-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Layered Navigation (Filters) (#797)
- Loading branch information
1 parent
d0f3f5e
commit f1114a1
Showing
43 changed files
with
1,368 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 36 additions & 12 deletions
48
packages/venia-concept/src/RootComponents/Category/categoryContent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,59 @@ | ||
import React from 'react'; | ||
import { shape, string } from 'prop-types'; | ||
|
||
import { mergeClasses } from 'src/classify'; | ||
import FilterModal from 'src/components/FilterModal'; | ||
import Gallery from 'src/components/Gallery'; | ||
import Pagination from 'src/components/Pagination'; | ||
import defaultClasses from './category.css'; | ||
|
||
const CategoryContent = props => { | ||
const { pageControl, data, pageSize } = props; | ||
const { data, openDrawer, pageControl, pageSize } = props; | ||
const classes = mergeClasses(defaultClasses, props.classes); | ||
const items = data ? data.category.products.items : null; | ||
const title = data ? data.category.description : null; | ||
const categoryTitle = data ? data.category.name : null; | ||
const filters = data ? data.products.filters : null; | ||
const items = data ? data.products.items : null; | ||
const title = data ? data.category.name : null; | ||
|
||
const header = filters ? ( | ||
<div className={classes.headerButtons}> | ||
<button | ||
className={classes.filterButton} | ||
onClick={openDrawer} | ||
type="button" | ||
> | ||
{'Filter'} | ||
</button> | ||
</div> | ||
) : null; | ||
|
||
const modal = filters ? <FilterModal filters={filters} /> : null; | ||
|
||
return ( | ||
<article className={classes.root}> | ||
<h1 className={classes.title}> | ||
{/* TODO: Switch to RichContent component from Peregrine when merged */} | ||
<div | ||
dangerouslySetInnerHTML={{ | ||
__html: title | ||
}} | ||
/> | ||
<div className={classes.categoryTitle}>{categoryTitle}</div> | ||
<div className={classes.categoryTitle}>{title}</div> | ||
</h1> | ||
{header} | ||
<section className={classes.gallery}> | ||
<Gallery data={items} title={title} pageSize={pageSize} /> | ||
<Gallery data={items} pageSize={pageSize} /> | ||
</section> | ||
<div className={classes.pagination}> | ||
<Pagination pageControl={pageControl} /> | ||
</div> | ||
{modal} | ||
</article> | ||
); | ||
}; | ||
|
||
export default CategoryContent; | ||
|
||
CategoryContent.propTypes = { | ||
classes: shape({ | ||
filterContainer: string, | ||
gallery: string, | ||
headerButtons: string, | ||
pagination: string, | ||
root: string, | ||
title: string | ||
}) | ||
}; |
12 changes: 12 additions & 0 deletions
12
packages/venia-concept/src/RootComponents/Category/categoryContentContainer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { connect } from 'src/drivers'; | ||
import { toggleDrawer } from 'src/actions/app'; | ||
import CategoryContent from './categoryContent'; | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
openDrawer: () => dispatch(toggleDrawer('filter')) | ||
}); | ||
|
||
export default connect( | ||
null, | ||
mapDispatchToProps | ||
)(CategoryContent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f1114a1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://venia-icslpvggg.now.sh to the following aliases.