Skip to content

Commit

Permalink
nullish operator
Browse files Browse the repository at this point in the history
  • Loading branch information
ChurroC authored Mar 11, 2024
1 parent 0c70c3e commit 1708c78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// This will cause a rehydration issue but it is what it is
console.log("theme");
if (
JSON.parse(localStorage.getItem("theme") || '""') === "dark" ||
JSON.parse(localStorage.getItem("theme") ?? '""') === "dark" ||
((!localStorage.getItem("theme") ||
JSON.parse(localStorage.getItem("theme") || '""') === "system") &&
JSON.parse(localStorage.getItem("theme") ?? '""') === "system") &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
) {
document.documentElement.classList.add("dark");
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function Dropdown({
className?: string;
}) {
const { top, bottom, right, left } =
referenceElement.current?.getBoundingClientRect() || {
referenceElement.current?.getBoundingClientRect() ?? {
top: 0,
bottom: 0,
right: 0,
Expand Down

0 comments on commit 1708c78

Please sign in to comment.