review 2 fixes

This commit is contained in:
AhnafAhamed
2022-09-21 23:12:07 +05:30
parent 054c0cd16d
commit 57038dc5f0
7 changed files with 22 additions and 24 deletions

View File

@@ -24,7 +24,7 @@ Use these responsive card components to show data entries and information to you
import { TheCard } from 'flowbite-vue' import { TheCard } from 'flowbite-vue'
</script> </script>
<template> <template>
<the-card :href="'#'"/> <the-card href="#"/>
</template> </template>
``` ```
@@ -38,10 +38,10 @@ import { TheCard } from 'flowbite-vue'
</script> </script>
<template> <template>
<the-card <the-card
:variant="'image'" variant="image"
:href="'#'" href="#"
:img-src="'./images/blog/image-1.jpg'" img-src="./images/blog/image-1.jpg"
:img-alt="'Image'" img-alt="Image"
/> />
</template> </template>
``` ```
@@ -56,10 +56,10 @@ import { TheCard } from 'flowbite-vue'
</script> </script>
<template> <template>
<the-card <the-card
:variant="'horizontal'" variant="horizontal"
:href="'#'" href="#"
:img-src="'./images/blog/image-4.jpg'" img-src="./images/blog/image-4.jpg"
:img-alt="'Image'" img-alt="Image"
/> />
</template> </template>
``` ```

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="vp-raw inline-flex align-center gap-2 flex-wrap"> <div class="vp-raw inline-flex align-center gap-2 flex-wrap">
<the-card :href="'#'"> <the-card href="#">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5>
<p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> <p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
</the-card> </the-card>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="vp-raw inline-flex align-center gap-2 flex-wrap"> <div class="vp-raw inline-flex align-center gap-2 flex-wrap">
<the-card :href="'#'" :variant="'horizontal'" :img-src="'https://flowbite.com/docs/images/blog/image-4.jpg'" :imgAlt="'Desk'"> <the-card href="#" variant="horizontal" img-src="https://flowbite.com/docs/images/blog/image-4.jpg" img-alt="Desk">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5>
<p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> <p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
</the-card> </the-card>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="vp-raw inline-flex align-center gap-2 flex-wrap"> <div class="vp-raw inline-flex align-center gap-2 flex-wrap">
<the-card :href="'#'" :variant="'image'" :img-src="'https://flowbite.com/docs/images/blog/image-1.jpg'" :imgAlt="'Desk'"> <the-card href="#" variant="image" img-src="https://flowbite.com/docs/images/blog/image-1.jpg" img-alt="Desk">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5> <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5>
<p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p> <p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
</the-card> </the-card>

View File

@@ -1,11 +1,10 @@
<template> <template>
<a :href="href" :class="cardClasses"> <component :is="wrapperType" :href="href" :class="cardClasses">
<img v-if="imgSrc" class="rounded-t-lg" :class="horizontalImageClasses" :src="imgSrc" :alt="imgAlt"/> <img v-if="imgSrc" class="rounded-t-lg" :class="horizontalImageClasses" :src="imgSrc" :alt="imgAlt"/>
<div class="p-6"> <div class="p-6">
<slot /> <slot />
</div> </div>
</component>
</a>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, toRefs } from 'vue' import { computed, toRefs } from 'vue'
@@ -32,6 +31,7 @@ const props = defineProps({
}, },
}) })
const { cardClasses, horizontalImageClasses } = useCardsClasses(props) const { cardClasses, horizontalImageClasses } = useCardsClasses(toRefs(props))
const wrapperType = computed(() => props.href ? 'a' : 'div')
</script> </script>

View File

@@ -1,9 +1,9 @@
import type { Ref } from 'vue' import type { Ref } from 'vue'
import { computed, useSlots } from 'vue' import { computed } from 'vue'
import type { CardsVariant } from '../types' import type { CardsVariant } from '../types'
export type UseCardsClassesProps = { export type UseCardsClassesProps = {
variant: CardsVariant variant: Ref<CardsVariant>
} }
export function useCardsClasses(props: UseCardsClassesProps): { export function useCardsClasses(props: UseCardsClassesProps): {
@@ -11,17 +11,17 @@ export function useCardsClasses(props: UseCardsClassesProps): {
horizontalImageClasses: Ref<string> horizontalImageClasses: Ref<string>
} { } {
const cardClasses = computed(() => { const cardClasses = computed(() => {
if(props.variant === 'default') if(props.variant.value === 'default')
return 'block max-w-sm bg-white rounded-lg border border-gray-200 shadow-md hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700' return 'block max-w-sm bg-white rounded-lg border border-gray-200 shadow-md hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700'
else if(props.variant === 'image') else if(props.variant.value === 'image')
return 'max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700' return 'max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700'
else if(props.variant === 'horizontal') else if(props.variant.value === 'horizontal')
return 'flex flex-col items-center bg-white rounded-lg border shadow-md md:flex-row md:max-w-xl hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700' return 'flex flex-col items-center bg-white rounded-lg border shadow-md md:flex-row md:max-w-xl hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700'
return '' return ''
}) })
const horizontalImageClasses = computed(() => { const horizontalImageClasses = computed(() => {
if(props.variant === 'horizontal') if(props.variant.value === 'horizontal')
return 'object-cover w-full h-96 rounded-t-lg md:h-auto md:w-48 md:rounded-none md:rounded-l-lg' return 'object-cover w-full h-96 rounded-t-lg md:h-auto md:w-48 md:rounded-none md:rounded-l-lg'
return '' return ''
}) })

View File

@@ -13,9 +13,7 @@ export { default as Avatar } from './components/Avatar/Avatar.vue'
export { default as StackedAvatars } from './components/Avatar/StackedAvatars.vue' export { default as StackedAvatars } from './components/Avatar/StackedAvatars.vue'
export { default as StackedAvatarsCounter } from './components/Avatar/StackedAvatarsCounter.vue' export { default as StackedAvatarsCounter } from './components/Avatar/StackedAvatarsCounter.vue'
export { default as Accordion } from './components/Accordion/Accordion.vue' export { default as Accordion } from './components/Accordion/Accordion.vue'
export { default as Badge } from './components/Badge/Badge.vue' export { default as Badge } from './components/Badge/Badge.vue'
export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.vue'
export { default as TheCard } from './components/Card/TheCard.vue' export { default as TheCard } from './components/Card/TheCard.vue'
export { default as Carousel } from './components/Carousel/Carousel.vue' export { default as Carousel } from './components/Carousel/Carousel.vue'
export { default as Footer } from './components/Footer/Footer.vue' export { default as Footer } from './components/Footer/Footer.vue'