Skip to content

Commit a3803b5

Browse files
committed
feat: add support for different card sizes in AFCL Card component
1 parent 654c0a5 commit a3803b5

3 files changed

Lines changed: 42 additions & 4 deletions

File tree

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ const enable = ref(false)
437437
</div>
438438

439439
## Card
440-
440+
### Standart card
441441
<div class="split-screen">
442442
```ts
443443
import { Card } from '@/afcl'
@@ -453,6 +453,36 @@ import { Card } from '@/afcl'
453453

454454
![AFCL Checkbox](Card.png)
455455

456+
</div>
457+
458+
### Different card sizes
459+
If you want to have smaller card, you can specify size in props:
460+
461+
<div class="split-screen">
462+
463+
```ts
464+
<Card
465+
size="lg"
466+
title="This is a large card"
467+
description="Description text for large card. This is a large card. Very nice card. Big one. You can put here any content you want."
468+
>
469+
</Card>
470+
471+
<Card
472+
size="md"
473+
title="This is a medium card"
474+
description="Description text for medium card. This is a medium card. Very nice card. Big one. You can put here any content you want."
475+
>
476+
</Card>
477+
478+
<Card
479+
size="sm"
480+
title="This is a small card"
481+
description="Description text for small card. This is a small card. Very nice card. Big one. You can put here any content you want."
482+
>
483+
</Card>
484+
```
485+
![AFCL Checkbox](Card2.png)
456486

457487
</div>
458488

48.9 KB
Loading

adminforth/spa/src/afcl/Card.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<template>
2-
<a href="#" class="block max-w-sm p-6 bg-lightCardBackground border border-lightCardBorder rounded-lg shadow-sm hover:bg-lightCardBackgroundHover dark:bg-darkCardBackground dark:border-darkCardBorder dark:hover:bg-darkCardBackgroundHover">
2+
<a href="#"
3+
class="block max-w-sm bg-lightCardBackground border border-lightCardBorder rounded-lg shadow-sm hover:bg-lightCardBackgroundHover dark:bg-darkCardBackground dark:border-darkCardBorder dark:hover:bg-darkCardBackgroundHover"
4+
:class="[
5+
props.size === 'sm' ? 'p-2' : props.size === 'md' ? 'p-4' : 'p-6',
6+
props.hideBorder ? 'border-0' : ''
7+
]"
8+
>
39

4-
<h5 class="mb-2 text-2xl font-bold tracking-tight text-lightCardTitle dark:text-darkCardTitle">{{ props.title }}</h5>
5-
<p class="font-normal text-base text-lightCardDescription dark:text-darkCardDescription">{{ props.description }}</p>
10+
<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>
11+
<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>
612
</a>
713
</template>
814

@@ -11,6 +17,8 @@
1117
const props = defineProps<{
1218
title: string;
1319
description: string;
20+
size?: 'sm' | 'md' | 'lg';
21+
hideBorder?: boolean;
1422
}>();
1523
1624
</script>

0 commit comments

Comments
 (0)