Merge pull request #424 from ridemountainpig/fix-wordmark
Some checks failed
🧑‍🚀 Check / 📦 SVGs Size (push) Has been cancelled
🧑‍🚀 Check / ⚡ Testing with Vitest (push) Has been cancelled
🧑‍🚀 Check / 🛠️ Build app (push) Has been cancelled
🚀 Deploy / API - Cloudflare Workers (push) Has been cancelled

⚙️ Fix wordmark SVG error
This commit is contained in:
Pablo Hdez 2024-10-10 09:05:28 +01:00 committed by GitHub
commit 302dfd62ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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}