Skip to content

Commit

Permalink
feat(card): add xlarge and xxlarge size (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking authored Nov 14, 2023
1 parent c37b97c commit 6cd8364
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/components/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import SCardHeaderTitle from 'sefirot/components/SCardHeaderTitle.vue'
</SCardBlock>
<SCardFooter>
<SCardFooterActions>
<SCardFooterAction mode="mute" label="Cancel" />
<SCardFooterAction label="Cancel" />
<SCardFooterAction mode="info" label="Submit" />
</SCardFooterActions>
</SCardFooter>
Expand Down
16 changes: 15 additions & 1 deletion lib/components/SCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed } from 'vue'
import { provideCardState } from '../composables/Card'
export type Size = 'small' | 'medium' | 'large'
export type Size = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'
export type Mode = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
const props = defineProps<{
Expand Down Expand Up @@ -83,6 +83,20 @@ const classes = computed(() => [
max-width: 768px;
}
}
&.xlarge {
@media (min-width: 1056px) {
margin: 48px auto 128px;
max-width: 960px;
}
}
&.xxlarge {
@media (min-width: 1248px) {
margin: 48px auto 128px;
max-width: 1152px;
}
}
}
.SModal.fade-enter-from > .SCard,
Expand Down
2 changes: 1 addition & 1 deletion stories/components/SCard.01_Playground.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function state() {

<SCardFooter>
<SCardFooterActions>
<SCardFooterAction mode="mute" label="Cancel" />
<SCardFooterAction label="Cancel" />
<SCardFooterAction mode="info" label="Submit" />
</SCardFooterActions>
</SCardFooter>
Expand Down
16 changes: 14 additions & 2 deletions stories/components/SCard.02_Within_Modal.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const open = ref(false)
function state() {
return {
cardSize: 'small',
cardMode: 'neutral',
titleMode: 'neutral'
}
Expand All @@ -28,6 +29,17 @@ function state() {
<template>
<Story :title="title" :init-state="state" source="Not available" auto-props-disabled>
<template #controls="{ state }">
<HstSelect
title="Card size"
:options="{
small: 'small',
medium: 'medium',
large: 'large',
xlarge: 'xlarge',
xxlarge: 'xxlarge'
}"
v-model="state.cardSize"
/>
<HstSelect
title="Card mode"
:options="{
Expand Down Expand Up @@ -59,7 +71,7 @@ function state() {
<SButton mode="info" label="Open dialog" @click="open = true" />

<SModal :open="open" @close="open = false">
<SCard size="small" :mode="state.cardMode">
<SCard :size="state.cardSize" :mode="state.cardMode">
<SCardHeader>
<SCardHeaderTitle :mode="state.titleMode">Header title</SCardHeaderTitle>
<SCardHeaderActions>
Expand All @@ -78,7 +90,7 @@ function state() {

<SCardFooter>
<SCardFooterActions>
<SCardFooterAction mode="mute" label="Cancel" @click="open = false" />
<SCardFooterAction label="Cancel" @click="open = false" />
<SCardFooterAction mode="info" label="Submit" @click="open = false" />
</SCardFooterActions>
</SCardFooter>
Expand Down

0 comments on commit 6cd8364

Please sign in to comment.