You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Sort.tsx 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { FormControl, InputLabel, MenuItem, Select, SelectChangeEvent } from '@mui/material';
  2. import { useTranslation } from 'next-i18next';
  3. interface SortProps {
  4. sort: string;
  5. handleSortChange: (e: SelectChangeEvent) => void;
  6. }
  7. const Sort: React.FC<SortProps> = ({ sort, handleSortChange }) => {
  8. const { t } = useTranslation('products');
  9. return (
  10. <>
  11. <FormControl
  12. sx={{
  13. width: '200px',
  14. mb: { xs: '10px', sm: '0px' },
  15. mr: { sm: '10px' },
  16. }}
  17. >
  18. <InputLabel id="sort-label">{t('products:sort')}</InputLabel>
  19. <Select
  20. MenuProps={{
  21. disableScrollLock: true,
  22. }}
  23. label={t('products:sort')}
  24. labelId="sort-label"
  25. id="sort-select-helper"
  26. value={sort}
  27. onChange={handleSortChange}
  28. >
  29. <MenuItem value="asc">{t('products:asc')}</MenuItem>
  30. <MenuItem value="desc">{t('products:desc')}</MenuItem>
  31. </Select>
  32. </FormControl>
  33. </>
  34. );
  35. };
  36. export default Sort;