Newer
Older
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* eslint-disable react/prop-types */
import React, {
useMemo,
useContext,
useState,
useEffect,
useRef,
createRef,
} from 'react';
import styled from 'styled-components';
import {
WaxContext,
DocumentHelpers,
Icon,
useOnClickOutside,
} from 'wax-prosemirror-core';
const Wrapper = styled.div`
opacity: ${props => (props.disabled ? '0.4' : '1')};
`;
const DropDownButton = styled.button`
background: #fff;
border: none;
color: #000;
cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
display: flex;
position: relative;
width: 160px;
span {
position: relative;
top: 2px;
}
`;
const NumericalAnswerDropDownCompontent = ({ view = {}, item }) => {
const dropDownOptions = [
{
label: 'Exact answer with margin of error',
value: 'exactAnswer',
},
{
label: 'Answer within a range',
value: 'rangeAnswer',
},
{
label: 'Precise answer',
value: 'preciseAnswer',
},
];
const { activeView } = useContext(WaxContext);
const itemRefs = useRef([]);
const wrapperRef = useRef();
const [isOpen, setIsOpen] = useState(false);
const isDisabled = false;
useOnClickOutside(wrapperRef, () => setIsOpen(false));
useEffect(() => {
if (isDisabled) setIsOpen(false);
}, [isDisabled]);
return <>dropDown</>;
};
export default NumericalAnswerDropDownCompontent;