Skip to content

Commit

Permalink
Improve homepage styling
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Sep 30, 2023
1 parent dbc0618 commit 6a94a4a
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 7 deletions.
71 changes: 70 additions & 1 deletion components/homepage/hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,60 @@
import { useState, useRef } from 'react'
import { useInterval } from 'usehooks-ts'
import { motion, useAnimation, useInView } from 'framer-motion'
import { Container, Stack, Heading, Text } from '@chakra-ui/react'

const word = {
hidden: {
opacity: 1,
transition: {
duration: 3.0,
},
},
visible: {
opacity: 1,
transition: {
delay: 0.5,
staggerChildren: 0.05,
},
},
}

const letter = {
hidden: {
opacity: 0,
y: 50,
},
visible: {
opacity: 1,
y: 0,
},
}

const wordsToDisplay = [
'Celebrating',
'Encouraging',
'Galvanising',
'Uplifting',
]

export default function Hero() {
const [wordIndex, setWordIndex] = useState(0)
const controls = useAnimation()
const ref = useRef(null)
const isInView = useInView(ref)

useInterval(() => {
const nextIndex =
wordIndex === wordsToDisplay.length - 1 ? 0 : wordIndex + 1
setWordIndex(nextIndex)

if (isInView) {
controls.start('visible')
} else {
controls.start('hidden')
}
}, 5000)

return (
<>
<Container maxW="7xl" mt="1rem">
Expand All @@ -23,7 +77,22 @@ export default function Hero() {
wordBreak="break-word"
textAlign={{ base: 'left', md: 'center' }}
>
Celebrating place-based community{' '}
<motion.span
variants={word}
initial="hidden"
animate="visible"
ref={ref}
key={wordsToDisplay[wordIndex]}
>
{wordsToDisplay[wordIndex].split('').map((char, index) => {
return (
<motion.span key={`${char}-${index}`} variants={letter}>
{char}
</motion.span>
)
})}
</motion.span>{' '}
<span>place-based community </span>
<Text
as="span"
fontWeight={600}
Expand Down
7 changes: 6 additions & 1 deletion components/homepage/web-cards/WebCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Card = ({ web }) => {
alt={`Image representing ${web.title} web`}
src={web.image}
fill={true}
style={{ objectFit: 'cover' }}
style={{ objectFit: 'cover', objectPosition: 'bottom' }}
/>
</Box>
<Stack>
Expand All @@ -77,3 +77,8 @@ const Card = ({ web }) => {
)
}






1 change: 1 addition & 0 deletions components/layout/Layout.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.root {
margin-top: 1rem;
p {
font-size: 1.125rem;
line-height: 1.6;
Expand Down
2 changes: 1 addition & 1 deletion components/nav/Nav.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

&:hover {
text-decoration: none;
color: rgb(93, 106, 126);
color: #4A5568;
}

&.active {
Expand Down
8 changes: 4 additions & 4 deletions components/nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ const DesktopNav = ({ currentPathname, navItems }) => {
{navItem.children && (
<PopoverContent
border={0}
boxShadow={'xl'}
boxShadow="2xl"
bg="white"
p={2}
rounded={'xl'}
rounded="xl"
>
<Stack>
{navItem.children.map((child) => (
<DesktopSubNav key={child.label} {...child} />
<DesktopSubNavItem key={child.label} {...child} />
))}
</Stack>
</PopoverContent>
Expand All @@ -231,7 +231,7 @@ const DesktopNav = ({ currentPathname, navItems }) => {
)
}

const DesktopSubNav = ({ label, href }) => {
const DesktopSubNavItem = ({ label, href }) => {
return (
<Link
href={href}
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"tinymce": "6.7.0",
"use-debounce": "9.0.4",
"use-local-storage": "3.0.0",
"usehooks-ts": "2.9.1",
"vis-network-react": "github:DinerIsmail/vis-network-react"
},
"devDependencies": {
Expand Down

1 comment on commit 6a94a4a

@vercel
Copy link

@vercel vercel bot commented on 6a94a4a Sep 30, 2023

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.