|
@@ -2,29 +2,54 @@ import React from 'react'
|
2
|
2
|
import classnames from 'classnames'
|
3
|
3
|
import PropTypes from 'prop-types'
|
4
|
4
|
|
5
|
|
-const PopinFixedHeader = props => {
|
6
|
|
- return (
|
7
|
|
- <div className={classnames('wsContentGeneric__header', `${props.customClass}__header`)}>
|
8
|
|
- <div className={classnames('wsContentGeneric__header__icon', `${props.customClass}__header__icon`)}>
|
9
|
|
- <i className={props.icon} />
|
10
|
|
- </div>
|
|
5
|
+class PopinFixedHeader extends React.Component {
|
|
6
|
+ constructor (props) {
|
|
7
|
+ super(props)
|
|
8
|
+ this.state = {
|
|
9
|
+ editTitle: false
|
|
10
|
+ }
|
|
11
|
+ }
|
11
|
12
|
|
12
|
|
- <div className={classnames('wsContentGeneric__header__title mr-auto', `${props.customClass}__header__title`)}>
|
13
|
|
- {props.name}
|
14
|
|
- </div>
|
|
13
|
+ handleClickChangeTitleBtn = () => this.setState(prevState => ({
|
|
14
|
+ editTitle: !prevState.editTitle
|
|
15
|
+ }))
|
15
|
16
|
|
16
|
|
- <div className={classnames('wsContentGeneric__header__edittitle', `${props.customClass}__header__changetitle`)}>
|
17
|
|
- <i className='fa fa-pencil' />
|
18
|
|
- </div>
|
|
17
|
+ render () {
|
|
18
|
+ const { customClass, icon, name, onChangeTitle, onClickCloseBtn } = this.props
|
|
19
|
+
|
|
20
|
+ return (
|
|
21
|
+ <div className={classnames('wsContentGeneric__header', `${customClass}__header`)}>
|
|
22
|
+ <div className={classnames('wsContentGeneric__header__icon', `${customClass}__header__icon`)}>
|
|
23
|
+ <i className={icon} />
|
|
24
|
+ </div>
|
|
25
|
+
|
|
26
|
+ <div className={classnames('wsContentGeneric__header__title mr-auto', `${customClass}__header__title`)}>
|
|
27
|
+ {this.state.editTitle === false &&
|
|
28
|
+ <div>
|
|
29
|
+ {name}
|
|
30
|
+ </div>
|
|
31
|
+ }
|
|
32
|
+ {this.state.editTitle === true &&
|
|
33
|
+ <input onChange={onChangeTitle} />
|
|
34
|
+ }
|
|
35
|
+ </div>
|
|
36
|
+
|
|
37
|
+ <div
|
|
38
|
+ className={classnames('wsContentGeneric__header__edittitle', `${customClass}__header__changetitle`)}
|
|
39
|
+ onClick={this.handleClickChangeTitleBtn}
|
|
40
|
+ >
|
|
41
|
+ <i className='fa fa-pencil' />
|
|
42
|
+ </div>
|
19
|
43
|
|
20
|
|
- <div
|
21
|
|
- className={classnames('wsContentGeneric__header__close', `${props.customClass}__header__close`)}
|
22
|
|
- onClick={props.onClickCloseBtn}
|
23
|
|
- >
|
24
|
|
- <i className='fa fa-times' />
|
|
44
|
+ <div
|
|
45
|
+ className={classnames('wsContentGeneric__header__close', `${customClass}__header__close`)}
|
|
46
|
+ onClick={onClickCloseBtn}
|
|
47
|
+ >
|
|
48
|
+ <i className='fa fa-times' />
|
|
49
|
+ </div>
|
25
|
50
|
</div>
|
26
|
|
- </div>
|
27
|
|
- )
|
|
51
|
+ )
|
|
52
|
+ }
|
28
|
53
|
}
|
29
|
54
|
|
30
|
55
|
export default PopinFixedHeader
|
|
@@ -33,10 +58,12 @@ PopinFixedHeader.propTypes = {
|
33
|
58
|
icon: PropTypes.string.isRequired,
|
34
|
59
|
onClickCloseBtn: PropTypes.func.isRequired,
|
35
|
60
|
customClass: PropTypes.string,
|
36
|
|
- name: PropTypes.string
|
|
61
|
+ name: PropTypes.string,
|
|
62
|
+ onChangeTitle: PropTypes.func
|
37
|
63
|
}
|
38
|
64
|
|
39
|
65
|
PopinFixedHeader.defaultProps = {
|
40
|
66
|
customClass: '',
|
41
|
|
- name: ''
|
|
67
|
+ name: '',
|
|
68
|
+ onChangeTitle: () => {}
|
42
|
69
|
}
|