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

[BugFix] Fixes layout shifting issues #71

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jcalcaben
Copy link
Contributor

Fixes #35 by pre-loading the font.

Fixes the layout shifting on the homepage and footer by replacing the useBreakpointValue() hook with the array syntax.

@vercel
Copy link

vercel bot commented Apr 22, 2023

@jcalcaben is attempting to deploy a commit to the open-austin-vercel Team on Vercel.

A member of the Team first needs to authorize it.

@newswim
Copy link
Contributor

newswim commented May 15, 2023

Hey James! Thanks a lot for taking a look at this. Before I review this, would you mind re-running prettier? I think something in your local settings might've overridden the project settings, which is why there are a lot of instances of single quotes being replaced with double quotes.

Project setting is located here:

https://github.com/open-austin/website-v2-vercel/blob/main/.prettierrc#L3

package.json Outdated Show resolved Hide resolved
@jcalcaben jcalcaben requested a review from newswim May 16, 2023 03:44
pages/_app.tsx Outdated Show resolved Hide resolved
pages/_app.tsx Outdated
import '@fontsource/crimson-text'

import "@fontsource/crimson-text";
import crimsonTextLatin from "@fontsource/crimson-text/files/crimson-text-latin-400-normal.woff2";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Next recommends using their @next/Font component for this:

https://nextjs.org/docs/pages/building-your-application/optimizing/fonts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error: `@next/font` is only available in Next.js 13 and newer.

Project is currently using 12.3.1

Since it's a major version bump, I hesitate to include it in this PR since it would require regression testing.

Copy link
Contributor

@newswim newswim May 19, 2023

Choose a reason for hiding this comment

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

Oh right! I think this is what prompted the creation of #47

In that case, I think what you have here is a good approach 👍

<SimpleGrid
templateColumns={{ base: '1fr 1fr', md: '2fr 1fr 1fr' }}
templateRows={{ base: '1fr 1fr', md: '1fr' }}
spacing={8}
>
<Stack order={useBreakpointValue({ base: 1, md: 2 })}>
<Stack order={[1, 2]}>
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 not super familiar with this hook, could you give a little bit of context for why you opted to not use useBreakpointValue? I'm sure it's totally valid, I'm just not sure what the trade-offs are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From their docs:

All style props accept arrays as values for mobile-first responsive styles. This is the recommended method.

https://chakra-ui.com/docs/styled-system/responsive-styles#the-array-syntax

If I understand the docs for the useBreakpointValue(), this hook is more useful when the calculated values are dynamic instead of static.

Also, how common is it to use custom react hooks inline instead of inside the function body? I've personally never seen it in other projects and code samples, but I've also never worked with the chakra library.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, it's a little strange. This seems quite a bit more manageable.

I just approved the deployment but it looks like the build is still failing. I'll try to figure out why. I was thinking that once it builds, we may want to check how the site is looking on mobile now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I think you might've bumped the version of React but didn't re-run yarn install, so the yarn.lock is out of sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did a yarn install and there are no changes to push up

@vercel
Copy link

vercel bot commented May 19, 2023

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

Name Status Preview Comments Updated (UTC)
website-v2 ❌ Failed (Inspect) May 19, 2023 3:17pm

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

Successfully merging this pull request may close these issues.

Font flashing
2 participants