Skip to content

Commit 98568b2

Browse files
committed
fix: restore dark theme UI and scope light mode styling using data-theme
1 parent 72d4ce2 commit 98568b2

7 files changed

Lines changed: 45 additions & 25 deletions

File tree

app/components/layout/Header/headerComponent.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ const HeaderComponent = () => {
368368
height={32}
369369
alt="Logo"
370370
title="betterbugs-logo"
371+
className={hederStyles.bbLogo}
371372
priority
372373
/>
373374
</Link>
@@ -459,7 +460,7 @@ const HeaderComponent = () => {
459460
target="_blank"
460461
>
461462
<Button
462-
className={`font-medium flex items-center rounded-full border !border-light-primary btn-gradient ${
463+
className={`${hederStyles.getStartedButton} font-medium flex items-center rounded-full border !border-light-primary btn-gradient ${
463464
isScrolled
464465
? 'scroll-gradient !text-base py-5 px-6'
465466
: 'bg-[#FFFFFF0D] !text-white/80 !text-base py-5 px-6'
@@ -492,6 +493,7 @@ const HeaderComponent = () => {
492493
height={32}
493494
alt="Logo"
494495
title="betterbugs-logo"
496+
className={hederStyles.bbLogo}
495497
priority
496498
/>
497499
</Link>
@@ -513,7 +515,7 @@ const HeaderComponent = () => {
513515
target="_blank"
514516
>
515517
<Button
516-
className={`btn-primary font-medium flex items-center rounded-full border !border-light-primary text-[#FFFFFF0D] hover:bg-primary scroll-gradient !text-base px-4 !h-10`}
518+
className={`${hederStyles.getStartedButton} btn-primary font-medium flex items-center rounded-full border !border-light-primary text-[#FFFFFF0D] hover:bg-primary scroll-gradient !text-base px-4 !h-10`}
517519
>
518520
Get started
519521
</Button>

app/components/layout/Header/headerStyles.module.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
background: rgba(255, 255, 255, 0.16);
101101
}
102102

103-
:global(html.light) & {
103+
:global([data-theme="light"]) & {
104104
background: rgba(17, 24, 39, 0.06);
105105
border-color: rgba(17, 24, 39, 0.2);
106106
color: #111827;
@@ -110,3 +110,13 @@
110110
}
111111
}
112112
}
113+
114+
:global([data-theme="light"]) .bbLogo {
115+
filter: brightness(0) saturate(100%);
116+
}
117+
118+
:global([data-theme="light"]) .getStartedButton {
119+
background: rgba(17, 24, 39, 0.88);
120+
border-color: rgba(17, 24, 39, 0.88);
121+
color: rgba(255, 255, 255, 0.9);
122+
}

app/components/layout/footer/footerComponent.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import { Col, Row } from 'antd';
1010
import YouTubeIcon from '../../theme/Icon/youTubeIcon';
1111
import DiscordIcon from '../../theme/Icon/discordIcon';
1212
import { WEB_URL } from '@/app/libs/constants';
13+
import { useTheme } from '@/app/contexts/themeContext';
1314

1415
const FooterComponent = () => {
16+
const { isLightTheme } = useTheme();
1517
const pathname = usePathname();
1618
const router = useRouter();
1719
const [sectionId, setSectionId] = useState<string | null>(null);
@@ -262,7 +264,7 @@ const FooterComponent = () => {
262264
height={100}
263265
alt="Logo"
264266
title="betterbugs-logo"
265-
className="mx-2 w-[211px] lg:w-[470px]"
267+
className="mx-2 w-[211px] lg:w-[470px] bb-logo"
266268
priority
267269
/>
268270
</Link>
@@ -322,7 +324,7 @@ const FooterComponent = () => {
322324
</p>
323325
<p className="text-sm text-white/70 md:text-base font-normal cursor-pointer">
324326
<iframe
325-
src="https://status.betterbugs.io/badge?theme=dark"
327+
src={`https://status.betterbugs.io/badge?theme=${isLightTheme ? 'light' : 'dark'}`}
326328
width="200"
327329
height="30"
328330
frameBorder="0"

app/contexts/themeContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export const ThemeProvider = ({ children }: { children: ReactNode }) => {
3838
const root = document.documentElement;
3939
root.classList.remove("light", "dark");
4040
root.classList.add(theme);
41+
root.setAttribute("data-theme", theme);
42+
root.style.colorScheme = theme;
4143

4244
if (!hasHydrated) {
4345
return;

app/developmentToolsStyles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
}
4646
}
4747

48-
:global(html.light) .searchInput {
48+
:global([data-theme="light"]) .searchInput {
4949
input {
5050
border: 1px solid #000000;
5151
color: #000000;

app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const MyApp = ({ children }: { children: JSX.Element }): JSX.Element => {
3030
});
3131

3232
return (
33-
<html lang="en" className="dark">
33+
<html lang="en" className="dark" data-theme="dark">
3434
<head>
3535
<meta
3636
name="google-site-verification"

app/styles/global.scss

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,50 @@ body {
3131
}
3232
}
3333

34-
html.dark {
34+
html[data-theme="dark"] {
3535
color-scheme: dark;
3636
}
3737

38-
html.light {
38+
html[data-theme="light"] {
3939
color-scheme: light;
4040
}
4141

42-
html.light,
43-
html.light body {
42+
html[data-theme="light"],
43+
html[data-theme="light"] body {
4444
background-color: #ffffff;
4545
color: #111827;
4646
}
4747

48-
html.light .bg-black,
49-
html.light .bg-\[\#111111\] {
48+
html[data-theme="light"] .bg-black,
49+
html[data-theme="light"] .bg-\[\#111111\] {
5050
background-color: #ffffff;
5151
}
5252

53-
html.light .text-white,
54-
html.light .text-white\/80,
55-
html.light .text-white\/70,
56-
html.light .text-white\/60 {
53+
html[data-theme="light"] .text-white,
54+
html[data-theme="light"] .text-white\/80,
55+
html[data-theme="light"] .text-white\/70,
56+
html[data-theme="light"] .text-white\/60 {
5757
color: #111827;
5858
}
5959

60-
html.light .border-light-primary,
61-
html.light .border-t-light-primary,
62-
html.light .\!border-light-primary {
60+
html[data-theme="light"] .border-light-primary,
61+
html[data-theme="light"] .border-t-light-primary,
62+
html[data-theme="light"] .\!border-light-primary {
6363
border-color: #d1d5db;
6464
}
6565

66-
html.light .tab-gradient,
67-
html.light .grey-gradient,
68-
html.light .feature-gradient,
69-
html.light .cardGradient,
70-
html.light .boxGradient {
66+
html[data-theme="light"] .tab-gradient,
67+
html[data-theme="light"] .grey-gradient,
68+
html[data-theme="light"] .feature-gradient,
69+
html[data-theme="light"] .cardGradient,
70+
html[data-theme="light"] .boxGradient {
7171
background: #f3f4f6;
7272
}
7373

74+
html[data-theme="light"] .bb-logo {
75+
filter: brightness(0) saturate(100%);
76+
}
77+
7478
h1,
7579
h2,
7680
h3,

0 commit comments

Comments
 (0)