This repository has been archived by the owner on Nov 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added full-screen image modal when clicking on img's Co-authored-by: Erik Michelson <github@erik.michelson.eu>
- Loading branch information
1 parent
553cd35
commit cac9b7e
Showing
8 changed files
with
55 additions
and
7 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
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
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
31 changes: 31 additions & 0 deletions
31
src/components/markdown-renderer/replace-components/image/frame.tsx
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,31 @@ | ||
import React, { Fragment, useState } from 'react' | ||
import { Modal } from 'react-bootstrap' | ||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon' | ||
|
||
export const Frame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = ({ alt, ...props }) => { | ||
const [showFullscreenImage, setShowFullscreenImage] = useState(false) | ||
|
||
return ( | ||
<Fragment> | ||
<img alt={alt} {...props} className={'cursor-zoom-in'} onClick={() => setShowFullscreenImage(true)}/> | ||
<Modal | ||
animation={true} | ||
centered={true} | ||
dialogClassName={'text-dark'} | ||
show={showFullscreenImage} | ||
onHide={() => setShowFullscreenImage(false)} | ||
closeButton={true} | ||
size={'xl'} | ||
> | ||
<Modal.Header closeButton={true}> | ||
<Modal.Title className={'h6'}> | ||
<ForkAwesomeIcon icon={'picture-o'}/> | ||
| ||
<span>{alt ?? ''}</span> | ||
</Modal.Title> | ||
</Modal.Header> | ||
<img alt={alt} {...props} className={'w-100 cursor-zoom-out'} onClick={() => setShowFullscreenImage(false)}/> | ||
</Modal> | ||
</Fragment> | ||
) | ||
} |
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