import React from 'react' import Button from '../base/button' import { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react' import cn from '@/utils/classnames' import Tooltip from '../base/tooltip' import { useTranslation } from 'react-i18next' import { getKeyboardKeyNameBySystem } from '../workflow/utils' type TooltipContentProps = { expand: boolean } const TOGGLE_SHORTCUT = ['ctrl', 'B'] const TooltipContent = ({ expand, }: TooltipContentProps) => { const { t } = useTranslation() return (
{expand ? t('layout.sidebar.collapseSidebar') : t('layout.sidebar.expandSidebar')}
{ TOGGLE_SHORTCUT.map(key => ( {getKeyboardKeyNameBySystem(key)} )) }
) } type ToggleButtonProps = { expand: boolean handleToggle: () => void className?: string } const ToggleButton = ({ expand, handleToggle, className, }: ToggleButtonProps) => { return ( } popupClassName='p-1.5 rounded-lg' position='right' > ) } export default React.memo(ToggleButton)