Skip to content

Commit

Permalink
Remove some unused components, start putting styles and page structur…
Browse files Browse the repository at this point in the history
…e in place
  • Loading branch information
jaaniles committed Oct 23, 2021
1 parent b197e86 commit 00dd367
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 256 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Kaikualttiin Helsingin vaikutusvaltaisin Olutkerho
```
└─src
├── @types
Global styles
Global types
├── assets
Contains images and svgs
├── atoms
Expand Down
19 changes: 10 additions & 9 deletions src/design.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export const colors = {
error700: "#d32f2f",
error800: "#c62828",
error900: "#b71c1c",
text100: "#000000",
text200: "#080808",
text300: "#111111",
text400: "#191919",
text500: "#222222",
text600: "#2b2b2b",
text700: "#333333",
text800: "#3b3b3b",
text900: "#424242",
text100: "#ffffff",
text200: "#f6f6f6",
text300: "#ededed",
text400: "#e3e3e3",
text500: "#dadada",
text600: "#cacaca",
text700: "#c8c8c8",
text800: "#bfbfbf",
text900: "#b5b5b5",
background900: "#acacac",
background800: "#b5b5b5",
background700: "#bfbfbf",
Expand All @@ -65,6 +65,7 @@ export const globalStyles = css({
color: colors.text200,
height: "100%",
backgroundColor: colors.background300,
background: "linear-gradient(180deg, #2E2836 0%, #150F19 100%)",
WebkitFontSmoothing: "antialiased",
},
button: {
Expand Down
9 changes: 0 additions & 9 deletions src/pages/r/[subreddit].tsx

This file was deleted.

103 changes: 2 additions & 101 deletions src/pagesWithContext/IndexPage/IndexPage.tsx
Original file line number Diff line number Diff line change
@@ -1,111 +1,12 @@
import Image from "next/image";
import { useRouter } from "next/router";
import React, { FC, useCallback } from "react";
import { useForm } from "react-hook-form";
import { FormattedMessage, useIntl, defineMessages } from "react-intl";

import { Button } from "~/atoms/Button";
import { Column } from "~/atoms/Column";
import { Icon } from "~/atoms/Icon";
import React, { FC } from "react";
import { PageContent } from "~/atoms/PageContent";
import { TextField } from "~/atoms/TextField";
import { H1 } from "~/atoms/typography/H1";
import { commonMessages } from "~/commonMessages";
import { scale } from "~/design";
import { LanguageSelector } from "~/molecules/LanguageSelector";
import { getSubredditPage } from "~/paths";

const messages = defineMessages({
title: {
id: "pages.index.title",
defaultMessage: "Go to subreddit",
},
subreddit: {
id: "pages.index.subreddit",
defaultMessage: "Subreddit",
},
placeholder: {
id: "pages.index.input.placeholder",
defaultMessage: "all",
},
subredditRequired: {
id: "pages.index.subredditRequired",
defaultMessage: "Subreddit is required",
},
});

export const IndexPage: FC = () => {
const intl = useIntl();
const router = useRouter();

const { handleSubmit, register, errors, getValues } = useForm({
mode: "onChange",
reValidateMode: "onChange",
shouldFocusError: true,
defaultValues: {
subreddit: "all",
},
});

const onSubmit = useCallback(() => {
const { subreddit } = getValues();

const { href, as } = getSubredditPage({ subreddit });
router.push(href, as);
}, [getValues, router]);

return (
<PageContent>
<Column alignCenter>
<form
css={({ scale }) => ({
padding: scale(6),
width: "100%",
maxWidth: scale(120),
})}
onSubmit={handleSubmit(onSubmit)}
>
<div
css={{
maxWidth: scale(40),
margin: "0 auto",
marginBottom: scale(14),
}}
>
<Image
src="/logo-fraktio-transparent.png"
alt="Fraktio"
layout="intrinsic"
width={792}
height={213}
/>
</div>
<H1 css={({ scale }) => ({ marginBottom: scale(6) })}>
<FormattedMessage {...messages.title} />
<Icon name="camera" />
</H1>

<TextField
id="subreddit"
required
label={intl.formatMessage(messages.subreddit)}
name="subreddit"
ref={register({
required: true,
maxLength: 64,
})}
placeholder={intl.formatMessage(messages.placeholder)}
error={
errors.subreddit && intl.formatMessage(messages.subredditRequired)
}
/>

<Button css={{ width: "100%" }} type="submit">
<FormattedMessage {...commonMessages.submit} />
</Button>
</form>
<LanguageSelector />
</Column>
<H1>Olutkerho.fi</H1>
</PageContent>
);
};
67 changes: 0 additions & 67 deletions src/pagesWithContext/SubredditPage/SubredditPage.tsx

This file was deleted.

33 changes: 0 additions & 33 deletions src/pagesWithContext/SubredditPage/subredditQueries.ts

This file was deleted.

26 changes: 0 additions & 26 deletions src/pagesWithContext/SubredditPage/subredditStatic.ts

This file was deleted.

14 changes: 4 additions & 10 deletions src/translations/fi.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{
"app.head.description": "Kanalautanen simppelillä reddit hakukoneella",
"app.head.title": "Next.js Kanalautanen",
"app.head.description": "Olutkerho, No Limits",
"app.head.title": "Olutkerho",
"defaultMessages.submit": "Lähetä",
"head.title.fix": "{title} - Next.js Rest Kanalautanen",
"head.title.fix": "{title} - No Limits",
"languages.en": "Englanti",
"languages.fi": "Suomi",
"pages.genericError.title": "Virhe",
"pages.index.input.placeholder": "all",
"pages.index.subreddit": "Subreddit",
"pages.index.subredditRequired": "Subreddit on vaadittu",
"pages.index.title": "Subreddit",
"pages.r.head.description": "Katso postauksia r/{subreddit}",
"pages.r.head.title": "r/{subreddit}",
"pages.r.title": "Subreddit"
"pages.index.input.placeholder": "all"
}

0 comments on commit 00dd367

Please sign in to comment.