Merge branch 'release/3.8.10' into main

This commit is contained in:
Antonella Sgarlatta
2021-06-24 14:46:14 -03:00

View File

@@ -31,6 +31,7 @@ const SearchOptions = observer(({ appState }: Props) => {
top: 0, top: 0,
right: 0, right: 0,
}); });
const [maxWidth, setMaxWidth] = useState<number | 'auto'>('auto');
const buttonRef = useRef<HTMLButtonElement>(); const buttonRef = useRef<HTMLButtonElement>();
const panelRef = useRef<HTMLDivElement>(); const panelRef = useRef<HTMLDivElement>();
const [closeOnBlur, setLockCloseOnBlur] = useCloseOnBlur(panelRef, setOpen); const [closeOnBlur, setLockCloseOnBlur] = useCloseOnBlur(panelRef, setOpen);
@@ -49,6 +50,7 @@ const SearchOptions = observer(({ appState }: Props) => {
open={open} open={open}
onChange={() => { onChange={() => {
const rect = buttonRef.current.getBoundingClientRect(); const rect = buttonRef.current.getBoundingClientRect();
setMaxWidth(rect.right - 16);
setPosition({ setPosition({
top: rect.bottom, top: rect.bottom,
right: document.body.clientWidth - rect.right, right: document.body.clientWidth - rect.right,
@@ -68,8 +70,9 @@ const SearchOptions = observer(({ appState }: Props) => {
ref={panelRef} ref={panelRef}
style={{ style={{
...position, ...position,
maxWidth,
}} }}
className="sn-dropdown sn-dropdown--animated min-w-80 fixed grid gap-2 py-2" className="sn-dropdown sn-dropdown--animated w-80 fixed grid gap-2 py-2"
onBlur={closeOnBlur} onBlur={closeOnBlur}
> >
<Switch <Switch