Skip to content

Commit

Permalink
Merge pull request #194 from UgnisSoftware/UGN-371-3
Browse files Browse the repository at this point in the history
UGN-371 bugfix - fix select component alignment issues
  • Loading branch information
JulitorK committed Aug 21, 2023
2 parents 2429f82 + 398fb81 commit 8ae12a5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 72 deletions.
1 change: 1 addition & 0 deletions src/components/Selects/MatchColumnSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const MatchColumnSelect = ({ onChange, value, options, placeholder, name
<Select<SelectOption, false>
value={value || null}
colorScheme="gray"
useBasicStyles
onChange={onChange}
placeholder={placeholder}
options={options}
Expand Down
1 change: 1 addition & 0 deletions src/components/Selects/TableSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const TableSelect = ({ onChange, value, options }: Props) => {
return (
<Select<SelectOption, false>
autoFocus
useBasicStyles
size="sm"
value={value}
onChange={onChange}
Expand Down
103 changes: 31 additions & 72 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,44 +217,16 @@ export const themeOverrides = {
},
},
select: {
dropdownIndicator: (provided) => ({
...provided,
background: "none",
border: "none",
p: 0,
w: "40px",
color: "textColor",
}),
control: (provided) => ({
...provided,
background: "none",
borderRadius: "6px",
p: 0,
// _focus, _hover, _invalid, _readonly pseudoselectors can be used here for alternate border colors
_focus: undefined,
}),
input: (provided) => ({
...provided,
background: "none",
border: "none",
p: 0,
}),
indicatorSeparator: (provided) => ({
...provided,
opacity: 0,
}),
singleValue: (provided) => ({
...provided,
ml: 0,
mr: 0,
}),
placeholder: (provided) => ({
...provided,
color: "inactiveColor",
}),
valueContainer: (provided) => ({
...provided,
color: "textColor",
borderColor: "border",
_hover: {
borderColor: "border",
},
["&[data-focus-visible]"]: {
borderColor: "border",
boxShadow: "none",
},
}),
menu: (provided) => ({
...provided,
Expand All @@ -264,12 +236,12 @@ export const themeOverrides = {
menuList: (provided) => ({
...provided,
bg: "background",
minW: "initial",
borderColor: "border",
}),
option: (provided, state) => ({
...provided,
color: "textColor",
bg: state.isSelected || state.isFocused ? "highlight" : provided.bg,
bg: state.isSelected || state.isFocused ? "highlight" : "background",
overflow: "hidden",
textOverflow: "ellipsis",
display: "block",
Expand All @@ -278,6 +250,14 @@ export const themeOverrides = {
bg: "highlight",
},
}),
placeholder: (provided) => ({
...provided,
color: "inactiveColor",
}),
noOptionsMessage: (provided) => ({
...provided,
color: "inactiveColor",
}),
} as ChakraStylesConfig<SelectOption>,
},
},
Expand All @@ -288,58 +268,37 @@ export const themeOverrides = {
fontSize: "3xl",
},
select: {
dropdownIndicator: (provided) => ({
...provided,
background: "none",
border: "none",
p: 0,
w: "40px",
}),
control: (provided) => ({
...provided,
background: "none",
border: "none",
p: 0,
_focus: undefined,
}),
input: (provided) => ({
...provided,
background: "none",
border: "none",
p: 0,
}),
indicatorSeparator: (provided) => ({
...provided,
opacity: 0,
}),
singleValue: (provided) => ({
...provided,
marginInlineStart: 0,
}),
valueContainer: (provided) => ({
...provided,
p: 0,
paddingInlineStart: 2,
color: "gray.400",
py: 0,
px: 1.5,
}),
inputContainer: (provided) => ({ ...provided, py: 0 }),
control: (provided) => ({ ...provided, border: "none" }),
input: (provided) => ({ ...provided, color: "textColor" }),
menu: (provided) => ({
...provided,
p: 0,
mt: 0,
}),
menuList: (provided) => ({
...provided,
minW: "initial",
bg: "background",
borderColor: "border",
}),
option: (provided, state) => ({
...provided,
color: state.isSelected ? "gray.900" : provided.color,
bg: state.isSelected || state.isFocused ? "secondaryBackground" : provided.bg,
color: "textColor",
bg: state.isSelected || state.isFocused ? "highlight" : "background",
overflow: "hidden",
textOverflow: "ellipsis",
display: "block",
whiteSpace: "nowrap",
}),
noOptionsMessage: (provided) => ({
...provided,
color: "inactiveColor",
}),
} as ChakraStylesConfig<SelectOption>,
},
},
Expand Down

0 comments on commit 8ae12a5

Please sign in to comment.