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

feat: testimonial carousel on homepage #467

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: add testimonial card component
Josh Morton committed May 23, 2023
commit f93026e47fd7c76a23693ef31283866148435a1e
42 changes: 42 additions & 0 deletions src/components/Testimonal/TestimonialCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import PropTypes from 'prop-types'
import Image from 'next/image'

const imageLoader = ({ src, width }) => {
return `${src}?w=${width}`
}

function TestimonialCard({ testimonial }) {
return (
<>
<div className="cause_section_content">
<div className="testimonial-row">
<Image
src={'/../images/' + testimonial.image}
loader={imageLoader}
alt={testimonial.name}
height={200}
width={200}
placeholder="blur"
blurDataURL={'/../images/' + testimonial.image}
/>
<blockquote className="testimonial-text">
<p>
&quot;{testimonial.text}&quot;
<br /> - {testimonial.signature}
</p>
</blockquote>
</div>
</div>
</>
)
}

TestimonialCard.propTypes = PropTypes.shape({
id: PropTypes.string,
name: PropTypes.string,
image: PropTypes.string,
text: PropTypes.string,
signature: PropTypes.string,
})

export default TestimonialCard
1 change: 1 addition & 0 deletions src/components/Testimonal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './TestimonialCard'
32 changes: 4 additions & 28 deletions src/pages/testimonials.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Image from 'next/image'
import { NextSeo } from 'next-seo'
import PageHeader from '../components/PageHeader'
import { getTestimonials } from '@/utilities/testimonials'

const imageLoader = ({ src, width }) => {
return `${src}?w=${width}`
}
import TestimonialCard from '@/components/Testimonal/TestimonialCard'

function Testimonial() {
return (
@@ -25,29 +21,9 @@ function Testimonial() {
</p>
</div>
<div className="col-md-12">
<div className="cause_section_content">
{getTestimonials().map((testimonial, i) => {
return (
<div key={'testimonial' + i} className="testimonial-row">
<Image
src={'/../images/' + testimonial.image}
loader={imageLoader}
alt={testimonial.name}
height={200}
width={200}
placeholder="blur"
blurDataURL={'/../images/' + testimonial.image}
/>
<blockquote className="testimonial-text">
<p>
&quot;{testimonial.text}&quot;
<br /> - {testimonial.signature}
</p>
</blockquote>
</div>
)
})}
</div>
{getTestimonials().map(testimonial => {
return <TestimonialCard key={testimonial.id} testimonial={testimonial} />
})}
</div>
</div>
</div>