NotificationView.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import React, { Component, Fragment } from 'react';
  2. import { formatMessage } from 'umi/locale';
  3. import { Switch, List } from 'antd';
  4. class NotificationView extends Component {
  5. getData = () => {
  6. const Action = (
  7. <Switch
  8. checkedChildren={formatMessage({ id: 'app.settings.open' }, {})}
  9. unCheckedChildren={formatMessage({ id: 'app.settings.close' }, {})}
  10. defaultChecked
  11. />
  12. );
  13. return [
  14. {
  15. title: formatMessage({ id: 'app.settings.notification.password' }, {}),
  16. description: formatMessage({ id: 'app.settings.notification.password-description' }, {}),
  17. actions: [Action],
  18. },
  19. {
  20. title: formatMessage({ id: 'app.settings.notification.messages' }, {}),
  21. description: formatMessage({ id: 'app.settings.notification.messages-description' }, {}),
  22. actions: [Action],
  23. },
  24. {
  25. title: formatMessage({ id: 'app.settings.notification.todo' }, {}),
  26. description: formatMessage({ id: 'app.settings.notification.todo-description' }, {}),
  27. actions: [Action],
  28. },
  29. ];
  30. };
  31. render() {
  32. return (
  33. <Fragment>
  34. <List
  35. itemLayout="horizontal"
  36. dataSource={this.getData()}
  37. renderItem={item => (
  38. <List.Item actions={item.actions}>
  39. <List.Item.Meta title={item.title} description={item.description} />
  40. </List.Item>
  41. )}
  42. />
  43. </Fragment>
  44. );
  45. }
  46. }
  47. export default NotificationView;