Filter box styling fixes
This commit is contained in:
parent
ea033509c7
commit
339a8a9402
@ -122,87 +122,89 @@ export function FilterList({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const returnEl = (
|
const returnEl = (
|
||||||
<div className="filter-box">
|
<div className="filter-wrapper">
|
||||||
<div className="header">
|
<div className="filter-box">
|
||||||
<label>{label}</label>
|
<div className="header">
|
||||||
<input
|
<label>{label}</label>
|
||||||
type="text"
|
<input
|
||||||
value={text}
|
type="text"
|
||||||
placeholder={placeholder}
|
value={text}
|
||||||
ref={searchBoxRef}
|
placeholder={placeholder}
|
||||||
onChange={filterUpdate}
|
ref={searchBoxRef}
|
||||||
onBlur={(e) => {
|
onChange={filterUpdate}
|
||||||
searchBoxRef.current!.focus();
|
onBlur={(e) => {
|
||||||
}}
|
searchBoxRef.current!.focus();
|
||||||
onKeyDown={(e: React.KeyboardEvent) => {
|
}}
|
||||||
// console.log("Key up", e);
|
onKeyDown={(e: React.KeyboardEvent) => {
|
||||||
if (onKeyPress) {
|
// console.log("Key up", e);
|
||||||
onKeyPress(e.key, text);
|
if (onKeyPress) {
|
||||||
}
|
onKeyPress(e.key, text);
|
||||||
switch (e.key) {
|
}
|
||||||
case "ArrowUp":
|
switch (e.key) {
|
||||||
setSelectionOption(Math.max(0, selectedOption - 1));
|
case "ArrowUp":
|
||||||
break;
|
setSelectionOption(Math.max(0, selectedOption - 1));
|
||||||
case "ArrowDown":
|
break;
|
||||||
setSelectionOption(
|
case "ArrowDown":
|
||||||
Math.min(matchingOptions.length - 1, selectedOption + 1)
|
setSelectionOption(
|
||||||
);
|
Math.min(matchingOptions.length - 1, selectedOption + 1)
|
||||||
break;
|
);
|
||||||
case "Enter":
|
break;
|
||||||
onSelect(matchingOptions[selectedOption]);
|
case "Enter":
|
||||||
e.preventDefault();
|
onSelect(matchingOptions[selectedOption]);
|
||||||
break;
|
|
||||||
case "Escape":
|
|
||||||
onSelect(undefined);
|
|
||||||
break;
|
|
||||||
case " ":
|
|
||||||
if (completePrefix && !text) {
|
|
||||||
updateFilter(completePrefix);
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
break;
|
||||||
break;
|
case "Escape":
|
||||||
}
|
onSelect(undefined);
|
||||||
e.stopPropagation();
|
break;
|
||||||
}}
|
case " ":
|
||||||
onClick={(e) => e.stopPropagation()}
|
if (completePrefix && !text) {
|
||||||
/>
|
updateFilter(completePrefix);
|
||||||
</div>
|
e.preventDefault();
|
||||||
<div
|
}
|
||||||
className="help-text"
|
break;
|
||||||
dangerouslySetInnerHTML={{ __html: helpText }}
|
}
|
||||||
></div>
|
e.stopPropagation();
|
||||||
<div className="result-list">
|
}}
|
||||||
{matchingOptions && matchingOptions.length > 0
|
onClick={(e) => e.stopPropagation()}
|
||||||
? matchingOptions.map((option, idx) => (
|
/>
|
||||||
<div
|
</div>
|
||||||
key={"" + idx}
|
<div
|
||||||
ref={selectedOption === idx ? selectedElementRef : undefined}
|
className="help-text"
|
||||||
className={
|
dangerouslySetInnerHTML={{ __html: helpText }}
|
||||||
selectedOption === idx ? "selected-option" : "option"
|
></div>
|
||||||
}
|
<div className="result-list">
|
||||||
onMouseOver={(e) => {
|
{matchingOptions && matchingOptions.length > 0
|
||||||
setSelectionOption(idx);
|
? matchingOptions.map((option, idx) => (
|
||||||
}}
|
<div
|
||||||
onClick={(e) => {
|
key={"" + idx}
|
||||||
e.preventDefault();
|
ref={selectedOption === idx ? selectedElementRef : undefined}
|
||||||
onSelect(option);
|
className={
|
||||||
}}
|
selectedOption === idx ? "selected-option" : "option"
|
||||||
>
|
}
|
||||||
<span className="icon">
|
onMouseOver={(e) => {
|
||||||
{icon && <FontAwesomeIcon icon={icon} />}
|
setSelectionOption(idx);
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
className="name"
|
|
||||||
dangerouslySetInnerHTML={{
|
|
||||||
__html: option?.result?.indexes
|
|
||||||
? fuzzysort.highlight(option.result, "<b>", "</b>")!
|
|
||||||
: escapeHtml(option.name),
|
|
||||||
}}
|
}}
|
||||||
></span>
|
onClick={(e) => {
|
||||||
{option.hint && <span className="hint">{option.hint}</span>}
|
e.preventDefault();
|
||||||
</div>
|
onSelect(option);
|
||||||
))
|
}}
|
||||||
: null}
|
>
|
||||||
|
<span className="icon">
|
||||||
|
{icon && <FontAwesomeIcon icon={icon} />}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
className="name"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: option?.result?.indexes
|
||||||
|
? fuzzysort.highlight(option.result, "<b>", "</b>")!
|
||||||
|
: escapeHtml(option.name),
|
||||||
|
}}
|
||||||
|
></span>
|
||||||
|
{option.hint && <span className="hint">{option.hint}</span>}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
@import "constants";
|
@import "constants";
|
||||||
|
|
||||||
.filter-box {
|
.filter-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-family: $ui-font;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
background-color: #fff;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -14,9 +12,15 @@
|
|||||||
max-height: 290px;
|
max-height: 290px;
|
||||||
overflow: hide;
|
overflow: hide;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-box {
|
||||||
|
font-family: $ui-font;
|
||||||
|
background-color: #fff;
|
||||||
border: rgb(103, 103, 103) 1px solid;
|
border: rgb(103, 103, 103) 1px solid;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
|
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
|
||||||
|
margin: 10px;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
border-bottom: 1px rgb(108, 108, 108) solid;
|
border-bottom: 1px rgb(108, 108, 108) solid;
|
||||||
@ -53,7 +57,6 @@
|
|||||||
.result-list {
|
.result-list {
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
padding: 0 8px 0 5px;
|
padding: 0 8px 0 5px;
|
||||||
|
Loading…
Reference in New Issue
Block a user