Skip to content

Commit

Permalink
Merge pull request #13 from spencer-rafada/spencer/about-approach
Browse files Browse the repository at this point in the history
ABOUT - Approaches Section
  • Loading branch information
spencer-rafada authored Mar 20, 2024
2 parents fc6f487 + ca6c040 commit e95c81b
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 54 deletions.
60 changes: 15 additions & 45 deletions src/app/(home)/Approach.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import {
Card,
CardHeader,
Flex,
Grid,
GridItem,
Heading,
Link,
} from '@chakra-ui/react'
import { Flex, Grid, GridItem, Heading } from '@chakra-ui/react'
import React from 'react'
import ApproachItem from './ApproachItem'

export default function Approach() {
// Approaches
Expand Down Expand Up @@ -36,48 +29,25 @@ export default function Approach() {
className='gap-x-8'
>
<GridItem>
<Link href='/about'>
<Card>
<CardHeader>
<Heading as='h3' size='md'>
Community Centered Approach
</Heading>
</CardHeader>
</Card>
</Link>
<ApproachItem href='/about' title='Community Centered Approach' />
</GridItem>
<GridItem className='md:even:mt-10'>
<Link href='/about'>
<Card>
<CardHeader>
<Heading as='h3' size='md'>
Needs Assessment and Dialogue
</Heading>
</CardHeader>
</Card>
</Link>
<ApproachItem href='/about' title='Needs Assessment and Dialogue' />
</GridItem>
<GridItem>
<Link href='/about'>
<Card>
<CardHeader>
<Heading as='h3' size='md'>
Inclusive Planning
</Heading>
</CardHeader>
</Card>
</Link>
<ApproachItem href='/about' title='Inclusive Planning' />
</GridItem>
<GridItem className='md:even:mt-10'>
<Link href='/about'>
<Card>
<CardHeader>
<Heading as='h3' size='md'>
Education Advocacy
</Heading>
</CardHeader>
</Card>
</Link>
<ApproachItem href='/about' title='Education Advocacy' />
</GridItem>
<GridItem className='md:even:mt-10'>
<ApproachItem href='/about' title='Legal Workforce Engagement' />
</GridItem>
<GridItem className='md:even:mt-10'>
<ApproachItem href='/about' title='Transparent Implementation' />
</GridItem>
<GridItem className='md:even:mt-10'>
<ApproachItem href='/about' title='Sustainability and Longevity' />
</GridItem>
</Grid>
</Flex>
Expand Down
28 changes: 28 additions & 0 deletions src/app/(home)/ApproachItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use client'
import { Card, CardHeader, Heading } from '@chakra-ui/react'
import Link from 'next/link'
import React from 'react'

export default function ApproachItem({
href,
title,
}: {
href: string
title: string
}) {
const handleClick = () => {
sessionStorage.setItem('approach', 'true')
}

return (
<Link href={href} onClick={handleClick}>
<Card>
<CardHeader>
<Heading as='h3' size='md'>
{title}
</Heading>
</CardHeader>
</Card>
</Link>
)
}
37 changes: 37 additions & 0 deletions src/app/about/components/AboutContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use client'
import React, { useEffect, useRef } from 'react'
import OurStory from './OurStory'
import VisionMission from './VisionMission'
import CTASection from '@/app/(home)/CTASection'
import Approach from './Approaches'
import { Box } from '@chakra-ui/react'

export default function AboutContent() {
const ref = useRef<HTMLElement | null>(null)

useEffect(() => {
if (sessionStorage.getItem('approach')) {
setTimeout(() => {
ref.current?.scrollIntoView({
behavior: 'smooth',
block: 'start',
})
}, 500)
sessionStorage.removeItem('approach')
}
}, [ref])

return (
<>
<OurStory />
<VisionMission />
<Box ref={ref as React.RefObject<HTMLDivElement>}>
<Approach />
</Box>
<CTASection
heading='Get to Know Us More'
subheading='We can tell you more about how your donations are put in to good use.'
/>
</>
)
}
147 changes: 147 additions & 0 deletions src/app/about/components/Approaches.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import {
Accordion,
AccordionItem,
AccordionButton,
Flex,
Heading,
AccordionPanel,
AccordionIcon,
} from '@chakra-ui/react'
import React from 'react'

export default function Approach() {
// Approaches
// 1. Community Centered Approach
// 2. Needs Assessment and Dialogue
// 3. Inclusive Planning
// 4. Education Advocacy
// 5. Legal Workforce Engagement
// 6. Transparent Implementation
// 7. Sustainability anad Longevity

return (
<>
<Flex
p={{ base: 8, lg: 16 }}
gap={{ base: 5, lg: 8 }}
direction={'column'}
>
<Heading as='h2' textAlign='center' color='brand.500'>
Our Approach
</Heading>
<Accordion
data-testid='about-approaches-container'
defaultIndex={[0]}
allowMultiple
bgColor='white'
>
<AccordionItem>
<AccordionButton
className='justify-between'
data-testid='about-approaches-accordion-community'
>
<Heading as='h3' size='md'>
Community Centered Approach
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel data-testid='about-approaches-accordion-community-content'>
At the Ray Foundation, we firmly believe in the power of community
collaboration to drive positive change in Sierra Leone. Our
approach centers around fostering a collective spirit of
empowerment and engagement to uplift the lives of those we serve.
By involving the community at every step, we ensure that our
initiatives are tailored to local needs, sustainable, and truly
transformative in our effort to provide education, healthcare, and
clean water in Sierra Leone.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton className='justify-between'>
<Heading as='h3' size='md'>
Needs Assessment and Dialogue
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel>
We start by listening to the voices of the community. Through open
dialogues and needs assessments, we gain a comprehensive
understanding of the challenges, aspirations, and priorities that
shape the community&apos;s well-being.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton className='justify-between'>
<Heading as='h3' size='md'>
Inclusive Planning
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel>
Our planning process involves community members, local leaders,
and experts. Together, we co-create strategies that address
identified needs while aligning with the community&apos;s culture,
values, and existing resources.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton className='justify-between'>
<Heading as='h3' size='md'>
Education Advocacy
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel>
In alignment with our mission, we actively engage with community
members to raise awareness about the transformative power of
education. We encourage parents, guardians, and children to value
and prioritize learning.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton className='justify-between'>
<Heading as='h3' size='md'>
Legal Workforce Engagement
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel>
We prioritize hiring skilled labor from within the community,
supporting economic growth and providing employment opportunities.
This not only enhances the project&apos;s impact but also fosters
a sense of pride and ownership.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton className='justify-between'>
<Heading as='h3' size='md'>
Transparent Implementation
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel>
Transparency is paramount to building trust. We ensure that every
step of the project implementation is communicated to the
community, showcasing and documenting our progress and involving
them in decision-making whenever needed.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton className='justify-between'>
<Heading as='h3' size='md'>
Sustainability anad Longevity
</Heading>
<AccordionIcon />
</AccordionButton>
<AccordionPanel>
Our projects are designed for enduring impact. We collaborate with
the community to develop maintenance and sustainability plans,
ensuring that the benefits of our initiatives continue to be felt
for generations to come.
</AccordionPanel>
</AccordionItem>
</Accordion>
</Flex>
</>
)
}
17 changes: 17 additions & 0 deletions src/app/about/components/__tests__/Approaches.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { screen, render, fireEvent } from '@testing-library/react'
import Approach from '../Approaches'

describe('Approaches', () => {
it('should render the accordions container', () => {
render(<Approach />)
expect(screen.getByTestId('about-approaches-container')).toBeInTheDocument()
})
it('should open the accordion when clicked', () => {
render(<Approach />)
const accordion = screen.getByTestId('about-approaches-accordion-community')
fireEvent.click(accordion)
expect(
screen.getByTestId('about-approaches-accordion-community-content')
).toBeInTheDocument()
})
})
11 changes: 2 additions & 9 deletions src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Metadata } from 'next'
import React from 'react'
import OurStory from './components/OurStory'
import VisionMission from './components/VisionMission'
import CTASection from '../(home)/CTASection'
import AboutContent from './components/AboutContent'

export const metadata: Metadata = {
title: 'About',
Expand All @@ -12,12 +10,7 @@ export const metadata: Metadata = {
export default function About() {
return (
<>
<OurStory />
<VisionMission />
<CTASection
heading='Get to Know Us More'
subheading='We can tell you more about how your donations are put in to good use.'
/>
<AboutContent />
</>
)
}

0 comments on commit e95c81b

Please sign in to comment.