This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
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.
Merge pull request #9 from trisbee/dev/example-dynamic
fixed assets bug
- Loading branch information
Showing
15 changed files
with
7,828 additions
and
17 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,24 @@ | ||
import Layout from "../../../src/components/Layout"; | ||
|
||
const YearPage = (props) => { | ||
return ( | ||
<Layout> | ||
<h1>Selected year is: {props.year}</h1> | ||
<ul> | ||
<li>Selected model is: {props.model}</li> | ||
<li>Selected brand is: {props.brand}</li> | ||
</ul> | ||
</Layout> | ||
); | ||
}; | ||
|
||
YearPage.getInitialProps = ({ query }) => { | ||
const { year, model, brand } = query; | ||
return { | ||
year: year, | ||
model: model, | ||
brand: brand | ||
} | ||
}; | ||
|
||
export default YearPage; |
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,22 @@ | ||
import Layout from "../../src/components/Layout"; | ||
|
||
const ModelPage = (props) => { | ||
return ( | ||
<Layout> | ||
<h1>Selected model is: {props.year}</h1> | ||
<ul> | ||
<li>Selected brand is: {props.brand}</li> | ||
</ul> | ||
</Layout> | ||
); | ||
}; | ||
|
||
ModelPage.getInitialProps = ({ query }) => { | ||
const { year, model, brand } = query; | ||
return { | ||
model: model, | ||
brand: brand | ||
} | ||
}; | ||
|
||
export default ModelPage; |
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,18 @@ | ||
import Layout from "../src/components/Layout"; | ||
|
||
const BrandPage = (props) => { | ||
return ( | ||
<Layout> | ||
<h1>Selected brand is: {props.brand}</h1> | ||
</Layout> | ||
); | ||
}; | ||
|
||
BrandPage.getInitialProps = ({ query }) => { | ||
const { brand } = query; | ||
return { | ||
brand: brand | ||
} | ||
}; | ||
|
||
export default BrandPage; |
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,36 @@ | ||
import Document, { Head, Main, NextScript } from 'next/document'; | ||
// Import styled components ServerStyleSheet | ||
import { ServerStyleSheet } from 'styled-components'; | ||
|
||
export default class MyDocument extends Document { | ||
static getInitialProps({ renderPage }) { | ||
// Step 1: Create an instance of ServerStyleSheet | ||
const sheet = new ServerStyleSheet(); | ||
|
||
// Step 2: Retrieve styles from components in the page | ||
const page = renderPage((App) => (props) => | ||
sheet.collectStyles(<App {...props} />), | ||
); | ||
|
||
// Step 3: Extract the styles as <style> tags | ||
const styleTags = sheet.getStyleElement(); | ||
|
||
// Step 4: Pass styleTags as a prop | ||
return { ...page, styleTags }; | ||
} | ||
|
||
render() { | ||
return ( | ||
<html> | ||
<Head> | ||
{/* Step 5: Output the styles in the head */} | ||
{this.props.styleTags} | ||
</Head> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
} |
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,5 +1,11 @@ | ||
import Layout from "./src/components/Layout"; | ||
|
||
const Home = () => { | ||
return <h1>Hello world, I am an index page</h1> | ||
return ( | ||
<Layout> | ||
<h1>Hello world, I am an index page</h1> | ||
</Layout> | ||
) | ||
}; | ||
|
||
export default Home; |
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,51 @@ | ||
import { createGlobalStyle } from 'styled-components'; | ||
|
||
const GlobalStyle = createGlobalStyle` | ||
:root { | ||
--font-base: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; | ||
} | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
html, body { | ||
width: 100%; | ||
min-height: 100vh; | ||
scroll-behavior: smooth; | ||
overflow-y: ${props => (props.loading ? 'hidden' : 'auto')} | ||
} | ||
body { | ||
line-height: 1.5; | ||
font-size: 14px; | ||
font-family: var(--font-base); | ||
color: #666; | ||
} | ||
a { | ||
color: #959595; | ||
text-decoration: underline; | ||
&:hover { | ||
color: #000; | ||
} | ||
} | ||
/* Disable arrows in number input type | ||
Chrome, Safari, Edge, Opera */ | ||
input::-webkit-outer-spin-button, | ||
input::-webkit-inner-spin-button { | ||
-webkit-appearance: none; | ||
margin: 0; | ||
} | ||
/* Firefox */ | ||
input[type=number] { | ||
-moz-appearance: textfield; | ||
} | ||
`; | ||
|
||
export default GlobalStyle; |
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,21 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import GlobalStyle from "../GlobalStyle"; | ||
|
||
function Layout(props) { | ||
return ( | ||
<Wrapper> | ||
<GlobalStyle /> | ||
{props.children} | ||
</Wrapper> | ||
); | ||
} | ||
|
||
const Wrapper = styled.div` | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 20px 25px; | ||
background: #F0F0F0; | ||
`; | ||
|
||
export default Layout; |
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,5 +1,11 @@ | ||
import Layout from "./src/components/Layout"; | ||
|
||
const Subpage = () => { | ||
return <h1>I am a subpage</h1> | ||
return ( | ||
<Layout> | ||
<h1>I am a subpage</h1> | ||
</Layout> | ||
) | ||
}; | ||
|
||
export default Subpage; |
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