-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import Image from 'next/image' | ||
import Image from "next/image"; | ||
import { | ||
Box, | ||
Container, | ||
|
@@ -7,37 +7,32 @@ import { | |
Link as ChakraLink, | ||
Text, | ||
useColorModeValue, | ||
useBreakpointValue, | ||
Heading, | ||
} from '@chakra-ui/react' | ||
import { ReactNode } from 'react' | ||
import { FaGithub, FaLinkedin, FaTwitter, FaYoutube } from 'react-icons/fa' | ||
import { Link, LinkProps } from './link' | ||
} from "@chakra-ui/react"; | ||
import { ReactNode } from "react"; | ||
import { FaGithub, FaLinkedin, FaTwitter, FaYoutube } from "react-icons/fa"; | ||
import { Link, LinkProps } from "./link"; | ||
|
||
export const Footer = () => ( | ||
<Box | ||
bg={useColorModeValue('gray.50', 'gray.900')} | ||
color={useColorModeValue('gray.700', 'gray.200')} | ||
bg={useColorModeValue("gray.50", "gray.900")} | ||
color={useColorModeValue("gray.700", "gray.200")} | ||
> | ||
<Container | ||
as={Stack} | ||
maxW={'6xl'} | ||
py={useBreakpointValue({ base: 4, md: 10 })} | ||
> | ||
<Container as={Stack} maxW={"6xl"} py={[4, 10]}> | ||
<SimpleGrid | ||
templateColumns={{ base: '1fr 1fr', md: '2fr 1fr 1fr' }} | ||
templateRows={{ base: '1fr 1fr', md: '1fr' }} | ||
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]}> | ||
<Heading as="h2">More Info</Heading> | ||
{FOOTER_ITEMS_MORE_INFO.map((link) => ( | ||
<Link href={link.href} key={link.key}> | ||
<Text ml={2}>{link.label}</Text> | ||
</Link> | ||
))} | ||
</Stack> | ||
<Stack order={useBreakpointValue({ base: 2, md: 3 })}> | ||
<Stack order={[2, 3]}> | ||
<Heading as="h2">Support</Heading> | ||
{FOOTER_ITEMS_SUPPORT.map((link) => ( | ||
<ChakraLink | ||
|
@@ -52,22 +47,22 @@ export const Footer = () => ( | |
</Stack> | ||
<Stack | ||
spacing={6} | ||
gridColumn={{ base: '1 / -1', md: '1' }} | ||
order={useBreakpointValue({ base: 3, md: 1 })} | ||
gridColumn={{ base: "1 / -1", md: "1" }} | ||
order={[3, 1]} | ||
> | ||
<Box alignSelf="center"> | ||
<Image | ||
alt="Open Austin's logo; a five-pointed star in orange and black" | ||
priority | ||
src={'/assets/logo.svg'} | ||
src={"/assets/logo.svg"} | ||
width={60} | ||
height={60} | ||
/> | ||
</Box> | ||
<Text fontSize={'sm'} alignSelf="center"> | ||
<Text fontSize={"sm"} alignSelf="center"> | ||
© 2022 Open Austin. All rights reserved | ||
</Text> | ||
<Stack direction={'row'} spacing={6} justifyContent="center"> | ||
<Stack direction={"row"} spacing={6} justifyContent="center"> | ||
{SOCIAL_ITEMS.map((link) => ( | ||
<ChakraLink | ||
href={link.href} | ||
|
@@ -85,60 +80,60 @@ export const Footer = () => ( | |
</SimpleGrid> | ||
</Container> | ||
</Box> | ||
) | ||
); | ||
|
||
type FooterItems = LinkProps & { | ||
key: string | ||
label: string | ||
icon?: ReactNode | ||
} | ||
key: string; | ||
label: string; | ||
icon?: ReactNode; | ||
}; | ||
|
||
const FOOTER_ITEMS_MORE_INFO: ReadonlyArray<FooterItems> = [ | ||
{ href: 'about', label: 'About', key: 'About' }, | ||
{ href: 'portfolio', label: 'Portfolio', key: 'Portfolio' }, | ||
{ href: "about", label: "About", key: "About" }, | ||
{ href: "portfolio", label: "Portfolio", key: "Portfolio" }, | ||
{ | ||
href: 'mailto:[email protected]', | ||
label: 'Contact us', | ||
key: 'Contact-Us', | ||
href: "mailto:[email protected]", | ||
label: "Contact us", | ||
key: "Contact-Us", | ||
}, | ||
] | ||
]; | ||
|
||
const FOOTER_ITEMS_SUPPORT: ReadonlyArray<FooterItems> = [ | ||
{ | ||
href: 'https://opencollective.com/open-austin', | ||
label: 'Open Collective', | ||
key: 'oc', | ||
href: "https://opencollective.com/open-austin", | ||
label: "Open Collective", | ||
key: "oc", | ||
}, | ||
{ | ||
href: 'https://github.com/sponsors/open-austin', | ||
label: 'GitHub Sponsor', | ||
key: 'github', | ||
href: "https://github.com/sponsors/open-austin", | ||
label: "GitHub Sponsor", | ||
key: "github", | ||
}, | ||
] | ||
]; | ||
|
||
const SOCIAL_ITEMS: ReadonlyArray<FooterItems> = [ | ||
{ | ||
label: 'Twitter', | ||
href: 'https://twitter.com/openaustin', | ||
label: "Twitter", | ||
href: "https://twitter.com/openaustin", | ||
icon: <FaTwitter />, | ||
key: 'twitter', | ||
key: "twitter", | ||
}, | ||
{ | ||
label: 'Youtube', | ||
href: 'https://www.youtube.com/channel/UCSDcLeHsq8k-WLaJaRQHh4w', | ||
label: "Youtube", | ||
href: "https://www.youtube.com/channel/UCSDcLeHsq8k-WLaJaRQHh4w", | ||
icon: <FaYoutube />, | ||
key: 'youtube', | ||
key: "youtube", | ||
}, | ||
{ | ||
label: 'LinkedIn', | ||
href: 'https://www.linkedin.com/company/open-austin/about/', | ||
label: "LinkedIn", | ||
href: "https://www.linkedin.com/company/open-austin/about/", | ||
icon: <FaLinkedin />, | ||
key: 'linkedin', | ||
key: "linkedin", | ||
}, | ||
{ | ||
label: 'GitHub', | ||
href: 'https://github.com/open-austin', | ||
label: "GitHub", | ||
href: "https://github.com/open-austin", | ||
icon: <FaGithub />, | ||
key: 'github', | ||
key: "github", | ||
}, | ||
] | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
// Importing fonts (there's probably a better way to do this...) | ||
import '@fontsource/crimson-text' | ||
|
||
import "@fontsource/crimson-text"; | ||
import crimsonTextLatin from "@fontsource/crimson-text/files/crimson-text-latin-400-normal.woff2"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think Next recommends using their https://nextjs.org/docs/pages/building-your-application/optimizing/fonts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 👍 |
||
|
||
// Setup for Chakra and Next environments | ||
import { ChakraProvider } from '@chakra-ui/react' | ||
import { Analytics } from '@vercel/analytics/react' | ||
import { ChakraProvider } from "@chakra-ui/react"; | ||
import { Analytics } from "@vercel/analytics/react"; | ||
|
||
import { type AppProps } from 'next/app' | ||
import Head from 'next/head' | ||
import { type AppProps } from "next/app"; | ||
import Head from "next/head"; | ||
|
||
import { theme } from '../lib/theme' | ||
import { Header } from '../components/header' | ||
import { Footer } from '../components/footer' | ||
import { theme } from "../lib/theme"; | ||
import { Header } from "../components/header"; | ||
import { Footer } from "../components/footer"; | ||
jcalcaben marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
function MyApp({ Component, pageProps }: AppProps) { | ||
return ( | ||
|
@@ -22,13 +24,20 @@ function MyApp({ Component, pageProps }: AppProps) { | |
content="Open Austin is a volunteer citizen brigade advocating for open government, open data, and civic application development since 2009." | ||
/> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<link | ||
rel="preload" | ||
href={crimsonTextLatin} | ||
as="font" | ||
type="font/woff2" | ||
crossOrigin="anonymous" | ||
/> | ||
</Head> | ||
<Header /> | ||
<Analytics /> | ||
<Component {...pageProps} /> | ||
<Footer /> | ||
</ChakraProvider> | ||
) | ||
); | ||
} | ||
|
||
export default MyApp | ||
export default MyApp; |
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From their docs:
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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