a11y.jsx 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  1. import React, { useEffect, useState } from 'react';
  2. import {
  3. Avatar,
  4. Badge,
  5. Breadcrumb,
  6. Button,
  7. Layout,
  8. Nav,
  9. Pagination,
  10. Popover,
  11. Rating,
  12. Row,
  13. Steps,
  14. Space,
  15. Tag,
  16. Timeline,
  17. Tooltip,
  18. Col,
  19. Typography,
  20. Anchor,
  21. BackTop,
  22. Tabs,
  23. TabPane,
  24. Calendar,
  25. Card,
  26. Collapse,
  27. Descriptions,
  28. Dropdown,
  29. Empty,
  30. List,
  31. ButtonGroup,
  32. Modal,
  33. OverflowList,
  34. Slider,
  35. SideSheet,
  36. Table,
  37. Banner,
  38. Popconfirm,
  39. Notification,
  40. Progress,
  41. Toast,
  42. Spin,
  43. Form,
  44. Select,
  45. Collapsible,
  46. Skeleton,
  47. Tree,
  48. Transfer
  49. } from '@douyinfe/semi-ui';
  50. import {
  51. IconSemiLogo,
  52. IconBell,
  53. IconHelpCircle,
  54. IconBytedanceLogo,
  55. IconHome,
  56. IconHistogram,
  57. IconLive,
  58. IconSetting,
  59. IconEdit,
  60. IconCamera,
  61. IconAlarm,
  62. IconBookmark,
  63. IconDuration,
  64. IconFolder,
  65. IconDelete,
  66. IconUpload,
  67. IconSun,
  68. IconMoon,
  69. IconSearch
  70. } from '@douyinfe/semi-icons';
  71. import {
  72. IllustrationConstruction,
  73. IllustrationConstructionDark,
  74. IllustrationNoResult,
  75. IllustrationNoResultDark,
  76. IllustrationSuccess,
  77. IllustrationSuccessDark,
  78. IllustrationFailure,
  79. IllustrationFailureDark,
  80. IllustrationNoAccess,
  81. IllustrationNoAccessDark,
  82. IllustrationNoContent,
  83. IllustrationNoContentDark,
  84. IllustrationNotFound,
  85. IllustrationNotFoundDark,
  86. IllustrationIdle,
  87. IllustrationIdleDark
  88. } from '@douyinfe/semi-illustrations';
  89. import './a11y.scss';
  90. SemiA11y.storyName = 'Semi A11y';
  91. const raw = [
  92. {
  93. key: '1',
  94. name: 'Semi Design 设计稿标题可能有点长这时候应该显示 Tooltip.fig',
  95. nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/figma-icon.png',
  96. size: '2M',
  97. owner: '姜鹏志',
  98. updateTime: '2020-02-02 05:13',
  99. avatarBg: 'grey',
  100. },
  101. {
  102. key: '2',
  103. name: 'Semi Design 分享演示文稿',
  104. nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
  105. size: '2M',
  106. owner: '郝宣',
  107. updateTime: '2020-01-17 05:31',
  108. avatarBg: 'red',
  109. },
  110. {
  111. key: '3',
  112. name: '设计文档',
  113. nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
  114. size: '34KB',
  115. owner: 'Zoey Edwards',
  116. updateTime: '2020-01-26 11:01',
  117. avatarBg: 'light-blue',
  118. },
  119. {
  120. key: '4',
  121. name: 'Semi Pro 设计文档可能也有点长所以也会显示Tooltip',
  122. nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
  123. size: '34KB',
  124. owner: '姜琪',
  125. updateTime: '2020-01-26 11:01',
  126. avatarBg: 'green',
  127. },
  128. ];
  129. const treeData = [
  130. {
  131. label: '亚洲',
  132. value: 'Asia',
  133. key: '0',
  134. children: [
  135. {
  136. label: '中国',
  137. value: 'China',
  138. key: '0-0',
  139. children: [
  140. {
  141. label: '北京',
  142. value: 'Beijing',
  143. key: '0-0-0',
  144. },
  145. {
  146. label: '上海',
  147. value: 'Shanghai',
  148. key: '0-0-1',
  149. },
  150. ],
  151. },
  152. ],
  153. },
  154. {
  155. label: '北美洲',
  156. value: 'North America',
  157. key: '1',
  158. }
  159. ];
  160. const listData = [
  161. {
  162. title: '审核管理平台',
  163. rating: 4.5,
  164. feedbacks: 124,
  165. },
  166. {
  167. title: '扁鹊',
  168. rating: 4,
  169. feedbacks: 108,
  170. },
  171. {
  172. title: '直播审核平台',
  173. rating: 3.5,
  174. feedbacks: 244,
  175. },
  176. {
  177. title: '抖音安全测试',
  178. feedbacks: 189,
  179. },
  180. {
  181. title: '内容平台',
  182. rating: 3,
  183. feedbacks: 128,
  184. },
  185. {
  186. title: '策略平台',
  187. rating: 4,
  188. feedbacks: 156,
  189. },
  190. ];
  191. const style = { width: '90%' };
  192. const initValues = {
  193. name: 'semi',
  194. business: ['ulikeCam'],
  195. role: 'ued',
  196. switch: true,
  197. files: [
  198. {
  199. uid: '1',
  200. name: 'vigo.png',
  201. status: 'success',
  202. size: '130KB',
  203. preview: true,
  204. url:
  205. 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/vigo.png',
  206. },
  207. {
  208. uid: '2',
  209. name: 'jiafang1.jpeg',
  210. status: 'validateFail',
  211. size: '222KB',
  212. percent: 50,
  213. preview: true,
  214. fileInstance: new File([new ArrayBuffer(2048)], 'jiafang1.jpeg', { type: 'image/jpeg' }),
  215. url:
  216. 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
  217. },
  218. {
  219. uid: '3',
  220. name: 'jiafang2.jpeg',
  221. status: 'uploading',
  222. size: '222KB',
  223. percent: 50,
  224. preview: true,
  225. fileInstance: new File([new ArrayBuffer(2048)], 'jiafang2.jpeg', { type: 'image/jpeg' }),
  226. url:
  227. 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg',
  228. },
  229. ],
  230. };
  231. const listItemStyle = {
  232. border: '1px solid var(--semi-color-border)',
  233. backgroundColor: 'var(--semi-color-bg-2)',
  234. borderRadius: '3px',
  235. paddingLeft: '20px',
  236. margin: '8px 2px',
  237. };
  238. const descriptionData = [
  239. { key: '实际用户数量', value: '1,480,000' },
  240. { key: '7天留存', value: '98%' },
  241. { key: '安全等级', value: '3级' },
  242. { key: '垂类标签', value: <Tag style={{ margin: 0 }}>电商</Tag> },
  243. { key: '认证状态', value: '未认证' },
  244. ];
  245. const descriptionStyle = {
  246. boxShadow: 'var(--semi-shadow-elevated)',
  247. backgroundColor: 'var(--semi-color-bg-2)',
  248. borderRadius: '4px',
  249. padding: '10px',
  250. margin: '10px',
  251. width: '200px',
  252. };
  253. const emptyStyle = {
  254. padding: 30,
  255. };
  256. const transferData = Array.from({ length: 100 }, (v, i) => {
  257. return {
  258. label: `选项名称 ${i}`,
  259. value: i,
  260. disabled: false,
  261. key: i,
  262. };
  263. });
  264. const items = [
  265. { icon: <IconAlarm style={{ marginRight: 4 }} />, key: 'alarm' },
  266. { icon: <IconBookmark style={{ marginRight: 4 }} />, key: 'bookmark' },
  267. { icon: <IconCamera style={{ marginRight: 4 }} />, key: 'camera' },
  268. { icon: <IconDuration style={{ marginRight: 4 }} />, key: 'duration' },
  269. { icon: <IconEdit style={{ marginRight: 4 }} />, key: 'edit' },
  270. { icon: <IconFolder style={{ marginRight: 4 }} />, key: 'folder' },
  271. ];
  272. const empty = (
  273. <Empty
  274. image={<IllustrationNoResult />}
  275. darkModeImage={<IllustrationNoResultDark />}
  276. description={'搜索无结果'}
  277. />
  278. );
  279. const placeholder = (
  280. <div style={style}>
  281. <Skeleton.Avatar style={{ marginRight: 12 }} />
  282. <div>
  283. <Skeleton.Title style={{ width: 120, marginBottom: 12, marginTop: 12 }} />
  284. <Skeleton.Paragraph style={{ width: 240 }} rows={3} />
  285. </div>
  286. </div>
  287. );
  288. export default function SemiA11y() {
  289. const { Header, Footer, Sider, Content } = Layout;
  290. const { Title, Text, Paragraph } = Typography;
  291. const [modalVisible, setModalVisible] = useState(false);
  292. const [sideSheetVisible, setSideSheetVisible] = useState(false);
  293. const [overflowWidth, setOverflowWidth] = useState(100);
  294. const [isOpen, setCollapsibleOpen] = useState(false);
  295. const [dataSource, setData] = useState(raw);
  296. const [mode, setMode] = useState('light');
  297. const [stringData, setStringData] = useState([]);
  298. const removeRecord = key => {
  299. let newDataSource = [...dataSource];
  300. if (key != null) {
  301. let idx = newDataSource.findIndex(data => data.key === key);
  302. if (idx > -1) {
  303. newDataSource.splice(idx, 1);
  304. setData(newDataSource);
  305. }
  306. }
  307. };
  308. const columns = [
  309. {
  310. title: '标题',
  311. dataIndex: 'name',
  312. width: 400,
  313. render: (text, record, index) => {
  314. return (
  315. <span style={{ display: 'flex', alignItems: 'center' }}>
  316. <Avatar
  317. size="small"
  318. shape="square"
  319. src={record.nameIconSrc}
  320. style={{ marginRight: 12 }}
  321. ></Avatar>
  322. {/* 宽度计算方式为单元格设置宽度 - 非文本内容宽度 */}
  323. <Text heading={5} ellipsis={{ showTooltip: true }} style={{ width: 'calc(400px - 76px)' }}>
  324. {text}
  325. </Text>
  326. </span>
  327. );
  328. },
  329. },
  330. {
  331. title: '大小',
  332. dataIndex: 'size',
  333. width: 150,
  334. },
  335. {
  336. title: '所有者',
  337. dataIndex: 'owner',
  338. render: (text, record, index) => {
  339. return (
  340. <div>
  341. <Avatar size="small" color={record.avatarBg} style={{ marginRight: 4 }}>
  342. {typeof text === 'string' && text.slice(0, 1)}
  343. </Avatar>
  344. {text}
  345. </div>
  346. );
  347. },
  348. },
  349. {
  350. title: '更新日期',
  351. dataIndex: 'updateTime',
  352. },
  353. {
  354. title: '',
  355. width: 100,
  356. dataIndex: 'operate',
  357. render: (text, record) => (
  358. <Button icon={<IconDelete />} theme="borderless" onClick={() => removeRecord(record.key)} />
  359. ),
  360. },
  361. ];
  362. const onConfirm = () => {
  363. Toast.success('确认保存!');
  364. };
  365. const onCancel = () => {
  366. Toast.warning('取消保存!');
  367. };
  368. const switchMode = () => {
  369. const body = document.body;
  370. if (body.hasAttribute('theme-mode')) {
  371. body.removeAttribute('theme-mode');
  372. setMode('light');
  373. } else {
  374. body.setAttribute('theme-mode', 'dark');
  375. setMode('dark');
  376. }
  377. };
  378. const handleStringSearch = (value) => {
  379. let result;
  380. if (value) {
  381. result = ['gmail.com', '163.com', 'qq.com'].map(domain => `${value}@${domain}`);
  382. } else {
  383. result = [];
  384. }
  385. setStringData(result);
  386. };
  387. const renderOverflow = items => {
  388. return items.length ? <Tag style={{ flex: '0 0 auto' }}>+{items.length}</Tag> : null;
  389. };
  390. const renderOverflowItem = (item, ind) => {
  391. return (
  392. <Tag color="blue" key={item.key} style={{ marginRight: 8, flex: '0 0 auto' }}>
  393. {item.icon}
  394. {item.key}
  395. </Tag>
  396. );
  397. };
  398. useEffect(() => {
  399. document.body && document.body.setAttribute('data-page', 'a11y');
  400. return () => {
  401. document.body && document.body.removeAttribute('data-page');
  402. };
  403. }, []);
  404. return (
  405. <>
  406. <Layout style={{ border: '1px solid var(--semi-color-border)' }}>
  407. <Header style={{ backgroundColor: 'var(--semi-color-bg-1)' }}>
  408. <div>
  409. <Nav mode="horizontal" defaultSelectedKeys={['Home']}>
  410. <Nav.Header>
  411. <IconSemiLogo style={{ width: '96px', height: '36px', fontSize: 36 }} />
  412. <span
  413. style={{
  414. color: 'var(--semi-color-text-2)',
  415. }}
  416. >
  417. <span
  418. style={{
  419. marginRight: '24px',
  420. color: 'var(--semi-color-text-0)',
  421. fontWeight: '600',
  422. }}
  423. >
  424. 模版推荐
  425. </span>
  426. <span style={{ marginRight: '24px' }}>所有模版</span>
  427. <span>我的模版</span>
  428. </span>
  429. </Nav.Header>
  430. <Nav.Footer>
  431. <Button
  432. theme="borderless"
  433. icon={mode === 'dark' ? <IconSun size="large" /> : <IconMoon size="large" />}
  434. style={{
  435. color: 'var(--semi-color-text-2)',
  436. marginRight: '12px',
  437. }}
  438. onClick={switchMode}
  439. />
  440. <Button
  441. theme="borderless"
  442. icon={<IconBell size="large" />}
  443. style={{
  444. color: 'var(--semi-color-text-2)',
  445. marginRight: '12px',
  446. }}
  447. />
  448. <Button
  449. theme="borderless"
  450. icon={<IconHelpCircle size="large" />}
  451. style={{
  452. color: 'var(--semi-color-text-2)',
  453. marginRight: '12px',
  454. }}
  455. />
  456. <Avatar color="orange" size="small">
  457. YJ
  458. </Avatar>
  459. </Nav.Footer>
  460. </Nav>
  461. </div>
  462. </Header>
  463. <Layout>
  464. <Sider style={{ backgroundColor: 'var(--semi-color-bg-1)' }}>
  465. <Nav
  466. style={{ maxWidth: 220, height: '100%' }}
  467. defaultSelectedKeys={['Home']}
  468. items={[
  469. { itemKey: 'Home', text: '首页', icon: <IconHome size="large" /> },
  470. { itemKey: 'Histogram', text: '基础数据', icon: <IconHistogram size="large" /> },
  471. { itemKey: 'Live', text: '测试功能', icon: <IconLive size="large" /> },
  472. { itemKey: 'Setting', text: '设置', icon: <IconSetting size="large" /> },
  473. ]}
  474. footer={{
  475. collapseButton: true,
  476. }}
  477. />
  478. </Sider>
  479. <Content
  480. style={{
  481. padding: '24px',
  482. backgroundColor: 'var(--semi-color-bg-1)',
  483. maxHeight: 'calc(100vh - 120px)',
  484. }}
  485. >
  486. <Breadcrumb
  487. style={{
  488. marginBottom: '24px',
  489. }}
  490. routes={['首页', '当这个页面标题很长时需要省略', '上一页', '详情页']}
  491. />
  492. <div
  493. style={{
  494. borderRadius: '10px',
  495. border: '1px solid var(--semi-color-border)',
  496. padding: '32px',
  497. }}
  498. className="rows-container"
  499. >
  500. <Row id="基本示例">
  501. <Pagination total={80} showSizeChanger></Pagination>
  502. <Steps current={1}>
  503. <Steps.Step title="Finished" description="This is a description." />
  504. <Steps.Step title="In Progress" description="This is a description." />
  505. <Steps.Step title="Waiting" description="This is a description." />
  506. </Steps>
  507. <Steps current={1} status="error">
  508. <Steps.Step title="Finished" description="This is a description" />
  509. <Steps.Step title="In Process" description="This is a description" />
  510. <Steps.Step title="Waiting" description="This is a description" />
  511. </Steps>
  512. </Row>
  513. <Row>
  514. <div style={{ display: 'flex' }}>
  515. <div style={{ padding: 8 }}>
  516. <Badge count={5} theme="solid">
  517. <Avatar color="blue" shape="square">
  518. XZ
  519. </Avatar>
  520. </Badge>
  521. </div>
  522. <div style={{ padding: 8 }}>
  523. <Badge count={5} theme="light">
  524. <Avatar color="cyan" shape="square">
  525. YB
  526. </Avatar>
  527. </Badge>
  528. </div>
  529. <div style={{ padding: 8 }}>
  530. <Badge count={5} theme="inverted">
  531. <Avatar color="indigo" shape="square">
  532. LX
  533. </Avatar>
  534. </Badge>
  535. </div>
  536. <div style={{ padding: 8 }}>
  537. <Badge dot theme="solid">
  538. <Avatar color="light-blue" shape="square">
  539. YZ
  540. </Avatar>
  541. </Badge>
  542. </div>
  543. <div style={{ padding: 8 }}>
  544. <Badge dot theme="light">
  545. <Avatar color="teal" shape="square">
  546. HW
  547. </Avatar>
  548. </Badge>
  549. </div>
  550. <div
  551. style={{
  552. padding: '8px',
  553. borderRadius: '4px',
  554. backgroundColor: 'var(--semi-color-fill-0)',
  555. }}
  556. >
  557. <Badge dot theme="inverted">
  558. <Avatar color="green" shape="square">
  559. XM
  560. </Avatar>
  561. </Badge>
  562. </div>
  563. </div>
  564. <div>
  565. <Space wrap>
  566. <Tag color="grey">grey tag</Tag>
  567. <Tag color="blue">blue tag</Tag>
  568. <Tag color="blue" type="ghost">
  569. ghost tag
  570. </Tag>
  571. <Tag color="blue" type="solid">
  572. solid tag
  573. </Tag>
  574. <Tag color="red">red tag</Tag>
  575. <Tag color="green">green tag</Tag>
  576. <Tag color="orange">orange tag</Tag>
  577. <Tag color="teal">teal tag</Tag>
  578. <Tag color="violet">violet tag</Tag>
  579. <Tag color="white">white tag</Tag>
  580. </Space>
  581. </div>
  582. <div>
  583. <Space>
  584. <Popover content={'hi semi-design'} style={{ padding: 8 }}>
  585. <Tag style={{ marginRight: 8 }}>I am Popover</Tag>
  586. </Popover>
  587. <Tooltip content={'hi semi-design'}>
  588. <Tag style={{ marginRight: 8 }}>I am Tooltip</Tag>
  589. </Tooltip>
  590. <Dropdown
  591. render={
  592. <Dropdown.Menu>
  593. <Dropdown.Item>Menu Item 1</Dropdown.Item>
  594. <Dropdown.Item>Menu Item 2</Dropdown.Item>
  595. <Dropdown.Item>Menu Item 3</Dropdown.Item>
  596. </Dropdown.Menu>
  597. }
  598. >
  599. <Tag>I am dropdown</Tag>
  600. </Dropdown>
  601. <Rating defaultValue={3} size="small" style={{ marginRight: 8 }} />
  602. </Space>
  603. </div>
  604. <div className="mt12">
  605. <Space>
  606. <Button onClick={() => setModalVisible(true)}>Modal</Button>
  607. <Button type="tertiary" onClick={() => setSideSheetVisible(true)}>
  608. SideSheet
  609. </Button>
  610. <Button
  611. type="warning"
  612. onClick={() =>
  613. Notification.open({
  614. title: 'Hi, Bytedance',
  615. content: 'ies dance dance dance',
  616. duration: 3,
  617. })
  618. }
  619. >
  620. Notification
  621. </Button>
  622. <Popconfirm
  623. title="确定是否要保存此修改?"
  624. content="此修改将不可逆"
  625. onConfirm={onConfirm}
  626. onCancel={onCancel}
  627. >
  628. <Button type="danger">Popconfirm</Button>
  629. </Popconfirm>
  630. <Modal
  631. title="基本对话框"
  632. visible={modalVisible}
  633. onOk={() => setModalVisible(false)}
  634. onCancel={() => setModalVisible(false)}
  635. >
  636. This is the content of a basic modal.
  637. More content...
  638. </Modal>
  639. <SideSheet
  640. title="滑动侧边栏"
  641. visible={sideSheetVisible}
  642. onCancel={() => setSideSheetVisible(false)}
  643. >
  644. <p>This is the content of a basic side sheet.</p>
  645. <p>Here is more content...</p>
  646. </SideSheet>
  647. </Space>
  648. </div>
  649. </Row>
  650. <Row>
  651. <Col span={12} style={{ paddingRight: 24 }}>
  652. <div style={{ maxWidth: 640 }}>
  653. <Banner
  654. className="mb12"
  655. fullMode={false}
  656. type="info"
  657. bordered
  658. icon={null}
  659. closeIcon={null}
  660. title={
  661. <div style={{ fontWeight: 600, fontSize: '14px', lineHeight: '20px' }}>
  662. 不知道 AppKey?
  663. </div>
  664. }
  665. description={
  666. <div>
  667. 你可先联系对应的研发同学,确认是否已在
  668. <Text link={{ href: 'https://semi.design/' }}>应用云平台</Text>
  669. 申请了应用,并填写对应的信息。
  670. </div>
  671. }
  672. />
  673. <Banner
  674. className="mb12"
  675. fullMode={false}
  676. type="warning"
  677. bordered
  678. icon={null}
  679. closeIcon={null}
  680. title={
  681. <div style={{ fontWeight: 600, fontSize: '14px', lineHeight: '20px' }}>
  682. 不知道 AppKey?
  683. </div>
  684. }
  685. description={
  686. <div>
  687. 你可先联系对应的研发同学,确认是否已在
  688. <Text link={{ href: 'https://semi.design/' }}>应用云平台</Text>
  689. 申请了应用,并填写对应的信息。
  690. </div>
  691. }
  692. />
  693. <Banner
  694. className="mb12"
  695. fullMode={false}
  696. type="danger"
  697. bordered
  698. icon={null}
  699. closeIcon={null}
  700. title={
  701. <div style={{ fontWeight: 600, fontSize: '14px', lineHeight: '20px' }}>
  702. 不知道 AppKey?
  703. </div>
  704. }
  705. description={
  706. <div>
  707. 你可先联系对应的研发同学,确认是否已在
  708. <Text link={{ href: 'https://semi.design/' }}>应用云平台</Text>
  709. 申请了应用,并填写对应的信息。
  710. </div>
  711. }
  712. />
  713. <Banner
  714. fullMode={false}
  715. type="success"
  716. bordered
  717. icon={null}
  718. closeIcon={null}
  719. title={
  720. <div style={{ fontWeight: 600, fontSize: '14px', lineHeight: '20px' }}>
  721. 不知道 AppKey?
  722. </div>
  723. }
  724. description={
  725. <div>
  726. 你可先联系对应的研发同学,确认是否已在
  727. <Text link={{ href: 'https://semi.design/' }}>应用云平台</Text>
  728. 申请了应用,并填写对应的信息。
  729. </div>
  730. }
  731. />
  732. </div>
  733. </Col>
  734. <Col span={12}>
  735. <Title style={{ margin: '8px 0' }}>h1. Semi Design</Title>
  736. <Title heading={2} style={{ margin: '8px 0' }}>
  737. h2. Semi Design
  738. </Title>
  739. <Title heading={3} style={{ margin: '8px 0' }}>
  740. h3. Semi Design
  741. </Title>
  742. <Title heading={4} style={{ margin: '8px 0' }}>
  743. h4. Semi Design
  744. </Title>
  745. <Title heading={5} style={{ margin: '8px 0' }}>
  746. h5. Semi Design
  747. </Title>
  748. <Title heading={6} style={{ margin: '8px 0' }}>
  749. h6. Semi Design
  750. </Title>
  751. </Col>
  752. </Row>
  753. <Row id="组件">
  754. <div style={{ display: 'flex', flexWrap: 'wrap' }}>
  755. <Empty
  756. image={<IllustrationSuccess style={{ width: 150, height: 150 }} />}
  757. darkModeImage={<IllustrationSuccessDark style={{ width: 150, height: 150 }} />}
  758. description={'创建成功'}
  759. style={emptyStyle}
  760. />
  761. <Empty
  762. image={<IllustrationFailure style={{ width: 150, height: 150 }} />}
  763. darkModeImage={<IllustrationFailureDark style={{ width: 150, height: 150 }} />}
  764. description={'加载失败'}
  765. style={emptyStyle}
  766. />
  767. <Empty
  768. image={<IllustrationNoAccess style={{ width: 150, height: 150 }} />}
  769. darkModeImage={<IllustrationNoAccessDark style={{ width: 150, height: 150 }} />}
  770. description={'没有权限'}
  771. style={emptyStyle}
  772. />
  773. <Empty
  774. image={<IllustrationNoContent style={{ width: 150, height: 150 }} />}
  775. darkModeImage={<IllustrationNoContentDark style={{ width: 150, height: 150 }} />}
  776. description={'暂无内容,请添加'}
  777. style={emptyStyle}
  778. />
  779. <Empty
  780. image={<IllustrationNotFound style={{ width: 150, height: 150 }} />}
  781. darkModeImage={<IllustrationNotFoundDark style={{ width: 150, height: 150 }} />}
  782. description={'页面404'}
  783. style={emptyStyle}
  784. />
  785. <Empty
  786. image={<IllustrationNoResult style={{ width: 150, height: 150 }} />}
  787. darkModeImage={<IllustrationNoResultDark style={{ width: 150, height: 150 }} />}
  788. description={'搜索无结果'}
  789. style={emptyStyle}
  790. />
  791. <Empty
  792. image={<IllustrationConstruction style={{ width: 150, height: 150 }} />}
  793. darkModeImage={<IllustrationConstructionDark style={{ width: 150, height: 150 }} />}
  794. description={'建设中'}
  795. style={emptyStyle}
  796. />
  797. <Empty
  798. image={<IllustrationIdle style={{ width: 150, height: 150 }} />}
  799. darkModeImage={<IllustrationIdleDark style={{ width: 150, height: 150 }} />}
  800. description={'神游四方'}
  801. style={emptyStyle}
  802. />
  803. </div>
  804. </Row>
  805. <Row>
  806. <Timeline>
  807. <Timeline.Item time="2019-07-14 10:35" type="ongoing">
  808. 审核中
  809. </Timeline.Item>
  810. <Timeline.Item time="2019-06-13 16:17" type="success">
  811. 发布成功
  812. </Timeline.Item>
  813. <Timeline.Item time="2019-05-14 18:34" type="error">
  814. 审核失败
  815. </Timeline.Item>
  816. </Timeline>
  817. <div style={{ width: 200 }}>
  818. <Progress className="mb12" percent={10} stroke="#fc8800" aria-label='download progress'/>
  819. <Progress className="mb12" percent={25} stroke="#f93920" aria-label='download progress'/>
  820. <Progress className="mb12" percent={50} aria-label='download progress'/>
  821. <Progress className="mb12" percent={80} aria-label='download progress'/>
  822. <Progress className="mb12" percent={80} size="large" aria-label='download progress'/>
  823. <Progress className="mb12" percent={80} style={{ height: '8px' }} aria-label='download progress'/>
  824. </div>
  825. <div className="mb12">
  826. <Skeleton placeholder={placeholder} loading={true} active>
  827. <div style={{
  828. display: 'flex',
  829. alignItems: 'flex-start',
  830. }}>
  831. <Avatar color="blue" style={{ marginRight: 12 }}>
  832. UI
  833. </Avatar>
  834. <div>
  835. <h3>Semi UI</h3>
  836. <p>Hi, Bytedance dance dance.</p>
  837. <p>Hi, Bytedance dance dance.</p>
  838. <p>Hi, Bytedance dance dance.</p>
  839. </div>
  840. </div>
  841. </Skeleton>
  842. </div>
  843. <div>
  844. <Spin size="small" />
  845. <Spin size="middle" />
  846. <Spin size="large" />
  847. </div>
  848. </Row>
  849. <Row>
  850. <div style={{ width: 300 }}>
  851. <Slider
  852. step={1}
  853. value={overflowWidth}
  854. onChange={value => setOverflowWidth(value)}
  855. />
  856. <div style={{ width: `${overflowWidth}%` }}>
  857. <OverflowList
  858. items={items}
  859. overflowRenderer={renderOverflow}
  860. visibleItemRenderer={renderOverflowItem}
  861. />
  862. </div>
  863. </div>
  864. </Row>
  865. <Row id="设计语言">
  866. <Table
  867. style={{ minHeight: 350 }}
  868. columns={columns}
  869. dataSource={dataSource}
  870. pagination={false}
  871. empty={empty}
  872. />
  873. </Row>
  874. <Row id="物料平台">
  875. <Form
  876. initValues={initValues}
  877. style={{ padding: 10, width: '100%' }}
  878. onValueChange={v => console.log(v)}
  879. >
  880. <Form.Section text={'基本信息'}>
  881. <Row>
  882. <Col span={12}>
  883. <Form.Input
  884. field="name"
  885. label="名称(Input)"
  886. initValue={'mikeya'}
  887. style={style}
  888. trigger="blur"
  889. />
  890. </Col>
  891. <Col span={12}>
  892. <Form.DatePicker
  893. field="date"
  894. label="日期(DatePicker)"
  895. style={style}
  896. initValue={new Date()}
  897. placeholder="请选择生效日期"
  898. />
  899. </Col>
  900. </Row>
  901. <Row>
  902. <Col span={12}>
  903. <Form.Select
  904. field="role"
  905. style={style}
  906. label="角色(Select)"
  907. placeholder="请选择你的角色"
  908. >
  909. <Select.Option value="operate">运营</Select.Option>
  910. <Select.Option value="rd">开发</Select.Option>
  911. <Select.Option value="pm">产品</Select.Option>
  912. <Select.Option value="ued">设计</Select.Option>
  913. </Form.Select>
  914. </Col>
  915. <Col span={12}>
  916. <Form.Select
  917. field="business"
  918. multiple
  919. style={style}
  920. placeholder="请选择业务线"
  921. label="业务线(多选Select)"
  922. extraText={
  923. <div
  924. style={{
  925. color: 'rgba(var(--semi-blue-5), 1)',
  926. fontSize: 14,
  927. userSelect: 'none',
  928. cursor: 'pointer',
  929. }}
  930. >
  931. 没有找到合适的业务线?
  932. </div>
  933. }
  934. >
  935. <Select.Option value="abc">Semi</Select.Option>
  936. <Select.Option value="ulikeCam">轻颜相机</Select.Option>
  937. <Select.Option value="toutiao">今日头条</Select.Option>
  938. </Form.Select>
  939. </Col>
  940. </Row>
  941. <Row>
  942. <Col span={12}>
  943. <Form.Cascader
  944. placeholder="请选择所在地区"
  945. treeData={treeData}
  946. field="area"
  947. label="地区(Cascader)"
  948. style={style}
  949. ></Form.Cascader>
  950. </Col>
  951. <Col span={12}>
  952. <Form.TreeSelect
  953. field="tree"
  954. style={style}
  955. label="节点(TreeSelect)"
  956. placeholder="请选择服务节点"
  957. treeData={treeData}
  958. filterTreeNode
  959. ></Form.TreeSelect>
  960. </Col>
  961. </Row>
  962. <Row>
  963. <Col span={12}>
  964. <Form.TagInput
  965. field="product"
  966. label="产品(TagInput)"
  967. placeholder="请输入产品"
  968. style={style}
  969. />
  970. </Col>
  971. <Col span={12}>
  972. <Form.AutoComplete
  973. field="email"
  974. label="邮箱(AutoComplete)"
  975. data={stringData}
  976. showClear
  977. prefix={<IconSearch />}
  978. placeholder="搜索... "
  979. onSearch={handleStringSearch}
  980. style={style}
  981. />
  982. </Col>
  983. </Row>
  984. <Row>
  985. <Col span={24}>
  986. <Form.Upload
  987. field="files"
  988. label="证明文件(Upload)"
  989. action="//semi.design/api/upload"
  990. >
  991. <Button icon={<IconUpload />} theme="light">
  992. 点击上传
  993. </Button>
  994. </Form.Upload>
  995. </Col>
  996. </Row>
  997. </Form.Section>
  998. <Form.Section text="资源详情">
  999. <Row>
  1000. <Col span={12}>
  1001. <Form.TextArea
  1002. style={{ ...style, height: 120 }}
  1003. field="description"
  1004. label="申请理由(TextArea)"
  1005. placeholder="请填写申请资源理由"
  1006. />
  1007. </Col>
  1008. <Col span={12}>
  1009. <Form.CheckboxGroup
  1010. field="type"
  1011. direction="horizontal"
  1012. label="申请类型(CheckboxGroup)"
  1013. initValue={['user', 'admin']}
  1014. rules={[{ required: true }]}
  1015. >
  1016. <Form.Checkbox value="admin">admin</Form.Checkbox>
  1017. <Form.Checkbox value="user">user</Form.Checkbox>
  1018. <Form.Checkbox value="guest">guest</Form.Checkbox>
  1019. <Form.Checkbox value="root">root</Form.Checkbox>
  1020. </Form.CheckboxGroup>
  1021. <Form.RadioGroup
  1022. field="isMonopolize"
  1023. label="是否独占资源(Radio)"
  1024. rules={[
  1025. { type: 'boolean' },
  1026. { required: true, message: '必须选择是否独占 ' },
  1027. ]}
  1028. >
  1029. <Form.Radio value={true}>是</Form.Radio>
  1030. <Form.Radio value={false}>否</Form.Radio>
  1031. </Form.RadioGroup>
  1032. </Col>
  1033. </Row>
  1034. <Row>
  1035. <Col span={12}>
  1036. <Form.TimePicker
  1037. field="time"
  1038. label="截止时刻(TimePicker)"
  1039. style={{ width: '90%' }}
  1040. />
  1041. </Col>
  1042. <Col span={12}>
  1043. <Form.InputNumber
  1044. field="number"
  1045. label="申请数量(InputNumber)"
  1046. initValue={20}
  1047. style={style}
  1048. />
  1049. </Col>
  1050. </Row>
  1051. <Row>
  1052. <Col span={12}>
  1053. <Form.Slider
  1054. field="range"
  1055. label="资源使用报警阈值(%)(Slider)"
  1056. initValue={10}
  1057. style={{ width: '90%' }}
  1058. />
  1059. </Col>
  1060. <Col span={12}>
  1061. <Form.Switch field="switch" label="开关(Switch)" />
  1062. </Col>
  1063. </Row>
  1064. <Row>
  1065. <Col span={12}>
  1066. <Form.Rating
  1067. field="rating"
  1068. label="满意度(Rating)"
  1069. initValue={2}
  1070. style={{ width: '90%' }}
  1071. />
  1072. </Col>
  1073. </Row>
  1074. </Form.Section>
  1075. <Form.Checkbox value="false" field="agree" noLabel={true}>
  1076. 我已阅读并清楚相关规定(Checkbox)
  1077. </Form.Checkbox>
  1078. <Button type="primary" htmlType="submit" className="btn-margin-right">
  1079. 提交(submit)
  1080. </Button>
  1081. <Button htmlType="reset">重置(reset)</Button>
  1082. </Form>
  1083. </Row>
  1084. <Row>
  1085. <Col span="12">
  1086. <Tree
  1087. treeData={treeData}
  1088. defaultExpandAll
  1089. style={{
  1090. width: 260,
  1091. height: 420,
  1092. border: '1px solid var(--semi-color-border)'
  1093. }}
  1094. />
  1095. </Col>
  1096. <Col span="12">
  1097. <Transfer
  1098. style={{ width: 568, height: 416 }}
  1099. dataSource={transferData}
  1100. onChange={(values, items) => console.log(values, items)}
  1101. />
  1102. </Col>
  1103. </Row>
  1104. <Row id="主题商店">
  1105. <List
  1106. grid={{
  1107. gutter: 12,
  1108. xs: 0,
  1109. sm: 0,
  1110. md: 12,
  1111. lg: 8,
  1112. xl: 8,
  1113. xxl: 6,
  1114. }}
  1115. dataSource={listData}
  1116. renderItem={item => (
  1117. <List.Item style={listItemStyle}>
  1118. <div>
  1119. <h3 style={{ color: 'var(--semi-color-text-0)', fontWeight: 500 }}>
  1120. {item.title}
  1121. </h3>
  1122. <Descriptions
  1123. align="center"
  1124. size="small"
  1125. row
  1126. data={[
  1127. {
  1128. key: '满意度',
  1129. value: (
  1130. <Rating allowHalf size="small" value={item.rating} />
  1131. ),
  1132. },
  1133. { key: '反馈数', value: item.feedbacks },
  1134. ]}
  1135. />
  1136. <div
  1137. style={{
  1138. margin: '12px 0',
  1139. display: 'flex',
  1140. justifyContent: 'flex-end',
  1141. }}
  1142. >
  1143. <ButtonGroup theme="borderless" style={{ marginTop: 8 }}>
  1144. <Button>编辑</Button>
  1145. <Button>更多</Button>
  1146. </ButtonGroup>
  1147. </div>
  1148. </div>
  1149. </List.Item>
  1150. )}
  1151. />
  1152. <div style={{ display: 'flex', flexWrap: 'wrap' }}>
  1153. <Descriptions align="center" data={descriptionData} style={descriptionStyle} />
  1154. <Descriptions align="justify" data={descriptionData} style={descriptionStyle} />
  1155. <Descriptions align="left" data={descriptionData} style={descriptionStyle} />
  1156. <Descriptions align="plain" data={descriptionData} style={descriptionStyle} />
  1157. </div>
  1158. <div
  1159. style={{
  1160. backgroundColor: 'var(--semi-color-fill-0)',
  1161. padding: 20,
  1162. }}
  1163. >
  1164. <Row gutter={[16, 16]}>
  1165. <Col span={8}>
  1166. <Card title="Card Title" bordered={false}>
  1167. Card Content
  1168. </Card>
  1169. </Col>
  1170. <Col span={8}>
  1171. <Card title="Card Title" bordered={false}>
  1172. Card Content
  1173. </Card>
  1174. </Col>
  1175. <Col span={8}>
  1176. <Card title="Card Title" bordered={false}>
  1177. Card Content
  1178. </Card>
  1179. </Col>
  1180. </Row>
  1181. <Row gutter={[16, 16]}>
  1182. <Col span={16}>
  1183. <Card title="Card Title" bordered={false}>
  1184. Card Content
  1185. </Card>
  1186. </Col>
  1187. <Col span={8}>
  1188. <Card title="Card Title" bordered={false}>
  1189. Card Content
  1190. </Card>
  1191. </Col>
  1192. </Row>
  1193. </div>
  1194. </Row>
  1195. <Row>
  1196. <Calendar mode="month" />
  1197. </Row>
  1198. <Row>
  1199. <Collapse className="mt12">
  1200. <Collapse.Panel header="This is panel header 1" itemKey="1">
  1201. <p>Hi, bytedance dance dance. This is the docsite of Semi UI. </p>
  1202. </Collapse.Panel>
  1203. <Collapse.Panel header="This is panel header 2" itemKey="2">
  1204. <p>Hi, bytedance dance dance. This is the docsite of Semi UI. </p>
  1205. </Collapse.Panel>
  1206. <Collapse.Panel header="This is panel header 3" itemKey="3">
  1207. <p>Hi, bytedance dance dance. This is the docsite of Semi UI. </p>
  1208. </Collapse.Panel>
  1209. </Collapse>
  1210. <Tabs type="button" className="mt12">
  1211. <TabPane tab="文档" itemKey="1">
  1212. 文档
  1213. </TabPane>
  1214. <TabPane tab="快速起步" itemKey="2">
  1215. 快速起步
  1216. </TabPane>
  1217. <TabPane tab="帮助" itemKey="3">
  1218. 帮助
  1219. </TabPane>
  1220. </Tabs>
  1221. <div className="mt12" style={{ height: 200 }}>
  1222. <Button onClick={() => setCollapsibleOpen(!isOpen)}>Toggle</Button>
  1223. <Collapsible isOpen={isOpen}>
  1224. <ul>
  1225. <li>
  1226. <p>Semi Design 以内容优先进行设计。</p>
  1227. </li>
  1228. <li>
  1229. <p>更容易地自定义主题。</p>
  1230. </li>
  1231. <li>
  1232. <p>适用国际化场景。</p>
  1233. </li>
  1234. <li>
  1235. <p>效率场景加入人性化关怀。</p>
  1236. </li>
  1237. </ul>
  1238. </Collapsible>
  1239. </div>
  1240. <Anchor style={{ position: 'fixed', top: 150, right: 50 }}>
  1241. <Anchor.Link href="#基本示例" title="基本示例" />
  1242. <Anchor.Link href="#组件" title="组件" />
  1243. <Anchor.Link href="#设计语言" title="设计语言" />
  1244. <Anchor.Link href="#物料平台" title="物料平台" />
  1245. <Anchor.Link href="#主题商店" title="主题商店" />
  1246. </Anchor>
  1247. <BackTop style={{ bottom: 100, right: 50 }} target={() => document && document.querySelector('.semi-layout-content' || window)} visibilityHeight={-1} />
  1248. </Row>
  1249. </div>
  1250. </Content>
  1251. </Layout>
  1252. <Footer
  1253. style={{
  1254. display: 'flex',
  1255. justifyContent: 'space-between',
  1256. padding: '20px',
  1257. color: 'var(--semi-color-text-2)',
  1258. backgroundColor: 'rgba(var(--semi-grey-0), 1)',
  1259. }}
  1260. >
  1261. <span
  1262. style={{
  1263. display: 'flex',
  1264. alignItems: 'center',
  1265. }}
  1266. >
  1267. <IconBytedanceLogo size="large" style={{ marginRight: '8px' }} />
  1268. <span>{`Copyright © ${(new Date()).getFullYear()} Semi Design. All Rights Reserved. `}</span>
  1269. </span>
  1270. <span>
  1271. <span style={{ marginRight: '24px' }}>平台客服</span>
  1272. <span>反馈建议</span>
  1273. </span>
  1274. </Footer>
  1275. </Layout>
  1276. </>
  1277. );
  1278. }