Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logo option #6817

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Add logo option #6817

merged 1 commit into from
Apr 30, 2024

Conversation

rickhanlonii
Copy link
Member

Overview

Adds a query param to switch the React logo to https://github.com/SAWARATSUKI/ServiceLogos:

  • on: ?uwu=true
  • off: ?uwu=false

Setting will persist until you turn it off.

Screen

Screenshot 2024-04-30 at 1 00 19 AM

Credits

Credit to @SAWARATSUKI in https://github.com/SAWARATSUKI/ServiceLogos

This PR also adds a console.log and footer credit for the amazing artwork.

Copy link

vercel bot commented Apr 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
19-react-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 5:03am
react-dev ✅ Ready (Inspect) Visit Preview Apr 30, 2024 5:03am

Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 104.12 KB (🟡 +38 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 80.46 KB (🟡 +158 B) 184.58 KB
/500 80.46 KB (🟡 +158 B) 184.58 KB
/[[...markdownPath]] 82.28 KB (🟡 +158 B) 186.4 KB
/errors 80.67 KB (🟡 +158 B) 184.79 KB
/errors/[errorCode] 80.65 KB (🟡 +158 B) 184.77 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@rickhanlonii rickhanlonii merged commit 1df378f into reactjs:main Apr 30, 2024
6 checks passed
@rickhanlonii rickhanlonii deleted the rh/uwu branch April 30, 2024 05:05
@@ -19,6 +19,41 @@ const MyDocument = () => {
}}
/>
<body className="font-text font-medium antialiased text-lg bg-wash dark:bg-wash-dark text-secondary dark:text-secondary-dark leading-base">
<script
dangerouslySetInnerHTML={{
__html: `
Copy link
Member

@Daniel15 Daniel15 May 7, 2024

Choose a reason for hiding this comment

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

Creating a __html object inline like this is explicitly discouraged in the React docs 😅 we should follow the best practices here.

Can't the script just go in a regular .js file?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no other way to use dangerouslySetInnerHTML, which we have to use since the head rendered by React and browsers ignore script text set by innerText for security reasons.

The cautions about it being unsafe are not applicable, because the string is static. We can't use a .js file because it would require a round trip to fetch the script, so it would run later and flash the wrong theme or logo (see the existing logic for setting the theme in the script tag below this).

When we convert to the App Router, this is supported out of the box with React 19 with the new Resources support https://react.dev/reference/react-dom/components#resource-and-metadata-components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants