Skip to content

fix: Card width issue #383 #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/components/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use these responsive card components to show data entries and information to you
<fwb-card-example />
```vue
<template>
<fwb-card href="#">
<fwb-card href="#" class="w-sm">
<div class="p-5">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Noteworthy technology acquisitions 2021
Expand All @@ -46,6 +46,7 @@ import { FwbCard } from 'flowbite-vue'
img-alt="Desk"
img-src="https://flowbite.com/docs/images/blog/image-1.jpg"
variant="image"
class="w-md"
>
<div class="p-5">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Expand All @@ -72,6 +73,7 @@ import { FwbCard } from 'flowbite-vue'
img-alt="Desk"
img-src="https://flowbite.com/docs/images/blog/image-4.jpg"
variant="horizontal"
class="w-lg"
>
<div class="p-5">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Expand Down
2 changes: 1 addition & 1 deletion docs/components/card/examples/FwbCardExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="vp-raw inline-flex flex-wrap gap-2">
<fwb-card href="#">
<fwb-card href="#" class="w-sm">

Check warning on line 3 in docs/components/card/examples/FwbCardExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'class' should be on a new line
<div class="p-5">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Noteworthy technology acquisitions 2021
Expand Down
1 change: 1 addition & 0 deletions docs/components/card/examples/FwbCardExampleHorizontal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
img-alt="Desk"
img-src="https://flowbite.com/docs/images/blog/image-4.jpg"
variant="horizontal"
class="w-lg"
>
<div class="p-5">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Expand Down
1 change: 1 addition & 0 deletions docs/components/card/examples/FwbCardExampleImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
img-alt="Desk"
img-src="https://flowbite.com/docs/images/blog/image-1.jpg"
variant="image"
class="w-md"
>
<div class="p-5">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Expand Down
6 changes: 3 additions & 3 deletions src/components/FwbCard/composables/useCardClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export function useCardsClasses (props: UseCardsClassesProps): {
const cardClasses = computed(() => {
let computedClasses = ''
if (props.variant.value === 'image') {
computedClasses = 'max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700'
computedClasses = 'min-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700'
}

if (props.variant.value === 'default') {
computedClasses = 'block max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700 '
computedClasses = 'block min-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700 '
} else if (props.variant.value === 'horizontal') {
computedClasses = 'flex flex-col items-center bg-white rounded-lg border shadow-md md:flex-row md:max-w-xl dark:border-gray-700 dark:bg-gray-800'
computedClasses = 'flex flex-col items-center bg-white rounded-lg border shadow-md md:flex-row md:min-w-xl dark:border-gray-700 dark:bg-gray-800'
}

if (props.href?.value) {
Expand Down
Loading