|
@@ -2,20 +2,23 @@ import React from 'react';
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
|
import { getPhotogalary } from "../../actions/photogalaryActions";
|
|
|
+import { getAllEvents } from "../../actions/getAllEvents";
|
|
|
|
|
|
import './gallery.scss';
|
|
|
|
|
|
import Sidebar from '../../components/sidebar/Sidebar';
|
|
|
import Footer from '../../components/footer/Footer';
|
|
|
+import FiltersEvents from '../../components/filtersEvents/FiltersEvents';
|
|
|
|
|
|
class Gallery extends React.Component {
|
|
|
componentDidMount() {
|
|
|
- this.props.getPhotogalary()
|
|
|
+ this.props.getPhotogalary();
|
|
|
+ this.props.getAllEvents();
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const { gallery } = this.props;
|
|
|
- //console.log('gallery', this.props.gallery);
|
|
|
+ const { gallery, eventsArrTitles, getPhotogalary } = this.props;
|
|
|
+ //console.log('gallery', gallery);
|
|
|
return (
|
|
|
<>
|
|
|
<Sidebar/>
|
|
@@ -25,9 +28,15 @@ class Gallery extends React.Component {
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className="container-wrap">
|
|
|
+
|
|
|
+ <div className="events-filters">
|
|
|
+ <h4>Gallery filter</h4>
|
|
|
+ <FiltersEvents labelType="Event Title" getRequest={getPhotogalary} eventTypes={eventsArrTitles} />
|
|
|
+ </div>
|
|
|
+
|
|
|
<div className="gallery-wrap">
|
|
|
{
|
|
|
- gallery.map((item,ind) =>
|
|
|
+ gallery.length !== 0 ? gallery.map((item,ind) =>
|
|
|
<div className="gallery-item" key={ind}>
|
|
|
<h3>{item.eventTitle}</h3>
|
|
|
<h5>{item.eventType}</h5>
|
|
@@ -44,7 +53,7 @@ class Gallery extends React.Component {
|
|
|
}
|
|
|
</div>
|
|
|
</div>
|
|
|
- )
|
|
|
+ ) : <p className="not-found">Not found gallery</p>
|
|
|
}
|
|
|
</div>
|
|
|
</div>
|
|
@@ -56,11 +65,12 @@ class Gallery extends React.Component {
|
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
return {
|
|
|
- gallery: state.photogalaryReducer.gallery
|
|
|
+ gallery: state.photogalaryReducer.gallery,
|
|
|
+ eventsArrTitles: state.getEvents.eventsArrTitles
|
|
|
};
|
|
|
};
|
|
|
|
|
|
export default connect(
|
|
|
mapStateToProps,
|
|
|
- { getPhotogalary }
|
|
|
+ { getPhotogalary, getAllEvents }
|
|
|
)(Gallery);
|