From b7f2113fedc838ffc7d63424e9cb63e84244d56e Mon Sep 17 00:00:00 2001
From: parsa aghaei
Date: Sun, 20 Oct 2024 18:02:03 +0330
Subject: [PATCH] homePage testimonials component updated for Clean Code
---
.../components/testimonials/testimonials.tsx | 86 +++++++++----------
src/app/types/types.ts | 7 ++
2 files changed, 47 insertions(+), 46 deletions(-)
diff --git a/src/app/(routes)/(website)/components/testimonials/testimonials.tsx b/src/app/(routes)/(website)/components/testimonials/testimonials.tsx
index e655005..76dda40 100644
--- a/src/app/(routes)/(website)/components/testimonials/testimonials.tsx
+++ b/src/app/(routes)/(website)/components/testimonials/testimonials.tsx
@@ -1,14 +1,8 @@
"use client";
+import { Testimonial } from "@/app/types/types";
import React, { useEffect, useRef, useState } from "react";
-interface Testimonial {
- name: string;
- position: string;
- image: string;
- quote: string;
-}
-
interface TestimonialsProps {
dict: {
homePage: {
@@ -20,49 +14,49 @@ interface TestimonialsProps {
};
}
+const testimonials: Testimonial[] = [
+ {
+ name: "Sarah Johnson",
+ position: "Founder & CEO of Innovate Solutions",
+ image: "/images/user-1.svg",
+ quote:
+ 'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.',
+ },
+ {
+ name: "Michael Lee",
+ position: "Chief Executive Officer at Tech Innovators",
+ image: "/images/user-1.svg",
+ quote:
+ "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
+ },
+ {
+ name: "Emma Davis",
+ position: "CEO & Lead Strategist at Visionary Ventures",
+ image: "/images/user-1.svg",
+ quote:
+ "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.",
+ },
+ {
+ name: "John Doe",
+ position: "COO at Startup Labs",
+ image: "/images/user-1.svg",
+ quote:
+ "All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.",
+ },
+ {
+ name: "Jane Smith",
+ position: "Founder at Health Innovations",
+ image: "/images/user-1.svg",
+ quote:
+ "It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.",
+ },
+];
+
export default function Testimonials({ dict }: TestimonialsProps) {
const [currentIndex, setCurrentIndex] = useState(0); // شروع با آیتم وسطی
const sliderRef = useRef(null);
const [isHovered, setIsHovered] = useState(false);
const [bulletClicked, setBulletClicked] = useState(false);
- // const [maxHeight, setMaxHeight] = useState(0);
- const testimonials: Testimonial[] = [
- {
- name: "Sarah Johnson",
- position: "Founder & CEO of Innovate Solutions",
- image: "/images/user-1.svg",
- quote:
- 'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.',
- },
- {
- name: "Michael Lee",
- position: "Chief Executive Officer at Tech Innovators",
- image: "/images/user-1.svg",
- quote:
- "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
- },
- {
- name: "Emma Davis",
- position: "CEO & Lead Strategist at Visionary Ventures",
- image: "/images/user-1.svg",
- quote:
- "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.",
- },
- {
- name: "John Doe",
- position: "COO at Startup Labs",
- image: "/images/user-1.svg",
- quote:
- "All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.",
- },
- {
- name: "Jane Smith",
- position: "Founder at Health Innovations",
- image: "/images/user-1.svg",
- quote:
- "It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.",
- },
- ];
// Auto-scroll every 5 seconds
useEffect(() => {
@@ -151,7 +145,7 @@ export default function Testimonials({ dict }: TestimonialsProps) {
key={index}
className={`${
currentIndex === index ? "bg-[#FD6F00] shadow-lg" : "bg-[#D9D9D9]"
- } h-[40px] w-[40px] rounded-lg hover:cursor-pointer sm:h-[30px] md:h-[30px] lg:h-[20px] sm:w-[50px] md:w-[50px] lg:w-[50px]`}
+ } h-[40px] w-[40px] rounded-lg hover:cursor-pointer sm:h-[30px] sm:w-[50px] md:h-[30px] md:w-[50px] lg:h-[20px] lg:w-[50px]`}
onClick={() => {
setCurrentIndex(index);
setBulletClicked(true);
diff --git a/src/app/types/types.ts b/src/app/types/types.ts
index a3b0caf..17d7401 100644
--- a/src/app/types/types.ts
+++ b/src/app/types/types.ts
@@ -214,3 +214,10 @@ export type Project = {
created_at: string;
updated_at: string;
};
+
+export type Testimonial = {
+ name: string;
+ position: string;
+ image: string;
+ quote: string;
+}
\ No newline at end of file