|
12 | 12 | class="relative lg:mx-auto lg:max-w-md 2xl:max-w-md bg-secondary rounded-2xl"
|
13 | 13 | >
|
14 | 14 | <div
|
15 |
| - :class="classes[brandColor]" |
| 15 | + :class="brandClasses[authBrandColor]" |
16 | 16 | class="rounded-2xl lg:min-w-md 2xl:min-w-md"
|
17 | 17 | >
|
18 | 18 | <div
|
|
39 | 39 | <Auth
|
40 | 40 | :appearance="{
|
41 | 41 | theme: ThemeSupa,
|
42 |
| - brand: brandColor, |
43 |
| - shape: shape |
| 42 | + brand: authBrandColor, |
| 43 | + shape: authShape |
44 | 44 | }"
|
45 | 45 | :supabaseClient="supabaseClient"
|
46 | 46 | v-model:view="view"
|
|
65 | 65 | class="w-10 rounded-full p-2"
|
66 | 66 | :style="{
|
67 | 67 | background: backgroundColor,
|
68 |
| - color: brandColor |
| 68 | + color: authBrandColor |
69 | 69 | }"
|
70 | 70 | >
|
71 | 71 | <IconPalette />
|
|
103 | 103 | </div>
|
104 | 104 | <div class="flex items-center gap-3">
|
105 | 105 | <Button
|
| 106 | + v-for="color in brandList" |
| 107 | + :key="color" |
106 | 108 | variant="outline"
|
107 | 109 | size="icon"
|
108 | 110 | :class="
|
109 | 111 | cn(
|
110 |
| - 'rounded-full border-emerald-500 text-brand-foreground bg-emerald-500/20 hover:bg-emerald-500/50', |
111 |
| - brandColor === 'emerald' && |
112 |
| - 'bg-emerald-500 border-emerald-800 dark:border-emerald-200 border-2' |
| 112 | + `rounded-full border-${color}-500 text-brand-foreground bg-${color}-500/20 hover:bg-${color}-500/50`, |
| 113 | + authBrandColor === color && |
| 114 | + `bg-${color}-500 border-${color}-800 dark:border-${color}-200 border-2` |
113 | 115 | )
|
114 | 116 | "
|
115 |
| - @click="brandColor = 'emerald'" |
116 |
| - /> |
117 |
| - <Button |
118 |
| - variant="outline" |
119 |
| - size="icon" |
120 |
| - :class=" |
121 |
| - cn( |
122 |
| - 'rounded-full border-violet-500 text-brand-foreground bg-violet-500/20 hover:bg-violet-500/50', |
123 |
| - brandColor === 'violet' && |
124 |
| - 'bg-violet-500 border-violet-800 dark:border-violet-200 border-2' |
125 |
| - ) |
126 |
| - " |
127 |
| - @click="brandColor = 'violet'" |
128 |
| - /> |
129 |
| - <Button |
130 |
| - variant="outline" |
131 |
| - size="icon" |
132 |
| - :class=" |
133 |
| - cn( |
134 |
| - 'rounded-full border-fuchsia-500 text-brand-foreground bg-fuchsia-500/20 hover:bg-fuchsia-500/50', |
135 |
| - brandColor === 'fuchsia' && |
136 |
| - 'bg-fuchsia-500 border-fuchsia-800 dark:border-fuchsia-200 border-2' |
137 |
| - ) |
138 |
| - " |
139 |
| - @click="brandColor = 'fuchsia'" |
140 |
| - /> |
141 |
| - <Button |
142 |
| - variant="outline" |
143 |
| - size="icon" |
144 |
| - :class=" |
145 |
| - cn( |
146 |
| - 'rounded-full border-sky-500 text-brand-foreground bg-sky-500/20 hover:bg-sky-500/50', |
147 |
| - brandColor === 'sky' && |
148 |
| - 'bg-sky-500 border-sky-800 dark:border-sky-200 border-2' |
149 |
| - ) |
150 |
| - " |
151 |
| - @click="brandColor = 'sky'" |
152 |
| - /> |
153 |
| - <Button |
154 |
| - variant="outline" |
155 |
| - size="icon" |
156 |
| - :class=" |
157 |
| - cn( |
158 |
| - 'rounded-full border-amber-500 text-brand-foreground bg-amber-500/20 hover:bg-amber-500/50', |
159 |
| - brandColor === 'amber' && |
160 |
| - 'bg-amber-500 border-amber-800 dark:border-amber-200 border-2' |
161 |
| - ) |
162 |
| - " |
163 |
| - @click="brandColor = 'amber'" |
| 117 | + @click="authBrandColor = color" |
164 | 118 | />
|
165 | 119 | </div>
|
166 | 120 | </div>
|
|
172 | 126 | </div>
|
173 | 127 | <div class="flex items-center gap-3">
|
174 | 128 | <ToggleButton
|
175 |
| - v-model:selected="shape" |
| 129 | + v-model:selected="authShape" |
176 | 130 | :defaultValue="shapeList[0]"
|
177 | 131 | class="rounded-none border-b-0 border-l-0 bg-neutral-100 dark:bg-neutral-800"
|
178 | 132 | />
|
179 | 133 | <ToggleButton
|
180 |
| - v-model:selected="shape" |
| 134 | + v-model:selected="authShape" |
181 | 135 | :defaultValue="shapeList[1]"
|
182 | 136 | class="rounded-xl border-b-0 border-l-0 bg-neutral-100 dark:bg-neutral-800"
|
183 | 137 | />
|
184 | 138 | <ToggleButton
|
185 |
| - v-model:selected="shape" |
| 139 | + v-model:selected="authShape" |
186 | 140 | :defaultValue="shapeList[2]"
|
187 | 141 | class="rounded-2xl border-b-0 border-l-0 bg-neutral-100 dark:bg-neutral-800"
|
188 | 142 | />
|
@@ -284,7 +238,7 @@ const { supabaseUser } = useSupabaseUser(supabaseClient)
|
284 | 238 | const { locale } = useI18n()
|
285 | 239 | const { en, zh } = useLanguage()
|
286 | 240 |
|
287 |
| -const classes: { [key: string]: string } = { |
| 241 | +const brandClasses: { [key: string]: string } = { |
288 | 242 | emerald: 'container-emeraldshadow',
|
289 | 243 | violet: 'container-violetshadow',
|
290 | 244 | fuchsia: 'container-fuchsiashadow',
|
@@ -313,17 +267,17 @@ const views: { id: AuthViewType; title: string }[] = [
|
313 | 267 | { id: 'anonymous_sign_in', title: 'Anonymous Sign-ins' }
|
314 | 268 | ]
|
315 | 269 |
|
316 |
| -const brandColor = ref(brandList[0]) |
317 |
| -const shape = ref(shapeList[1]) |
| 270 | +const authBrandColor = ref(brandList[0]) |
| 271 | +const authShape = ref(shapeList[1]) |
318 | 272 | const socialLayout = ref(socialAlignments[0])
|
319 | 273 | const view = ref(views[0].id)
|
320 | 274 |
|
321 | 275 | const currentColor = computed(() => {
|
322 |
| - return colors[brandColor.value]['500'] |
| 276 | + return colors[authBrandColor.value]['500'] |
323 | 277 | })
|
324 | 278 | const backgroundColor = computed(() => {
|
325 | 279 | const opacity = isDark.value ? 0.2 : 0.48
|
326 |
| - const color = colors[brandColor.value]['500'] |
| 280 | + const color = colors[authBrandColor.value]['500'] |
327 | 281 | return colord(color).alpha(opacity).toRgbString()
|
328 | 282 | })
|
329 | 283 | const theme = computed(() => (isDark.value ? 'dark' : 'default'))
|
|
0 commit comments