Skip to content

Commit

Permalink
⚙️ Use getReactComponentCode utility
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Oct 21, 2024
1 parent dc85252 commit 2748f63
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/copySvg.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
import { ClipboardIcon, CopyIcon, Loader, X } from 'lucide-svelte';
import { toast } from 'svelte-sonner';
import * as Popover from '@/ui/popover';
import { buttonStyles } from '@/ui/styles';
import ReactIcon from '@/components/icons/reactIcon.svelte';
// Utils:
import { getSvgContent } from '@/utils/getSvgContent';
import { getReactComponentCode } from '@/utils/getReactComponentCode';
import { getReactComponentCode } from '@/utils/getFrameworkComponentCode';
import { clipboard } from '@/utils/clipboard';
import { copyToClipboard as figmaCopyToClipboard } from '@/figma/copy-to-clipboard';
import { buttonStyles } from '@/ui/styles';
import { cn } from '@/utils/cn';
import ReactIcon from './icons/reactIcon.svelte';
// Props:
export let iconSize = 24;
Expand Down Expand Up @@ -142,15 +143,15 @@
</Popover.Trigger>
<Popover.Content class="flex flex-col space-y-2" sideOffset={3}>
<button
class={cn(buttonStyles, 'rounded-md w-full')}
class={cn(buttonStyles, 'w-full rounded-md')}
title={isWordmarkSvg ? 'Copy wordmark SVG to clipboard' : 'Copy SVG to clipboard'}
on:click={() => copyToClipboard()}
>
<ClipboardIcon size={16} strokeWidth={2} />
<span>Copy SVG</span>
</button>
<button
class={cn(buttonStyles, 'rounded-md w-full')}
class={cn(buttonStyles, 'w-full rounded-md')}
title="Copy as React component"
disabled={isLoading}
on:click={() => convertSvgReactComponent(true)}
Expand All @@ -159,7 +160,7 @@
<span>Copy TSX</span>
</button>
<button
class={cn(buttonStyles, 'rounded-md w-full')}
class={cn(buttonStyles, 'w-full rounded-md')}
title="Copy as React component"
disabled={isLoading}
on:click={() => convertSvgReactComponent(false)}
Expand Down

0 comments on commit 2748f63

Please sign in to comment.