-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from indaco/fix-42
Fix 42
- Loading branch information
Showing
12 changed files
with
198 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
main { | ||
padding: 1rem 0.5rem; | ||
} | ||
|
||
.header { | ||
text-align: center; | ||
} | ||
|
||
.roundedColor { | ||
padding: 4px; | ||
background-color: yellow; | ||
border: 1px solid #d1d5db; | ||
border-radius: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Nodes } from 'hast-util-to-html/lib/index.js'; | ||
import type { SvelteHTMLElements } from 'svelte/elements'; | ||
|
||
type IconSizeMap = { | ||
xs: string; | ||
sm: string; | ||
base: string; | ||
lg: string; | ||
xl: string; | ||
}; | ||
|
||
type IconSize = keyof IconSizeMap; | ||
|
||
export type IconVariant = 'regular' | 'solid'; | ||
|
||
export type Icon = { | ||
svgFile: string; | ||
name: string; | ||
variant: IconVariant; | ||
data?: Nodes; | ||
}; | ||
|
||
type SVGRestProps = SvelteHTMLElements['svg']; | ||
|
||
interface SVGPropsInternal extends SVGRestProps { | ||
name: string; | ||
size: IconSize | string | number; | ||
altText?: string; | ||
} | ||
|
||
export type SVGProps = SVGPropsInternal & SvelteHTMLElements['svg']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script lang="ts"> | ||
import type { IconSize, IconSizeMap, SVGProps } from './Icon.d.ts'; | ||
const sizeMap = { | ||
xs: '1em', | ||
sm: '1.25em', | ||
base: '1.5em', | ||
lg: '1.75em', | ||
xl: '2em' | ||
} satisfies IconSizeMap; | ||
interface $$Props extends SVGProps {} | ||
export let name: $$Props['name']; | ||
export let altText: $$Props['altText'] = undefined; | ||
export let size: $$Props['size'] = 'base'; | ||
const defaultSize = sizeMap['base']; | ||
let _altText = altText ?? `${name} icon`; | ||
let _size = | ||
size in sizeMap | ||
? sizeMap[size as unknown as IconSize] | ||
: typeof size === 'number' || typeof size === 'string' | ||
? size | ||
: defaultSize; | ||
</script> | ||
|
||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={_size} | ||
height={_size} | ||
fill="none" | ||
stroke-width="1.5" | ||
viewBox="0 0 24 24" | ||
aria-hidden="true" | ||
aria-labelledby={_altText} | ||
{...$$restProps} | ||
on:click | ||
on:dblclick | ||
on:keydown | ||
on:keyup | ||
on:mouseenter | ||
on:mouseleave | ||
> | ||
<slot /> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
import '../app.css'; | ||
</script> | ||
|
||
<main> | ||
<slot /> | ||
</main> |
Oops, something went wrong.