Skip to content

Commit 4d1a308

Browse files
committed
refactor: add light mode for product landing page
See: FE-144
1 parent 4b655ef commit 4d1a308

File tree

17 files changed

+192
-77
lines changed

17 files changed

+192
-77
lines changed

frontend/i18n/locales/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"side_navigation": "Side Navigation"
1616
},
1717
"footer": {
18+
"color_mode": {
19+
"dark": "Dark",
20+
"light": "Light",
21+
"title": "Color Mode"
22+
},
1823
"copyright": "© {year} beaconcha.in. All rights reserved",
1924
"imprint": "Imprint",
2025
"links": {

frontend/layers/base/app/components/BaseButtonIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const {
3131
<component
3232
:is="to ? NuxtLink : 'button'"
3333
:to
34-
class="border border-transparent flex rounded-full bg-linear-to-b disabled:opacity-40 aria-disabled:opacity-40 active:opacity-80 size-fit"
34+
class="border flex rounded-full bg-linear-to-b disabled:opacity-40 aria-disabled:opacity-40 active:opacity-80 size-fit"
3535
:class="[
36-
variant === 'secondary' && 'from-gray-300 to-gray-200 dark:from-charcoal-600 dark:to-charcoal-700 opacity-90',
36+
variant === 'secondary' && 'from-gray-300 to-gray-200 dark:from-charcoal-600 dark:to-charcoal-700 opacity-90 border-transparent',
3737
variant === 'tertiary' && 'dark:border-charcoal-400 border-gray-200',
3838
size === 'md' && 'p-md',
3939
size === 'lg' && 'p-md',

frontend/layers/base/app/components/BaseCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const id = useId()
2626
</script>
2727

2828
<template>
29-
<div class="dark:bg-gray-950 p-3xl rounded-4xl flex flex-col gap-2xl w-full">
29+
<div class="dark:bg-gray-950 border border-gray-100 dark:border-gray-900 p-3xl rounded-4xl flex flex-col gap-2xl w-full">
3030
<slot name="header">
3131
<header
3232
v-if="title"

frontend/layers/base/app/components/BaseIcon.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const customize = (content: string) => {
1616

1717
<template>
1818
<Icon
19+
aria-hidden="true"
1920
:name="`tabler:${name}`"
2021
:customize
22+
mode="svg"
2123
/>
2224
</template>

frontend/layers/base/app/components/BaseNavigation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const v1Domain = useV1Domain()
1919
</script>
2020

2121
<template>
22-
<nav class="p-2xl isolate">
22+
<nav class="p-2xl isolate bg-gray-50 dark:bg-transparent">
2323
<div class="max-w-8xl mx-auto grid gap-2xl [&>*]:[grid-area:1/1]">
2424
<span class="flex gap-2xl items-center z-10 w-fit">
2525
<BaseButtonIcon

frontend/layers/base/app/components/BaseNavigationItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defineProps<BaseNavigationItem>()
1313

1414
<template>
1515
<NuxtLink
16-
class="font-semibold flex gap-md items-center p-md bg-linear-to-b rounded-full from-gray-300 to-gray-200 dark:from-charcoal-600 dark:to-charcoal-700 opacity-90 hover:opacity-95 text-sm"
16+
class="font-semibold flex gap-md items-center py-sm px-md bg-linear-to-b rounded-full border border-gray-200 dark:border-transparent dark:from-charcoal-600 dark:to-charcoal-700 opacity-90 hover:opacity-95 text-sm"
1717
:to
1818
>
1919
<BaseIcon :name="icon" />

frontend/layers/base/app/components/BaseSearchInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const handleClickOutside = (e: PointerDownOutsideEvent) => {
8585
:aria-busy="isLoading"
8686
:placeholder
8787
class="search-input w-full text-2xl font-semibold rounded-3xl pt-3xl pr-5xl pb-6xl pl-2xl dark:bg-gray-950
88-
dark:focus:bg-black placeholder:dark:text-gray-500 dark:text-white border-1 dark:border-charcoal-500
88+
bg-white dark:focus:bg-black placeholder:dark:text-gray-500 dark:text-white border border-gray-500 dark:border-charcoal-500
8989
dark:focus:border-charcoal-50 dark:focus-within:outline-0"
9090
@update:model-value="(value) => { if (!value) hasSearched = false }"
9191
/>

frontend/layers/base/app/components/BaseSwitch.vue

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,20 @@ watch(modelValue, () => {
6060
:class="classList?.trackItem"
6161
class="relative"
6262
>
63-
<span
64-
class="relative z-10"
65-
>
66-
{{ values[0]?.label }}
63+
<span class="relative z-10">
64+
<slot
65+
name="first"
66+
:label="values[0]?.label"
67+
>
68+
{{ values[0]?.label }}
69+
</slot>
6770
</span>
6871
<input
6972
:id="idFirstValue"
7073
v-model="modelValue"
7174
:value="values[0]?.key"
7275
type="radio"
73-
class="appearance-none"
76+
class="sr-only"
7477
:name
7578
>
7679
<span
@@ -85,16 +88,19 @@ watch(modelValue, () => {
8588
:class="classList?.trackItem"
8689
:for="idSecondValue"
8790
>
88-
<span
89-
class="relative z-10"
90-
>
91-
{{ values[1]?.label }}
91+
<span class="relative z-10">
92+
<slot
93+
name="second"
94+
:label="values[1]?.label"
95+
>
96+
{{ values[1]?.label }}
97+
</slot>
9298
</span>
9399
<input
94100
:id="idSecondValue"
95101
v-model="modelValue"
96102
:value="values[1]?.key"
97-
class="appearance-none"
103+
class="sr-only"
98104
type="radio"
99105
:name
100106
>

frontend/layers/base/app/components/BaseTabs.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const props = defineProps<{
99
activeTabIndicator?: string,
1010
tab?: string,
1111
tablist?: string,
12+
tabpanel?: string,
1213
},
1314
defaultSelectedTab?: number,
1415
hasFocusableElement?: boolean,
@@ -137,6 +138,7 @@ watch(selectedTab, (newValue, oldValue) => {
137138
<article
138139
v-if="selectedTab === index"
139140
:id="`${idTabPanel}-${index}`"
141+
:class="classList?.tabpanel"
140142
tabindex="0"
141143
role="tabpanel"
142144
:aria-labelledby="`${idTab}-${index}`"

frontend/layers/base/app/components/TheFooter.vue

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ const resourceLinks: Link[] = [
4040
href: 'https://status.beaconcha.in/', icon: 'circle-check-filled', text: $t('base.footer.resources.links.site_status'),
4141
},
4242
]
43+
const colorMode = useColorMode()
4344
</script>
4445

4546
<template>
4647
<div
47-
class="bg-gray-50 dark:bg-gray-950 flex flex-col gap-3xl sm:gap-5xl pt-3xl px-xl pb-7xl sm:px-5xl sm:py-7xl sm:rounded-4xl sm:mb-xl max-w-24xl mx-auto"
48+
class="bg-gray-50 dark:bg-gray-950 flex flex-col gap-3xl sm:gap-5xl pt-3xl px-xl pb-7xl sm:px-5xl sm:py-7xl sm:rounded-4xl sm:mb-xl max-w-24xl mx-auto [&_*:focus-visible]:rounded-3xl [&_*:focus-visible]:outline-offset-4"
4849
>
4950
<NuxtLink
5051
to="/"
@@ -168,6 +169,35 @@ const resourceLinks: Link[] = [
168169
/>
169170
</li>
170171
</ul>
172+
<BaseSwitch
173+
v-model="colorMode.value"
174+
class="w-fit -ml-[1px]"
175+
:values="[
176+
{
177+
label: $t('base.footer.color_mode.light'),
178+
key: 'light',
179+
},
180+
{
181+
label: $t('base.footer.color_mode.dark'),
182+
key: 'dark',
183+
},
184+
]"
185+
:class-list="{
186+
trackItem: 'p-md +py-md +px-lg border border-transparent rounded-4xl text-gray-600 dark:text-gray-400 has-checked:text-black has-checked:dark:text-white has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-brand-300',
187+
track: 'border border-gray-100 dark:border-gray-900 flex gap-md [&>*]:grow text-center bg-white dark:bg-gray-950 rounded-4xl shadow-[0_1px_0.5px_0_rgba(255,255,255,0.08)_inset,0-1px_0_0_rgba(255,255,255,0.18)_inset]',
188+
thumb: 'bg-gray-50 dark:bg-gray-800 rounded-4xl shadow-[0_2px_2px_0_rgba(0,0,0,0.25),_0_0.5px_0.5px_0_rgba(255,255,255,0.12)_inset]',
189+
}"
190+
screenreader-title="base.footer.color_mode.title"
191+
>
192+
<template #first=" { label } ">
193+
<BaseIcon name="sun" />
194+
<span class="sr-only">{{ label }}</span>
195+
</template>
196+
<template #second=" { label } ">
197+
<BaseIcon name="moon" />
198+
<span class="sr-only">{{ label }}</span>
199+
</template>
200+
</BaseSwitch>
171201
</div>
172202
</div>
173203

0 commit comments

Comments
 (0)