From be2fb6654beb4853e52dacd692708d3cef22c7f3 Mon Sep 17 00:00:00 2001 From: Andrei Firsov Date: Fri, 31 Aug 2018 15:11:46 +0300 Subject: [PATCH] fix(Storybook): adds typography fixes --- src/atoms/typography/Heading/Heading.js | 6 +- .../typography/Heading/Heading.stories.js | 12 +- src/atoms/typography/Text/Text.stories.js | 54 +++-- .../__snapshots__/storyshots.test.js.snap | 193 +++++++++++++----- storybook/preview-head.html | 1 + 5 files changed, 188 insertions(+), 78 deletions(-) create mode 100644 storybook/preview-head.html diff --git a/src/atoms/typography/Heading/Heading.js b/src/atoms/typography/Heading/Heading.js index e66f5c89..bebe3535 100644 --- a/src/atoms/typography/Heading/Heading.js +++ b/src/atoms/typography/Heading/Heading.js @@ -36,13 +36,13 @@ const theme = createTheme(name, (colors) => ({ }, kind: { primary: { - color: colors.DARK_PRIMARY_TEXT_COLOR, + color: colors.TEXT_PRIMARY, }, secondary: { - color: colors.DARK_SECONDARY_TEXT_COLOR, + color: colors.TEXT_SECONDARY, }, disabled: { - color: colors.DARK_DISABLED_TEXT_COLOR, + color: colors.DISABLED_TEXT_COLOR, }, white: { color: colors.WHITE, diff --git a/src/atoms/typography/Heading/Heading.stories.js b/src/atoms/typography/Heading/Heading.stories.js index debf3dc5..2b333bff 100644 --- a/src/atoms/typography/Heading/Heading.stories.js +++ b/src/atoms/typography/Heading/Heading.stories.js @@ -5,12 +5,12 @@ export default (asStory) => { story .add('with type modifiers', () => ( - - - - - - + 62px - Heading 1 + 46px - Heading 2 + 30px - Heading 3 + 20px - Heading 4 + 14px - Heading 5 + 10px - Heading 6 )) .add('with kind modifiers ', () => ( diff --git a/src/atoms/typography/Text/Text.stories.js b/src/atoms/typography/Text/Text.stories.js index 9097aae8..5be4b548 100644 --- a/src/atoms/typography/Text/Text.stories.js +++ b/src/atoms/typography/Text/Text.stories.js @@ -3,41 +3,61 @@ import React from 'react'; import { Text } from './'; +const placeholderText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'; + export default (asStory: *) => { asStory('ATOMS/TYPOGRAPHY/Text', module, (story, { Text }: { Text: typeof Text }) => { story .add('with text', () => ( - + )) .add('with children', () => ( - Imploringness + { placeholderText } )) .add('with color modifiers ', () => ( -
- Primary Text - Secondary Text - Red Text - Green Text - Blue Text -
+ + { placeholderText } +
+ { placeholderText } +
+ { placeholderText } +
+ { placeholderText } +
+ { placeholderText } +
)) .add('with align modifiers ', () => (
- LongText.LongText.LongText.LongText.LongText. LongText.LongText.LongText. + { placeholderText }
- LongText.LongText.LongText.LongText.LongText. LongText.LongText.LongText. + { placeholderText }
- LongText.LongText.LongText.LongText.LongText. LongText.LongText.LongText. + { placeholderText }
)) .add('with disabled modifier', () => ( - Disabled Text + Disabled { placeholderText } )) - .add('with bold modifier', () => ( - Disabled Text + .add('with bold modifiers', () => ( + + Semibold: { placeholderText } +
+ Bold: { placeholderText } +
)) - .add('with custom size', () => ( - Disabled Text + .add('with size modifiers', () => ( + + XS - 10px: { placeholderText } +
+ SM - 12px: { placeholderText } +
+ MD - 14px: { placeholderText } +
+ LG - 16px: { placeholderText } +
+ XL - 18px: { placeholderText } +
)); }); }; diff --git a/storybook/__tests__/__snapshots__/storyshots.test.js.snap b/storybook/__tests__/__snapshots__/storyshots.test.js.snap index 81408c19..859ea2f5 100644 --- a/storybook/__tests__/__snapshots__/storyshots.test.js.snap +++ b/storybook/__tests__/__snapshots__/storyshots.test.js.snap @@ -11406,6 +11406,7 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Heading with kind modifiers 1`] = ` font-weight: 400; margin: 0; font-size: 6.2rem; + color: #323c47; } .emotion-1 { @@ -11414,6 +11415,7 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Heading with kind modifiers 1`] = ` font-weight: 400; margin: 0; font-size: 4.6rem; + color: #878c93; } .emotion-2 { @@ -11422,6 +11424,7 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Heading with kind modifiers 1`] = ` font-weight: 400; margin: 0; font-size: 3rem; + color: #d0d7dd; }
- Heading 1 + 62px - Heading 1

- Heading 2 + 46px - Heading 2

- Heading 3 + 30px - Heading 3

- Heading 4 + 20px - Heading 4

- Heading 5 + 14px - Heading 5
- Heading 6 + 10px - Heading 6
`; @@ -12312,30 +12321,38 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Text with align modifiers 1`] = ` - LongText.LongText.LongText.LongText.LongText. LongText.LongText.LongText. + Lorem ipsum dolor sit amet, consectetur adipiscing elit
- LongText.LongText.LongText.LongText.LongText. LongText.LongText.LongText. + Lorem ipsum dolor sit amet, consectetur adipiscing elit
- LongText.LongText.LongText.LongText.LongText. LongText.LongText.LongText. + Lorem ipsum dolor sit amet, consectetur adipiscing elit `; -exports[`Storyshots ATOMS/TYPOGRAPHY/Text with bold modifier 1`] = ` -.emotion-1 { +exports[`Storyshots ATOMS/TYPOGRAPHY/Text with bold modifiers 1`] = ` +.emotion-2 { margin: 2rem; } .emotion-0 { + line-height: 1.4; + margin: 0; + color: #323c47; + font-weight: 600; + font-size: 1.4rem; +} + +.emotion-1 { line-height: 1.4; margin: 0; color: #323c47; @@ -12344,12 +12361,20 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Text with bold modifier 1`] = ` }
- Disabled Text + Semibold: + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + Bold: + Lorem ipsum dolor sit amet, consectetur adipiscing elit
`; @@ -12373,7 +12398,7 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Text with children 1`] = ` - Imploringness + Lorem ipsum dolor sit amet, consectetur adipiscing elit `; @@ -12418,37 +12443,39 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Text with color modifiers 1`] = `
-
- - Primary Text - - - Secondary Text - - - Red Text - - - Green Text - - - Blue Text - -
+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit +
`; -exports[`Storyshots ATOMS/TYPOGRAPHY/Text with custom size 1`] = ` +exports[`Storyshots ATOMS/TYPOGRAPHY/Text with disabled modifier 1`] = ` .emotion-1 { margin: 2rem; } @@ -12456,9 +12483,9 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Text with custom size 1`] = ` .emotion-0 { line-height: 1.4; margin: 0; - color: #323c47; + color: #d0d7dd; font-weight: 400; - font-size: 1.6rem; + font-size: 1.4rem; }
- Disabled Text + Disabled + Lorem ipsum dolor sit amet, consectetur adipiscing elit
`; -exports[`Storyshots ATOMS/TYPOGRAPHY/Text with disabled modifier 1`] = ` -.emotion-1 { +exports[`Storyshots ATOMS/TYPOGRAPHY/Text with size modifiers 1`] = ` +.emotion-5 { margin: 2rem; } -.emotion-0 { +.emotion-2 { line-height: 1.4; margin: 0; - color: #d0d7dd; + color: #323c47; font-weight: 400; font-size: 1.4rem; } +.emotion-0 { + line-height: 1.4; + margin: 0; + color: #323c47; + font-weight: 400; + font-size: 1rem; +} + +.emotion-1 { + line-height: 1.4; + margin: 0; + color: #323c47; + font-weight: 400; + font-size: 1.2rem; +} + +.emotion-3 { + line-height: 1.4; + margin: 0; + color: #323c47; + font-weight: 400; + font-size: 1.6rem; +} + +.emotion-4 { + line-height: 1.4; + margin: 0; + color: #323c47; + font-weight: 400; + font-size: 1.8rem; +} +
- Disabled Text + XS - 10px: + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + SM - 12px: + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + MD - 14px: + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + LG - 16px: + Lorem ipsum dolor sit amet, consectetur adipiscing elit + +
+ + XL - 18px: + Lorem ipsum dolor sit amet, consectetur adipiscing elit
`; @@ -12515,7 +12604,7 @@ exports[`Storyshots ATOMS/TYPOGRAPHY/Text with text 1`] = ` - Expletively + Lorem ipsum dolor sit amet, consectetur adipiscing elit `; diff --git a/storybook/preview-head.html b/storybook/preview-head.html new file mode 100644 index 00000000..ce5b37e0 --- /dev/null +++ b/storybook/preview-head.html @@ -0,0 +1 @@ +