This file contains hidden or 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
| import React from 'react'; | |
| import AppNavigation from './AppNavigation'; | |
| import {ToastProvider} from './ToastContext'; | |
| import Toast from './Toast'; | |
| export default class App extends React.Component { | |
| render() { | |
| return ( | |
| <ToastProvider> | |
| <Toast /> |
This file contains hidden or 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
| import React from 'react'; | |
| import AppNavigation from './AppNavigation'; | |
| import {ToastProvider} from './ToastContext'; | |
| import Toast from './Toast'; | |
| const App = () => ( | |
| <ToastProvider> | |
| <Toast /> | |
| <AppNavigation /> | |
| </ToastProvider> |
This file contains hidden or 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
| import React, {useContext} from 'react'; | |
| import {View, Text, TouchableOpacity, StyleSheet} from 'react-native'; | |
| import {ToastContext} from './ToastContext'; | |
| const HomeScreen = () => { | |
| const {show} = useContext(ToastContext); | |
| return ( | |
| <View style={styles.container}> | |
| <TouchableOpacity onPress={() => show({message: 'Ama simple Toast!'})}> |
This file contains hidden or 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
| export const pageQuery = graphql` | |
| query BlogPostBySlug($slug: String!) { | |
| contentfulBlogPost(slug: { eq: $slug }) { | |
| title | |
| publishDate(formatString: "MMMM Do, YYYY") | |
| heroImage { | |
| fluid(maxWidth: 1180, background: "rgb:000000") { | |
| ...GatsbyContentfulFluid_tracedSVG | |
| } | |
| } |
This file contains hidden or 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
| export const pageQuery = graphql` | |
| query BlogPostBySlug($slug: String!) { | |
| contentfulBlogPost(slug: { eq: $slug }) { | |
| title | |
| publishDate(formatString: "MMMM Do, YYYY") | |
| heroImage { | |
| fluid(maxWidth: 1180, background: "rgb:000000") { | |
| ...GatsbyContentfulFluid_tracedSVG | |
| } | |
| } |
This file contains hidden or 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
| query BlogPostBySlug($slug: String!) { | |
| contentfulBlogPost(slug: { eq: $slug }) { | |
| contentReferences { | |
| ... on ContentfulCodeComponent { | |
| url | |
| __typename | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or 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
| import React from "react" | |
| import { graphql } from "gatsby" | |
| const CodeComponent = () => <div><span></span></div> | |
| export default CodeComponent | |
| export const query = graphql` | |
| fragment CodeComponentFragment on ContentfulCodeComponent { | |
| url |
This file contains hidden or 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
| export const pageQuery = graphql` | |
| query BlogPostBySlug($slug: String!) { | |
| contentfulBlogPost(slug: { eq: $slug }) { | |
| title | |
| publishDate(formatString: "MMMM Do, YYYY") | |
| heroImage { | |
| fluid(maxWidth: 1180, background: "rgb:000000") { | |
| ...GatsbyContentfulFluid_tracedSVG | |
| } | |
| } |
This file contains hidden or 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
| export const pageQuery = graphql` | |
| query BlogPostBySlug($slug: String!) { | |
| contentfulBlogPost(slug: { eq: $slug }) { | |
| title | |
| publishDate(formatString: "MMMM Do, YYYY") | |
| heroImage { | |
| fluid(maxWidth: 1180, background: "rgb:000000") { | |
| ...GatsbyContentfulFluid_tracedSVG | |
| } | |
| } |
This file contains hidden or 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
| const content = () => { | |
| if(post.contentReferences) { | |
| return(post.contentReferences.map(reference => { | |
| switch(reference.__typename) { | |
| case 'ContentfulCodeComponent': { | |
| return <CodeComponent {...reference} /> | |
| } | |
| default: | |
| return null | |
| } |