index.tsx 791 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react'
  2. import { Menu } from 'antd'
  3. import './index.less'
  4. type LeftMenuProps = {
  5. title?: string
  6. options: { label: string; value: string }[]
  7. onChange: (key: string) => void
  8. value: string
  9. }
  10. const LeftMenu: React.FC<LeftMenuProps> = ({ title = '栏目/功能', options, onChange, value }) => {
  11. return (
  12. <div className="w-216px rounded-20px" style={{ height: 'calc(100vh - 122px)', background: '#ffffff' }}>
  13. <div className="p-5 text-16px text-opacity-85 menu-title">{title}</div>
  14. <Menu
  15. defaultSelectedKeys={[value]}
  16. onSelect={({ key }) => onChange(key)}
  17. mode="inline"
  18. items={options.map(item => ({
  19. label: item.label,
  20. key: item.value
  21. }))}
  22. />
  23. </div>
  24. )
  25. }
  26. export default LeftMenu