这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(docs): fix showcase layout shift #1727

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

Merged

Conversation

tknickman
Copy link
Member

Handle logo size correctly and fix showcase layout shift

@vercel
Copy link

vercel bot commented Aug 19, 2022

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

Name Status Preview Updated
turbo-site ✅ Ready (Inspect) Visit Preview Aug 19, 2022 at 8:52PM (UTC)

@@ -128,7 +138,7 @@ export const users = [
infoLink: "https://espn.com",
pinned: true,
style: {
widt: 75,
Copy link
Contributor

Choose a reason for hiding this comment

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

widt

Copy link
Member Author

Choose a reason for hiding this comment

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

😂

@tknickman
Copy link
Member Author

There's still a tiny shift on preview that I don't have locally - looking into it a bit more

@tknickman tknickman added the pr: on hold Pull requests that are "on hold" and should not be merged label Aug 19, 2022
@gaspar09
Copy link
Contributor

There's still a tiny shift on preview that I don't have locally - looking into it a bit more

yep. sounds good.

@tknickman
Copy link
Member Author

Fixed @gaspar09

@tknickman tknickman added pr: automerge Kodiak will merge these automatically after checks pass and removed pr: on hold Pull requests that are "on hold" and should not be merged labels Aug 19, 2022
export function Clients({ linked }: { linked?: boolean }) {
const showcaseDark = [];
const showcaseLight = [];
users.forEach((user, idx) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

  • idx isn't used. do we have lint against unused declarations?
  • for...of would be nice!

Copy link
Member Author

@tknickman tknickman Aug 19, 2022

Choose a reason for hiding this comment

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

Ah good catch on the idx, will remove since we don't need that for the key.

for...of actually has sub par browser support compared with the array methods, so this and map are much more common than a traditional for style loop when it comes to the client.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we transpile anyways?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do, I would still argue forEach is easier to read, and more conventional in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm all about the for...of these days :D, but yeah, for most intents and purposes, it's a stylistic issue.

<Image
src={user.image.replace(
"/logos",
theme === "light" ? "/logos/white" : "/logos/color"
Copy link
Contributor

@mehulkar mehulkar Aug 19, 2022

Choose a reason for hiding this comment

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

does this do dark/light mode with JS?

It's possible to do just use html, fwiw <source media="(prefers-color-scheme: dark)" src=...>

Copy link
Member Author

Choose a reason for hiding this comment

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

It does, I think you need to use picture instead of img for source?

Copy link
Contributor

@gaspar09 gaspar09 Aug 19, 2022

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, prefers-color-scheme reflects system usage, same as the CSS @media query.

#:~:text=Start%20Building%20%E2%86%92-,System,-Footer

btw @gaspar09 , I don't use Chrome, so I can't see what you're pointing to with your text fragment links 😛

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@tknickman tknickman force-pushed the tomknickman/turbo-259-fix-turborepoorg-showcase-layoutshift branch from 398c468 to af53fd0 Compare August 19, 2022 20:51
@gaspar09
Copy link
Contributor

I googled why forEach is bad just to play devil's advocate:
https://aeflash.com/2014-11/avoid-foreach.html

lol

@kodiakhq kodiakhq bot merged commit a516904 into main Aug 19, 2022
@kodiakhq kodiakhq bot deleted the tomknickman/turbo-259-fix-turborepoorg-showcase-layoutshift branch August 19, 2022 21:58
@mehulkar
Copy link
Contributor

I googled why forEach is bad just to play devil's advocate: https://aeflash.com/2014-11/avoid-foreach.html

lol

btw,

  • that post is talking about classic for loops, not for...of
  • for...of also works for things that are not arrays, but implement Symbol.iterator (e.g. results from document.querySelectorAll or element.attributes()). I like the consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants