Skip to content

Commit

Permalink
fix(scripts/buildIconsDataset.ts): icon name
Browse files Browse the repository at this point in the history
  • Loading branch information
indaco committed Nov 2, 2023
1 parent 6d3d74b commit 41042ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions scripts/buildIconsDataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@ async function generateIconsDataset(
*/
async function makeIconComponent(outputFolder: string, iconObj: Icon): Promise<void> {
const txt = `<script lang="ts">
import type { IconSize } from '../../../Icon.d.ts';
import type { SVGProps } from '../../../Icon.d.ts';
import IconBase from '../../../IconBase.svelte';
export let name: string = 'zoom-out';
export let altText: string | undefined = undefined;
export let size: IconSize | string | number = 'base';
interface $$Props extends SVGProps {}
export let name: $$Props['name'] = '${iconObj.name}';
export let altText: $$Props['altText'] = undefined;
export let size: $$Props['size'] = 'base';
</script>
<IconBase {name} {altText} {size}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Icon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export type Icon = {
type SVGRestProps = SvelteHTMLElements['svg'];

interface SVGPropsInternal extends SVGRestProps {
name: string;
size: IconSize | string | number;
name?: string;
size?: IconSize | string | number;
altText?: string;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/IconBase.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
interface $$Props extends SVGProps {}
export let name: $$Props['name'];
export let name: $$Props['name'] = undefined;
export let altText: $$Props['altText'] = undefined;
export let size: $$Props['size'] = 'base';
Expand All @@ -20,7 +20,7 @@
let _altText = altText ?? `${name} icon`;
let _size =
size in sizeMap
size && size in sizeMap
? sizeMap[size as unknown as IconSize]
: typeof size === 'number' || typeof size === 'string'
? size
Expand Down

0 comments on commit 41042ae

Please sign in to comment.