Skip to content

Commit

Permalink
fix: improved what the experts are saying section #1696
Browse files Browse the repository at this point in the history
Signed-off-by: SumantxD <[email protected]>
  • Loading branch information
SumantxD committed May 20, 2023
1 parent 1f3c72c commit 2e66667
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 64 deletions.
215 changes: 215 additions & 0 deletions components/Carousel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
import React, { Fragment, useEffect, useState } from "react";


export default function Carousel({
data,
fullscreen,
timer,
interval,
arrows,
dots,
}) {
const [current, setCurrent] = useState(0);
const [paused, setPaused] = useState(false);
const [isFullscreen, setIsFullscreen] = useState(false);

function handlePrevious() {
let i = current;
i -= 1;
if (i < 0) i = data.length - 1;
setCurrent(i);
}

function handleNext() {
let i = current;
i += 1;
if (i > data.length - 1) i = 0;
setCurrent(i);
}

function handlePause() {
setPaused(!paused);
}

useEffect(() => {
const INTERVAL = setInterval(() => {
if (timer && !paused) handleNext();
}, interval || 5000);

return () => clearInterval(INTERVAL);
}, [current, paused]);

{/*---------------------------------------------------- Component start here ------------------------------------------------------ */}

return (
<div
className={`flex mx-auto mb-5 overflow-hidden justify-center ${
isFullscreen
? "fixed top-0 left-0 z-50 h-screen bg-white dark:bg-slate-700"
: "w-[80vw] relative"
}`}
>
{data.map((item, index) => (
<div
key={index}
className={`${
index === current ? "relative" : "absolute opacity-0"
} ${index !== current && index > current ? "translate-x-full" : ""} ${
index !== current && index < current ? "-translate-x-full" : ""
} w-full transition-all duration-700`}
>
{!item.video ? item.element : null}
{index === current && item.video ? item.element : null}
<div
className={`${
index === current ? "" : "opacity-0"
} absolute bottom-0 w-full`}
>
{item.show ? (
<div className="mx-auto mb-10 w-3/4 flex-col text-center">
<p className="text-slate-300 text-2xl">{data.title}</p>
<p className="text-slate-300 text-2xl">{data.description}</p>
</div>
) : null}
</div>
</div>
))}
<div className="absolute inset-x-5 flex justify-between pt-5">
{timer ? (
<button
key={"Carousel-pause"}
onClick={() => handlePause()}
className="opacity-75 hover:opacity-100 hover:scale-110 transition-all"
>
{paused ? (
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 16 16"
height="2em"
width="2em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path>
<path d="M6.271 5.055a.5.5 0 0 1 .52.038l3.5 2.5a.5.5 0 0 1 0 .814l-3.5 2.5A.5.5 0 0 1 6 10.5v-5a.5.5 0 0 1 .271-.445z"></path>
</svg>
) : (
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 16 16"
height="2em"
width="2em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path>
<path d="M5 6.25a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0v-3.5zm3.5 0a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0v-3.5z"></path>
</svg>
)}
</button>
) : (
<div></div>
)}
{fullscreen ? (
<button
key={"Carousel-screen"}
onClick={() => setIsFullscreen(!isFullscreen)}
className="opacity-75 hover:opacity-100 hover:scale-110 transition-all"
>
{isFullscreen ? (
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
version="1.1"
viewBox="0 0 16 16"
height="2em"
width="2em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M9 7h6.5l-2.5-2.5 3-3-1.5-1.5-3 3-2.5-2.5z"></path>
<path d="M9 9v6.5l2.5-2.5 3 3 1.5-1.5-3-3 2.5-2.5z"></path>
<path d="M7 9h-6.5l2.5 2.5-3 3 1.5 1.5 3-3 2.5 2.5z"></path>
<path d="M7 7v-6.5l-2.5 2.5-3-3-1.5 1.5 3 3-2.5 2.5z"></path>
</svg>
) : (
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 24 24"
height="2em"
width="2em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="m21 15.344-2.121 2.121-3.172-3.172-1.414 1.414 3.172 3.172L15.344 21H21zM3 8.656l2.121-2.121 3.172 3.172 1.414-1.414-3.172-3.172L8.656 3H3zM21 3h-5.656l2.121 2.121-3.172 3.172 1.414 1.414 3.172-3.172L21 8.656zM3 21h5.656l-2.121-2.121 3.172-3.172-1.414-1.414-3.172 3.172L3 15.344z"></path>
</svg>
)}
</button>
) : (
<div />
)}
</div>

<div className="absolute inset-x-5 top-1/2 flex -translate-y-1/2 justify-between">
{arrows ? (
<Fragment>
<button
key={"Carousel-left"}
onClick={() => handlePrevious()}
className="opacity-75 hover:opacity-100 hover:scale-110 transition-all"
>
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 24 24"
height="2em"
width="2em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"></path>
<path d="M16 16V8l-5 4zM9 8v8h2V8z"></path>
</svg>
</button>
<button
key={"Carousel-right"}
onClick={() => handleNext()}
className="opacity-75 hover:opacity-100 hover:scale-110 transition-all"
>
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 24 24"
height="2em"
width="2em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"></path>
<path d="m8 16 5-4-5-4zm5-4v4h2V8h-2z"></path>
</svg>
</button>
</Fragment>
) : null}
</div>
<div className="absolute inset-x-5 bottom-0 pb-5 flex justify-center">
{dots ? (
<div className="flex gap-2">
{data.map((item, index) => (
<button
key={index}
onClick={() => setCurrent(index)}
className={`w-2 h-2 rounded-full hover:scale-150 transition-all ${
current === index ? " bg-purple-300" : "bg-slate-500"
}`}
/>
))}
</div>
) : null}
</div>
</div>
);
}
35 changes: 0 additions & 35 deletions components/Testimonial.js

This file was deleted.

114 changes: 85 additions & 29 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import AxwayLogo from '../components/logos/Axway'
import SlackLogo from '../components/logos/Slack'
import SalesforceLogo from '../components/logos/Salesforce'
import SapLogo from '../components/logos/SAP'
import Testimonial from '../components/Testimonial'
import Heading from '../components/typography/Heading'
import Paragraph from '../components/typography/Paragraph'
import TextLink from '../components/typography/TextLink'
Expand All @@ -24,6 +23,7 @@ import GoogleCalendarButton from '../components/buttons/GoogleCalendarButton';
import ICSFileButton from '../components/buttons/ICSFileButton';
import SubscribeButton from '../components/buttons/SubscribeButton';
import NewsroomSection from '../components/newsroom/NewsroomSection'
import Carousel from '../components/Carousel'

function HomePage() {
return (
Expand Down Expand Up @@ -221,34 +221,90 @@ function HomePage() {
<Heading level="h3" typeStyle="heading-lg" className="mb-4">
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 className="max-w-screen-xl mx-auto md:grid md:grid-cols-2 md:px-6 lg:px-8 w-full h-[70vh]">
<Carousel
timer
fullscreen
arrows
dots
data={[
{
element: (
<section className="text-gray-600 body-font w-[500px] object-contain mx-auto -mt-12">
<div className="container px-5 py-24 mx-auto">
<div className="flex flex-wrap -m-4">
<div className="mb-6 p-4">
<div className="h-full text-center">
<img alt="testimonial" className="w-20 h-20 mb-8 object-cover object-center rounded-full inline-block border-2 border-gray-200 bg-gray-100" src="/img/testimonials/matt-mclarty.jpg"/>
<p className="leading-relaxed">Microservices underline the need for event-based communication in distributed architectures. AsyncAPI brings the richness of the REST API ecosystem to asynchronous APIs.</p>
<span className="inline-block h-1 w-10 rounded bg-indigo-500 mt-6 mb-4"></span>
<h2 className="text-gray-900 font-medium title-font tracking-wider text-sm">Matt McLarty</h2>
<p className="text-gray-500">Global Leader of API Strategy at MuleSoft</p>
</div>
</div>
</div>
</div>
</section>
),
},
{
element: (
<section className="text-gray-600 body-font w-[500px] object-contain mx-auto -mt-12">
<div className="container px-5 py-24 mx-auto">
<div className="flex flex-wrap -m-4">
<div className="mb-6 p-4">
<div className="h-full text-center">
<img alt="testimonial" className="w-20 h-20 mb-8 object-cover object-center rounded-full inline-block border-2 border-gray-200 bg-gray-100" src="/img/testimonials/bill-doerrfeld.jpg"/>
<p className="leading-relaxed">Event-driven APIs need love too! AsyncAPI brings the many benefits of a machine/human readable specification to these nuanced approaches.</p>
<span className="inline-block h-1 w-10 rounded bg-indigo-500 mt-6 mb-4"></span>
<h2 className="text-gray-900 font-medium title-font tracking-wider text-sm">Bill Doerrfeld</h2>
<p className="text-gray-500">Editor in Chief at Nordic APIs</p>
</div>
</div>
</div>
</div>
</section>
),
},
{
element: (
<section className="text-gray-600 body-font w-[500px] object-contain mx-auto -mt-12">
<div className="container px-5 py-24 mx-auto">
<div className="flex flex-wrap -m-4">
<div className="mb-6 p-4">
<div className="h-full text-center">
<img alt="testimonial" className="w-20 h-20 mb-8 object-cover object-center rounded-full inline-block border-2 border-gray-200 bg-gray-100" src="/img/testimonials/jonathan-schabowsky.jpg"/>
<p className="leading-relaxed">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.</p>
<span className="inline-block h-1 w-10 rounded bg-indigo-500 mt-6 mb-4"></span>
<h2 className="text-gray-900 font-medium title-font tracking-wider text-sm">Jonathan Schabowsky</h2>
<p className="text-gray-500">Sr. Architect, Office of the CTO at Solace</p>
</div>
</div>
</div>
</div>
</section>
),
},
{
element: (
<section className="text-gray-600 body-font w-[500px] object-contain mx-auto -mt-12">
<div className="container px-5 py-24 mx-auto">
<div className="flex flex-wrap -m-4">
<div className="mb-6 p-4">
<div className="h-full text-center">
<img alt="testimonial" className="w-20 h-20 mb-8 object-cover object-center rounded-full inline-block border-2 border-gray-200 bg-gray-100" src="/img/testimonials/eric-horesnyi.jpg"/>
<p className="leading-relaxed">We’ve been focusing on event-driven APIs since 2014 and thank the AsyncAPI contributors everyday for driving the community towards common standards.</p>
<span className="inline-block h-1 w-10 rounded bg-indigo-500 mt-6 mb-4"></span>
<h2 className="text-gray-900 font-medium title-font tracking-wider text-sm">Eric Horesnyi</h2>
<p className="text-gray-500">CEO at Streamdata.io</p>
</div>
</div>
</div>
</div>
</section>
),
},
]}
/>
</ul>
</Container>
Expand Down

0 comments on commit 2e66667

Please sign in to comment.