File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- defineProps <{
3- label? : string
4- description? : string
5- }>()
2+ const props = withDefaults (
3+ defineProps <{
4+ label? : string
5+ description? : string
6+ justify? : ' between' | ' start'
7+ reverseOrder? : boolean
8+ }>(),
9+ {
10+ justify: ' between' ,
11+ reverseOrder: false ,
12+ },
13+ )
614 </script >
715
816<template >
9- <div class =" grid" style =" grid-template-areas : ' label-text . toggle-background' " >
10- <span v-if =" label" class =" text-sm text-fg font-medium text-start" style =" grid-area : label-text" >
11- {{ label }}
12- </span >
13- <SkeletonBlock
14- class =" h-6 w-11 shrink-0 rounded-full"
15- style =" grid-area : toggle-background; justify-self : end "
16- />
17+ <div
18+ class =" grid items-center gap-4 py-1 -my-1"
19+ :class =" [
20+ justify === 'start' ? 'justify-start' : '',
21+ props.reverseOrder ? 'toggle-reverse' : 'toggle-default',
22+ ]"
23+ >
24+ <template v-if =" props .reverseOrder " >
25+ <SkeletonBlock class =" h-6 w-11 shrink-0 rounded-full" style =" grid-area : toggle-background" />
26+ <span
27+ v-if =" label"
28+ class =" text-sm text-fg font-medium text-start"
29+ style =" grid-area : label-text"
30+ >
31+ {{ label }}
32+ </span >
33+ </template >
34+ <template v-else >
35+ <span
36+ v-if =" label"
37+ class =" text-sm text-fg font-medium text-start"
38+ style =" grid-area : label-text"
39+ >
40+ {{ label }}
41+ </span >
42+ <SkeletonBlock
43+ class =" h-6 w-11 shrink-0 rounded-full"
44+ style =" grid-area : toggle-background; justify-self : end "
45+ />
46+ </template >
1747 </div >
1848 <p v-if =" description" class =" text-sm text-fg-muted mt-2" >
1949 {{ description }}
2050 </p >
2151</template >
52+
53+ <style scoped>
54+ .toggle-default {
55+ grid-template-areas : ' label-text . toggle-background' ;
56+ grid-template-columns : auto 1fr auto ;
57+ }
58+
59+ .toggle-reverse {
60+ grid-template-areas : ' toggle-background . label-text' ;
61+ grid-template-columns : auto 1fr auto ;
62+ }
63+ </style >
You can’t perform that action at this time.
0 commit comments