Skip to content

Commit a3010fd

Browse files
committed
feat: enhance Card component with custom slot and optional title/description props
1 parent 6bd1392 commit a3010fd

3 files changed

Lines changed: 25 additions & 15 deletions

File tree

adminforth/documentation/docs/tutorial/03-Customization/15-afcl.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -425,32 +425,41 @@ const enable = ref(false)
425425
</div>
426426

427427
## Card
428-
### Standart card
428+
429+
### Custom card
430+
If you need custom card, you can make it without
429431
<div class="split-screen">
430432
```ts
431-
import { Card } from '@/afcl'
432-
433-
...
433+
<Card>
434+
<h5 class="font-bold text-2xl text-gray-800 dark:text-gray-100 mb-6">Monthly Statistics</h5>
435+
<div class="flex justify-between items-center gap-6">
436+
<div class="flex flex-col">
437+
<p class="font-semibold text-gray-600 dark:text-gray-300">Total Income</p>
438+
<p class="text-blue-500 font-bold text-xl mt-2">350,000$</p>
439+
</div>
434440

435-
<Card
436-
title="New Reality"
437-
description="Click this card to visit the new AdminForth reality where you can build your own back-office"
438-
>
441+
<div class="flex flex-col">
442+
<p class="font-semibold text-gray-600 dark:text-gray-300">Total Profit</p>
443+
<p class="text-green-500 font-bold text-xl mt-2">100,000$</p>
444+
</div>
445+
</div>
439446
</Card>
440447
```
441448

442-
![AFCL Checkbox](Card.png)
443449

444-
</div>
450+
![AFCL Checkbox](Card3.png)
445451

446-
### Different card sizes
447-
If you want to have smaller card, you can specify size in props:
452+
</div>
448453

454+
### Standart card
449455
<div class="split-screen">
450456

451457
```ts
458+
import { Card } from '@/afcl'
459+
460+
...
461+
452462
<Card
453-
size="lg"
454463
title="This is a large card"
455464
description="Description text for large card. This is a large card. Very nice card. Big one. You can put here any content you want."
456465
>
24.6 KB
Loading

adminforth/spa/src/afcl/Card.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99

1010
<h5 class="font-bold tracking-tight text-lightCardTitle dark:text-darkCardTitle" :class="[props.size === 'sm' ? 'text-base' : props.size === 'md' ? 'text-lg mb-1' : 'text-xl mb-2']">{{ props.title }}</h5>
1111
<p class="font-normal text-lightCardDescription dark:text-darkCardDescription" :class="[props.size === 'sm' ? 'text-sm' : props.size === 'md' ? 'text-base' : 'text-lg']">{{ props.description }}</p>
12+
<slot></slot>
1213
</a>
1314
</template>
1415

1516

1617
<script setup lang="ts">
1718
const props = defineProps<{
18-
title: string;
19-
description: string;
19+
title?: string;
20+
description?: string;
2021
size?: 'sm' | 'md' | 'lg';
2122
hideBorder?: boolean;
2223
}>();

0 commit comments

Comments
 (0)