aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-header/send-header.component.js
blob: 5f6617fce0f40d224c6ca8783bcce47a64be9d23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import PageContainerHeader from '../../page-container/page-container-header'
import { DEFAULT_ROUTE } from '../../../routes'

export default class SendHeader extends Component {

  static propTypes = {
    clearSend: PropTypes.func,
    history: PropTypes.object,
    titleKey: PropTypes.string,
    subtitleParams: PropTypes.array,
  };

  onClose () {
    this.props.clearSend()
    this.props.history.push(DEFAULT_ROUTE)
  }

  render () {
    return (
      <PageContainerHeader
        onClose={() => this.onClose()}
        subtitle={this.context.t(...this.props.subtitleParams)}
        title={this.context.t(this.props.titleKey)}
      />
    )
  }

}

SendHeader.contextTypes = {
  t: PropTypes.func,
}