Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Better Expo/example wrapper title (#102)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #102

Changing the document title for the Expo and example wrapper pages to show the Expo Snack slug or the example slug in the page title rather than a generic page title.

Reviewed By: chrisklaiber

Differential Revision: D38477091

fbshipit-source-id: 750f68db4445bf197220d8a7fe351dcd247940d4
  • Loading branch information
raedle authored and facebook-github-bot committed Aug 6, 2022
1 parent 4f0f293 commit dc64c7b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion website/src/components/ExampleLandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* @format
*/

import React from 'react';
import Head from '@docusaurus/Head';
import * as React from 'react';
import {useEffect} from 'react';
import LandingPageHeader from './LandingPageHeader';

Expand All @@ -30,7 +31,9 @@ export default function ExampleLandingPage({match, history}) {

return (
<div>
<Head title={`${slug} | PlayTorch Example`} />
<LandingPageHeader
heroTitle={slug}
nameOfSharedItem="example"
urlToOpenInPlayTorch={`playtorch://example?example=${slug}`}
/>
Expand Down
9 changes: 6 additions & 3 deletions website/src/components/ExpoSnackLandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
* @format
*/

import React from 'react';
import clsx from 'clsx';
import Head from '@docusaurus/Head';
import ExpoSnack from '@site/src/components/ExpoSnack';
import clsx from 'clsx';
import * as React from 'react';
import styles from './ExpoSnackLandingPage.module.css';
import RedirectStarterSnack from './RedirectStarterSnack';
import LandingPageHeader from './LandingPageHeader';
import RedirectStarterSnack from './RedirectStarterSnack';

export default function ExpoSnackLandingPage({match}) {
const {expoSnackPath} = match.params;
Expand All @@ -23,7 +24,9 @@ export default function ExpoSnackLandingPage({match}) {

return (
<div>
<Head title={`${expoSnackPath} | PlayTorch Snack`} />
<LandingPageHeader
heroTitle={expoSnackPath}
nameOfSharedItem="snack"
urlToOpenInPlayTorch={`playtorch://snack?snackUrl=exp://exp.host/${expoSnackPath}`}
/>
Expand Down
3 changes: 2 additions & 1 deletion website/src/components/LandingPageHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function AppStoreButton({href, LogoComponent, label}) {
}

export default function LandingPageHeader({
heroTitle,
urlToOpenInPlayTorch,
nameOfSharedItem,
}) {
Expand All @@ -37,7 +38,7 @@ export default function LandingPageHeader({
<div className="col col--10 col--offset--1">
<div className="hero">
<div className="container">
<h1 className="hero__title">PlayTorch</h1>
<h1 className="hero__title">{heroTitle}</h1>
<p className="hero__subtitle">
PlayTorch is a framework for rapidly creating cross-platform
mobile AI experiences.
Expand Down

1 comment on commit dc64c7b

@vercel
Copy link

@vercel vercel bot commented on dc64c7b Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.