diff options
author | Ezekiel Aquino <ezekiel@bakkenbaeck.no> | 2018-12-12 20:55:12 +0800 |
---|---|---|
committer | Ezekiel Aquino <ezekiel@bakkenbaeck.no> | 2018-12-12 20:55:12 +0800 |
commit | bb2581612a2d4935ab58ec91fb024edfafeb954e (patch) | |
tree | b84538af78df46842cd922fa1f563adc2520c343 /packages | |
parent | 3844ce9b60fcbec7a04ff9b3c35ef0c4088af449 (diff) | |
download | dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.tar dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.tar.gz dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.tar.bz2 dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.tar.lz dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.tar.xz dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.tar.zst dexon-sol-tools-bb2581612a2d4935ab58ec91fb024edfafeb954e.zip |
Adds more types to newLayout
Diffstat (limited to 'packages')
-rw-r--r-- | packages/website/ts/@next/components/newLayout.tsx | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/packages/website/ts/@next/components/newLayout.tsx b/packages/website/ts/@next/components/newLayout.tsx index 7af2fb9f2..fc2bae46b 100644 --- a/packages/website/ts/@next/components/newLayout.tsx +++ b/packages/website/ts/@next/components/newLayout.tsx @@ -11,6 +11,15 @@ interface WrapProps extends FlexProps { isTextCentered?: boolean; } +interface WrapGridProps { + isWrapped?: boolean; + isCentered?: boolean; +} + +export interface WrapStickyProps { + offsetTop?: string; +} + interface SectionProps extends WrapProps { isPadded?: boolean; isFullWidth?: boolean; @@ -21,6 +30,8 @@ interface SectionProps extends WrapProps { } interface ColumnProps { + width?: string; + maxWidth?: string; padding?: string; } @@ -34,7 +45,7 @@ export const Section = (props: SectionProps) => { ); }; -export const Column = styled.div` +export const Column = styled.div<ColumnProps>` width: ${props => props.width}; max-width: ${props => props.maxWidth}; padding: ${props => props.padding}; @@ -45,7 +56,7 @@ export const Column = styled.div` } `; -export const FlexWrap = styled.div` +export const FlexWrap = styled.div<SectionProps>` padding: ${props => props.padding}; @media (min-width: ${props => props.flexBreakpoint || '768px'}) { @@ -54,12 +65,12 @@ export const FlexWrap = styled.div` } `; -export const WrapSticky = styled.div` +export const WrapSticky = styled.div<WrapStickyProps>` position: sticky; top: ${props => props.offsetTop || '60px'}; `; -const SectionBase = styled.section` +const SectionBase = styled.section<SectionProps>` margin: 0 auto; padding: ${props => props.isPadded && '120px 0'}; background-color: ${props => props.theme[`${props.bgColor}BgColor`] || props.bgColor}; @@ -69,14 +80,14 @@ const SectionBase = styled.section` } `; -const Wrap = styled(FlexWrap)` +const Wrap = styled(FlexWrap)<WrapProps>` width: ${props => !props.isFullWidth && 'calc(100% - 60px)'}; max-width: ${props => !props.isFullWidth && (props.maxWidth || '895px')}; margin: 0 auto; text-align: ${props => props.isTextCentered && 'center'}; `; -export const WrapGrid = styled(Wrap)` +export const WrapGrid = styled(Wrap)<WrapGridProps>` display: flex; flex-wrap: ${props => props.isWrapped && `wrap`}; justify-content: ${props => props.isCentered ? `center` : 'space-between'}; |