-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Sun-Mountain/23-duration-filter
23 duration filter
- Loading branch information
Showing
8 changed files
with
164 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useState } from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Slider from '@mui/material/Slider'; | ||
|
||
import { SlideFilter } from '@/interfaces/Filters'; | ||
|
||
function valuetext(value: number) { | ||
return `${value}`; | ||
} | ||
|
||
export default function SliderComponent({ | ||
label, | ||
filterValues, | ||
setFilter, | ||
step, | ||
min, | ||
max | ||
}: SlideFilter) { | ||
|
||
const handleChange = (event: Event, newValue: number | number[]) => { | ||
setFilter(newValue as number[]); | ||
}; | ||
|
||
const minValue = filterValues[0]; | ||
const maxValue = filterValues[1]; | ||
|
||
const chosenRange = minValue != maxValue ? `Between ${minValue} and ${maxValue} hours.` : `Only with a duration of ${minValue} hour(s).` | ||
|
||
return ( | ||
<div className='filter-component-container'> | ||
<strong>{label}</strong><br /> | ||
{chosenRange} | ||
<div className='flex-row slider-container'> | ||
<div className='slider-end-label'> | ||
{min} Hour | ||
</div> | ||
<Box className='slider-box' sx={{ width: 350 }} | ||
> | ||
<Slider | ||
getAriaLabel={() => 'Temperature range'} | ||
value={filterValues} | ||
onChange={handleChange} | ||
valueLabelDisplay="auto" | ||
getAriaValueText={valuetext} | ||
step={step} | ||
marks | ||
min={min} | ||
max={max} | ||
/> | ||
</Box> | ||
<div className='slider-end-label'> | ||
{max} Hours | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
import { Dispatch, SetStateAction } from 'react'; | ||
|
||
export interface UniqueFilter { | ||
[index: string]: Array<number>; | ||
} | ||
|
||
export interface FilterTypes { | ||
groups: UniqueFilter; | ||
eventTypes: UniqueFilter; | ||
gameSystems: UniqueFilter; | ||
ageRequirements: UniqueFilter; | ||
experienceRequirements: UniqueFilter; | ||
startDates: UniqueFilter; | ||
startTimes: UniqueFilter; | ||
costs: UniqueFilter; | ||
durationLength: UniqueFilter; | ||
endDates: UniqueFilter; | ||
endTimes: UniqueFilter; | ||
tournament: Array<number>; | ||
materialsRequired: Array<number>; | ||
costs: UniqueFilter; | ||
eventTypes: UniqueFilter; | ||
experienceRequirements: UniqueFilter; | ||
gameSystems: UniqueFilter; | ||
groups: UniqueFilter; | ||
locations: UniqueFilter; | ||
materialsRequired: Array<number>; | ||
noTickets: Array<number>; | ||
startDates: UniqueFilter; | ||
startTimes: UniqueFilter; | ||
tournament: Array<number>; | ||
} | ||
|
||
export interface SlideFilter { | ||
label: string; | ||
filterValues: number[]; | ||
setFilter: Dispatch<SetStateAction<number[]>>; | ||
step: number; | ||
min: number; | ||
max: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1121cd0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
gen-con-cal – ./
gen-con-cal-git-main-sun-mountain.vercel.app
gen-con-cal-sun-mountain.vercel.app
gen-con-cal.vercel.app