-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
387 additions
and
69 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
|
||
import styles from './index.module.css'; | ||
import BaseComponent from '../baseComponent/index'; | ||
|
||
class EmptyProducts extends BaseComponent { | ||
render() { | ||
return ( | ||
<div className={ classnames(styles.container) }> | ||
<span className={ classnames(styles.emptyText) }> | ||
Товары не найдены. Проверьте параметры фильтра. | ||
</span> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default EmptyProducts; |
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,8 @@ | ||
.container { | ||
text-align: center; | ||
padding: 24px 0; | ||
} | ||
.emptyText { | ||
font-size: 1.4em; | ||
font-weight: 700; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.list { | ||
padding: 0; | ||
list-style: "none"; | ||
columns: 3; | ||
} |
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,25 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux' | ||
|
||
import ProductList from '../../components/productList/index'; | ||
import BaseComponent from '../../components/baseComponent/index'; | ||
import EmptyProducts from '../../components/emptyProducts/index'; | ||
import { visibleProductsSelector } from '../../store/selectors'; | ||
|
||
class Products extends BaseComponent { | ||
render() { | ||
if(this.props.products.length > 0) { | ||
return (<ProductList products={ this.props.products }/>) | ||
} | ||
|
||
return (<EmptyProducts />) | ||
} | ||
}; | ||
|
||
const mapStateToProps = function(state) { | ||
return { | ||
products: visibleProductsSelector(state) | ||
} | ||
} | ||
|
||
export default connect(mapStateToProps)(Products); |
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,43 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux' | ||
import { NavLink } from 'react-router-dom'; | ||
import classnames from 'classnames'; | ||
|
||
import styles from './index.module.css'; | ||
import BaseComponent from '../../components/baseComponent/index'; | ||
import { productsPageCountSelector } from '../../store/selectors'; | ||
|
||
class ProductsPagination extends BaseComponent { | ||
|
||
get paginationItems() { | ||
return Array.from(Array(this.props.pageCount), (item, i) => i + 1) | ||
.map((item) => { | ||
return <NavLink | ||
className={ classnames(styles.item) } | ||
activeStyle={{ | ||
background: '#5695ED', | ||
color: '#fff' | ||
}} | ||
key={item} | ||
to={`/list/${item}`}> | ||
{item} | ||
</NavLink> | ||
}) | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={ classnames(styles.container)}> | ||
{ this.paginationItems } | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
const mapStateToProps = function(state) { | ||
return { | ||
pageCount: productsPageCountSelector(state) | ||
} | ||
} | ||
|
||
export default connect(mapStateToProps)(ProductsPagination); |
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,20 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
} | ||
|
||
.item { | ||
margin: 0 2px; | ||
padding: 4px 0; | ||
width: 34px; | ||
border: 1px solid #c5cfde; | ||
box-sizing: border-box; | ||
text-align: center; | ||
text-decoration: none; | ||
color: #7e8fa4; | ||
} | ||
|
||
.item.active { | ||
background: red; | ||
} |
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.