Skip to content

Commit

Permalink
Added auto scorable beautiful testimonial
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawan-Kushwah committed Oct 25, 2024
1 parent 0758ce4 commit 77e4ac0
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 16 deletions.
32 changes: 17 additions & 15 deletions client/src/component/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import glichBitboxGif from '../assets/images/Other Gifs/Bitbox Glitch.gif';
import CardsPage from './HomePage/Card';
import { motion } from 'framer-motion'; // Importing framer-motion
import './Home.css';
import Testimonial from './Testimonial';

const worddata = [
{
Expand Down Expand Up @@ -123,12 +124,12 @@ const Home = (props) => {
</motion.div>
<motion.div className="p-5 mt-4 w-[60%]" animate={{ x: [0, 100, 0] }}>

<motion.h1
<motion.h1
className="display-4"
initial={{ opacity: 0, x: -100 }}
whileInView={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8 }}
viewport={{ once: true }}
initial={{ opacity: 0, x: -100 }}
whileInView={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8 }}
viewport={{ once: true }}
>
Grow
</motion.h1>
Expand All @@ -148,12 +149,12 @@ const Home = (props) => {
viewport={{ once: true }}
>
<div className="p-5 mt-4 w-[60%]">
<motion.h1
<motion.h1
className="display-4"
initial={{ opacity: 0, x: -100 }}
whileInView={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8 }}
viewport={{ once: true }}
initial={{ opacity: 0, x: -100 }}
whileInView={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8 }}
viewport={{ once: true }}
>
Learn
</motion.h1>
Expand Down Expand Up @@ -190,10 +191,10 @@ const Home = (props) => {
<div className="p-5 mt-4 w-[60%]">
<motion.h1
className="display-4"
initial={{ opacity: 0, x: -100 }}
whileInView={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8 }}
viewport={{ once: true }}
initial={{ opacity: 0, x: -100 }}
whileInView={{ opacity: 1, x: 0 }}
transition={{ duration: 0.8 }}
viewport={{ once: true }}
>
Share
</motion.h1>
Expand Down Expand Up @@ -270,8 +271,9 @@ const Home = (props) => {
</div>
</div>
</div>*/}
</div>
</div>

<Testimonial />

{/* Technology Section */}
<div className='Technology-Sec' style={{ background: props.mode === 'dark' ? 'black' : 'white', color: props.mode === 'dark' ? 'white' : 'black' }}>
Expand Down
145 changes: 145 additions & 0 deletions client/src/component/Testimonial.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import React, { useEffect, useState } from 'react';

const Testimonial = () => {
const [active, setActive] = useState(3);
const items = [
{
img: "https://i.pravatar.cc/[email protected]",
stars: "★★★★★",
text: "BitBox has been a game-changer for me as a developer. The platform's ease of use, combined with its collaborative features ! The opportunity to explore and learn from other developers' work",
name: "- Rajat Mehta",
jobTitle: "Full Stack Developer",
location: "Location: Bengaluru, India"
},
{
img: "https://img.freepik.com/free-vector/illustration-user-avatar-icon_53876-5907.jpg?ga=GA1.1.713761379.1679213202&semt=ais_hybrid",
stars: "★★★★",
text: "Using BitBox has been an enriching experience. It’s the perfect platform to upload, share, and collaborate on various projects. I love how easy it is to explore other developers' work and learn from them. The community is so engaging.",
name: "- Anjali Verma",
jobTitle: "Frontend Developer",
location: "Location: Mumbai, India"
},
{
img: "https://img.freepik.com/free-vector/gradient-professional-sarah-smith-linkedin-personal-profile-picture_742173-13011.jpg?ga=GA1.1.713761379.1679213202&semt=ais_hybrid",
stars: "★★★★★",
text: "BitBox has truly enhanced the way I work. The collaboration feature is brilliant, and the ease with which I can upload and share my projects is remarkable. It’s not just about showcasing work, but about learning from the wealth of knowledge shared by the community.",
name: "- Rohan Desai",
jobTitle: "Backend Developer",
location: "Location: Ahmedabad, India"
},
{
img: "https://img.freepik.com/free-vector/profile-picture-template-design_742173-22027.jpg?ga=GA1.1.713761379.1679213202&semt=ais_hybrid",
stars: "★★★★",
text: "BitBox has been an incredible platform for networking with other developers. I’ve learned so much just by engaging with the projects shared by others. The collaboration opportunities are endless, and the learning never stops. It’s a must-have tool for any aspiring developer.",
name: "- Sneha Iyer",
jobTitle: "UI/UX Designer",
location: "Location: Chennai, India"
},
{
img: "https://i.pravatar.cc/[email protected]",
stars: "★★★★★",
text: "The BitBox platform has allowed me to collaborate on projects I would never have had access to otherwise. It’s an amazing hub for developers to connect, share ideas, and grow together. I’ve gained invaluable experience and can’t wait to keep learning from the community.",
name: "- Akash Sharma",
jobTitle: "Software Tester",
location: "Location: Hyderabad, India"
}
];


useEffect(() => {
const interval = setInterval(() => {
setActive(prev => (prev + 1) % items.length);
}, 2500);

return () => clearInterval(interval);
}, [items.length]);

useEffect(() => {
loadShow();
}, [active]);

const loadShow = () => {
const itemsElement = document.querySelectorAll('.slider .item');
itemsElement[active].style.transform = `none`;
itemsElement[active].style.zIndex = 1;
itemsElement[active].style.filter = 'none';
itemsElement[active].style.opacity = 1;
// Show after
let stt = 0;
for (let i = active + 1; i < itemsElement.length; i++) {
stt++;
itemsElement[i].style.transform = `translateX(${120 * stt}px) scale(${1 - 0.2 * stt}) perspective(16px) rotateY(-1deg)`;
itemsElement[i].style.zIndex = 0;
itemsElement[i].style.filter = 'blur(5px)';
itemsElement[i].style.opacity = stt > 2 ? 0 : 0.6;
}
stt = 0;
for (let i = (active - 1); i >= 0; i--) {
stt++;
itemsElement[i].style.transform = `translateX(${-120 * stt}px) scale(${1 - 0.2 * stt}) perspective(16px) rotateY(1deg)`;
itemsElement[i].style.zIndex = 0;
itemsElement[i].style.filter = 'blur(5px)';
itemsElement[i].style.opacity = stt > 2 ? 0 : 0.6;
}
};

return (
<div>
<h1 className='text-center text-5xl'>
See What our client say&apos;s about us !
</h1>

<div className="slider" style={{ position: 'relative', marginTop: '100px', width: '100%', height: '550px', overflow: 'hidden' }}>
{items.map((item, index) => (
<div className="item max-sm:!w-[300px] max-sm:!h-[430px] bg-blue-700 text-white" key={index} style={{
position: 'absolute',
width: '350px',
height: '450px',
textAlign: 'justify',
borderRadius: '12px',
padding: '20px',
transition: '0.5s',
left: 'calc(50% - 150px)',
top: '0',
marginBottom: '100px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
boxShadow: '0 4px 15px rgba(0, 0, 0, 0.1)', // Soft shadow for depth
overflow: 'hidden', // Ensures the image does not overflow
color: 'white',
}}>
<img
src={item.img}
alt="User Avatar"
className='w-[150px] h-[150px] rounded-lg object-cover mb-[20px] cursor-pointer max-sm:h-[120px] mb-0'
style={{
transition: 'transform 0.3s ease, filter 0.3s ease',
border: '3px solid #d0e7b0' // Green border for the image
}}
onMouseOver={e => {
e.currentTarget.style.transform = 'scale(1.1)';
e.currentTarget.style.filter = 'brightness(1.1)'; // Brightness effect on hover
}}
onMouseOut={e => {
e.currentTarget.style.transform = 'scale(1)';
e.currentTarget.style.filter = 'brightness(1)'; // Reset brightness
}}
/>
<div className="stars text-[#ffd700] text-2xl mt-auto max-sm:mt-2">{item.stars}</div>
<p className='text-justify mb-[20px] max-sm:text-xs max-sm:mb-0 text-white text-[1rem]'>{item.text}</p>
<h2 className='mb-[10px] text-xl font-semibold max-sm:mb-1 max-sm:text-lg'>{item.name}</h2>

</div>


))}

<button id="next" className=' absolute top-[40%] text-blue-700 bg-none border-none text-6xl font-mono font-bold opacity-80 transition-opacity z-10 right-[50px] max-sm:text-white max-sm:text-2xl max-sm:right-2' onClick={() => setActive(prev => (prev + 1 < items.length ? prev + 1 : prev))}>{">>"}</button>
<button id="prev" className=' absolute top-[40%] text-blue-700 bg-none border-none text-6xl font-mono font-bold opacity-80 transition-opacity z-10 left-[50px] max-sm:text-white max-sm:text-2xl max-sm:left-2' onClick={() => setActive(prev => (prev - 1 >= 0 ? prev - 1 : prev))}> {"<<"}</button>
</div>
</div>
);
};

export default Testimonial;
2 changes: 1 addition & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require('dotenv').config(); // Load environment variables from .env file
// Connect to MongoDB
connectToMongo();

const app = express();
const app = express();
const httpServer = require("http").createServer(app);
const io = new Server(httpServer, {
cors: {
Expand Down

0 comments on commit 77e4ac0

Please sign in to comment.