-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { FC } from "react"; | ||
import Select from "react-select" | ||
|
||
type Option = { | ||
label: string; | ||
value: string; | ||
} | ||
type SingleDropdownSelectorProps = { | ||
label: string; | ||
options: Array<Option>; | ||
setSelectedOption: any; | ||
} | ||
const SingleDropdownSelector: FC<SingleDropdownSelectorProps> = ({ | ||
label, | ||
options, | ||
setSelectedOption | ||
}) => { | ||
|
||
const styles = { | ||
control: (base: any) => ({ | ||
...base, | ||
border: "1px solid #cccccc", | ||
boxShadow: "none", | ||
"&:active": { | ||
borderColor: '#7429C6' | ||
}, | ||
"&:select": { | ||
borderColor: '#7429C6' | ||
}, | ||
"&:focus": { | ||
borderColor: '#7429C6' | ||
}, | ||
"&:hover": { | ||
borderColor: '#7429C6', | ||
cursor: "pointer", | ||
} | ||
}), | ||
dropdownIndicator: (base: any) => ({ | ||
...base, | ||
color: "inherit", | ||
}), | ||
singleValue: (base: any) => ({ | ||
...base, | ||
color: "inherit" | ||
}), | ||
option: (base: any, state: any) => ({ | ||
...base, | ||
backgroundColor: state.isSelected ? '#7429C6' : 'inherit', | ||
"&:hover": { | ||
backgroundColor: "#D2D5DA", | ||
borderColor: "#D2D5DA", | ||
color: "#121826", | ||
cursor: "pointer" | ||
}, | ||
"&:active": { | ||
backgroundColor: "#7429C6", | ||
borderColor: "#7429C6", | ||
color: "white" | ||
} | ||
}) | ||
}; | ||
|
||
return ( | ||
<div className="min-w-[140px]"> | ||
<Select | ||
styles={styles} | ||
defaultValue={options[0]} | ||
onChange={setSelectedOption} | ||
name={label} | ||
options={options} | ||
/> | ||
</div> | ||
); | ||
} | ||
export default SingleDropdownSelector; |
This file was deleted.
This file was deleted.