fixing the filter dropdown to look like a dropdown

This commit is contained in:
D3vision 2023-05-15 19:31:37 +02:00
parent 0d128ffac7
commit f37f9b3dd7
4 changed files with 42 additions and 11 deletions

View File

@ -56,7 +56,7 @@ export const ToggleSwitch = ({ value, onChange, inputRef, children }: InputEleme
}; };
export const VerticalToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties<boolean>) => { export const VerticalToggleSwitch = ({ value, onChange, inputRef, children }: InputElementProperties<boolean>) => {
return <label> return <label className="label-fix">
{children && <b>{children}</b>} {children && <b>{children}</b>}
<span className="check-box"> <span className="check-box">
<input ref={inputRef} defaultChecked={value} onChange={onChange} type='checkbox' /> <input ref={inputRef} defaultChecked={value} onChange={onChange} type='checkbox' />

View File

@ -775,6 +775,10 @@ input:disabled:hover {
color: #bdbfc4 color: #bdbfc4
} }
.placeholder{
color: #bdbfc4
}
.nav { .nav {
-webkit-box-align: stretch; -webkit-box-align: stretch;
-ms-flex-align: stretch; -ms-flex-align: stretch;

View File

@ -1,6 +1,13 @@
.dropdown .header { .dropdown .header {
min-height: 40px; min-height: 40px;
background-color: white; background-color: field;
border: 1px solid var(--color-lightGrey);
border-radius: 4px;
font-family: inherit;
font-size: 1em;
padding: 0.8rem 1rem;
transition: all .2s ease;
padding-right: 2.5rem !important;
} }
.dropdown .item-list { .dropdown .item-list {
@ -17,3 +24,20 @@
padding: 0.5rem 1rem !important; padding: 0.5rem 1rem !important;
user-select: none; user-select: none;
} }
.dropdown summary .placeholder{
margin-left: 0.5rem;
user-select: none;
}
.dropdown summary{
flex-wrap: wrap;
}
.dropdown summary::after{
content: " ";
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='40' fill='%23555'><polygon points='0,0 60,0 30,40'/></svg>");
background-size: 1ex;
position: absolute;
height: 1ex;
background-repeat: no-repeat;
width: 1ex;
right: 1rem;
}

View File

@ -192,7 +192,9 @@ const FlagList = () => {
/> />
{availableFilters && <Dropdown> {availableFilters && <Dropdown>
<Dropdown.Header> <Dropdown.Header>
{selectedFilters.map(f => <Dropdown.Item {selectedFilters.length === 0
? <p className="placeholder">Click to filter</p>
: selectedFilters.map(f => <Dropdown.Item
key={f} key={f}
onClick={() => { onClick={() => {
setSelectedFilters(selectedFilters.filter(ff => f !== ff)); setSelectedFilters(selectedFilters.filter(ff => f !== ff));
@ -200,7 +202,8 @@ const FlagList = () => {
}} }}
> >
{f} {f}
</Dropdown.Item>)} </Dropdown.Item>)
}
</Dropdown.Header> </Dropdown.Header>
<Dropdown.ItemList> <Dropdown.ItemList>