-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use icon-loader from ui packages
- Loading branch information
1 parent
1f4b78a
commit c2a53ab
Showing
24 changed files
with
88 additions
and
243 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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Iconify } from "./Iconify"; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { Iconify } from "./iconify"; | ||
export { type IconifyProps } from "./types"; | ||
export { type IconifyProps } from "@oktaytest/icon-loader"; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,20 @@ | ||
<script lang="ts"> | ||
import { parseSync, stringify } from "svgson"; | ||
import { fallbackIcon } from "@oktaytest/core/constants"; | ||
// @ts-ignore | ||
import icons from "oktay"; | ||
import type { Icon } from "@oktaytest/core"; | ||
import { getIconDetails } from "@oktaytest/icon-loader"; | ||
export let name: string; | ||
export let size: number | undefined = undefined; | ||
export let color: string | undefined = undefined; | ||
$: icon = icons[name] || fallbackIcon; | ||
if (!icons[name]) { | ||
console.warn( | ||
`[Iconify] The icon "${name}" is missing from the configuration. To resolve this, ensure it is added to the 'icons' array within the Iconify plugin's configuration.` | ||
); | ||
} | ||
$: parsed = parseSync(icon.svg); | ||
$: children = parsed.children.map((child) => { | ||
if (child.name !== "path" || !child.attributes.fill || !color) return child; | ||
child.attributes.fill = color; | ||
return child; | ||
}); | ||
$: html = stringify(children as any); | ||
$: ratio = icon.width / icon.height; | ||
$: height = size ? Number(size) : icon.height; | ||
$: width = size ? Number(size) * ratio : icon.width; | ||
// @ts-ignore | ||
import icons from "oktay"; | ||
$: attributes = { | ||
...parsed.attributes, | ||
width, | ||
height, | ||
}; | ||
$: details = getIconDetails( | ||
{ name, color, size }, | ||
icons as Record<string, Icon> | ||
); | ||
</script> | ||
|
||
<svg {...attributes}> | ||
{@html html} | ||
<svg {...details.attributes}> | ||
{@html details.innerHtml} | ||
</svg> |
Oops, something went wrong.