Skip to content

Commit

Permalink
fix: dev errors + outdated scss
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjosethomas committed Feb 4, 2025
1 parent 61599b6 commit 9f62316
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "next-app",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"dev": "next dev",
"build": "next build",
"start": "next start",
"export": "next export",
Expand All @@ -17,8 +17,8 @@
"@vercel/analytics": "^1.3.1",
"chart.js": "^4.4.2",
"chess.ts": "^0.16.2",
"chessground": "^8.3.5",
"chroma-js": "^2.4.2",
"classnames": "^2.3.1",
"exponential-backoff": "^3.1.1",
"framer-motion": "^11.5.6",
"gray-matter": "^4.0.3",
Expand Down
8 changes: 6 additions & 2 deletions src/hooks/useLocalStorage/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export const useLocalStorage = <T>(
): [T, (arg0: T) => void] => {
const isClient = typeof window !== 'undefined'
const [storedValue, setStoredValue] = useState<T>(() => {
if (!isClient) {
return initialValue
}
try {
const item = window.localStorage.getItem(key)
return item ? JSON.parse(item) : initialValue
Expand All @@ -20,8 +23,9 @@ export const useLocalStorage = <T>(
const valueToStore =
value instanceof Function ? value(storedValue) : value
setStoredValue(valueToStore)
if (isClient)
window?.localStorage?.setItem(key, JSON.stringify(valueToStore))
if (isClient) {
window.localStorage.setItem(key, JSON.stringify(valueToStore))
}
} catch (error) {
console.error(error)
}
Expand Down
22 changes: 11 additions & 11 deletions src/styles/_base.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
@import './theme';
@import './layout';
@use 'theme';
@use 'layout';

@mixin rounded {
border-radius: 10px;
}

@mixin shadowed {
@include themed-styles {
filter: drop-shadow(0px 2px 8px rgba(themed-colour('background0'), 1));
@include theme.themed-styles {
filter: drop-shadow(0px 2px 8px rgba(theme.themed-colour('background0'), 1));
}
}

@mixin boxed {
@include rounded;
@include themed-styles {
background-color: rgba(themed-colour('background0'), 0.75);
@include theme.themed-styles {
background-color: rgba(theme.themed-colour('background0'), 0.75);
}
}

@mixin scroll {
&::-webkit-scrollbar {
width: 7px;

@include mobile {
@include layout.mobile {
width: 4px;
height: 8px;
}
Expand All @@ -36,13 +36,13 @@
border-radius: 1px;
transition: 150ms;

@include themed-styles {
background-color: rgba(themed-colour('human-accent'), 0.4);
@include theme.themed-styles {
background-color: rgba(theme.themed-colour('human-accent'), 0.4);
}

&:hover {
@include themed-styles {
background-color: rgba(themed-colour('human-accent'), 0.65);
@include theme.themed-styles {
background-color: rgba(theme.themed-colour('human-accent'), 0.65);
}
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/styles/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@use 'sass:map';

$theme-map: null !default;

$themes: (
light: (
backdrop: #f6f6f6,
Expand Down Expand Up @@ -28,8 +32,8 @@ $themes: (
:global(.theme-#{$theme}) & {
$theme-map: () !global;
@each $key, $submap in $map {
$value: map-get($map, '#{$key}');
$theme-map: map-merge(
$value: map.get($map, '#{$key}');
$theme-map: map.merge(
$theme-map,
(
$key: $value,
Expand All @@ -45,8 +49,8 @@ $themes: (
.theme-#{$theme} & {
$theme-map: () !global;
@each $key, $submap in $map {
$value: map-get($map, '#{$key}');
$theme-map: map-merge(
$value: map.get($map, '#{$key}');
$theme-map: map.merge(
$theme-map,
(
$key: $value,
Expand All @@ -60,5 +64,5 @@ $themes: (
}

@function themed-colour($key) {
@return map-get($theme-map, $key);
@return map.get($theme-map, $key);
}
26 changes: 13 additions & 13 deletions src/styles/globals.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import './theme';
@import './layout';
@import './fonts';
@import './base';
@use 'theme';
@use 'layout';
@use 'fonts';
@use 'base';

button {
&:disabled {
Expand Down Expand Up @@ -31,12 +31,12 @@ a {

width: 100%;
min-height: 100vh;
@include themed-styles {
background-color: themed-colour(backdrop);
color: themed-colour(text-primary);
@include theme.themed-styles {
background-color: theme.themed-colour(backdrop);
color: theme.themed-colour(text-primary);
}

@include mobile {
@include layout.mobile {
flex-direction: column;
overflow-x: hidden;
}
Expand All @@ -45,7 +45,7 @@ a {
.content-container {
flex-grow: 1;
position: relative;
@include rounded;
@include base.rounded;
display: flex;
flex-direction: column;
}
Expand All @@ -65,7 +65,7 @@ h5 {
flex-grow: 1;
margin-left: 2vw;

@include mobile {
@include layout.mobile {
flex-direction: column;
margin-left: 0px;
}
Expand All @@ -79,7 +79,7 @@ h5 {
flex-grow: 1;
padding: 2em;

@include mobile {
@include layout.mobile {
width: 100%;
padding: 1em;
max-width: none;
Expand All @@ -96,15 +96,15 @@ h5 {
gap: 10px;
margin: 10px;

@include mobile {
@include layout.mobile {
margin: 0px;
width: 100%;
max-width: none;
}
}

.action {
@include boxed;
@include base.boxed;
width: 100%;
padding: 25px;
}

0 comments on commit 9f62316

Please sign in to comment.