Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Teemunkierros filter to index #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions client/src/views/Events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Outlet } from 'react-router-dom';
import { useDialogState } from 'reakit/Dialog';
import { Calendar, SettingsHorizontal } from 'akar-icons';

import { Disclosure, EventList, Modal } from 'components';
import { Disclosure, EventList, Filter, Modal } from 'components';
import { useEventContext, useGlobalContext } from 'contexts';

import { Dates } from './Dates';
Expand All @@ -34,7 +34,7 @@ const ResetButton: VFC<ResetButtonProps> = ({ onClick, visible }) => {

export const Events: VFC = () => {
const { translation } = useGlobalContext();
const { count, events, reset } = useEventContext();
const { count, events, reset, filter } = useEventContext();

const dateDialog = useDialogState({ animated: true });
const dateRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -64,20 +64,23 @@ export const Events: VFC = () => {
return (
<>
<div className="m-auto flex max-w-7xl justify-between">
<Disclosure icon={Calendar} {...dateDialog}>
{translation?.date}
{count.date > 0 && <> ({count.date})</>}
</Disclosure>
<Modal
ref={dateRef}
alignLeft={true}
title={translation?.date}
{...dateDialog}
>
<Dates />

<ResetButton onClick={onDateReset} visible={count.date > 0} />
</Modal>
<div className="flex max-w-7xl space-x-2">
<Disclosure icon={Calendar} {...dateDialog}>
{translation?.date}
{count.date > 0 && <> ({count.date})</>}
</Disclosure>
<Modal
ref={dateRef}
alignLeft={true}
title={translation?.date}
{...dateDialog}
>
<Dates />

<ResetButton onClick={onDateReset} visible={count.date > 0} />
</Modal>
<Filter {...filter.teemunkierros}>{translation?.teemunkierros}</Filter>
</div>

<Disclosure icon={SettingsHorizontal} {...filterDialog}>
{translation?.filterButton}
Expand Down