Skip to content

Commit

Permalink
frontend: Changed the background color for the dark mode. Switched fr…
Browse files Browse the repository at this point in the history
…om Radix Icons to Lucide Icons. Improved notiication and theme switcher styles.
  • Loading branch information
kkomelin committed May 14, 2024
1 parent a977422 commit 3eb3301
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"@mysten/bcs": "^0.11.1",
"@mysten/dapp-kit": "^0.13.0",
"@mysten/sui.js": "^0.54.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/themes": "^3.0.3",
"@tanstack/react-query": "^5.36.0",
"clsx": "^2.1.1",
"lucide-react": "^0.378.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AnimatedBackground = () => {
<svg
// width="100%"
// height="100%"
id="svg"
// id="svg"
viewBox="0 0 1440 590"
xmlns="http://www.w3.org/2000/svg"
className="absolute bottom-0 left-0 -z-50 object-cover opacity-70 transition delay-150 duration-300 ease-in-out"
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/components/Notification.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Cross1Icon } from '@radix-ui/react-icons'
import { Button } from '@radix-ui/themes'
import c from 'clsx'
import { XIcon } from 'lucide-react'
import { FC, PropsWithChildren } from 'react'
import toast, { ToastType } from 'react-hot-toast'

Expand All @@ -21,10 +21,10 @@ const Notification: FC<PropsWithChildren<INotification>> = ({
{isCloseButtonVisible && (
<Button
variant="ghost"
className="cursor-pointer text-sds-dark dark:text-sds-light"
className="cursor-pointer pr-0 text-sds-dark dark:text-sds-light"
onClick={() => toast.dismiss(id)}
>
<Cross1Icon />
<XIcon />
</Button>
)}
</div>
Expand Down
10 changes: 7 additions & 3 deletions packages/frontend/src/components/ThemeSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { detectBrowserTheme } from '@/helpers/theme'
import { MoonIcon, SunIcon } from '@radix-ui/react-icons'
import * as Toggle from '@radix-ui/react-toggle'
import { MoonIcon, SunIcon } from 'lucide-react'
import { useEffect } from 'react'
import { useLocalStorage } from 'react-use'

Expand All @@ -20,11 +20,15 @@ const ThemeSwitcher = () => {

return (
<Toggle.Root
className="rounded-full border border-sds-dark p-2 dark:border-sds-light"
className="rounded-full p-2 shadow"
aria-label="Toggle theme"
onPressedChange={toggleTheme}
>
{theme === 'dark' ? <SunIcon /> : <MoonIcon />}
{theme === 'dark' ? (
<SunIcon className="h-5 w-5" />
) : (
<MoonIcon className="h-5 w-5" />
)}
</Toggle.Root>
)
}
Expand Down
6 changes: 5 additions & 1 deletion packages/frontend/src/providers/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { Theme } from '@radix-ui/themes'
import { FC, PropsWithChildren } from 'react'

const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {
return <Theme className="w-full">{children}</Theme>
return (
<Theme className="w-full bg-sds-light text-sds-dark dark:bg-sds-dark dark:text-sds-light">
{children}
</Theme>
)
}

export default ThemeProvider
2 changes: 1 addition & 1 deletion packages/frontend/src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@apply font-inter;

--sds-light: #ffffffde;
--sds-dark: #242424;
--sds-dark: #011631;
--sds-pink: #fed5f4;
--sds-blue: #4da2ff;

Expand Down
42 changes: 21 additions & 21 deletions pnpm-lock.yaml

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

0 comments on commit 3eb3301

Please sign in to comment.