From f3d3471e697d6ebede4fa584c8671fb686028381 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 17 Apr 2021 16:42:30 +0300 Subject: refactor: move move filters to ServiceFilters --- src/containers/Page.tsx | 62 ++++++++++++------------------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) (limited to 'src/containers') diff --git a/src/containers/Page.tsx b/src/containers/Page.tsx index 69f3513..887e839 100644 --- a/src/containers/Page.tsx +++ b/src/containers/Page.tsx @@ -1,62 +1,30 @@ import React from 'react'; -import { useLocation } from 'react-router-dom'; import Paper from '../components/Paper'; import Button from '../components/Button'; -import { Action, Filter } from '../lib/ServiceContext'; -import { SelectBase } from '../components/Select'; +import { Action } from '../lib/ServiceContext'; interface Props { title?: string; actions?: Action[]; - filters?: Filter[]; - applyFilter?: (key: string, value: string) => void; - resetFilters?: () => void; + filters?: JSX.Element; className?: string; } const style = 'mb-2 flex justify-between md:flex-row md:items-center'; -const Page: React.FC = ({ title, actions, filters, applyFilter, resetFilters, className, children }) => { - const location = useLocation(); - - const handleFilterChange = (key: string) => (event: React.ChangeEvent) => { - if (applyFilter) applyFilter(key, event.target.value); - }; - - return ( - -
1 ? 'flex-col items-start' : 'flex-row items-center'}`}> - {title} -
-
- {filters && location.search && ( - - Сбросить фильтры - - )} - {filters?.map(filter => ( - - ))} -
-
- {actions?.map(action => ())} -
-
-
-
- {children} +const Page: React.FC = ({ title, actions, filters, className, children }) => ( + +
1 ? 'flex-col items-start' : 'flex-row items-center'}`}> + {title} +
+ {filters} + {actions?.map(action => ())}
- - ); -}; +
+
+ {children} +
+
+); export default Page; -- cgit v1.2.3