Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/lib/card/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,21 @@

{#snippet childSlot()}
{#if img}
<img class={image({ class: clsx(theme?.image, styling.image) })} src={img} alt={img} />
{@render children()}
<img
class={image({ class: clsx(theme?.image, styling.image) })}
src={img}
alt=""
loading="lazy"
onerror={(e) => {
const target = e.currentTarget as HTMLImageElement;
if (target) {
target.style.display = "none";
}
}}
/>
{@render children?.()}
{:else}
{@render children()}
{@render children?.()}
{/if}
{/snippet}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/card/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const card = tv({
rose: { base: "border-rose-200 bg-rose-400 dark:bg-rose-800 dark:border-rose-700" }
},
shadow: {
sm: { base: "shadow-md" },
sm: { base: "shadow-sm" },
normal: { base: "shadow-sm" },
md: { base: "shadow-md" },
lg: { base: "shadow-lg" },
Expand Down
1 change: 0 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ export type CheckIconProps = SVGAttributes<SVGSVGElement>;
// card
export type CardProps = Omit<CardVariants, "href"> &
AnchorDivAttributes & {
children: Snippet;
img?: string;
imgClass?: ClassValue;
contentClass?: string;
Expand Down