Skip to content

Commit

Permalink
slider styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sun-Mountain committed Jun 22, 2023
1 parent c13aa81 commit 41301f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
19 changes: 19 additions & 0 deletions frontend/components/DailyTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default function DailyTabs({
allBaseFilters,
showOnly,
dateList,
durationFilter,
durationLength,
hideMaterialReq,
hideSoldOut,
materialsRequired,
Expand All @@ -57,11 +59,28 @@ export default function DailyTabs({
setTab(newValue);
};

const lowestDuration = durationFilter[0];
const highestDuration = durationFilter[1];
const durationKeys = Object.keys(durationLength).sort();

const getEventsList = (date: string) => {
const dayEvents = dateList[date]

var eventsForDay = dayEvents.filter(val => !allBaseFilters.includes(val));

if (Number(durationKeys[0]) != lowestDuration || Number(durationKeys[durationKeys.length - 1]) != highestDuration) {
durationKeys.map(key => {
if (Number(key) < lowestDuration){
var events = durationLength[key]
eventsForDay = eventsForDay.filter(val => !events.includes(val));
}
if (Number(key) > highestDuration){
var events = durationLength[key]
eventsForDay = eventsForDay.filter(val => !events.includes(val));
}
})
}

if (hideMaterialReq) {
eventsForDay = eventsForDay.filter(val => !materialsRequired.includes(val));
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/SliderComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function SliderComponent({
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'>
Expand All @@ -52,6 +52,6 @@ export default function SliderComponent({
{max} Hours
</div>
</div>
</>
</div>
);
}
6 changes: 0 additions & 6 deletions frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default function Home() {
const [tournamentFilter, setTournamentFilter] = useState(tournamentFilterOptions[0]);

// Switches
const [hideLongestDur, setHideLongestDur] = useState(false);
const [hideSoldOut, setHideSoldOut] = useState(false);
const [hideMaterialsReq, setHideMaterialsReq] = useState(false);

Expand Down Expand Up @@ -121,11 +120,6 @@ export default function Home() {
min={0.5}
max={10}
/>
<Switch
switchLabel={'Events with Duration Over 10 Hours'}
hide={hideLongestDur}
setHide={setHideLongestDur}
/>
</div>
<DailyTabs
allBaseFilters={[
Expand Down
5 changes: 3 additions & 2 deletions frontend/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ a:hover {
margin-top: 19px;
}

.filter-component-container+.filter-component-container {
margin-top: 25px;
.filter-component-container {
margin-top: 10px;
padding-top: 10px;
}

.filter-list {
Expand Down

0 comments on commit 41301f3

Please sign in to comment.