-
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
1 parent
db5d0ee
commit 675f194
Showing
12 changed files
with
265 additions
and
166 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { DefaultTheme, CSSProp } from "styled-components"; | ||
import { theme } from "styles/theme"; | ||
|
||
declare module "styled-components" { | ||
type Theme = typeof theme; | ||
export interface DefaultTheme extends Theme {} | ||
} |
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,40 @@ | ||
import { FunctionComponent } from "react"; | ||
import styled from "styled-components"; | ||
|
||
export const Info: FunctionComponent = () => { | ||
return ( | ||
<Container> | ||
<h2>Vardagsmaten</h2> | ||
<p>Något som inte faller i smaken? Tryck på ikonen i hörnet</p> | ||
|
||
<i>Skapat av Joakim Jäderberg</i> | ||
</Container> | ||
); | ||
}; | ||
|
||
const Container = styled.div` | ||
display: grid; | ||
grid-template-areas: | ||
"heading" | ||
"info" | ||
"creator"; | ||
text-align: center; | ||
padding: 30px; | ||
h2 { | ||
grid-area: heading; | ||
align-self: end; | ||
} | ||
p { | ||
grid-area: info; | ||
align-self: flex-start; | ||
} | ||
i { | ||
grid-area: creator; | ||
font-size: 1vmax; | ||
text-align: right; | ||
align-self: end; | ||
} | ||
`; |
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,28 +1,58 @@ | ||
import { Recipe } from "../../models/recipie"; | ||
import { AutoId } from "../util"; | ||
|
||
export async function getRecipies({ | ||
count, | ||
}: { | ||
count: number; | ||
}): Promise<Recipe[]> { | ||
let recipes: Recipe[] = []; | ||
|
||
// firebase has no current way of fetching multiple random documents at once | ||
while (recipes.length < count) { | ||
const recipe: Recipe = { | ||
id: "123", | ||
recipe_links: [ | ||
"https://www.koket.se/mitt-kok/jennie-wallden/klassisk-kottfarssas-med-spaghetti", | ||
"https://www.arla.se/recept/kottfarssas/", | ||
], | ||
title: "Spaghetti och köttfärssås", | ||
tags: ["barnvänligt", "snabbt"], | ||
}; | ||
recipes = [...recipes, recipe]; | ||
} | ||
|
||
return recipes; | ||
return mockData.slice(0, count); | ||
} | ||
|
||
export async function addRecipe({ recipe }: { recipe: Recipe }) {} | ||
|
||
const mockData: Recipe[] = [ | ||
{ | ||
id: "1", | ||
recipe_links: [ | ||
"https://www.koket.se/mitt-kok/jennie-wallden/klassisk-kottfarssas-med-spaghetti", | ||
"https://www.arla.se/recept/kottfarssas/", | ||
], | ||
title: "Spaghetti och köttfärssås", | ||
tags: ["barnvänligt", "snabbt"], | ||
}, | ||
{ | ||
id: "2", | ||
recipe_links: [], | ||
title: "Blodpudding", | ||
tags: ["barnvänligt", "snabbt"], | ||
}, | ||
{ | ||
id: "3", | ||
recipe_links: [ | ||
"https://www.koket.se/mitt-kok/jennie-wallden/klassisk-kottfarssas-med-spaghetti", | ||
"https://www.arla.se/recept/kottfarssas/", | ||
], | ||
title: "Kyckling parmesan", | ||
tags: [], | ||
}, | ||
{ | ||
id: "4", | ||
recipe_links: [ | ||
"https://www.koket.se/mitt-kok/jennie-wallden/klassisk-kottfarssas-med-spaghetti", | ||
"https://www.arla.se/recept/kottfarssas/", | ||
"https://www.tasteline.se/recept/kottfarssas/", | ||
], | ||
title: "Souvlaki", | ||
tags: [], | ||
}, | ||
{ | ||
id: "5", | ||
recipe_links: [ | ||
"https://www.koket.se/mitt-kok/jennie-wallden/klassisk-kottfarssas-med-spaghetti", | ||
"https://www.arla.se/recept/kottfarssas/", | ||
"https://www.tasteline.se/recept/kottfarssas/", | ||
], | ||
title: "Fishtacos", | ||
tags: ["fisk"], | ||
}, | ||
]; |
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,8 +1,15 @@ | ||
import '../styles/globals.css' | ||
import type { AppProps } from 'next/app' | ||
import "../styles/globals.css"; | ||
import type { AppProps } from "next/app"; | ||
import { ThemeProvider } from "styled-components"; | ||
import { theme } from "../styles/theme"; | ||
|
||
console.log(theme); | ||
function MyApp({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} /> | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<Component {...pageProps} /> | ||
</ThemeProvider> | ||
); | ||
} | ||
|
||
export default MyApp | ||
export default MyApp; |
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,49 @@ | ||
import Document, { | ||
DocumentContext, | ||
Html, | ||
Head, | ||
Main, | ||
NextScript, | ||
} from "next/document"; | ||
import { ServerStyleSheet } from "styled-components"; | ||
|
||
export default class MyDocument extends Document { | ||
static async getInitialProps(ctx: DocumentContext) { | ||
const sheet = new ServerStyleSheet(); | ||
const originalRenderPage = ctx.renderPage; | ||
|
||
try { | ||
ctx.renderPage = () => | ||
originalRenderPage({ | ||
enhanceApp: (App) => (props) => | ||
sheet.collectStyles(<App {...props} />), | ||
}); | ||
|
||
const initialProps = await Document.getInitialProps(ctx); | ||
|
||
return { | ||
...initialProps, | ||
styles: ( | ||
<> | ||
{initialProps.styles} | ||
{sheet.getStyleElement()} | ||
</> | ||
), | ||
}; | ||
} finally { | ||
sheet.seal(); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<Html> | ||
<Head /> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
</body> | ||
</Html> | ||
); | ||
} | ||
} |
Oops, something went wrong.