@meduza/ui-kit-2 0.1.8 → 0.1.10
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/dist/Footnote/Footnote.stories.d.ts +10 -0
- package/dist/Footnote/Footnote.types.d.ts +5 -0
- package/dist/Footnote/index.d.ts +3 -0
- package/dist/Image/Image.types.d.ts +2 -2
- package/dist/MaterialNote/MaterialNote.stories.d.ts +2 -1
- package/dist/MaterialNote/MaterialNote.types.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/ui-kit-2.cjs.development.js +238 -210
- 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 +238 -211
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +684 -577
- package/dist/utils/makeClassName.d.ts +2 -1
- package/dist/utils/makeStyleContext.d.ts +2 -1
- package/package.json +12 -4
- package/src/BookmarkButton/BookmarkButton.stories.tsx +1 -1
- package/src/BookmarkButton/index.tsx +2 -4
- package/src/Button/Button.stories.tsx +2 -2
- package/src/Button/Button.test.tsx +3 -3
- package/src/Button/index.tsx +3 -3
- package/src/CardTitle/CardTitle.stories.tsx +1 -1
- package/src/CardTitle/CardTitle.test.tsx +1 -1
- package/src/CardTitle/index.tsx +1 -2
- package/src/ChapterBlock/ChapterBlock.stories.tsx +1 -1
- package/src/ChapterBlock/ChapterBlock.test.tsx +1 -1
- package/src/ChapterBlock/index.tsx +1 -2
- package/src/Cover/Cover.stories.tsx +1 -1
- package/src/Cover/Cover.test.tsx +1 -1
- package/src/Cover/index.tsx +5 -6
- package/src/DocumentItemsCount/DocumentItemsCount.stories.tsx +1 -1
- package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +1 -1
- package/src/DocumentItemsCount/index.tsx +0 -1
- package/src/DotsOnImage/DotsOnImage.module.css +13 -9
- package/src/DotsOnImage/DotsOnImage.stories.tsx +1 -1
- package/src/DotsOnImage/DotsOnImage.test.tsx +2 -1
- package/src/DotsOnImage/index.tsx +29 -17
- package/src/DotsOnImage/mock.json +4 -4
- package/src/Dropdown/index.tsx +2 -2
- package/src/EmbedBlock/EmbedBlock.module.css +1 -1
- package/src/EmbedBlock/EmbedBlock.stories.tsx +2 -2
- package/src/EmbedBlock/EmbedBlock.test.tsx +1 -1
- package/src/EmbedBlock/EmbedBlock.tsx +3 -8
- package/src/EmbedBlock/EmbedGif.tsx +0 -3
- package/src/EmbedBlock/IframeBlock.tsx +0 -1
- package/src/EmbedBlock/index.tsx +0 -1
- package/src/Footnote/Footnote.module.css +70 -0
- package/src/Footnote/Footnote.stories.module.css +5 -0
- package/src/Footnote/Footnote.stories.tsx +43 -0
- package/src/Footnote/Footnote.test.tsx +20 -0
- package/src/Footnote/Footnote.types.ts +5 -0
- package/src/Footnote/index.tsx +26 -0
- package/src/GroupedBlock/GroupedBlock.stories.tsx +1 -1
- package/src/GroupedBlock/GroupedBlock.test.tsx +1 -1
- package/src/GroupedBlock/index.tsx +4 -6
- package/src/HalfBlock/HalfBlock.stories.tsx +1 -1
- package/src/HalfBlock/HalfBlock.test.tsx +1 -1
- package/src/HalfBlock/index.tsx +3 -5
- package/src/Image/Image.stories.tsx +1 -1
- package/src/Image/Image.test.tsx +1 -1
- package/src/Image/Image.types.ts +2 -2
- package/src/Image/RenderPicture.tsx +1 -2
- package/src/Image/index.tsx +1 -4
- package/src/ImportantLead/ImportantLead.stories.tsx +1 -1
- package/src/ImportantLead/ImportantLead.test.tsx +1 -1
- package/src/ImportantLead/index.tsx +3 -5
- package/src/Lazy/Lazy.stories.tsx +3 -2
- package/src/Lazy/Lazy.test.tsx +1 -1
- package/src/Lazy/index.tsx +2 -4
- package/src/ListBlock/ListBlock.stories.tsx +2 -2
- package/src/ListBlock/ListBlock.test.tsx +1 -1
- package/src/ListBlock/index.tsx +2 -3
- package/src/MaterialNote/MaterialNote.stories.tsx +4 -3
- package/src/MaterialNote/MaterialNote.test.tsx +1 -1
- package/src/MaterialNote/MaterialNote.types.ts +2 -1
- package/src/MaterialNote/index.tsx +3 -3
- package/src/MaterialTitle/MaterialTitle.stories.tsx +1 -1
- package/src/MaterialTitle/MaterialTitle.test.tsx +1 -1
- package/src/MediaCaption/MediaCaption.stories.tsx +1 -1
- package/src/MediaCaption/MediaCaption.test.tsx +1 -1
- package/src/MediaCaption/index.tsx +2 -2
- package/src/Meta/Meta.stories.tsx +1 -1
- package/src/Meta/Meta.test.tsx +1 -1
- package/src/Meta/MetaContainer.tsx +2 -4
- package/src/Meta/index.tsx +2 -3
- package/src/MetaItem/MetaItem.stories.tsx +2 -2
- package/src/MetaItem/MetaItem.test.tsx +1 -1
- package/src/MetaItem/index.tsx +1 -3
- package/src/MetaItemLive/MetaItemLive.stories.tsx +2 -2
- package/src/MetaItemLive/MetaItemLive.test.tsx +1 -1
- package/src/MetaItemLive/index.tsx +1 -3
- package/src/Popover/Popover.module.css +36 -2
- package/src/Popover/Popover.stories.tsx +1 -1
- package/src/Popover/Popover.test.tsx +1 -1
- package/src/Popover/index.tsx +2 -3
- package/src/QuoteBlock/QuoteBlock.stories.tsx +1 -1
- package/src/QuoteBlock/QuoteBlock.test.tsx +1 -1
- package/src/QuoteBlock/index.tsx +2 -3
- package/src/RawHtmlBlock/RawHtmlBlock.stories.tsx +2 -2
- package/src/RawHtmlBlock/RawHtmlBlock.test.tsx +1 -1
- package/src/RawHtmlBlock/index.tsx +0 -2
- package/src/RelatedBlock/RelatedBlock.stories.tsx +1 -1
- package/src/RelatedBlock/RelatedBlock.test.tsx +1 -1
- package/src/RelatedBlock/index.tsx +2 -3
- package/src/RenderBlocks/RenderBlocks.stories.tsx +1 -1
- package/src/RenderBlocks/RenderBlocks.test.tsx +1 -1
- package/src/RenderBlocks/index.tsx +0 -1
- package/src/RichTitle/RichTitle.stories.tsx +1 -1
- package/src/RichTitle/RichTitle.test.tsx +1 -1
- package/src/RichTitle/index.tsx +2 -3
- package/src/SimpleBlock/FootnoteLink.css +7 -0
- package/src/SimpleBlock/SimpleBlock.stories.tsx +2 -2
- package/src/SimpleBlock/SimpleBlock.test.tsx +1 -1
- package/src/SimpleBlock/index.tsx +2 -3
- package/src/SimpleTitle/SimpleTitle.stories.tsx +1 -1
- package/src/SimpleTitle/SimpleTitle.test.tsx +1 -1
- package/src/SimpleTitle/index.tsx +2 -2
- package/src/SourceBlock/SourceBlock.stories.tsx +6 -6
- package/src/SourceBlock/SourceBlock.test.tsx +1 -1
- package/src/SourceBlock/index.tsx +6 -4
- package/src/SourceBlock/mock.json +15 -0
- package/src/Spoiler/Spoiler.stories.tsx +1 -1
- package/src/Spoiler/Spoiler.test.tsx +1 -1
- package/src/Spoiler/index.tsx +4 -5
- package/src/SvgSymbol/SvgSymbol.stories.tsx +6 -6
- package/src/SvgSymbol/SvgSymbol.test.tsx +1 -1
- package/src/SvgSymbol/index.tsx +2 -2
- package/src/Switcher/Switcher.stories.tsx +4 -4
- package/src/Switcher/Switcher.test.tsx +1 -1
- package/src/Switcher/index.tsx +1 -2
- package/src/Table/Table.stories.tsx +1 -1
- package/src/Table/Table.test.tsx +1 -1
- package/src/Table/index.tsx +2 -2
- package/src/Tag/Tag.stories.tsx +1 -3
- package/src/Tag/Tag.test.tsx +4 -4
- package/src/Tag/index.tsx +2 -2
- package/src/Timestamp/Timestamp.stories.tsx +1 -1
- package/src/Timestamp/Timestamp.test.tsx +1 -1
- package/src/Timestamp/index.tsx +0 -2
- package/src/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/Toolbar/Toolbar.test.tsx +1 -1
- package/src/Toolbar/index.tsx +2 -3
- package/src/ToolbarButton/ToolbarButton.stories.tsx +2 -2
- package/src/ToolbarButton/ToolbarButton.test.tsx +1 -1
- package/src/ToolbarButton/index.tsx +2 -3
- package/src/_storybook/PreviewWrapper/index.tsx +1 -1
- package/src/index.tsx +1 -0
- package/src/utils/DangerousHtml.tsx +5 -7
- package/src/utils/generateGradient.ts +1 -1
- package/src/utils/makeClassName.ts +3 -1
- package/src/utils/makeStyleContext.ts +8 -4
- package/src/utils/toCamel.ts +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Footnote } from './'
|
|
3
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
|
|
5
|
+
import styles from './Footnote.stories.module.css'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Main / Footnote',
|
|
9
|
+
component: Footnote,
|
|
10
|
+
parameters: {
|
|
11
|
+
themeWrapperSideBySide: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Example: React.FC = () => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.root}>
|
|
19
|
+
<Footnote onClose={(): void => alert('Handle Close')}>
|
|
20
|
+
<h3>Заголовок лвлвлдфова выа вовофдывлоа</h3>
|
|
21
|
+
<p>
|
|
22
|
+
«Я видел истинного Дональда Трампа, наблюдал за ним. Это обманщик,
|
|
23
|
+
притворщик и задира. Настоящий паршивец! Все его слова абсурдны
|
|
24
|
+
и направлены на скандал. Рейган когда-то сказал Горбачёву:
|
|
25
|
+
«Мистер Горбачёв, развалите эту стену!», а Трамп собирается
|
|
26
|
+
взводить стену между Америкой и Мексикой.
|
|
27
|
+
</p>
|
|
28
|
+
</Footnote>
|
|
29
|
+
</div>
|
|
30
|
+
</>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Default: React.FC = () => (
|
|
35
|
+
<>
|
|
36
|
+
<PreviewWrapper theme="light">
|
|
37
|
+
<Example />
|
|
38
|
+
</PreviewWrapper>
|
|
39
|
+
<PreviewWrapper theme="dark">
|
|
40
|
+
<Example />
|
|
41
|
+
</PreviewWrapper>
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { Footnote } from './'
|
|
4
|
+
import { FootnoteProps } from './Footnote.types'
|
|
5
|
+
|
|
6
|
+
import styles from './Footnote.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Footnote', () => {
|
|
9
|
+
let props: FootnoteProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<Footnote {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const footnote = getByTestId('footnote')
|
|
17
|
+
|
|
18
|
+
expect(footnote).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { FootnoteProps } from './Footnote.types'
|
|
3
|
+
import makeClassName from '../utils/makeClassName'
|
|
4
|
+
|
|
5
|
+
import { SvgSymbol } from '../SvgSymbol'
|
|
6
|
+
|
|
7
|
+
import styles from './Footnote.module.css'
|
|
8
|
+
|
|
9
|
+
export const Footnote: React.FC<FootnoteProps> = ({ children, onClose }) => {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
data-testid="footnote"
|
|
13
|
+
className={makeClassName([[styles.root, true]])}
|
|
14
|
+
>
|
|
15
|
+
<button
|
|
16
|
+
className={styles.dismiss}
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={(): void => onClose()}
|
|
19
|
+
>
|
|
20
|
+
<SvgSymbol icon="cross" size="unset" />
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
<div className={styles.body}>{children}</div>
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { GroupedBlockProps } from './GroupedBlock.types'
|
|
3
|
-
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
-
|
|
7
5
|
import { EmbedBlockContainer } from '../EmbedBlock'
|
|
8
6
|
import { MediaCaption } from '../MediaCaption'
|
|
9
7
|
|
|
@@ -14,15 +12,15 @@ export const GroupedBlock: React.FC<GroupedBlockProps> = ({
|
|
|
14
12
|
block: { only_on: onlyOn },
|
|
15
13
|
styleContext
|
|
16
14
|
}) => {
|
|
17
|
-
const maxHeight = Math.min(...block.data.map(item => item.data.height))
|
|
15
|
+
const maxHeight = Math.min(...block.data.map((item) => item.data.height))
|
|
18
16
|
|
|
19
17
|
const normalizedBoxesWidth = block.data.map(
|
|
20
|
-
item => item.data.width / (item.data.height / maxHeight)
|
|
18
|
+
(item) => item.data.width / (item.data.height / maxHeight)
|
|
21
19
|
)
|
|
22
20
|
|
|
23
21
|
const sumWidth = normalizedBoxesWidth.reduce((sum, x) => sum + x)
|
|
24
22
|
|
|
25
|
-
let classNames:
|
|
23
|
+
let classNames: ClassNames = [
|
|
26
24
|
[styles.root, true],
|
|
27
25
|
[styles[onlyOn], true],
|
|
28
26
|
[styles.hasFigcaption, block.cc === 'default'],
|
package/src/HalfBlock/index.tsx
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { HalfBlockProps } from './HalfBlock.types'
|
|
3
|
-
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
-
|
|
7
5
|
import { RenderBlocks } from '../RenderBlocks'
|
|
8
6
|
import { Image } from '../Image'
|
|
9
7
|
import { MediaCaption } from '../MediaCaption'
|
|
@@ -20,7 +18,7 @@ export const HalfBlock: React.FC<HalfBlockProps> = ({
|
|
|
20
18
|
},
|
|
21
19
|
styleContext
|
|
22
20
|
}) => {
|
|
23
|
-
let classNames:
|
|
21
|
+
let classNames: ClassNames = [
|
|
24
22
|
[styles.root, true],
|
|
25
23
|
[styles[onlyOn], true]
|
|
26
24
|
]
|
|
@@ -36,7 +34,7 @@ export const HalfBlock: React.FC<HalfBlockProps> = ({
|
|
|
36
34
|
<Image optimized={optimized} ratio={ratio} display="super_full" />
|
|
37
35
|
</div>
|
|
38
36
|
<div className={styles.body}>
|
|
39
|
-
{data.blocks.map(item => (
|
|
37
|
+
{data.blocks.map((item) => (
|
|
40
38
|
<RenderBlocks key={item.id} block={item} styleContext={['rich']} />
|
|
41
39
|
))}
|
|
42
40
|
</div>
|
package/src/Image/Image.test.tsx
CHANGED
package/src/Image/Image.types.ts
CHANGED
|
@@ -18,14 +18,14 @@ export interface ImageProps {
|
|
|
18
18
|
}
|
|
19
19
|
width?: number
|
|
20
20
|
height?: number
|
|
21
|
-
source?:
|
|
21
|
+
source?: string[]
|
|
22
22
|
lazy?: boolean
|
|
23
23
|
fullscreen?: boolean
|
|
24
24
|
ratio?: number
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface PictureProps {
|
|
28
|
-
source?:
|
|
28
|
+
source?: string[]
|
|
29
29
|
optimized?: {
|
|
30
30
|
original?: string
|
|
31
31
|
w325: OptimizedImageItem
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { PictureProps } from './Image.types'
|
|
3
|
-
|
|
4
3
|
import { imageBreakpoints, imageConditionalKeys } from '../constants'
|
|
5
4
|
import { toCamel } from '../utils/toCamel'
|
|
6
5
|
|
|
@@ -31,7 +30,7 @@ export const RenderPicture: React.FC<PictureProps> = ({
|
|
|
31
30
|
)}
|
|
32
31
|
|
|
33
32
|
{optimized &&
|
|
34
|
-
keys.map(key => {
|
|
33
|
+
keys.map((key) => {
|
|
35
34
|
const breakpoint = optimized[`w${key}`]
|
|
36
35
|
|
|
37
36
|
if (!breakpoint) {
|
package/src/Image/index.tsx
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from 'react'
|
|
2
2
|
import { ImageProps } from './Image.types'
|
|
3
|
-
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
5
|
-
|
|
3
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
6
4
|
import BlockContext from '../utils/BlockContext'
|
|
7
5
|
import viewportSize from '../utils/viewportSize'
|
|
8
6
|
import postMessage from '../utils/postMessage'
|
|
9
7
|
import { MediaQuerySizes } from '../constants'
|
|
10
|
-
|
|
11
8
|
import { Lazy } from '../Lazy'
|
|
12
9
|
import RenderPicture from './RenderPicture'
|
|
13
10
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
|
-
|
|
4
3
|
import { ImportantLead } from './'
|
|
5
4
|
import { ImportantLeadProps } from './ImportantLead.types'
|
|
5
|
+
|
|
6
6
|
import styles from './ImportantLead.module.css'
|
|
7
7
|
|
|
8
8
|
describe('Important Lead', () => {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ImportantLeadProps } from './ImportantLead.types'
|
|
3
|
-
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
|
-
|
|
7
5
|
import { RenderBlocks } from '../RenderBlocks'
|
|
8
6
|
|
|
9
7
|
import styles from './ImportantLead.module.css'
|
|
@@ -12,7 +10,7 @@ export const ImportantLead: React.FC<ImportantLeadProps> = ({
|
|
|
12
10
|
block: { only_on: onlyOn, data },
|
|
13
11
|
styleContext
|
|
14
12
|
}) => {
|
|
15
|
-
let classNames:
|
|
13
|
+
let classNames: ClassNames = [
|
|
16
14
|
[styles.root, true],
|
|
17
15
|
[styles[onlyOn], !!onlyOn]
|
|
18
16
|
]
|
|
@@ -23,7 +21,7 @@ export const ImportantLead: React.FC<ImportantLeadProps> = ({
|
|
|
23
21
|
|
|
24
22
|
return (
|
|
25
23
|
<div data-testid="important-lead" className={makeClassName(classNames)}>
|
|
26
|
-
{data.map(item => (
|
|
24
|
+
{data.map((item) => (
|
|
27
25
|
<RenderBlocks
|
|
28
26
|
key={item.id}
|
|
29
27
|
block={item}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
|
|
3
2
|
import { Lazy } from './'
|
|
4
3
|
import { Image } from '../Image'
|
|
5
4
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
import styles from './Lazy.stories.module.css'
|
|
8
7
|
|
|
8
|
+
import mock from '../Image/mock.json'
|
|
9
|
+
|
|
9
10
|
export default {
|
|
10
11
|
title: 'Main / Lazy',
|
|
11
12
|
component: Lazy,
|
package/src/Lazy/Lazy.test.tsx
CHANGED
package/src/Lazy/index.tsx
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useInView } from 'react-intersection-observer'
|
|
3
|
-
|
|
4
|
-
import
|
|
3
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
4
|
+
import { LazyProps } from './Lazy.types'
|
|
5
5
|
|
|
6
6
|
import styles from './Lazy.module.css'
|
|
7
7
|
|
|
8
|
-
import { LazyProps } from './Lazy.types'
|
|
9
|
-
|
|
10
8
|
export const Lazy: React.FC<LazyProps> = ({ children, threshold }) => {
|
|
11
9
|
const [ref, inView, entry] = useInView({
|
|
12
10
|
threshold: threshold || 0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
|
|
3
2
|
import { ListBlock } from './'
|
|
4
3
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
|
|
5
5
|
import styles from './ListBlock.stories.module.css'
|
|
6
6
|
|
|
7
7
|
import mock from './mock.json'
|
|
@@ -18,7 +18,7 @@ const Example: React.FC = () => {
|
|
|
18
18
|
return (
|
|
19
19
|
<>
|
|
20
20
|
<div className={styles.root}>
|
|
21
|
-
{mock.blocks.map(item => (
|
|
21
|
+
{mock.blocks.map((item) => (
|
|
22
22
|
<ListBlock block={item} key={item.id} />
|
|
23
23
|
))}
|
|
24
24
|
</div>
|
package/src/ListBlock/index.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ListBlockProps } from './ListBlock.types'
|
|
3
|
-
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
6
5
|
|
|
7
6
|
import styles from './ListBlock.module.css'
|
|
@@ -12,7 +11,7 @@ export const ListBlock: React.FC<ListBlockProps> = ({
|
|
|
12
11
|
}) => {
|
|
13
12
|
const TagName = type
|
|
14
13
|
|
|
15
|
-
let classNames:
|
|
14
|
+
let classNames: ClassNames = [
|
|
16
15
|
[styles.root, true],
|
|
17
16
|
[styles[onlyOn], true],
|
|
18
17
|
[styles[type], !!type && !!styles[type]]
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
|
|
3
2
|
import { MaterialNote } from './'
|
|
4
3
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
import { MaterialNoteProps } from 'src/MaterialNote/MaterialNote.types'
|
|
5
|
+
|
|
5
6
|
import styles from './MaterialNote.stories.module.css'
|
|
6
7
|
|
|
7
|
-
import mock from './mock'
|
|
8
|
+
import mock from './mock.json'
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
title: 'Main / MaterialNote',
|
|
@@ -18,7 +19,7 @@ const Example: React.FC = () => {
|
|
|
18
19
|
return (
|
|
19
20
|
<>
|
|
20
21
|
<div className={styles.root}>
|
|
21
|
-
<MaterialNote block={mock} />
|
|
22
|
+
<MaterialNote block={mock as MaterialNoteProps['block']} />
|
|
22
23
|
</div>
|
|
23
24
|
</>
|
|
24
25
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { MaterialNoteProps } from './MaterialNote.types'
|
|
3
3
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
4
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
5
|
|
|
6
6
|
import styles from './MaterialNote.module.css'
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ export const MaterialNote: React.FC<MaterialNoteProps> = ({
|
|
|
9
9
|
block: { data },
|
|
10
10
|
styleContext
|
|
11
11
|
}) => {
|
|
12
|
-
let classNames:
|
|
12
|
+
let classNames: ClassNames = [[styles.root, true]]
|
|
13
13
|
|
|
14
14
|
if (styleContext) {
|
|
15
15
|
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
@@ -18,7 +18,7 @@ export const MaterialNote: React.FC<MaterialNoteProps> = ({
|
|
|
18
18
|
return (
|
|
19
19
|
<div data-testid="material-note" className={makeClassName(classNames)}>
|
|
20
20
|
{data &&
|
|
21
|
-
data.map(item => (
|
|
21
|
+
data.map((item) => (
|
|
22
22
|
<p
|
|
23
23
|
className={styles[item.type]}
|
|
24
24
|
key={item.id}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
|
-
|
|
4
3
|
import { MaterialTitle } from './'
|
|
5
4
|
import { MaterialTitleProps } from './MaterialTitle.types'
|
|
5
|
+
|
|
6
6
|
import styles from './MaterialTitle.module.css'
|
|
7
7
|
|
|
8
8
|
describe('Material Title', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { MediaCaptionProps } from './MediaCaption.types'
|
|
3
3
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
4
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
5
|
|
|
6
6
|
import styles from './MediaCaption.module.css'
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@ export const MediaCaption: React.FC<MediaCaptionProps> = ({
|
|
|
10
10
|
caption,
|
|
11
11
|
styleContext
|
|
12
12
|
}) => {
|
|
13
|
-
let classNames:
|
|
13
|
+
let classNames: ClassNames = [[styles.root, true]]
|
|
14
14
|
|
|
15
15
|
if (styleContext) {
|
|
16
16
|
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
|
|
3
2
|
import { Meta } from './'
|
|
4
3
|
import { MetaItem } from '../MetaItem'
|
|
5
4
|
import { MetaItemLive } from '../MetaItemLive'
|
|
@@ -7,6 +6,7 @@ import { DocumentItemsCount } from '../DocumentItemsCount'
|
|
|
7
6
|
import { Timestamp } from '../Timestamp'
|
|
8
7
|
import { SvgSymbol } from '../SvgSymbol'
|
|
9
8
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
9
|
+
|
|
10
10
|
import styles from './Meta.stories.module.css'
|
|
11
11
|
|
|
12
12
|
export default {
|
package/src/Meta/Meta.test.tsx
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { MetaContainerProps } from './Meta.types'
|
|
3
|
-
|
|
4
3
|
import { Meta } from './'
|
|
5
4
|
import { MetaItem } from '../MetaItem'
|
|
6
5
|
import { MetaItemLive } from '../MetaItemLive'
|
|
7
6
|
import { DocumentItemsCount } from '../DocumentItemsCount'
|
|
8
|
-
|
|
9
7
|
import { BookmarkButton } from '../BookmarkButton'
|
|
10
8
|
import { Timestamp } from '../Timestamp'
|
|
11
9
|
import { SvgSymbol } from '../SvgSymbol'
|
|
@@ -29,7 +27,7 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
|
|
|
29
27
|
const isPodcast = styleContext && styleContext.indexOf('podcast') !== -1
|
|
30
28
|
const isSlides = styleContext && styleContext.indexOf('slide') !== -1
|
|
31
29
|
|
|
32
|
-
const hasSource = !!components.find(item => item.type === 'source_name')
|
|
30
|
+
const hasSource = !!components.find((item) => item.type === 'source_name')
|
|
33
31
|
|
|
34
32
|
return (
|
|
35
33
|
<Meta
|
|
@@ -38,7 +36,7 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
|
|
|
38
36
|
onlyOn={block.only_on}
|
|
39
37
|
hasSource={hasSource}
|
|
40
38
|
>
|
|
41
|
-
{components.map(component => {
|
|
39
|
+
{components.map((component) => {
|
|
42
40
|
switch (component.type) {
|
|
43
41
|
case 'source_name': {
|
|
44
42
|
return (
|
package/src/Meta/index.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { MetaProps } from './Meta.types'
|
|
3
|
-
|
|
4
3
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
5
|
-
import makeClassName from '../utils/makeClassName'
|
|
4
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
6
5
|
|
|
7
6
|
import styles from './Meta.module.css'
|
|
8
7
|
|
|
@@ -13,7 +12,7 @@ export const Meta: React.FC<MetaProps> = ({
|
|
|
13
12
|
onlyOn,
|
|
14
13
|
styleContext
|
|
15
14
|
}) => {
|
|
16
|
-
let classNames:
|
|
15
|
+
let classNames: ClassNames = [
|
|
17
16
|
[styles.root, true],
|
|
18
17
|
[styles[theme], !!theme && !!styles[theme]],
|
|
19
18
|
[styles[onlyOn], !!onlyOn],
|
package/src/MetaItem/index.tsx
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { MetaItemProps } from './MetaItem.types'
|
|
3
|
-
|
|
4
|
-
import makeClassName from '../utils/makeClassName'
|
|
5
|
-
|
|
3
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
6
4
|
import styles from './MetaItem.module.css'
|
|
7
5
|
|
|
8
6
|
export const MetaItem: React.FC<MetaItemProps> = ({
|