Skip to content

Commit

Permalink
πŸ˜‡ prefetch intent (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgarropy authored Jan 17, 2024
1 parent ac26c28 commit 09c53a7
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bradgarropy.com",
"version": "7.3.1",
"version": "7.3.2",
"description": "🏠 my home on the web",
"type": "module",
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/components/FancyLink/FancyLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const FancyLink: FC<FancyLinkProps> = ({children, to}) => {
<Link
className="shadow-link transition duration-300 hover:shadow-link-hover"
to={to}
prefetch="intent"
>
{children}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Header: FC = () => {
return (
<header className="grid grid-flow-col items-center justify-between p-5">
<div className="grid grid-flow-col items-center gap-x-8">
<Link to="/" aria-label="bg">
<Link prefetch="intent" to="/" aria-label="bg">
<Logo />
</Link>

Expand Down
2 changes: 1 addition & 1 deletion src/components/LinkButton/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const LinkButton: FC<LinkButtonProps> = ({
}

return (
<Link to={to} className={classes}>
<Link prefetch="intent" to={to} className={classes}>
{props.children}
</Link>
)
Expand Down
30 changes: 25 additions & 5 deletions src/components/MobileNavigation/MobileNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,43 @@ const MobileNavigation: FC = () => {
/>

<div className="grid grid-flow-row content-center justify-center gap-y-4">
<Link className="hover:text-purple-400" to="/blog">
<Link
prefetch="intent"
className="hover:text-purple-400"
to="/blog"
>
blog
</Link>

<Link className="hover:text-purple-400" to="/now">
<Link
prefetch="intent"
className="hover:text-purple-400"
to="/now"
>
now
</Link>

<Link className="hover:text-purple-400" to="/uses">
<Link
prefetch="intent"
className="hover:text-purple-400"
to="/uses"
>
uses
</Link>

<Link className="hover:text-purple-400" to="/hire-me">
<Link
prefetch="intent"
className="hover:text-purple-400"
to="/hire-me"
>
hire me
</Link>

<Link className="hover:text-purple-400" to="/contact">
<Link
prefetch="intent"
className="hover:text-purple-400"
to="/contact"
>
contact
</Link>
</div>
Expand Down
30 changes: 25 additions & 5 deletions src/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,51 @@ import type {FC} from "react"
const Navigation: FC = () => {
return (
<nav className="grid grid-flow-col gap-x-5 max-[800px]:hidden">
<Link className="duration-300 hover:text-purple-400" to="/blog">
<Link
prefetch="intent"
className="duration-300 hover:text-purple-400"
to="/blog"
>
blog
</Link>

<span>|</span>

<Link className="duration-300 hover:text-purple-400" to="/now">
<Link
prefetch="intent"
className="duration-300 hover:text-purple-400"
to="/now"
>
now
</Link>

<span>|</span>

<Link className="duration-300 hover:text-purple-400" to="/uses">
<Link
prefetch="intent"
className="duration-300 hover:text-purple-400"
to="/uses"
>
uses
</Link>

<span>|</span>

<Link className="duration-300 hover:text-purple-400" to="/hire-me">
<Link
prefetch="intent"
className="duration-300 hover:text-purple-400"
to="/hire-me"
>
hire me
</Link>

<span>|</span>

<Link className="duration-300 hover:text-purple-400" to="/contact">
<Link
prefetch="intent"
className="duration-300 hover:text-purple-400"
to="/contact"
>
contact
</Link>
</nav>
Expand Down
1 change: 1 addition & 0 deletions src/components/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const PostCard: FC<PostCardProps> = ({post, className}) => {
>
<h1 className="mb-10 font-heading text-3xl font-semibold max-[750px]:text-2xl">
<Link
prefetch="intent"
to={`/blog/${post.slug}`}
className="transition duration-300 hover:text-purple-400"
>
Expand Down
2 changes: 2 additions & 0 deletions src/components/PostMeta/PostMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const PostMeta: FC<PostMetaProps> = ({date, tags, topic}) => {
<span className="lowercase">
{formatDate(date)} in{" "}
<Link
prefetch="intent"
to={`/topic/${topic}`}
className="transition duration-300 hover:text-purple-400"
>
Expand All @@ -26,6 +27,7 @@ const PostMeta: FC<PostMetaProps> = ({date, tags, topic}) => {
key={tag}
className="rounded bg-black px-2 font-heading text-sm font-bold text-white duration-300 hover:bg-purple-400 dark:bg-white dark:text-black dark:hover:bg-purple-400"
to={`/tag/${tag}`}
prefetch="intent"
>
{tag}
</Link>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Section/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const Section: FC<SectionProps> = ({title, link, children, ...props}) => {
return (
<section {...props}>
{link ? (
<Link className="m-0 mb-7 inline-block" to={link}>
<Link
className="m-0 mb-7 inline-block"
to={link}
prefetch="intent"
>
<Title title={title} />
</Link>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useMarkdown/useMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const useMarkdown = (html: string) => {
props: Record<string, unknown>
}) => {
return (
<Link to={href} {...props}>
<Link prefetch="intent" to={href} {...props}>
{children}
</Link>
)
Expand Down

1 comment on commit 09c53a7

@vercel
Copy link

@vercel vercel bot commented on 09c53a7 Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.