mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-17 06:26:58 +01:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { memo } from 'react';
|
|
import { useSidebarHidden } from '../hooks/useSidebarHidden';
|
|
import { trackEvent } from '../lib/analytics';
|
|
import { IconButton } from './core/IconButton';
|
|
import { HStack } from './core/Stacks';
|
|
import { CreateDropdown } from './CreateDropdown';
|
|
|
|
export const SidebarActions = memo(function SidebarActions() {
|
|
const { hidden, show, hide } = useSidebarHidden();
|
|
|
|
return (
|
|
<HStack className="h-full" alignItems="center">
|
|
<IconButton
|
|
onClick={async () => {
|
|
trackEvent('Sidebar', 'Toggle');
|
|
|
|
// NOTE: We're not using `toggle` because it may be out of sync
|
|
// from changes in other windows
|
|
if (hidden) await show();
|
|
else await hide();
|
|
}}
|
|
className="pointer-events-auto"
|
|
size="sm"
|
|
title="Show sidebar"
|
|
hotkeyAction="sidebar.toggle"
|
|
icon={hidden ? 'leftPanelHidden' : 'leftPanelVisible'}
|
|
/>
|
|
<CreateDropdown>
|
|
<IconButton size="sm" icon="plusCircle" title="Add Resource" />
|
|
</CreateDropdown>
|
|
</HStack>
|
|
);
|
|
});
|