Add Card component using shadcn/ui primitives with custom ProductCard extension#37
Draft
Copilot wants to merge 5 commits into
Draft
Add Card component using shadcn/ui primitives with custom ProductCard extension#37Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
|
Coverage after merging copilot/add-card-component into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
🚀 Lighthouse Performance Results
Download the |
- Create Card component with TypeScript in src/components/ui/card/ - Support title with configurable heading level (h2-h4) - Support description text - Optional CTA button or link (internal/external) - Optional image with top/bottom positioning - Use class-variance-authority for variants - Use Tailwind CSS for styling with hover effects - Add comprehensive unit tests (22 tests, 100% coverage) - Add extensive Storybook stories for documentation - Add barrel export via index.ts - Full accessibility support with a11y tests Co-authored-by: DanStuartDept <87612831+DanStuartDept@users.noreply.github.com>
- Fix image border radius to respect imagePosition (top vs bottom) - Improve external URL detection to include http://, https://, and // - Fix imagePosition default logic to prevent inconsistent behavior - Add test for protocol-relative URLs - Maintain 100% test coverage (23 tests passing) Co-authored-by: DanStuartDept <87612831+DanStuartDept@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add card component to the codebase
Add Card component with configurable heading, CTA, and image positioning
Nov 26, 2025
Owner
|
@copilot actually can we reuse shadcn elements and then use those ui components and extend with my custom requirements |
- Add card-primitives.tsx with shadcn base components - Refactor card.tsx to build ProductCard on top of primitives - Export shadcn primitives and custom ProductCard - ProductCard extends shadcn with image positioning, CTA, heading levels - Update tests and stories to use ProductCard - All 47 tests passing with 100% coverage on card.tsx Co-authored-by: DanStuartDept <87612831+DanStuartDept@users.noreply.github.com>
Contributor
Author
Done! I've refactored the Card component to use shadcn/ui primitives as the foundation (commit 1999a26). What changed:
You can now use either:
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card";
<Card>
<CardHeader>
<CardTitle>Custom Layout</CardTitle>
<CardDescription>Build anything</CardDescription>
</CardHeader>
<CardContent>Your content</CardContent>
<CardFooter><Button>Action</Button></CardFooter>
</Card>
import { ProductCard } from "@/components/ui/card";
<ProductCard
title="Feature"
titleHeadingLevel="h3"
description="Description"
image={{ src: "/img.jpg", alt: "Feature" }}
imagePosition="top"
cta={{ text: "Learn more", href: "/about" }}
/>All 47 tests passing, 100% coverage maintained. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: DanStuartDept <87612831+DanStuartDept@users.noreply.github.com>
Copilot
AI
changed the title
Add Card component with configurable heading, CTA, and image positioning
Add Card component using shadcn/ui primitives with custom ProductCard extension
Nov 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Implements a Card component system using shadcn/ui base primitives, extended with a custom ProductCard wrapper for specific requirements including title, description, optional CTA (button/link), and optional image with configurable positioning.
Implementation
shadcn/ui Base Components (
card-primitives.tsx)Card- Root container with border, shadow, rounded cornersCardHeader- Header section with spacingCardTitle- Heading element (h3) with typographyCardDescription- Description text with muted colorCardContent- Content area with paddingCardFooter- Footer section for actionsCustom ProductCard (
card.tsx)titleHeadingLevelpropimagePositionvariant:top,bottom, ornoneclass-variance-authorityfor variant managementrounded-t-lg, bottom:rounded-b-lg)URL Handling
External link detection checks
http://,https://, and protocol-relative//URLs, automatically addingtarget="_blank"andrel="noopener noreferrer".Testing & Documentation
Usage
Using shadcn primitives directly
Using ProductCard wrapper
Benefits
✅ Flexibility - Use shadcn primitives for custom layouts or ProductCard for quick implementation
✅ Consistency - Base components follow shadcn/ui design system and patterns
✅ Extensibility - Easy to create new variants by composing primitives
✅ Type Safety - Full TypeScript support with proper type exports
✅ Accessibility - Semantic HTML and WCAG compliant
Screenshots
Refactored Card Component with shadcn/ui primitives

Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.