Skip to content

Commit

Permalink
feat: update rangeSlider for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic-maury committed Jan 11, 2025
1 parent 3fddf6b commit 81b4545
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Common/Inputs/RangeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function RangeSlider(props: RangeSliderProps & {
const isSmallScreen = useSmallScreen();
return <>
{ props.textlabel &&
<Text size={!isSmallScreen ? 'md' : 'xl'} className="!mb-2">
<Text size={!isSmallScreen ? 'md' : 'xl'} className={`!mb-2 ${props.labelAlwaysOn ? '!mb-8' : ''}`}>
{ props.textlabel }
</Text>
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/Filtering/PropertyOccupations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export function PropertyOccupations() {
<RangeSlider
textlabel={t('propertyOccupations.range') + ' (%)'}
value={[propertyOccupations.min, propertyOccupations.max]}
labelAlwaysOn
marks={[
{ value: 0, label: '0%' },
{ value: 50, label: '50%' },
{ value: 100, label: '100%' },
]}
min={0}
max={100}
minRange={0}
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/Filtering/PropertyYields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ export function PropertyYields() {
return <>
<RangeSlider
textlabel={t('propertyYields.range') + ' (%)'}
value={[propertyYields.min ?? 0, propertyYields.max ?? 100]}
value={[propertyYields.min ?? 0, propertyYields.max ?? 20]}
labelAlwaysOn
marks={[
{ value: 0, label: '0%' },
{ value: 10, label: '10%' },
{ value: 20, label: '20%+' },
]}
min={0}
max={100}
max={20}
minRange={0}
size={!isSmallScreen ? 'md' : 'xl'}
onChange={(e) => onPropertyYields(e[0] as number, e[1] as number)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function filterProperties(
if (propertyYields.min > 0 && property.annualPercentageYield < propertyYields.min) {
return false;
}
if (propertyYields.max && property.annualPercentageYield > propertyYields.max) {
if (propertyYields.max && propertyYields.max < 20 && property.annualPercentageYield > propertyYields.max) {
return false;
}
if (rentStart !== 'all') {
Expand Down

0 comments on commit 81b4545

Please sign in to comment.