Skip to content

Commit 8ea57cf

Browse files
committed
feat: Add common types
1 parent fed6716 commit 8ea57cf

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/routes.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrowserRouter, Routes as ReactRoutes, Route } from 'react-router';
1+
import { BrowserRouter, Routes as ReactRoutes, Route, useLocation } from 'react-router';
22

33
import { AppContainer } from '@/layout/app-container';
44
import { AuthLayout } from '@/layout/auth-layout';
@@ -8,6 +8,7 @@ import { NotFoundPage } from '@/pages/not-found-page';
88
import { LoginPage } from '@/pages/auth/login-page';
99
import { LandingPage } from '@/pages/landing-page';
1010
import { MainPage } from '@/pages/main/main-page';
11+
import { useEffect } from 'react';
1112

1213
const ROUTES_DATA = [
1314
{
@@ -18,6 +19,12 @@ const ROUTES_DATA = [
1819
] as const;
1920

2021
export function Routes() {
22+
const { pathname } = useLocation();
23+
24+
useEffect(() => {
25+
window.scrollTo(0, 0);
26+
}, [pathname]);
27+
2128
return (
2229
<BrowserRouter>
2330
<ReactRoutes>

src/shared/types/common.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { CSSProperties, PropsWithChildren } from 'react';
2+
3+
export interface CommonComponentProperties {
4+
className?: string;
5+
style?: CSSProperties;
6+
}
7+
8+
export type CommonComponentPropertiesWithChildren =
9+
PropsWithChildren<CommonComponentProperties>;

src/shared/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './api';
2+
export * from './common';

0 commit comments

Comments
 (0)