MobileMenuButton.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. import React from 'react';
  16. import { Button } from '@douyinfe/semi-ui';
  17. import { IconClose, IconMenu } from '@douyinfe/semi-icons';
  18. const MobileMenuButton = ({
  19. isConsoleRoute,
  20. isMobile,
  21. drawerOpen,
  22. collapsed,
  23. onToggle,
  24. t,
  25. }) => {
  26. if (!isConsoleRoute || !isMobile) {
  27. return null;
  28. }
  29. return (
  30. <Button
  31. icon={
  32. (isMobile ? drawerOpen : collapsed) ? (
  33. <IconClose className='text-lg' />
  34. ) : (
  35. <IconMenu className='text-lg' />
  36. )
  37. }
  38. aria-label={
  39. (isMobile ? drawerOpen : collapsed) ? t('关闭侧边栏') : t('打开侧边栏')
  40. }
  41. onClick={onToggle}
  42. theme='borderless'
  43. type='tertiary'
  44. className='!p-2 !text-current focus:!bg-semi-color-fill-1 dark:focus:!bg-gray-700'
  45. />
  46. );
  47. };
  48. export default MobileMenuButton;