feat: ExperienceCard stack field and Card subcomponent layout
This commit is contained in:
@@ -6,6 +6,7 @@ const DEFAULT_PROPS = {
|
||||
company: 'Acme Corp',
|
||||
period: '2021 – 2024',
|
||||
description: 'Built scalable frontend systems.',
|
||||
stack: [],
|
||||
};
|
||||
|
||||
describe('ExperienceCard', () => {
|
||||
@@ -32,9 +33,9 @@ describe('ExperienceCard', () => {
|
||||
});
|
||||
|
||||
describe('structure', () => {
|
||||
it('title is rendered as an h4', () => {
|
||||
it('title is rendered as an h3', () => {
|
||||
render(<ExperienceCard {...DEFAULT_PROPS} />);
|
||||
expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('Senior Developer');
|
||||
expect(screen.getByRole('heading', { level: 3 })).toHaveTextContent('Senior Developer');
|
||||
});
|
||||
|
||||
it('period badge has brutal-border, bg-blue, text-cream, text-sm', () => {
|
||||
@@ -43,11 +44,11 @@ describe('ExperienceCard', () => {
|
||||
expect(badge).toHaveClass('brutal-border', 'bg-blue', 'text-cream', 'text-sm');
|
||||
});
|
||||
|
||||
it('company paragraph has opacity-80', () => {
|
||||
it('company paragraph has opacity-60', () => {
|
||||
render(<ExperienceCard {...DEFAULT_PROPS} />);
|
||||
const company = screen.getByText('Acme Corp');
|
||||
expect(company.tagName).toBe('P');
|
||||
expect(company).toHaveClass('opacity-80');
|
||||
expect(company).toHaveClass('opacity-60');
|
||||
});
|
||||
|
||||
it('description renders via RichText with rich-text class', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Card, RichText } from '$shared/ui';
|
||||
import { Card, CardContent, CardFooter, CardHeader, CardTitle, RichText } from '$shared/ui';
|
||||
|
||||
type Props = {
|
||||
/**
|
||||
@@ -17,6 +17,10 @@ type Props = {
|
||||
* Description of responsibilities and achievements
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Technologies used during this role
|
||||
*/
|
||||
stack: string[];
|
||||
/**
|
||||
* Additional CSS classes forwarded to the card
|
||||
*/
|
||||
@@ -24,19 +28,30 @@ type Props = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Work experience card with title, company, period, and description.
|
||||
* Work experience card with title, company, period, description, and tech stack.
|
||||
*/
|
||||
export function ExperienceCard({ title, company, period, description, className }: Props) {
|
||||
export function ExperienceCard({ title, company, period, description, stack, className }: Props) {
|
||||
return (
|
||||
<Card className={className}>
|
||||
<div className="flex flex-col md:flex-row md:items-start md:justify-between mb-4 gap-4">
|
||||
<div className="flex-1 max-w-[700px]">
|
||||
<h4>{title}</h4>
|
||||
<p className="text-base opacity-80">{company}</p>
|
||||
<CardHeader className="flex flex-col md:flex-row md:items-start md:justify-between gap-4 pb-6 md:pb-8 brutal-border-bottom">
|
||||
<div className="flex-1">
|
||||
<CardTitle className="font-heading">{title}</CardTitle>
|
||||
<p className="text-base opacity-60">{company}</p>
|
||||
</div>
|
||||
<span className="brutal-border px-4 py-2 bg-blue text-cream text-sm self-start">{period}</span>
|
||||
</div>
|
||||
<RichText html={description} />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<RichText html={description} />
|
||||
</CardContent>
|
||||
{stack.length > 0 && (
|
||||
<CardFooter className="flex flex-wrap gap-2">
|
||||
{stack.map((tech) => (
|
||||
<span key={tech} className="brutal-border px-3 py-1 bg-cream text-blue text-sm uppercase tracking-wide">
|
||||
{tech}
|
||||
</span>
|
||||
))}
|
||||
</CardFooter>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user