@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,129 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
margin: 16px 0;
|
|
5
|
+
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
background-color: $platinum;
|
|
8
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 4px 0 0 #b78b5c;
|
|
9
|
+
|
|
10
|
+
@media $portraitTablet {
|
|
11
|
+
margin: 25px 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.root:last-child {
|
|
16
|
+
margin-bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.root:first-child {
|
|
20
|
+
margin-top: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.root a {
|
|
24
|
+
display: block;
|
|
25
|
+
|
|
26
|
+
padding: $gapSmall $gapSmall 13px;
|
|
27
|
+
|
|
28
|
+
transition: color 0.15s;
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
|
|
31
|
+
color: #000;
|
|
32
|
+
box-shadow: none;
|
|
33
|
+
|
|
34
|
+
font-size: 17px;
|
|
35
|
+
line-height: 20px;
|
|
36
|
+
|
|
37
|
+
@media $portraitTablet {
|
|
38
|
+
padding: 15px 20px 17px;
|
|
39
|
+
|
|
40
|
+
font-size: 19px;
|
|
41
|
+
line-height: 23px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.root a:hover {
|
|
46
|
+
color: #5c5c5c;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.header {
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: 14px 12px 3px;
|
|
52
|
+
|
|
53
|
+
letter-spacing: 1px;
|
|
54
|
+
text-transform: uppercase;
|
|
55
|
+
|
|
56
|
+
color: #7F7F7F;
|
|
57
|
+
|
|
58
|
+
font-family: $secondaryFont;
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
font-weight: 600;
|
|
61
|
+
line-height: 17px;
|
|
62
|
+
|
|
63
|
+
@media $portraitTablet {
|
|
64
|
+
padding: 20px 20px 14px;
|
|
65
|
+
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
line-height: 16px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.items {
|
|
72
|
+
margin: 0;
|
|
73
|
+
padding-left: 0;
|
|
74
|
+
|
|
75
|
+
list-style: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.items li {
|
|
79
|
+
padding: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.items li + li {
|
|
83
|
+
border-top: 1px solid #e6e6e6;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.rich .first {
|
|
87
|
+
font-family: $secondaryFont;
|
|
88
|
+
font-size: 16px;
|
|
89
|
+
font-weight: 700;
|
|
90
|
+
line-height: 18px;
|
|
91
|
+
|
|
92
|
+
@media $portraitTablet {
|
|
93
|
+
font-size: 18px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.simple {
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.center {
|
|
101
|
+
max-width: 650px;
|
|
102
|
+
margin-right: auto;
|
|
103
|
+
margin-left: auto;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.isInSlideMaterial:first-child {
|
|
107
|
+
margin-top: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.isInSlideMaterial:last-child {
|
|
111
|
+
margin-bottom: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* VISIBILITY */
|
|
115
|
+
|
|
116
|
+
.mobile {
|
|
117
|
+
@media $mobile {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.desktop {
|
|
123
|
+
display: none;
|
|
124
|
+
|
|
125
|
+
@media $mobile {
|
|
126
|
+
display: block;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { RelatedBlock } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './RelatedBlock.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / RelatedBlock',
|
|
9
|
+
component: RelatedBlock,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<RelatedBlock />
|
|
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 { RelatedBlock } from './'
|
|
5
|
+
import { RelatedBlockProps } from './RelatedBlock.types'
|
|
6
|
+
import styles from './RelatedBlock.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Related Block', () => {
|
|
9
|
+
let props: RelatedBlockProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<RelatedBlock {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const relatedBlock = getByTestId('related-block')
|
|
17
|
+
|
|
18
|
+
expect(relatedBlock).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RelatedBlockProps } from './RelatedBlock.types'
|
|
3
|
+
|
|
4
|
+
import makeClassName from '../utils/makeClassName'
|
|
5
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
+
|
|
7
|
+
import styles from './RelatedBlock.module.css'
|
|
8
|
+
|
|
9
|
+
export const RelatedBlock: React.FC<RelatedBlockProps> = ({
|
|
10
|
+
block: {
|
|
11
|
+
data: { title, related },
|
|
12
|
+
only_on: onlyOn
|
|
13
|
+
},
|
|
14
|
+
styleContext
|
|
15
|
+
}) => {
|
|
16
|
+
let classNames: (string[] | string | boolean)[][] = [
|
|
17
|
+
[styles.root, true],
|
|
18
|
+
[styles[onlyOn], true]
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
if (styleContext) {
|
|
22
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div data-testid="related-block" className={makeClassName(classNames)}>
|
|
27
|
+
<h3 className={styles.header}>{title}</h3>
|
|
28
|
+
<ul className={styles.items}>
|
|
29
|
+
{related.map((item, index) => (
|
|
30
|
+
<li key={item.id || index} className={styles[item.layout]}>
|
|
31
|
+
<a
|
|
32
|
+
href={item.full_url || `/${item.url}`}
|
|
33
|
+
target="_blank"
|
|
34
|
+
rel="noopener noreferrer"
|
|
35
|
+
>
|
|
36
|
+
<span className={styles.first}>{item.title}</span>
|
|
37
|
+
{item.second_title && ' '}
|
|
38
|
+
{item.second_title && <span>{item.second_title}</span>}
|
|
39
|
+
</a>
|
|
40
|
+
</li>
|
|
41
|
+
))}
|
|
42
|
+
</ul>
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { RenderBlocks } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './RenderBlocks.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / RenderBlocks',
|
|
9
|
+
component: RenderBlocks,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<RenderBlocks />
|
|
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 { RenderBlocks } from './'
|
|
5
|
+
import { RenderBlocksProps } from './RenderBlocks.types'
|
|
6
|
+
import styles from './RenderBlocks.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Render Blocks', () => {
|
|
9
|
+
let props: RenderBlocksProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<RenderBlocks {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const renderBlocks = getByTestId('render-blocks')
|
|
17
|
+
|
|
18
|
+
expect(renderBlocks).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RenderBlocksProps } from './RenderBlocks.types'
|
|
3
|
+
|
|
4
|
+
import { Tag } from '../Tag'
|
|
5
|
+
import { SimpleTitle } from '../SimpleTitle'
|
|
6
|
+
import { RichTitle } from '../RichTitle'
|
|
7
|
+
import { SimpleBlock } from '../SimpleBlock'
|
|
8
|
+
import { ListBlock } from '../ListBlock'
|
|
9
|
+
import { ChapterBlock } from '../ChapterBlock'
|
|
10
|
+
import { QuoteBlock } from '../QuoteBlock'
|
|
11
|
+
import { CardTitle } from '../CardTitle'
|
|
12
|
+
import { RelatedBlock } from '../RelatedBlock'
|
|
13
|
+
import { SourceBlock } from '../SourceBlock'
|
|
14
|
+
import { EmbedBlockContainer } from '../EmbedBlock'
|
|
15
|
+
import { GroupedBlock } from '../GroupedBlock'
|
|
16
|
+
import { MetaContainer } from '../Meta/MetaContainer'
|
|
17
|
+
import { Table } from '../Table'
|
|
18
|
+
import { MaterialNote } from '../MaterialNote'
|
|
19
|
+
|
|
20
|
+
export const RenderBlocks: React.FC<RenderBlocksProps> = ({
|
|
21
|
+
block,
|
|
22
|
+
styleContext,
|
|
23
|
+
lang,
|
|
24
|
+
isRead,
|
|
25
|
+
isListened,
|
|
26
|
+
bookmarkAction,
|
|
27
|
+
isInBookmarks
|
|
28
|
+
}) => {
|
|
29
|
+
switch (block.type) {
|
|
30
|
+
case 'tag': {
|
|
31
|
+
return (
|
|
32
|
+
<Tag
|
|
33
|
+
size="large"
|
|
34
|
+
onlyOn={block.only_on}
|
|
35
|
+
theme={block.data.theme}
|
|
36
|
+
styleContext={styleContext}
|
|
37
|
+
>
|
|
38
|
+
{block.data.text}
|
|
39
|
+
</Tag>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
case 'simple_title': {
|
|
44
|
+
return <SimpleTitle block={block} styleContext={styleContext} />
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
case 'rich_title': {
|
|
48
|
+
return <RichTitle block={block} styleContext={styleContext} />
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
case 'meta': {
|
|
52
|
+
return (
|
|
53
|
+
<MetaContainer
|
|
54
|
+
block={block}
|
|
55
|
+
lang={block.data.lang}
|
|
56
|
+
styleContext={styleContext}
|
|
57
|
+
isRead={isRead}
|
|
58
|
+
isListened={isListened}
|
|
59
|
+
isInBookmarks={isInBookmarks}
|
|
60
|
+
bookmarkAction={bookmarkAction}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
case 'h1':
|
|
66
|
+
case 'h2':
|
|
67
|
+
case 'h3':
|
|
68
|
+
case 'h4':
|
|
69
|
+
case 'blockquote':
|
|
70
|
+
case 'p':
|
|
71
|
+
case 'context_p':
|
|
72
|
+
case 'lead':
|
|
73
|
+
case 'lead_hr': {
|
|
74
|
+
return <SimpleBlock block={block} styleContext={styleContext} />
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
case 'quote':
|
|
78
|
+
return <QuoteBlock block={block} styleContext={styleContext} />
|
|
79
|
+
|
|
80
|
+
case 'ol':
|
|
81
|
+
case 'ul': {
|
|
82
|
+
return <ListBlock block={block} styleContext={styleContext} />
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case 'chapter-subtitle': {
|
|
86
|
+
return <ChapterBlock block={block} styleContext={styleContext} />
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
case 'card_title': {
|
|
90
|
+
return <CardTitle block={block} styleContext={styleContext} />
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
case 'related': {
|
|
94
|
+
return <RelatedBlock block={block} styleContext={styleContext} />
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
case 'source':
|
|
98
|
+
return <SourceBlock block={block} styleContext={styleContext} />
|
|
99
|
+
|
|
100
|
+
case 'table':
|
|
101
|
+
return <Table block={block} styleContext={styleContext} />
|
|
102
|
+
|
|
103
|
+
case 'embed':
|
|
104
|
+
case 'embed_code':
|
|
105
|
+
case 'game_embed':
|
|
106
|
+
case 'image':
|
|
107
|
+
case 'gif':
|
|
108
|
+
return (
|
|
109
|
+
<EmbedBlockContainer
|
|
110
|
+
block={block}
|
|
111
|
+
styleContext={styleContext}
|
|
112
|
+
lang={lang}
|
|
113
|
+
/>
|
|
114
|
+
)
|
|
115
|
+
case 'grouped':
|
|
116
|
+
return <GroupedBlock block={block} styleContext={styleContext} />
|
|
117
|
+
|
|
118
|
+
case 'material_note':
|
|
119
|
+
return <MaterialNote block={block} styleContext={styleContext} />
|
|
120
|
+
|
|
121
|
+
default: {
|
|
122
|
+
return null
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
margin: 0 0 18px;
|
|
5
|
+
|
|
6
|
+
font-family: $secondaryFont;
|
|
7
|
+
font-size: 19px;
|
|
8
|
+
font-weight: 700;
|
|
9
|
+
line-height: 23px;
|
|
10
|
+
|
|
11
|
+
@media $portraitTablet {
|
|
12
|
+
margin-bottom: 15px;
|
|
13
|
+
|
|
14
|
+
font-size: 37px;
|
|
15
|
+
line-height: 42px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.root:last-child {
|
|
20
|
+
margin-bottom: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.root span {
|
|
24
|
+
font-family: $primaryFont;
|
|
25
|
+
font-size: 20px;
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
|
|
28
|
+
@media $portraitTablet {
|
|
29
|
+
font-size: 38px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.slide,
|
|
34
|
+
.game {
|
|
35
|
+
@media $mobile {
|
|
36
|
+
text-align: center;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.half {
|
|
41
|
+
@media $landscapeTablet {
|
|
42
|
+
font-size: 33px;
|
|
43
|
+
line-height: 36px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.half span {
|
|
48
|
+
@media $landscapeTablet {
|
|
49
|
+
font-size: 34px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.game:first-child {
|
|
54
|
+
padding-top: 9px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.featured {
|
|
58
|
+
letter-spacing: 0.3px;
|
|
59
|
+
|
|
60
|
+
font-size: 28px;
|
|
61
|
+
line-height: 30px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.featured span {
|
|
65
|
+
display: block;
|
|
66
|
+
|
|
67
|
+
padding-top: 2px;
|
|
68
|
+
|
|
69
|
+
font-size: 18px;
|
|
70
|
+
line-height: 24px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.mobile {
|
|
74
|
+
@media $mobile {
|
|
75
|
+
display: none;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.desktop {
|
|
80
|
+
display: none;
|
|
81
|
+
|
|
82
|
+
@media $mobile {
|
|
83
|
+
display: block;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { RichTitle } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './RichTitle.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / RichTitle',
|
|
9
|
+
component: RichTitle,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<RichTitle />
|
|
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 { RichTitle } from './'
|
|
5
|
+
import { RichTitleProps } from './RichTitle.types'
|
|
6
|
+
import styles from './RichTitle.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Rich Title', () => {
|
|
9
|
+
let props: RichTitleProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<RichTitle {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const richTitle = getByTestId('rich-title')
|
|
17
|
+
|
|
18
|
+
expect(richTitle).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RichTitleProps } from './RichTitle.types'
|
|
3
|
+
|
|
4
|
+
import makeClassName from '../utils/makeClassName'
|
|
5
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
+
|
|
7
|
+
import styles from './RichTitle.module.css'
|
|
8
|
+
|
|
9
|
+
export const RichTitle: React.FC<RichTitleProps> = ({
|
|
10
|
+
block: {
|
|
11
|
+
only_on: onlyOn,
|
|
12
|
+
data: { featured, first, second }
|
|
13
|
+
},
|
|
14
|
+
styleContext
|
|
15
|
+
}) => {
|
|
16
|
+
let classNames: (string[] | string | boolean)[][] = [
|
|
17
|
+
[styles.root, true],
|
|
18
|
+
[styles[onlyOn], true],
|
|
19
|
+
[styles.featured, !!featured]
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
if (styleContext) {
|
|
23
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<h1 data-testid="rich-title" className={makeClassName(classNames)}>
|
|
28
|
+
{first}
|
|
29
|
+
{second && <span> {second}</span>}
|
|
30
|
+
</h1>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* stylelint-disable declaration-empty-line-before */
|
|
2
|
+
@import '../vars';
|
|
3
|
+
|
|
4
|
+
span[data-body] {
|
|
5
|
+
position: relative;
|
|
6
|
+
|
|
7
|
+
padding: 0 4px;
|
|
8
|
+
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
white-space: pre-wrap;
|
|
11
|
+
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
background: #F8F8F8;
|
|
14
|
+
box-shadow: inset 1px 0 $ash, inset 0 1px $ash, inset -1px 0 $ash, inset 0 -1px $ash;
|
|
15
|
+
|
|
16
|
+
@media $portraitTablet {
|
|
17
|
+
padding-bottom: 1px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
span[data-body]:hover {
|
|
22
|
+
background: #F3F3F3;
|
|
23
|
+
box-shadow: inset 1px 0 #999, inset 0 1px #999, inset -1px 0 #999, inset 0 -1px #999;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dark span[data-body] {
|
|
27
|
+
background-color: #5B5B5B;
|
|
28
|
+
box-shadow: inset 1px 0 #8B8B8B, inset 0 1px #8B8B8B, inset -1px 0 #8B8B8B, inset 0 -1px #8B8B8B;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dark span[data-body]:hover {
|
|
32
|
+
background-color: #5B5B5B;
|
|
33
|
+
box-shadow: inset 1px 0 #747474, inset 0 1px #747474, inset -1px 0 #747474, inset 0 -1px #747474;
|
|
34
|
+
}
|