Skip to content

Commit 4346a07

Browse files
authored
🔙 Added left chevron on landing page (#1089)
* fixed banner badge on landing :sparkles * added left button to landing carousel :rewind
1 parent a4cad3d commit 4346a07

File tree

2 files changed

+45
-23
lines changed

2 files changed

+45
-23
lines changed

next/src/components/BannerBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import clsx from "clsx";
77
type BadgeProps = PropsWithChildren<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
88

99
const BannerBadge = ({ children, className, ...props }: BadgeProps) => (
10-
<div className="rounded-full bg-gradient-to-tl from-[#A02BFE] via-[#02FCF1] to-[#A02BFE] p-[0.75px] subpixel-antialiased">
10+
<div className="rounded-full bg-gradient-to-tl from-[#A02BFE] via-[#02FCF1] to-[#A02BFE] p-[1px] subpixel-antialiased">
1111
<a
1212
className={clsx(
1313
"animate-border-pulse py group relative flex w-max cursor-pointer items-center gap-2 rounded-full bg-black px-4 py-2 text-sm text-white",

next/src/components/landing/Hero.tsx

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import TextButton from "../TextButton";
77
import React, { useState } from "react";
88
import { useRouter } from "next/router";
99
import Image from "next/image";
10-
import { FaChevronRight } from "react-icons/fa";
10+
import { FaChevronRight, FaChevronLeft } from "react-icons/fa";
1111
import HeroCard from "../HeroCard";
1212
import PurpleHeroIcon from "../../../public/icons/icon-hero-purple.svg";
1313
import GreenHeroIcon from "../../../public/icons/icon-hero-green.svg";
@@ -22,9 +22,18 @@ const Hero: React.FC<{ className?: string }> = ({ className }) => {
2222
const [sliderIndex, setSliderIndex] = useState(0);
2323
const totalCards = roles.length;
2424

25-
const handleSliderButton = (increment: number) => {
26-
const newIndex = (sliderIndex + increment + totalCards) % totalCards;
27-
setSliderIndex(newIndex);
25+
const handleSliderButtonLeft = (decrement: number) => {
26+
if (sliderIndex != 0) {
27+
const newIndex = (sliderIndex - decrement + totalCards) % totalCards;
28+
setSliderIndex(newIndex);
29+
}
30+
};
31+
32+
const handleSliderButtonRight = (increment: number) => {
33+
if (sliderIndex != roles.length - 2) {
34+
const newIndex = (sliderIndex + increment + totalCards) % totalCards;
35+
setSliderIndex(newIndex);
36+
}
2837
};
2938

3039
return (
@@ -70,30 +79,42 @@ const Hero: React.FC<{ className?: string }> = ({ className }) => {
7079
Experience a new way of working.
7180
</p>
7281
</div>
73-
<div className="relative hidden w-full items-center overflow-hidden sm:max-w-[40em] md:flex">
74-
<motion.div
75-
className="z-20 flex gap-5"
76-
animate={{ x: `${sliderIndex * -308}px` }}
77-
transition={{ duration: 0.5, type: "spring", stiffness: 60 }}
82+
83+
<div className="relative hidden w-full items-center sm:max-w-[40em] md:flex">
84+
<button
85+
onClick={() => handleSliderButtonLeft(1)}
86+
className="group absolute left-0 -translate-x-5 z-30 flex h-6 w-8 items-center justify-center rounded-full border border-white/20 bg-black bg-gradient-to-r from-white/10 to-black hover:border-white/30"
7887
>
79-
{roles.map((role, index) => (
80-
<HeroCard
81-
key={role.title}
82-
title={role.title}
83-
subtitle={role.subtitle}
84-
leftIcon={role.icon}
85-
onClick={() => {
86-
router.push("/").catch(console.error);
87-
}}
88-
/>
89-
))}
90-
</motion.div>
88+
<FaChevronLeft
89+
size={10}
90+
className="text-gray-400 transition-transform group-hover:translate-x-0.5"
91+
/>
92+
</button>
93+
<div className="relative hidden w-full items-center overflow-hidden sm:max-w-[40em] md:flex">
94+
<motion.div
95+
className="z-20 flex gap-5"
96+
animate={{ x: `${sliderIndex * -308}px` }}
97+
transition={{ duration: 0.5, type: "spring", stiffness: 60 }}
98+
>
99+
{roles.map((role, index) => (
100+
<HeroCard
101+
key={role.title}
102+
title={role.title}
103+
subtitle={role.subtitle}
104+
leftIcon={role.icon}
105+
onClick={() => {
106+
router.push("/").catch(console.error);
107+
}}
108+
/>
109+
))}
110+
</motion.div>
111+
</div>
91112
<div
92113
id="tests"
93114
className="absolute right-0 z-20 h-full w-10 bg-gradient-to-r from-transparent to-black to-75% text-white sm:w-40"
94115
/>
95116
<button
96-
onClick={() => handleSliderButton(1)}
117+
onClick={() => handleSliderButtonRight(1)}
97118
className="group absolute right-10 z-30 flex h-6 w-8 items-center justify-center rounded-full border border-white/20 bg-black bg-gradient-to-r from-white/10 to-black hover:border-white/30"
98119
>
99120
<FaChevronRight
@@ -164,3 +185,4 @@ const roles = [
164185
];
165186

166187
export default Hero;
188+

0 commit comments

Comments
 (0)