Skip to content

Commit c424010

Browse files
committed
add theming
1 parent ae0f1a2 commit c424010

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
@use '../../styles/mixins' as *;
2-
@use '../../styles/variables' as *;
3-
41
.contactCards {
5-
background-color: $white;
2+
background-color: var(--white);
63
}

components/layout/Layout/index.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { useRouter } from 'next/router';
2-
import { heroOptions } from '@/utils/hero-options';
3-
import Hero from '@/components/layout/Hero';
4-
import Meta from '@/components/layout/Meta';
5-
import Footer from '@/components/layout/Footer';
6-
import S from './styles';
7-
8-
export default function Layout({ children }) {
9-
const router = useRouter();
10-
const heroPathKeys = Object.keys(heroOptions)
11-
.sort((a, b) => a - b)
12-
.filter(k => router.pathname.startsWith(k));
13-
14-
const heroKey = heroPathKeys[heroPathKeys.length - 1];
15-
return (
16-
<>
17-
<Meta />
18-
<S.Main>
19-
<Hero {...heroOptions[heroKey]} />
20-
{children}
21-
<Footer />
22-
</S.Main>
23-
</>
24-
);
25-
}
1+
import { useRouter } from 'next/router';
2+
import { heroOptions } from '@/utils/hero-options';
3+
import Hero from '@/components/layout/Hero';
4+
import Meta from '@/components/layout/Meta';
5+
import Footer from '@/components/layout/Footer';
6+
import S from './styles';
7+
8+
export default function Layout({ children }) {
9+
const router = useRouter();
10+
const heroPathKeys = Object.keys(heroOptions)
11+
.sort((a, b) => a - b)
12+
.filter(k => router.pathname.startsWith(k));
13+
14+
const heroKey = heroPathKeys[heroPathKeys.length - 1];
15+
return (
16+
<>
17+
<Meta />
18+
<S.Main>
19+
<Hero {...heroOptions[heroKey]} />
20+
{children}
21+
<Footer />
22+
</S.Main>
23+
</>
24+
);
25+
}

pages/_app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Layout from '@/components/layout/Layout';
22
import { useState } from 'react';
33
import { ThemeProvider } from 'styled-components';
44
import { lightTheme, darkTheme, GlobalStyles } from '@/styles/themeConfig';
5+
import '@/styles/index.scss';
56

67
function MyApp({ Component, pageProps }) {
7-
88
// Only uncomment when the darkTheme is set
99
// const [theme, setTheme] = useState('light');
1010
// const toggleTheme = () => {

styles/index.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@use './themes';
2+
@use './mixins';
3+
@use './variables';

styles/themes.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:root {
2+
--white: #ffffff;
3+
--bg-color: #eaeaea;
4+
}
5+
6+
[data-theme='dark'] {
7+
--bg-color: #333;
8+
}
9+
10+
// Theming notes:
11+
/*
12+
Set document data-theme to dark to activate dark theme, for example
13+
document.documentElement.setAttribute('data-theme', 'dark');
14+
*/

0 commit comments

Comments
 (0)