|
| 1 | + |
| 2 | +import {useTheme} from "../../ThemeContext" |
| 3 | + |
| 4 | +import { |
| 5 | + VerticalTimeline, |
| 6 | + VerticalTimelineElement, |
| 7 | +} from "react-vertical-timeline-component"; |
| 8 | +import { motion } from "framer-motion"; |
| 9 | + |
| 10 | +import "react-vertical-timeline-component/style.min.css"; |
| 11 | + |
| 12 | +import { styles } from "../styles"; |
| 13 | +import { experiences } from "../../components/styles"; |
| 14 | +import { SectionWrapper } from "../../hoc"; |
| 15 | +import { textVariant } from "../../utils/motion"; |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +const ExperienceCard = ({ experience }) => { |
| 20 | + const {theme} = useTheme(); |
| 21 | + const backgroundColor = theme === 'dark' ? "#fff" : "#F5F5F5"; // Dark or light background |
| 22 | + const textColor = theme === 'dark' ? "#fff" : "#000000"; // Text color based on theme |
| 23 | + const arrowColor = theme === 'dark' ? "#fff" : "#F5F5F5"; |
| 24 | + const textColor1 = theme === 'dark' ? "#000000" : "#000000"; // Text color based on theme |
| 25 | + return ( |
| 26 | + <VerticalTimelineElement |
| 27 | + contentStyle={{ |
| 28 | + background: backgroundColor, |
| 29 | + color: textColor, |
| 30 | + }} |
| 31 | + contentArrowStyle={{ borderRight: `7px solid ${arrowColor}` }} |
| 32 | + date={experience.date} |
| 33 | + iconStyle={{ background: 'rgb(33, 150, 243)', color: '#000000' , backgroundColor :'#000000' }} |
| 34 | + |
| 35 | + icon={ |
| 36 | + <div className="flex justify-center items-center w-full h-full"> |
| 37 | + <img |
| 38 | + src={experience.icon} |
| 39 | + alt={experience.company_name} |
| 40 | + className="w-[80%] h-[80%] object-contain" |
| 41 | + /> |
| 42 | + </div> |
| 43 | + } |
| 44 | + > |
| 45 | + <div> |
| 46 | + <h3 className=" text-ternary-dark sm:text-l md:text-xl lg:text-1xl xl:text-2xl font-bold">{experience.title}</h3> |
| 47 | + <p |
| 48 | + className=" text-ternary-dark text-[16px] font-semibold" |
| 49 | + style={{ margin: 0 }} |
| 50 | + > |
| 51 | + {experience.company_name} |
| 52 | + </p> |
| 53 | + </div> |
| 54 | + |
| 55 | + <ul className=" text-ternary-dark mt-5 list-disc ml-5 space-y-2 "> |
| 56 | + {experience.points.map((point, index) => ( |
| 57 | + <li |
| 58 | + key={`experience-point-${index}`} |
| 59 | + className=" text-[14px] pl-1 tracking-wider" |
| 60 | + > |
| 61 | + {point} |
| 62 | + </li> |
| 63 | + ))} |
| 64 | + </ul> |
| 65 | + </VerticalTimelineElement> |
| 66 | + ); |
| 67 | +}; |
| 68 | + |
| 69 | +const Experience = () => { |
| 70 | + const {theme} = useTheme(); |
| 71 | + const color = theme === 'dark' ? "#fff" : "#000000"; |
| 72 | + return ( |
| 73 | + <motion.section |
| 74 | + initial={{ opacity: 0 }} |
| 75 | + animate={{ opacity: 1 }} |
| 76 | + transition={{ ease: 'easeInOut', duration: 0.9, delay: 0.2 }} |
| 77 | + className=" sm:justify-between items-center sm:flex-row mt-12 md:mt-2" |
| 78 | + > |
| 79 | + |
| 80 | + |
| 81 | + <motion.div className="mt-20 md:text-xl lg:text-2xl xl:text-3xl text-center sm:text-left leading-normal font-general-bold text-custom-purple text-center sm:text-left text-ternary-dark dark:text-primary-light "> |
| 82 | + <p className={`${styles.sectionSubText} text-center`}> |
| 83 | + What I have done so far |
| 84 | + </p> |
| 85 | + <h2 className={`${styles.sectionHeadText} text-center mt-10 text-gray-500 dark:text-gray-200`}> |
| 86 | + Education & Experience |
| 87 | + </h2> |
| 88 | + </motion.div> |
| 89 | + |
| 90 | + <div className="mt-20"> |
| 91 | + |
| 92 | + <motion.div |
| 93 | + initial={{ opacity: 0, y: -180 }} |
| 94 | + animate={{ opacity: 1, y: 0 }} |
| 95 | + transition={{ ease: 'easeInOut', duration: 0.9, delay: 0.2 }} |
| 96 | + |
| 97 | + > |
| 98 | + |
| 99 | + <VerticalTimeline |
| 100 | + key={theme} // Forces re-render on theme change |
| 101 | + lineColor={color} |
| 102 | + |
| 103 | + > |
| 104 | + {experiences.map((experience, index) => ( |
| 105 | + <ExperienceCard |
| 106 | + key={`experience-${index}`} |
| 107 | + experience={experience} |
| 108 | + /> |
| 109 | + ))} |
| 110 | + </VerticalTimeline> |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + </motion.div> |
| 116 | + |
| 117 | + </div> |
| 118 | + </motion.section> |
| 119 | + ); |
| 120 | +}; |
| 121 | + |
| 122 | +export default SectionWrapper(Experience, "work"); |
0 commit comments