This repository has been archived by the owner on Sep 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Much work, little outcome :thumbs-up:
- Loading branch information
1 parent
53f14cf
commit 668d1ee
Showing
7 changed files
with
265 additions
and
6 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
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,175 @@ | ||
import { useScrollYPosition } from 'react-use-scroll-position'; | ||
import { Link, NavLink } from 'react-router-dom'; | ||
import styled, { css } from 'styled-components'; | ||
import { | ||
Collapse, | ||
Container, | ||
DropdownItem, | ||
DropdownMenu, | ||
DropdownToggle, | ||
Nav, | ||
Navbar, | ||
NavbarBrand, | ||
NavbarToggler, | ||
NavItem, | ||
UncontrolledDropdown, | ||
} from 'reactstrap'; | ||
import React from 'react'; | ||
|
||
type Mode = 'primary' | 'secondary'; | ||
|
||
const Navvy: React.FunctionComponent = () => { | ||
const scrollY = useScrollYPosition(); | ||
const mode = scrollY < 100 ? 'primary' : 'secondary'; | ||
|
||
return ( | ||
<StyledNavbar | ||
fixed={'top'} | ||
expand={'md'} | ||
mode={mode} | ||
> | ||
<Container> | ||
<NavbarHeader mode={mode}> | ||
<Brand | ||
as={NavLink} | ||
to={'/'} | ||
mode={mode} | ||
> | ||
{'Branch'} | ||
</Brand> | ||
<NavbarToggler /> | ||
</NavbarHeader> | ||
<Collapse isOpen navbar> | ||
<Nav | ||
className={'ml-auto'} | ||
navbar | ||
> | ||
<NavItem> | ||
<NavLink | ||
className={'nav-link'} | ||
to={'/blog'} | ||
> | ||
{'Blog'} | ||
</NavLink> | ||
</NavItem> | ||
<UncontrolledDropdown | ||
nav | ||
inNavbar | ||
> | ||
<DropdownToggle | ||
nav | ||
caret | ||
> | ||
{'Games'} | ||
</DropdownToggle> | ||
<DropdownMenu right> | ||
<DropdownItem> | ||
<Link to={'/games/halo-mcc'}>{'Halo 3'}</Link> | ||
</DropdownItem> | ||
<DropdownItem divider /> | ||
<DropdownItem> | ||
<Link to={'/games/halo-infinite'}>{'Halo Infinite'}</Link> | ||
</DropdownItem> | ||
</DropdownMenu> | ||
</UncontrolledDropdown> | ||
<NavItem> | ||
<NavLink | ||
className={'nav-link'} | ||
to={'/about'} | ||
> | ||
{'About'} | ||
</NavLink> | ||
</NavItem> | ||
</Nav> | ||
</Collapse> | ||
</Container> | ||
</StyledNavbar> | ||
); | ||
} | ||
|
||
const StyledNavbar = styled(Navbar) <{ mode: Mode }>` | ||
height: 80px; | ||
padding-top: 20px; | ||
padding-left: 80px; | ||
padding-right: 80px; | ||
background: transparent; | ||
border: 0; | ||
border-radius: 0; | ||
transition: 0.5s; | ||
${props => { | ||
if (props.mode === 'primary') { | ||
return css` | ||
.navbar-nav > li { | ||
> a { | ||
color: ${props => props.theme.textInverse}; | ||
&, &:hover { | ||
/* color: ${props => props.theme.textInverse}; */ | ||
opacity: .7; | ||
} | ||
&:active, &:focus { | ||
color: #eee; | ||
} | ||
} | ||
&.open > a { | ||
&, &:hover { | ||
background-color: transparent; | ||
color: white; | ||
opacity: 0.7; | ||
} | ||
&:active, &:focus { | ||
background-color: transparent; | ||
color: #eee;; | ||
} | ||
} | ||
} | ||
`; | ||
} | ||
if (props.mode === 'secondary') { | ||
return css` | ||
padding-top: 10px; | ||
height: 70px; | ||
background: white; | ||
border-bottom: 1px solid ${props => props.theme.brandPrimary}; | ||
`; | ||
} | ||
}} | ||
`; | ||
|
||
const NavbarHeader = styled.div<{ mode: Mode }>` | ||
background-position: left center; | ||
background-repeat: no-repeat; | ||
background-size: contain; | ||
height: 35px; | ||
padding-left: 45px; | ||
${({ mode, theme }) => mode === 'primary' && css` | ||
background-image: url(${theme.images.logo}); | ||
`} | ||
${({ mode, theme }) => mode === 'secondary' && css` | ||
background-image: url(${theme.images.logoInverse}); | ||
`} | ||
`; | ||
|
||
const Brand = styled(NavbarBrand)<{ mode: Mode }>` | ||
color: white; | ||
font-size: 1.25rem; | ||
line-height: 35px; | ||
font-weight: 300; | ||
${({ mode, theme }) => mode === 'primary' && css` | ||
`} | ||
${({ mode, theme }) => mode === 'secondary' && css` | ||
color: ${theme.brandPrimary}; | ||
font-weight: 400; | ||
`} | ||
`; | ||
|
||
export default Navvy; |
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 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,7 +1,12 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const Home: React.FunctionComponent = () => { | ||
return <p>{'welcome 2 branch xx'}</p>; | ||
return <Wrapper>{'welcome 2 branch xx'}</Wrapper>; | ||
}; | ||
|
||
const Wrapper = styled.div` | ||
height: 1200px; | ||
`; | ||
|
||
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
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,5 +1,59 @@ | ||
const theme = { | ||
import logo from '../../assets/images/logo/logo-150x150-w.png'; | ||
import logoInverse from '../../assets/images/logo/logo-150x150.png'; | ||
|
||
interface Theme { | ||
brandPrimary: string; | ||
brandSecondary: string; | ||
brandTertiary: string; | ||
brandQuaternary: string; | ||
|
||
brandAccentPrimary: string; | ||
brandAccentSecondary: string; | ||
brandAccentTertiary: string; | ||
|
||
anchorPrimary: string; | ||
anchorPrimaryActive: string; | ||
anchorSecondary: string; | ||
anchorSecondaryActive: string; | ||
|
||
separatorLight: string; | ||
|
||
textInverse: string; | ||
|
||
images: { | ||
logo: string; | ||
logoInverse: string; | ||
}; | ||
} | ||
|
||
const defaultTheme: Theme = { | ||
brandPrimary: '#3d3d7c', | ||
brandSecondary: '#353575', | ||
brandTertiary: '#5d5da0', | ||
brandQuaternary: '#aaa4b6', | ||
|
||
brandAccentPrimary: '#e25092', | ||
brandAccentSecondary: '#b42c69', | ||
brandAccentTertiary: '#d3508b', | ||
|
||
anchorPrimary: '#3d3d7c', | ||
anchorPrimaryActive: '#3d3d7c', | ||
anchorSecondary: '#e25092', | ||
anchorSecondaryActive: '#d3508b', | ||
|
||
separatorLight: '#eee', | ||
|
||
textInverse: 'white', | ||
|
||
images: { | ||
logo, | ||
logoInverse, | ||
}, | ||
}; | ||
|
||
export default theme; | ||
// yolo this | ||
declare module "styled-components" { | ||
interface DefaultTheme extends Theme {} | ||
} | ||
|
||
export default defaultTheme; |
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