NotificationView.js 1.61 KB
Newer Older
陈帅's avatar
陈帅 committed
1
import React, { Component, Fragment } from 'react';
张秀玲's avatar
张秀玲 committed
2
import { injectIntl } from 'react-intl';
陈帅's avatar
陈帅 committed
3 4
import { Switch, List } from 'antd';

张秀玲's avatar
张秀玲 committed
5
class NotificationView extends Component {
陈帅's avatar
陈帅 committed
6
  getData = () => {
张秀玲's avatar
张秀玲 committed
7 8 9 10 11 12 13 14
    const { intl } = this.props;
    const Action = (
      <Switch
        checkedChildren={intl.formatMessage({ id: 'app.settings.open' }, {})}
        unCheckedChildren={intl.formatMessage({ id: 'app.settings.close' }, {})}
        defaultChecked
      />
    );
陈帅's avatar
陈帅 committed
15 16
    return [
      {
张秀玲's avatar
张秀玲 committed
17 18 19 20 21
        title: intl.formatMessage({ id: 'app.settings.notification.password' }, {}),
        description: intl.formatMessage(
          { id: 'app.settings.notification.password-description' },
          {}
        ),
陈帅's avatar
陈帅 committed
22 23 24
        actions: [Action],
      },
      {
张秀玲's avatar
张秀玲 committed
25 26 27 28 29
        title: intl.formatMessage({ id: 'app.settings.notification.messages' }, {}),
        description: intl.formatMessage(
          { id: 'app.settings.notification.messages-description' },
          {}
        ),
陈帅's avatar
陈帅 committed
30 31 32
        actions: [Action],
      },
      {
张秀玲's avatar
张秀玲 committed
33 34
        title: intl.formatMessage({ id: 'app.settings.notification.todo' }, {}),
        description: intl.formatMessage({ id: 'app.settings.notification.todo-description' }, {}),
陈帅's avatar
陈帅 committed
35 36 37 38
        actions: [Action],
      },
    ];
  };
陈帅's avatar
陈帅 committed
39

陈帅's avatar
陈帅 committed
40 41 42 43 44 45 46 47
  render() {
    return (
      <Fragment>
        <List
          itemLayout="horizontal"
          dataSource={this.getData()}
          renderItem={item => (
            <List.Item actions={item.actions}>
jim's avatar
jim committed
48
              <List.Item.Meta title={item.title} description={item.description} />
陈帅's avatar
陈帅 committed
49 50 51 52 53 54 55
            </List.Item>
          )}
        />
      </Fragment>
    );
  }
}
张秀玲's avatar
张秀玲 committed
56
export default injectIntl(NotificationView);