Skip to content

Commit

Permalink
add border padding to Filter Dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Jan 14, 2025
1 parent 7906153 commit 78a37d0
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 34 deletions.
4 changes: 1 addition & 3 deletions app/seasonal-planting-guide/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ export const HeaderContainer = styled.div`
export const FilterContainer = styled.div`
display: flex;
flex-direction: row;
white-space: nowrap; // Prevent line break
gap: 8px;
margin-top: 12px;
margin-bottom: 20px;
padding-top: 1px;
padding-bottom: 1px; // ensure filter border isn't cut off
position: relative;
overflow-x: auto;
align-items: center;
Expand Down Expand Up @@ -55,4 +52,5 @@ export const VerticalSeparator = styled.div`
height: 30px;
width: 1px;
background-color: ${COLORS.lightgray};
flex-shrink: 0;
`;
5 changes: 3 additions & 2 deletions components/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export const SmallButton = styled(P3).attrs({ as: 'button' })<ButtonProps>`
${ButtonStyles}
// Unique to Small Button
border-radius: 20px;
height: 24px;
min-width: 60px;
min-height: 24px; // to prevent Clear Filters text overflow
padding: 4px 10px;
flex-shrink: 0; // to prevent Clear Filters from collapsing on overflow
padding: 4px 8px;
`;
34 changes: 18 additions & 16 deletions components/FilterDropdownMultiple/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,23 @@ export default function FilterDropdownMultiple<T>({
};

return (
<Select
options={options}
isMulti
value={value}
isDisabled={disabled}
placeholder={placeholder}
onChange={handleChange}
closeMenuOnSelect={false}
styles={customSelectStyles<T>()}
isSearchable={false}
hideSelectedOptions={false}
// use custom styled components instead of default components
components={{ MultiValue: CustomMultiValue, Option: CustomOption }}
menuPosition="fixed"
instanceId="dropdown-multiple"
/>
<div style={{ padding: '1px' }}>
<Select
options={options}
isMulti
value={value}
isDisabled={disabled}
placeholder={placeholder}
onChange={handleChange}
closeMenuOnSelect={false}
styles={customSelectStyles<T>()}
isSearchable={false}
hideSelectedOptions={false}
// use custom styled components instead of default components
components={{ MultiValue: CustomMultiValue, Option: CustomOption }}
menuPosition="fixed"
instanceId="dropdown-multiple"
/>
</div>
);
}
28 changes: 15 additions & 13 deletions components/FilterDropdownSingle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ export default function FilterDropdownSingle<T>({
};

return (
<Select
options={options}
value={value}
isDisabled={disabled}
placeholder={placeholder}
onChange={handleChange}
closeMenuOnSelect={false}
styles={customSelectStyles<T>(small)}
isSearchable={false}
hideSelectedOptions={false}
menuPosition="fixed"
instanceId="dropdown-single"
/>
<div style={{ padding: '1px' }}>
<Select
options={options}
value={value}
isDisabled={disabled}
placeholder={placeholder}
onChange={handleChange}
closeMenuOnSelect={false}
styles={customSelectStyles<T>(small)}
isSearchable={false}
hideSelectedOptions={false}
menuPosition="fixed"
instanceId="dropdown-single"
/>
</div>
);
}
1 change: 1 addition & 0 deletions components/FilterDropdownSingle/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const customSelectStyles = <T>(
: '#fff',
padding: '8px 14px',
minWidth: $isSmall ? '93px' : '150px',
width: 'max-content',
}),
// placeholder text
placeholder: baseStyles => ({
Expand Down

0 comments on commit 78a37d0

Please sign in to comment.