1
1
<template >
2
2
<div class =" tab-container" :id =" id" >
3
3
<nav ref =" nav" >
4
- <button :id =" id + '_rtdb'" :class =" !selectedTab && 'is-selected'" title =" Realtime Database example"
5
- @focus =" selectOnFocus(0, $event)" @click =" select(0)" :disabled =" disable === '0'" >
4
+ <button
5
+ :id =" id + '_rtdb'"
6
+ :class =" !selectedTab && 'is-selected'"
7
+ title =" Realtime Database example"
8
+ @focus =" selectOnFocus(0, $event)"
9
+ @click =" select(0)"
10
+ :disabled =" disable === '0'"
11
+ >
6
12
<rtdb-logo />
7
13
</button >
8
- <button :id =" id + '_firestore'" :class =" selectedTab && 'is-selected'" title =" Firestore example"
9
- @focus =" selectOnFocus(1, $event)" @click =" select(1)" :disabled =" disable === '1'" >
14
+ <button
15
+ :id =" id + '_firestore'"
16
+ :class =" selectedTab && 'is-selected'"
17
+ title =" Firestore example"
18
+ @focus =" selectOnFocus(1, $event)"
19
+ @click =" select(1)"
20
+ :disabled =" disable === '1'"
21
+ >
10
22
<firestore-logo />
11
23
</button >
12
24
</nav >
@@ -31,8 +43,18 @@ const sharedState = {
31
43
selectedTab: 1 , // defaults to Firestore examples
32
44
}
33
45
46
+ let id = 0
47
+
34
48
export default {
35
- props: [' id' , ' disable' ],
49
+ props: {
50
+ id: {
51
+ type: String ,
52
+ default : () => ` code-example-${ id++ } ` ,
53
+ },
54
+ disable: {
55
+ type: String ,
56
+ },
57
+ },
36
58
data () {
37
59
return sharedState
38
60
},
@@ -73,7 +95,7 @@ export default {
73
95
</style >
74
96
75
97
<style >
76
- .tab-container > nav {
98
+ .tab-container > nav {
77
99
display : flex ;
78
100
align-items : flex-end ;
79
101
justify-content : flex-end ;
@@ -85,12 +107,12 @@ export default {
85
107
}
86
108
87
109
@media (max-width : 419px ) {
88
- .tab-container > nav {
110
+ .tab-container > nav {
89
111
margin : 0 -1.5rem 0 ;
90
112
}
91
113
}
92
114
93
- .tab-container > nav > button {
115
+ .tab-container > nav > button {
94
116
display : flex ;
95
117
align-items : center ;
96
118
height : 100% ;
@@ -104,64 +126,64 @@ export default {
104
126
background-color : var (--code-bg-color-lighter );
105
127
}
106
128
107
- .tab-container > nav > button svg {
129
+ .tab-container > nav > button svg {
108
130
width : 32px ;
109
131
height : 32px ;
110
132
/* margin-top: -3.5rem; */
111
133
fill : var (--vp-code-block-color );
112
134
/* filter: brightness(0.8); */
113
135
}
114
136
115
- .tab-container > nav > button :not (:first-child ) {
137
+ .tab-container > nav > button :not (:first-child ) {
116
138
border-left : none ;
117
139
}
118
140
119
- .tab-container > nav > button :not (:last-child ) {
141
+ .tab-container > nav > button :not (:last-child ) {
120
142
border-right : none ;
121
143
}
122
144
123
- .tab-container > nav > button :first-child {
145
+ .tab-container > nav > button :first-child {
124
146
border-radius : 6px 0 0 ;
125
147
}
126
148
127
- .tab-container > nav > button :last-child {
149
+ .tab-container > nav > button :last-child {
128
150
border-radius : 0 6px 0 0 ;
129
151
}
130
152
131
- .tab-container > nav > button :not ([disabled ]):hover {
153
+ .tab-container > nav > button :not ([disabled ]):hover {
132
154
cursor : pointer ;
133
155
/* background-color: lighten(var(--code-bg-color), 30%); */
134
156
background-color : var (--code-bg-color-lightest );
135
157
/* filter: brightness(1.3); */
136
158
}
137
159
138
- .tab-container > nav > button :not ([disabled ]):hover svg {
160
+ .tab-container > nav > button :not ([disabled ]):hover svg {
139
161
fill : var (--vp-code-block-color );
140
162
}
141
163
142
- .tab-container > nav > button .is-selected :hover {
164
+ .tab-container > nav > button .is-selected :hover {
143
165
filter : brightness (1 );
144
166
background-color : var (--vp-code-block-bg );
145
167
146
168
/* var(--vp-code-block-bg); */
147
169
}
148
170
149
- .tab-container > nav > button [disabled ] {
171
+ .tab-container > nav > button [disabled ] {
150
172
/* border-color: lighten(var(--vp-code-block-bg), 60%); */
151
173
border-color : var (--vp-code-block-bg );
152
174
/* filter: brightness(1.6); */
153
175
}
154
176
155
- .tab-container > nav > button [disabled ] svg {
177
+ .tab-container > nav > button [disabled ] svg {
156
178
fill : var (--vp-code-block-bg );
157
179
/* filter: brightness(1.6); */
158
180
}
159
181
160
- .tab-container > nav > button .is-selected {
182
+ .tab-container > nav > button .is-selected {
161
183
background-color : var (--vp-code-block-bg );
162
184
}
163
185
164
- .tab-container > nav > button .is-selected svg {
186
+ .tab-container > nav > button .is-selected svg {
165
187
fill : var (--vp-code-block-color );
166
188
}
167
189
0 commit comments