-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YUANCONG LIU
committed
Dec 27, 2023
1 parent
9222fd9
commit 2ccffd5
Showing
3 changed files
with
71 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,65 @@ | ||
'use client'; | ||
import { useRef } from 'react'; | ||
|
||
import classNames from 'classnames'; | ||
import { useInView } from 'framer-motion'; | ||
import Link from 'next/link'; | ||
|
||
import { ImageWithLoading } from '~/components/common/image/imageWithLoading'; | ||
import { Experience } from '~/types/Resume'; | ||
|
||
// import { useTranslation } from 'next-i18next'; | ||
import styles from './index.module.scss'; | ||
|
||
type Props = { | ||
experience: Experience; | ||
}; | ||
|
||
export const ExperienceCard = ({ experience }: Props) => { | ||
// const { t } = useTranslation('common'); | ||
const cardRef = useRef<HTMLDivElement>(null); | ||
|
||
const inView = useInView(cardRef); | ||
|
||
return ( | ||
<div className={styles['card-wrapper']}> | ||
<h2 className={styles['year']}>{experience.startYear}</h2> | ||
{experience.imagePath && ( | ||
<div className={styles['image']}> | ||
<ImageWithLoading src={experience.imagePath} alt={experience.name} /> | ||
<section className={styles['card-section']}> | ||
<div className={styles['card-wrapper']} ref={cardRef}> | ||
<h2 className={styles['year']}>{experience.startYear}</h2> | ||
{experience.imagePath && ( | ||
<div className={styles['image']}> | ||
<ImageWithLoading | ||
src={experience.imagePath} | ||
alt={experience.name} | ||
/> | ||
</div> | ||
)} | ||
{experience.url ? ( | ||
<Link | ||
className={styles['name']} | ||
href={experience.url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
{experience.name} | ||
</Link> | ||
) : ( | ||
<p className={styles['name']}>{experience.name}</p> | ||
)} | ||
<div className={styles['details']}> | ||
<p>{experience.department}</p> | ||
{experience.degree && <p>{experience.degree}</p>} | ||
</div> | ||
)} | ||
{experience.url ? ( | ||
<Link | ||
className={styles['name']} | ||
href={experience.url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
<div | ||
className={classNames(styles['border'], inView && styles['-in-view'])} | ||
/> | ||
<div | ||
className={classNames( | ||
styles['year'], | ||
styles['end-year'], | ||
inView && styles['-in-view'], | ||
)} | ||
> | ||
{experience.name} | ||
</Link> | ||
) : ( | ||
<p className={styles['name']}>{experience.name}</p> | ||
)} | ||
<div className={styles['details']}> | ||
<p className={styles['detail']}>{experience.department}</p> | ||
{experience.degree && ( | ||
<p className={styles['detail']}>{experience.degree}</p> | ||
)} | ||
{experience.endYear} | ||
</div> | ||
</div> | ||
<div className={styles['border']} /> | ||
<h2 className={classNames(styles['year'], styles['end-year'])}> | ||
{experience.endYear} | ||
</h2> | ||
</div> | ||
</section> | ||
); | ||
}; |
2ccffd5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
portfolio – ./
overlook-hotel.vercel.app
portfolio-yuancong-liu.vercel.app
yuancong.space
portfolio-git-develop-yuancong-liu.vercel.app
www.yuancong.space