Skip to content

Commit

Permalink
feat(core): Added page 404
Browse files Browse the repository at this point in the history
  • Loading branch information
wootsbot committed Aug 10, 2023
1 parent 497b429 commit ebd5ea6
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-bags-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'x-boilerplate': minor
---

Added page 404
6 changes: 6 additions & 0 deletions @design-system/button-go-back/ButtonGoBack.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
background-color: transparent;
}

.label {
text-decoration: none;
color: #000;
font-family: Arial, Helvetica, sans-serif;
}

.wrapper {
display: flex;
justify-content: center;
Expand Down
12 changes: 8 additions & 4 deletions @design-system/button-go-back/ButtonGoBack.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import Link from 'next/link';

import ArrowLeftLine from '@design-system/icons/ArrowLeftLine';

import styles from './ButtonGoBack.module.css';
import { ButtonGoBackProps } from './ButtonGoBack.types';

function ButtonGoBack({ label, ...props }: ButtonGoBackProps) {
function ButtonGoBack({ label, to, ...props }: ButtonGoBackProps) {
const Component = to ? Link : 'button';

return (
<button className={styles.root} {...props}>
<Component href={to ?? ''} className={styles.root} {...props}>
<div className={styles.wrapper}>
<ArrowLeftLine />
</div>

{label}
</button>
<span className={styles.label}>{label}</span>
</Component>
);
}

Expand Down
1 change: 1 addition & 0 deletions @design-system/button-go-back/ButtonGoBack.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type ButtonGoBackProps = {
label: string;
onClick?: () => void;
to?: string;
};
3 changes: 3 additions & 0 deletions @design-system/typography/Typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { HeadingProps } from './Typography.types';
const fontSizes = {
s: '14px',
m: '20px',
l: '24px',
xl: '32',
'2xl': '40px',
};

function Typography(props: HeadingProps) {
Expand Down
2 changes: 1 addition & 1 deletion @design-system/typography/Typography.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { ElementType, HTMLAttributes } from 'react';

export interface HeadingProps extends HTMLAttributes<HTMLElement> {
as?: ElementType<HTMLAttributes<HTMLElement>>;
size?: 's' | 'm';
size?: 's' | 'm' | 'l' | 'xl' | '2xl';
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

- 馃 TypeScript, of course

- 馃拕 Unstyled - The frontend contains minimal css styling just to show the demo.
- 馃拕 Unstyled - The frontend contains minimal css styling just the demo.

- 鈿欙笍 Adjustable to your preferences - Designed to be modular so you can fine-tune it to your preferences

Expand Down Expand Up @@ -83,6 +83,7 @@ Many of this boilerplate features are based on the philosophy of being optional.
- [x] Integrate https://chakra-ui.com/
- [x] Dark mode
- [x] Integrate graphql
- [x] Do `cli` to configure all functions

### Dev tools

Expand Down
2 changes: 1 addition & 1 deletion app/(i18next)/i18next/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Header from '@/components/header';

function I18nextPage() {
const router = useRouter();
const { t, i18n } = useTranslation(['common', 'i18next']);
const { t } = useTranslation(['common', 'i18next']);

function handleGoBack() {
router.push('/');
Expand Down
18 changes: 18 additions & 0 deletions app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Link from 'next/link';
import * as React from 'react';

import ButtonGoBack from '@design-system/button-go-back';
import Typography from '@design-system/typography';

function NotFoundPage(): JSX.Element {
return (
<div>
<Typography as="h1" size="2xl">
404 page
</Typography>
<ButtonGoBack to="/" label="Go back" />
</div>
);
}

export default NotFoundPage;

0 comments on commit ebd5ea6

Please sign in to comment.