-
Notifications
You must be signed in to change notification settings - Fork 2
styling - chakra #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fb92961
setup basic chakra
5d79eaa
add color mode
2b26a6b
Merge branch 'master' into styling
1257dc4
change type for page
49c5275
change color name
26a55b0
add svg laoder
0f99bcc
change module path naming and preload fonts
b1c43e6
add jest typings
898fc11
Update src/components/shared/Navigation/Navigation.tsx
mamihelj09 8ca020e
fix tabs/spaces mix
7ab4504
Merge branch 'styling' of github.com:infinum/JS-React-Example into st…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| NEXT_PUBLIC_API_ENDPOINT = "http://localhost:4000/api/" |
This file contains hidden or 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 hidden or 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,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'), | ||
| }, | ||
| ], | ||
| ]); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains hidden or 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,9 @@ | ||
| import { chakra } from '@chakra-ui/react'; | ||
|
|
||
| export const NavigationWrapper = chakra('nav', { | ||
| baseStyle: { | ||
| py: 6, | ||
| mx: 'auto', | ||
| maxWidth: '800px', | ||
| }, | ||
| }); |
This file contains hidden or 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,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.
This file contains hidden or 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,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> | ||
| ); | ||
| }; |
This file contains hidden or 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 hidden or 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,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; |
This file contains hidden or 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,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 →</CardTitle> | ||
| <CardContent>Find in-depth information about Next.js features and API.</CardContent> | ||
| </Card> | ||
|
|
||
| <Card href="https://nextjs.org/learn"> | ||
| <CardTitle>Learn →</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 →</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 →</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; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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