Fix width of dropdown menus
This commit is contained in:
parent
b2328b50c6
commit
d54a8713d1
1 changed files with 2 additions and 3 deletions
|
@ -40,9 +40,7 @@ class DropdownMenu extends React.PureComponent<Props, State> {
|
||||||
if (this.state.visible && !prevState.visible && menu) {
|
if (this.state.visible && !prevState.visible && menu) {
|
||||||
document.addEventListener('click', this.windowListener);
|
document.addEventListener('click', this.windowListener);
|
||||||
document.addEventListener('contextmenu', this.contextMenuListener);
|
document.addEventListener('contextmenu', this.contextMenuListener);
|
||||||
menu.setAttribute(
|
menu.style.left = `${Math.round(this.state.posX - menu.clientWidth)}px`;
|
||||||
'style', `left: ${Math.round(this.state.posX - menu.clientWidth)}px`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.state.visible && prevState.visible) {
|
if (!this.state.visible && prevState.visible) {
|
||||||
|
@ -94,6 +92,7 @@ class DropdownMenu extends React.PureComponent<Props, State> {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.setState({ visible: false });
|
this.setState({ visible: false });
|
||||||
}}
|
}}
|
||||||
|
style={{ width: '12rem' }}
|
||||||
css={tw`absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500 z-50`}
|
css={tw`absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500 z-50`}
|
||||||
>
|
>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
|
Loading…
Reference in a new issue