-
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.
Merge pull request #280 from dump-hr/speakers-section
Speakers section
- Loading branch information
Showing
24 changed files
with
849 additions
and
8 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 |
---|---|---|
|
@@ -52,4 +52,4 @@ | |
"breakpoints": true | ||
} | ||
] | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { SpeakerDto } from '@ddays-app/types'; | ||
import { QueryOptions, useQuery } from 'react-query'; | ||
|
||
import { api } from '..'; | ||
|
||
const speakerGetAll = () => { | ||
return api.get<never, SpeakerDto[]>('speaker'); | ||
}; | ||
|
||
export const useSpeakerGetAll = (options?: QueryOptions<SpeakerDto[]>) => { | ||
return useQuery(['speaker'], speakerGetAll, options); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { SpeakerWithCompanyDto } from '@ddays-app/types'; | ||
import { QueryOptions, useQuery } from 'react-query'; | ||
|
||
import { api } from '..'; | ||
|
||
const speakerWithCompanyGetAll = () => { | ||
return api.get<never, SpeakerWithCompanyDto[]>('speaker/with-company'); | ||
}; | ||
|
||
export const useSpeakerWithCompanyGetAll = ( | ||
options?: QueryOptions<SpeakerWithCompanyDto[]>, | ||
) => { | ||
return useQuery(['speaker/with-company'], speakerWithCompanyGetAll, options); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.frame { | ||
height: 100%; | ||
width: 100%; | ||
|
||
&Wrapper { | ||
position: relative; | ||
background-color: #171615; | ||
} | ||
|
||
&Image { | ||
position: absolute; | ||
top: 3%; | ||
left: 4%; | ||
width: 91%; | ||
height: 92%; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import FilmFrameSvg from '../../assets/FilmFrame.svg'; | ||
import c from './FilmFrame.module.scss'; | ||
|
||
type FilmFrameProps = { | ||
imageSrc: string | undefined; | ||
width: number; | ||
height: number; | ||
}; | ||
|
||
const FilmFrame: React.FC<FilmFrameProps> = ({ imageSrc, width, height }) => { | ||
return ( | ||
<div style={{ height: height, width: width }} className={c.frameWrapper}> | ||
<img className={c.frame} src={FilmFrameSvg} alt='' /> | ||
<img className={c.frameImage} src={imageSrc} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FilmFrame; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import FilmFrame from './FilmFrame'; | ||
|
||
export default FilmFrame; |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { SpeakerWithCompanyDto } from '@ddays-app/types'; | ||
import FilmFrame from 'components/FilmFrame'; | ||
import { motion } from 'framer-motion'; | ||
import { useState } from 'react'; | ||
|
||
import SpeakerModal from './SpeakerModal'; | ||
import c from './SpeakersSection.module.scss'; | ||
|
||
type SpeakerCardProps = { | ||
speaker: SpeakerWithCompanyDto; | ||
width: number; | ||
height: number; | ||
}; | ||
|
||
const SpeakerCard: React.FC<SpeakerCardProps> = ({ | ||
speaker, | ||
width, | ||
height, | ||
}) => { | ||
const [isOpenModal, setIsOpenModal] = useState(false); | ||
|
||
const handleOpenModal = () => { | ||
if (!isOpenModal) { | ||
setIsOpenModal(true); | ||
} | ||
}; | ||
|
||
const handleCloseModal = () => { | ||
setIsOpenModal(false); | ||
}; | ||
return ( | ||
<> | ||
<motion.div | ||
initial={{ opacity: 0 }} | ||
whileInView={{ opacity: 1 }} | ||
transition={{ ease: 'easeIn', duration: 1 }} | ||
style={{ width: width }} | ||
className={c.card} | ||
onClick={handleOpenModal}> | ||
<FilmFrame imageSrc={speaker.photo} height={height} width={width} /> | ||
<div className={c.cardInfoWrapper}> | ||
<h3 className={c.cardName}> | ||
{speaker.firstName} {speaker.lastName} | ||
</h3> | ||
<p className={c.cardTitle}> | ||
{speaker.title}{' '} | ||
{speaker.company?.name ? '@ ' + speaker.company?.name : ''} | ||
</p> | ||
</div> | ||
</motion.div> | ||
<SpeakerModal | ||
close={handleCloseModal} | ||
isOpen={isOpenModal} | ||
speaker={speaker} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default SpeakerCard; |
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { SpeakerWithCompanyDto } from '@ddays-app/types'; | ||
import FilmFrame from 'components/FilmFrame'; | ||
import { useEffect } from 'react'; | ||
|
||
import CloseSvg from '../../assets/close.svg'; | ||
import c from './SpeakersSection.module.scss'; | ||
|
||
type SpeakerModalProps = { | ||
close: () => void; | ||
isOpen: boolean; | ||
speaker: SpeakerWithCompanyDto; | ||
}; | ||
|
||
const SpeakerModal: React.FC<SpeakerModalProps> = ({ | ||
close, | ||
isOpen, | ||
speaker, | ||
}) => { | ||
useEffect(() => { | ||
if (isOpen) { | ||
const width = document.body.clientWidth; | ||
document.body.style.overflow = 'hidden'; | ||
document.body.style.width = `${width}px`; | ||
} else { | ||
document.body.style.overflow = 'visible'; | ||
document.body.style.width = `auto`; | ||
} | ||
|
||
return () => { | ||
document.body.style.overflow = 'visible'; | ||
document.body.style.width = `auto`; | ||
}; | ||
}, [isOpen]); | ||
|
||
useEffect(() => { | ||
const handleEsc = (e: KeyboardEvent) => { | ||
if (e.key === 'Escape') { | ||
close(); | ||
} | ||
}; | ||
|
||
window.addEventListener('keydown', handleEsc); | ||
|
||
return () => { | ||
window.removeEventListener('keydown', handleEsc); | ||
}; | ||
}, [close]); | ||
|
||
if (!isOpen) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div data-lenis-prevent className={c.modalBackground} onClick={close}> | ||
<div className={c.modal}> | ||
<div | ||
data-lenis-prevent | ||
className={c.container} | ||
onClick={(e) => e.stopPropagation()}> | ||
<img src={CloseSvg} alt='Close' className={c.close} onClick={close} /> | ||
<div className={c.modalImage}> | ||
<FilmFrame imageSrc={speaker.photo} width={320} height={400} /> | ||
</div> | ||
<div className={c.modalRight}> | ||
<h2 className={c.modalSpeakerName}> | ||
{speaker.firstName} {speaker.lastName} | ||
</h2> | ||
<h3 className={c.modalTitle}> | ||
{speaker.title}{' '} | ||
{speaker.company?.name ? '@ ' + speaker.company?.name : ''} | ||
</h3> | ||
<div className={c.socialsWrapper}> | ||
{speaker.linkedin && ( | ||
<a className={c.socialsLink} href={speaker.linkedin}> | ||
{`[`} LINKEDIN {']'} | ||
</a> | ||
)} | ||
{speaker.instagram && ( | ||
<a href={speaker.instagram}> | ||
{`[`} INSTAGRAM {']'} | ||
</a> | ||
)} | ||
</div> | ||
<section className={c.modalDescription}> | ||
{speaker.description} | ||
</section> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SpeakerModal; |
Oops, something went wrong.