Skip to content

Commit 0cda271

Browse files
committed
refactor: remove unused code
- clean up code
1 parent eccc077 commit 0cda271

File tree

10 files changed

+39
-265
lines changed

10 files changed

+39
-265
lines changed

β€Žnext.config.jsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = {
2121
stitches: computePath('./src/styles/stitches.config.ts'),
2222
stores: computePath('./src/stores/'),
2323
styles: computePath('./src/styles'),
24-
theme: computePath('./src/theme/'),
2524
types: computePath('./src/types/'),
2625
utils: computePath('./src/utils'),
2726
}

β€Žsrc/components/atoms/Link/DynamicLink.tsxβ€Ž

Lines changed: 0 additions & 32 deletions
This file was deleted.

β€Žsrc/components/atoms/Link/StaticLink.tsxβ€Ž

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1-
export { Link } from './StaticLink'
2-
export { DynamicLink } from './DynamicLink'
1+
import NextLink from 'next/link'
2+
import { useRouter } from 'next/router'
3+
import type { Routes } from 'routes'
4+
import { routes } from 'routes'
5+
import type { CSS } from 'stitches'
6+
7+
import { Styled } from './styles'
8+
import { handleKeyPress } from './utils'
9+
10+
type Props = {
11+
route: keyof Routes
12+
label: string
13+
param?: string
14+
css?: CSS
15+
isActive?: (pathname: string) => boolean
16+
}
17+
18+
function Link({ route, label, param, isActive, ...rest }: Props) {
19+
const { pathname } = useRouter()
20+
const href = param ? `${routes[route]}/${param}` : routes[route]
21+
22+
return (
23+
<NextLink href={href}>
24+
<Styled.Root
25+
href={href}
26+
active={isActive?.(pathname) ?? href === pathname}
27+
tabIndex={0}
28+
onKeyPress={handleKeyPress}
29+
{...rest}
30+
>
31+
{label}
32+
</Styled.Root>
33+
</NextLink>
34+
)
35+
}
36+
37+
export { Link }

β€Žsrc/pagesContent/users/index.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Button } from 'components/atoms/Button'
2-
import { DynamicLink } from 'components/atoms/Link'
2+
import { Link } from 'components/atoms/Link'
33
import { Text } from 'components/atoms/Text'
44
import { useStore } from 'stores/someStore'
55
import type { User } from 'types/user'
@@ -13,7 +13,7 @@ function RenderUsers({ users }: Props) {
1313
const updateCount = useStore(s => s.updateCount)
1414

1515
const links = users.map(({ id, name }) => (
16-
<DynamicLink
16+
<Link
1717
key={id}
1818
css={{
1919
display: 'block',

β€Žsrc/theme/get.tsβ€Ž

Lines changed: 0 additions & 26 deletions
This file was deleted.

β€Žsrc/theme/index.tsβ€Ž

Lines changed: 0 additions & 129 deletions
This file was deleted.

β€Žsrc/theme/types.tsβ€Ž

Lines changed: 0 additions & 8 deletions
This file was deleted.

β€Žsrc/theme/utils.tsβ€Ž

Lines changed: 0 additions & 28 deletions
This file was deleted.

β€Žtsconfig.jsonβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
"utils/*": ["./src/utils/*"],
1414
"routes": ["./src/routes.ts"],
1515
"rtl": ["./src/rtl/index.tsx"],
16-
"theme": ["./src/theme"],
17-
"theme/*": ["./src/theme/*"],
1816
"types/*": ["./src/types/*"]
1917
},
2018
"esModuleInterop": true,

0 commit comments

Comments
Β (0)