playbook_ui 14.21.2.pre.alpha.PLAY2046advancedtableinfinitescroll8311 → 14.21.2.pre.alpha.PLAY2179playbookiconsupdate8389
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +25 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSection.tsx +49 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSidebar.tsx +69 -0
- data/app/pb_kits/playbook/pb_filter/Filter/index.tsx +13 -0
- data/app/pb_kits/playbook/pb_filter/_filter.scss +4 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_sidebar.jsx +224 -0
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
- data/dist/chunks/_typeahead-BXD634Vm.js +22 -0
- data/dist/chunks/_weekday_stacked--dPf0i--.js +45 -0
- data/dist/chunks/lib-9VvC3Rp0.js +29 -0
- data/dist/chunks/{pb_form_validation-DSkdRDMf.js → pb_form_validation-CbyL4Bqa.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +3 -3
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +11 -6
- data/dist/chunks/_typeahead-CVIBi3oA.js +0 -22
- data/dist/chunks/_weekday_stacked-BQMmOtHu.js +0 -45
- data/dist/chunks/lib-D7Va7yqa.js +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd6938603e3b7ea37cd0dfa7a480f3ee6f27a9df349325f0f755ffe5254fd5c
|
4
|
+
data.tar.gz: c7d9933a4f2fd4b525d4b570d47ff79274f2a3ddecf7b0f42273b09f9b45c31f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8a312ffe4b64d4c8022434a53a616a1d5dc764a84d9f61ffab69117a2039dbe56ce674e71a561019a71e1be09014c858e85e252db2cfe59e20d212eb68e9487
|
7
|
+
data.tar.gz: edb82b3cf90dac74c811461b13bce6c530382efaed70ca641c1214bcc1d25cd5781debe9d8f79748f936fbc402f1eff7823fa36c125d013b4be49dd223576632
|
@@ -19,6 +19,7 @@ interface CustomCellProps {
|
|
19
19
|
value?: string
|
20
20
|
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
21
21
|
selectableRows?: boolean
|
22
|
+
customStyle?: GenericObject
|
22
23
|
}
|
23
24
|
|
24
25
|
export const CustomCell = ({
|
@@ -28,6 +29,7 @@ export const CustomCell = ({
|
|
28
29
|
value,
|
29
30
|
customRenderer,
|
30
31
|
selectableRows,
|
32
|
+
customStyle = {},
|
31
33
|
}: CustomCellProps & GlobalProps) => {
|
32
34
|
const { setExpanded, expanded, expandedControl, inlineRowLoading, hasAnySubRows } = useContext(AdvancedTableContext);
|
33
35
|
|
@@ -43,7 +45,7 @@ export const CustomCell = ({
|
|
43
45
|
const renderButton = inlineRowLoading ? RowHasChildren : row.getCanExpand()
|
44
46
|
|
45
47
|
return (
|
46
|
-
<div style={{ paddingLeft: `${row.depth * 1.25}em`
|
48
|
+
<div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
|
47
49
|
<Flex
|
48
50
|
alignItems="center"
|
49
51
|
columnGap="xs"
|
@@ -65,6 +67,7 @@ export const CustomCell = ({
|
|
65
67
|
<button
|
66
68
|
className="gray-icon expand-toggle-icon"
|
67
69
|
onClick={() => handleOnExpand(row)}
|
70
|
+
style={{ color: customStyle?.expandButtonColor }}
|
68
71
|
>
|
69
72
|
{row.getIsExpanded() ? (
|
70
73
|
<Icon cursor="pointer"
|
@@ -27,6 +27,7 @@ const TableCellRenderer = ({
|
|
27
27
|
loading = false,
|
28
28
|
stickyLeftColumn,
|
29
29
|
columnPinning,
|
30
|
+
customRowStyle,
|
30
31
|
columnDefinitions,
|
31
32
|
}: {
|
32
33
|
row: Row<GenericObject>
|
@@ -34,6 +35,7 @@ const TableCellRenderer = ({
|
|
34
35
|
loading?: boolean | string
|
35
36
|
stickyLeftColumn?: string[]
|
36
37
|
columnPinning: { left: string[] }
|
38
|
+
customRowStyle?: GenericObject
|
37
39
|
columnDefinitions?: {[key:string]:any}[]
|
38
40
|
}) => {
|
39
41
|
return (
|
@@ -74,6 +76,8 @@ const TableCellRenderer = ({
|
|
74
76
|
? '180px'
|
75
77
|
: `${column.getStart("left")}px`
|
76
78
|
: undefined,
|
79
|
+
backgroundColor: i === 0 && customRowStyle?.backgroundColor,
|
80
|
+
color: customRowStyle?.fontColor,
|
77
81
|
}}
|
78
82
|
>
|
79
83
|
{collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
|
@@ -107,6 +111,7 @@ export const RegularTableView = ({
|
|
107
111
|
pinnedRows,
|
108
112
|
headerHeight,
|
109
113
|
rowHeight,
|
114
|
+
rowStyling = [],
|
110
115
|
sampleRowRef,
|
111
116
|
} = useContext(AdvancedTableContext)
|
112
117
|
|
@@ -171,6 +176,7 @@ export const RegularTableView = ({
|
|
171
176
|
const rowBackground = isExpandable && ((!inlineRowLoading && row.getCanExpand()) || (inlineRowLoading && rowHasNoChildren));
|
172
177
|
const rowColor = row.getIsSelected() ? "bg-row-selection" : rowBackground ? "bg-silver" : "bg-white";
|
173
178
|
const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
|
179
|
+
const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
|
174
180
|
|
175
181
|
return (
|
176
182
|
<React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
|
@@ -189,6 +195,7 @@ export const RegularTableView = ({
|
|
189
195
|
className={`${rowColor} ${row.depth > 0 ? `depth-sub-row-${row.depth}` : ""}`}
|
190
196
|
id={`${row.index}-${row.id}-${row.depth}-row`}
|
191
197
|
ref={isFirstRegularRow ? sampleRowRef : null}
|
198
|
+
style={{backgroundColor: customRowStyle?.backgroundColor, color: customRowStyle?.fontColor}}
|
192
199
|
>
|
193
200
|
{/* Render custom checkbox column when we want selectableRows for non-expanding tables */}
|
194
201
|
{selectableRows && !hasAnySubRows && (
|
@@ -206,6 +213,7 @@ export const RegularTableView = ({
|
|
206
213
|
collapsibleTrail={collapsibleTrail}
|
207
214
|
columnDefinitions={columnDefinitions}
|
208
215
|
columnPinning={columnPinning}
|
216
|
+
customRowStyle={customRowStyle}
|
209
217
|
loading={loading}
|
210
218
|
row={row}
|
211
219
|
stickyLeftColumn={stickyLeftColumn}
|
@@ -32,6 +32,7 @@ interface UseTableStateProps {
|
|
32
32
|
tableOptions?: GenericObject;
|
33
33
|
onRowSelectionChange?: (arg: RowSelectionState) => void;
|
34
34
|
columnVisibilityControl?: GenericObject;
|
35
|
+
rowStyling?: GenericObject;
|
35
36
|
}
|
36
37
|
|
37
38
|
export function useTableState({
|
@@ -49,6 +50,7 @@ export function useTableState({
|
|
49
50
|
tableOptions,
|
50
51
|
columnVisibilityControl,
|
51
52
|
pinnedRows,
|
53
|
+
rowStyling
|
52
54
|
}: UseTableStateProps) {
|
53
55
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
54
56
|
const [localExpanded, setLocalExpanded] = useState({});
|
@@ -102,7 +104,8 @@ export function useTableState({
|
|
102
104
|
column.customRenderer,
|
103
105
|
isFirstColumn,
|
104
106
|
onRowToggleClick,
|
105
|
-
selectableRows
|
107
|
+
selectableRows,
|
108
|
+
rowStyling
|
106
109
|
);
|
107
110
|
}
|
108
111
|
|
@@ -165,7 +168,7 @@ export function useTableState({
|
|
165
168
|
enableSortingRemoval: false,
|
166
169
|
sortDescFirst: true,
|
167
170
|
onRowSelectionChange: setRowSelection,
|
168
|
-
getRowId: (selectableRows || pinnedRows) ? row => row.id : undefined,
|
171
|
+
getRowId: (selectableRows || pinnedRows || rowStyling) ? row => row.id : undefined,
|
169
172
|
onColumnVisibilityChange: setColumnVisibility,
|
170
173
|
meta: {
|
171
174
|
columnDefinitions
|
@@ -17,7 +17,8 @@ export const createCellFunction = (
|
|
17
17
|
customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element,
|
18
18
|
isFirstColumn?: boolean,
|
19
19
|
onRowToggleClick?: (row: Row<GenericObject>) => void,
|
20
|
-
selectableRows?: boolean
|
20
|
+
selectableRows?: boolean,
|
21
|
+
rowStyling?: GenericObject
|
21
22
|
) => {
|
22
23
|
// Add display name to the returned function
|
23
24
|
const cellRenderer = ({
|
@@ -28,6 +29,7 @@ export const createCellFunction = (
|
|
28
29
|
getValue: Getter<string>
|
29
30
|
}) => {
|
30
31
|
const rowData = row.original;
|
32
|
+
const customStyle = rowStyling?.length > 0 && rowStyling?.find((s:GenericObject) => s?.rowId === row.id);
|
31
33
|
|
32
34
|
if (isFirstColumn) {
|
33
35
|
switch (row.depth) {
|
@@ -35,6 +37,7 @@ export const createCellFunction = (
|
|
35
37
|
return (
|
36
38
|
<CustomCell
|
37
39
|
customRenderer={customRenderer}
|
40
|
+
customStyle={customStyle}
|
38
41
|
getValue={getValue}
|
39
42
|
onRowToggleClick={onRowToggleClick}
|
40
43
|
row={row}
|
@@ -57,6 +57,7 @@ type AdvancedTableProps = {
|
|
57
57
|
onChange?: (value: RowPinningState) => void;
|
58
58
|
};
|
59
59
|
responsive?: "scroll" | "none",
|
60
|
+
rowStyling?: GenericObject[],
|
60
61
|
scrollBarNone?: boolean,
|
61
62
|
selectableRows?: boolean,
|
62
63
|
showActionsBar?: boolean,
|
@@ -98,6 +99,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
98
99
|
paginationProps,
|
99
100
|
pinnedRows,
|
100
101
|
responsive = "scroll",
|
102
|
+
rowStyling,
|
101
103
|
scrollBarNone= false,
|
102
104
|
showActionsBar = true,
|
103
105
|
selectableRows,
|
@@ -144,6 +146,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
144
146
|
onRowSelectionChange,
|
145
147
|
columnVisibilityControl,
|
146
148
|
pinnedRows,
|
149
|
+
rowStyling
|
147
150
|
});
|
148
151
|
|
149
152
|
// Initialize table actions
|
@@ -336,6 +339,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
336
339
|
onExpandByDepthClick={onExpandByDepthClick}
|
337
340
|
pinnedRows={pinnedRows}
|
338
341
|
responsive={responsive}
|
342
|
+
rowStyling={rowStyling}
|
339
343
|
selectableRows={selectableRows}
|
340
344
|
setExpanded={setExpanded}
|
341
345
|
showActionsBar={showActionsBar}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, {useState} from "react"
|
2
2
|
import { render, screen, waitFor } from "../utilities/test-utils"
|
3
3
|
|
4
|
-
import { AdvancedTable, Pill } from "playbook-ui"
|
4
|
+
import { AdvancedTable, Pill, colors } from "playbook-ui"
|
5
5
|
|
6
6
|
global.ResizeObserver = class {
|
7
7
|
observe() {}
|
@@ -652,3 +652,27 @@ test("renders virtualized table rows and header", () => {
|
|
652
652
|
const virtualizedRows = kit.querySelectorAll('.virtualized-table-row')
|
653
653
|
expect(virtualizedRows.length).toBeLessThan(MOCK_DATA_WITH_ID.length)
|
654
654
|
})
|
655
|
+
|
656
|
+
test("rowStyling prop works as expected", () => {
|
657
|
+
const rowStyling = [
|
658
|
+
{
|
659
|
+
rowId: "1",
|
660
|
+
backgroundColor: colors.white,
|
661
|
+
fontColor: colors.black
|
662
|
+
},
|
663
|
+
];
|
664
|
+
|
665
|
+
render(
|
666
|
+
<AdvancedTable
|
667
|
+
columnDefinitions={columnDefinitions}
|
668
|
+
data={{ testid: testId }}
|
669
|
+
rowStyling={rowStyling}
|
670
|
+
tableData={MOCK_DATA_WITH_ID}
|
671
|
+
/>
|
672
|
+
)
|
673
|
+
|
674
|
+
const kit = screen.getByTestId(testId)
|
675
|
+
const tableBody = kit.querySelector('tbody')
|
676
|
+
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
677
|
+
expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
|
678
|
+
})
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
|
4
|
+
import { colors } from "playbook-ui"
|
5
|
+
|
6
|
+
const AdvancedTableRowStyling = (props) => {
|
7
|
+
const columnDefinitions = [
|
8
|
+
{
|
9
|
+
accessor: "year",
|
10
|
+
label: "Year",
|
11
|
+
cellAccessors: ["quarter", "month", "day"],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
accessor: "newEnrollments",
|
15
|
+
label: "New Enrollments",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
accessor: "scheduledMeetings",
|
19
|
+
label: "Scheduled Meetings",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
accessor: "attendanceRate",
|
23
|
+
label: "Attendance Rate",
|
24
|
+
},
|
25
|
+
{
|
26
|
+
accessor: "completedClasses",
|
27
|
+
label: "Completed Classes",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
accessor: "classCompletionRate",
|
31
|
+
label: "Class Completion Rate",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
accessor: "graduatedStudents",
|
35
|
+
label: "Graduated Students",
|
36
|
+
},
|
37
|
+
]
|
38
|
+
|
39
|
+
const rowStyling = [
|
40
|
+
{
|
41
|
+
rowId: "1",
|
42
|
+
backgroundColor: colors.warning,
|
43
|
+
},
|
44
|
+
{
|
45
|
+
rowId: "8",
|
46
|
+
backgroundColor: colors.category_1,
|
47
|
+
fontColor: colors.white,
|
48
|
+
expandButtonColor: colors.white,
|
49
|
+
},
|
50
|
+
];
|
51
|
+
|
52
|
+
return (
|
53
|
+
<div>
|
54
|
+
<AdvancedTable
|
55
|
+
columnDefinitions={columnDefinitions}
|
56
|
+
rowStyling={rowStyling}
|
57
|
+
tableData={MOCK_DATA}
|
58
|
+
{...props}
|
59
|
+
/>
|
60
|
+
</div>
|
61
|
+
)
|
62
|
+
}
|
63
|
+
|
64
|
+
export default AdvancedTableRowStyling
|
@@ -0,0 +1,7 @@
|
|
1
|
+
The `rowStyling` prop can be used in conjunction with row ids to control certain styling options on individual rows. Currently, `rowStyling` gives you 3 optional controls:
|
2
|
+
|
3
|
+
- `backgroundColor` : use this to control the background color of the row
|
4
|
+
- `fontColor`: use this to control font color for each row if needed, for example if using a darker background color.
|
5
|
+
- `expandButtonColor`: use this to control the color of the expand icon if needed, for example if using a darker background color.
|
6
|
+
|
7
|
+
**NOTE:** Each object within the `tableData` Array must contain a unique id in order to attach an id to all Rows for this to function.
|
@@ -59,6 +59,7 @@ examples:
|
|
59
59
|
- advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
|
60
60
|
- advanced_table_pinned_rows: Pinned Rows
|
61
61
|
- advanced_table_scrollbar_none: Advanced Table Scrollbar None
|
62
|
+
- advanced_table_row_styling: Row Styling
|
62
63
|
- advanced_table_column_styling: Column Styling
|
63
64
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
64
65
|
- advanced_table_infinite_scroll: Infinite Scroll
|
@@ -34,6 +34,7 @@ export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table
|
|
34
34
|
export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
|
35
35
|
export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_rows.jsx'
|
36
36
|
export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
|
37
|
+
export { default as AdvancedTableRowStyling } from './_advanced_table_row_styling.jsx'
|
37
38
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
38
39
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
39
40
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Collapsible from '../../pb_collapsible/_collapsible'
|
4
|
+
import Caption from '../../pb_caption/_caption'
|
5
|
+
import Body from '../../pb_body/_body'
|
6
|
+
|
7
|
+
type FilterSectionProps = {
|
8
|
+
children?: React.ReactChild[] | React.ReactChild,
|
9
|
+
collapsible?: boolean,
|
10
|
+
collapsed?: boolean,
|
11
|
+
headerText?: string,
|
12
|
+
}
|
13
|
+
const FilterSection = ({ children, collapsible = false, collapsed = true, headerText, }: FilterSectionProps): React.ReactElement => {
|
14
|
+
if (collapsible) {
|
15
|
+
return (
|
16
|
+
<Collapsible
|
17
|
+
collapsed={collapsed}
|
18
|
+
padding="none"
|
19
|
+
>
|
20
|
+
<Collapsible.Main
|
21
|
+
paddingX="sm"
|
22
|
+
paddingY="xs"
|
23
|
+
>
|
24
|
+
<Caption>{ headerText }</Caption>
|
25
|
+
</Collapsible.Main>
|
26
|
+
<Collapsible.Content
|
27
|
+
className="filter_section_collapsible"
|
28
|
+
paddingX="sm"
|
29
|
+
>
|
30
|
+
{ children }
|
31
|
+
</Collapsible.Content>
|
32
|
+
</Collapsible>
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
return (
|
37
|
+
<Body
|
38
|
+
paddingTop="xs"
|
39
|
+
paddingX="sm"
|
40
|
+
>
|
41
|
+
<>
|
42
|
+
{headerText && <Caption marginBottom="sm">{ headerText }</Caption>}
|
43
|
+
{ children }
|
44
|
+
</>
|
45
|
+
</Body>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
export default FilterSection
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import { FilterDescription } from './CurrentFilters'
|
4
|
+
import FilterBackground, { FilterBackgroundProps } from './FilterBackground'
|
5
|
+
import ResultsCount from './ResultsCount'
|
6
|
+
|
7
|
+
import Flex from '../../pb_flex/_flex'
|
8
|
+
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
9
|
+
import Card from '../../pb_card/_card'
|
10
|
+
import Caption from '../../pb_caption/_caption'
|
11
|
+
|
12
|
+
export type FilterSidebarProps = {
|
13
|
+
children?: React.ReactChild[] | React.ReactChild,
|
14
|
+
filters?: FilterDescription,
|
15
|
+
results?: number,
|
16
|
+
} & FilterBackgroundProps
|
17
|
+
|
18
|
+
const FilterSidebar = ({
|
19
|
+
onCollapse,
|
20
|
+
onSortChange,
|
21
|
+
sortOptions,
|
22
|
+
sortValue,
|
23
|
+
filters,
|
24
|
+
results,
|
25
|
+
children,
|
26
|
+
dark,
|
27
|
+
isCollapsed,
|
28
|
+
maxHeight,
|
29
|
+
minWidth,
|
30
|
+
placement,
|
31
|
+
popoverProps,
|
32
|
+
...bgProps
|
33
|
+
}: FilterSidebarProps): React.ReactElement => (
|
34
|
+
<FilterBackground
|
35
|
+
dark={dark}
|
36
|
+
{...bgProps}
|
37
|
+
>
|
38
|
+
<Card.Body
|
39
|
+
paddingX="sm"
|
40
|
+
paddingY="xs"
|
41
|
+
>
|
42
|
+
<Flex
|
43
|
+
align="center"
|
44
|
+
justify="between"
|
45
|
+
orientation="row"
|
46
|
+
>
|
47
|
+
<ResultsCount
|
48
|
+
dark={dark}
|
49
|
+
results={results}
|
50
|
+
title
|
51
|
+
/>
|
52
|
+
<div onClick={onCollapse}>
|
53
|
+
<Caption
|
54
|
+
color="link"
|
55
|
+
cursor="pointer"
|
56
|
+
size="xs"
|
57
|
+
text={isCollapsed ? "Expand All" : "Collapse All"}
|
58
|
+
/>
|
59
|
+
</div>
|
60
|
+
</Flex>
|
61
|
+
</Card.Body>
|
62
|
+
<SectionSeparator dark={dark} />
|
63
|
+
<>
|
64
|
+
{ children }
|
65
|
+
</>
|
66
|
+
</FilterBackground>
|
67
|
+
)
|
68
|
+
|
69
|
+
export default FilterSidebar
|
@@ -1,18 +1,29 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import FilterSingle, { FilterSingleProps } from './FilterSingle'
|
3
3
|
import FilterDouble, { FilterDoubleProps } from './FilterDouble'
|
4
|
+
import FilterSidebar, { FilterSidebarProps } from './FilterSidebar'
|
5
|
+
import FilterSection from './FilterSection'
|
4
6
|
|
5
7
|
type FilterProps =
|
6
8
|
| FilterSingleProps
|
7
9
|
| (FilterDoubleProps & {
|
8
10
|
double?: boolean,
|
9
11
|
})
|
12
|
+
| (FilterSidebarProps & {
|
13
|
+
variant?: null | 'sidebar',
|
14
|
+
})
|
10
15
|
|
11
16
|
const Filter = ({
|
12
17
|
double = false,
|
18
|
+
variant,
|
13
19
|
...templateProps
|
14
20
|
}: FilterProps): React.ReactElement => {
|
15
21
|
const displayFilter = () => {
|
22
|
+
if (variant === 'sidebar') {
|
23
|
+
return (
|
24
|
+
<FilterSidebar {...templateProps} />
|
25
|
+
)
|
26
|
+
}
|
16
27
|
if (double === true) {
|
17
28
|
return (
|
18
29
|
<FilterDouble {...templateProps} />
|
@@ -30,4 +41,6 @@ const Filter = ({
|
|
30
41
|
)
|
31
42
|
}
|
32
43
|
|
44
|
+
Filter.Section = FilterSection
|
45
|
+
|
33
46
|
export default Filter
|