-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/scihub 718 open lightbox when clicking on image (#69)
Co-authored-by: Krzysztof Nofz <[email protected]>
- Loading branch information
Showing
7 changed files
with
106 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
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,64 @@ | ||
import styled from 'styled-components'; | ||
|
||
import { Image, ImageStyled } from './Image'; | ||
import { ControlledModal } from './Modal/ControlledModal'; | ||
import { CloseButtonStyled, ModalBoxStyled } from './Modal/ModalContainer'; | ||
import { theme } from '../styles/theme'; | ||
import { pxToRem } from '../styles/utils'; | ||
|
||
type LightboxProps = { | ||
src: string; | ||
isOpen: boolean; | ||
onOpen: () => void; | ||
onClose: () => void; | ||
}; | ||
|
||
export const Lightbox: React.FC<LightboxProps> = ({ src, ...rest }) => { | ||
return ( | ||
<ControlledModalStyled {...rest}> | ||
<LightboxImageStyled {...{ src }} /> | ||
</ControlledModalStyled> | ||
); | ||
}; | ||
|
||
const ControlledModalStyled = styled(ControlledModal)` | ||
${ModalBoxStyled} { | ||
@media (min-width: ${theme.queries.laptop}) { | ||
width: auto; | ||
border: ${pxToRem(4)} solid ${props => props.theme.colors.white}; | ||
border-radius: 0; | ||
} | ||
} | ||
${CloseButtonStyled} { | ||
svg { | ||
width: ${pxToRem(30)}; | ||
height: ${pxToRem(30)}; | ||
fill: ${props => props.theme.colors.white}; | ||
} | ||
&:hover { | ||
background-color: transparent; | ||
} | ||
} | ||
`; | ||
|
||
const LightboxImageStyled = styled(Image)` | ||
height: 100%; | ||
width: 100%; | ||
@media (min-width: ${theme.queries.laptop}) { | ||
width: auto; | ||
height: auto; | ||
} | ||
${ImageStyled} { | ||
max-width: 100vw; | ||
max-height: 100vh; | ||
@media (min-width: ${theme.queries.laptop}) { | ||
max-width: 90vw; | ||
max-height: 90vh; | ||
} | ||
} | ||
`; |
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