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: add testimonial carousel #1704

Closed
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
622c655
feat: add testimonial carousel
May 23, 2023
ab4f4ac
Merge branch 'master' into async_testimonial
ashutosh-rath02 May 25, 2023
43a69d4
fix: add arrows for navigation
May 25, 2023
ab5633d
Merge branch 'async_testimonial' of https://github.com/Lucif3r-in/web…
May 25, 2023
143b22e
Merge branch 'master' into async_testimonial
ashutosh-rath02 May 28, 2023
db3beea
fix: fix nav arrow && chore: add content to config
May 28, 2023
ef4e468
fix: added comments explaining the logic
May 28, 2023
0325cec
Merge branch 'master' into async_testimonial
ashutosh-rath02 May 29, 2023
2962bca
Merge branch 'master' into async_testimonial
ashutosh-rath02 May 30, 2023
a531ff0
fix: change card structure
ashutosh-rath02 Jun 1, 2023
3310087
Merge branch 'async_testimonial' of https://github.com/Lucif3r-in/web…
ashutosh-rath02 Jun 1, 2023
3892e2e
Merge branch 'master' into async_testimonial
ashutosh-rath02 Jun 4, 2023
fafd00e
fix: change arrow styles && chore: store TestimonialData
ashutosh-rath02 Jun 4, 2023
00af294
feat: add auto scroll to carousels
ashutosh-rath02 Jun 4, 2023
f7e677c
fix: suggested changes
ashutosh-rath02 Oct 1, 2023
13815e9
Revert "fix: suggested changes"
ashutosh-rath02 Oct 1, 2023
6a54171
fix: made changes
ashutosh-rath02 Oct 1, 2023
232c3c7
Merge branch 'master' into async_testimonial
ashutosh-rath02 Oct 1, 2023
3d3533b
Merge branch 'master' into async_testimonial
ashutosh-rath02 Dec 8, 2023
453ee50
Merge branch 'master' into async_testimonial
ashutosh-rath02 Mar 6, 2024
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
99 changes: 68 additions & 31 deletions components/Testimonial.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,72 @@
import Paragraph from "./typography/Paragraph";
import { FaArrowLeft, FaArrowRight } from 'react-icons/fa';
ashutosh-rath02 marked this conversation as resolved.
Show resolved Hide resolved
import { useState } from 'react';
import testimonials from '../config/content/Testimonial';

const TestimonialCarousel = () => {
const [activeIndex, setActiveIndex] = useState(0);
const len = testimonials.length;

const goToPrevious = () => {
setActiveIndex((prevIndex) => (prevIndex === 0 ? len - 1 : prevIndex - 1));
};

const goToNext = () => {
setActiveIndex((prevIndex) => (prevIndex === len - 1 ? 0 : prevIndex + 1));
};

const goToIndex = (index) => {
setActiveIndex(index);
};

export default function Testimonial({
className = '',
text,
authorName,
authorDescription,
authorAvatar,
}) {
return (
<li className={`py-4 px-4 sm:px-6 md:flex md:flex-row md:py-4 md:pr-0 ${className}`}>
<blockquote className="mt-8 md:flex-grow md:flex md:flex-col">
<div className="relative text-lg leading-7 font-medium text-gray-600 md:flex-1">
<svg className="absolute top-0 left-0 transform -translate-y-2 h-8 w-8 text-primary-500" fill="currentColor" viewBox="0 0 32 32">
<path d="M9.352 4C4.456 7.456 1 13.12 1 19.36c0 5.088 3.072 8.064 6.624 8.064 3.36 0 5.856-2.688 5.856-5.856 0-3.168-2.208-5.472-5.088-5.472-.576 0-1.344.096-1.536.192.48-3.264 3.552-7.104 6.624-9.024L9.352 4zm16.512 0c-4.8 3.456-8.256 9.12-8.256 15.36 0 5.088 3.072 8.064 6.624 8.064 3.264 0 5.856-2.688 5.856-5.856 0-3.168-2.304-5.472-5.184-5.472-.576 0-1.248.096-1.44.192.48-3.264 3.456-7.104 6.528-9.024L25.864 4z" />
</svg>
<Paragraph className="relative pl-10 text-left">
{text}
</Paragraph>
</div>
<footer className="mt-6">
<div className="flex">
<figure className="flex-shrink-0 inline-flex rounded-full border-2 border-white">
<img className="h-12 w-12 rounded-full" src={authorAvatar} alt={authorName}/>
</figure>
<div className="ml-4 text-left">
<p className="text-base leading-6 font-bold text-gray-900">{authorName}</p>
<p className="text-base leading-6 font-medium text-primary-500">{authorDescription}</p>
<div className="relative flex flex-row justify-center items-center md:gap-4 overflow-x-hidden">
<div className="h-8 w-8 rounded-full bg-[#ddd] cursor-pointer mb-2 absolute left-0 z-10 top-1/2 transform -translate-y-1/2 opacity-50 md:opacity-100" onClick={goToPrevious}>
<FaArrowLeft className="mt-[20%] m-auto"/>
</div>
<div className="flex flex-col justify-center items-center">
<div className="relative h-[300px] w-[300px] md:w-[600px] md:h-[450px] overflow-hidden">
ashutosh-rath02 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Don't specify height for the box, as you may not know how long can be testimonial text. Moreover, using overflow-hidden is not a good practice. You can allow Read More option inside box to expand the testimonial box.

Copy link
Contributor Author

@ashutosh-rath02 ashutosh-rath02 Oct 1, 2023

Choose a reason for hiding this comment

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

For some reason I cant set the height to auto... When I am doing height-auto or max-content the cards just disappears. The Read more part is causing some issue also, causing this PR to delay

Copy link
Member

@Mayaleeeee Mayaleeeee Oct 2, 2023

Choose a reason for hiding this comment

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

Weldone @akshatnema

Hello @Lucif3r-in, thank you.
Where can I review the updated version of the testimonial section? Or is it still the same link in the deploy preview column?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same link @Mayaleeeee

Copy link
Member

@Mayaleeeee Mayaleeeee Oct 2, 2023

Choose a reason for hiding this comment

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

  1. The icon here is not centered in the middle.
    Screenshot 2023-10-02 134612

  2. You need to change the card background color to white and add elevation to match other cards on the website.
    Screenshot 2023-10-02 173125

Thank you @Lucif3r-in

{testimonials.map((testimonial, index) => (
<div
key={index}
className={`flex flex-col items-center justify-center absolute bg-slate-100 shadow-md rounded-md transform transition-transform ${
index === activeIndex ? 'opacity-100 scale-100' : 'opacity-0 scale-90'
}`}
>
<div className="rounded-full h-16 w-16 md:h-32 md:w-32 overflow-hidden my-4">
<img src={testimonial.imgUrl} className="h-full w-full" alt={testimonial.name} />
</div>
<p className="text-[14px] lg:text-base lg:leading-6 font-bold text-gray-900 mb-2">
{testimonial.name}
</p>
<p className="text-[12px] lg:text-base lg:leading-6 font-medium text-primary-500 mb-2 md:mb-4">
{testimonial.salutation}
</p>
<p className="h-[200px] text-[12px] px-1 lg:px-6 overflow-clip md:text-lg">
{testimonial.text}
</p>
</div>
))}
</div>
<div className="flex justify-center w-[400px] mt-4">
{testimonials.map((testimonial, index) => (
<div
key={index}
className={`h-2 w-2 rounded-full mx-1 cursor-pointer ${
activeIndex === index ? 'bg-primary-500' : 'bg-gray-300'
}`}
onClick={() => goToIndex(index)}
/>
))}
</div>
</div>
<div
className="h-8 w-8 rounded-full bg-[#ddd] cursor-pointer mb-2 z-10 absolute right-0 top-1/2 transform -translate-y-1/2 opacity-50 md:opacity-100"
onClick={goToNext}
>
<FaArrowRight className="mt-[20%] m-auto"/>
</div>
</footer>
</blockquote>
</li>
)
}
</div>
);
};

export default TestimonialCarousel;
28 changes: 28 additions & 0 deletions config/content/Testimonial.js
ashutosh-rath02 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const TestimonialData = [
{
imgUrl: '/img/testimonials/matt-mclarty.jpg',
name: 'Matt McLarty',
salutation: 'Global Leader of API Strategy at MuleSoft',
text: 'Microservices underline the need for event-based communication in distributed architectures. AsyncAPI brings the richness of the REST API ecosystem to asynchronous APIs.',
},
{
imgUrl: '/img/testimonials/bill-doerrfeld.jpg',
name: 'Bill Doerrfeld',
salutation: 'Editor in Chief at Nordic APIs',
text: 'Microservices underline the need for event-based communication in distributed architectures. AsyncAPI brings the richness of the REST API ecosystem to asynchronous APIs.',
},
{
imgUrl: '/img/testimonials/jonathan-schabowsky.jpg',
name: 'Jonathan Schabowsky',
salutation: 'Sr. Architect, Office of the CTO at Solace',
text: "Developers need to be able to quickly and consistently create event-driven applications that provide business value and react to customer needs in realtime. I can't count how many times I've heard developers ask for OpenAPI/Swagger style tools for the asynchronous and event driven world, and that is exactly what the AsyncAPI initiative is making a reality.",
},
{
imgUrl: '/img/testimonials/eric-horesnyi.jpg',
name: 'Eric Horesnyi',
salutation: 'CEO at Streamdata.io',
text: 'We’ve been focusing on event-driven APIs since 2014 and thank the AsyncAPI contributors everyday for driving the community towards common standards.',
},
];

export default TestimonialData
15 changes: 15 additions & 0 deletions package-lock.json
ashutosh-rath02 marked this conversation as resolved.
Show resolved Hide resolved

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 @@ -79,6 +79,7 @@
"react-dom": "^17.0.2",
"react-ga": "^3.1.2",
"react-gtm-module": "^2.0.11",
"react-icons": "^4.8.0",
Copy link
Member

Choose a reason for hiding this comment

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

Are we using these icons anywhere in the PR? I don't see any imports for this library.

"react-scrollspy": "^3.4.2",
"react-syntax-highlighter": "12.2.1",
"react-text-truncate": "^0.16.0",
Expand Down
33 changes: 2 additions & 31 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,39 +218,10 @@ function HomePage() {
<SupportUs className="mt-4" showSupportBanner={false} />
</Container>
<Container className="text-center pb-20 mt-8" wide as="section">
<Heading level="h3" typeStyle="heading-lg" className="mb-4">
<Heading level="h3" typeStyle="heading-lg" className="mb-8">
What the experts are saying
</Heading>
<ul className="max-w-screen-xl mx-auto md:grid md:grid-cols-2 md:px-6 lg:px-8">
<Testimonial
className="md:pr-10 lg:pr-16"
text="Microservices underline the need for event-based communication in distributed architectures. AsyncAPI brings the richness of the REST API ecosystem to asynchronous APIs."
authorAvatar="/img/testimonials/matt-mclarty.jpg"
authorName="Matt McLarty"
authorDescription="Global Leader of API Strategy at MuleSoft"
/>
<Testimonial
className="md:pl-10 lg:pl-16"
text="Event-driven APIs need love too! AsyncAPI brings the many benefits of a machine/human readable specification to these nuanced approaches."
authorAvatar="/img/testimonials/bill-doerrfeld.jpg"
authorName="Bill Doerrfeld"
authorDescription="Editor in Chief at Nordic APIs"
/>
<Testimonial
className="md:pr-10 lg:pr-16"
text="Developers need to be able to quickly and consistently create event-driven applications that provide business value and react to customer needs in realtime. I can't count how many times I've heard developers ask for OpenAPI/Swagger style tools for the asynchronous and event driven world, and that is exactly what the AsyncAPI initiative is making a reality."
authorAvatar="/img/testimonials/jonathan-schabowsky.jpg"
authorName="Jonathan Schabowsky"
authorDescription="Sr. Architect, Office of the CTO at Solace"
/>
<Testimonial
className="md:pl-10 lg:pl-16"
text="We’ve been focusing on event-driven APIs since 2014 and thank the AsyncAPI contributors everyday for driving the community towards common standards."
authorAvatar="/img/testimonials/eric-horesnyi.jpg"
authorName="Eric Horesnyi"
authorDescription="CEO at Streamdata.io"
/>
</ul>
<Testimonial />
</Container>
</main>
</>
Expand Down