Skip to content

Commit 2e69edf

Browse files
authored
Enhance Icon (#70)
1 parent 45eb59e commit 2e69edf

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

src/components/Icon/Icon.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import Styled from './Icon.styled'
1010
export const ICON_TEST_ID = 'ch-design-system-icon'
1111

1212
function Icon({
13-
className,
14-
style,
1513
name,
1614
color,
1715
testId = ICON_TEST_ID,
@@ -20,18 +18,18 @@ function Icon({
2018
marginRight = 0,
2119
marginBottom = 0,
2220
marginLeft = 0,
21+
...props
2322
}: IconProps) {
2423
if (_.isNil(icons[name])) { return null }
2524

2625
return (
2726
<Styled
27+
{...props}
2828
data-testid={testId}
29-
className={className}
3029
color={color}
3130
as={icons[name]}
3231
width={size}
3332
height={size}
34-
style={style}
3533
marginTop={marginTop}
3634
marginRight={marginRight}
3735
marginBottom={marginBottom}

src/components/Icon/Icon.types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
/* External dependencies */
2+
import React from 'react'
3+
14
/* Internal dependencies */
25
import { StylableComponentProps } from '../../types/ComponentProps'
36
import { IconName } from './generated'
47

8+
type SVGProps = React.SVGProps<SVGSVGElement>
9+
510
export enum IconSize {
611
L = 34,
712
Normal = 24,
@@ -18,7 +23,7 @@ export interface IconStyledProps {
1823
marginLeft: number
1924
}
2025

21-
export default interface IconProps extends StylableComponentProps {
26+
export default interface IconProps extends StylableComponentProps, Omit<SVGProps, 'ref'> {
2227
name: IconName
2328
color?: string
2429
size?: IconSize
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react'
2+
3+
function SvgAppPlus(props: React.SVGProps<SVGSVGElement>) {
4+
return (
5+
<svg width="1em" height="1em" viewBox="0 0 24 24" {...props}>
6+
<path
7+
fill="currentColor"
8+
fillRule="evenodd"
9+
d="M12 3v2H6.927A1.927 1.927 0 005 6.927v10.146C5 18.137 5.863 19 6.927 19h10.146A1.927 1.927 0 0019 17.073V12h2v5.073A3.928 3.928 0 0117.073 21H6.927A3.927 3.927 0 013 17.073V6.927A3.928 3.928 0 016.927 3H12zm6 0v3h3v2h-3v3h-2V8h-3V6h3V3h2z"
10+
/>
11+
</svg>
12+
)
13+
}
14+
15+
export default SvgAppPlus

src/components/Icon/generated/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import All from './All'
33
import Android from './Android'
44
import AppCheck from './AppCheck'
5+
import AppPlus from './AppPlus'
56
import AppPush from './AppPush'
67
import Apple from './Apple'
78
import AppsAdd from './AppsAdd'
@@ -328,6 +329,7 @@ const icons = {
328329
'all': All,
329330
'android': Android,
330331
'app-check': AppCheck,
332+
'app-plus': AppPlus,
331333
'app-push': AppPush,
332334
'apple': Apple,
333335
'apps-add': AppsAdd,

0 commit comments

Comments
 (0)