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:
2025-09-24 01:01:44 +09:00
parent 97ee67cf64
commit 65b7e2cd44
9 changed files with 18 additions and 18 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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>
); );
} };

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;