Skip to content

Commit

Permalink
fix: Styling fixes for Card component
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuh committed Apr 11, 2024
1 parent 31ec1c6 commit 8097922
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 150 deletions.
27 changes: 14 additions & 13 deletions components/card/w-card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@
import { card as ccCard } from '@warp-ds/css/component-classes';
import { computed } from 'vue';
defineOptions({
name: 'wCard',
});
const props = defineProps({
as: { type: String, default: 'div' },
selected: Boolean,
flat: Boolean
})
const outerClasses = computed(() => ({
const containerClasses = computed(() => ({
[ccCard.card]: true,
[ccCard.cardShadow]: !props.flat,
[props.selected ? ccCard.cardSelected : ccCard.cardUnselected]: !props.flat,
[ccCard.cardSelected]: !props.flat && props.selected,
[ccCard.cardFlat]: props.flat,
[props.selected ? ccCard.cardFlatSelected : ccCard.cardFlatUnselected]: props.flat
}))
const innerClasses = computed(() => ({
[ccCard.cardOutline]: true,
[props.selected ? ccCard.cardOutlineSelected : ccCard.cardOutlineUnselected]: true
}))
}));
const outlineClasses = computed(() => [
ccCard.cardOutline,
props.selected ? ccCard.cardOutlineSelected : ccCard.cardOutlineUnselected,
]);
</script>

<template>
<component :is="as" :class="outerClasses">
<div v-if="!flat" :class="innerClasses" />
<component :is="as" :class="containerClasses">
<div v-if="!flat" :class="outlineClasses" />
<slot />
</component>
</template>

<script>
export default { name: 'wCard' }
</script>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"@floating-ui/dom": "1.6.3",
"@lingui/core": "^4.7.0",
"@warp-ds/core": "^1.0.2",
"@warp-ds/css": "1.9.1",
"@warp-ds/css": "1.9.3",
"@warp-ds/icons": "2.0.0",
"@warp-ds/uno": "1.9.0",
"@warp-ds/uno": "1.10.2",
"create-v-model": "^2.2.0",
"dom-focus-lock": "^1.1.0",
"element-collapse": "^1.1.0",
Expand Down
Loading

0 comments on commit 8097922

Please sign in to comment.