[Improvement] handle close snackbar

This commit is contained in:
Qolzam
2018-02-04 12:19:45 +07:00
parent 36f77ba99d
commit c775a19039
5 changed files with 12 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
{ {
"projects": { "projects": {
"default": "love-social" "default": "test-4515a"
} }
} }

View File

@@ -57,7 +57,7 @@ export class FindPeopleComponent extends Component<IFindPeopleComponentProps, IF
loadMore={this.scrollLoad} loadMore={this.scrollLoad}
hasMore={hasMorePeople} hasMore={hasMorePeople}
useWindow={true} useWindow={true}
loader={<LoadMoreProgressComponent />} loader={<LoadMoreProgressComponent key='find-people-load-more-progress' />}
> >
<div className='tracks'> <div className='tracks'>

View File

@@ -114,4 +114,9 @@ export interface IMasterComponentProps {
*/ */
sendFeedbackStatus?: boolean sendFeedbackStatus?: boolean
/**
* Hide global message
*/
hideMessage?: () => any
} }

View File

@@ -125,7 +125,7 @@ export class MasterComponent extends Component<IMasterComponentProps, IMasterCom
*/ */
public render () { public render () {
const { progress, global, loaded, guest, uid, sendFeedbackStatus } = this.props const { progress, global, loaded, guest, uid, sendFeedbackStatus, hideMessage } = this.props
const { loading, isVerifide } = this.state const { loading, isVerifide } = this.state
return ( return (
@@ -142,6 +142,7 @@ export class MasterComponent extends Component<IMasterComponentProps, IMasterCom
<Snackbar <Snackbar
open={this.props.global.messageOpen} open={this.props.global.messageOpen}
message={this.props.global.message} message={this.props.global.message}
onClose={hideMessage}
autoHideDuration={4000} autoHideDuration={4000}
style={{ left: '1%', transform: 'none' }} style={{ left: '1%', transform: 'none' }}
/> />
@@ -185,7 +186,8 @@ const mapDispatchToProps = (dispatch: any, ownProps: IMasterComponentProps) => {
dispatch(globalActions.loadDataGuest()) dispatch(globalActions.loadDataGuest())
}, },
showMasterLoading: () => dispatch(globalActions.showMasterLoading()), showMasterLoading: () => dispatch(globalActions.showMasterLoading()),
hideMasterLoading: () => dispatch(globalActions.hideMasterLoading()) hideMasterLoading: () => dispatch(globalActions.hideMasterLoading()),
hideMessage: () => dispatch(globalActions.hideMessage())
} }
} }

View File

@@ -14,7 +14,7 @@ export default class LoadMoreProgressComponent extends Component<{},{}> {
*/ */
render () { render () {
return ( return (
<div className='g-load-more'><CircularProgress size={30} thickness={5} style={{color: teal['A400'] }} /></div> <div key='load-more-progress' className='g-load-more'><CircularProgress size={30} thickness={5} style={{color: teal['A400'] }} /></div>
) )
} }
} }