mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
feat: show dropdown immediately (#5606)
This commit is contained in:
parent
e88beff2b2
commit
eebe43fcb1
@ -28,10 +28,14 @@ export const FilterDateItem: FC<IFilterDateItemProps> = ({
|
||||
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null);
|
||||
const { locationSettings } = useLocationSettings();
|
||||
|
||||
const onClick = () => {
|
||||
const open = () => {
|
||||
setAnchorEl(ref.current);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
open();
|
||||
}, []);
|
||||
|
||||
const onClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
@ -68,7 +72,7 @@ export const FilterDateItem: FC<IFilterDateItemProps> = ({
|
||||
label={label}
|
||||
selectedOptions={selectedOptions}
|
||||
onDelete={onDelete}
|
||||
onClick={onClick}
|
||||
onClick={open}
|
||||
operator={currentOperator}
|
||||
operatorOptions={operators}
|
||||
onChangeOperator={(operator) => {
|
||||
|
@ -35,16 +35,20 @@ export const FilterItem: FC<IFilterItemProps> = ({
|
||||
pluralOperators,
|
||||
}) => {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null);
|
||||
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>();
|
||||
const [searchText, setSearchText] = useState('');
|
||||
|
||||
const currentOperators =
|
||||
state && state.values.length > 1 ? pluralOperators : singularOperators;
|
||||
|
||||
const onClick = () => {
|
||||
const open = () => {
|
||||
setAnchorEl(ref.current);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
open();
|
||||
}, []);
|
||||
|
||||
const onClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
@ -95,7 +99,7 @@ export const FilterItem: FC<IFilterItemProps> = ({
|
||||
label={label}
|
||||
selectedOptions={selectedOptions}
|
||||
onDelete={onDelete}
|
||||
onClick={onClick}
|
||||
onClick={open}
|
||||
operator={currentOperator}
|
||||
operatorOptions={currentOperators}
|
||||
onChangeOperator={(operator) => {
|
||||
|
Loading…
Reference in New Issue
Block a user