@meduza/ui-kit-2 0.2.37 → 0.3.1
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/Button/Button.d.ts +3 -0
- package/dist/Button/Button.types.d.ts +2 -0
- package/dist/Button/ButtonLoader.d.ts +2 -0
- package/dist/Button/index.d.ts +2 -3
- package/dist/SvgSymbol/SvgSymbol.types.d.ts +1 -1
- package/dist/SvgSymbol/icons.d.ts +5 -0
- package/dist/Toolbar/Toolbar.d.ts +3 -0
- package/dist/Toolbar/Toolbar.types.d.ts +3 -0
- package/dist/Toolbar/ToolbarItem.d.ts +3 -0
- package/dist/Toolbar/index.d.ts +2 -3
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +4 -5
- package/dist/Tooltip/Tooltip.d.ts +3 -0
- package/dist/Tooltip/Tooltip.stories.d.ts +10 -0
- package/dist/Tooltip/Tooltip.types.d.ts +8 -0
- package/dist/Tooltip/TooltipFooter.d.ts +3 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/constants.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/ui-kit-2.cjs.development.js +203 -162
- 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 +200 -163
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +3282 -3193
- package/dist/utils/capitalizeFirstLetter.d.ts +1 -0
- package/package.json +1 -1
- package/src/BookmarkButton/BookmarkButton.css +0 -4
- package/src/BookmarkButton/BookmarkButton.module.css +0 -4
- package/src/Button/Button.module.css +13 -0
- package/src/Button/Button.stories.tsx +15 -1
- package/src/Button/Button.tsx +50 -0
- package/src/Button/Button.types.ts +3 -0
- package/src/Button/{loader.tsx → ButtonLoader.tsx} +1 -3
- package/src/Button/index.tsx +2 -48
- package/src/Cover/Cover.module.css +6 -1
- package/src/EmbedBlock/EmbedBlock.test.tsx +2 -6
- package/src/SvgSymbol/SvgSymbol.module.css +4 -0
- package/src/SvgSymbol/SvgSymbol.stories.tsx +1 -1
- package/src/SvgSymbol/SvgSymbol.types.ts +1 -0
- package/src/SvgSymbol/icons.ts +6 -0
- package/src/Toolbar/Toolbar.module.css +0 -5
- package/src/Toolbar/Toolbar.stories.tsx +17 -16
- package/src/Toolbar/Toolbar.tsx +20 -0
- package/src/Toolbar/Toolbar.types.ts +4 -0
- package/src/Toolbar/ToolbarItem.tsx +8 -0
- package/src/Toolbar/index.tsx +2 -20
- package/src/ToolbarButton/ToolbarButton.module.css +0 -14
- package/src/ToolbarButton/ToolbarButton.types.ts +4 -5
- package/src/ToolbarButton/index.tsx +14 -23
- package/src/Tooltip/Tooltip.module.css +91 -0
- package/src/Tooltip/Tooltip.stories.module.css +7 -0
- package/src/Tooltip/Tooltip.stories.tsx +69 -0
- package/src/Tooltip/Tooltip.test.tsx +16 -0
- package/src/Tooltip/Tooltip.tsx +24 -0
- package/src/Tooltip/Tooltip.types.ts +8 -0
- package/src/Tooltip/TooltipFooter.tsx +7 -0
- package/src/Tooltip/index.tsx +2 -0
- package/src/constants.ts +2 -0
- package/src/index.tsx +1 -0
- package/src/utils/capitalizeFirstLetter.ts +2 -0
- package/dist/Button/loader.d.ts +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const capitalizeFirstLetter: (string: string) => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { Button } from './'
|
|
3
3
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
-
import { ButtonStates, ButtonThemes } from './Button.types'
|
|
4
|
+
import { ButtonAppearance, ButtonStates, ButtonThemes } from './Button.types'
|
|
5
5
|
|
|
6
6
|
import styles from './Button.stories.module.css'
|
|
7
7
|
|
|
@@ -26,6 +26,7 @@ const buttons: { theme: ButtonThemes; title: string }[] = [
|
|
|
26
26
|
const Example: React.FC = () => {
|
|
27
27
|
const [state, setState] = useState<ButtonStates>('isDefault')
|
|
28
28
|
const [disabled, setDisabled] = useState(false)
|
|
29
|
+
const [appearance, setAppearance] = useState<ButtonAppearance>('isClassic')
|
|
29
30
|
|
|
30
31
|
const handleLoaderClick = () => {
|
|
31
32
|
setState(state === 'isLoading' ? 'isDefault' : 'isLoading')
|
|
@@ -33,6 +34,9 @@ const Example: React.FC = () => {
|
|
|
33
34
|
const handleDisabledClick = () => {
|
|
34
35
|
setDisabled(!disabled)
|
|
35
36
|
}
|
|
37
|
+
const handleAppearanceClick = () => {
|
|
38
|
+
setAppearance((prev) => (prev === 'isClassic' ? 'isFancy' : 'isClassic'))
|
|
39
|
+
}
|
|
36
40
|
|
|
37
41
|
return (
|
|
38
42
|
<>
|
|
@@ -55,6 +59,15 @@ const Example: React.FC = () => {
|
|
|
55
59
|
Toggle Disabled
|
|
56
60
|
</Button>
|
|
57
61
|
</div>
|
|
62
|
+
<div className={styles.control}>
|
|
63
|
+
<Button
|
|
64
|
+
onClick={() => handleAppearanceClick()}
|
|
65
|
+
theme="gray"
|
|
66
|
+
size="default"
|
|
67
|
+
>
|
|
68
|
+
Toggle Style
|
|
69
|
+
</Button>
|
|
70
|
+
</div>
|
|
58
71
|
</div>
|
|
59
72
|
|
|
60
73
|
<div className={styles.block}>
|
|
@@ -64,6 +77,7 @@ const Example: React.FC = () => {
|
|
|
64
77
|
theme={item.theme}
|
|
65
78
|
state={state}
|
|
66
79
|
disabled={disabled}
|
|
80
|
+
appearance={appearance}
|
|
67
81
|
size="default"
|
|
68
82
|
>
|
|
69
83
|
{item.title}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { FC } from 'react'
|
|
2
|
+
import { makeClassName } from '../utils/makeClassName'
|
|
3
|
+
import { ButtonLoader } from './ButtonLoader'
|
|
4
|
+
import { ButtonProps } from './Button.types'
|
|
5
|
+
|
|
6
|
+
import styles from './Button.module.css'
|
|
7
|
+
|
|
8
|
+
export const Button: FC<ButtonProps> = ({
|
|
9
|
+
theme = 'gold',
|
|
10
|
+
size = 'default',
|
|
11
|
+
state = 'isDefault',
|
|
12
|
+
styleContext = 'isInToolbar',
|
|
13
|
+
appearance,
|
|
14
|
+
disabled = false,
|
|
15
|
+
onClick,
|
|
16
|
+
children
|
|
17
|
+
}) => {
|
|
18
|
+
const handleClick = (): void => {
|
|
19
|
+
if (disabled || !onClick) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onClick()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
data-testid="button"
|
|
29
|
+
className={makeClassName([
|
|
30
|
+
[styles.root, true],
|
|
31
|
+
[styles[size], !!size],
|
|
32
|
+
[styles[theme], !!theme],
|
|
33
|
+
[styles[appearance], !!appearance],
|
|
34
|
+
[styles[state], !!state && !!styles[state]],
|
|
35
|
+
[styles[styleContext], !!styleContext]
|
|
36
|
+
])}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
onClick={handleClick}
|
|
39
|
+
type="button"
|
|
40
|
+
>
|
|
41
|
+
{state === 'isLoading' ? (
|
|
42
|
+
<span className={styles.loader}>
|
|
43
|
+
<ButtonLoader />
|
|
44
|
+
</span>
|
|
45
|
+
) : (
|
|
46
|
+
children
|
|
47
|
+
)}
|
|
48
|
+
</button>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -14,8 +14,11 @@ export type ButtonStates = 'isLoading' | 'isDefault'
|
|
|
14
14
|
export type ButtonSizes = 'auto' | 'default'
|
|
15
15
|
export type ButtonStyleContexts = 'isInToolbar' | 'isInSpoiler' | 'isInDropdown'
|
|
16
16
|
|
|
17
|
+
export type ButtonAppearance = 'isFancy' | 'isClassic'
|
|
18
|
+
|
|
17
19
|
export interface ButtonProps {
|
|
18
20
|
theme?: ButtonThemes
|
|
21
|
+
appearance?: ButtonAppearance
|
|
19
22
|
size?: ButtonSizes
|
|
20
23
|
state?: ButtonStates
|
|
21
24
|
styleContext?: ButtonStyleContexts
|
package/src/Button/index.tsx
CHANGED
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import Loader from './loader'
|
|
4
|
-
import { ButtonProps } from './Button.types'
|
|
5
|
-
|
|
6
|
-
import styles from './Button.module.css'
|
|
7
|
-
|
|
8
|
-
export const Button: FC<ButtonProps> = ({
|
|
9
|
-
theme = 'gold',
|
|
10
|
-
size = 'default',
|
|
11
|
-
state = 'isDefault',
|
|
12
|
-
styleContext = 'isInToolbar',
|
|
13
|
-
disabled = false,
|
|
14
|
-
onClick,
|
|
15
|
-
children
|
|
16
|
-
}) => {
|
|
17
|
-
const handleClick = (): void => {
|
|
18
|
-
if (disabled || !onClick) {
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
onClick()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<button
|
|
27
|
-
data-testid="button"
|
|
28
|
-
className={makeClassName([
|
|
29
|
-
[styles.root, true],
|
|
30
|
-
[styles[size], !!size],
|
|
31
|
-
[styles[theme], !!theme],
|
|
32
|
-
[styles[state], !!state && !!styles[state]],
|
|
33
|
-
[styles[styleContext], !!styleContext]
|
|
34
|
-
])}
|
|
35
|
-
disabled={disabled}
|
|
36
|
-
onClick={handleClick}
|
|
37
|
-
type="button"
|
|
38
|
-
>
|
|
39
|
-
{state === 'isLoading' ? (
|
|
40
|
-
<span className={styles.loader}>
|
|
41
|
-
<Loader />
|
|
42
|
-
</span>
|
|
43
|
-
) : (
|
|
44
|
-
children
|
|
45
|
-
)}
|
|
46
|
-
</button>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
1
|
+
export { Button } from './Button'
|
|
2
|
+
export { ButtonLoader } from './ButtonLoader'
|
|
@@ -76,8 +76,13 @@
|
|
|
76
76
|
box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.15);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
.isInDynamicBlock {
|
|
80
|
+
border-radius: 8px;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
.isInDynamicBlock .body {
|
|
80
|
-
padding: 0 12px 12px
|
|
85
|
+
padding: 0 12px 12px;
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
.isInDynamicBlock::after {
|
|
@@ -3,8 +3,6 @@ import { render } from '@testing-library/react'
|
|
|
3
3
|
import { EmbedBlockContainer } from './'
|
|
4
4
|
import { EmbedBlockProps } from './EmbedBlock.types'
|
|
5
5
|
|
|
6
|
-
import styles from './EmbedBlock.module.css'
|
|
7
|
-
|
|
8
6
|
import mock from './mock.json'
|
|
9
7
|
import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils'
|
|
10
8
|
|
|
@@ -23,11 +21,9 @@ describe('Embed Block', () => {
|
|
|
23
21
|
)
|
|
24
22
|
|
|
25
23
|
it('should have root style', () => {
|
|
26
|
-
const {
|
|
24
|
+
const { container } = renderComponent()
|
|
27
25
|
mockAllIsIntersecting(true)
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
expect(embedBlock).toHaveClass(styles.root)
|
|
27
|
+
expect(container).toBeInTheDocument()
|
|
32
28
|
})
|
|
33
29
|
})
|
package/src/SvgSymbol/icons.ts
CHANGED
|
@@ -220,5 +220,11 @@ export const icons = {
|
|
|
220
220
|
height: 15,
|
|
221
221
|
content:
|
|
222
222
|
'<g fill-rule="nonzero"><path d="M4.978 4.354a.5.5 0 01-.332.624c-1.197.367-2.064 1.527-2.14 2.897l-.005.167a.749.749 0 01.999.708v3a.75.75 0 01-1.458.248L2 12a1 1 0 01-1-1v-1a1 1 0 01.5-.866V8.072c0-1.886 1.172-3.535 2.854-4.05a.5.5 0 01.624.332zM10 7a.5.5 0 01.492.41l.008.09.001 1.634a1 1 0 01.492.745L11 10v1a1 1 0 01-.883.993L10 12l-.042-.002a.75.75 0 01-1.451-.146L8.5 11.75v-3a.75.75 0 011.001-.707L9.5 7.5l.008-.09A.5.5 0 0110 7z" fill="currentColor" /><path d="M11.585 1.194a.513.513 0 01.855.56l-.051.077-3.163 3.975a.514.514 0 01-.73.075l-.068-.069-1.812-2.208a.512.512 0 01.729-.716l.065.066 1.409 1.718 2.766-3.478z" fill="#6EAC65" /></g>'
|
|
223
|
+
},
|
|
224
|
+
magic: {
|
|
225
|
+
width: 15,
|
|
226
|
+
height: 15,
|
|
227
|
+
content:
|
|
228
|
+
'<g fill-rule="evenodd" clip-rule="evenodd"> <path d="M7.804.4a.6.6 0 0 1 .6.6v2.035a.6.6 0 0 1-1.2 0V1a.6.6 0 0 1 .6-.6ZM7.804 10.577a.6.6 0 0 1 .6.6v2.035a.6.6 0 1 1-1.2 0v-2.035a.6.6 0 0 1 .6-.6ZM14.636 7.106a.6.6 0 0 1-.6.6h-2.078a.6.6 0 1 1 0-1.2h2.078a.6.6 0 0 1 .6.6ZM4.25 7.106a.6.6 0 0 1-.6.6H1.573a.6.6 0 0 1 0-1.2H3.65a.6.6 0 0 1 .6.6ZM12.639 2.37a.585.585 0 0 1 0 .84l-1.442 1.412a.615.615 0 0 1-.857 0 .585.585 0 0 1 0-.84l1.442-1.412a.615.615 0 0 1 .857 0ZM12.639 11.843a.615.615 0 0 1-.857 0L10.34 10.43a.585.585 0 0 1 0-.84.615.615 0 0 1 .857 0l1.442 1.413a.585.585 0 0 1 0 .84ZM5.269 4.621a.615.615 0 0 1-.858 0L2.97 3.208a.585.585 0 0 1 0-.84.615.615 0 0 1 .858 0l1.442 1.413a.585.585 0 0 1 0 .84ZM8.926 6.074a.6.6 0 0 1 0 .849l-.863.863-.849-.849.863-.863a.6.6 0 0 1 .849 0ZM7.348 8.5l-5.924 5.924a.6.6 0 1 1-.848-.848L6.5 7.652l.848.848Z"/> </g>'
|
|
223
229
|
}
|
|
224
230
|
}
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
padding-right: 17px;
|
|
38
38
|
padding-left: 17px;
|
|
39
39
|
|
|
40
|
-
cursor: pointer;
|
|
41
40
|
transition: color 250ms ease;
|
|
42
41
|
text-align: center;
|
|
43
42
|
|
|
@@ -125,7 +124,3 @@
|
|
|
125
124
|
.dark::before {
|
|
126
125
|
background-color: #4f4f4f;
|
|
127
126
|
}
|
|
128
|
-
|
|
129
|
-
[data-context='prodano'] .root {
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { Toolbar } from './'
|
|
2
|
+
import { Toolbar, ToolbarItem } from './'
|
|
3
3
|
import { ToolbarButton } from '../ToolbarButton'
|
|
4
4
|
import { ToolbarButtonTypes } from '../ToolbarButton/ToolbarButton.types'
|
|
5
5
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
@@ -52,21 +52,22 @@ const Example: React.FC<{ theme?: string }> = ({ theme }) => {
|
|
|
52
52
|
<div className={styles.root}>
|
|
53
53
|
<Toolbar styleContext={[theme]}>
|
|
54
54
|
{buttons.map((button, index) => (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
<ToolbarItem key={`${index}-${button.type}`}>
|
|
56
|
+
<ToolbarButton
|
|
57
|
+
type={button.type}
|
|
58
|
+
theme={theme}
|
|
59
|
+
onClick={(): void =>
|
|
60
|
+
button.type === 'bookmark'
|
|
61
|
+
? handleBookmark()
|
|
62
|
+
: handleButton(button.type)
|
|
63
|
+
}
|
|
64
|
+
isActive={button.type === 'bookmark' && bookmark}
|
|
65
|
+
lang="ru"
|
|
66
|
+
icon={button.icon}
|
|
67
|
+
>
|
|
68
|
+
{button.label && button.label}
|
|
69
|
+
</ToolbarButton>
|
|
70
|
+
</ToolbarItem>
|
|
70
71
|
))}
|
|
71
72
|
</Toolbar>
|
|
72
73
|
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ToolbarProps } from './Toolbar.types'
|
|
3
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
4
|
+
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
|
+
|
|
6
|
+
import styles from './Toolbar.module.css'
|
|
7
|
+
|
|
8
|
+
export const Toolbar: React.FC<ToolbarProps> = ({ children, styleContext }) => {
|
|
9
|
+
let classNames: ClassNames = [[styles.root, true]]
|
|
10
|
+
|
|
11
|
+
if (styleContext) {
|
|
12
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div data-testid="toolbar" className={makeClassName(classNames)}>
|
|
17
|
+
<ul className={styles.list}>{children}</ul>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ToolbarItemProps } from './Toolbar.types'
|
|
3
|
+
|
|
4
|
+
import styles from '../Toolbar/Toolbar.module.css'
|
|
5
|
+
|
|
6
|
+
export const ToolbarItem: React.FC<ToolbarItemProps> = ({ children }) => {
|
|
7
|
+
return <li className={styles.item}>{children}</li>
|
|
8
|
+
}
|
package/src/Toolbar/index.tsx
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import makeStyleContext from '../utils/makeStyleContext'
|
|
4
|
-
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
|
-
|
|
6
|
-
import styles from './Toolbar.module.css'
|
|
7
|
-
|
|
8
|
-
export const Toolbar: React.FC<ToolbarProps> = ({ children, styleContext }) => {
|
|
9
|
-
let classNames: ClassNames = [[styles.root, true]]
|
|
10
|
-
|
|
11
|
-
if (styleContext) {
|
|
12
|
-
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div data-testid="toolbar" className={makeClassName(classNames)}>
|
|
17
|
-
<ul className={styles.list}>{children}</ul>
|
|
18
|
-
</div>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
1
|
+
export { ToolbarItem } from './ToolbarItem'
|
|
2
|
+
export { Toolbar } from './Toolbar'
|
|
@@ -100,20 +100,6 @@
|
|
|
100
100
|
vertical-align: middle;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
.counter {
|
|
104
|
-
display: inline-block;
|
|
105
|
-
|
|
106
|
-
padding-left: 3px;
|
|
107
|
-
|
|
108
|
-
vertical-align: middle;
|
|
109
|
-
|
|
110
|
-
color: #8c8c8c;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.counter:empty {
|
|
114
|
-
display: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
103
|
.bookmark {
|
|
118
104
|
fill: transparent;
|
|
119
105
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
1
|
export type ToolbarButtonTypes =
|
|
4
2
|
| 'vk'
|
|
5
3
|
| 'fb'
|
|
@@ -9,14 +7,15 @@ export type ToolbarButtonTypes =
|
|
|
9
7
|
| 'reaction'
|
|
10
8
|
| 'pdf'
|
|
11
9
|
| 'bookmark'
|
|
10
|
+
| 'unblock'
|
|
12
11
|
| 'cross'
|
|
13
12
|
|
|
14
13
|
export interface ToolbarButtonProps {
|
|
15
14
|
type: ToolbarButtonTypes
|
|
16
15
|
theme?: string
|
|
17
|
-
lang
|
|
16
|
+
lang?: 'ru' | 'en'
|
|
17
|
+
text?: string
|
|
18
18
|
icon?: 'shareBookmark'
|
|
19
19
|
isActive?: boolean
|
|
20
|
-
onClick: (type: string) => void
|
|
21
|
-
children?: React.ReactNode | JSX.Element[] | JSX.Element
|
|
20
|
+
onClick: (event, type: string) => void
|
|
22
21
|
}
|
|
@@ -3,16 +3,15 @@ import { ToolbarButtonProps } from './ToolbarButton.types'
|
|
|
3
3
|
import { SvgSymbol } from '../SvgSymbol/'
|
|
4
4
|
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
5
5
|
|
|
6
|
-
import toolbarStyles from '../Toolbar/Toolbar.module.css'
|
|
7
6
|
import styles from './ToolbarButton.module.css'
|
|
8
7
|
import { SocialLabels } from '../constants'
|
|
9
8
|
|
|
10
9
|
export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
11
|
-
children,
|
|
12
10
|
type,
|
|
13
11
|
theme,
|
|
14
12
|
isActive,
|
|
15
13
|
lang = 'ru',
|
|
14
|
+
text,
|
|
16
15
|
icon,
|
|
17
16
|
onClick
|
|
18
17
|
}) => {
|
|
@@ -26,26 +25,18 @@ export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
|
|
|
26
25
|
const label = SocialLabels[lang][type]
|
|
27
26
|
|
|
28
27
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{icon
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{children && (
|
|
43
|
-
<span className={styles.counter}>
|
|
44
|
-
{` `}
|
|
45
|
-
{children}
|
|
46
|
-
</span>
|
|
47
|
-
)}
|
|
48
|
-
</button>
|
|
49
|
-
</li>
|
|
28
|
+
<button
|
|
29
|
+
data-testid="toolbar-button"
|
|
30
|
+
className={makeClassName(classNames)}
|
|
31
|
+
type="button"
|
|
32
|
+
onClick={(event): void => onClick(event, type)}
|
|
33
|
+
>
|
|
34
|
+
{icon && (
|
|
35
|
+
<div className={styles.icon}>
|
|
36
|
+
<SvgSymbol size="medium" icon={icon} styleContext="isInToolbar" />
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
<span className={styles.text}>{text || label}</span>
|
|
40
|
+
</button>
|
|
50
41
|
)
|
|
51
42
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: 20px;
|
|
8
|
+
|
|
9
|
+
color: #fff;
|
|
10
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
11
|
+
border-radius: 16px;
|
|
12
|
+
background: #4761e0;
|
|
13
|
+
box-shadow: 0 37px 37px rgba(0, 0, 0, 0.09), 0 9px 20px rgba(0, 0, 0, 0.1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.root::after {
|
|
17
|
+
position: absolute;
|
|
18
|
+
|
|
19
|
+
width: 16px;
|
|
20
|
+
height: 8px;
|
|
21
|
+
|
|
22
|
+
content: '';
|
|
23
|
+
|
|
24
|
+
background-image: url("data:image/svg+xml,%3Csvg width='16' height='8' viewBox='0 0 16 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m8 0 8 8H0l8-8Z' fill='%234057CA'/%3E%3Cpath d='M8 1s3.89 3.876 7 7H1l7-7Z' fill='%234761E0'/%3E%3C/svg%3E");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.isCenterBottom::after {
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 50%;
|
|
30
|
+
transform: translate(-50%, 100%) rotate(180deg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.isLeftBottom::after {
|
|
34
|
+
bottom: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
transform: translate(200%, 100%) rotate(180deg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.isCenterTop::after {
|
|
40
|
+
top: 0;
|
|
41
|
+
left: 50%;
|
|
42
|
+
|
|
43
|
+
transform: translate(-50%, -100%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.isLeftTop::after {
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
transform: translate(200%, -100%);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.body {
|
|
53
|
+
font-family: $secondaryFont;
|
|
54
|
+
font-size: 16px;
|
|
55
|
+
line-height: 22px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.body h3 {
|
|
59
|
+
margin: 0 0 6px;
|
|
60
|
+
|
|
61
|
+
font-size: inherit;
|
|
62
|
+
font-weight: 700;
|
|
63
|
+
line-height: inherit;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.body p {
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.body p + p {
|
|
71
|
+
margin-top: 6px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.body a {
|
|
75
|
+
color: inherit;
|
|
76
|
+
text-decoration: none;
|
|
77
|
+
box-shadow: inset 0 -1px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.body a:hover {
|
|
81
|
+
opacity: 0.75;
|
|
82
|
+
color: inherit;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.footer {
|
|
86
|
+
margin-top: 10px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.footer button {
|
|
90
|
+
color: #4761e0;
|
|
91
|
+
}
|