@meduza/ui-kit-2 0.2.21 → 0.2.23
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/SvgSymbol/SvgSymbol.types.d.ts +1 -1
- package/dist/SvgSymbol/icons.d.ts +5 -0
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +2 -0
- package/dist/constants.d.ts +19 -0
- package/dist/ui-kit-2.cjs.development.js +37 -5
- 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 +37 -5
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +2521 -2518
- package/package.json +1 -1
- package/src/BookmarkButton/BookmarkButton.css +1 -3
- package/src/SvgSymbol/SvgSymbol.module.css +7 -0
- package/src/SvgSymbol/SvgSymbol.types.ts +1 -0
- package/src/SvgSymbol/icons.ts +7 -0
- package/src/Toolbar/Toolbar.module.css +15 -30
- package/src/Toolbar/Toolbar.stories.tsx +16 -10
- package/src/ToolbarButton/ToolbarButton.module.css +19 -5
- package/src/ToolbarButton/ToolbarButton.stories.tsx +1 -0
- package/src/ToolbarButton/ToolbarButton.test.tsx +5 -1
- package/src/ToolbarButton/ToolbarButton.types.ts +2 -0
- package/src/ToolbarButton/index.tsx +17 -2
- package/src/constants.ts +20 -0
package/package.json
CHANGED
package/src/SvgSymbol/icons.ts
CHANGED
|
@@ -195,6 +195,13 @@ export const icons = {
|
|
|
195
195
|
'<path d="M16 20l-7.5-6.333L1 20V1h15z" stroke="currentColor" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
196
196
|
},
|
|
197
197
|
|
|
198
|
+
shareBookmark: {
|
|
199
|
+
width: 8,
|
|
200
|
+
height: 11,
|
|
201
|
+
content:
|
|
202
|
+
'<path clip-rule="evenodd" d="M7 10 4 7l-3 3V1h6v9Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
203
|
+
},
|
|
204
|
+
|
|
198
205
|
receipt: {
|
|
199
206
|
width: 10,
|
|
200
207
|
height: 13,
|
|
@@ -12,36 +12,26 @@
|
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-flow: row wrap;
|
|
14
14
|
|
|
15
|
-
margin: 0 0 0 -
|
|
15
|
+
margin: 0 0 0 -11px;
|
|
16
16
|
padding: 0;
|
|
17
17
|
|
|
18
18
|
list-style: none;
|
|
19
|
-
|
|
20
|
-
@media $landscapeTablet {
|
|
21
|
-
margin: 0 0 0 -15px;
|
|
22
|
-
}
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
.item {
|
|
26
22
|
position: relative;
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
padding-
|
|
31
|
-
padding-left: 10px;
|
|
24
|
+
height: 30px;
|
|
25
|
+
padding-right: 11px;
|
|
26
|
+
padding-left: 11px;
|
|
32
27
|
|
|
33
28
|
cursor: pointer;
|
|
34
29
|
transition: color 250ms ease;
|
|
35
30
|
text-align: center;
|
|
36
31
|
|
|
37
|
-
color: #
|
|
32
|
+
color: #000;
|
|
38
33
|
|
|
39
34
|
line-height: 1;
|
|
40
|
-
|
|
41
|
-
@media $landscapeTablet {
|
|
42
|
-
padding-right: 15px;
|
|
43
|
-
padding-left: 15px;
|
|
44
|
-
}
|
|
45
35
|
}
|
|
46
36
|
|
|
47
37
|
.item:last-child {
|
|
@@ -50,15 +40,15 @@
|
|
|
50
40
|
|
|
51
41
|
.item::before {
|
|
52
42
|
position: absolute;
|
|
53
|
-
top:
|
|
43
|
+
top: 50%;
|
|
54
44
|
left: 0;
|
|
55
45
|
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
width: 2px;
|
|
47
|
+
height: 2px;
|
|
48
|
+
background-color: #000;
|
|
49
|
+
border-radius: 1px;
|
|
58
50
|
content: '';
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
border-left: 1px solid rgba(0, 0, 0, 0.15);
|
|
51
|
+
transform: translateY(-50%) translateY(1px);
|
|
62
52
|
}
|
|
63
53
|
|
|
64
54
|
.item:empty {
|
|
@@ -91,21 +81,16 @@
|
|
|
91
81
|
.game .list,
|
|
92
82
|
.gameSurvey .list {
|
|
93
83
|
justify-content: center;
|
|
84
|
+
max-width: 372px;
|
|
94
85
|
|
|
95
86
|
@media $mobile {
|
|
96
87
|
display: flex;
|
|
88
|
+
max-width: 650px;
|
|
97
89
|
}
|
|
98
90
|
}
|
|
99
91
|
|
|
100
|
-
.game .item:last-child
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
@media $mobile {
|
|
104
|
-
width: auto;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.game .item:last-child::before {
|
|
92
|
+
.game .item:nth-last-child(2)::before,
|
|
93
|
+
.gameSurvey .item:nth-last-child(2)::before {
|
|
109
94
|
content: none;
|
|
110
95
|
|
|
111
96
|
@media $mobile {
|
|
@@ -14,11 +14,21 @@ export default {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const buttons: {
|
|
17
|
+
const buttons: {
|
|
18
|
+
type: ToolbarButtonTypes
|
|
19
|
+
label?: string
|
|
20
|
+
icon?: 'shareBookmark'
|
|
21
|
+
}[] = [
|
|
22
|
+
{
|
|
23
|
+
type: 'tg'
|
|
24
|
+
},
|
|
18
25
|
{
|
|
19
26
|
type: 'fb',
|
|
20
27
|
label: '23,4K'
|
|
21
28
|
},
|
|
29
|
+
{
|
|
30
|
+
type: 'tw'
|
|
31
|
+
},
|
|
22
32
|
{
|
|
23
33
|
type: 'vk',
|
|
24
34
|
label: '481'
|
|
@@ -27,17 +37,11 @@ const buttons: { type: ToolbarButtonTypes; label?: string }[] = [
|
|
|
27
37
|
type: 'ok'
|
|
28
38
|
},
|
|
29
39
|
{
|
|
30
|
-
type: '
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
type: 'tg'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: 'reaction',
|
|
37
|
-
label: 'Связаться с редакцией'
|
|
40
|
+
type: 'bookmark',
|
|
41
|
+
icon: 'shareBookmark'
|
|
38
42
|
},
|
|
39
43
|
{
|
|
40
|
-
type: '
|
|
44
|
+
type: 'reaction'
|
|
41
45
|
}
|
|
42
46
|
]
|
|
43
47
|
|
|
@@ -66,6 +70,8 @@ const Example: React.FC<{ theme?: string }> = ({ theme }) => {
|
|
|
66
70
|
}
|
|
67
71
|
key={`${index}-${button.type}`}
|
|
68
72
|
isActive={button.type === 'bookmark' && bookmark}
|
|
73
|
+
lang="ru"
|
|
74
|
+
icon={button.icon}
|
|
69
75
|
>
|
|
70
76
|
{button.label && button.label}
|
|
71
77
|
</ToolbarButton>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
|
|
10
|
-
color:
|
|
10
|
+
color: #000;
|
|
11
11
|
border-width: 0;
|
|
12
12
|
outline: none;
|
|
13
13
|
background-color: transparent;
|
|
@@ -82,21 +82,35 @@
|
|
|
82
82
|
visibility: hidden;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.icon {
|
|
86
|
+
display: inline-block;
|
|
87
|
+
vertical-align: middle;
|
|
88
|
+
margin-top: -1px;
|
|
89
|
+
padding-right: 5px;
|
|
90
|
+
|
|
91
|
+
@media $landscapeTablet {
|
|
92
|
+
padding-left: 5px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
.text {
|
|
86
97
|
display: inline-block;
|
|
87
98
|
|
|
88
|
-
|
|
99
|
+
vertical-align: middle;
|
|
100
|
+
}
|
|
89
101
|
|
|
102
|
+
.counter {
|
|
103
|
+
color: #8c8c8c;
|
|
104
|
+
display: inline-block;
|
|
90
105
|
vertical-align: middle;
|
|
106
|
+
padding-left: 3px;
|
|
91
107
|
}
|
|
92
108
|
|
|
93
|
-
.
|
|
109
|
+
.counter:empty {
|
|
94
110
|
display: none;
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
.bookmark {
|
|
98
|
-
color: #999;
|
|
99
|
-
|
|
100
114
|
fill: transparent;
|
|
101
115
|
}
|
|
102
116
|
|
|
@@ -10,7 +10,11 @@ describe('Toolbar Button', () => {
|
|
|
10
10
|
|
|
11
11
|
const renderComponent = () =>
|
|
12
12
|
render(
|
|
13
|
-
<ToolbarButton
|
|
13
|
+
<ToolbarButton
|
|
14
|
+
lang="ru"
|
|
15
|
+
type="fb"
|
|
16
|
+
onClick={(): void => alert('Hello Button')}
|
|
17
|
+
>
|
|
14
18
|
42
|
|
15
19
|
</ToolbarButton>
|
|
16
20
|
)
|
|
@@ -13,6 +13,8 @@ export type ToolbarButtonTypes =
|
|
|
13
13
|
export interface ToolbarButtonProps {
|
|
14
14
|
type: ToolbarButtonTypes
|
|
15
15
|
theme?: string
|
|
16
|
+
lang: 'ru' | 'en'
|
|
17
|
+
icon?: 'shareBookmark'
|
|
16
18
|
isActive?: boolean
|
|
17
19
|
onClick: (type: string) => void
|
|
18
20
|
children?: React.ReactNode | JSX.Element[] | JSX.Element
|
|
@@ -5,12 +5,15 @@ import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
|
5
5
|
|
|
6
6
|
import toolbarStyles from '../Toolbar/Toolbar.module.css'
|
|
7
7
|
import styles from './ToolbarButton.module.css'
|
|
8
|
+
import { SocialLabels } from '../constants'
|
|
8
9
|
|
|
9
10
|
export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
10
11
|
children,
|
|
11
12
|
type,
|
|
12
13
|
theme,
|
|
13
14
|
isActive,
|
|
15
|
+
lang = 'ru',
|
|
16
|
+
icon,
|
|
14
17
|
onClick
|
|
15
18
|
}) => {
|
|
16
19
|
const classNames: ClassNames = [
|
|
@@ -20,6 +23,8 @@ export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
|
20
23
|
[styles.isActive, !!isActive]
|
|
21
24
|
]
|
|
22
25
|
|
|
26
|
+
const label = SocialLabels[lang][type]
|
|
27
|
+
|
|
23
28
|
return (
|
|
24
29
|
<li className={toolbarStyles.item}>
|
|
25
30
|
<button
|
|
@@ -28,8 +33,18 @@ export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
|
28
33
|
type="button"
|
|
29
34
|
onClick={(): void => onClick(type)}
|
|
30
35
|
>
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
{icon && (
|
|
37
|
+
<div className={styles.icon}>
|
|
38
|
+
<SvgSymbol size="medium" icon={icon} styleContext="isInToolbar" />
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
<span className={styles.text}>{label}</span>
|
|
42
|
+
{children && (
|
|
43
|
+
<span className={styles.counter}>
|
|
44
|
+
{` `}
|
|
45
|
+
{children}
|
|
46
|
+
</span>
|
|
47
|
+
)}
|
|
33
48
|
</button>
|
|
34
49
|
</li>
|
|
35
50
|
)
|
package/src/constants.ts
CHANGED
|
@@ -22,3 +22,23 @@ export const imageConditionalKeys = {
|
|
|
22
22
|
default: [650, 520, 325],
|
|
23
23
|
narrow: [600, 325]
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
export const SocialLabels = {
|
|
27
|
+
ru: {
|
|
28
|
+
tg: 'Telegram',
|
|
29
|
+
fb: 'Фб',
|
|
30
|
+
vk: 'Вк',
|
|
31
|
+
ok: 'Ок',
|
|
32
|
+
tw: 'Твиттер',
|
|
33
|
+
bookmark: 'В закладки',
|
|
34
|
+
reaction: 'Напишите нам'
|
|
35
|
+
},
|
|
36
|
+
en: {
|
|
37
|
+
tg: 'Telegram',
|
|
38
|
+
fb: 'Fb',
|
|
39
|
+
vk: 'Vk',
|
|
40
|
+
ok: 'Ok',
|
|
41
|
+
tw: 'Twitter',
|
|
42
|
+
bookmark: 'Add to bookmarks'
|
|
43
|
+
}
|
|
44
|
+
}
|