Skip to content

Commit

Permalink
feat: improve lighthouse score (#554)
Browse files Browse the repository at this point in the history
* use image-optimization

* use on tweets

* index page

* seo worky?

* alt tag

* remove misused definition list

* image show pls?
  • Loading branch information
juliusmarminge authored Oct 3, 2022
1 parent 43f0d81 commit 2300e23
Show file tree
Hide file tree
Showing 10 changed files with 272 additions and 22 deletions.
252 changes: 245 additions & 7 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion www/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from "astro/config";
import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
import mdx from "@astrojs/mdx";
import image from "@astrojs/image";

/**
* @link https://astro.build/config
Expand All @@ -14,5 +15,12 @@ export default defineConfig({
wrap: true,
},
},
integrations: [react(), tailwind(), mdx()],
integrations: [
react(),
tailwind(),
mdx(),
image({
serviceEntryPoint: "@astrojs/image/sharp",
}),
],
});
2 changes: 2 additions & 0 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
},
"dependencies": {
"@algolia/client-search": "^4.13.1",
"@astrojs/image": "^0.9.1",
"@docsearch/css": "^3.2.1",
"@docsearch/react": "^3.2.1",
"@fontsource/inter": "^4.5.12",
"@fontsource/jetbrains-mono": "^4.5.10",
"clsx": "^1.2.1",
"embla-carousel": "^7.0.3",
"embla-carousel-autoplay": "^7.0.3",
"sharp": "^0.31.1",
"tailwind-scrollbar": "^2.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion www/public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

User-agent: *
Allow: /
Sitemap: https://create.t3.gg/sitemap-index.xml
Sitemap: https://beta.create.t3.gg/sitemap.xml
8 changes: 4 additions & 4 deletions www/src/components/landingPage/stack/card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ const { title, href } = Astro.props;
target="_blank"
rel="noopener noreferrer"
class="hover:no-underline active:no-underline focus:no-underline"
><dt
><div
class="flex space-x-4 items-center bg-white/10 p-2 pl-5 rounded-tr-md rounded-tl-md hover:bg-white/20 transition-colors"
>
<slot name="icon" />
<p class="text-lg leading-6 md:text-xl font-medium text-t3-purple-200">
{title}
</p>
</dt>
<dd
</div>
<div
class="m-6 text-sm md:text-base text-t3-purple-100 subpixel-antialiased h-full"
>
<slot name="description" />
</dd>
</div>
</a>
</div>
13 changes: 6 additions & 7 deletions www/src/components/landingPage/stack/stack.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { Image } from "@astrojs/image/components";
import PageSection from "../pageSection.astro";
import Feature from "./card.astro";
import NextAuthIcon from "./nextauth.png";
---

<PageSection size={"24"} id="stack">
Expand All @@ -20,7 +20,7 @@ import NextAuthIcon from "./nextauth.png";
</p>
</div>
<div>
<dl
<div
class="space-y-10 sm:space-y-0 sm:grid sm:grid-cols-2 md:grid-cols-3 sm:grid-rows-3 md:grid-rows-2 sm:grid-flow-col sm:gap-x-6 sm:gap-y-14 lg:gap-x-8"
>
<Feature title="Next.js" href="https://nextjs.org/">
Expand Down Expand Up @@ -140,13 +140,12 @@ import NextAuthIcon from "./nextauth.png";
</Feature>

<Feature title="NextAuth.js" href="https://next-auth.js.org/">
<img
<Image
slot="icon"
src={NextAuthIcon}
src={import("./nextauth.png")}
class="h-10 w-8 py-1"
alt="NextAuth.js"
width={100}
height={100}
format="webp"
/>
<Fragment slot="description">
When you need a flexible, secure, and scalable authentication
Expand All @@ -155,7 +154,7 @@ import NextAuthIcon from "./nextauth.png";
ties into NextJS and tRPC to provide a seamless experience.
</Fragment>
</Feature>
</dl>
</div>
</div>
</div>
</PageSection>
4 changes: 3 additions & 1 deletion www/src/components/landingPage/tweets/tweetCard.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import type { Tweet } from "./types";
import { Image } from "@astrojs/image/components";
const {
id,
Expand All @@ -18,10 +19,11 @@ const {
<article
class="px-4 pt-4 pb-1 flex flex-wrap items-start hover:bg-white/20 bg-white/10 bg-cover rounded-lg transition-colors hover:no-underline border border-t3-purple-200/20 hover:border-t3-purple-300/50"
>
<img
<Image
src={avatar}
width={48}
height={48}
format="webp"
class="rounded-full w-12 h-12 mr-3"
alt={`@${handle}'s Avatar`}
/>
Expand Down
1 change: 0 additions & 1 deletion www/src/env.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions www/src/layouts/landingPage.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const currentPage = Astro.url.pathname;
<img
src="/images/background-pattern.svg"
class="absolute inset-0 opacity-5 h-max w-max object-cover"
alt="background pattern"
/>
<div class="relative">
<Navbar />
Expand Down
1 change: 1 addition & 0 deletions www/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"jsx": "preserve",
"types": ["@astrojs/image/client"],
// Skip type checking of external libraries.
"skipLibCheck": true
}
Expand Down

1 comment on commit 2300e23

@vercel
Copy link

@vercel vercel bot commented on 2300e23 Oct 3, 2022

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.