Skip to content
Snippets Groups Projects
Commit c08561a2 authored by Sreeram, Sudarshan's avatar Sreeram, Sudarshan :carrot:
Browse files

Update styling of search bar dropdown

parent 9f81efde
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ export interface SearchBoxProps { ...@@ -16,7 +16,7 @@ export interface SearchBoxProps {
const SearchBox: React.FC<SearchBoxProps> = ({ const SearchBox: React.FC<SearchBoxProps> = ({
searchText, searchText,
onSearchTextChange, onSearchTextChange
}: SearchBoxProps) => { }: SearchBoxProps) => {
return ( return (
<Dropdown alignRight> <Dropdown alignRight>
...@@ -33,33 +33,40 @@ const SearchBox: React.FC<SearchBoxProps> = ({ ...@@ -33,33 +33,40 @@ const SearchBox: React.FC<SearchBoxProps> = ({
<InputGroup.Append> <InputGroup.Append>
<Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" /> <Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" />
<Dropdown.Menu alignRight> <Dropdown.Menu alignRight className={styles.dropdownMenu}>
<Dropdown.Header>Search types: </Dropdown.Header> <Dropdown.Header className={styles.dropdownHeader}>
Types:{" "}
</Dropdown.Header>
<Dropdown.Item <Dropdown.Item
className={styles.dropdownItem}
onClick={() => onSearchTextChange(`${searchText} type(pdf) `)} onClick={() => onSearchTextChange(`${searchText} type(pdf) `)}
> >
type(pdf) PDF
</Dropdown.Item> </Dropdown.Item>
<Dropdown.Item <Dropdown.Item
className={styles.dropdownItem}
onClick={() => onSearchTextChange(`${searchText} type(video) `)} onClick={() => onSearchTextChange(`${searchText} type(video) `)}
> >
type(video) Video
</Dropdown.Item> </Dropdown.Item>
<Dropdown.Item <Dropdown.Item
className={styles.dropdownItem}
onClick={() => onSearchTextChange(`${searchText} type(file) `)} onClick={() => onSearchTextChange(`${searchText} type(file) `)}
> >
type(file) File
</Dropdown.Item> </Dropdown.Item>
<Dropdown.Header>Search tags: </Dropdown.Header> <Dropdown.Header className={styles.dropdownHeader}>Tags: </Dropdown.Header>
<Dropdown.Item <Dropdown.Item
className={styles.dropdownItem}
onClick={() => onSearchTextChange(`${searchText} tag(new) `)} onClick={() => onSearchTextChange(`${searchText} tag(new) `)}
> >
tag(new) New
</Dropdown.Item> </Dropdown.Item>
<Dropdown.Item <Dropdown.Item
className={styles.dropdownItem}
onClick={() => onSearchTextChange(`${searchText} tag(my tag) `)} onClick={() => onSearchTextChange(`${searchText} tag(my tag) `)}
> >
tag(my tag) My Tag
</Dropdown.Item> </Dropdown.Item>
</Dropdown.Menu> </Dropdown.Menu>
</InputGroup.Append> </InputGroup.Append>
...@@ -73,7 +80,7 @@ const CustomToggle = React.forwardRef(({ onClick }: any, ref: any) => ( ...@@ -73,7 +80,7 @@ const CustomToggle = React.forwardRef(({ onClick }: any, ref: any) => (
variant="secondary" variant="secondary"
className={styles.searchBarIcon} className={styles.searchBarIcon}
ref={ref} ref={ref}
onClick={(e) => { onClick={e => {
e.preventDefault(); e.preventDefault();
onClick(e); onClick(e);
}} }}
......
...@@ -10,6 +10,7 @@ $button-border: transparentize($gray-300, 1); ...@@ -10,6 +10,7 @@ $button-border: transparentize($gray-300, 1);
transition: 0.2s background-color; transition: 0.2s background-color;
-webkit-transition: 0.2s background-color; -webkit-transition: 0.2s background-color;
-moz-transition: 0.2s back-ground-color; -moz-transition: 0.2s back-ground-color;
margin-top: 0.875rem;
} }
.searchBar::placeholder { .searchBar::placeholder {
...@@ -41,6 +42,7 @@ $button-border: transparentize($gray-300, 1); ...@@ -41,6 +42,7 @@ $button-border: transparentize($gray-300, 1);
transition: 0.2s background-color !important; transition: 0.2s background-color !important;
-webkit-transition: 0.2s background-color !important; -webkit-transition: 0.2s background-color !important;
-moz-transition: 0.2s back-ground-color !important; -moz-transition: 0.2s back-ground-color !important;
margin-top: 0.875rem;
} }
...@@ -54,3 +56,48 @@ $button-border: transparentize($gray-300, 1); ...@@ -54,3 +56,48 @@ $button-border: transparentize($gray-300, 1);
box-shadow: none !important; box-shadow: none !important;
} }
.dropdownMenu {
border-radius: 0.5rem;
margin-top: 0.5rem;
box-shadow: 0 0.125rem 0.625rem 0 rgba(0, 0, 0, 0.1);
border: 1px solid $gray-300;
padding: 0.75rem;
}
.dropdownHeader {
font-weight: 500;
font-size: 1rem;
color: $black;
padding: 0px;
margin-bottom: 0.75rem;
}
.dropdownHeader:not(:first-child) {
margin-top: 1rem;
}
.dropdownItem {
border-radius: 0.5rem;
background: $gray-100;
font-size: 1rem;
text-align: center;
transition: 0.2s background;
-webkit-transition: 0.2s background;
-moz-transition: 0.2s background;
}
.dropdownItem:not(:last-child) {
margin-bottom: 0.5rem;
}
.dropdownItem:hover {
background: $gray-200;
}
.dropdownItem:active,
.dropdown:global(.active) {
color: $white;
font-weight: 500;
background: $black;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment