Skip to content

Commit

Permalink
🏷️ Improve Icon component type
Browse files Browse the repository at this point in the history
  • Loading branch information
Frontendland committed Sep 28, 2024
1 parent f7c2c0f commit 3b1b54b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { IconProps } from './icon'
import iconMap from './map'
export let type: IconProps['type'] = ''
export let type: IconProps['type'] = 'alert'
export let size: IconProps['size'] = 24
export let color: IconProps['color'] = ''
Expand Down
18 changes: 17 additions & 1 deletion src/components/Icon/icon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
export type IconProps = {
type: string
type: 'alert'
| 'arrow-down'
| 'arrow-left'
| 'arrow-right'
| 'check'
| 'circle-check'
| 'close'
| 'components'
| 'file'
| 'github'
| 'home'
| 'info'
| 'moon'
| 'order'
| 'search'
| 'sun'
| 'warning'
size?: number
color?: string
}
6 changes: 6 additions & 0 deletions src/components/Icon/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import ArrowRight from '../../icons/arrow-right.svg?raw'
import Check from '../../icons/check.svg?raw'
import CircleCheck from '../../icons/circle-check.svg?raw'
import Close from '../../icons/close.svg?raw'
import Components from '../../icons/components.svg?raw'
import File from '../../icons/file.svg?raw'
import Github from '../../icons/github.svg?raw'
import Home from '../../icons/home.svg?raw'
import Info from '../../icons/info.svg?raw'
import Moon from '../../icons/moon.svg?raw'
import Order from '../../icons/order.svg?raw'
Expand All @@ -21,7 +24,10 @@ const iconMap = {
'check': Check,
'circle-check': CircleCheck,
'close': Close,
'components': Components,
'file': File,
'github': Github,
'home': Home,
'info': Info,
'moon': Moon,
'order': Order,
Expand Down
3 changes: 3 additions & 0 deletions src/icons/components.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/icons/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/icons/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3b1b54b

Please sign in to comment.