forked from reactplay/react-play
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,100 additions
and
922 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
import PageNotFound from './404/PageNotFound'; | ||
import Footer from './footer/Footer'; | ||
import Header from './header/Header'; | ||
import Home from './home/Home'; | ||
import Modal from './modal'; | ||
|
||
export { | ||
Header, | ||
Footer, | ||
Home, | ||
PageNotFound, | ||
Modal | ||
}; | ||
import PageNotFound from "./404/PageNotFound"; | ||
import Footer from "./footer/Footer"; | ||
import Header from "./header/Header"; | ||
import Home from "./home/Home"; | ||
import Modal from "./modal"; | ||
import DefMeta from "meta/DefMeta"; | ||
import PlayMeta from "./playlists/PlayMeta"; | ||
|
||
export { Header, Footer, Home, PageNotFound, Modal, PlayMeta, DefMeta }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { cloneElement } from "react"; | ||
import { Helmet } from "react-helmet"; | ||
|
||
function PlayMeta({ id, name, description, path, cover, component }) { | ||
const playFolder = path.split("/")[2]; | ||
|
||
let metaImage; // Initialize metaImage variable | ||
if (cover) { | ||
metaImage = cover; // If cover path is given, use that | ||
} else { | ||
try { | ||
// If not, try finding the cover.png in the play's folder | ||
metaImage = require(`../../plays/${playFolder}/cover.png`); | ||
} catch { | ||
// If no image is available, cover stays as undefined | ||
console.log("No cover available."); | ||
} | ||
} | ||
|
||
return ( | ||
<> | ||
<Helmet> | ||
<meta name="description" content={description} /> | ||
<meta property="og:title" content={name} /> | ||
<meta property="og:description" content={description} /> | ||
{metaImage && ( | ||
<meta | ||
property="og:image" | ||
content={metaImage} | ||
data-react-helmet="true" | ||
/> | ||
)} | ||
<meta | ||
property="og:image:alt" | ||
content={description} | ||
data-react-helmet="true" | ||
/> | ||
<meta name="twitter:title" content={name} data-react-helmet="true" /> | ||
<meta | ||
name="twitter:description" | ||
content={description} | ||
data-react-helmet="true" | ||
/> | ||
{metaImage && ( | ||
<meta | ||
name="twitter:image" | ||
content={metaImage} | ||
data-react-helmet="true" | ||
/> | ||
)} | ||
</Helmet> | ||
{cloneElement(component(), { id })} | ||
</> | ||
); | ||
} | ||
|
||
export default PlayMeta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Helmet } from "react-helmet"; | ||
|
||
function DefMeta() { | ||
return ( | ||
<Helmet> | ||
<meta | ||
name="description" | ||
content="ReactPlay is an open-source application to learn, create and | ||
share ReactJS projects with the developer community." | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="ReactPlay is an open-source application to learn, create and | ||
share ReactJS projects with the developer community." | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
property="og:title" | ||
content="ReactPlay - One app to learn, create, and share ReactJS projects." | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
property="og:image" | ||
content="/og-image.png" // React should default these to public | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
property="og:image:alt" | ||
content="Start React Code Arena with ReactPlay" | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
name="twitter:site" | ||
content="@ReactPlayIO" | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
name="twitter:title" | ||
content="ReactPlay - One app to learn, create, and share ReactJS projects." | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
name="twitter:description" | ||
content="ReactPlay is an open-source application to learn, create and | ||
share ReactJS projects with the developer community." | ||
data-react-helmet="true" | ||
/> | ||
<meta | ||
name="twitter:image" | ||
content="/og-image.png" // React should default these to public | ||
data-react-helmet="true" | ||
/> | ||
</Helmet> | ||
); | ||
} | ||
|
||
export default DefMeta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.