Skip to content

Commit 74697fb

Browse files
authored
fix uwu flicker (#6820)
* Try next/image * Fix styles.css * rm unneeded styles * priority=true * tweaks * Static height * tweak * priority
1 parent 6f5ee38 commit 74697fb

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

src/components/Layout/HomeContent.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import CodeBlock from 'components/MDX/CodeBlock';
2727
import {ExternalLink} from 'components/ExternalLink';
2828
import sidebarBlog from '../../sidebarBlog.json';
2929
import * as React from 'react';
30+
import Image from 'next/image';
3031

3132
function Section({children, background = null}) {
3233
return (
@@ -117,10 +118,12 @@ export function HomeContent() {
117118
<div className="ps-0">
118119
<div className="mx-5 mt-12 lg:mt-24 mb-20 lg:mb-32 flex flex-col justify-center">
119120
<div className="uwu-visible flex justify-center">
120-
<img
121+
<Image
121122
alt="logo by @sawaratsuki1004"
122123
title="logo by @sawaratsuki1004"
123-
className="uwu-visible h-24 lg:h-40"
124+
loading="eager"
125+
width={313}
126+
height={160}
124127
src="/images/uwu.png"
125128
/>
126129
</div>

src/components/Layout/TopNav/TopNav.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
startTransition,
1111
Suspense,
1212
} from 'react';
13+
import Image from 'next/image';
1314
import * as React from 'react';
1415
import cn from 'classnames';
1516
import NextLink from 'next/link';
@@ -249,14 +250,15 @@ export default function TopNav({
249250
{isMenuOpen ? <IconClose /> : <IconHamburger />}
250251
</button>
251252
<div className="f">
252-
<div className="uwu-visible">
253-
<NextLink
254-
href="/"
255-
className={`active:scale-95 mt-0.5 overflow-hidden transition-transform relative items-center justify-center text-primary dark:text-primary-dark p-1 whitespace-nowrap outline-link rounded-full 3xl:rounded-xl inline-flex text-lg font-normal gap-2`}>
256-
<img
253+
<div className="uwu-visible flex items-center justify-center h-full">
254+
<NextLink href="/">
255+
<Image
257256
alt="logo by @sawaratsuki1004"
258257
title="logo by @sawaratsuki1004"
259258
className="h-8"
259+
priority
260+
width={63}
261+
height={32}
260262
src="/images/uwu.png"
261263
/>
262264
</NextLink>

src/styles/index.css

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -745,11 +745,10 @@ ol.mdx-illustration-block {
745745
display: flex;
746746
}
747747

748-
.uwu {
749-
.uwu-visible {
750-
display: flex;
751-
}
752-
.uwu-hidden {
753-
display: none;
754-
}
748+
.uwu .uwu-visible {
749+
display: flex;
750+
}
751+
752+
.uwu .uwu-hidden {
753+
display: none;
755754
}

0 commit comments

Comments
 (0)