Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/XW-94/update-select-box #135

Merged
merged 7 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- 2.2.18:
- Refactored select role attribute.
- Fixed Pagination-button border-radius.
- Added colors for Focus and Selected options in Select forms.
- 2.2.17: Refactor Pagination to include aria labels and make aria label required on texarea, input and select components.
- 2.2.15/2.2.16: Added more NLDS options to Pagination.
- 2.2.13/2.2.14:
Expand Down
5 changes: 5 additions & 0 deletions src/components/formFields/select/select.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

--conduction-input-select-list-option-font-family: "Noto Sans", Arial, sans-serif;
/* --conduction-input-select-list-option-background-color: unset; */
/* --conduction-input-select-list-option-color: unset; */
/* --conduction-input-select-list-option-selected--background-color: unset; */
/* --conduction-input-select-list-option-selected-color: unset; */
/* --conduction-input-select-list-option-focus--background-color: unset; */
/* --conduction-input-select-list-option-focus-color: unset; */

/* --conduction-input-select-list-option-hover-background-color: unset; */
/* --conduction-input-select-list-option-hover-color: unset; */
Expand Down
18 changes: 16 additions & 2 deletions src/components/formFields/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,24 @@ interface ISelectProps {

const selectStyles: StylesConfig = {
menuPortal: (base) => ({ ...base, zIndex: 100 }),
option: (base) => ({
option: (base, state) => ({
...base,
fontFamily: `var(--conduction-input-select-list-option-font-family, ${base.fontFamily})`,
backgroundColor: `var(--conduction-input-select-list-option-background-color, ${base.backgroundColor}) `,
backgroundColor: [
state.isFocused
? `var(--conduction-input-select-list-option-focus-background-color, ${base.backgroundColor})`
: state.isSelected
? `var(--conduction-input-select-list-option-selected-background-color, ${base.backgroundColor})`
: `var(--conduction-input-select-list-option-background-color, ${base.backgroundColor})`,
],

color: [
state.isFocused
? `var(--conduction-input-select-list-option-focus-color, ${base.color})`
: state.isSelected
? `var(--conduction-input-select-list-option-selected-color, ${base.color})`
: `var(--conduction-input-select-list-option-color, ${base.color})`,
],

"&:hover": {
backgroundColor: `var(--conduction-input-select-list-option-hover-background-color, ${base.backgroundColor})`,
Expand Down