Skip to content

Commit a2d5e2a

Browse files
authored
feat: add dark mode and full theming support (#81)
1 parent 99299a3 commit a2d5e2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+820
-506
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"plugins": ["prettier", "@typescript-eslint"],
1111
"rules": {
1212
"@typescript-eslint/explicit-module-boundary-types": "off",
13-
"@typescript-eslint/no-explicit-any": "off"
13+
"@typescript-eslint/no-explicit-any": "off",
14+
"@typescript-eslint/no-non-null-assertion": "off"
1415
}
1516
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# hey pal, here is the code that builds my website
1+
# hi friend, here is the code that builds my website
22

33
made with [preact](https://preactjs.com/), [next.js](https://nextjs.org/), [typescript](https://www.typescriptlang.org/), [goober](https://github.com/cristianbote/goober), [storeon](https://github.com/storeon/storeon), and a whole lotta googling.

SHITLIST.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ still to do
22

33
- [ ] visual regression testing
44
- [x] 404 page
5-
- [ ] themeing & dark mode
6-
- [ ] easter egg
7-
- [ ] accessibility (contrast/reduce motion) options
5+
- [x] themeing & dark mode
6+
- [x] easter egg
7+
- [x] accessibility (contrast/reduce motion) options
88
- [x] add api routes for custom status and location check-in
99
- [x] add 'my work' page
10+
- [x] move blog to craft

next.config.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ module.exports = withPreact({
1414
}
1515
return config;
1616
},
17-
rewrites: async () => {
18-
return [
19-
{
20-
source: '/work',
21-
destination: '/',
22-
},
23-
];
24-
},
17+
rewrites: async () => [
18+
{
19+
source: '/work',
20+
destination: '/',
21+
},
22+
],
2523
experimental: {
2624
modern: true,
2725
},

src/components/Bio/About.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { FC } from 'react';
22

3-
import { useSiteStore } from 'services/store';
3+
import { useStore } from 'services/store';
44
import { Link, Text } from 'components/core';
55
import DynamicTime from 'components/DynamicTime';
66
import DynamicTagline from 'components/DynamicTagline';
77
import DynamicCurrentStatus from 'components/DynamicCurrentStatus';
88

99
const About: FC = () => {
10-
const { talkingPoint, currentCity } = useSiteStore(
11-
'talkingPoint',
12-
'currentCity'
13-
);
10+
const { talkingPoint, currentCity } = useStore('talkingPoint', 'currentCity');
1411

1512
return (
1613
<>

src/components/Bio/Work.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { FC, memo } from 'react';
22

33
import { Link, Text } from 'components/core';
44
import { PAST_EXPERIENCE } from 'services/copy';
5-
import { useSiteStore } from 'services/store';
5+
import { useStore } from 'services/store';
66

77
const Work: FC = memo(() => {
8-
const { githubStats } = useSiteStore('githubStats');
8+
const { githubStats } = useStore('githubStats');
99
const latestRepo = githubStats?.reposCommittedTo[0] ?? null;
1010

1111
return (
@@ -39,8 +39,10 @@ const Work: FC = memo(() => {
3939
return (
4040
<>
4141
{isLast ? ' and ' : ' '}
42-
<Link href={href} newTab style={{ color }} bare>
43-
<Text bold>{label}</Text>
42+
<Link href={href} newTab bare>
43+
<Text bold color={color}>
44+
{label}
45+
</Text>
4446
</Link>
4547
{isLast ? '.' : ','}
4648
</>

src/components/Bio/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { FC, useEffect } from 'react';
22
import { styled } from 'goober';
33

4-
import { useSiteStore } from 'services/store';
5-
import { screen } from 'services/utils';
4+
import { useStore } from 'services/store';
5+
import { screen } from 'services/style';
66

77
import About from './About';
88
import Work from './Work';
@@ -31,7 +31,7 @@ const Subcontainer = styled('div')`
3131
`;
3232

3333
const Bio: FC = () => {
34-
const { dispatch, displayedSection } = useSiteStore('displayedSection');
34+
const { dispatch, displayedSection } = useStore('displayedSection');
3535

3636
useEffect(() => {
3737
if (process.browser && window.location.pathname === '/work') {

src/components/CoverArt.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@ import { css, keyframes } from 'goober';
22
import { FC, memo } from 'react';
33

44
import { useStoreFocusListeners } from 'services/store/utils';
5-
import { screen } from 'services/utils';
5+
import { screen } from 'services/style';
66

77
type TCoverArtProps = { link: string; src: string; color: string };
88

99
const rotate = keyframes`
10-
from {
11-
transform: rotate(0deg);
12-
}
13-
14-
to {
15-
transform: rotate(360deg);
16-
}
10+
from { transform: rotate(0deg); }
11+
to { transform: rotate(360deg); }
1712
`;
1813

1914
const CoverArtLink = css`

src/components/DynamicCurrentStatus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { memo, FC, useCallback, useEffect } from 'react';
22
import TextLoop from 'react-text-loop';
33

4-
import { useSiteStore } from 'services/store';
4+
import { useStore } from 'services/store';
55
import { TNowPlayingData, isNowPlayingData } from 'services/now-playing';
66
import {
77
textLoopIntervals,
@@ -45,7 +45,7 @@ const nowPlayingMarkup = ({
4545
};
4646

4747
const DynamicCurrentStatus: FC = memo(() => {
48-
const { dispatch, statuses } = useSiteStore('statuses');
48+
const { dispatch, statuses } = useStore('statuses');
4949
const statusesMarkup = statuses.map((status) =>
5050
isNowPlayingData(status) ? nowPlayingMarkup(status) : status.split(' ')
5151
);

src/components/DynamicFavicon.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ import { useState, FC } from 'react';
33

44
import { useVisibilityChange } from 'services/utils';
55

6-
const DynamicFavicon: FC = () => {
6+
const DynamicFavicon: FC<{ face?: 'smile' | 'mad' }> = ({ face }) => {
77
const [isAway, setAway] = useState(false);
88
useVisibilityChange(setAway);
99

10+
const dynamicFace = face ?? isAway ? 'mad' : 'smile';
11+
const href = dynamicFace === 'mad' ? '/favicon-away.png' : '/favicon.png';
12+
1013
return (
1114
<Head>
12-
<link
13-
rel="shortcut icon"
14-
type="image/png"
15-
href={isAway ? '/favicon-away.png' : '/favicon.png'}
16-
/>
15+
<link rel="shortcut icon" type="image/png" href={href} />
1716
</Head>
1817
);
1918
};

0 commit comments

Comments
 (0)