Skip to content
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

fix: FwbCard: Removed hover on non-links cards #321

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
18 changes: 13 additions & 5 deletions src/components/FwbCard/composables/useCardClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@ import type { CardsVariant } from '../types'

export type UseCardsClassesProps = {
variant: Ref<CardsVariant>
href?: Ref<string>
}

export function useCardsClasses (props: UseCardsClassesProps): {
cardClasses: Ref<string>,
horizontalImageClasses: Ref<string>
} {
const cardClasses = computed(() => {
let classes = ''
if (props.variant.value === 'image') {
classes = 'max-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') {
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.value === 'image') {
return 'max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700'
classes = 'block 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.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'
classes = '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'
}

if (props.href?.value) {
classes += ' hover:bg-gray-100 dark:hover:bg-gray-700'
}

return ''
return classes
andreyjamer marked this conversation as resolved.
Show resolved Hide resolved
})

const horizontalImageClasses = computed(() => (props.variant.value === 'horizontal')
Expand Down
Loading