Merge remote-tracking branch 'origin/main'

# Conflicts:
#	01-frontend/package-lock.json
#	01-frontend/package.json
This commit is contained in:
mathusan
2025-05-31 18:05:32 +02:00
5 changed files with 153 additions and 2919 deletions

View File

@@ -0,0 +1,48 @@
import { Slider, Typography, Box } from "@mui/material";
import { useState } from "react";
import { useTranslation } from "react-i18next";
type PriceSliderProps = {
min?: number;
max?: number;
onChange?: (range: [number, number]) => void;
};
export default function PriceSlider({ min = 0, max = 100, onChange }: PriceSliderProps) {
const { t } = useTranslation();
const [value, setValue] = useState<[number, number]>([min, max]);
const handleChange = (_: Event, newValue: number | number[]) => {
if (Array.isArray(newValue)) {
setValue([newValue[0], newValue[1]]);
}
};
const handleCommitted = (_: Event, newValue: number | number[]) => {
if (Array.isArray(newValue)) {
onChange?.([newValue[0], newValue[1]]);
}
};
return (
<div>
<h3>{t('price')}</h3>
<Box sx={{pl: 2, pr: 7}}>
<Slider
value={value}
onChange={handleChange}
onChangeCommitted={handleCommitted}
valueLabelDisplay="auto"
min={min}
max={max}
step={1}
/>
</Box>
<Box sx={{ pl: 1, pr: 6, display: 'flex', justifyContent: 'space-between' }}>
<Typography>{value[0]?.toFixed(2) ?? "0.00"} </Typography>
<Typography>{value[1]?.toFixed(2) ?? "0.00"} </Typography>
</Box>
</div>
);
}