-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create header and creating hero banner
- Loading branch information
=
committed
Mar 26, 2022
1 parent
b990362
commit b45c659
Showing
19 changed files
with
1,353 additions
and
239 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
images: { | ||
domains: ['media.graphcms.com'], | ||
} | ||
} | ||
|
||
module.exports = nextConfig |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
import { Flex } from "@chakra-ui/react" | ||
import { Logo } from "./Logo" | ||
import { Navbar } from "./Navbar" | ||
|
||
export const Header = () => { | ||
return ( | ||
<Flex as="header" | ||
bg="brand.primary" | ||
align="center" | ||
justify="space-around" | ||
py="4" | ||
> | ||
<Logo /> | ||
<Navbar /> | ||
</Flex> | ||
) | ||
} |
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,21 @@ | ||
import { Flex } from "@chakra-ui/react"; | ||
|
||
export type HeroBannerProps = { | ||
title: string, | ||
background: { | ||
url: string | ||
}, | ||
description: string, | ||
} | ||
|
||
export const HeroBanner = ({ title, background, description}: HeroBannerProps) => { | ||
return ( | ||
<Flex | ||
bgImage={`url(${background.url})`} | ||
height="20vh" | ||
> | ||
{ title } | ||
{ description } | ||
</Flex> | ||
) | ||
} |
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 Image from "next/image" | ||
|
||
export const Logo = () => { | ||
return ( | ||
<Image src="https://media.graphcms.com/OdWKElwPSEia9nfabuxw?_ga=2.34469153.1858804931.1648141850-710560506.1647625745" width={120} height={40} /> | ||
) | ||
} |
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,15 @@ | ||
import { Link as ChakraLink } from '@chakra-ui/react' | ||
import Link from "next/link" | ||
|
||
type NavItemProps = { | ||
href: string | ||
label: string | ||
} | ||
|
||
export const NavItem = ({ href, label }: NavItemProps) => { | ||
return ( | ||
<Link href={href} passHref> | ||
<ChakraLink>{label}</ChakraLink> | ||
</Link> | ||
) | ||
} |
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,12 @@ | ||
import { Flex } from "@chakra-ui/react" | ||
import { NavItem } from "./NavItem" | ||
|
||
export const Navbar = () => { | ||
return ( | ||
<Flex as="nav" gap="1.5rem"> | ||
<NavItem href="/" label="Home" /> | ||
<NavItem href="/about" label="About" /> | ||
<NavItem href="/blog" label="Blog" /> | ||
</Flex> | ||
) | ||
} |
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,15 @@ | ||
import { ChakraProvider } from '@chakra-ui/react' | ||
import type { AppProps } from 'next/app' | ||
import { Header } from '../components/Header' | ||
import { theme } from '../styles/theme' | ||
|
||
function MyApp({ Component, pageProps }: AppProps) { | ||
return ( | ||
<ChakraProvider resetCSS theme={theme}> | ||
<Header /> | ||
<Component {...pageProps} /> | ||
</ChakraProvider> | ||
) | ||
} | ||
|
||
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,34 @@ | ||
import { gql } from 'graphql-request'; | ||
import type { GetStaticProps } from 'next'; | ||
import { HeroBanner, HeroBannerProps } from '../components/HeroBanner'; | ||
import { graphcms } from '../services/graphcms'; | ||
|
||
const Home = ({title, background, description}: HeroBannerProps) => { | ||
return ( | ||
<HeroBanner | ||
title={title} | ||
background={background} | ||
description={description} | ||
/> | ||
) | ||
} | ||
|
||
export const getStaticProps: GetStaticProps = async () => { | ||
const query = gql` | ||
{ | ||
heroBanner(where: {slug: "hero-principal"}) { | ||
title, | ||
background { | ||
url | ||
}, | ||
description | ||
} | ||
} | ||
` | ||
const { heroBanner } = await graphcms.request(query) | ||
return { | ||
props: {...heroBanner}, | ||
} | ||
} | ||
|
||
export default Home |
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,4 @@ | ||
import { GraphQLClient } from 'graphql-request'; | ||
export const graphcms = new GraphQLClient( | ||
'https://api-sa-east-1.graphcms.com/v2/cl176t5goieg801ywh05mbs03/master' | ||
); |
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,11 @@ | ||
import { extendTheme } from '@chakra-ui/react' | ||
|
||
const colors = { | ||
brand: { | ||
primary: '#FDC906', | ||
secondary: '#414141', | ||
tertiary: '#242121', | ||
}, | ||
} | ||
|
||
export const theme = extendTheme({ colors }) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.