[WIP] Adds paragraph sizes

This commit is contained in:
Ezekiel Aquino
2018-12-05 18:07:28 +01:00
parent 682b0dd8f4
commit a9895c55f9
2 changed files with 11 additions and 17 deletions

View File

@@ -19,25 +19,11 @@ interface ParagraphProps extends BaseTextInterface {
isMuted?: boolean | number;
}
interface ParagraphSizes {
default: string;
medium: string;
large: string;
[key: string]: string;
}
const PARAGRAPH_SIZES: ParagraphSizes = {
default: '18px',
small: '14px',
medium: '22px',
large: '28px',
};
const StyledHeading = styled.h1<HeadingProps>`
color: ${props => props.color || props.theme.textColor};
font-size: ${props => `var(--${props.size}Heading)`};
font-size: ${props => `var(--${props.size || 'default'}Heading)`};
padding: ${props => props.padding && getCSSPadding(props.padding)};
line-height: ${props => `var(--${props.size}HeadingHeight)`};
line-height: ${props => `var(--${props.size || 'default'}HeadingHeight)`};
margin-bottom: ${props => !props.isNoMargin && '30px'};
text-align: ${props => props.isCentered && 'center'};
font-weight: 300;
@@ -57,7 +43,7 @@ export const Heading: React.StatelessComponent<HeadingProps> = props => {
// and be more generic. e.g. <Text /> with a props asElement so we can use it
// for literally anything =
export const Paragraph = styled.p<ParagraphProps>`
font-size: ${props => PARAGRAPH_SIZES[props.size || 'default']};
font-size: ${props => `var(--${props.size || 'default'}Paragraph)`};
margin-bottom: ${props => !props.isNoMargin && '30px'};
padding: ${props => props.padding && getCSSPadding(props.padding)};
color: ${props => props.color || props.theme.textColor};

View File

@@ -40,6 +40,10 @@ const GlobalStyles = withTheme(createGlobalStyle<GlobalStyle> `
--defaultHeadingHeight: 1.357142857em;
--mediumHeadingHeight: 1.16em;
--largeHeadingHeight: 1em;
--smallParagraph: 14px;
--defaultParagraph: 18px;
--mediumParagraph: 22px;
--largeParagraph: 28px;
}
}
@@ -53,6 +57,10 @@ const GlobalStyles = withTheme(createGlobalStyle<GlobalStyle> `
--defaultHeadingHeight: 1.357142857em; // TO DO
--mediumHeadingHeight: 1.16em; // TO DO
--largeHeadingHeight: 1em; // TO DO
--smallParagraph: 14px; // TO DO
--defaultParagraph: 18px; // TO DO
--mediumParagraph: 22px; // TO DO
--largeParagraph: 28px; // TO DO
}
}