Skip to content

Commit

Permalink
refactor(repo:app): deleta lucide-react package
Browse files Browse the repository at this point in the history
  • Loading branch information
David Rondio authored and David Rondio committed Oct 5, 2024
1 parent ca6bfe3 commit f150eec
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
52 changes: 52 additions & 0 deletions components/icons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
interface IconProps extends React.SVGProps<SVGSVGElement> {
size?: number | string;
className?: string;
}

const defaultIconStyle = 'inline-block';

export const SunIcon: React.FC<IconProps> = ({
size = 24,
className = '',
...props
}) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
className={`${defaultIconStyle} ${className}`}
{...props}
>
<path
d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);

export const MoonIcon: React.FC<IconProps> = ({
size = 24,
className = '',
...props
}) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
className={`${defaultIconStyle} ${className}`}
{...props}
>
<path
d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75 9.75 9.75 0 0 1 8.25 6c0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25 9.75 9.75 0 0 0 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
15 changes: 12 additions & 3 deletions components/theme-button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use client';

import { Moon, Sun } from 'lucide-react';
import { useTheme } from 'next-themes';
import { useEffect, useState } from 'react';

import { MoonIcon, SunIcon } from './icons';

const ThemeButton = () => {
const { resolvedTheme, setTheme } = useTheme();

Expand All @@ -22,9 +23,17 @@ const ThemeButton = () => {
onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}
>
{resolvedTheme === 'dark' ? (
<Sun className="h-5 w-5 text-white transition-all" />
<SunIcon
size={20}
className="h-5 w-5 text-white transition-all"
strokeWidth={2}
/>
) : (
<Moon className="h-5 w-5 text-slate-800" />
<MoonIcon
size={20}
className="h-5 w-5 text-slate-800 transition-all"
strokeWidth={2}
/>
)}
<span className="sr-only">Toggle theme</span>
</button>
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"lucide-react": "^0.446.0",
"postcss": "^8",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
Expand Down

0 comments on commit f150eec

Please sign in to comment.