fix: wordmark SVG error

This commit is contained in:
ridemountainpig 2024-10-10 11:37:55 +08:00
parent 61f31b09e9
commit 1108b024a1
2 changed files with 9 additions and 3 deletions

View File

@ -28,6 +28,7 @@
// Props: // Props:
export let svgInfo: iSVG; export let svgInfo: iSVG;
export let searchTerm: string;
let isInFigma = false; let isInFigma = false;
onMount(() => { onMount(() => {
@ -37,6 +38,11 @@
// Wordmark SVG: // Wordmark SVG:
let wordmarkSvg = false; let wordmarkSvg = false;
$: {
if (searchTerm) {
wordmarkSvg = false;
}
}
const insertSVG = async (url?: string) => { const insertSVG = async (url?: string) => {
const content = (await getSvgContent(url)) as string; const content = (await getSvgContent(url)) as string;
@ -59,7 +65,7 @@
class="group flex flex-col items-center justify-center rounded-md border border-neutral-200 p-4 transition-colors duration-100 hover:bg-neutral-100/80 dark:border-neutral-800 dark:hover:bg-neutral-800/20" class="group flex flex-col items-center justify-center rounded-md border border-neutral-200 p-4 transition-colors duration-100 hover:bg-neutral-100/80 dark:border-neutral-800 dark:hover:bg-neutral-800/20"
> >
<!-- Image --> <!-- Image -->
{#if wordmarkSvg == true} {#if wordmarkSvg == true && svgInfo.wordmark !== undefined}
<img <img
class={cn('hidden dark:block', globalImageStyles)} class={cn('hidden dark:block', globalImageStyles)}
src={typeof svgInfo.wordmark !== 'string' src={typeof svgInfo.wordmark !== 'string'
@ -175,7 +181,7 @@
</button> </button>
{/if} {/if}
{#if wordmarkSvg} {#if wordmarkSvg && svgInfo.wordmark !== undefined}
<CopySvg {iconSize} {iconStroke} {svgInfo} isInFigma={false} isWordmarkSvg={true} /> <CopySvg {iconSize} {iconStroke} {svgInfo} isInFigma={false} isWordmarkSvg={true} />
{:else} {:else}
<CopySvg {iconSize} {iconStroke} {svgInfo} isInFigma={false} isWordmarkSvg={false} /> <CopySvg {iconSize} {iconStroke} {svgInfo} isInFigma={false} isWordmarkSvg={false} />

View File

@ -134,7 +134,7 @@
</div> </div>
<Grid> <Grid>
{#each filteredSvgs.slice(0, showAll ? undefined : 30) as svg} {#each filteredSvgs.slice(0, showAll ? undefined : 30) as svg}
<SvgCard svgInfo={svg} /> <SvgCard svgInfo={svg} searchTerm={searchTerm} />
{/each} {/each}
</Grid> </Grid>
{#if filteredSvgs.length > 30 && !showAll} {#if filteredSvgs.length > 30 && !showAll}