refactor: Consistently use arrow functions for components
Converts all functional components from the function Component() {} declaration to the const Component = () => {} syntax. This change improves consistency across the codebase.
This commit is contained in:
@@ -2,7 +2,7 @@ import PageContainer from './PageContainer';
|
|||||||
import Sidebar from './Sidebar';
|
import Sidebar from './Sidebar';
|
||||||
import { ToggleTheme } from './ToggleTheme';
|
import { ToggleTheme } from './ToggleTheme';
|
||||||
|
|
||||||
function MainContainer() {
|
const MainContainer = () => {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-screen">
|
<div className="flex h-screen">
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
@@ -12,6 +12,6 @@ function MainContainer() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default MainContainer;
|
export default MainContainer;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Dashboard from './pages/Dashboard';
|
|||||||
import Todos from './pages/Todos';
|
import Todos from './pages/Todos';
|
||||||
import NotFound from './pages/default/NotFound';
|
import NotFound from './pages/default/NotFound';
|
||||||
|
|
||||||
function PageContainer() {
|
const PageContainer = () => {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col flex-1">
|
<div className="flex flex-col flex-1">
|
||||||
<Topbar />
|
<Topbar />
|
||||||
@@ -19,6 +19,6 @@ function PageContainer() {
|
|||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default PageContainer;
|
export default PageContainer;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const items = [
|
|||||||
{ name: 'Calendar', href: '/calendar', icon: IconCalendarWeekFilled },
|
{ name: 'Calendar', href: '/calendar', icon: IconCalendarWeekFilled },
|
||||||
];
|
];
|
||||||
|
|
||||||
function Sidebar() {
|
const Sidebar = () => {
|
||||||
const [location] = useLocation();
|
const [location] = useLocation();
|
||||||
return (
|
return (
|
||||||
<nav className="flex flex-col min-w-[240px] max-w-[480px] bg-sidebar border">
|
<nav className="flex flex-col min-w-[240px] max-w-[480px] bg-sidebar border">
|
||||||
@@ -37,6 +37,6 @@ function Sidebar() {
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Sidebar;
|
export default Sidebar;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { useTheme } from '../hooks/useThemeHook';
|
import { useTheme } from '../hooks/useThemeHook';
|
||||||
import { changeTheme } from '../lib/utils';
|
import { changeTheme } from '../lib/utils';
|
||||||
|
|
||||||
export function ToggleTheme() {
|
export const ToggleTheme = () => {
|
||||||
const { theme, toggleTheme } = useTheme();
|
const { theme, toggleTheme } = useTheme();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -19,4 +19,4 @@ export function ToggleTheme() {
|
|||||||
<span className="sr-only">Toggle theme</span>
|
<span className="sr-only">Toggle theme</span>
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { items } from './Sidebar';
|
import { items } from './Sidebar';
|
||||||
import { useLocation } from 'wouter';
|
import { useLocation } from 'wouter';
|
||||||
|
|
||||||
function Topbar() {
|
const Topbar = () => {
|
||||||
const [location] = useLocation();
|
const [location] = useLocation();
|
||||||
return (
|
return (
|
||||||
<div className="flex bg-sidebar p-2 gap-2 border-t border-r border-b border-l-0">
|
<div className="flex bg-sidebar p-2 gap-2 border-t border-r border-b border-l-0">
|
||||||
@@ -12,6 +12,6 @@ function Topbar() {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Topbar;
|
export default Topbar;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
function Dashboard() {
|
const Dashboard = () => {
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<h1 className="text-2xl font-bold">Dashboard</h1>
|
<h1 className="text-2xl font-bold">Dashboard</h1>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Dashboard;
|
export default Dashboard;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
function Home() {
|
const Home = () => {
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<h1 className="text-2xl font-bold">Home</h1>
|
<h1 className="text-2xl font-bold">Home</h1>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Home;
|
export default Home;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
function Todos() {
|
const Todos = () => {
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<h1 className="text-2xl font-bold">Todos</h1>
|
<h1 className="text-2xl font-bold">Todos</h1>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Todos;
|
export default Todos;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
function NotFound() {
|
const NotFound = () => {
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<h1 className="text-2xl font-bold">404 - Not Found!</h1>
|
<h1 className="text-2xl font-bold">404 - Not Found!</h1>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default NotFound;
|
export default NotFound;
|
||||||
|
|||||||
Reference in New Issue
Block a user