@meduza/ui-kit-2 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -179
- package/dist/BookmarkButton/BookmarkButton.stories.d.ts +10 -0
- package/dist/BookmarkButton/BookmarkButton.types.d.ts +6 -0
- package/dist/BookmarkButton/index.d.ts +3 -0
- package/dist/Button/Button.stories.d.ts +10 -0
- package/dist/Button/Button.types.d.ts +2 -2
- package/dist/CardTitle/CardTitle.stories.d.ts +10 -0
- package/dist/CardTitle/CardTitle.types.d.ts +8 -0
- package/dist/CardTitle/index.d.ts +3 -0
- package/dist/ChapterBlock/ChapterBlock.stories.d.ts +10 -0
- package/dist/ChapterBlock/ChapterBlock.types.d.ts +7 -0
- package/dist/ChapterBlock/index.d.ts +3 -0
- package/dist/Cover/Cover.stories.d.ts +10 -0
- package/dist/Cover/Cover.types.d.ts +4 -0
- package/dist/Cover/index.d.ts +3 -0
- package/dist/DocumentItemsCount/DocumentItemsCount.stories.d.ts +10 -0
- package/dist/DocumentItemsCount/DocumentItemsCount.types.d.ts +7 -0
- package/dist/DocumentItemsCount/index.d.ts +3 -0
- package/dist/DotsOnImage/DotsOnImage.stories.d.ts +10 -0
- package/dist/DotsOnImage/DotsOnImage.types.d.ts +42 -0
- package/dist/DotsOnImage/index.d.ts +3 -0
- package/dist/Dropdown/Dropdown.stories.d.ts +10 -0
- package/dist/Dropdown/Dropdown.types.d.ts +6 -0
- package/dist/Dropdown/index.d.ts +4 -0
- package/dist/EmbedBlock/EmbedBlock.d.ts +3 -0
- package/dist/EmbedBlock/EmbedBlock.stories.d.ts +10 -0
- package/dist/EmbedBlock/EmbedBlock.types.d.ts +5 -0
- package/dist/EmbedBlock/IframeBlock.d.ts +3 -0
- package/dist/EmbedBlock/index.d.ts +3 -0
- package/dist/GroupedBlock/GroupedBlock.stories.d.ts +10 -0
- package/dist/GroupedBlock/GroupedBlock.types.d.ts +4 -0
- package/dist/GroupedBlock/index.d.ts +3 -0
- package/dist/HalfBlock/HalfBlock.stories.d.ts +10 -0
- package/dist/HalfBlock/HalfBlock.types.d.ts +4 -0
- package/dist/HalfBlock/index.d.ts +3 -0
- package/dist/Image/Image.stories.d.ts +10 -0
- package/dist/Image/Image.types.d.ts +38 -0
- package/dist/Image/RenderPicture.d.ts +4 -0
- package/dist/Image/index.d.ts +3 -0
- package/dist/ImportantLead/ImportantLead.stories.d.ts +10 -0
- package/dist/ImportantLead/ImportantLead.types.d.ts +4 -0
- package/dist/ImportantLead/index.d.ts +3 -0
- package/dist/Lazy/Lazy.stories.d.ts +10 -0
- package/dist/Lazy/Lazy.types.d.ts +5 -0
- package/dist/Lazy/index.d.ts +3 -0
- package/dist/ListBlock/ListBlock.stories.d.ts +10 -0
- package/dist/ListBlock/ListBlock.types.d.ts +4 -0
- package/dist/ListBlock/index.d.ts +3 -0
- package/dist/MaterialNote/MaterialNote.stories.d.ts +10 -0
- package/dist/MaterialNote/MaterialNote.types.d.ts +12 -0
- package/dist/MaterialNote/index.d.ts +3 -0
- package/dist/MaterialTitle/MaterialTitle.stories.d.ts +10 -0
- package/dist/MaterialTitle/MaterialTitle.types.d.ts +4 -0
- package/dist/MaterialTitle/index.d.ts +5 -0
- package/dist/MediaCaption/MediaCaption.stories.d.ts +10 -0
- package/dist/MediaCaption/MediaCaption.types.d.ts +5 -0
- package/dist/MediaCaption/index.d.ts +3 -0
- package/dist/Meta/Meta.stories.d.ts +10 -0
- package/dist/Meta/Meta.types.d.ts +18 -0
- package/dist/Meta/MetaContainer.d.ts +3 -0
- package/dist/Meta/index.d.ts +3 -0
- package/dist/MetaItem/MetaItem.stories.d.ts +10 -0
- package/dist/MetaItem/MetaItem.types.d.ts +7 -0
- package/dist/MetaItem/index.d.ts +3 -0
- package/dist/MetaItemLive/MetaItemLive.stories.d.ts +10 -0
- package/dist/MetaItemLive/MetaItemLive.types.d.ts +3 -0
- package/dist/MetaItemLive/index.d.ts +3 -0
- package/dist/Popover/Popover.stories.d.ts +10 -0
- package/dist/Popover/Popover.types.d.ts +5 -0
- package/dist/Popover/index.d.ts +3 -0
- package/dist/QuoteBlock/QuoteBlock.stories.d.ts +10 -0
- package/dist/QuoteBlock/QuoteBlock.types.d.ts +6 -0
- package/dist/QuoteBlock/index.d.ts +3 -0
- package/dist/RawHtmlBlock/RawHtmlBlock.stories.d.ts +10 -0
- package/dist/RawHtmlBlock/RawHtmlBlock.types.d.ts +9 -0
- package/dist/RawHtmlBlock/index.d.ts +3 -0
- package/dist/RelatedBlock/RelatedBlock.stories.d.ts +10 -0
- package/dist/RelatedBlock/RelatedBlock.types.d.ts +4 -0
- package/dist/RelatedBlock/index.d.ts +3 -0
- package/dist/RenderBlocks/RenderBlocks.stories.d.ts +10 -0
- package/dist/RenderBlocks/RenderBlocks.types.d.ts +10 -0
- package/dist/RenderBlocks/index.d.ts +3 -0
- package/dist/RichTitle/RichTitle.stories.d.ts +10 -0
- package/dist/RichTitle/RichTitle.types.d.ts +4 -0
- package/dist/RichTitle/index.d.ts +3 -0
- package/dist/SimpleBlock/SimpleBlock.stories.d.ts +10 -0
- package/dist/SimpleBlock/SimpleBlock.types.d.ts +4 -0
- package/dist/SimpleBlock/index.d.ts +3 -0
- package/dist/SimpleTitle/SimpleTitle.stories.d.ts +10 -0
- package/dist/SimpleTitle/SimpleTitle.types.d.ts +4 -0
- package/dist/SimpleTitle/index.d.ts +3 -0
- package/dist/SourceBlock/SourceBlock.stories.d.ts +10 -0
- package/dist/SourceBlock/SourceBlock.types.d.ts +4 -0
- package/dist/SourceBlock/index.d.ts +3 -0
- package/dist/Spoiler/Spoiler.stories.d.ts +10 -0
- package/dist/Spoiler/Spoiler.types.d.ts +4 -0
- package/dist/Spoiler/index.d.ts +3 -0
- package/dist/SvgSymbol/SvgSymbol.stories.d.ts +10 -0
- package/dist/SvgSymbol/SvgSymbol.types.d.ts +8 -0
- package/dist/SvgSymbol/icons.d.ts +157 -0
- package/dist/SvgSymbol/index.d.ts +3 -0
- package/dist/Switcher/Switcher.stories.d.ts +10 -0
- package/dist/Switcher/Switcher.types.d.ts +12 -0
- package/dist/Switcher/index.d.ts +3 -0
- package/dist/Table/Table.stories.d.ts +10 -0
- package/dist/Table/Table.types.d.ts +25 -0
- package/dist/Table/index.d.ts +3 -0
- package/dist/Tag/Tag.stories.d.ts +10 -0
- package/dist/Tag/Tag.types.d.ts +12 -0
- package/dist/Tag/index.d.ts +3 -0
- package/dist/Timestamp/Timestamp.stories.d.ts +10 -0
- package/dist/Timestamp/Timestamp.types.d.ts +5 -0
- package/dist/Timestamp/index.d.ts +4 -0
- package/dist/Toolbar/Toolbar.stories.d.ts +10 -0
- package/dist/Toolbar/Toolbar.types.d.ts +5 -0
- package/dist/Toolbar/index.d.ts +3 -0
- package/dist/ToolbarButton/ToolbarButton.stories.d.ts +10 -0
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +9 -0
- package/dist/ToolbarButton/index.d.ts +3 -0
- package/dist/_storybook/PreviewWrapper/index.d.ts +6 -0
- package/dist/constants.d.ts +22 -0
- package/dist/index.d.ts +37 -0
- package/dist/ui-kit-2.cjs.development.css +36 -0
- package/dist/ui-kit-2.cjs.development.js +2187 -39
- package/dist/ui-kit-2.cjs.development.js.map +1 -1
- package/dist/ui-kit-2.cjs.production.min.js +1 -1
- package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
- package/dist/ui-kit-2.esm.js +2139 -32
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/utils/BlockContext.d.ts +8 -0
- package/dist/utils/DangerousHtml.d.ts +8 -0
- package/dist/utils/makeClassName.d.ts +1 -1
- package/dist/utils/makeStyleContext.d.ts +2 -0
- package/dist/utils/toCamel.d.ts +1 -0
- package/package.json +29 -13
- package/src/BookmarkButton/BookmarkButton.module.css +50 -0
- package/src/BookmarkButton/BookmarkButton.stories.module.css +5 -0
- package/src/BookmarkButton/BookmarkButton.stories.tsx +39 -0
- package/src/BookmarkButton/BookmarkButton.test.tsx +20 -0
- package/src/BookmarkButton/BookmarkButton.types.ts +6 -0
- package/src/BookmarkButton/index.tsx +37 -0
- package/src/Button/Button.stories.module.css +30 -0
- package/src/Button/Button.stories.tsx +87 -0
- package/src/Button/Button.test.tsx +42 -0
- package/src/Button/Button.types.ts +1 -3
- package/src/Button/index.tsx +2 -2
- package/src/CardTitle/CardTitle.module.css +52 -0
- package/src/CardTitle/CardTitle.stories.module.css +5 -0
- package/src/CardTitle/CardTitle.stories.tsx +36 -0
- package/src/CardTitle/CardTitle.test.tsx +20 -0
- package/src/CardTitle/CardTitle.types.ts +8 -0
- package/src/CardTitle/index.tsx +24 -0
- package/src/CardTitle/mock.json +8 -0
- package/src/ChapterBlock/ChapterBlock.module.css +70 -0
- package/src/ChapterBlock/ChapterBlock.stories.module.css +5 -0
- package/src/ChapterBlock/ChapterBlock.stories.tsx +36 -0
- package/src/ChapterBlock/ChapterBlock.test.tsx +20 -0
- package/src/ChapterBlock/ChapterBlock.types.ts +7 -0
- package/src/ChapterBlock/index.tsx +31 -0
- package/src/ChapterBlock/mock.json +5 -0
- package/src/Cover/Cover.module.css +5 -0
- package/src/Cover/Cover.stories.module.css +5 -0
- package/src/Cover/Cover.stories.tsx +34 -0
- package/src/Cover/Cover.test.tsx +20 -0
- package/src/Cover/Cover.types.ts +4 -0
- package/src/Cover/index.tsx +89 -0
- package/src/DocumentItemsCount/DocumentItemsCount.module.css +18 -0
- package/src/DocumentItemsCount/DocumentItemsCount.stories.module.css +5 -0
- package/src/DocumentItemsCount/DocumentItemsCount.stories.tsx +34 -0
- package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +20 -0
- package/src/DocumentItemsCount/DocumentItemsCount.types.ts +6 -0
- package/src/DocumentItemsCount/index.tsx +54 -0
- package/src/DotsOnImage/DotsOnImage.module.css +56 -0
- package/src/DotsOnImage/DotsOnImage.stories.module.css +9 -0
- package/src/DotsOnImage/DotsOnImage.stories.tsx +37 -0
- package/src/DotsOnImage/DotsOnImage.test.tsx +19 -0
- package/src/DotsOnImage/DotsOnImage.types.ts +46 -0
- package/src/DotsOnImage/index.tsx +79 -0
- package/src/DotsOnImage/mock.json +75 -0
- package/src/Dropdown/Dropdown.module.css +82 -0
- package/src/Dropdown/Dropdown.stories.module.css +5 -0
- package/src/Dropdown/Dropdown.stories.tsx +55 -0
- package/src/Dropdown/Dropdown.test.tsx +20 -0
- package/src/Dropdown/Dropdown.types.ts +5 -0
- package/src/Dropdown/index.tsx +35 -0
- package/src/EmbedBlock/EmbedBlock.module.css +351 -0
- package/src/EmbedBlock/EmbedBlock.stories.module.css +5 -0
- package/src/EmbedBlock/EmbedBlock.stories.tsx +39 -0
- package/src/EmbedBlock/EmbedBlock.test.tsx +20 -0
- package/src/EmbedBlock/EmbedBlock.tsx +236 -0
- package/src/EmbedBlock/EmbedBlock.types.ts +5 -0
- package/src/EmbedBlock/IframeBlock.tsx +86 -0
- package/src/EmbedBlock/index.tsx +16 -0
- package/src/EmbedBlock/mock.json +89 -0
- package/src/GroupedBlock/GroupedBlock.module.css +94 -0
- package/src/GroupedBlock/GroupedBlock.stories.module.css +5 -0
- package/src/GroupedBlock/GroupedBlock.stories.tsx +34 -0
- package/src/GroupedBlock/GroupedBlock.test.tsx +20 -0
- package/src/GroupedBlock/GroupedBlock.types.ts +4 -0
- package/src/GroupedBlock/index.tsx +67 -0
- package/src/HalfBlock/HalfBlock.module.css +88 -0
- package/src/HalfBlock/HalfBlock.stories.module.css +5 -0
- package/src/HalfBlock/HalfBlock.stories.tsx +34 -0
- package/src/HalfBlock/HalfBlock.test.tsx +20 -0
- package/src/HalfBlock/HalfBlock.types.ts +4 -0
- package/src/HalfBlock/index.tsx +53 -0
- package/src/Image/Image.module.css +78 -0
- package/src/Image/Image.stories.module.css +5 -0
- package/src/Image/Image.stories.tsx +47 -0
- package/src/Image/Image.test.tsx +33 -0
- package/src/Image/Image.types.ts +40 -0
- package/src/Image/RenderPicture.tsx +70 -0
- package/src/Image/index.tsx +101 -0
- package/src/Image/mock.json +49 -0
- package/src/ImportantLead/ImportantLead.module.css +64 -0
- package/src/ImportantLead/ImportantLead.stories.module.css +5 -0
- package/src/ImportantLead/ImportantLead.stories.tsx +34 -0
- package/src/ImportantLead/ImportantLead.test.tsx +20 -0
- package/src/ImportantLead/ImportantLead.types.ts +4 -0
- package/src/ImportantLead/index.tsx +35 -0
- package/src/Lazy/Lazy.module.css +9 -0
- package/src/Lazy/Lazy.stories.module.css +5 -0
- package/src/Lazy/Lazy.stories.tsx +48 -0
- package/src/Lazy/Lazy.test.tsx +20 -0
- package/src/Lazy/Lazy.types.ts +4 -0
- package/src/Lazy/index.tsx +41 -0
- package/src/ListBlock/ListBlock.module.css +163 -0
- package/src/ListBlock/ListBlock.stories.module.css +5 -0
- package/src/ListBlock/ListBlock.stories.tsx +34 -0
- package/src/ListBlock/ListBlock.test.tsx +20 -0
- package/src/ListBlock/ListBlock.types.ts +4 -0
- package/src/ListBlock/index.tsx +33 -0
- package/src/MaterialNote/MaterialNote.module.css +139 -0
- package/src/MaterialNote/MaterialNote.stories.module.css +5 -0
- package/src/MaterialNote/MaterialNote.stories.tsx +36 -0
- package/src/MaterialNote/MaterialNote.test.tsx +20 -0
- package/src/MaterialNote/MaterialNote.types.ts +12 -0
- package/src/MaterialNote/index.tsx +30 -0
- package/src/MaterialNote/mock.json +18 -0
- package/src/MaterialTitle/MaterialTitle.module.css +33 -0
- package/src/MaterialTitle/MaterialTitle.stories.module.css +13 -0
- package/src/MaterialTitle/MaterialTitle.stories.tsx +52 -0
- package/src/MaterialTitle/MaterialTitle.test.tsx +20 -0
- package/src/MaterialTitle/MaterialTitle.types.ts +3 -0
- package/src/MaterialTitle/index.tsx +20 -0
- package/src/MediaCaption/MediaCaption.module.css +85 -0
- package/src/MediaCaption/MediaCaption.stories.module.css +5 -0
- package/src/MediaCaption/MediaCaption.stories.tsx +37 -0
- package/src/MediaCaption/MediaCaption.test.tsx +20 -0
- package/src/MediaCaption/MediaCaption.types.ts +5 -0
- package/src/MediaCaption/index.tsx +35 -0
- package/src/Meta/Meta.module.css +106 -0
- package/src/Meta/Meta.stories.module.css +7 -0
- package/src/Meta/Meta.stories.tsx +69 -0
- package/src/Meta/Meta.test.tsx +20 -0
- package/src/Meta/Meta.types.ts +19 -0
- package/src/Meta/MetaContainer.tsx +148 -0
- package/src/Meta/index.tsx +32 -0
- package/src/MetaItem/MetaItem.module.css +104 -0
- package/src/MetaItem/MetaItem.stories.module.css +5 -0
- package/src/MetaItem/MetaItem.stories.tsx +34 -0
- package/src/MetaItem/MetaItem.test.tsx +20 -0
- package/src/MetaItem/MetaItem.types.ts +6 -0
- package/src/MetaItem/index.tsx +26 -0
- package/src/MetaItemLive/MetaItemLive.module.css +124 -0
- package/src/MetaItemLive/MetaItemLive.stories.module.css +5 -0
- package/src/MetaItemLive/MetaItemLive.stories.tsx +34 -0
- package/src/MetaItemLive/MetaItemLive.test.tsx +20 -0
- package/src/MetaItemLive/MetaItemLive.types.ts +3 -0
- package/src/MetaItemLive/index.tsx +25 -0
- package/src/Popover/Popover.module.css +134 -0
- package/src/Popover/Popover.stories.module.css +5 -0
- package/src/Popover/Popover.stories.tsx +55 -0
- package/src/Popover/Popover.test.tsx +20 -0
- package/src/Popover/Popover.types.ts +4 -0
- package/src/Popover/index.tsx +78 -0
- package/src/QuoteBlock/QuoteBlock.module.css +79 -0
- package/src/QuoteBlock/QuoteBlock.stories.module.css +7 -0
- package/src/QuoteBlock/QuoteBlock.stories.tsx +36 -0
- package/src/QuoteBlock/QuoteBlock.test.tsx +20 -0
- package/src/QuoteBlock/QuoteBlock.types.ts +6 -0
- package/src/QuoteBlock/index.tsx +24 -0
- package/src/QuoteBlock/mock.json +6 -0
- package/src/RawHtmlBlock/RawHtmlBlock.stories.module.css +5 -0
- package/src/RawHtmlBlock/RawHtmlBlock.stories.tsx +34 -0
- package/src/RawHtmlBlock/RawHtmlBlock.test.tsx +20 -0
- package/src/RawHtmlBlock/RawHtmlBlock.types.ts +9 -0
- package/src/RawHtmlBlock/index.tsx +57 -0
- package/src/RelatedBlock/RelatedBlock.module.css +129 -0
- package/src/RelatedBlock/RelatedBlock.stories.module.css +5 -0
- package/src/RelatedBlock/RelatedBlock.stories.tsx +34 -0
- package/src/RelatedBlock/RelatedBlock.test.tsx +20 -0
- package/src/RelatedBlock/RelatedBlock.types.ts +4 -0
- package/src/RelatedBlock/index.tsx +45 -0
- package/src/RenderBlocks/RenderBlocks.stories.module.css +5 -0
- package/src/RenderBlocks/RenderBlocks.stories.tsx +34 -0
- package/src/RenderBlocks/RenderBlocks.test.tsx +20 -0
- package/src/RenderBlocks/RenderBlocks.types.ts +10 -0
- package/src/RenderBlocks/index.tsx +125 -0
- package/src/RichTitle/RichTitle.module.css +85 -0
- package/src/RichTitle/RichTitle.stories.module.css +5 -0
- package/src/RichTitle/RichTitle.stories.tsx +34 -0
- package/src/RichTitle/RichTitle.test.tsx +20 -0
- package/src/RichTitle/RichTitle.types.ts +4 -0
- package/src/RichTitle/index.tsx +32 -0
- package/src/SimpleBlock/FootnoteLink.css +34 -0
- package/src/SimpleBlock/SimpleBlock.module.css +393 -0
- package/src/SimpleBlock/SimpleBlock.stories.module.css +5 -0
- package/src/SimpleBlock/SimpleBlock.stories.tsx +34 -0
- package/src/SimpleBlock/SimpleBlock.test.tsx +20 -0
- package/src/SimpleBlock/SimpleBlock.types.ts +4 -0
- package/src/SimpleBlock/index.tsx +47 -0
- package/src/SimpleTitle/SimpleTitle.module.css +33 -0
- package/src/SimpleTitle/SimpleTitle.stories.module.css +5 -0
- package/src/SimpleTitle/SimpleTitle.stories.tsx +34 -0
- package/src/SimpleTitle/SimpleTitle.test.tsx +20 -0
- package/src/SimpleTitle/SimpleTitle.types.ts +4 -0
- package/src/SimpleTitle/index.tsx +29 -0
- package/src/SourceBlock/SourceBlock.module.css +110 -0
- package/src/SourceBlock/SourceBlock.stories.module.css +5 -0
- package/src/SourceBlock/SourceBlock.stories.tsx +34 -0
- package/src/SourceBlock/SourceBlock.test.tsx +20 -0
- package/src/SourceBlock/SourceBlock.types.ts +4 -0
- package/src/SourceBlock/index.tsx +44 -0
- package/src/Spoiler/Spoiler.module.css +177 -0
- package/src/Spoiler/Spoiler.stories.module.css +8 -0
- package/src/Spoiler/Spoiler.stories.tsx +36 -0
- package/src/Spoiler/Spoiler.test.tsx +20 -0
- package/src/Spoiler/Spoiler.types.ts +4 -0
- package/src/Spoiler/index.tsx +81 -0
- package/src/Spoiler/mock.json +49 -0
- package/src/SvgSymbol/SvgSymbol.module.css +240 -0
- package/src/SvgSymbol/SvgSymbol.stories.module.css +127 -0
- package/src/SvgSymbol/SvgSymbol.stories.tsx +95 -0
- package/src/SvgSymbol/SvgSymbol.test.tsx +21 -0
- package/src/SvgSymbol/SvgSymbol.types.ts +57 -0
- package/src/SvgSymbol/icons.ts +217 -0
- package/src/SvgSymbol/index.tsx +32 -0
- package/src/Switcher/Switcher.module.css +159 -0
- package/src/Switcher/Switcher.stories.module.css +28 -0
- package/src/Switcher/Switcher.stories.tsx +68 -0
- package/src/Switcher/Switcher.test.tsx +43 -0
- package/src/Switcher/Switcher.types.ts +16 -0
- package/src/Switcher/index.tsx +53 -0
- package/src/Table/Table.module.css +300 -0
- package/src/Table/Table.stories.module.css +5 -0
- package/src/Table/Table.stories.tsx +36 -0
- package/src/Table/Table.test.tsx +20 -0
- package/src/Table/Table.types.ts +26 -0
- package/src/Table/index.tsx +76 -0
- package/src/Table/mock.json +301 -0
- package/src/Tag/Tag.module.css +115 -0
- package/src/Tag/Tag.stories.module.css +5 -0
- package/src/Tag/Tag.stories.tsx +53 -0
- package/src/Tag/Tag.test.tsx +20 -0
- package/src/Tag/Tag.types.ts +14 -0
- package/src/Tag/index.tsx +33 -0
- package/src/Timestamp/Timestamp.module.css +6 -0
- package/src/Timestamp/Timestamp.stories.module.css +5 -0
- package/src/Timestamp/Timestamp.stories.tsx +34 -0
- package/src/Timestamp/Timestamp.test.tsx +20 -0
- package/src/Timestamp/Timestamp.types.ts +5 -0
- package/src/Timestamp/index.tsx +40 -0
- package/src/Toolbar/Toolbar.module.css +134 -0
- package/src/Toolbar/Toolbar.stories.module.css +5 -0
- package/src/Toolbar/Toolbar.stories.tsx +89 -0
- package/src/Toolbar/Toolbar.test.tsx +20 -0
- package/src/Toolbar/Toolbar.types.ts +4 -0
- package/src/Toolbar/index.tsx +28 -0
- package/src/ToolbarButton/ToolbarButton.module.css +97 -0
- package/src/ToolbarButton/ToolbarButton.stories.module.css +5 -0
- package/src/ToolbarButton/ToolbarButton.stories.tsx +36 -0
- package/src/ToolbarButton/ToolbarButton.test.tsx +20 -0
- package/src/ToolbarButton/ToolbarButton.types.ts +19 -0
- package/src/ToolbarButton/index.tsx +34 -0
- package/src/_storybook/PreviewWrapper/PreviewWrapper.module.css +117 -0
- package/src/_storybook/PreviewWrapper/index.tsx +23 -0
- package/src/constants.ts +24 -0
- package/src/index.tsx +38 -0
- package/src/utils/BlockContext.ts +7 -0
- package/src/utils/DangerousHtml.tsx +79 -0
- package/src/utils/makeClassName.ts +1 -1
- package/src/utils/makeStyleContext.ts +13 -0
- package/src/utils/toCamel.ts +2 -0
- package/LICENSE +0 -21
- package/src/global.d.ts +0 -4
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
@import './FootnoteLink';
|
|
3
|
+
|
|
4
|
+
.p {
|
|
5
|
+
margin: 0 0 14px;
|
|
6
|
+
|
|
7
|
+
font-family: $primaryFont;
|
|
8
|
+
font-size: 18px;
|
|
9
|
+
line-height: 24px;
|
|
10
|
+
|
|
11
|
+
@media $mobile {
|
|
12
|
+
margin: 0 0 20px;
|
|
13
|
+
|
|
14
|
+
font-size: 20px;
|
|
15
|
+
line-height: 28px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.p a,
|
|
20
|
+
.h2 a,
|
|
21
|
+
.h3 a,
|
|
22
|
+
.h4 a,
|
|
23
|
+
.lead a,
|
|
24
|
+
.lead_hr a,
|
|
25
|
+
.context_p a {
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
|
|
28
|
+
color: inherit;
|
|
29
|
+
box-shadow: inset 0 -1px $gold;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.p a:hover,
|
|
33
|
+
.h2 a:hover,
|
|
34
|
+
.h3 a:hover,
|
|
35
|
+
.h4 a:hover,
|
|
36
|
+
.lead a:hover,
|
|
37
|
+
.lead_hr a:hover,
|
|
38
|
+
.context_p a:hover {
|
|
39
|
+
color: $gold;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.h3:first-child,
|
|
43
|
+
.h4:first-child,
|
|
44
|
+
.p:first-child,
|
|
45
|
+
.lead:first-child,
|
|
46
|
+
.blockquote:first-child {
|
|
47
|
+
margin-top: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.p:last-child,
|
|
51
|
+
.blockquote:last-child,
|
|
52
|
+
.lead:last-child,
|
|
53
|
+
.game.lead:last-child,
|
|
54
|
+
.slide.lead:last-child,
|
|
55
|
+
.h2:last-child {
|
|
56
|
+
margin-bottom: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.h2 {
|
|
60
|
+
max-width: 520px;
|
|
61
|
+
margin: 0 0 15px;
|
|
62
|
+
|
|
63
|
+
font-family: $primaryFont;
|
|
64
|
+
font-size: 25px;
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
line-height: 28px;
|
|
67
|
+
|
|
68
|
+
@media $mobile {
|
|
69
|
+
margin: 0 0 45px;
|
|
70
|
+
|
|
71
|
+
font-size: 37px;
|
|
72
|
+
line-height: 39px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.h2 + figure {
|
|
77
|
+
margin-top: 15px;
|
|
78
|
+
|
|
79
|
+
@media $mobile {
|
|
80
|
+
margin-top: -20px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.h3 {
|
|
85
|
+
margin-top: 29px;
|
|
86
|
+
margin-bottom: 10px;
|
|
87
|
+
|
|
88
|
+
font-family: $secondaryFont;
|
|
89
|
+
font-size: 20px;
|
|
90
|
+
font-weight: bold;
|
|
91
|
+
line-height: 24px;
|
|
92
|
+
|
|
93
|
+
@media $mobile {
|
|
94
|
+
margin-top: 45px;
|
|
95
|
+
margin-bottom: 15px;
|
|
96
|
+
|
|
97
|
+
font-size: 28px;
|
|
98
|
+
line-height: 34px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.h4 {
|
|
103
|
+
margin-top: 26px;
|
|
104
|
+
margin-bottom: 11px;
|
|
105
|
+
|
|
106
|
+
font-family: $secondaryFont;
|
|
107
|
+
font-size: 17px;
|
|
108
|
+
font-weight: bold;
|
|
109
|
+
line-height: 21px;
|
|
110
|
+
|
|
111
|
+
@media $mobile {
|
|
112
|
+
margin-top: 45px;
|
|
113
|
+
margin-bottom: 15px;
|
|
114
|
+
|
|
115
|
+
font-size: 21px;
|
|
116
|
+
line-height: 28px;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.h3 + .h3,
|
|
121
|
+
.h2 + .h2 {
|
|
122
|
+
margin-top: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.h3 + .h4 {
|
|
126
|
+
margin-top: 15px;
|
|
127
|
+
|
|
128
|
+
@media $mobile {
|
|
129
|
+
margin-top: 15px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.p + ul,
|
|
134
|
+
.p + ol,
|
|
135
|
+
.game.lead + ul,
|
|
136
|
+
.game.lead + ol {
|
|
137
|
+
margin-top: -9px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.blockquote {
|
|
141
|
+
margin: 16px 0;
|
|
142
|
+
padding: 12px 12px 13px;
|
|
143
|
+
|
|
144
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
145
|
+
border-radius: 8px;
|
|
146
|
+
background: #fff8c4;
|
|
147
|
+
|
|
148
|
+
font-family: $secondaryFont;
|
|
149
|
+
font-size: 16px;
|
|
150
|
+
font-weight: normal;
|
|
151
|
+
line-height: 22px;
|
|
152
|
+
|
|
153
|
+
@media $mobile {
|
|
154
|
+
margin: 25px 0;
|
|
155
|
+
padding: 12px 15px 13px;
|
|
156
|
+
|
|
157
|
+
font-size: 18px;
|
|
158
|
+
line-height: 26px;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.blockquote a {
|
|
163
|
+
text-decoration: none;
|
|
164
|
+
|
|
165
|
+
color: #000;
|
|
166
|
+
box-shadow: inset 0 -1px #000;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.blockquote a:hover {
|
|
170
|
+
color: $gold;
|
|
171
|
+
box-shadow: inset 0 -1px $gold;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.blockquote.dark {
|
|
175
|
+
color: #000;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.lead {
|
|
179
|
+
position: relative;
|
|
180
|
+
|
|
181
|
+
margin-top: 30px;
|
|
182
|
+
margin-bottom: 0;
|
|
183
|
+
|
|
184
|
+
font-family: $secondaryFont;
|
|
185
|
+
font-size: 16px;
|
|
186
|
+
line-height: 22px;
|
|
187
|
+
|
|
188
|
+
@media $mobile {
|
|
189
|
+
margin-top: 25px;
|
|
190
|
+
|
|
191
|
+
font-size: 20px;
|
|
192
|
+
line-height: 28px;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.lead [data-body] {
|
|
197
|
+
padding-top: 1px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.lead_hr {
|
|
201
|
+
display: block;
|
|
202
|
+
|
|
203
|
+
width: 100%;
|
|
204
|
+
max-width: 650px;
|
|
205
|
+
margin: 30px auto;
|
|
206
|
+
|
|
207
|
+
border-bottom: 1px solid #e5e5e5;
|
|
208
|
+
|
|
209
|
+
@media $mobile {
|
|
210
|
+
margin: 45px auto;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
mark {
|
|
215
|
+
position: relative;
|
|
216
|
+
|
|
217
|
+
white-space: pre-wrap;
|
|
218
|
+
|
|
219
|
+
background-color: $highlighter;
|
|
220
|
+
|
|
221
|
+
font-weight: inherit;
|
|
222
|
+
font-style: inherit;
|
|
223
|
+
|
|
224
|
+
@media $mobile {
|
|
225
|
+
padding-bottom: 1px;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
a mark {
|
|
230
|
+
z-index: 1;
|
|
231
|
+
|
|
232
|
+
padding-bottom: 0;
|
|
233
|
+
|
|
234
|
+
color: inherit;
|
|
235
|
+
box-shadow: inset 0 -1px $gold, 0 1px $highlighter;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.context_p {
|
|
239
|
+
position: relative;
|
|
240
|
+
|
|
241
|
+
margin: 0 0 15px;
|
|
242
|
+
padding: 0 0 0 23px;
|
|
243
|
+
|
|
244
|
+
font-family: $primaryFont;
|
|
245
|
+
font-size: 18px;
|
|
246
|
+
line-height: 22px;
|
|
247
|
+
|
|
248
|
+
@media $portraitTablet {
|
|
249
|
+
padding: 0 0 0 38px;
|
|
250
|
+
|
|
251
|
+
font-size: 20px;
|
|
252
|
+
line-height: 27px;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.context_p::before {
|
|
257
|
+
position: absolute;
|
|
258
|
+
top: 0;
|
|
259
|
+
left: 5px;
|
|
260
|
+
|
|
261
|
+
width: 8px;
|
|
262
|
+
|
|
263
|
+
content: '\2022';
|
|
264
|
+
text-align: center;
|
|
265
|
+
|
|
266
|
+
color: $gold;
|
|
267
|
+
|
|
268
|
+
font-size: 18px;
|
|
269
|
+
line-height: inherit;
|
|
270
|
+
|
|
271
|
+
@media $portraitTablet {
|
|
272
|
+
left: 0;
|
|
273
|
+
|
|
274
|
+
width: 36px;
|
|
275
|
+
|
|
276
|
+
text-align: center;
|
|
277
|
+
|
|
278
|
+
font-size: 20px;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.isInIntro.lead::after {
|
|
283
|
+
content: none;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.center {
|
|
287
|
+
max-width: 650px;
|
|
288
|
+
margin-right: auto;
|
|
289
|
+
margin-left: auto;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.center.lead {
|
|
293
|
+
@media $portraitTablet {
|
|
294
|
+
font-size: 20px;
|
|
295
|
+
line-height: 28px;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.game.lead {
|
|
300
|
+
margin-bottom: 18px;
|
|
301
|
+
|
|
302
|
+
@media $portraitTablet {
|
|
303
|
+
margin-top: 27px;
|
|
304
|
+
margin-bottom: 20px;
|
|
305
|
+
|
|
306
|
+
font-size: 20px;
|
|
307
|
+
line-height: 28px;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.slide.lead {
|
|
312
|
+
margin-bottom: 15px;
|
|
313
|
+
|
|
314
|
+
@media $portraitTablet {
|
|
315
|
+
margin-top: 20px;
|
|
316
|
+
|
|
317
|
+
font-size: 20px;
|
|
318
|
+
line-height: 28px;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.slide.lead + .lead,
|
|
323
|
+
.game.lead + .lead {
|
|
324
|
+
margin-top: 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.isInImportantLead {
|
|
328
|
+
font-family: $secondaryFont;
|
|
329
|
+
font-size: 16px;
|
|
330
|
+
line-height: 22px;
|
|
331
|
+
|
|
332
|
+
@media $portraitTablet {
|
|
333
|
+
font-size: 18px;
|
|
334
|
+
line-height: 26px;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.slide {
|
|
339
|
+
max-width: 650px;
|
|
340
|
+
margin-right: auto;
|
|
341
|
+
margin-left: auto;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.isInAnswer.p {
|
|
345
|
+
margin-top: 6px;
|
|
346
|
+
margin-bottom: 6px;
|
|
347
|
+
|
|
348
|
+
font-family: $secondaryFont;
|
|
349
|
+
font-size: 16px;
|
|
350
|
+
line-height: 22px;
|
|
351
|
+
|
|
352
|
+
@media $portraitTablet {
|
|
353
|
+
margin-top: 12px;
|
|
354
|
+
margin-bottom: 12px;
|
|
355
|
+
|
|
356
|
+
font-size: 18px;
|
|
357
|
+
line-height: 26px;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.isInAnswer.blockquote {
|
|
362
|
+
margin-top: 12px;
|
|
363
|
+
margin-bottom: 12px;
|
|
364
|
+
|
|
365
|
+
@media $portraitTablet {
|
|
366
|
+
margin-top: 10px;
|
|
367
|
+
margin-bottom: 10px;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.isInAnswer:first-child {
|
|
372
|
+
margin-top: 6px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.isInAnswer:last-child {
|
|
376
|
+
margin-bottom: 0;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/* VISIBILITY */
|
|
380
|
+
|
|
381
|
+
.mobile {
|
|
382
|
+
@media $mobile {
|
|
383
|
+
display: none;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.desktop {
|
|
388
|
+
display: none;
|
|
389
|
+
|
|
390
|
+
@media $mobile {
|
|
391
|
+
display: block;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { SimpleBlock } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './SimpleBlock.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / SimpleBlock',
|
|
9
|
+
component: SimpleBlock,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<SimpleBlock />
|
|
20
|
+
</div>
|
|
21
|
+
</>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Default: React.FC = () => (
|
|
26
|
+
<>
|
|
27
|
+
<PreviewWrapper theme="light">
|
|
28
|
+
<Example />
|
|
29
|
+
</PreviewWrapper>
|
|
30
|
+
<PreviewWrapper theme="dark">
|
|
31
|
+
<Example />
|
|
32
|
+
</PreviewWrapper>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
|
|
4
|
+
import { SimpleBlock } from './'
|
|
5
|
+
import { SimpleBlockProps } from './SimpleBlock.types'
|
|
6
|
+
import styles from './SimpleBlock.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Simple Block', () => {
|
|
9
|
+
let props: SimpleBlockProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<SimpleBlock {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const simpleBlock = getByTestId('simple-block')
|
|
17
|
+
|
|
18
|
+
expect(simpleBlock).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { SimpleBlockProps } from './SimpleBlock.types'
|
|
3
|
+
|
|
4
|
+
import makeClassName from '../utils/makeClassName'
|
|
5
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
+
import DangerousHTML from '../utils/DangerousHtml'
|
|
7
|
+
|
|
8
|
+
import styles from './SimpleBlock.module.css'
|
|
9
|
+
|
|
10
|
+
export const SimpleBlock: React.FC<SimpleBlockProps> = ({
|
|
11
|
+
block: { data, type, only_on: onlyOn },
|
|
12
|
+
styleContext
|
|
13
|
+
}) => {
|
|
14
|
+
let tagName
|
|
15
|
+
|
|
16
|
+
let classNames: (string[] | string | boolean)[][] = [
|
|
17
|
+
[styles[type], !!type && !!styles[type]],
|
|
18
|
+
[styles[onlyOn], true]
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
if (styleContext) {
|
|
22
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (type) {
|
|
26
|
+
case 'context_p':
|
|
27
|
+
case 'lead':
|
|
28
|
+
case 'note_caption':
|
|
29
|
+
case 'note_credit': {
|
|
30
|
+
tagName = 'p'
|
|
31
|
+
break
|
|
32
|
+
}
|
|
33
|
+
case 'lead_hr': {
|
|
34
|
+
tagName = 'div'
|
|
35
|
+
break
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
tagName = type
|
|
39
|
+
}
|
|
40
|
+
return (
|
|
41
|
+
<DangerousHTML
|
|
42
|
+
className={makeClassName(classNames)}
|
|
43
|
+
html={data || ''}
|
|
44
|
+
tagName={tagName}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
margin: 0 0 18px;
|
|
5
|
+
|
|
6
|
+
font-family: $primaryFont;
|
|
7
|
+
font-size: 20px;
|
|
8
|
+
font-weight: normal;
|
|
9
|
+
line-height: 23px;
|
|
10
|
+
|
|
11
|
+
@media $portraitTablet {
|
|
12
|
+
margin-bottom: 15px;
|
|
13
|
+
|
|
14
|
+
font-size: 36px;
|
|
15
|
+
line-height: 40px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* VISIBILITY */
|
|
20
|
+
|
|
21
|
+
.mobile {
|
|
22
|
+
@media $mobile {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.desktop {
|
|
28
|
+
display: none;
|
|
29
|
+
|
|
30
|
+
@media $mobile {
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { SimpleTitle } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './SimpleTitle.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / SimpleTitle',
|
|
9
|
+
component: SimpleTitle,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<SimpleTitle />
|
|
20
|
+
</div>
|
|
21
|
+
</>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Default: React.FC = () => (
|
|
26
|
+
<>
|
|
27
|
+
<PreviewWrapper theme="light">
|
|
28
|
+
<Example />
|
|
29
|
+
</PreviewWrapper>
|
|
30
|
+
<PreviewWrapper theme="dark">
|
|
31
|
+
<Example />
|
|
32
|
+
</PreviewWrapper>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
|
|
4
|
+
import { SimpleTitle } from './'
|
|
5
|
+
import { SimpleTitleProps } from './SimpleTitle.types'
|
|
6
|
+
import styles from './SimpleTitle.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Simple Title', () => {
|
|
9
|
+
let props: SimpleTitleProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<SimpleTitle {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const simpleTitle = getByTestId('simple-title')
|
|
17
|
+
|
|
18
|
+
expect(simpleTitle).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { SimpleTitleProps } from './SimpleTitle.types'
|
|
3
|
+
import makeClassName from '../utils/makeClassName'
|
|
4
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
5
|
+
|
|
6
|
+
import styles from './SimpleTitle.module.css'
|
|
7
|
+
|
|
8
|
+
export const SimpleTitle: React.FC<SimpleTitleProps> = ({
|
|
9
|
+
block: {
|
|
10
|
+
data: { first },
|
|
11
|
+
only_on: onlyOn
|
|
12
|
+
},
|
|
13
|
+
styleContext
|
|
14
|
+
}) => {
|
|
15
|
+
let classNames: (string[] | string | boolean)[][] = [
|
|
16
|
+
[styles.root, true],
|
|
17
|
+
[styles[onlyOn], true]
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
if (styleContext) {
|
|
21
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div data-testid="simple-title" className={makeClassName(classNames)}>
|
|
26
|
+
{first}
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
}
|