File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change 1
1
// LocaleLink.tsx
2
2
import { Link , useParams } from "@remix-run/react" ;
3
3
4
-
5
4
export function LocaleLink ( {
6
5
to,
7
6
children,
@@ -11,7 +10,7 @@ export function LocaleLink({
11
10
children : React . ReactNode ;
12
11
className ?: string ;
13
12
} ) {
14
- const { locale } = useParams ( ) ;
13
+ const { locale } = useParams ( ) ;
15
14
16
15
const path = `/${ locale } ${ to } ` ;
17
16
Original file line number Diff line number Diff line change 1
1
import { NavLink , type NavLinkProps , useParams } from "@remix-run/react" ;
2
2
3
-
4
3
// NavLinkProps を継承
5
4
type NavLocaleLinkProps = Omit < NavLinkProps , "to" > & {
6
5
to : string ;
@@ -12,17 +11,13 @@ export function NavLocaleLink({
12
11
children,
13
12
...rest
14
13
} : NavLocaleLinkProps ) {
15
- const { locale } = useParams ( ) ;
14
+ const { locale } = useParams ( ) ;
16
15
17
16
const normalized = to . startsWith ( "/" ) ? to . slice ( 1 ) : to ;
18
17
const path = `/${ locale } /${ normalized } ` ;
19
18
20
19
return (
21
- < NavLink
22
- to = { path }
23
- className = { className }
24
- { ...rest }
25
- >
20
+ < NavLink to = { path } className = { className } { ...rest } >
26
21
{ children }
27
22
</ NavLink >
28
23
) ;
You can’t perform that action at this time.
0 commit comments