feat(addon-docs): add ability to set units for font sizes

This commit is contained in:
Kirill Popolov 2019-10-26 11:51:44 +03:00
parent 2c62e72e0b
commit c3d7e33bd7
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ export default {
component: Typeset,
};
const fontSizes = [12, 14, 16, 20, 24, 32, 40, 48];
const fontSizes = ['12px', '14px', '16px', '20px', '24px', '32px', '40px', '48px'];
const fontWeight = 900;
export const withFontSizes = () => <Typeset fontSizes={fontSizes} />;

View File

@ -35,7 +35,7 @@ const Wrapper = styled.div<{}>(withReset, ({ theme }) => ({
}));
export interface TypesetProps {
fontSizes: number[];
fontSizes: string[];
fontWeight?: number;
sampleText?: string;
}
@ -51,12 +51,12 @@ export const Typeset: FunctionComponent<TypesetProps> = ({
...props
}) => (
<Wrapper {...props} className="docblock-typeset">
{fontSizes.map(num => (
<TypeSpecimen key={num}>
<Label>{num}px</Label>
{fontSizes.map(size => (
<TypeSpecimen key={size}>
<Label>{size}</Label>
<Sample
style={{
fontSize: num,
fontSize: size,
fontWeight,
}}
>