Skip to content

Commit ec0bd64

Browse files
committed
fix: next compatibility fixes for umami example
* update domhandler import * run link codemod
1 parent b403667 commit ec0bd64

19 files changed

+157
-136
lines changed

examples/example-umami/components/block--banner.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ export function BlockBanner({ block }: BlockBannerProps) {
2222
<Link
2323
href={block.field_content_link.uri.replace("internal:", "")}
2424
passHref
25+
className="px-6 py-3 font-serif text-xl text-white transition-colors border-2 rounded-md bg-secondary hover:bg-white hover:text-black border-secondary"
2526
>
26-
<a className="px-6 py-3 font-serif text-xl text-white transition-colors border-2 rounded-md bg-secondary hover:bg-white hover:text-black border-secondary">
27-
{block.field_content_link.title}
28-
</a>
27+
{block.field_content_link.title}
2928
</Link>
3029
)}
3130
</div>

examples/example-umami/components/breadcrumbs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export function Breadcrumbs({ items, ...props }: BreadcrumbsProps) {
2525
{items.map((item, index) => (
2626
<li key={index} className="flex items-center leading-none truncate">
2727
{item.url ? (
28-
<Link href={item.url} passHref>
29-
<a className="underline text-link">{item.title}</a>
28+
<Link href={item.url} passHref className="underline text-link">
29+
{item.title}
3030
</Link>
3131
) : (
3232
item.title

examples/example-umami/components/footer.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ export function Footer({ menus, blocks }: FooterProps) {
3434
</h2>
3535
<div className="grid max-w-4xl mx-auto mt-4 text-sm text-center md:text-left md:grid-cols-4 gap-y-3 gap-x-4">
3636
{blocks.recipeCollections.map((tag) => (
37-
<Link key={tag.id} href={tag.path.alias} passHref>
38-
<a className="font-semibold hover:underline">{tag.name}</a>
37+
<Link
38+
key={tag.id}
39+
href={tag.path.alias}
40+
passHref
41+
className="font-semibold hover:underline"
42+
>
43+
{tag.name}
3944
</Link>
4045
))}
4146
</div>
@@ -70,10 +75,9 @@ export function Footer({ menus, blocks }: FooterProps) {
7075
""
7176
)}
7277
passHref
78+
className="text-sm underline transition-colors hover:bg-black"
7379
>
74-
<a className="text-sm underline transition-colors hover:bg-black">
75-
{blocks.footerPromo.field_content_link.title}
76-
</a>
80+
{blocks.footerPromo.field_content_link.title}
7781
</Link>
7882
)}
7983
</div>

examples/example-umami/components/form--search.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ export function FormSearch({ className, ...props }: FormSearchProps) {
2020

2121
return (
2222
<>
23-
<Link href="/search" passHref>
24-
<a className="md:hidden">
25-
<span className="sr-only">{t("search")}</span>
26-
<SearchIcon />
27-
</a>
23+
<Link href="/search" passHref className="md:hidden">
24+
<span className="sr-only">{t("search")}</span>
25+
<SearchIcon />
2826
</Link>
2927
<form
3028
className={classNames("text-sm hidden md:flex items-center", className)}

examples/example-umami/components/formatted-text.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ const options: HTMLReactParserOptions = {
3939

4040
if (href && isRelative(href)) {
4141
return (
42-
<Link href={href} passHref>
43-
<a className={className}>{domToReact(domNode.children)}</a>
42+
<Link href={href} passHref className={className}>
43+
{domToReact(domNode.children)}
4444
</Link>
4545
)
4646
}

examples/example-umami/components/header.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ export function Header({ menus }: HeaderProps) {
3535
</div>
3636
</div>
3737
<div className="container relative flex-wrap items-center justify-between py-6 md:flex lg:py-10">
38-
<Link href="/" passHref>
39-
<a className="flex justify-start">
40-
<Logo className="w-48 h-12 text-primary lg:h-16 lg:w-52" />
41-
<span className="sr-only">{siteConfig.name}</span>
42-
</a>
38+
<Link href="/" passHref className="flex justify-start">
39+
<Logo className="w-48 h-12 text-primary lg:h-16 lg:w-52" />
40+
<span className="sr-only">{siteConfig.name}</span>
4341
</Link>
4442
<button
4543
className="absolute transition-all border border-transparent md:hidden right-4 top-8 hover:border-link"

examples/example-umami/components/locale-switcher.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ export function LocaleSwitcher({ ...props }) {
1616
<ul className="flex space-x-4">
1717
{locales.map((locale) => (
1818
<li key={locale}>
19-
<Link href={asPath} locale={locale} passHref>
20-
<a
21-
data-cy={`local-switcher-${locale}`}
22-
className={classNames(
23-
locale === currentLocale ? "font-semibold" : "font-normal"
24-
)}
25-
>
26-
{config.locales[locale]}
27-
</a>
19+
<Link
20+
href={asPath}
21+
locale={locale}
22+
passHref
23+
data-cy={`local-switcher-${locale}`}
24+
className={classNames(
25+
locale === currentLocale ? "font-semibold" : "font-normal"
26+
)}
27+
>
28+
{config.locales[locale]}
2829
</Link>
2930
</li>
3031
))}

examples/example-umami/components/menu-footer.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ export function MenuFooter({ items, ...props }: MenuFooterProps) {
1111
<ul className="flex flex-col space-y-2">
1212
{items.map((item) => (
1313
<li key={item.id}>
14-
<Link href={item.url} passHref>
15-
<a className="text-sm font-semibold transition-colors hover:bg-black hover:underline">
16-
{item.title}
17-
</a>
14+
<Link
15+
href={item.url}
16+
passHref
17+
className="text-sm font-semibold transition-colors hover:bg-black hover:underline"
18+
>
19+
{item.title}
1820
</Link>
1921
</li>
2022
))}

examples/example-umami/components/menu-link.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ export type MenuLinkProps = Omit<
1010
function CustomLink(props, ref) {
1111
let { href, children, ...rest } = props
1212
return (
13-
<NextLink href={href} passHref>
14-
<a ref={ref} {...rest}>
15-
{children}
16-
</a>
13+
<NextLink href={href} passHref ref={ref} {...rest}>
14+
{children}
1715
</NextLink>
1816
)
1917
}

examples/example-umami/components/menu-main.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ export function MenuMain({ items, ...props }: MenuMainProps) {
2222

2323
return (
2424
<li key={item.id}>
25-
<Link href={item.url} passHref>
26-
<a
27-
className={classNames(
28-
"text-xl border-b-[3px] flex border-b-transparent font-serif transition-colors hover:text-primary",
29-
{
30-
"border-b-primary": isActive,
31-
}
32-
)}
33-
>
34-
{item.title}
35-
</a>
25+
<Link
26+
href={item.url}
27+
passHref
28+
className={classNames(
29+
"text-xl border-b-[3px] flex border-b-transparent font-serif transition-colors hover:text-primary",
30+
{
31+
"border-b-primary": isActive,
32+
}
33+
)}
34+
>
35+
{item.title}
3636
</Link>
3737
</li>
3838
)

0 commit comments

Comments
 (0)