@meduza/ui-kit-2 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Meta/Meta.types.d.ts +0 -5
- package/dist/MetaItem/MetaItem.types.d.ts +1 -0
- package/dist/RawHtmlBlock/RawHtmlBlock.types.d.ts +1 -5
- package/dist/RenderBlocks/RenderBlocks.types.d.ts +1 -5
- package/dist/SvgSymbol/SvgSymbol.types.d.ts +2 -2
- package/dist/SvgSymbol/icons.d.ts +0 -25
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +1 -2
- package/dist/constants.d.ts +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui-kit-2.cjs.development.js +70 -168
- 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 +71 -168
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit-game.css +47 -156
- package/dist/ui-kit.css +47 -156
- package/package.json +13 -13
- package/src/Cover/Cover.module.css +0 -17
- package/src/Meta/Meta.module.css +0 -11
- package/src/Meta/Meta.stories.tsx +1 -3
- package/src/Meta/Meta.types.ts +0 -5
- package/src/Meta/MetaContainer.tsx +5 -44
- package/src/MetaItem/MetaItem.module.css +12 -22
- package/src/MetaItem/MetaItem.types.ts +1 -0
- package/src/MetaItem/index.tsx +4 -2
- package/src/RawHtmlBlock/RawHtmlBlock.types.ts +1 -5
- package/src/RawHtmlBlock/index.tsx +0 -8
- package/src/RawHtmlBlock/mock.json +1 -2
- package/src/RenderBlocks/RenderBlocks.types.ts +1 -5
- package/src/RenderBlocks/index.tsx +0 -8
- package/src/RichTitle/RichTitle.module.css +22 -3
- package/src/SvgSymbol/SvgSymbol.module.css +1 -26
- package/src/SvgSymbol/SvgSymbol.stories.tsx +1 -2
- package/src/SvgSymbol/SvgSymbol.types.ts +0 -6
- package/src/SvgSymbol/icons.ts +0 -33
- package/src/Tag/Tag.module.css +7 -4
- package/src/Timestamp/index.tsx +1 -1
- package/src/Toolbar/Toolbar.stories.tsx +2 -18
- package/src/ToolbarButton/ToolbarButton.module.css +0 -16
- package/src/ToolbarButton/ToolbarButton.types.ts +0 -2
- package/src/ToolbarButton/index.tsx +0 -7
- package/src/constants.ts +1 -3
- package/src/index.tsx +0 -1
- package/src/types.ts +0 -1
- package/dist/BookmarkButton/BookmarkButton.types.d.ts +0 -6
- package/dist/BookmarkButton/index.d.ts +0 -3
- package/src/BookmarkButton/BookmarkButton.css +0 -45
- package/src/BookmarkButton/BookmarkButton.module.css +0 -45
- package/src/BookmarkButton/BookmarkButton.stories.module.css +0 -5
- package/src/BookmarkButton/BookmarkButton.stories.tsx +0 -39
- package/src/BookmarkButton/BookmarkButton.test.tsx +0 -33
- package/src/BookmarkButton/BookmarkButton.types.ts +0 -6
- package/src/BookmarkButton/index.tsx +0 -35
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { Toolbar, ToolbarItem } from './'
|
|
3
3
|
import { ToolbarButton } from '../ToolbarButton'
|
|
4
4
|
import { ToolbarButtonTypes } from '../ToolbarButton/ToolbarButton.types'
|
|
@@ -17,7 +17,6 @@ export default {
|
|
|
17
17
|
const buttons: {
|
|
18
18
|
type: ToolbarButtonTypes
|
|
19
19
|
label?: string
|
|
20
|
-
icon?: 'shareBookmark'
|
|
21
20
|
}[] = [
|
|
22
21
|
{
|
|
23
22
|
type: 'tg'
|
|
@@ -28,25 +27,16 @@ const buttons: {
|
|
|
28
27
|
{
|
|
29
28
|
type: 'tw'
|
|
30
29
|
},
|
|
31
|
-
{
|
|
32
|
-
type: 'bookmark',
|
|
33
|
-
icon: 'shareBookmark'
|
|
34
|
-
},
|
|
35
30
|
{
|
|
36
31
|
type: 'reaction'
|
|
37
32
|
}
|
|
38
33
|
]
|
|
39
34
|
|
|
40
35
|
const Example: React.FC<{ theme?: string }> = ({ theme }) => {
|
|
41
|
-
const [bookmark, setBookmark] = useState(false)
|
|
42
36
|
const handleButton = (type: string): void => {
|
|
43
37
|
alert(type)
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
const handleBookmark = (): void => {
|
|
47
|
-
setBookmark(!bookmark)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
40
|
return (
|
|
51
41
|
<>
|
|
52
42
|
<div className={styles.root}>
|
|
@@ -56,14 +46,8 @@ const Example: React.FC<{ theme?: string }> = ({ theme }) => {
|
|
|
56
46
|
<ToolbarButton
|
|
57
47
|
type={button.type}
|
|
58
48
|
theme={theme}
|
|
59
|
-
onClick={(): void =>
|
|
60
|
-
button.type === 'bookmark'
|
|
61
|
-
? handleBookmark()
|
|
62
|
-
: handleButton(button.type)
|
|
63
|
-
}
|
|
64
|
-
isActive={button.type === 'bookmark' && bookmark}
|
|
49
|
+
onClick={(): void => handleButton(button.type)}
|
|
65
50
|
lang="ru"
|
|
66
|
-
icon={button.icon}
|
|
67
51
|
/>
|
|
68
52
|
</ToolbarItem>
|
|
69
53
|
))}
|
|
@@ -52,18 +52,6 @@
|
|
|
52
52
|
fill: #fff;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.isDark.bookmark svg,
|
|
56
|
-
.dark.bookmark svg {
|
|
57
|
-
color: #fff;
|
|
58
|
-
|
|
59
|
-
fill: transparent;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.isDark.bookmark.isActive svg,
|
|
63
|
-
.dark.bookmark.isActive svg {
|
|
64
|
-
fill: currentColor;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
55
|
.isDark::before,
|
|
68
56
|
.dark::before {
|
|
69
57
|
border-left-color: rgba(255, 255, 255, 0.2);
|
|
@@ -99,10 +87,6 @@
|
|
|
99
87
|
vertical-align: middle;
|
|
100
88
|
}
|
|
101
89
|
|
|
102
|
-
.bookmark {
|
|
103
|
-
fill: transparent;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
90
|
.isActive {
|
|
107
91
|
fill: currentColor;
|
|
108
92
|
}
|
|
@@ -4,7 +4,6 @@ export type ToolbarButtonTypes =
|
|
|
4
4
|
| 'tg'
|
|
5
5
|
| 'reaction'
|
|
6
6
|
| 'pdf'
|
|
7
|
-
| 'bookmark'
|
|
8
7
|
| 'unblock'
|
|
9
8
|
| 'cross'
|
|
10
9
|
|
|
@@ -13,7 +12,6 @@ export interface ToolbarButtonProps {
|
|
|
13
12
|
theme?: string
|
|
14
13
|
lang?: 'ru' | 'en'
|
|
15
14
|
text?: string
|
|
16
|
-
icon?: 'shareBookmark'
|
|
17
15
|
isActive?: boolean
|
|
18
16
|
onClick: (event, type: string) => void
|
|
19
17
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ToolbarButtonProps } from './ToolbarButton.types'
|
|
3
|
-
import { SvgSymbol } from '../SvgSymbol/'
|
|
4
3
|
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
4
|
|
|
6
5
|
import styles from './ToolbarButton.module.css'
|
|
@@ -12,7 +11,6 @@ export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
|
12
11
|
isActive,
|
|
13
12
|
lang = 'ru',
|
|
14
13
|
text,
|
|
15
|
-
icon,
|
|
16
14
|
onClick
|
|
17
15
|
}) => {
|
|
18
16
|
const classNames: ClassNames = [
|
|
@@ -31,11 +29,6 @@ export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
|
31
29
|
type="button"
|
|
32
30
|
onClick={(event): void => onClick(event, type)}
|
|
33
31
|
>
|
|
34
|
-
{icon && (
|
|
35
|
-
<div className={styles.icon}>
|
|
36
|
-
<SvgSymbol size="medium" icon={icon} styleContext="isInToolbar" />
|
|
37
|
-
</div>
|
|
38
|
-
)}
|
|
39
32
|
<span className={styles.text}>{text || label}</span>
|
|
40
33
|
</button>
|
|
41
34
|
)
|
package/src/constants.ts
CHANGED
|
@@ -30,7 +30,6 @@ export const SocialLabels = {
|
|
|
30
30
|
tw: 'Твиттер',
|
|
31
31
|
pdf: 'PDF',
|
|
32
32
|
unblock: 'Magic link',
|
|
33
|
-
bookmark: 'В закладки',
|
|
34
33
|
reaction: 'Напишите нам'
|
|
35
34
|
},
|
|
36
35
|
en: {
|
|
@@ -38,7 +37,6 @@ export const SocialLabels = {
|
|
|
38
37
|
fb: 'Fb',
|
|
39
38
|
tw: 'Twitter',
|
|
40
39
|
pdf: 'PDF',
|
|
41
|
-
unblock: 'Magic link'
|
|
42
|
-
bookmark: 'Add to bookmarks'
|
|
40
|
+
unblock: 'Magic link'
|
|
43
41
|
}
|
|
44
42
|
}
|
package/src/index.tsx
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
color: #e0e0e0;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.control {
|
|
6
|
-
margin: 0;
|
|
7
|
-
padding: 5px 3px;
|
|
8
|
-
|
|
9
|
-
color: inherit;
|
|
10
|
-
|
|
11
|
-
background-color: transparent;
|
|
12
|
-
border-width: 0;
|
|
13
|
-
outline: none;
|
|
14
|
-
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
|
|
17
|
-
appearance: none;
|
|
18
|
-
fill: transparent;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.dark {
|
|
22
|
-
color: #fff;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.light {
|
|
26
|
-
color: #000;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.isInBookmarks .control {
|
|
30
|
-
fill: #000;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.isInBookmarks.dark .control {
|
|
34
|
-
fill: #fff;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.isInBookmarks.light .control {
|
|
38
|
-
fill: #000;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.isInGrid .control svg {
|
|
42
|
-
@media $landscapeTablet {
|
|
43
|
-
width: 12px;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
color: #e0e0e0;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.control {
|
|
6
|
-
margin: 0;
|
|
7
|
-
padding: 5px 3px;
|
|
8
|
-
|
|
9
|
-
color: inherit;
|
|
10
|
-
|
|
11
|
-
background-color: transparent;
|
|
12
|
-
border-width: 0;
|
|
13
|
-
outline: none;
|
|
14
|
-
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
|
|
17
|
-
appearance: none;
|
|
18
|
-
fill: transparent;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.dark {
|
|
22
|
-
color: #fff;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.light {
|
|
26
|
-
color: #000;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.isInBookmarks .control {
|
|
30
|
-
fill: #e0e0e0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.isInBookmarks.dark .control {
|
|
34
|
-
fill: #fff;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.isInBookmarks.light .control {
|
|
38
|
-
fill: #000;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.isInGrid .control svg {
|
|
42
|
-
@media $landscapeTablet {
|
|
43
|
-
width: 12px;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { BookmarkButton } from './'
|
|
3
|
-
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
-
|
|
5
|
-
import styles from './BookmarkButton.stories.module.css'
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Main / BookmarkButton',
|
|
9
|
-
component: BookmarkButton,
|
|
10
|
-
parameters: {
|
|
11
|
-
themeWrapperSideBySide: true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Example: React.FC = () => {
|
|
16
|
-
const [isInBookmarks, setIsInBookmarks] = useState(false)
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<div className={styles.root}>
|
|
21
|
-
<BookmarkButton
|
|
22
|
-
onClick={(): void => setIsInBookmarks(!isInBookmarks)}
|
|
23
|
-
isInBookmarks={isInBookmarks}
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
</>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const Default: React.FC = () => (
|
|
31
|
-
<>
|
|
32
|
-
<PreviewWrapper theme="light">
|
|
33
|
-
<Example />
|
|
34
|
-
</PreviewWrapper>
|
|
35
|
-
<PreviewWrapper theme="dark">
|
|
36
|
-
<Example />
|
|
37
|
-
</PreviewWrapper>
|
|
38
|
-
</>
|
|
39
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react'
|
|
3
|
-
|
|
4
|
-
import { BookmarkButton } from './'
|
|
5
|
-
import styles from './BookmarkButton.module.css'
|
|
6
|
-
|
|
7
|
-
describe('Bookmark Button', () => {
|
|
8
|
-
const renderComponent = () =>
|
|
9
|
-
render(
|
|
10
|
-
<BookmarkButton
|
|
11
|
-
onClick={(): void => alert('true')}
|
|
12
|
-
isInBookmarks={false}
|
|
13
|
-
/>
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
it('should have root style', () => {
|
|
17
|
-
const { getByTestId } = renderComponent()
|
|
18
|
-
|
|
19
|
-
const bookmarkButton = getByTestId('bookmark-button')
|
|
20
|
-
|
|
21
|
-
expect(bookmarkButton).toHaveClass(styles.root)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
// it('should change class on click', () => {
|
|
25
|
-
// const { getByTestId } = renderComponent()
|
|
26
|
-
|
|
27
|
-
// const bookmarkButton = getByTestId('bookmark-button')
|
|
28
|
-
|
|
29
|
-
// fireEvent.click(bookmarkButton)
|
|
30
|
-
|
|
31
|
-
// expect(bookmarkButton).toHaveClass(styles.isInBookmarks)
|
|
32
|
-
// })
|
|
33
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { BookmarkButtonProps } from './BookmarkButton.types'
|
|
3
|
-
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
4
|
-
import makeStyleContext from '../utils/makeStyleContext'
|
|
5
|
-
import { SvgSymbol } from '../SvgSymbol'
|
|
6
|
-
import styles from './BookmarkButton.module.css'
|
|
7
|
-
|
|
8
|
-
export const BookmarkButton: React.FC<BookmarkButtonProps> = ({
|
|
9
|
-
styleContext,
|
|
10
|
-
theme,
|
|
11
|
-
isInBookmarks,
|
|
12
|
-
onClick
|
|
13
|
-
}) => {
|
|
14
|
-
let classNames: ClassNames = [
|
|
15
|
-
[styles.root, true],
|
|
16
|
-
[styles.isInBookmarks, isInBookmarks],
|
|
17
|
-
[styles[theme], !!theme && !!styles[theme]]
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
if (styleContext) {
|
|
21
|
-
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div data-testid="bookmark-button" className={makeClassName(classNames)}>
|
|
26
|
-
<button
|
|
27
|
-
className={styles.control}
|
|
28
|
-
onClick={(): void => onClick()}
|
|
29
|
-
type="button"
|
|
30
|
-
>
|
|
31
|
-
<SvgSymbol icon="bookmark" size="unset" />
|
|
32
|
-
</button>
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
}
|