NotificationView.js 1.47 KB
Newer Older
1
import React, { Component, Fragment } from 'react';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
2
import { formatMessage } from 'umi/locale';
3 4
import { Switch, List } from 'antd';

5
class NotificationView extends Component {
6
  getData = () => {
7 8
    const Action = (
      <Switch
afc163's avatar
afc163 committed
9 10
        checkedChildren={formatMessage({ id: 'app.settings.open' })}
        unCheckedChildren={formatMessage({ id: 'app.settings.close' })}
11 12 13
        defaultChecked
      />
    );
14 15
    return [
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
16 17
        title: formatMessage({ id: 'app.settings.notification.password' }, {}),
        description: formatMessage({ id: 'app.settings.notification.password-description' }, {}),
18 19 20
        actions: [Action],
      },
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
21 22
        title: formatMessage({ id: 'app.settings.notification.messages' }, {}),
        description: formatMessage({ id: 'app.settings.notification.messages-description' }, {}),
23 24 25
        actions: [Action],
      },
      {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
26 27
        title: formatMessage({ id: 'app.settings.notification.todo' }, {}),
        description: formatMessage({ id: 'app.settings.notification.todo-description' }, {}),
28 29 30 31
        actions: [Action],
      },
    ];
  };
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
32

33 34 35 36 37 38 39 40
  render() {
    return (
      <Fragment>
        <List
          itemLayout="horizontal"
          dataSource={this.getData()}
          renderItem={item => (
            <List.Item actions={item.actions}>
jim's avatar
jim committed
41
              <List.Item.Meta title={item.title} description={item.description} />
42 43 44 45 46 47 48
            </List.Item>
          )}
        />
      </Fragment>
    );
  }
}
lijiehua's avatar
lijiehua committed
49

้™ˆๅธ…'s avatar
้™ˆๅธ… committed
50
export default NotificationView;