Skip to content

Commit 3f1341a

Browse files
committed
feat(anatomy-table): add support for custom column label
1 parent 8e3b321 commit 3f1341a

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

apps/website/src/routes/docs/_components/anatomy-table/anatomy-table.tsx

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,45 @@ import { component$ } from '@builder.io/qwik';
22
import {} from '@qwik-ui/headless';
33

44
type AnatomyTableProps = {
5+
firstColumnLabel?: string;
56
propDescriptors: {
67
name: string;
78
info: string;
89
description: string;
910
}[];
1011
};
1112

12-
export const AnatomyTable = component$(({ propDescriptors }: AnatomyTableProps) => {
13-
return (
14-
<div class="overflow-auto">
15-
<table class="w-full max-w-full text-left">
16-
<tbody class="divide-y divide-slate-200 dark:divide-slate-800">
17-
<tr class="text-slate-950 dark:text-white">
18-
<td class="whitespace-nowrap py-2 pl-4 text-sm font-[700] font-medium sm:pl-0">
19-
Component
20-
</td>
21-
<td class="whitespace-nowrap py-2 text-sm font-[600]">Description</td>
22-
</tr>
23-
{propDescriptors?.map((propDescriptor) => {
24-
return (
25-
<tr key={propDescriptor.name}>
26-
<td class="align-center py-3 pl-2 pr-2 sm:pl-0 md:align-baseline">
27-
<code class="border-qwikui-blue-500 bg-qwikui-blue-50 dark:bg-qwikui-purple-100 dark:border-qwikui-purple-500 mr-6 rounded-md rounded-md border-[1px] border-b-[2px] px-2 py-[2px] font-[400] text-slate-950">
28-
{propDescriptor.name}
29-
</code>
30-
</td>
31-
<td class="py-3 align-baseline">
32-
<div class="prose prose-sm prose-docs-table">
33-
<p>{propDescriptor.description}</p>
34-
</div>
35-
</td>
36-
</tr>
37-
);
38-
})}
39-
</tbody>
40-
</table>
41-
</div>
42-
);
43-
});
13+
export const AnatomyTable = component$(
14+
({ firstColumnLabel = 'Component', propDescriptors }: AnatomyTableProps) => {
15+
return (
16+
<div class="overflow-auto">
17+
<table class="w-full max-w-full text-left">
18+
<tbody class="divide-y divide-slate-200 dark:divide-slate-800">
19+
<tr class="text-slate-950 dark:text-white">
20+
<td class="whitespace-nowrap py-2 pl-4 text-sm font-[700] font-medium sm:pl-0">
21+
{firstColumnLabel}
22+
</td>
23+
<td class="whitespace-nowrap py-2 text-sm font-[600]">Description</td>
24+
</tr>
25+
{propDescriptors?.map((propDescriptor) => {
26+
return (
27+
<tr key={propDescriptor.name}>
28+
<td class="align-center py-3 pl-2 pr-2 sm:pl-0 md:align-baseline">
29+
<code class="border-qwikui-blue-500 bg-qwikui-blue-50 dark:bg-qwikui-purple-100 dark:border-qwikui-purple-500 mr-6 rounded-md rounded-md border-[1px] border-b-[2px] px-2 py-[2px] font-[400] text-slate-950">
30+
{propDescriptor.name}
31+
</code>
32+
</td>
33+
<td class="py-3 align-baseline">
34+
<div class="prose prose-sm prose-docs-table">
35+
<p>{propDescriptor.description}</p>
36+
</div>
37+
</td>
38+
</tr>
39+
);
40+
})}
41+
</tbody>
42+
</table>
43+
</div>
44+
);
45+
},
46+
);

0 commit comments

Comments
 (0)