Skip to content

Commit

Permalink
Adding Variant prop to AssistantCard
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncid committed Dec 18, 2024
1 parent 48ee34e commit 1ac7445
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sparkle/src/components/AssistantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CardActionButton,
MiniButtonProps,
} from "@sparkle/components/";
import { CardVariantType } from "@sparkle/components/Card";
import { MoreIcon } from "@sparkle/icons/";
import { cn } from "@sparkle/lib/utils";

Expand All @@ -16,6 +17,7 @@ interface BaseAssistantCardProps {
subtitle?: string;
className?: string;
onClick?: () => void;
variant?: CardVariantType;
}

type AssistantCardMore = Omit<MiniButtonProps, "icon" | "size">;
Expand All @@ -37,7 +39,16 @@ export const AssistantCard = React.forwardRef<
AssistantCardProps
>(
(
{ className, onClick, title, description, pictureUrl, subtitle, action },
{
className,
onClick,
title,
description,
pictureUrl,
subtitle,
action,
variant = "primary",
},
ref
) => {
return (
Expand All @@ -47,6 +58,7 @@ export const AssistantCard = React.forwardRef<
className={cn("s-flex s-flex-col s-gap-3", className)}
onClick={onClick}
action={action}
variant={variant}
>
<div className="s-flex s-gap-3">
<Avatar visual={pictureUrl} size="md" />
Expand Down
1 change: 1 addition & 0 deletions sparkle/src/stories/AssistantCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const AssistantCardExample = () => (
description="Showing a custom action element"
onClick={() => console.log("AssistantCard clicked")}
action={<AssistantCardMore onClick={() => console.log("hello")} />}
variant="secondary"
/>
</CardGrid>
</div>
Expand Down

0 comments on commit 1ac7445

Please sign in to comment.