@meduza/ui-kit-2 0.0.1 → 0.1.0
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.js +2257 -10
- 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 +2209 -3
- 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 +28 -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 +102 -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,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { MaterialNote } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './MaterialNote.stories.module.css'
|
|
6
|
+
|
|
7
|
+
import mock from './mock'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Main / MaterialNote',
|
|
11
|
+
component: MaterialNote,
|
|
12
|
+
parameters: {
|
|
13
|
+
themeWrapperSideBySide: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Example: React.FC = () => {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<div className={styles.root}>
|
|
21
|
+
<MaterialNote block={mock} />
|
|
22
|
+
</div>
|
|
23
|
+
</>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Default: React.FC = () => (
|
|
28
|
+
<>
|
|
29
|
+
<PreviewWrapper theme="light">
|
|
30
|
+
<Example />
|
|
31
|
+
</PreviewWrapper>
|
|
32
|
+
<PreviewWrapper theme="dark">
|
|
33
|
+
<Example />
|
|
34
|
+
</PreviewWrapper>
|
|
35
|
+
</>
|
|
36
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
|
|
4
|
+
import { MaterialNote } from './'
|
|
5
|
+
import { MaterialNoteProps } from './MaterialNote.types'
|
|
6
|
+
import styles from './MaterialNote.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Material Note', () => {
|
|
9
|
+
let props: MaterialNoteProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<MaterialNote {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const materialNote = getByTestId('material-note')
|
|
17
|
+
|
|
18
|
+
expect(materialNote).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { MaterialNoteProps } from './MaterialNote.types'
|
|
3
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
4
|
+
import makeClassName from '../utils/makeClassName'
|
|
5
|
+
|
|
6
|
+
import styles from './MaterialNote.module.css'
|
|
7
|
+
|
|
8
|
+
export const MaterialNote: React.FC<MaterialNoteProps> = ({
|
|
9
|
+
block: { data },
|
|
10
|
+
styleContext
|
|
11
|
+
}) => {
|
|
12
|
+
let classNames: (string[] | string | boolean)[][] = [[styles.root, true]]
|
|
13
|
+
|
|
14
|
+
if (styleContext) {
|
|
15
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div data-testid="material-note" className={makeClassName(classNames)}>
|
|
20
|
+
{data &&
|
|
21
|
+
data.map(item => (
|
|
22
|
+
<p
|
|
23
|
+
className={styles[item.type]}
|
|
24
|
+
key={item.id}
|
|
25
|
+
dangerouslySetInnerHTML={{ __html: item.data }}
|
|
26
|
+
/>
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "material_note",
|
|
3
|
+
"data": [
|
|
4
|
+
{
|
|
5
|
+
"type": "note_caption",
|
|
6
|
+
"data": "Сделано в <a href=\"https://prodano.media/\" target=\"_blank\" rel=\"noopener\"><strong>продано!</strong></a>",
|
|
7
|
+
"length": 18,
|
|
8
|
+
"id": "52-0-d9684e08cf3e63a26677cc0749d47e104939d20f514b1b228b03bcdaa6af7a92"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "note_credit",
|
|
12
|
+
"data": "Иллюстрации: Essl / Shutterstock",
|
|
13
|
+
"length": 32,
|
|
14
|
+
"id": "52-1-822d6bae27a29a214e1af63f6bcd8dd6aebe291d5b0b89c2a7cbab456c9e38b9"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"id": "52-c0fd8cea8e599cc0a27ca0a1d1d5ccb4f021e8dc9843ff54457311e24dfdedf6"
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.root {
|
|
8
|
+
margin: 0;
|
|
9
|
+
|
|
10
|
+
font-family: $secondaryFont;
|
|
11
|
+
font-size: 25px;
|
|
12
|
+
font-weight: normal;
|
|
13
|
+
line-height: 27px;
|
|
14
|
+
|
|
15
|
+
@media $portraitTablet {
|
|
16
|
+
font-size: 37px;
|
|
17
|
+
line-height: 38px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.primary {
|
|
22
|
+
font-family: $primaryFont;
|
|
23
|
+
font-weight: normal;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.secondary {
|
|
27
|
+
font-size: 24px;
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
|
|
30
|
+
@media $portraitTablet {
|
|
31
|
+
font-size: 36px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { MaterialTitle, Primary, Secondary } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './MaterialTitle.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / MaterialTitle',
|
|
9
|
+
component: MaterialTitle,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<div className={styles.block}>
|
|
20
|
+
<MaterialTitle>
|
|
21
|
+
<Primary>Протесты против пенсионной реформы. Хроника</Primary>
|
|
22
|
+
</MaterialTitle>
|
|
23
|
+
</div>
|
|
24
|
+
<div className={styles.block}>
|
|
25
|
+
<MaterialTitle>
|
|
26
|
+
<Secondary>Одинокий богатый заголовок</Secondary>
|
|
27
|
+
</MaterialTitle>
|
|
28
|
+
</div>
|
|
29
|
+
<div className={styles.block}>
|
|
30
|
+
<MaterialTitle>
|
|
31
|
+
<Secondary>Протесты против пенсионной реформы. Хроника</Secondary>{' '}
|
|
32
|
+
<Primary>
|
|
33
|
+
Как прошли митинги против повышения пенсионного возраста в разных
|
|
34
|
+
городах России
|
|
35
|
+
</Primary>
|
|
36
|
+
</MaterialTitle>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Default: React.FC = () => (
|
|
44
|
+
<>
|
|
45
|
+
<PreviewWrapper theme="light">
|
|
46
|
+
<Example />
|
|
47
|
+
</PreviewWrapper>
|
|
48
|
+
<PreviewWrapper theme="dark">
|
|
49
|
+
<Example />
|
|
50
|
+
</PreviewWrapper>
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
|
|
4
|
+
import { MaterialTitle } from './'
|
|
5
|
+
import { MaterialTitleProps } from './MaterialTitle.types'
|
|
6
|
+
import styles from './MaterialTitle.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Material Title', () => {
|
|
9
|
+
let props: MaterialTitleProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<MaterialTitle {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const materialTitle = getByTestId('material-title')
|
|
17
|
+
|
|
18
|
+
expect(materialTitle).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { MaterialTitleProps } from './MaterialTitle.types'
|
|
3
|
+
|
|
4
|
+
import styles from './MaterialTitle.module.css'
|
|
5
|
+
|
|
6
|
+
export const Primary: React.FC<MaterialTitleProps> = ({ children }) => {
|
|
7
|
+
return <span className={styles.primary}>{children}</span>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Secondary: React.FC<MaterialTitleProps> = ({ children }) => {
|
|
11
|
+
return <span className={styles.secondary}>{children}</span>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const MaterialTitle: React.FC<MaterialTitleProps> = ({ children }) => {
|
|
15
|
+
return (
|
|
16
|
+
<h1 className={styles.root} data-testid="material-title">
|
|
17
|
+
{children}
|
|
18
|
+
</h1>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
font-family: $secondaryFont;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.root a {
|
|
8
|
+
text-decoration: underline;
|
|
9
|
+
|
|
10
|
+
color: inherit;
|
|
11
|
+
box-shadow: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.root a:hover {
|
|
15
|
+
color: #b88b58;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.caption {
|
|
19
|
+
max-width: 520px;
|
|
20
|
+
padding-top: 4px;
|
|
21
|
+
|
|
22
|
+
color: $jet;
|
|
23
|
+
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
line-height: 18px;
|
|
26
|
+
|
|
27
|
+
@media $mobile {
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
line-height: 22px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.credit {
|
|
34
|
+
max-width: 520px;
|
|
35
|
+
padding-top: 1px;
|
|
36
|
+
|
|
37
|
+
color: #666;
|
|
38
|
+
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
line-height: 16px;
|
|
41
|
+
|
|
42
|
+
@media $mobile {
|
|
43
|
+
padding-top: 3px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.credit:first-child {
|
|
48
|
+
padding-top: 3px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dark .caption {
|
|
52
|
+
color: #fff;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.dark .credit {
|
|
56
|
+
color: #929292;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.video .caption,
|
|
60
|
+
.picture .caption {
|
|
61
|
+
padding-top: 10px;
|
|
62
|
+
|
|
63
|
+
@media $mobile {
|
|
64
|
+
padding-top: 12px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.video .credit:first-child,
|
|
69
|
+
.picture .credit:first-child {
|
|
70
|
+
padding-top: 9px;
|
|
71
|
+
|
|
72
|
+
@media $mobile {
|
|
73
|
+
padding-top: 11px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.picture .credit,
|
|
78
|
+
.picture .caption,
|
|
79
|
+
.video .credit,
|
|
80
|
+
.video .caption,
|
|
81
|
+
.desktop .credit,
|
|
82
|
+
.desktop .caption {
|
|
83
|
+
max-width: 650px;
|
|
84
|
+
}
|
|
85
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { MediaCaption } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './MediaCaption.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / MediaCaption',
|
|
9
|
+
component: MediaCaption,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<MediaCaption
|
|
20
|
+
credit="The Insider, Bellingcat и Der Spiegel"
|
|
21
|
+
caption="Пресс-секретарь президента России Дмитрий Песков в разговоре с российскими журналистами не исключил, что между Путиным и Конте произошло недопонимание."
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Default: React.FC = () => (
|
|
29
|
+
<>
|
|
30
|
+
<PreviewWrapper theme="light">
|
|
31
|
+
<Example />
|
|
32
|
+
</PreviewWrapper>
|
|
33
|
+
<PreviewWrapper theme="dark">
|
|
34
|
+
<Example />
|
|
35
|
+
</PreviewWrapper>
|
|
36
|
+
</>
|
|
37
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
|
|
4
|
+
import { MediaCaption } from './'
|
|
5
|
+
import { MediaCaptionProps } from './MediaCaption.types'
|
|
6
|
+
import styles from './MediaCaption.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Media Caption', () => {
|
|
9
|
+
let props: MediaCaptionProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<MediaCaption {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const mediaCaption = getByTestId('media-caption')
|
|
17
|
+
|
|
18
|
+
expect(mediaCaption).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { MediaCaptionProps } from './MediaCaption.types'
|
|
3
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
4
|
+
import makeClassName from '../utils/makeClassName'
|
|
5
|
+
|
|
6
|
+
import styles from './MediaCaption.module.css'
|
|
7
|
+
|
|
8
|
+
export const MediaCaption: React.FC<MediaCaptionProps> = ({
|
|
9
|
+
credit,
|
|
10
|
+
caption,
|
|
11
|
+
styleContext
|
|
12
|
+
}) => {
|
|
13
|
+
let classNames: (string[] | string | boolean)[][] = [[styles.root, true]]
|
|
14
|
+
|
|
15
|
+
if (styleContext) {
|
|
16
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div data-testid="media-caption" className={makeClassName(classNames)}>
|
|
21
|
+
{caption && (
|
|
22
|
+
<div
|
|
23
|
+
className={styles.caption}
|
|
24
|
+
dangerouslySetInnerHTML={{ __html: caption }}
|
|
25
|
+
/>
|
|
26
|
+
)}
|
|
27
|
+
{credit && (
|
|
28
|
+
<div
|
|
29
|
+
className={styles.credit}
|
|
30
|
+
dangerouslySetInnerHTML={{ __html: credit }}
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
transform: translateZ(0);
|
|
5
|
+
|
|
6
|
+
font-family: $secondaryFont;
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
line-height: 14px;
|
|
9
|
+
|
|
10
|
+
fill: inherit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.rich,
|
|
14
|
+
.podcast,
|
|
15
|
+
.episode,
|
|
16
|
+
.simple,
|
|
17
|
+
.slide,
|
|
18
|
+
.card,
|
|
19
|
+
.game,
|
|
20
|
+
.isInMaterial {
|
|
21
|
+
width: 100%;
|
|
22
|
+
|
|
23
|
+
color: $nikel;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.podcast {
|
|
27
|
+
fill: currentColor;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.isInSearchItem {
|
|
31
|
+
color: rgba(255, 255, 255, 0.7);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.center.half {
|
|
35
|
+
@media $landscapeTablet {
|
|
36
|
+
text-align: left;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.episode,
|
|
41
|
+
.card,
|
|
42
|
+
.slide,
|
|
43
|
+
.game,
|
|
44
|
+
.center {
|
|
45
|
+
@media $mobile {
|
|
46
|
+
text-align: center;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.light {
|
|
51
|
+
color: rgba(255, 255, 255, 0.6);
|
|
52
|
+
|
|
53
|
+
fill: currentColor;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dark {
|
|
57
|
+
color: #757575;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.episode,
|
|
61
|
+
.card,
|
|
62
|
+
.slide,
|
|
63
|
+
.podcast {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
flex-flow: row wrap;
|
|
67
|
+
|
|
68
|
+
@media $portraitTablet {
|
|
69
|
+
display: block;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.hasSource {
|
|
74
|
+
@media $mobileMax {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-flow: row wrap;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.bookmark {
|
|
81
|
+
position: absolute;
|
|
82
|
+
z-index: 10;
|
|
83
|
+
right: -12px;
|
|
84
|
+
bottom: -4px;
|
|
85
|
+
|
|
86
|
+
@media $mobile {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
/* VISIBILITY */
|
|
93
|
+
|
|
94
|
+
.mobile {
|
|
95
|
+
@media $mobile {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.desktop {
|
|
101
|
+
display: none;
|
|
102
|
+
|
|
103
|
+
@media $mobile {
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Meta } from './'
|
|
4
|
+
import { MetaItem } from '../MetaItem'
|
|
5
|
+
import { MetaItemLive } from '../MetaItemLive'
|
|
6
|
+
import { DocumentItemsCount } from '../DocumentItemsCount'
|
|
7
|
+
import { Timestamp } from '../Timestamp'
|
|
8
|
+
import { SvgSymbol } from '../SvgSymbol'
|
|
9
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
10
|
+
import styles from './Meta.stories.module.css'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Main / Meta',
|
|
14
|
+
component: Meta,
|
|
15
|
+
parameters: {
|
|
16
|
+
themeWrapperSideBySide: true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Example: React.FC = () => {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<div className={styles.root}>
|
|
24
|
+
<h3>В карточке</h3>
|
|
25
|
+
<Meta>
|
|
26
|
+
<MetaItem>
|
|
27
|
+
<MetaItemLive /> Онлайн
|
|
28
|
+
</MetaItem>
|
|
29
|
+
<MetaItem key={`status-${status}`}>
|
|
30
|
+
<Timestamp publishedAt={1526024185} type="fromNow" />
|
|
31
|
+
</MetaItem>
|
|
32
|
+
{['card', 'podcast'].map((type: 'card' | 'podcast') => (
|
|
33
|
+
<MetaItem key={type}>
|
|
34
|
+
<DocumentItemsCount type={type} items={4}>
|
|
35
|
+
<SvgSymbol icon={type} size="small" />
|
|
36
|
+
</DocumentItemsCount>
|
|
37
|
+
</MetaItem>
|
|
38
|
+
))}
|
|
39
|
+
</Meta>
|
|
40
|
+
</div>
|
|
41
|
+
<div className={styles.root}>
|
|
42
|
+
<h3>В материале</h3>
|
|
43
|
+
|
|
44
|
+
<Meta styleContext="isInMaterial">
|
|
45
|
+
<MetaItem bullets>
|
|
46
|
+
<MetaItemLive /> Онлайн
|
|
47
|
+
</MetaItem>
|
|
48
|
+
<MetaItem bullets>
|
|
49
|
+
Источник: <a href="https://meduza.io">Meduza</a>
|
|
50
|
+
</MetaItem>
|
|
51
|
+
<MetaItem bullets>
|
|
52
|
+
<Timestamp publishedAt={1558353600} type="date" locale="en" />
|
|
53
|
+
</MetaItem>
|
|
54
|
+
</Meta>
|
|
55
|
+
</div>
|
|
56
|
+
</>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const Default: React.FC = () => (
|
|
61
|
+
<>
|
|
62
|
+
<PreviewWrapper theme="light">
|
|
63
|
+
<Example />
|
|
64
|
+
</PreviewWrapper>
|
|
65
|
+
<PreviewWrapper theme="dark">
|
|
66
|
+
<Example />
|
|
67
|
+
</PreviewWrapper>
|
|
68
|
+
</>
|
|
69
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
|
|
4
|
+
import { Meta } from './'
|
|
5
|
+
import { MetaProps } from './Meta.types'
|
|
6
|
+
import styles from './Meta.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Meta', () => {
|
|
9
|
+
let props: MetaProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<Meta {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const meta = getByTestId('meta')
|
|
17
|
+
|
|
18
|
+
expect(meta).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|