blob: 88b7231690e3c3f697f754556f8225b6eb54aa59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { useState } from "react";
import dynamic from "next/dynamic";
const DynamicBottomPopup = dynamic(() => import('@/components/elements/BottomPopup'));
const useBottomPopup = ({
title,
children
}) => {
const [ isOpen, setIsOpen ] = useState(false);
const [ dataPopup, setDataPopup ] = useState(null);
const closePopup = () => {
setIsOpen(false);
setDataPopup(null);
};
const openPopup = ( data = null ) => {
setIsOpen(true);
setDataPopup(data);
};
const BottomPopup = (
<DynamicBottomPopup
title={title}
active={isOpen}
closePopup={closePopup}
>
{ children(dataPopup) }
</DynamicBottomPopup>
);
return {
dataPopup,
BottomPopup,
closePopup,
openPopup
}
}
export default useBottomPopup;
|