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

fix: Reduce selected menu option styles specificity #338

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"start": "nodemon --watch src --exec npm run build -e ts,tsx"
},
"dependencies": {
"react-select": "5.8.1"
"react-select": "5.8.x"
},
"peerDependencies": {
"@chakra-ui/react": "2.x",
Expand Down
16 changes: 8 additions & 8 deletions src/chakra-components/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export const Option = <
selectedOptionStyle === "check" &&
(!isMulti || hideSelectedOptions === false);

const shouldHighlight = selectedOptionStyle === "color";
const shouldHighlight = selectedOptionStyle === "color" && isSelected;

const initialSx: SystemStyleObject = {
...menuItemStyles,
Expand All @@ -423,13 +423,13 @@ export const Option = <
fontSize: size,
paddingX: horizontalPaddingOptions[size],
paddingY: verticalPaddingOptions[size],
...(shouldHighlight && {
_selected: {
bg: selectedBg,
color: selectedColor,
_active: { bg: selectedBg },
},
}),
...(shouldHighlight
? {
bg: selectedBg,
color: selectedColor,
_active: { bg: selectedBg },
}
: {}),
};

const sx = chakraStyles?.option
Expand Down
Loading