-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d92d2d
commit 00b2e10
Showing
25 changed files
with
738 additions
and
10 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
Binary file not shown.
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
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,78 @@ | ||
import { createGlobalStyle } from 'styled-components' | ||
|
||
// @ts-ignore | ||
import MarianneBold from './assets/fonts/Marianne-Bold.woff2' | ||
// @ts-ignore | ||
import MarianneBoldItalic from './assets/fonts/Marianne-Bold_Italic.woff2' | ||
// @ts-ignore | ||
import MarianneLight from './assets/fonts/Marianne-Light.woff2' | ||
// @ts-ignore | ||
import MarianneLightItalic from './assets/fonts/Marianne-Light_Italic.woff2' | ||
// @ts-ignore | ||
import MarianneMedium from './assets/fonts/Marianne-Medium.woff2' | ||
// @ts-ignore | ||
import MarianneMediumItalic from './assets/fonts/Marianne-Medium_Italic.woff2' | ||
// @ts-ignore | ||
import MarianneRegular from './assets/fonts/Marianne-Regular.woff2' | ||
// @ts-ignore | ||
import MarianneItalic from './assets/fonts/Marianne-Regular_Italic.woff2' | ||
|
||
export const GlobalStyle = createGlobalStyle` | ||
@font-face { | ||
font-family: Marianne; | ||
src: local('Marianne'), local('Marianne-Regular'), url(${MarianneRegular}) format('woff2'); | ||
font-weight: normal; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src: local('Marianne-Thin'), url(${MarianneLight}) format('woff2'); | ||
font-weight: 300; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src:local('Marianne-Medium'), url(${MarianneMedium}) format('woff2'); | ||
font-weight: 500; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src: local('Marianne-Medium_Italic'), url(${MarianneMediumItalic}) format('woff2'); | ||
font-weight: 500; | ||
font-style: italic; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src: local('Marianne-Thin_Italic'), url(${MarianneLightItalic}) format('woff2'); | ||
font-weight: lighter; | ||
font-style: italic; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src:local('Marianne-Regular_Italic'), url(${MarianneItalic}) format('woff2'); | ||
font-weight: normal; | ||
font-style: italic; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src: local('Marianne-Bold'), url(${MarianneBold}) format('woff2'); | ||
font-weight: 700; | ||
} | ||
@font-face { | ||
font-family: Marianne; | ||
src: local('Marianne-Bold_Italic'), url(${MarianneBoldItalic}) format('woff2'); | ||
font-style: italic; | ||
font-weight: 700; | ||
} | ||
body { | ||
font-family: Marianne, sans-serif; | ||
font-size: 16px; | ||
line-height: 1.4; | ||
} | ||
` |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
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 @@ | ||
export enum Accent { | ||
PRIMARY = 'PRIMARY', | ||
SECONDARY = 'SECONDARY', | ||
TERTIARY = 'TERTIARY' | ||
} | ||
|
||
export enum Size { | ||
LARGE = 'LARGE', | ||
NORMAL = 'NORMAL', | ||
SMALL = 'SMALL' | ||
} |
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,170 @@ | ||
import { useMemo } from 'react' | ||
import styled from 'styled-components' | ||
|
||
import { Accent, Size } from '../contants' | ||
|
||
import type { IconProps } from '../types' | ||
import type { ButtonHTMLAttributes, FunctionComponent } from 'react' | ||
|
||
const ICON_SIZE: Record<Size, number> = { | ||
[Size.LARGE]: 1.25, | ||
[Size.NORMAL]: 1.25, | ||
[Size.SMALL]: 0.75 | ||
} | ||
|
||
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & { | ||
Icon?: FunctionComponent<IconProps> | ||
accent?: Accent | ||
isFullWidth?: boolean | ||
size?: Size | ||
} | ||
export function Button({ | ||
accent = Accent.PRIMARY, | ||
children, | ||
Icon, | ||
isFullWidth = false, | ||
size = Size.NORMAL, | ||
type = 'button', | ||
...nativeProps | ||
}: ButtonProps) { | ||
const commonChildren = useMemo( | ||
() => ( | ||
<> | ||
{Icon && <Icon size={ICON_SIZE[size]} />} | ||
{children} | ||
</> | ||
), | ||
[children, Icon, size] | ||
) | ||
const commonProps = useMemo( | ||
() => ({ | ||
children: commonChildren, | ||
isFullWidth, | ||
size, | ||
type, | ||
...nativeProps | ||
}), | ||
[commonChildren, isFullWidth, nativeProps, size, type] | ||
) | ||
|
||
switch (accent) { | ||
case Accent.SECONDARY: | ||
return <SecondaryButton {...commonProps} /> | ||
|
||
case Accent.TERTIARY: | ||
return <TertiaryButton {...commonProps} /> | ||
|
||
default: | ||
return <PrimaryButton {...commonProps} /> | ||
} | ||
} | ||
|
||
const FONT_SIZE: Record<Size, string> = { | ||
[Size.LARGE]: '13px', | ||
[Size.NORMAL]: '13px', | ||
[Size.SMALL]: '11px' | ||
} | ||
const PADDING: Record<Size, string> = { | ||
[Size.LARGE]: '6px 12px', | ||
[Size.NORMAL]: '6px 12px', | ||
[Size.SMALL]: '5px 8px 4px' | ||
} | ||
|
||
const StyledButton = styled.button<{ | ||
isFullWidth: boolean | ||
size: Size | ||
}>` | ||
align-items: center; | ||
display: flex; | ||
font-size: ${p => FONT_SIZE[p.size]}; | ||
justify-content: center; | ||
padding: ${p => PADDING[p.size]}; | ||
white-space: nowrap; | ||
width: ${p => (p.isFullWidth ? '100%' : 'auto')}; | ||
/* SVG Icon Components are wrapped within a <div /> */ | ||
> div { | ||
margin-right: 5px; | ||
} | ||
` | ||
|
||
const PrimaryButton = styled(StyledButton)` | ||
background-color: ${p => p.theme.color.charcoal}; | ||
border: 1px solid ${p => p.theme.color.charcoal}; | ||
color: ${p => p.theme.color.gainsboro}; | ||
:hover, | ||
&._hover { | ||
background-color: ${p => p.theme.color.blueYonder['100']}; | ||
border: 1px solid ${p => p.theme.color.blueYonder['100']}; | ||
color: ${p => p.theme.color.white}; | ||
} | ||
:active, | ||
&._active { | ||
background-color: ${p => p.theme.color.blueGray['100']}; | ||
border: 1px solid ${p => p.theme.color.blueGray['100']}; | ||
color: ${p => p.theme.color.white}; | ||
} | ||
:disabled, | ||
&._disabled { | ||
background-color: ${p => p.theme.color.lightGray}; | ||
border: 1px solid ${p => p.theme.color.lightGray}; | ||
color: ${p => p.theme.color.cultured}; | ||
} | ||
` | ||
|
||
const SecondaryButton = styled(StyledButton)` | ||
background-color: ${p => p.theme.color.white}; | ||
border: 1px solid ${p => p.theme.color.charcoal}; | ||
color: ${p => p.theme.color.charcoal}; | ||
:hover, | ||
&._hover { | ||
background-color: ${p => p.theme.color.blueYonder['25']}; | ||
border: 1px solid ${p => p.theme.color.blueYonder['100']}; | ||
color: ${p => p.theme.color.blueYonder['100']}; | ||
} | ||
:active, | ||
&._active { | ||
background-color: ${p => p.theme.color.blueGray['25']}; | ||
border: 1px solid ${p => p.theme.color.blueGray['100']}; | ||
color: ${p => p.theme.color.blueGray['100']}; | ||
} | ||
:disabled, | ||
&._disabled { | ||
background-color: ${p => p.theme.color.white}; | ||
border: 1px solid ${p => p.theme.color.lightGray}; | ||
color: ${p => p.theme.color.lightGray}; | ||
} | ||
` | ||
|
||
const TertiaryButton = styled(StyledButton)` | ||
background-color: ${p => p.theme.color.white}; | ||
border: 1px solid ${p => p.theme.color.white}; | ||
color: ${p => p.theme.color.gainsboro}; | ||
:hover, | ||
&._hover { | ||
background-color: ${p => p.theme.color.blueYonder['25']}; | ||
border: 1px solid ${p => p.theme.color.blueYonder['25']}; | ||
color: ${p => p.theme.color.blueYonder['100']}; | ||
} | ||
:active, | ||
&._active { | ||
background-color: ${p => p.theme.color.blueGray['25']}; | ||
border: 1px solid ${p => p.theme.color.blueGray['100']}; | ||
color: ${p => p.theme.color.blueGray['100']}; | ||
} | ||
:disabled, | ||
&._disabled { | ||
background-color: ${p => p.theme.color.white}; | ||
border: 1px solid ${p => p.theme.color.lightGray}; | ||
color: ${p => p.theme.color.lightGray}; | ||
} | ||
` |
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
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,9 @@ | ||
import styled from 'styled-components' | ||
|
||
export const Subtitle = styled.h3` | ||
color: ${p => p.theme.color.gunMetal}; | ||
font-size: 13px; | ||
font-weight: bold; | ||
margin: 0; | ||
text-transform: uppercase; | ||
` |
Oops, something went wrong.