@meduza/ui-kit-2 0.2.20 → 0.2.22
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 +42 -10
- 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 +42 -10
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +3446 -3437
- package/package.json +1 -1
- package/src/AnnouncementInText/AnnouncementInText.module.css +4 -0
- package/src/AnnouncementInText/index.tsx +7 -5
- 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 +7 -18
- 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
|
@@ -21,17 +21,18 @@ export const AnnouncementInText: React.FC<AnnouncementInTextProps> = ({
|
|
|
21
21
|
const data = {
|
|
22
22
|
ru: {
|
|
23
23
|
title:
|
|
24
|
-
'
|
|
24
|
+
'«Медуза» заблокирована в России. Мы были к этому готовы — и продолжаем работать. Несмотря ни на что',
|
|
25
25
|
text:
|
|
26
|
-
'
|
|
26
|
+
'<p>Нам нужна ваша помощь как никогда. Прямо сейчас. Дальше всем нам будет еще труднее. Мы независимое издание и работаем только в интересах читателей.</p>',
|
|
27
27
|
button: 'Хочу помочь',
|
|
28
28
|
href: 'https://mdza.io/yiNxPZ7Bs-k'
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
en: {
|
|
32
|
-
title:
|
|
32
|
+
title:
|
|
33
|
+
'Meduza has been blocked in Russia. We were ready for this and our work continues, no matter what, but we need your support like never before. ',
|
|
33
34
|
text:
|
|
34
|
-
'We
|
|
35
|
+
'<p>We need it now. Tomorrow could be too late. We are an independent publication, and we work only in the interests of our readers. Many of our readers in Russia can no longer contribute, so we turn to you, our audience around the world.</p>',
|
|
35
36
|
button: 'I want to help',
|
|
36
37
|
href: 'https://support.meduza.io/en'
|
|
37
38
|
}
|
|
@@ -49,7 +50,8 @@ export const AnnouncementInText: React.FC<AnnouncementInTextProps> = ({
|
|
|
49
50
|
className={styles.title}
|
|
50
51
|
dangerouslySetInnerHTML={{ __html: localeData.title }}
|
|
51
52
|
/>
|
|
52
|
-
|
|
53
|
+
|
|
54
|
+
<div dangerouslySetInnerHTML={{ __html: localeData.text }} />
|
|
53
55
|
</div>
|
|
54
56
|
|
|
55
57
|
<div className={styles.footer}>
|
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,14 +12,10 @@
|
|
|
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 {
|
|
@@ -27,8 +23,8 @@
|
|
|
27
23
|
|
|
28
24
|
min-width: 42px;
|
|
29
25
|
height: 32px;
|
|
30
|
-
padding-right:
|
|
31
|
-
padding-left:
|
|
26
|
+
padding-right: 11px;
|
|
27
|
+
padding-left: 11px;
|
|
32
28
|
|
|
33
29
|
cursor: pointer;
|
|
34
30
|
transition: color 250ms ease;
|
|
@@ -37,11 +33,6 @@
|
|
|
37
33
|
color: #808080;
|
|
38
34
|
|
|
39
35
|
line-height: 1;
|
|
40
|
-
|
|
41
|
-
@media $landscapeTablet {
|
|
42
|
-
padding-right: 15px;
|
|
43
|
-
padding-left: 15px;
|
|
44
|
-
}
|
|
45
36
|
}
|
|
46
37
|
|
|
47
38
|
.item:last-child {
|
|
@@ -50,15 +41,13 @@
|
|
|
50
41
|
|
|
51
42
|
.item::before {
|
|
52
43
|
position: absolute;
|
|
53
|
-
top:
|
|
44
|
+
top: 50%;
|
|
54
45
|
left: 0;
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
content: '';
|
|
59
|
-
vertical-align: middle;
|
|
47
|
+
content: '·';
|
|
48
|
+
transform: translateY(-50%);
|
|
60
49
|
|
|
61
|
-
|
|
50
|
+
font-size: 14px;
|
|
62
51
|
}
|
|
63
52
|
|
|
64
53
|
.item:empty {
|
|
@@ -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
|
+
}
|