Skip to content

Commit 3b1b54b

Browse files
committed
🏷️ Improve Icon component type
1 parent f7c2c0f commit 3b1b54b

File tree

6 files changed

+34
-2
lines changed

6 files changed

+34
-2
lines changed

src/components/Icon/Icon.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { IconProps } from './icon'
33
import iconMap from './map'
44
5-
export let type: IconProps['type'] = ''
5+
export let type: IconProps['type'] = 'alert'
66
export let size: IconProps['size'] = 24
77
export let color: IconProps['color'] = ''
88

src/components/Icon/icon.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
export type IconProps = {
2-
type: string
2+
type: 'alert'
3+
| 'arrow-down'
4+
| 'arrow-left'
5+
| 'arrow-right'
6+
| 'check'
7+
| 'circle-check'
8+
| 'close'
9+
| 'components'
10+
| 'file'
11+
| 'github'
12+
| 'home'
13+
| 'info'
14+
| 'moon'
15+
| 'order'
16+
| 'search'
17+
| 'sun'
18+
| 'warning'
319
size?: number
420
color?: string
521
}

src/components/Icon/map.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import ArrowRight from '../../icons/arrow-right.svg?raw'
55
import Check from '../../icons/check.svg?raw'
66
import CircleCheck from '../../icons/circle-check.svg?raw'
77
import Close from '../../icons/close.svg?raw'
8+
import Components from '../../icons/components.svg?raw'
9+
import File from '../../icons/file.svg?raw'
810
import Github from '../../icons/github.svg?raw'
11+
import Home from '../../icons/home.svg?raw'
912
import Info from '../../icons/info.svg?raw'
1013
import Moon from '../../icons/moon.svg?raw'
1114
import Order from '../../icons/order.svg?raw'
@@ -21,7 +24,10 @@ const iconMap = {
2124
'check': Check,
2225
'circle-check': CircleCheck,
2326
'close': Close,
27+
'components': Components,
28+
'file': File,
2429
'github': Github,
30+
'home': Home,
2531
'info': Info,
2632
'moon': Moon,
2733
'order': Order,

src/icons/components.svg

Lines changed: 3 additions & 0 deletions
Loading

src/icons/file.svg

Lines changed: 3 additions & 0 deletions
Loading

src/icons/home.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)