@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
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassNames } from './makeClassName';
|
|
2
|
+
declare const makeStyleContext: (classNames: ClassNames, styleContext: string[] | string, styles: Record<string, string>) => ClassNames;
|
|
2
3
|
export default makeStyleContext;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.10",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "UIKit for Meduza",
|
|
5
5
|
"repository": "https://github.com/meduza-corp/ui-kit-2.git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "tsdx test --passWithNoTests",
|
|
23
23
|
"test:watch": "tsdx test --watch",
|
|
24
24
|
"test:coverage": "tsdx test --coverage",
|
|
25
|
-
"lint": "
|
|
25
|
+
"lint": "eslint src",
|
|
26
26
|
"prepare": "tsdx build",
|
|
27
27
|
"storybook": "start-storybook -p 6006",
|
|
28
28
|
"build-storybook": "build-storybook"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"husky": {
|
|
53
53
|
"hooks": {
|
|
54
|
-
"pre-commit": "lint-staged",
|
|
54
|
+
"pre-commit": "tsc --noEmit && lint-staged",
|
|
55
55
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
@@ -69,7 +69,14 @@
|
|
|
69
69
|
"@testing-library/react": "^10.4.7",
|
|
70
70
|
"@types/react": "^16.9.43",
|
|
71
71
|
"@types/react-dom": "^16.9.8",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
|
73
|
+
"@typescript-eslint/parser": "^4.2.0",
|
|
72
74
|
"babel-loader": "^8.1.0",
|
|
75
|
+
"eslint": "^7.9.0",
|
|
76
|
+
"eslint-config-prettier": "^6.11.0",
|
|
77
|
+
"eslint-plugin-jsx-a11y": "^6.3.1",
|
|
78
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
79
|
+
"eslint-plugin-react": "^7.21.0",
|
|
73
80
|
"husky": "^4.2.5",
|
|
74
81
|
"identity-obj-proxy": "^3.0.0",
|
|
75
82
|
"lint-staged": "^10.2.11",
|
|
@@ -79,6 +86,7 @@
|
|
|
79
86
|
"postcss-modules": "^3.2.0",
|
|
80
87
|
"postcss-preset-env": "^6.7.0",
|
|
81
88
|
"precss": "^4.0.0",
|
|
89
|
+
"prettier": "^2.1.2",
|
|
82
90
|
"react": "^16.13.1",
|
|
83
91
|
"react-docgen-typescript-loader": "^3.7.2",
|
|
84
92
|
"react-dom": "^16.13.1",
|
|
@@ -93,7 +101,7 @@
|
|
|
93
101
|
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
|
94
102
|
"tsdx": "^0.13.2",
|
|
95
103
|
"tslib": "^2.0.0",
|
|
96
|
-
"typescript": "^
|
|
104
|
+
"typescript": "^4.0.3",
|
|
97
105
|
"typescript-plugin-css-modules": "^2.4.0",
|
|
98
106
|
"utils": "^0.3.1"
|
|
99
107
|
},
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { BookmarkButtonProps } from './BookmarkButton.types'
|
|
3
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
4
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
5
|
-
|
|
6
5
|
import { SvgSymbol } from '../SvgSymbol'
|
|
7
|
-
|
|
8
6
|
import styles from './BookmarkButton.module.css'
|
|
9
7
|
|
|
10
8
|
export const BookmarkButton: React.FC<BookmarkButtonProps> = ({
|
|
@@ -13,7 +11,7 @@ export const BookmarkButton: React.FC<BookmarkButtonProps> = ({
|
|
|
13
11
|
isInBookmarks,
|
|
14
12
|
onClick
|
|
15
13
|
}) => {
|
|
16
|
-
let classNames:
|
|
14
|
+
let classNames: ClassNames = [
|
|
17
15
|
[styles.root, true],
|
|
18
16
|
[styles.isInBookmarks, isInBookmarks],
|
|
19
17
|
[styles[theme], !!theme && !!styles[theme]]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
|
|
3
2
|
import { Button } from './'
|
|
4
3
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
5
|
-
import styles from './Button.stories.module.css'
|
|
6
4
|
import { ButtonStates, ButtonThemes } from './Button.types'
|
|
7
5
|
|
|
6
|
+
import styles from './Button.stories.module.css'
|
|
7
|
+
|
|
8
8
|
export default {
|
|
9
9
|
title: 'Main / Button',
|
|
10
10
|
component: Button,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render, RenderResult } from '@testing-library/react'
|
|
3
|
-
|
|
4
3
|
import { Button } from './'
|
|
5
|
-
import styles from './Button.module.css'
|
|
6
4
|
import { ButtonThemes } from './Button.types'
|
|
7
5
|
|
|
6
|
+
import styles from './Button.module.css'
|
|
7
|
+
|
|
8
8
|
describe('Button', () => {
|
|
9
9
|
const buttonTypes: { theme: ButtonThemes; title: string }[] = [
|
|
10
10
|
{ theme: 'gold', title: 'Золотая кнопка' },
|
|
@@ -16,7 +16,7 @@ describe('Button', () => {
|
|
|
16
16
|
{ theme: 'gray', title: 'Серая кнопка' }
|
|
17
17
|
]
|
|
18
18
|
|
|
19
|
-
test.each(buttonTypes)('Check classes.', button => {
|
|
19
|
+
test.each(buttonTypes)('Check classes.', (button) => {
|
|
20
20
|
const renderComponent = (): RenderResult =>
|
|
21
21
|
render(<Button theme={button.theme}>{button.title}</Button>)
|
|
22
22
|
|
package/src/Button/index.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { FC } from 'react'
|
|
2
|
-
|
|
3
|
-
import makeClassName from '../utils/makeClassName'
|
|
2
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
4
3
|
import Loader from './loader'
|
|
5
|
-
import styles from './Button.module.css'
|
|
6
4
|
import { ButtonProps } from './Button.types'
|
|
7
5
|
|
|
6
|
+
import styles from './Button.module.css'
|
|
7
|
+
|
|
8
8
|
export const Button: FC<ButtonProps> = ({
|
|
9
9
|
theme = 'gold',
|
|
10
10
|
size = 'default',
|
package/src/CardTitle/index.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { CardTitleProps } from './CardTitle.types'
|
|
3
|
-
import makeClassName from '../utils/makeClassName'
|
|
4
|
-
|
|
3
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
5
4
|
import styles from './CardTitle.module.css'
|
|
6
5
|
|
|
7
6
|
export const CardTitle: React.FC<CardTitleProps> = ({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ChapterBlockProps } from './ChapterBlock.types'
|
|
3
|
-
import makeClassName from '../utils/makeClassName'
|
|
4
|
-
|
|
3
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
5
4
|
import styles from './ChapterBlock.module.css'
|
|
6
5
|
|
|
7
6
|
export const ChapterBlock: React.FC<ChapterBlockProps> = ({
|
package/src/Cover/Cover.test.tsx
CHANGED
package/src/Cover/index.tsx
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { CoverProps } from './Cover.types'
|
|
3
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
4
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
5
5
|
import generateGradient from '../utils/generateGradient'
|
|
6
|
-
|
|
7
|
-
import styles from './Cover.module.css'
|
|
8
|
-
|
|
9
6
|
import { RenderBlocks } from '../RenderBlocks'
|
|
10
7
|
import { MediaCaption } from '../MediaCaption'
|
|
11
8
|
import { Image } from '../Image'
|
|
12
9
|
import { Popover } from '../Popover'
|
|
13
10
|
|
|
11
|
+
import styles from './Cover.module.css'
|
|
12
|
+
|
|
14
13
|
export const Cover: React.FC<CoverProps> = ({
|
|
15
14
|
block: {
|
|
16
15
|
only_on: onlyOn,
|
|
@@ -25,7 +24,7 @@ export const Cover: React.FC<CoverProps> = ({
|
|
|
25
24
|
|
|
26
25
|
const style: React.CSSProperties = {}
|
|
27
26
|
|
|
28
|
-
let classNames:
|
|
27
|
+
let classNames: ClassNames = [
|
|
29
28
|
[styles.root, true],
|
|
30
29
|
[styles[onlyOn], !!onlyOn && !!styles[onlyOn]]
|
|
31
30
|
]
|
|
@@ -56,7 +55,7 @@ export const Cover: React.FC<CoverProps> = ({
|
|
|
56
55
|
<Image optimized={urls} ratio={mobileRatio} display="narrow" />
|
|
57
56
|
</div>
|
|
58
57
|
<div className={styles.body} style={style}>
|
|
59
|
-
{blocks.map(item => (
|
|
58
|
+
{blocks.map((item) => (
|
|
60
59
|
<RenderBlocks
|
|
61
60
|
key={item.id}
|
|
62
61
|
block={item}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
|
-
|
|
4
3
|
import { DocumentItemsCount } from './'
|
|
5
4
|
import { DocumentItemsCountProps } from './DocumentItemsCount.types'
|
|
5
|
+
|
|
6
6
|
import styles from './DocumentItemsCount.module.css'
|
|
7
7
|
|
|
8
8
|
describe('Document Items Count', () => {
|
|
@@ -39,23 +39,27 @@
|
|
|
39
39
|
top: 50%;
|
|
40
40
|
left: 50%;
|
|
41
41
|
|
|
42
|
-
width: 340px;
|
|
43
|
-
padding: 25px;
|
|
44
|
-
|
|
45
42
|
transform: translate(-50%, -50%);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.popoverTitle {
|
|
46
|
+
margin-bottom: 16px;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
background-color: #fff;
|
|
50
|
-
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.2);
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
}
|
|
51
50
|
|
|
51
|
+
.popoverBody {
|
|
52
52
|
font-family: $secondaryFont;
|
|
53
53
|
font-size: 16px;
|
|
54
54
|
line-height: 22px;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
.
|
|
58
|
-
|
|
57
|
+
.popoverText p {
|
|
58
|
+
margin: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.popoverText a:hover {
|
|
62
|
+
color: $gold;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
.dismiss {
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
3
|
import mock from './mock.json'
|
|
4
4
|
import { DotsOnImage } from './'
|
|
5
|
+
|
|
5
6
|
import styles from './DotsOnImage.module.css'
|
|
6
7
|
|
|
7
8
|
describe('Dots On Image', () => {
|
|
@@ -10,7 +11,7 @@ describe('Dots On Image', () => {
|
|
|
10
11
|
const renderComponent = () => render(<DotsOnImage block={data} />)
|
|
11
12
|
|
|
12
13
|
it('should have root style', () => {
|
|
13
|
-
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
14
15
|
|
|
15
16
|
const dotsOnImage = getByTestId('dots-on-image')
|
|
16
17
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { PopoverData, DotsOnImageProps, SingleDot } from './DotsOnImage.types'
|
|
3
|
-
|
|
4
3
|
import { Image } from '../Image'
|
|
5
|
-
import {
|
|
4
|
+
import { Popover } from '../Popover'
|
|
5
|
+
import { Footnote } from '../Footnote'
|
|
6
|
+
|
|
7
|
+
import viewportSize from '../utils/viewportSize'
|
|
8
|
+
import { MediaQuerySizes } from '../constants'
|
|
6
9
|
|
|
7
10
|
import styles from './DotsOnImage.module.css'
|
|
8
11
|
|
|
@@ -30,7 +33,7 @@ export const DotsOnImage: React.FC<DotsOnImageProps> = ({
|
|
|
30
33
|
return (
|
|
31
34
|
<div data-testid="dots-on-image" className={styles.root}>
|
|
32
35
|
<div className={styles.dots}>
|
|
33
|
-
{dots.map(dot => (
|
|
36
|
+
{dots.map((dot) => (
|
|
34
37
|
<button
|
|
35
38
|
className={styles.dot}
|
|
36
39
|
type="button"
|
|
@@ -63,20 +66,29 @@ export const DotsOnImage: React.FC<DotsOnImageProps> = ({
|
|
|
63
66
|
</div>
|
|
64
67
|
|
|
65
68
|
{popover.show && (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
className={styles.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
<>
|
|
70
|
+
{viewportSize().width >= MediaQuerySizes.LANDSCAPE_TABLET ? (
|
|
71
|
+
<div className={styles.popover}>
|
|
72
|
+
<Footnote
|
|
73
|
+
onClose={(): void => {
|
|
74
|
+
setPopover({ show: false })
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<h3>{popover.title}</h3>
|
|
78
|
+
<div dangerouslySetInnerHTML={{ __html: popover.body }} />
|
|
79
|
+
</Footnote>
|
|
80
|
+
</div>
|
|
81
|
+
) : (
|
|
82
|
+
<Popover
|
|
83
|
+
onClose={(): void => {
|
|
84
|
+
setPopover({ show: false })
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<h3>{popover.title}</h3>
|
|
88
|
+
<div dangerouslySetInnerHTML={{ __html: popover.body }} />
|
|
89
|
+
</Popover>
|
|
90
|
+
)}
|
|
91
|
+
</>
|
|
80
92
|
)}
|
|
81
93
|
</div>
|
|
82
94
|
)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"data": {
|
|
4
4
|
"dots": [
|
|
5
5
|
{
|
|
6
|
-
"title": "
|
|
7
|
-
"body": "<p
|
|
6
|
+
"title": "Мафия и Голливуд",
|
|
7
|
+
"body": "<p>Но Голливуду тех лет далеко за вдохновением ходить было не нужно. Мафия в 20-е подминала под себя профсоюзы по всей стране, и Голливуд не был исключением. Один из таких профсоюзов возглавил Томас Мэлой. Когда в 1931 году уволенный киномеханик пришёл к нему жаловаться, то подручный Мэлоя застрелил его прямо в кабинете. Причём без всяких последствий для себя.</p>",
|
|
8
8
|
"position": {
|
|
9
9
|
"x": 43.86,
|
|
10
10
|
"y": 31.03
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"id": "0-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"title": "
|
|
21
|
-
"body": "<p
|
|
20
|
+
"title": "Аль Капоне в кино",
|
|
21
|
+
"body": "<p>Первые гангстерские фильмы начала 30-х своим появлением обязаны «Королю Чикаго» — Аль Капоне. Ещё при жизни он стал знаменитостью мирового масштаба: он получал письма со всех концов света, а журналисты выстраивались в очередь, чтобы задать ему пару вопросов. Отель «Готорн», из которого он привык вести дела, городские экскурсоводы называли «замком Капоне».</p>",
|
|
22
22
|
"position": {
|
|
23
23
|
"x": 16.05,
|
|
24
24
|
"y": 18.83
|
package/src/Dropdown/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { DropdownProps } from './Dropdown.types'
|
|
3
|
-
import makeClassName from '../utils/makeClassName'
|
|
3
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
4
4
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
5
5
|
|
|
6
6
|
import styles from './Dropdown.module.css'
|
|
@@ -18,7 +18,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
18
18
|
active,
|
|
19
19
|
styleContext
|
|
20
20
|
}) => {
|
|
21
|
-
let classNames:
|
|
21
|
+
let classNames: ClassNames = [
|
|
22
22
|
[styles.root, true],
|
|
23
23
|
[styles.active, !!active && !!styles.active]
|
|
24
24
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
|
|
3
2
|
import { EmbedBlockContainer } from './'
|
|
4
3
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
|
|
5
5
|
import styles from './EmbedBlock.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(block => (
|
|
21
|
+
{mock.blocks.map((block) => (
|
|
22
22
|
<EmbedBlockContainer block={block} lang="ru" key={block.id} />
|
|
23
23
|
))}
|
|
24
24
|
</div>
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
|
|
3
2
|
import { Image } from '../Image'
|
|
4
3
|
import { Popover } from '../Popover'
|
|
5
4
|
import { MediaCaption } from '../MediaCaption'
|
|
6
5
|
import { DotsOnImage } from '../DotsOnImage'
|
|
7
|
-
|
|
8
|
-
import makeClassName from '../utils/makeClassName'
|
|
6
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
9
7
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
10
|
-
|
|
11
8
|
import DangerousHTML from '../utils/DangerousHtml'
|
|
12
|
-
|
|
13
9
|
import { EmbedGif } from './EmbedGif'
|
|
14
|
-
|
|
15
10
|
import { EmbedBlockProps } from './EmbedBlock.types'
|
|
16
11
|
|
|
17
12
|
import styles from './EmbedBlock.module.css'
|
|
@@ -118,7 +113,7 @@ export const EmbedBlock: React.FC<EmbedBlockProps> = ({
|
|
|
118
113
|
style.height = 0
|
|
119
114
|
}
|
|
120
115
|
|
|
121
|
-
let classNames:
|
|
116
|
+
let classNames: ClassNames = [
|
|
122
117
|
[styles.root, true],
|
|
123
118
|
[styles.cc, cc],
|
|
124
119
|
[styles[display], !!display && styles[display]],
|
|
@@ -134,7 +129,7 @@ export const EmbedBlock: React.FC<EmbedBlockProps> = ({
|
|
|
134
129
|
|
|
135
130
|
if (styleContext) {
|
|
136
131
|
const filteredContext = Object.keys(styleContext)
|
|
137
|
-
.filter(key => key.startsWith('isIn') && styles[key])
|
|
132
|
+
.filter((key) => key.startsWith('isIn') && styles[key])
|
|
138
133
|
.reduce((acc, key) => {
|
|
139
134
|
acc.push([styles[key], true])
|
|
140
135
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
-
|
|
3
2
|
import enableInlineVideo from 'iphone-inline-video'
|
|
4
|
-
|
|
5
3
|
import viewportSize from '../utils/viewportSize'
|
|
6
4
|
import { MediaQuerySizes } from '../constants'
|
|
7
|
-
|
|
8
5
|
import { EmbedGifProps } from './EmbedBlock.types'
|
|
9
6
|
|
|
10
7
|
import styles from './EmbedBlock.module.css'
|
package/src/EmbedBlock/index.tsx
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
width: 320px;
|
|
7
|
+
padding: 20px;
|
|
8
|
+
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 5px 20px rgba(0, 0, 0, 0.2);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.body {
|
|
15
|
+
font-family: $secondaryFont;
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
line-height: 22px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.body h3 {
|
|
21
|
+
margin: 0 0 16px;
|
|
22
|
+
|
|
23
|
+
font-size: inherit;
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
line-height: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.body p {
|
|
29
|
+
margin: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.body p + p {
|
|
33
|
+
margin-top: 6px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
.body a {
|
|
38
|
+
color: inherit;
|
|
39
|
+
box-shadow: inset 0 -1px $gold;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.body a:hover {
|
|
43
|
+
color: $gold;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dismiss {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
|
|
51
|
+
margin: 0;
|
|
52
|
+
padding: 6px 9px 10px;
|
|
53
|
+
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
|
|
56
|
+
color: #b3b3b3;
|
|
57
|
+
border-width: 0;
|
|
58
|
+
outline: none;
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dismiss:hover {
|
|
63
|
+
color: #757575;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.dismiss svg {
|
|
67
|
+
width: 12px;
|
|
68
|
+
height: 12px;
|
|
69
|
+
}
|
|
70
|
+
|