Skip to content

Commit f2c9dfc

Browse files
committed
more prefetch on intent
1 parent ef15521 commit f2c9dfc

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

app/root.res

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ let default = () => {
5353
<head>
5454
<style> {React.string("html {opacity:0;}")} </style>
5555
<link rel="preload" href={mainCss} as_="css" />
56+
// Preload the fonts used for the above the fold on the homepage
5657
<link rel="preload" href="/fonts/subset-Inter-Bold.woff2" as_="font" />
5758
<link rel="preload" href="/fonts/subset-Inter-Regular.woff2" as_="font" />
58-
<link rel="preload" href="/fonts/subset-Inter-SemiBold.woff2" as_="font" />
59-
<link rel="preload" href="/fonts/subset-Inter-Medium.woff2" as_="font" />
60-
6159
<link rel="stylesheet" href={mainCss} />
6260

6361
<Links />

src/components/Navigation.res

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,34 @@ module MobileNav = {
3535
<div className="border-gray-80 border-tn">
3636
<ul>
3737
<li className=base>
38-
<Link to=#"/try" className={linkOrActiveLink(~target=#"/try", ~route)}>
38+
<Link prefetch={#intent} to=#"/try" className={linkOrActiveLink(~target=#"/try", ~route)}>
3939
{React.string("Playground")}
4040
</Link>
4141
</li>
4242
<li className=base>
43-
<Link to=#"/blog" className={linkOrActiveLinkSubroute(~target=#"/blog", ~route)}>
43+
<Link
44+
prefetch={#intent}
45+
to=#"/blog"
46+
className={linkOrActiveLinkSubroute(~target=#"/blog", ~route)}
47+
>
4448
{React.string("Blog")}
4549
</Link>
4650
</li>
4751
<li className=base>
4852
<Link
53+
prefetch={#intent}
4954
to=#"/community/overview"
5055
className={linkOrActiveLink(~target=#"/community/overview", ~route)}
5156
>
5257
{React.string("Community")}
5358
</Link>
5459
</li>
5560
<li className=base>
56-
<Link to=#"/packages" className={linkOrActiveLink(~target=#"/packages", ~route)}>
61+
<Link
62+
prefetch={#intent}
63+
to=#"/packages"
64+
className={linkOrActiveLink(~target=#"/packages", ~route)}
65+
>
5766
{React.string("Packages")}
5867
</Link>
5968
</li>

src/layouts/SidebarLayout.res

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module Toc = {
2727
{Array.map(entries, ({header, href}) => {
2828
<li key=header className="pl-2 mt-2 first:mt-1" dataTestId=header>
2929
<Link.String
30+
prefetch={#intent}
3031
onClick={evt => {
3132
evt->ReactEvent.Mouse.preventDefault
3233
Console.log(href)
@@ -88,6 +89,7 @@ module Sidebar = {
8889
<li key=m.name className={hidden ++ " mt-1 leading-4"}>
8990
<Link.String
9091
to=m.href
92+
prefetch={#intent}
9193
className={"truncate block py-1 md:h-auto tracking-tight text-gray-60 rounded-sm hover:bg-gray-20 hover:-ml-2 hover:py-1 hover:pl-2 " ++
9294
active}
9395
>
@@ -238,7 +240,7 @@ module BreadCrumbs = {
238240
let item = if i === List.length(crumbs) - 1 {
239241
<span key={Int.toString(i)}> {React.string(crumb.name)} </span>
240242
} else {
241-
<Link.String key={Int.toString(i)} to=crumb.href>
243+
<Link.String key={Int.toString(i)} to=crumb.href prefetch={#intent}>
242244
{React.string(crumb.name)}
243245
</Link.String>
244246
}
@@ -331,6 +333,7 @@ let make = (
331333
| Some({name, href}) =>
332334
<Link.String
333335
to=href
336+
prefetch={#intent}
334337
className={"flex items-center text-fire hover:text-fire-70 border-2 border-red-300 rounded py-1.5 px-3"}
335338
>
336339
<Icon.ArrowRight className={"rotate-180 mr-2"} />
@@ -341,6 +344,7 @@ let make = (
341344
let next = switch items->Array.get(i + 1) {
342345
| Some({name, href}) =>
343346
<Link.String
347+
prefetch={#intent}
344348
to=href
345349
className={"flex items-center text-fire hover:text-fire-70 ml-auto border-2 border-red-300 rounded py-1.5 px-3"}
346350
>

0 commit comments

Comments
 (0)