-
Notifications
You must be signed in to change notification settings - Fork 14
HT4 #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
HT4 #69
Changes from all commits
d06921d
e480c9e
4c519d1
2dfe954
2a7eec8
ef3ea51
1ac413f
8172a37
056c1a9
73b985c
9e27519
af45308
3532141
fbcc1c6
b40de1a
77612b6
cb0363d
db4986f
a101962
cfdabc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,28 @@ | ||
| import React, { Component } from 'react' | ||
| import DateRange from './DateRange' | ||
| import SelectFilter from './Select' | ||
| import {connect} from 'react-redux' | ||
|
|
||
| class Filters extends Component { | ||
| static propTypes = { | ||
| }; | ||
|
|
||
| render() { | ||
| const { from, to } = this.props.filters | ||
|
|
||
| return ( | ||
| <div> | ||
| <SelectFilter articles = {this.props.articles}/> | ||
| <DateRange /> | ||
| <DateRange from = {from} | ||
| to = {to}/> | ||
|
|
||
| </div> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default Filters | ||
|
|
||
| export default connect( storeState => ({...storeState}) )(Filters) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не очень хорошая идея весь стор передавать
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romabelka тоже об этом подумал, но не стал менять |
||
|
|
||
| /* | ||
| export default Filters*/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export const INCREMENT = 'INCREMENT' | ||
|
|
||
| export const DELETE_ARTICLE = 'DELETE_ARTICLE' | ||
| export const DELETE_ARTICLE = 'DELETE_ARTICLE' | ||
| export const FILTER_DATERANGE = 'FILTER_DATERANGE' | ||
| export const FILTER_SELECTED = 'FILTER_SELECTED' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import {FILTER_DATERANGE, FILTER_SELECTED} from '../constants' | ||
|
|
||
| export default (state = {from: null, to: null, selected: []}, action) => { | ||
| console.log(JSON.stringify(action.payload)) | ||
|
|
||
| const {type, payload} = action | ||
|
|
||
| switch (type) { | ||
| case FILTER_DATERANGE: | ||
| return { | ||
| ...payload, | ||
| selected: state.selected | ||
| }; | ||
|
|
||
| case FILTER_SELECTED: | ||
| return { | ||
| ...state, | ||
| selected: payload.selected | ||
| } | ||
| } | ||
|
|
||
| return state | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| import {combineReducers} from 'redux' | ||
| import counterReducer from './counter' | ||
| import counter from './counter' | ||
| import articles from './articles' | ||
| import filters from './filters' | ||
|
|
||
| export default combineReducers({ | ||
| counter: counterReducer, | ||
| articles | ||
| counter, | ||
| articles, | ||
| filters | ||
|
|
||
| }) |
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.
ок, но еще лучше делать фильтрацию в коннекте