Skip to content

Commit 9a790a0

Browse files
committed
feat(docs): introduce FeatureCard component and refactor GuidesSection to utilize it
1 parent ef43623 commit 9a790a0

2 files changed

Lines changed: 44 additions & 16 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import clsx from 'clsx';
2+
import React from 'react';
3+
4+
import Badge from '../Badge';
5+
import { BodyBold, BodySmall } from '../Typography';
6+
7+
export interface FeatureCardProps {
8+
icon?: React.ReactNode;
9+
title: string;
10+
description?: string;
11+
badge?: string;
12+
className?: string;
13+
}
14+
15+
export const FeatureCard: React.FC<FeatureCardProps> = ({ icon, title, description, badge, className }) => {
16+
return (
17+
<div className={clsx('card-base', className)}>
18+
<div className="flex justify-between p-6 w-full h-full">
19+
<div className="flex gap-6 flex-1 w-full">
20+
{icon && <div className="flex items-center justify-center">{icon}</div>}
21+
22+
<div className="flex flex-col gap-2">
23+
<BodyBold className="m-0!">{title}</BodyBold>
24+
{description && <BodySmall className="m-0!">{description}</BodySmall>}
25+
</div>
26+
</div>
27+
28+
{badge && (
29+
<div className="shrink-0 ml-2">
30+
<Badge title={badge} variant="secondary" />
31+
</div>
32+
)}
33+
</div>
34+
</div>
35+
);
36+
};

apps/docs/src/components/GuidesSection/index.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import clsx from 'clsx';
22
import React, { type ReactNode } from 'react';
33

44
import HistoryIcon from '../../assets/icons/History.svg';
5-
import Badge from '../Badge';
6-
import { Body, BodyBold, BodySmall, H2, H3 } from '../Typography';
5+
import { FeatureCard } from '../FeatureCard';
6+
import { Body, BodySmall, H2, H3 } from '../Typography';
77

88
export interface Guide {
99
title: string;
@@ -40,20 +40,12 @@ export const GuidesSection: React.FC<GuidesSectionProps> = ({ title, guides, inf
4040
<ul className="list-none p-0! m-0! flex flex-col gap-4 w-full">
4141
{guides.map((guide, index) => (
4242
<li key={index}>
43-
<div className={clsx('card-base')}>
44-
<div className={`flex justify-between p-6 w-full h-full`}>
45-
<div className="self-center mr-6">{guide.icon}</div>
46-
47-
<div className={`flex flex-col gap-2`}>
48-
<BodyBold className="m-0!">{guide.title}</BodyBold>
49-
<BodySmall className="m-0!">{guide.description}</BodySmall>
50-
</div>
51-
52-
<div className="shrink-0 ml-2">
53-
<Badge title={guide.badge} variant="secondary" />
54-
</div>
55-
</div>
56-
</div>
43+
<FeatureCard
44+
icon={guide.icon}
45+
title={guide.title}
46+
description={guide.description}
47+
badge={guide.badge}
48+
/>
5749
</li>
5850
))}
5951
</ul>

0 commit comments

Comments
 (0)