Skip to content

Commit 66a55a6

Browse files
committed
fix: update responsive logic for audit table filter
1 parent 99a3792 commit 66a55a6

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

site/src/components/Filter/Filter.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ type FilterProps = {
139139
error?: unknown;
140140
options?: ReactNode;
141141
presets: PresetFilter[];
142-
breakpoint?: Breakpoint;
142+
143+
/**
144+
* The CSS media query breakpoint that defines when the UI will try
145+
* displaying all options on one row, regardless of the number of options
146+
* present
147+
*/
148+
singleRowBreakpoint?: Breakpoint;
143149
};
144150

145151
export const Filter: FC<FilterProps> = ({
@@ -152,7 +158,7 @@ export const Filter: FC<FilterProps> = ({
152158
learnMoreLabel2,
153159
learnMoreLink2,
154160
presets,
155-
breakpoint = "md",
161+
singleRowBreakpoint = "lg",
156162
}) => {
157163
const theme = useTheme();
158164
// Storing local copy of the filter query so that it can be updated more
@@ -183,10 +189,10 @@ export const Filter: FC<FilterProps> = ({
183189
display: "flex",
184190
gap: 8,
185191
marginBottom: 16,
186-
flexWrap: "nowrap",
192+
flexWrap: "wrap",
187193

188-
[theme.breakpoints.down(breakpoint)]: {
189-
flexWrap: "wrap",
194+
[theme.breakpoints.up(singleRowBreakpoint)]: {
195+
flexWrap: "nowrap",
190196
},
191197
}}
192198
>

site/src/components/Filter/SelectFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const SelectFilter: FC<SelectFilterProps> = ({
5252
<SelectMenuTrigger>
5353
<SelectMenuButton
5454
startIcon={selectedOption?.startIcon}
55-
css={{ width, flexGrow: 1 }}
55+
css={{ flexBasis: width, flexGrow: 1 }}
5656
aria-label={label}
5757
>
5858
{selectedOption?.label ?? placeholder}

site/src/components/SearchField/SearchField.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export const SearchField: FC<SearchFieldProps> = ({
2121
const theme = useTheme();
2222
return (
2323
<TextField
24+
// Have to specify min width so that, as we keep adding more and
25+
// control options to the filter row, the text box doesn't have a
26+
// risk of shrinking so much that it becomes un-clickable
27+
css={{ minWidth: "320px" }}
2428
size="small"
2529
value={value}
2630
onChange={(e) => onChange(e.target.value)}

site/src/pages/AuditPage/AuditFilter.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export const AuditFilter: FC<AuditFilterProps> = ({ filter, error, menus }) => {
5555
isLoading={menus.user.isInitializing}
5656
filter={filter}
5757
error={error}
58-
breakpoint={menus.organization && "lg"}
5958
options={
6059
<>
6160
<ResourceTypeMenu width={width} menu={menus.resourceType} />

0 commit comments

Comments
 (0)