@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,236 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
import enableInlineVideo from 'iphone-inline-video'
|
|
4
|
+
|
|
5
|
+
import { Image } from '../Image'
|
|
6
|
+
import { Popover } from '../Popover'
|
|
7
|
+
import { MediaCaption } from '../MediaCaption'
|
|
8
|
+
|
|
9
|
+
import makeClassName from '../utils/makeClassName'
|
|
10
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
11
|
+
|
|
12
|
+
import viewportSize from '../utils/viewportSize'
|
|
13
|
+
import DangerousHTML from '../utils/DangerousHtml'
|
|
14
|
+
|
|
15
|
+
import { MediaQuerySizes } from '../constants'
|
|
16
|
+
|
|
17
|
+
import { EmbedBlockProps } from './EmbedBlock.types'
|
|
18
|
+
|
|
19
|
+
import styles from './EmbedBlock.module.css'
|
|
20
|
+
|
|
21
|
+
export const EmbedBlock: React.FC<EmbedBlockProps> = ({
|
|
22
|
+
block,
|
|
23
|
+
block: {
|
|
24
|
+
data,
|
|
25
|
+
data: {
|
|
26
|
+
display,
|
|
27
|
+
only_on: onlyOn,
|
|
28
|
+
provider,
|
|
29
|
+
cc,
|
|
30
|
+
optimized,
|
|
31
|
+
small_url: small,
|
|
32
|
+
large_url: large
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
styleContext,
|
|
36
|
+
children
|
|
37
|
+
}) => {
|
|
38
|
+
const [isPopoverShown, setIsPopoverShown] = useState(false)
|
|
39
|
+
|
|
40
|
+
const [videoFrozen, setVideoFrozen] = useState(false)
|
|
41
|
+
const videoElem = useRef(null)
|
|
42
|
+
const wrapperElem = useRef(null)
|
|
43
|
+
|
|
44
|
+
const handleVideoTouch = (): void => {
|
|
45
|
+
videoElem.current.play()
|
|
46
|
+
setVideoFrozen(false)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const handleVideoError = (): void => {
|
|
50
|
+
const video = videoElem.current
|
|
51
|
+
|
|
52
|
+
video.setAttribute('poster', video.dataset.gif)
|
|
53
|
+
|
|
54
|
+
setVideoFrozen(false)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const video = videoElem.current
|
|
59
|
+
|
|
60
|
+
if (block.type === 'gif' && video) {
|
|
61
|
+
const { width: viewportWidth } = viewportSize()
|
|
62
|
+
|
|
63
|
+
enableInlineVideo(video)
|
|
64
|
+
|
|
65
|
+
if (viewportWidth >= MediaQuerySizes.MOBILE) {
|
|
66
|
+
video.setAttribute('autoplay', true)
|
|
67
|
+
video.play()
|
|
68
|
+
} else {
|
|
69
|
+
setVideoFrozen(true)
|
|
70
|
+
video.pause()
|
|
71
|
+
video.addEventListener('touchstart', handleVideoTouch)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
video.addEventListener('error', handleVideoError)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (): void => {
|
|
78
|
+
if (video) {
|
|
79
|
+
video.removeEventListener('touchstart', handleVideoTouch)
|
|
80
|
+
video.removeEventListener('error', handleVideoError)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [])
|
|
84
|
+
|
|
85
|
+
const renderCC = (context?: string | string[]): JSX.Element => (
|
|
86
|
+
<MediaCaption
|
|
87
|
+
credit={data.credit}
|
|
88
|
+
caption={data.caption}
|
|
89
|
+
styleContext={context || styleContext}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
const renderEmbed = (style: any): JSX.Element[] | JSX.Element => {
|
|
94
|
+
const { html } = block.data
|
|
95
|
+
|
|
96
|
+
switch (block.type) {
|
|
97
|
+
case 'gif': {
|
|
98
|
+
return (
|
|
99
|
+
<div className={styles.figure}>
|
|
100
|
+
<div
|
|
101
|
+
className={styles.objectWrap}
|
|
102
|
+
style={style}
|
|
103
|
+
ref={wrapperElem}
|
|
104
|
+
data-frozen={videoFrozen}
|
|
105
|
+
>
|
|
106
|
+
<video
|
|
107
|
+
playsInline
|
|
108
|
+
muted
|
|
109
|
+
loop
|
|
110
|
+
autoPlay
|
|
111
|
+
preload="metadata"
|
|
112
|
+
data-gif={block.data.gif_url}
|
|
113
|
+
ref={videoElem}
|
|
114
|
+
>
|
|
115
|
+
<source
|
|
116
|
+
src={`https://meduza.io${block.data.mp4_url}`}
|
|
117
|
+
type="video/mp4"
|
|
118
|
+
/>
|
|
119
|
+
</video>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
case 'image': {
|
|
125
|
+
return (
|
|
126
|
+
<div className={styles.figure}>
|
|
127
|
+
{(small || optimized) && (
|
|
128
|
+
<Image
|
|
129
|
+
fullscreen={block.data.fullscreen}
|
|
130
|
+
source={!optimized && [small, large]}
|
|
131
|
+
optimized={block.data.optimized}
|
|
132
|
+
width={block.data.width}
|
|
133
|
+
height={block.data.height}
|
|
134
|
+
alt={block.data.caption}
|
|
135
|
+
display={block.data.display}
|
|
136
|
+
lazy={block.data.lazy}
|
|
137
|
+
/>
|
|
138
|
+
)}
|
|
139
|
+
</div>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
case 'game_embed': {
|
|
143
|
+
return (
|
|
144
|
+
<div className={styles.gameEmbed}>
|
|
145
|
+
<iframe
|
|
146
|
+
src={block.data.game_src}
|
|
147
|
+
id={block.data.game_id}
|
|
148
|
+
title="Game embed"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
default: {
|
|
155
|
+
return (
|
|
156
|
+
<div className={styles.object}>
|
|
157
|
+
<div className={styles.wrapper} style={style}>
|
|
158
|
+
<DangerousHTML className={styles.objectWrap} html={html} />
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const style: React.CSSProperties = {}
|
|
167
|
+
|
|
168
|
+
let isProportional
|
|
169
|
+
|
|
170
|
+
// @TODO: Разобраться зачем это было нужно
|
|
171
|
+
// const className = Object.keys(styleContext)
|
|
172
|
+
// .filter(key => key.startsWith('isIn') && styles[key])
|
|
173
|
+
// .reduce((acc, key) => {
|
|
174
|
+
// acc.push([styles[key], true])
|
|
175
|
+
|
|
176
|
+
// return acc
|
|
177
|
+
// }, [])
|
|
178
|
+
|
|
179
|
+
/* eslint-disable react/no-array-index-key, no-mixed-operators */
|
|
180
|
+
if (block.data.height && block.data.width) {
|
|
181
|
+
style.paddingBottom = `${(block.data.height / block.data.width) * 100}%`
|
|
182
|
+
style.height = 0
|
|
183
|
+
|
|
184
|
+
isProportional = true
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let classNames: (string[] | string | boolean)[][] = [
|
|
188
|
+
[styles.root, true],
|
|
189
|
+
[styles.cc, cc],
|
|
190
|
+
[styles[display], !!display && styles[display]],
|
|
191
|
+
[styles[provider], !!provider && !!styles[provider]],
|
|
192
|
+
[styles[onlyOn], !!onlyOn && styles[onlyOn]],
|
|
193
|
+
[styles.proportional, !!styles.proportional && isProportional]
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
if (styleContext) {
|
|
197
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<figure className={makeClassName(classNames)}>
|
|
202
|
+
{children && (
|
|
203
|
+
<div className={styles.object}>
|
|
204
|
+
<div className={styles.wrapper} style={style}>
|
|
205
|
+
<div className={styles.objectWrap}>{children}</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
)}
|
|
209
|
+
|
|
210
|
+
{!children && renderEmbed(style)}
|
|
211
|
+
|
|
212
|
+
{cc === 'default' && <figcaption>{renderCC()}</figcaption>}
|
|
213
|
+
|
|
214
|
+
{cc === 'button' && (
|
|
215
|
+
<button
|
|
216
|
+
className={styles.control}
|
|
217
|
+
type="button"
|
|
218
|
+
aria-label="Open"
|
|
219
|
+
onClick={(): void => {
|
|
220
|
+
setIsPopoverShown(!isPopoverShown)
|
|
221
|
+
}}
|
|
222
|
+
/>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{cc === 'button' && isPopoverShown && (
|
|
226
|
+
<Popover
|
|
227
|
+
onClose={(): void => {
|
|
228
|
+
setIsPopoverShown(false)
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{renderCC('isInPopover')}
|
|
232
|
+
</Popover>
|
|
233
|
+
)}
|
|
234
|
+
</figure>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
|
2
|
+
import { EmbedBlockProps } from './EmbedBlock.types'
|
|
3
|
+
|
|
4
|
+
import { EmbedBlock } from './EmbedBlock'
|
|
5
|
+
|
|
6
|
+
export const IframeBlock: React.FC<EmbedBlockProps> = ({
|
|
7
|
+
block,
|
|
8
|
+
block: { id },
|
|
9
|
+
styleContext,
|
|
10
|
+
lang = 'ru'
|
|
11
|
+
}) => {
|
|
12
|
+
const element = useRef(null)
|
|
13
|
+
|
|
14
|
+
const renderIframe = (): void => {
|
|
15
|
+
const rootEl = document.createElement('div')
|
|
16
|
+
const contentEl = document.createElement('div')
|
|
17
|
+
const scriptEl = document.createElement('script')
|
|
18
|
+
const style = document.createElement('style')
|
|
19
|
+
const range = document.createRange()
|
|
20
|
+
|
|
21
|
+
range.setStart(contentEl, 0)
|
|
22
|
+
contentEl.setAttribute('id', 'content')
|
|
23
|
+
scriptEl.textContent = `
|
|
24
|
+
function getDocHeight() {
|
|
25
|
+
var doc = document;
|
|
26
|
+
var body = doc.body;
|
|
27
|
+
var html = doc.documentElement;
|
|
28
|
+
var height = Math.max( body.scrollHeight, body.offsetHeight,
|
|
29
|
+
html.clientHeight, html.scrollHeight, html.offsetHeight );
|
|
30
|
+
|
|
31
|
+
doc.body.style.margin="0";
|
|
32
|
+
|
|
33
|
+
return document.getElementById('content') ? document.getElementById('content').offsetHeight : height;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function sendDocHeightMsg() {
|
|
37
|
+
var height = getDocHeight();
|
|
38
|
+
var message = JSON.stringify({
|
|
39
|
+
action: {
|
|
40
|
+
type: "UPDATE_HEIGHT",
|
|
41
|
+
payload: {
|
|
42
|
+
id: "${block.id}",
|
|
43
|
+
height: height
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
parent.postMessage("mdzMaterialEmbedHeight=" + message, '*');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
setInterval(sendDocHeightMsg, 300);
|
|
51
|
+
`
|
|
52
|
+
|
|
53
|
+
style.type = 'text/css'
|
|
54
|
+
style.innerHTML =
|
|
55
|
+
block.type === 'embed_code'
|
|
56
|
+
? '.twitter-tweet { padding-top: 15px; margin: 0 !important; }'
|
|
57
|
+
: '.twitter-tweet { margin: 0 !important; } .fb-post { display: block; } .instagram-media { min-width: 0 !important; }'
|
|
58
|
+
|
|
59
|
+
contentEl.appendChild(range.createContextualFragment(block.data.html))
|
|
60
|
+
rootEl.appendChild(scriptEl)
|
|
61
|
+
rootEl.appendChild(contentEl)
|
|
62
|
+
contentEl.appendChild(style)
|
|
63
|
+
|
|
64
|
+
const frame = element.current.querySelector('iframe').contentDocument
|
|
65
|
+
|
|
66
|
+
frame.open()
|
|
67
|
+
frame.close()
|
|
68
|
+
frame.documentElement.setAttribute('lang', lang)
|
|
69
|
+
frame.body.appendChild(rootEl)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
renderIframe()
|
|
74
|
+
}, [])
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<EmbedBlock block={block} styleContext={styleContext}>
|
|
78
|
+
<div
|
|
79
|
+
ref={element}
|
|
80
|
+
dangerouslySetInnerHTML={{
|
|
81
|
+
__html: `<iframe id=${id} frameBorder="0" scrolling="no"></iframe>`
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
</EmbedBlock>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { EmbedBlockProps } from './EmbedBlock.types'
|
|
3
|
+
|
|
4
|
+
import { EmbedBlock } from './EmbedBlock'
|
|
5
|
+
import { IframeBlock } from './IframeBlock'
|
|
6
|
+
|
|
7
|
+
export const EmbedBlockContainer: React.FC<EmbedBlockProps> = ({
|
|
8
|
+
block,
|
|
9
|
+
styleContext,
|
|
10
|
+
lang
|
|
11
|
+
}) => {
|
|
12
|
+
if (block.data.wrap_with_iframe) {
|
|
13
|
+
return <IframeBlock block={block} styleContext={styleContext} lang={lang} />
|
|
14
|
+
}
|
|
15
|
+
return <EmbedBlock block={block} styleContext={styleContext} />
|
|
16
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"blocks": [
|
|
3
|
+
{
|
|
4
|
+
"type": "embed_code",
|
|
5
|
+
"data": {
|
|
6
|
+
"provider": "custom",
|
|
7
|
+
"html": "<iframe src=\"https://ourworldindata.org/grapher/biweekly-confirmed-covid-19-cases?year=latest&time=2020-03-24..latest®ion=Europe\" loading=\"lazy\" style=\"width: 100%; height: 600px; border: 0px none;\"></iframe>",
|
|
8
|
+
"wrap_with_iframe": false,
|
|
9
|
+
"cc": "none",
|
|
10
|
+
"display": "default"
|
|
11
|
+
},
|
|
12
|
+
"id": "1-7-75df999d0a038a9f8d0e4e821a64dc5aa77babd89ff6cc21da375be7724eae43"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "image",
|
|
16
|
+
"data": {
|
|
17
|
+
"lazy": true,
|
|
18
|
+
"fullscreen": false,
|
|
19
|
+
"small_url": "/image/attachments/images/005/990/548/small/fpRHmfXNLJ9Q4P3Bn7wN-g.jpg",
|
|
20
|
+
"large_url": "/image/attachments/images/005/990/548/large/fpRHmfXNLJ9Q4P3Bn7wN-g.jpg",
|
|
21
|
+
"elarge_url": "/image/attachments/images/005/990/548/elarge/fpRHmfXNLJ9Q4P3Bn7wN-g.jpg",
|
|
22
|
+
"width": 960,
|
|
23
|
+
"height": 1280,
|
|
24
|
+
"cc": "none",
|
|
25
|
+
"display": "default",
|
|
26
|
+
"optimized": {
|
|
27
|
+
"original": "https://meduza.io/impro/LoZVAfuGYyvmtVNfrOXTDbaLYOK-kg49M3iWlj-U5lU/fill/2670/0/ce/0/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
28
|
+
"w325": {
|
|
29
|
+
"1x": "https://meduza.io/impro/Yw7kaa11jT4hvWkGjroM517QFJfzOC75BWQEk18bhPg/fill/325/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
30
|
+
"2x": "https://meduza.io/impro/mGDYvVZMBpoHf-Rz-ISXTcmrRBpGQkOcBA4d47Bt2pM/fill/650/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
31
|
+
"1x_webp": "https://meduza.io/impro/dbY8Jy4cVx5v-zB4HYR9j3XkwrDG6uTOBcZdHi2NPS0/fill/325/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp",
|
|
32
|
+
"2x_webp": "https://meduza.io/impro/nm4UPhGNVMuWpAFlCn9G638Vl8a0o0IiBSbjTi_9eFk/fill/650/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp"
|
|
33
|
+
},
|
|
34
|
+
"w520": {
|
|
35
|
+
"1x": "https://meduza.io/impro/NjQRgtAWCcswx4C2DGeHsEN9-AsmIpptmozGdF__OKw/fill/520/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
36
|
+
"2x": "https://meduza.io/impro/Bhwz3BKBkSTcxfuzc32D2370rbX0Ht2Kh-eikynQbOY/fill/1040/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
37
|
+
"1x_webp": "https://meduza.io/impro/r4_0yiXyZ_Pz4oJiK97hW8GOWZQYD2dwEiDaZh5ZyS0/fill/520/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp",
|
|
38
|
+
"2x_webp": "https://meduza.io/impro/FadkbtcJskqqUcDiFbws45lkMh7SC1RZXGgKW9xSrzU/fill/1040/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp"
|
|
39
|
+
},
|
|
40
|
+
"w650": {
|
|
41
|
+
"1x": "https://meduza.io/impro/mGDYvVZMBpoHf-Rz-ISXTcmrRBpGQkOcBA4d47Bt2pM/fill/650/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
42
|
+
"2x": "https://meduza.io/impro/nWkvtZraUy8sT3dkOFwxgADnSyGRlpcNd6zHj88Mebk/fill/1300/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
43
|
+
"1x_webp": "https://meduza.io/impro/nm4UPhGNVMuWpAFlCn9G638Vl8a0o0IiBSbjTi_9eFk/fill/650/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp",
|
|
44
|
+
"2x_webp": "https://meduza.io/impro/E6RwwQ0UASGxcU6JATjZ43DTnE0vKee6uMliyrxE3xs/fill/1300/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp"
|
|
45
|
+
},
|
|
46
|
+
"w980": {
|
|
47
|
+
"1x": "https://meduza.io/impro/dQxoS_db8_rSK-9dMD-r5Vfr3CLcfBvx1zBXQtdtjXo/fill/980/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
48
|
+
"2x": "https://meduza.io/impro/pwzmGW1tEa9D4d5b5kWBaPAiUUgAkoWPOvEsayapGeE/fill/1960/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
49
|
+
"1x_webp": "https://meduza.io/impro/1gkt0hXv0YSpebxhIQlzx4PI0HXE2FfYl_LmRf88jXg/fill/980/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp",
|
|
50
|
+
"2x_webp": "https://meduza.io/impro/OXg6ywUZGs-3Ba8bFdaRHCs4cNm1kQZOlouqC82ZURc/fill/1960/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp"
|
|
51
|
+
},
|
|
52
|
+
"w1335": {
|
|
53
|
+
"1x": "https://meduza.io/impro/peDg3-37xsptF6z8Yz9MnCrl6ZtRg0mE6nufDFvS5R4/fill/1335/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
54
|
+
"2x": "https://meduza.io/impro/KsCUeiJYYp7TS28IhklBpBgFadj6quvR7cznCeBYij4/fill/2670/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.jpg",
|
|
55
|
+
"1x_webp": "https://meduza.io/impro/FRjotreXOIq_YJZBSKk7upk8MolV3dcV0hFY2exuKUg/fill/1335/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp",
|
|
56
|
+
"2x_webp": "https://meduza.io/impro/M8Ucsc78O5yE0hrED2ERqO2xR-7aapZcOrv6uFBousk/fill/2670/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNS85/OTAvNTQ4L29yaWdp/bmFsL2ZwUkhtZlhO/TEo5UTRQM0JuN3dO/LWcuanBn.webp"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"id": "9-5966c9fae73e002d15a7bee5884924f58c5cf5f11fb40883bc4dc8a9f4cd5083"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "embed",
|
|
64
|
+
"data": {
|
|
65
|
+
"provider": "youtube",
|
|
66
|
+
"html": "<iframe src=\"https://www.youtube.com/embed/dVP7PNRx8Mw?feature=oembed&iv_load_policy=3&showinfo=0&color=white\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen style=\"width: 100%; height: 100%; position: absolute\"></iframe>",
|
|
67
|
+
"width": 480,
|
|
68
|
+
"height": 270,
|
|
69
|
+
"lazy": true,
|
|
70
|
+
"wrap_with_iframe": false,
|
|
71
|
+
"credit": "SearchlightPictures",
|
|
72
|
+
"cc": "default",
|
|
73
|
+
"display": "full"
|
|
74
|
+
},
|
|
75
|
+
"id": "6-a6d96f7079dcfcdbb92fa3cd7d541e75a6ca25901d795ea1a5f14e64f5b338fe"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "embed",
|
|
79
|
+
"data": {
|
|
80
|
+
"provider": "twitter",
|
|
81
|
+
"html": "<blockquote class=\"twitter-tweet\"><p lang=\"ru\" dir=\"ltr\">Вышел трейлер «Дюны». <a href=\"https://t.co/8fzlIDFSFp\">pic.twitter.com/8fzlIDFSFp</a></p>— YamiEA (@brovitranduila) <a href=\"https://twitter.com/brovitranduila/status/1303740646226882561?ref_src=twsrc%5Etfw\">September 9, 2020</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n",
|
|
82
|
+
"wrap_with_iframe": true,
|
|
83
|
+
"cc": "none",
|
|
84
|
+
"display": "default"
|
|
85
|
+
},
|
|
86
|
+
"id": "3-6a50ce5056f3f6f15c48f25a972d9553fd0d5b961e64b4885d6ad34a1f211b73"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
max-width: 644px;
|
|
5
|
+
margin: 15px auto 0;
|
|
6
|
+
|
|
7
|
+
@media $portraitTablet {
|
|
8
|
+
max-width: none;
|
|
9
|
+
margin-top: 25px;
|
|
10
|
+
margin-bottom: 20px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.hasFigcaption {
|
|
15
|
+
margin-bottom: 15px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.hasFigcaption + .root {
|
|
19
|
+
@media $portraitTablet {
|
|
20
|
+
margin-top: 25px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.hasFigcaption .item:last-child {
|
|
25
|
+
margin-bottom: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.items {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
flex-wrap: nowrap;
|
|
32
|
+
|
|
33
|
+
@media $portraitTablet {
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.item {
|
|
39
|
+
flex-grow: 1;
|
|
40
|
+
|
|
41
|
+
width: 100%;
|
|
42
|
+
min-width: 100%;
|
|
43
|
+
max-width: 100%;
|
|
44
|
+
margin-bottom: 20px;
|
|
45
|
+
|
|
46
|
+
@media $portraitTablet {
|
|
47
|
+
min-width: 0;
|
|
48
|
+
max-width: none;
|
|
49
|
+
margin-bottom: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.item + .item {
|
|
54
|
+
@media $portraitTablet {
|
|
55
|
+
margin-left: 15px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.figcaption {
|
|
60
|
+
max-width: 650px;
|
|
61
|
+
margin-right: auto;
|
|
62
|
+
margin-left: auto;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* DISPLAY */
|
|
66
|
+
.default {
|
|
67
|
+
@media $portraitTablet {
|
|
68
|
+
max-width: 650px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.full {
|
|
73
|
+
max-width: 980px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.super_full {
|
|
77
|
+
max-width: 1680px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* VISIBILITY */
|
|
81
|
+
.mobile {
|
|
82
|
+
@media $mobile {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.desktop {
|
|
88
|
+
display: none;
|
|
89
|
+
|
|
90
|
+
@media $mobile {
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { GroupedBlock } from './'
|
|
4
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
+
import styles from './GroupedBlock.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / GroupedBlock',
|
|
9
|
+
component: GroupedBlock,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<GroupedBlock />
|
|
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 { GroupedBlock } from './'
|
|
5
|
+
import { GroupedBlockProps } from './GroupedBlock.types'
|
|
6
|
+
import styles from './GroupedBlock.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Grouped Block', () => {
|
|
9
|
+
let props: GroupedBlockProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<GroupedBlock {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const groupedBlock = getByTestId('grouped-block')
|
|
17
|
+
|
|
18
|
+
expect(groupedBlock).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { GroupedBlockProps } from './GroupedBlock.types'
|
|
3
|
+
|
|
4
|
+
import makeClassName from '../utils/makeClassName'
|
|
5
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
+
|
|
7
|
+
import { EmbedBlockContainer } from '../EmbedBlock'
|
|
8
|
+
import { MediaCaption } from '../MediaCaption'
|
|
9
|
+
|
|
10
|
+
import styles from './GroupedBlock.module.css'
|
|
11
|
+
|
|
12
|
+
export const GroupedBlock: React.FC<GroupedBlockProps> = ({
|
|
13
|
+
block,
|
|
14
|
+
block: { only_on: onlyOn },
|
|
15
|
+
styleContext
|
|
16
|
+
}) => {
|
|
17
|
+
const maxHeight = Math.min(...block.data.map(item => item.data.height))
|
|
18
|
+
|
|
19
|
+
const normalizedBoxesWidth = block.data.map(
|
|
20
|
+
item => item.data.width / (item.data.height / maxHeight)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const sumWidth = normalizedBoxesWidth.reduce((sum, x) => sum + x)
|
|
24
|
+
|
|
25
|
+
let classNames: (string[] | string | boolean)[][] = [
|
|
26
|
+
[styles.root, true],
|
|
27
|
+
[styles[onlyOn], true],
|
|
28
|
+
[styles.hasFigcaption, block.cc === 'default'],
|
|
29
|
+
[styles[block.display], !!block.display && styles[block.display]]
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
if (styleContext) {
|
|
33
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div data-testid="grouped-block" className={makeClassName(classNames)}>
|
|
38
|
+
<div className={styles.items}>
|
|
39
|
+
{block.data.map((item, index) => {
|
|
40
|
+
const percentWidth = (normalizedBoxesWidth[index] / sumWidth) * 100
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className={styles.item}
|
|
45
|
+
key={item.id}
|
|
46
|
+
style={{ width: `${percentWidth}%` }}
|
|
47
|
+
>
|
|
48
|
+
<EmbedBlockContainer
|
|
49
|
+
block={item}
|
|
50
|
+
styleContext="isInGroupedBlock"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
})}
|
|
55
|
+
</div>
|
|
56
|
+
{block.cc && (
|
|
57
|
+
<figcaption className={styles.figcaption}>
|
|
58
|
+
<MediaCaption
|
|
59
|
+
credit={block.credit}
|
|
60
|
+
caption={block.caption}
|
|
61
|
+
styleContext={styleContext}
|
|
62
|
+
/>
|
|
63
|
+
</figcaption>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|