import React from 'react';
import { Col, Dropdown, Row } from '@btri-ui/base';

export default () => {
  const getSubMenus = (parentKey: string) => [
    { key: parentKey + '-1', label: '子操作一' },
    { key: parentKey + '-2', label: '子操作二' },
    { key: parentKey + '-3', label: '子操作三' },
    { key: parentKey + '-4', label: '子操作四' },
  ];

  const menus = [
    {
      key: 'key-1',
      label: '操作一',
      children: [
        { label: '有三层', key: 'key-1-1', children: getSubMenus('key-1-1') },
      ],
    },
    { key: 'key-2', label: '操作二', children: getSubMenus('key-2') },
    { key: 'key-3', label: '操作三', children: getSubMenus('key-3') },
    { key: 'key-4', label: '操作四', children: getSubMenus('key-4') },
    { key: 'key-5', label: '操作五', children: getSubMenus('key-5') },
  ];

  return (
    <>
      <Row>
        <Col>
          <Dropdown type="text" text="下拉菜单" menuItems={menus} />
        </Col>
      </Row>
    </>
  );
};
