Skip to content

Commit c9e8171

Browse files
authored
Merge pull request bcgov#1735 from djnunez-aot/maxwidth-handling-for-list-filters
Add max width filtering for filters
2 parents 137b0cf + f589d3e commit c9e8171

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

epictrack-web/src/components/project/ProjectList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ const ProjectList = () => {
176176
column={column}
177177
variant="inline"
178178
name="rolesFilter"
179+
maxWidth="328px"
179180
/>
180181
);
181182
},

epictrack-web/src/components/shared/filterSelect/FilterSelect.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,24 @@ const FilterSelect = (props: SelectProps) => {
165165
onBlur={() => setMenuIsOpen(false)}
166166
ref={selectRef}
167167
styles={{
168-
option: (base, props) => ({
168+
option: (base, provided) => ({
169169
...base,
170-
whiteSpace: "nowrap",
170+
whiteSpace: "normal",
171171
overflow: "hidden",
172172
textOverflow: "ellipsis",
173173
display: "flex",
174174
alignItems: "center",
175175
padding: ".5rem .75rem .5rem 0px",
176176
fontWeight: "normal",
177177
fontSize: "1rem",
178-
background: props.isFocused ? Palette.neutral.bg.main : "transparent",
179-
color: props.isSelected
178+
maxWidth: props.maxWidth ?? "100%",
179+
background: provided.isFocused
180+
? Palette.neutral.bg.main
181+
: "transparent",
182+
color: provided.isSelected
180183
? Palette.primary.accent.main
181184
: Palette.neutral.accent.dark,
182-
cursor: props.isFocused ? "pointer" : "default",
185+
cursor: provided.isFocused ? "pointer" : "default",
183186
}),
184187
control: (base, props) => ({
185188
...base,

epictrack-web/src/components/shared/filterSelect/type.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ declare module "react-select/dist/declarations/src/Select" {
2424
getOptionLabel?: (option: any) => string;
2525
getOptionValue?: (option: any) => string;
2626
label?: string;
27+
maxWidth?: string;
2728
};
2829
filterAppliedCallback?: (value?: string[] | string) => void;
2930
filterClearedCallback?: (value?: [] | "") => void;
@@ -33,6 +34,7 @@ declare module "react-select/dist/declarations/src/Select" {
3334
export type SelectProps = {
3435
variant: "inline" | "bar" | "inline-standalone";
3536
info?: boolean;
37+
maxWidth?: string;
3638
} & Props<OptionType>;
3739

3840
export type TableFilterProps = {

0 commit comments

Comments
 (0)