Skip to content

Commit d2462d4

Browse files
authoredDec 22, 2024··
Website Redesign: Courses page changes (#807)
### Summary <!-- Required --> This PR implements changes to the Courses Page from the leads sync - [x] implemented Infinite carousel that starts and ends on each side of the screen - [x] decreased spacing between the sections - [x] decreased the gap between the points in the timeline section - [ ] Standardize Fonts (planning to do a PR for the whole website) ### Notion/Figma Link <!-- Optional --> **[Link to the Notion](https://www.notion.so/Idol-Lead-Sync-781de97ad403492b94b420349f829ea5?pvs=4)** ### Notes <!-- Optional --> - The fonts still need to be standardized but I'm going to create a separate PR for this for the whole site once we merge the other pages
1 parent b3021bf commit d2462d4

File tree

4 files changed

+43
-64
lines changed

4 files changed

+43
-64
lines changed
 

‎new-dti-website/components/course/TestimonialCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function TestimonialCard({
2626
profileImage = '/icons/profile_image.svg'
2727
}: TestimonialCardProps) {
2828
return (
29-
<div className="bg-white max-w-md w-[800px] p-10 rounded-xl drop-shadow-sm flex-shrink-0 flex-col flex">
29+
<div className="bg-white max-w-md w-[800px] h-[400px] p-10 rounded-xl drop-shadow-sm flex-shrink-0 flex-col flex">
3030
<div className="text-3xl text-gray-800 mb-4 tracking-wider font-black">❛❛</div>
3131
<p className="text-gray-700 mb-6">{description}</p>
3232
<div className="flex flex-row justify-start gap-4 items-center mt-auto">
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef, useState, useEffect } from 'react';
1+
import React from 'react';
22
import TestimonialCard, { TestimonialCardProps } from './TestimonialCard';
33

44
interface TestimonialSliderProps {
@@ -10,61 +10,35 @@ export default function TestimonialSlider({
1010
testimonials,
1111
className = ''
1212
}: TestimonialSliderProps) {
13-
const sliderRef = useRef<HTMLDivElement | null>(null);
14-
const [isScrolling, setIsScrolling] = useState(false);
15-
const [scrollAtEnd, setScrollAtEnd] = useState(false);
16-
17-
useEffect(() => {
18-
const slider = sliderRef.current;
19-
20-
// Return early if there are no testimonials or if we've reached the end
21-
if (!slider || testimonials.length === 0 || scrollAtEnd || isScrolling) {
22-
return undefined; // Return `undefined` explicitly to satisfy consistent-return rule
23-
}
24-
25-
const scrollInterval = setInterval(() => {
26-
const maxScrollLeft = slider.scrollWidth - slider.clientWidth;
27-
28-
if (slider.scrollLeft < maxScrollLeft) {
29-
slider.scrollLeft += 1; // Adjust the scroll speed as needed
30-
} else {
31-
setScrollAtEnd(true); // Stop scrolling when the end is reached
32-
// slider.scrollLeft = 0 if we want to start from the begnning :)
33-
}
34-
}, 40); // Adjust the interval as needed for smoother/faster scrolling
35-
36-
// Return the cleanup function
37-
return () => {
38-
clearInterval(scrollInterval);
39-
};
40-
}, [testimonials, isScrolling, scrollAtEnd]);
41-
42-
const handleMouseEnter = () => {
43-
setIsScrolling(true);
44-
};
45-
46-
const handleMouseLeave = () => {
47-
setIsScrolling(false);
48-
};
49-
5013
return (
51-
<div
52-
className={`overflow-x-auto pt-14 ${className}`}
53-
ref={sliderRef}
54-
onMouseEnter={handleMouseEnter}
55-
onMouseLeave={handleMouseLeave}
56-
>
57-
<div className="flex gap-x-12 flex-nowrap">
14+
<div className={`w-full inline-flex flex-nowrap ${className}`}>
15+
<ul className="flex items-center justify-center md:justify-start [&_li]:mx-8 [&_img]:max-w-none animate-infinite-scroll">
16+
{testimonials.map((testimonial, index) => (
17+
<li key={index}>
18+
<TestimonialCard
19+
profileImage={testimonial.profileImage}
20+
description={testimonial.description}
21+
name={testimonial.name}
22+
semesterTaken={testimonial.semesterTaken}
23+
/>
24+
</li>
25+
))}
26+
</ul>
27+
<ul
28+
className="flex items-center justify-center md:justify-start [&_li]:mx-8 [&_img]:max-w-none animate-infinite-scroll"
29+
aria-hidden="true"
30+
>
5831
{testimonials.map((testimonial, index) => (
59-
<TestimonialCard
60-
key={index}
61-
profileImage={testimonial.profileImage}
62-
description={testimonial.description}
63-
name={testimonial.name}
64-
semesterTaken={testimonial.semesterTaken}
65-
/>
32+
<li key={index}>
33+
<TestimonialCard
34+
profileImage={testimonial.profileImage}
35+
description={testimonial.description}
36+
name={testimonial.name}
37+
semesterTaken={testimonial.semesterTaken}
38+
/>
39+
</li>
6640
))}
67-
</div>
41+
</ul>
6842
</div>
6943
);
7044
}

‎new-dti-website/src/app/course/page.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default function Courses() {
9797
{/* WRAPPER */}
9898
<div
9999
id="Wrapper"
100-
className="flex flex-col pb-10 gap-y-28 md:gap-y-36 lg:gap-y-44 bg-[#EDEDED] text-black "
100+
className="flex flex-col pb-10 gap-y-24 md:gap-y-32 lg:gap-y-40 bg-[#EDEDED] text-black "
101101
>
102102
<SectionWrapper id={'Products Page Logo Section'}>
103103
<div className="flex flex-col pt-20 lg:flex-row lg:items-center lg:justify-around">
@@ -163,9 +163,9 @@ export default function Courses() {
163163
</SectionWrapper>
164164

165165
{/* TIMELINE SECTION */}
166-
<section id="Timeline">
166+
<SectionWrapper id={`Timeline`}>
167167
<Timeline events={timeline_events} currentDate={new Date()} />
168-
</section>
168+
</SectionWrapper>
169169

170170
{/* COURSE STAFF SECTION */}
171171
<SectionWrapper id={'Course Staff'}>
@@ -184,12 +184,12 @@ export default function Courses() {
184184
</SectionWrapper>
185185

186186
{/* PAST STUDENT EXPERIENCES SECTION */}
187-
<SectionWrapper id={'Past Student Experiences'}>
188-
<div className="font-bold text-4xl md:text-[40px] w-[1200px]">
189-
Past Student Experiences
190-
</div>
191-
<TestimonialSlider testimonials={testimonials} className="w-screen" />
192-
</SectionWrapper>
187+
<section id={'Past Student Experiences'}>
188+
<SectionWrapper id={'Past Student Experiences Wrapper'}>
189+
<div className="font-bold text-4xl md:text-[40px]">Past Student Experiences</div>
190+
</SectionWrapper>
191+
<TestimonialSlider testimonials={testimonials} className="pt-14" />
192+
</section>
193193

194194
{/* PAST STUDENT PROJECTS SECTION */}
195195
<SectionWrapper id={'Past Student Projects'}>

‎new-dti-website/tailwind.config.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ module.exports = {
9191
'accordion-up': {
9292
from: { height: 'var(--radix-accordion-content-height)' },
9393
to: { height: 0 }
94+
},
95+
'infinite-scroll': {
96+
from: { transform: 'translateX(0)' },
97+
to: { transform: 'translateX(-100%)' }
9498
}
9599
},
96100
animation: {
97101
'accordion-down': 'accordion-down 0.2s ease-out',
98-
'accordion-up': 'accordion-up 0.2s ease-out'
102+
'accordion-up': 'accordion-up 0.2s ease-out',
103+
'infinite-scroll': 'infinite-scroll 100s linear infinite'
99104
}
100105
}
101106
},

0 commit comments

Comments
 (0)
Please sign in to comment.