@@ -11,12 +11,17 @@ function formatKey(key) {
1111 return key .replace (/ [__] / g , ' ' )
1212}
1313
14- // Display select
14+ defineProps ({
15+ label: {
16+ type: String ,
17+ default: ' '
18+ }
19+ })
20+
1521onMounted (() => {
1622 const hash = decodeURIComponent (window .location .hash .slice (1 ))
1723 if (tabKeys .includes (hash)) {
1824 activeTab .value = hash
19-
2025 nextTick (() => {
2126 const el = wrapperRef .value
2227 if (el) {
@@ -36,26 +41,60 @@ watch(activeTab, (newVal) => {
3641< / script>
3742
3843< template>
39- < div
40- ref= " wrapperRef"
41- class = " table-tabs mt-8 border rounded-lg overflow-hidden text-sm scroll-mt-24"
42- : id= " activeTab"
43- >
44- < div class = " bg-gray-50 flex justify-between items-center border-b px-4 py-2" >
45- <!-- < span class = " font-medium text-gray-700" > Optional Text : < / span> -->
46- < select
47- v- model= " activeTab"
48- class = " bg-white text-gray-800 text-sm rounded border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500"
49- >
44+ < div ref= " wrapperRef" class = " table-tabs" : id= " activeTab" >
45+ < div class = " tab-header" >
46+ < span v- if = " label" class = " label-text" >
47+ {{ label }}
48+ < / span>
49+ < select v- model= " activeTab" class = " tab-select" >
5050 < option v- for = " key in tabKeys" : key= " key" : value= " key" >
5151 {{ formatKey (key) }}
5252 < / option>
5353 < / select>
5454 < / div>
5555
56- < div class = " tab-content prose prose-sm max-w-none p-4 " >
56+ < div class = " tab-content" >
5757 < slot : name= " currentTab" / >
5858 < / div>
59+
60+ < div class = " bottom-line" / >
5961 < / div>
6062< / template>
6163
64+
65+ < style scoped>
66+ .table - tabs {
67+ background: #fff;
68+ scroll- margin- top: 4rem ;
69+ }
70+
71+ .tab - header {
72+ border- top: 1px solid #d1d5db;
73+ padding: 1rem 0 ;
74+ }
75+
76+ .label - text {
77+ color: #314659 ;
78+ }
79+
80+ .tab - select {
81+ background- color: #fff;
82+ color: #314659 ;
83+ font- size: 0 .9rem ;
84+ padding: 0 .25rem 0 .25rem ;
85+ border: 1px solid #d1d5db;
86+ border- radius: 0 .5rem ;
87+ outline: none;
88+ }
89+
90+ .tab - select: focus {
91+ border- color: #5897fb ;
92+ box- shadow: 0 0 0 1px #5897fb ;
93+ }
94+
95+ .bottom - line {
96+ border- top: 1px solid #d1d5db;
97+ margin- top: 1rem ;
98+ }
99+ < / style>
100+
0 commit comments