2020-04-01 06:13:27 +03:00
|
|
|
import React from 'react';
|
|
|
|
import styled from '@emotion/styled';
|
2021-05-31 16:46:41 +02:00
|
|
|
|
2022-09-28 20:04:00 -06:00
|
|
|
import { lengths } from '../../ui';
|
2020-04-01 06:13:27 +03:00
|
|
|
import ViewStyleControl from './ViewStyleControl';
|
|
|
|
import SortControl from './SortControl';
|
2020-05-24 17:37:08 +00:00
|
|
|
import FilterControl from './FilterControl';
|
2020-11-08 17:33:09 +01:00
|
|
|
import GroupControl from './GroupControl';
|
2020-04-01 06:13:27 +03:00
|
|
|
|
|
|
|
const CollectionControlsContainer = styled.div`
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
margin-top: 22px;
|
|
|
|
width: ${lengths.topCardWidth};
|
2020-04-01 11:23:59 -04:00
|
|
|
max-width: 100%;
|
2020-04-01 06:13:27 +03:00
|
|
|
|
|
|
|
& > div {
|
|
|
|
margin-left: 6px;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-02-08 20:01:21 +02:00
|
|
|
function CollectionControls({
|
2020-04-01 06:13:27 +03:00
|
|
|
viewStyle,
|
|
|
|
onChangeViewStyle,
|
|
|
|
sortableFields,
|
|
|
|
onSortClick,
|
|
|
|
sort,
|
2020-05-24 17:37:08 +00:00
|
|
|
viewFilters,
|
2020-11-08 17:33:09 +01:00
|
|
|
viewGroups,
|
2020-05-24 17:37:08 +00:00
|
|
|
onFilterClick,
|
2020-11-08 17:33:09 +01:00
|
|
|
onGroupClick,
|
2020-05-24 17:37:08 +00:00
|
|
|
t,
|
|
|
|
filter,
|
2020-11-08 17:33:09 +01:00
|
|
|
group,
|
2021-02-08 20:01:21 +02:00
|
|
|
}) {
|
2020-05-24 17:37:08 +00:00
|
|
|
return (
|
|
|
|
<CollectionControlsContainer>
|
|
|
|
<ViewStyleControl viewStyle={viewStyle} onChangeViewStyle={onChangeViewStyle} />
|
2020-11-08 17:33:09 +01:00
|
|
|
{viewGroups.length > 0 && (
|
|
|
|
<GroupControl viewGroups={viewGroups} onGroupClick={onGroupClick} t={t} group={group} />
|
|
|
|
)}
|
2020-05-24 17:37:08 +00:00
|
|
|
{viewFilters.length > 0 && (
|
|
|
|
<FilterControl
|
|
|
|
viewFilters={viewFilters}
|
|
|
|
onFilterClick={onFilterClick}
|
|
|
|
t={t}
|
|
|
|
filter={filter}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{sortableFields.length > 0 && (
|
|
|
|
<SortControl fields={sortableFields} sort={sort} onSortClick={onSortClick} />
|
|
|
|
)}
|
|
|
|
</CollectionControlsContainer>
|
|
|
|
);
|
2021-02-08 20:01:21 +02:00
|
|
|
}
|
2020-04-01 06:13:27 +03:00
|
|
|
|
|
|
|
export default CollectionControls;
|