@meduza/ui-kit-2 0.1.53 → 0.1.54

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.53",
2
+ "version": "0.1.54",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -1,4 +1,4 @@
1
- import React, { Children } from 'react'
1
+ import React from 'react'
2
2
  import { ToolbarProps } from './Toolbar.types'
3
3
  import makeStyleContext from '../utils/makeStyleContext'
4
4
  import { makeClassName, ClassNames } from '../utils/makeClassName'
@@ -12,16 +12,9 @@ export const Toolbar: React.FC<ToolbarProps> = ({ children, styleContext }) => {
12
12
  classNames = makeStyleContext(classNames, styleContext, styles)
13
13
  }
14
14
 
15
- const renderItems = (): JSX.Element[] =>
16
- Children.map(children, (item: JSX.Element, index) => (
17
- <li className={styles.item} key={`${index}-${item.props.type}`}>
18
- {React.cloneElement(item)}
19
- </li>
20
- ))
21
-
22
15
  return (
23
16
  <div data-testid="toolbar" className={makeClassName(classNames)}>
24
- <ul className={styles.list}>{renderItems()}</ul>
17
+ <ul className={styles.list}>{children}</ul>
25
18
  </div>
26
19
  )
27
20
  }
@@ -3,6 +3,7 @@ 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'
6
7
  import styles from './ToolbarButton.module.css'
7
8
 
8
9
  export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
@@ -20,14 +21,16 @@ export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
20
21
  ]
21
22
 
22
23
  return (
23
- <button
24
- data-testid="toolbar-button"
25
- className={makeClassName(classNames)}
26
- type="button"
27
- onClick={(): void => onClick(type)}
28
- >
29
- <SvgSymbol size="medium" icon={type} styleContext="isInToolbar" />
30
- {children && <span className={styles.text}>{children}</span>}
31
- </button>
24
+ <li className={toolbarStyles.item}>
25
+ <button
26
+ data-testid="toolbar-button"
27
+ className={makeClassName(classNames)}
28
+ type="button"
29
+ onClick={(): void => onClick(type)}
30
+ >
31
+ <SvgSymbol size="medium" icon={type} styleContext="isInToolbar" />
32
+ {children && <span className={styles.text}>{children}</span>}
33
+ </button>
34
+ </li>
32
35
  )
33
36
  }