-
Notifications
You must be signed in to change notification settings - Fork 0
Navbar gatsby #19
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
base: main
Are you sure you want to change the base?
Navbar gatsby #19
Changes from all commits
728f3dc
5de2251
8296d49
9b30319
792c07a
c4f2eb9
adb82bb
38bf1ff
909e10f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import 'bootstrap/dist/css/bootstrap.min.css'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
| declare module '*.svg' { | ||
| const content: string; | ||
| export default content; | ||
| } | ||
|
|
||
| declare module '*.module.scss'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| /* eslint-disable import/no-unresolved */ | ||
| /* eslint-disable jsx-a11y/anchor-is-valid */ | ||
| /* eslint-disable react/button-has-type */ | ||
| /* eslint-disable arrow-body-style */ | ||
| /* eslint-disable react/function-component-definition */ | ||
| import React from 'react'; | ||
| import { | ||
| Nav, | ||
| Button, | ||
| Navbar as NavbarBase, | ||
| Container, | ||
| Col, | ||
| } from 'react-bootstrap'; | ||
| import styled from 'styled-components'; | ||
| import { Link } from 'gatsby'; | ||
| import logo from '../images/logo.svg'; | ||
|
|
||
| interface LinkProps { | ||
| href?: string; | ||
| } | ||
|
|
||
| interface NavbarProps { | ||
| path: string; | ||
| } | ||
|
|
||
| const Navbar: React.FC<NavbarProps> = ({ path }) => { | ||
| return ( | ||
| <NavbarBaseStyled> | ||
| <ContainerStyled> | ||
| <LogoStyled href="/" as={Col}> | ||
| <img | ||
| src={logo} | ||
| width="113" | ||
| height="57" | ||
| className="d-inline-block align-top" | ||
| alt="React Bootstrap logo" | ||
| /> | ||
| </LogoStyled> | ||
|
|
||
| <NavStyled className="me-auto" as={Col}> | ||
| <NavLinkStyled to="/" href={`${path}`}> | ||
| Home | ||
| </NavLinkStyled> | ||
| <NavLinkStyled to="/blog" href={`${path}`}> | ||
| Blog | ||
| </NavLinkStyled> | ||
| <NavLinkStyled to="/acuc" href={`${path}`}> | ||
| A ÇUÇ | ||
| </NavLinkStyled> | ||
| </NavStyled> | ||
| <NavButtonStyled as={Col}> | ||
| <a> | ||
| <ButtonStyled variant="warning">Conhecer</ButtonStyled> | ||
| </a> | ||
| </NavButtonStyled> | ||
| </ContainerStyled> | ||
| </NavbarBaseStyled> | ||
| ); | ||
| }; | ||
|
|
||
| const NavbarBaseStyled = styled(NavbarBase)` | ||
| width: 100%; | ||
| height: 85px; | ||
| background-color: #131313 !important; | ||
| padding: 0 !important; | ||
| display: flex; | ||
| flex-direction: column; | ||
| filter: drop-shadow(0px 0px 12px #000000); | ||
|
|
||
| @media (max-width: 768px) { | ||
| height: 70px; | ||
| } | ||
| `; | ||
|
|
||
| const LogoStyled = styled(NavbarBaseStyled.Brand)` | ||
| @media (max-width: 768px) { | ||
| display: none; | ||
| } | ||
| `; | ||
|
|
||
| const ContainerStyled = styled(Container)` | ||
| display: flex; | ||
| width: 100%; | ||
| height: 100%; | ||
| justify-content: space-between; | ||
|
|
||
| align-items: center; | ||
| margin: 0 auto; | ||
| `; | ||
|
|
||
| const NavStyled = styled(Nav)` | ||
| display: flex; | ||
| height: 100%; | ||
| padding-top: 25px; | ||
| justify-content: space-around; | ||
| align-items: center; | ||
|
|
||
| @media (max-width: 768px) { | ||
| padding-top: 20px; | ||
| } | ||
| `; | ||
|
|
||
| const NavLinkStyled = styled(Link)<LinkProps>` | ||
| font-family: Righteous; | ||
| font-style: normal; | ||
| font-weight: bold; | ||
| font-size: 24px; | ||
| line-height: 26px; | ||
| height: 100%; | ||
| text-align: center; | ||
| text-shadow: 0px 0px 12px #cf721c; | ||
| cursor: pointer; | ||
| text-decoration: none; | ||
|
|
||
| &:first-child { | ||
| color: ${props => (props.href === '' ? '#cf721c' : '#ffffff')}; | ||
| border-bottom: ${props => | ||
| props.href === '' ? '4px solid #cf721c' : 'none'}; | ||
| } | ||
|
|
||
| &:nth-child(0n + 2) { | ||
| color: ${props => (props.href === 'blog' ? '#cf721c' : '#ffffff')}; | ||
| border-bottom: ${props => | ||
| props.href === 'blog' ? '4px solid #cf721c' : 'none'}; | ||
| } | ||
|
|
||
| &:last-child { | ||
| color: ${props => (props.href === 'acuc' ? '#cf721c' : '#ffffff')}; | ||
| border-bottom: ${props => | ||
| props.href === 'acuc' ? '4px solid #cf721c' : 'none'}; | ||
| } | ||
| &:hover { | ||
| color: #cf721c !important; | ||
| border-bottom: 4px solid #cf721c !important; | ||
| } | ||
| `; | ||
|
|
||
| const NavButtonStyled = styled(Nav)` | ||
| display: flex; | ||
| justify-content: flex-end; | ||
|
|
||
| @media (max-width: 768px) { | ||
| display: none; | ||
| } | ||
| `; | ||
|
|
||
| const ButtonStyled = styled(Button)` | ||
| width: 199px; | ||
| height: 49px; | ||
| background-color: #cf721c !important; | ||
| color: #fff !important; | ||
| border: none !important; | ||
| border-radius: 5px; | ||
| font-size: 1.2rem; | ||
| font-weight: bold !important; | ||
| box-shadow: 0px 0px 12px #cf721c; | ||
| `; | ||
|
|
||
| export default Navbar; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All classes can be overwriten using some bootstrap classes |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import * as React from 'react'; | ||
| import { Main } from '../templates/main'; | ||
|
|
||
| function ACUC() { | ||
| return <Main />; | ||
| } | ||
|
|
||
| export default ACUC; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import * as React from 'react'; | ||
| import { Main } from '../templates/main'; | ||
|
|
||
| function Blog() { | ||
| return <Main />; | ||
| } | ||
|
|
||
| export default Blog; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +0,0 @@ | ||
| import { extendTheme } from '@chakra-ui/react'; | ||
|
|
||
| const colors = { | ||
| brand: { | ||
| 900: '#1a365d', | ||
| 800: '#153e75', | ||
| 700: '#2a69ac', | ||
| }, | ||
| }; | ||
|
|
||
| export const theme = extendTheme({ colors }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import React, { useMemo } from 'react'; | ||
| import styled from 'styled-components'; | ||
| import Navbar from '../components/Navbar'; | ||
|
|
||
| export const Main: React.FC = ({ children }) => { | ||
| const href = useMemo(() => (window ? window.location.href : ''), [window]); | ||
|
|
||
| const path = href.slice(href.lastIndexOf('/') + 1); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add all this logics in memo, we uses memo to optimize updatable variables, so, if we need to change things use the memo hook, click here for more information |
||
|
|
||
| return ( | ||
| <Container> | ||
| <Navbar path={path} /> | ||
| {children} | ||
| </Container> | ||
| ); | ||
| }; | ||
|
|
||
| const Container = styled.div` | ||
| width: 100%; | ||
| height: 100%; | ||
| background-color: #131313; | ||
| `; | ||
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.
Why not change container to fluid, add flex using bootstrap class instead of use styled components?