mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 00:58:26 +01:00
Dropdown selected element highlighting (#75255)
## About The Pull Request This PR makes selected elements in Dropdowns to be highlighted. Without this:  With this:  ## Why It's Good For The Game It's convenient to have this kind of selection indication, especially in long lists. ## Changelog 🆑 qol: Made selected elements highlighted in TGUI Dropdowns /🆑
This commit is contained in:
@@ -69,20 +69,16 @@ export class Dropdown extends Component<DropdownProps, DropdownState> {
|
||||
Dropdown.currentOpenMenu?.getBoundingClientRect() ?? NULL_RECT,
|
||||
};
|
||||
menuContents: any;
|
||||
handleClick: any;
|
||||
state: DropdownState = {
|
||||
open: false,
|
||||
selected: this.props.selected,
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.handleClick = () => {
|
||||
if (this.state.open) {
|
||||
this.setOpen(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
handleClick = () => {
|
||||
if (this.state.open) {
|
||||
this.setOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
getDOMNode() {
|
||||
return findDOMfromVNode(this.$LI, true);
|
||||
@@ -170,7 +166,10 @@ export class Dropdown extends Component<DropdownProps, DropdownState> {
|
||||
return (
|
||||
<div
|
||||
key={value}
|
||||
className="Dropdown__menuentry"
|
||||
className={classes([
|
||||
'Dropdown__menuentry',
|
||||
this.state.selected === value && 'selected',
|
||||
])}
|
||||
onClick={() => {
|
||||
this.setSelected(value);
|
||||
}}>
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
line-height: base.em(17px);
|
||||
transition: background-color 100ms ease-out;
|
||||
|
||||
&.selected {
|
||||
background-color: rgba(255, 255, 255, 0.5) !important;
|
||||
transition: background-color 0ms;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
transition: background-color 0ms;
|
||||
|
||||
Reference in New Issue
Block a user