diff --git a/lib/components/ColorCard/ColorCard.test.tsx b/lib/components/ColorCard/ColorCard.test.tsx index 89ac9e8..a58f114 100644 --- a/lib/components/ColorCard/ColorCard.test.tsx +++ b/lib/components/ColorCard/ColorCard.test.tsx @@ -27,7 +27,13 @@ describe('ColorCard', () => { it('renders ColorCard with a link when actionContent is provided', () => { render( - , + , ); // Assert ColorCard is wrapped in a link @@ -47,7 +53,7 @@ describe('ColorCard', () => { }); it('renders ColorCard with a link when actionContent is not provided', () => { - render(); + render(); // Assert ColorCard is wrapped in a link const linkElement = screen.getByRole('link'); diff --git a/lib/components/ColorCard/ColorCard.tsx b/lib/components/ColorCard/ColorCard.tsx index 0bb3439..72295bb 100644 --- a/lib/components/ColorCard/ColorCard.tsx +++ b/lib/components/ColorCard/ColorCard.tsx @@ -7,21 +7,29 @@ export interface ColorCardProps { actionContent?: string; /** Background color of the card */ backgroundColor?: string; + /** Link to page */ + href?: string; } -export const ColorCard = ({ title, content, actionContent, backgroundColor = '#444BACF2' }: ColorCardProps) => ( +export const ColorCard = ({ title, content, actionContent, backgroundColor = '#444BACF2', href }: ColorCardProps) => ( <> {actionContent ? ( - + ) : ( - - + + )} ); -const BaseCard = ({ title, content, actionContent, backgroundColor }: ColorCardProps) => { +const BaseCard = ({ title, content, actionContent, backgroundColor, href }: ColorCardProps) => { const Heading = actionContent ? 'h1' : 'h2'; return (
{content}

} {actionContent ? (