ChannelPicker.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { ProList } from "@ant-design/pro-components";
  2. import { Button, Progress } from "antd";
  3. import { useState } from "react";
  4. const dataSource = [
  5. {
  6. name: "语雀的天空",
  7. description: "简介",
  8. type: "translation",
  9. role: "owner",
  10. source: "studio",
  11. },
  12. {
  13. name: "Ant Design",
  14. description: "简介",
  15. type: "translation",
  16. role: "reader",
  17. source: "studio",
  18. },
  19. {
  20. name: "蚂蚁金服体验科技",
  21. description: "简介",
  22. type: "nissaya",
  23. role: "reader",
  24. source: "collaborate",
  25. },
  26. {
  27. name: "TechUI",
  28. description: "简介",
  29. type: "nissaya",
  30. role: "editor",
  31. source: "public",
  32. },
  33. ];
  34. interface IWidget {
  35. multiSelect?: boolean;
  36. }
  37. const Widget = ({ multiSelect = false }: IWidget) => {
  38. const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
  39. const rowSelection = {
  40. selectedRowKeys,
  41. onChange: (keys: React.Key[]) => setSelectedRowKeys(keys),
  42. };
  43. return (
  44. <ProList<{ title: string }>
  45. toolBarRender={() => {
  46. return [
  47. <Button key="3" type="primary">
  48. 新建
  49. </Button>,
  50. ];
  51. }}
  52. metas={{
  53. title: {
  54. dataIndex: "name",
  55. title: "版本名称",
  56. },
  57. description: { dataIndex: "description" },
  58. extra: {
  59. render: () => (
  60. <div
  61. style={{
  62. minWidth: 200,
  63. flex: 1,
  64. display: "flex",
  65. justifyContent: "flex-end",
  66. }}
  67. >
  68. <div
  69. style={{
  70. width: "200px",
  71. }}
  72. >
  73. <Progress percent={80} />
  74. </div>
  75. </div>
  76. ),
  77. },
  78. actions: {
  79. render: () => {
  80. return [<a key="init">邀请</a>, "发布"];
  81. },
  82. },
  83. }}
  84. rowKey="title"
  85. headerTitle="选择版本"
  86. rowSelection={rowSelection}
  87. dataSource={dataSource}
  88. />
  89. );
  90. };
  91. export default Widget;