Import repositories from gitlab
This commit is contained in:
33
next/components/imageBlock/index.jsx
Normal file
33
next/components/imageBlock/index.jsx
Normal file
@@ -0,0 +1,33 @@
|
||||
'use client';
|
||||
import { useState } from 'react';
|
||||
import styles from './style.module.scss';
|
||||
import ImagePopup from '../imagePopup';
|
||||
|
||||
export default function ImageBlock({alt, src, ...props}) {
|
||||
const [showPopup, setShowPopup] = useState(false);
|
||||
|
||||
const toggleShowPopup = () => {
|
||||
setShowPopup(prev => !prev);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<img
|
||||
{...props}
|
||||
onClick={toggleShowPopup}
|
||||
src={src}
|
||||
alt={alt}
|
||||
className={`${styles.imageBlock} ${props.className}`}
|
||||
/>
|
||||
{
|
||||
showPopup ?
|
||||
<ImagePopup
|
||||
toggleShowPopup={toggleShowPopup}
|
||||
alt={alt}
|
||||
src={src}
|
||||
/>
|
||||
: null
|
||||
}
|
||||
</>
|
||||
);
|
||||
}
|
||||
4
next/components/imageBlock/style.module.scss
Normal file
4
next/components/imageBlock/style.module.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
.imageBlock {
|
||||
cursor: pointer;
|
||||
max-height: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user