Skip to content

Commit 89d24f7

Browse files
authored
Floating SVGs Added (#60)
* Floating SVGs Added * AnimationsAdded * added react carousel * carousel for steps in sugarstick
1 parent 1d9c917 commit 89d24f7

File tree

14 files changed

+343
-108
lines changed

14 files changed

+343
-108
lines changed

public/assets/FloatingSVGs/music-block-1.svg

Lines changed: 21 additions & 0 deletions
Loading

public/assets/FloatingSVGs/music-block-2.svg

Lines changed: 21 additions & 0 deletions
Loading

public/assets/FloatingSVGs/music-block-3.svg

Lines changed: 21 additions & 0 deletions
Loading

public/assets/FloatingSVGs/sugarizer-1.svg

Lines changed: 9 additions & 0 deletions
Loading

public/assets/FloatingSVGs/turtle-blocks-1.svg

Lines changed: 21 additions & 0 deletions
Loading

public/assets/FloatingSVGs/turtle-blocks-2.svg

Lines changed: 21 additions & 0 deletions
Loading

public/assets/LinksLogos/sugarizer-1.svg

Lines changed: 9 additions & 0 deletions
Loading

src/components/TryNow/FeatureSection.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { useState } from 'react';
22
import { motion } from 'framer-motion';
3+
import { Carousel } from 'react-responsive-carousel';
4+
import 'react-responsive-carousel/lib/styles/carousel.min.css'; // Import carousel styles
35
import { featureSectionAnimations } from '@/styles/Animations';
46

57
interface FeatureData {
@@ -39,34 +41,32 @@ const FeatureSection = ({ data }: { data: FeatureData }) => {
3941
variants={featureSectionAnimations.imageContainer}
4042
>
4143
{data.images && data.images.length > 0 ? (
42-
<>
43-
{/* Display Active Image */}
44-
<motion.img
45-
key={currentImage} // Ensures animation triggers on image change
46-
src={data.images[currentImage].src}
47-
alt={data.images[currentImage].alt}
48-
className="w-full max-w-lg rounded-lg shadow-md"
49-
initial="hidden"
50-
animate="visible"
51-
whileHover="hover"
52-
variants={featureSectionAnimations.image}
53-
/>
54-
55-
{/* Dotted Navigation */}
56-
<div className="flex mt-4 space-x-2">
57-
{data.images.map((_, index) => (
58-
<motion.button
59-
key={index}
60-
onClick={() => setCurrentImage(index)}
61-
className={`h-3 w-3 rounded-full ${
62-
index === currentImage ? 'bg-blue-600' : 'bg-gray-400'
63-
}`}
44+
<Carousel
45+
selectedItem={currentImage}
46+
onChange={(index) => setCurrentImage(index)}
47+
showThumbs={false}
48+
showStatus={false}
49+
infiniteLoop
50+
autoPlay
51+
interval={3000}
52+
transitionTime={600} // Smooth transition
53+
emulateTouch
54+
dynamicHeight
55+
>
56+
{data.images.map((image, index) => (
57+
<motion.div key={index} className="w-full max-w-lg">
58+
<motion.img
59+
src={image.src}
60+
alt={image.alt}
61+
className="w-full rounded-lg shadow-md"
62+
initial="hidden"
63+
animate="visible"
6464
whileHover="hover"
65-
variants={featureSectionAnimations.button}
65+
variants={featureSectionAnimations.image}
6666
/>
67-
))}
68-
</div>
69-
</>
67+
</motion.div>
68+
))}
69+
</Carousel>
7070
) : (
7171
<motion.div
7272
className="w-full max-w-lg h-64 bg-gray-300 rounded-lg flex items-center justify-center"

src/components/TryNow/StepsToUse.tsx

Lines changed: 47 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,64 @@
1-
import { useState } from 'react';
2-
import { motion } from 'framer-motion';
1+
import 'react-responsive-carousel';
2+
import { Carousel } from 'react-responsive-carousel';
33
import { ArrowLeft, ArrowRight } from 'lucide-react';
44
import { steps } from '@/constants/TryNowData/bootableSoasData';
5+
import { useState } from 'react';
56

67
const StepsToUse = () => {
7-
const [activeStep, setActiveStep] = useState(0);
8-
9-
const nextStep = () =>
10-
setActiveStep((prev) => Math.min(prev + 1, steps.length - 1));
11-
const prevStep = () => setActiveStep((prev) => Math.max(prev - 1, 0));
8+
const [currentStep, setCurrentStep] = useState(0);
129

1310
return (
1411
<section className="w-[90%] mx-auto py-8">
1512
<h2 className="text-3xl font-bold text-center text-black mb-6">
1613
Steps to Boot Sugar on a Stick
1714
</h2>
1815

19-
{/* Carousel Container */}
20-
<div className="relative flex items-center justify-center">
21-
{/* Left Arrow */}
22-
<button
23-
className={`absolute left-0 top-1/2 transform -translate-y-1/2 bg-gray-300 text-black p-2 rounded-full shadow-lg transition ${
24-
activeStep === 0
25-
? 'opacity-50 cursor-not-allowed'
26-
: 'hover:bg-gray-400'
27-
}`}
28-
onClick={prevStep}
29-
disabled={activeStep === 0}
30-
>
31-
<ArrowLeft size={30} />
32-
</button>
33-
34-
{/* Step Content */}
35-
<motion.div
36-
key={activeStep}
37-
initial={{ opacity: 0, x: 50 }}
38-
animate={{ opacity: 1, x: 0 }}
39-
exit={{ opacity: 0, x: -50 }}
40-
transition={{ duration: 0.3 }}
41-
className="w-full sm:w-[80%] md:w-[70%] lg:w-[60%] text-center"
16+
<div className="relative w-full sm:w-[80%] md:w-[70%] lg:w-[60%] mx-auto">
17+
<Carousel
18+
selectedItem={currentStep}
19+
onChange={(index) => setCurrentStep(index)}
20+
showArrows={false}
21+
showThumbs={false}
22+
showStatus={false}
23+
showIndicators={true}
24+
useKeyboardArrows
25+
infiniteLoop
4226
>
43-
{/* Step Number */}
44-
<div className="text-lg font-semibold text-gray-600">
45-
Step {activeStep + 1}
46-
</div>
27+
{steps.map((step, index) => (
28+
<div key={index} className="text-center relative">
29+
{index > 0 && (
30+
<button
31+
className="absolute left-0 top-1/2 transform -translate-y-1/2 bg-gray-300 text-black p-2 rounded-full shadow-lg transition hover:bg-gray-400"
32+
onClick={() => setCurrentStep(currentStep - 1)}
33+
>
34+
<ArrowLeft size={30} />
35+
</button>
36+
)}
4737

48-
{/* Title */}
49-
<h3 className="text-2xl font-semibold text-black mt-1">
50-
{steps[activeStep].title}
51-
</h3>
52-
53-
{/* Description */}
54-
<p className="text-gray-700 mt-2">{steps[activeStep].description}</p>
55-
56-
{/* Step Image */}
57-
<motion.img
58-
src={steps[activeStep].image}
59-
alt={steps[activeStep].title}
60-
className="mx-auto mt-4 rounded-lg shadow-lg w-3/4 sm:w-2/3 md:w-1/2 h-auto"
61-
initial={{ scale: 0.8, opacity: 0 }}
62-
animate={{ scale: 1, opacity: 1 }}
63-
transition={{ duration: 0.4 }}
64-
/>
65-
</motion.div>
66-
67-
{/* Right Arrow */}
68-
<button
69-
className={`absolute right-0 top-1/2 transform -translate-y-1/2 bg-gray-300 text-black p-2 rounded-full shadow-lg transition ${
70-
activeStep === steps.length - 1
71-
? 'opacity-50 cursor-not-allowed'
72-
: 'hover:bg-gray-400'
73-
}`}
74-
onClick={nextStep}
75-
disabled={activeStep === steps.length - 1}
76-
>
77-
<ArrowRight size={30} />
78-
</button>
79-
</div>
38+
<div className="text-lg font-semibold text-gray-600">
39+
Step {index + 1}
40+
</div>
41+
<h3 className="text-2xl font-semibold text-black mt-1">
42+
{step.title}
43+
</h3>
44+
<p className="text-gray-700 mt-2">{step.description}</p>
45+
<img
46+
src={step.image}
47+
alt={step.title}
48+
className="mx-auto mt-4 rounded-lg shadow-lg w-3/4 sm:w-2/3 md:w-1/2 h-auto"
49+
/>
8050

81-
{/* Navigation Dots */}
82-
<div className="flex justify-center mt-6 gap-2">
83-
{steps.map((_, index) => (
84-
<button
85-
key={index}
86-
className={`w-3 h-3 rounded-full transition-all ${
87-
index === activeStep ? 'bg-[#FF4F00] w-5' : 'bg-gray-300'
88-
}`}
89-
onClick={() => setActiveStep(index)}
90-
/>
91-
))}
51+
{index < steps.length - 1 && (
52+
<button
53+
className="absolute right-0 top-1/2 transform -translate-y-1/2 bg-gray-300 text-black p-2 rounded-full shadow-lg transition hover:bg-gray-400"
54+
onClick={() => setCurrentStep(currentStep + 1)}
55+
>
56+
<ArrowRight size={30} />
57+
</button>
58+
)}
59+
</div>
60+
))}
61+
</Carousel>
9262
</div>
9363
</section>
9464
);

src/pages/TryNow/BootableSoas.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Header from '@/sections/Header';
22
import Footer from '@/sections/Footer';
33
import FeatureSection from '@/components/TryNow/FeatureSection';
4+
import { motion } from 'framer-motion';
5+
import { zoomFadeInAnimation } from '@/styles/Animations';
46
import {
57
bootableSoasData,
68
mockupImage,
@@ -14,7 +16,14 @@ const BootableSoasPage = () => {
1416
<main className="container mx-auto px-4 sm:px-6 md:px-8 py-6">
1517
<FeatureSection data={bootableSoasData} />
1618

17-
<img src={mockupImage.path} alt="TurtleMockup" />
19+
<motion.img
20+
src={mockupImage.path}
21+
alt="BootableSoasMockup"
22+
variants={zoomFadeInAnimation}
23+
initial="initial"
24+
animate="animate"
25+
className="w-[80%] mx-auto"
26+
/>
1827

1928
<StepsToUse />
2029
</main>

0 commit comments

Comments
 (0)