Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_API_ENDPOINT = "http://localhost:4000/api/"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TBD

## Styleguide

This project is using the styleguide as defined in the [Infinum Handbook v2020.09](link_to_tag) and [Styleguide Project v2020.09](link_to_tagged_project).
This project is using the styleguide as defined in the [Infinum Handbook v2020.09](https://infinum.com/handbook/books/frontend/react/css-in-js/chakra).

## Team

Expand Down
12 changes: 12 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');
const withPlugins = require('next-compose-plugins');
const withReactSvg = require('next-react-svg');

module.exports = withPlugins([
[
withReactSvg,
{
include: path.resolve(__dirname, 'src/assets/icons'),
},
],
]);
4,998 changes: 3,024 additions & 1,974 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,26 @@
"api:dev": "tsnd --pretty --project ./api/tsconfig.json ./api"
},
"dependencies": {
"@emotion/core": "^10.0.35",
"@emotion/styled": "^10.0.27",
"@chakra-ui/react": "^1.4.1",
"@emotion/react": "^11.1.5",
"@emotion/styled": "^11.1.5",
"datx": "^2.0.0-beta.4",
"datx-network": "^2.0.0-beta.7",
"framer-motion": "^4.0.0",
"knex": "^0.95.2",
"koa": "^2.13.1",
"kurier": "^1.1.0-alpha1",
"mobx": "4",
"next": "9.5.3",
"next-compose-plugins": "^2.2.1",
"next-react-svg": "^1.1.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"sqlite3": "^5.0.2"
},
"devDependencies": {
"@infinumjs/eslint-config-react": "^2.0.0",
"@types/jest": "^26.0.21",
"@types/node": "^14.11.2",
"@types/react": "^16.9.49",
"eslint": "^7.9.0",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/fonts/GT-Haptik-Bold.ttf
Binary file not shown.
Binary file added public/fonts/GT-Haptik-Regular.ttf
Binary file not shown.
Binary file added public/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions public/vercel.svg

This file was deleted.

1 change: 1 addition & 0 deletions src/assets/icons/ic-moon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/ic-sun.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
9 changes: 9 additions & 0 deletions src/components/shared/Navigation/Navigation.elements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { chakra } from '@chakra-ui/react';

export const NavigationWrapper = chakra('nav', {
baseStyle: {
py: 6,
mx: 'auto',
maxWidth: '800px',
},
});
29 changes: 29 additions & 0 deletions src/components/shared/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { FC } from 'react';
import { Box, Flex, Image, useColorMode, IconButton, Button } from '@chakra-ui/react';

import { NavigationWrapper } from './Navigation.elements';

import MoonIcon from '@/assets/icons/ic-moon.svg';
import SunIcon from '@/assets/icons/ic-sun.svg';

export const Navigation: FC = () => {
const { colorMode, toggleColorMode } = useColorMode();

return (
<NavigationWrapper>
<Flex justifyContent="space-between">
<Image src="/images/logo.png" htmlWidth="80px" />
<Box>
<Button disabled mr={2}>
Logout
</Button>
<IconButton
aria-label="Toggle color mode"
onClick={toggleColorMode}
icon={<Box w="16px" as={colorMode === 'light' ? MoonIcon : SunIcon} />}
/>
</Box>
</Flex>
</NavigationWrapper>
);
};
Empty file removed src/components/ui/.gitignore
Empty file.
20 changes: 20 additions & 0 deletions src/components/utilities/Meta/Meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { FC } from 'react';
import Head from 'next/head';

interface IHeadProps {
title?: string;
description?: string;
}

export const Meta: FC<IHeadProps> = ({
title = 'React Example | Infinum',
description = 'Javascript React Example project landing page ',
}) => {
return (
<Head>
<title>{title}</title>
<meta id="meta-description" name="description" content={description} />
<link rel="icon" href="/favicon.ico" />
</Head>
);
};
30 changes: 8 additions & 22 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import { Global, css } from '@emotion/core';
import React, { ReactElement } from 'react';
import type { AppProps } from 'next/app';
import { ReactElement } from 'react';
import { ChakraProvider } from '@chakra-ui/react';

const globalStyles = css`
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans,
Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
`;
import theme from '../styles/theme';
import { Fonts } from '../styles/Fonts';

function MyApp({ Component, pageProps }: AppProps): ReactElement {
return (
<>
<Global styles={globalStyles} />
<Component {...pageProps} />
<ChakraProvider theme={theme}>
<Fonts />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to preload fonts in _document

        <Head>
         <link
            rel="preload"
            href="/fonts/Space-Grotesk/SpaceGrotesk-Regular.woff"
            as="font"
            type="font/woff"
            crossOrigin="true"
          />
          </Head>

<Component {...pageProps} />
</ChakraProvider>
</>
);
}
Expand Down
25 changes: 25 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Document, { Html, Head, Main, NextScript } from 'next/document';

class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}

render() {
return (
<Html>
<Head>
<link rel="preload" href="/fonts/GT-Haptik-Regular.ttf" as="font" crossOrigin="true" />
<link rel="preload" href="/fonts/GT-Haptik-Bold.ttf" as="font" crossOrigin="true" />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument;
186 changes: 18 additions & 168 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,172 +1,22 @@
import styled from '@emotion/styled';
import Head from 'next/head';
import { ReactElement } from 'react';
import { NextPage } from 'next';
import React, { ReactElement } from 'react';
import { Container, Heading } from '@chakra-ui/react';

const Container = styled.div`
min-height: 100vh;
padding: 0 0.5rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`;
import { Meta } from '@/components/utilities/Meta/Meta';
import { Navigation } from '@/components/shared/Navigation/Navigation';

const Main = styled.main`
padding: 5rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`;

const Footer = styled.footer`
width: 100%;
height: 100px;
border-top: 1px solid #eaeaea;
display: flex;
justify-content: center;
align-items: center;
`;

const FooterImage = styled.img`
margin-left: 0.5rem;
height: 1em;
`;

const FooterLink = styled.a`
display: flex;
justify-content: center;
align-items: center;
`;

const Title = styled.h1`
margin: 0;
line-height: 1.15;
font-size: 4rem;
text-align: center;
`;

const TitleLink = styled.a`
color: #0070f3;
text-decoration: none;

&:hover,
&:focus,
&:active {
text-decoration: underline;
}
`;

const Description = styled.p`
line-height: 1.5;
font-size: 1.5rem;
text-align: center;
`;

const Code = styled.code`
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New,
monospace;
`;

const Grid = styled.div`
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;

max-width: 800px;
margin-top: 3rem;

@media (max-width: 600px) {
width: 100%;
flex-direction: column;
}
`;

const Card = styled.a`
margin: 1rem;
flex-basis: 45%;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;

&:hover,
&:focus,
&:active {
color: #0070f3;
border-color: #0070f3;
}
`;

const CardTitle = styled.h3`
margin: 0 0 1rem 0;
font-size: 1.5rem;
`;

const CardContent = styled.p`
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
`;

export default function Home(): ReactElement {
const Home: NextPage = () => {
return (
<Container>
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<Main>
<Title>
Welcome to <TitleLink href="https://nextjs.org">Next.js!</TitleLink>
</Title>

<Description>
Get started by editing <Code>pages/index.js</Code>
</Description>

<Grid>
<Card href="https://nextjs.org/docs">
<CardTitle>Documentation &rarr;</CardTitle>
<CardContent>Find in-depth information about Next.js features and API.</CardContent>
</Card>

<Card href="https://nextjs.org/learn">
<CardTitle>Learn &rarr;</CardTitle>
<CardContent>Learn about Next.js in an interactive course with quizzes!</CardContent>
</Card>

<Card href="https://github.com/vercel/next.js/tree/master/examples">
<CardTitle>Examples &rarr;</CardTitle>
<CardContent>Discover and deploy boilerplate example Next.js projects.</CardContent>
</Card>

<Card href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app">
<CardTitle>Deploy &rarr;</CardTitle>
<CardContent>Instantly deploy your Next.js site to a public URL with Vercel.</CardContent>
</Card>
</Grid>
</Main>

<Footer>
<FooterLink
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by <FooterImage src="/vercel.svg" alt="Vercel Logo" />
</FooterLink>
</Footer>
</Container>
<>
<Meta />
<Navigation />
<Container>
<section>
<Heading>Infinum todo list</Heading>
</section>
</Container>
</>
);
}
};

export default Home;
Loading