mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-14 00:31:12 +10:00
35 lines
762 B
TypeScript
35 lines
762 B
TypeScript
import {
|
|
IconLayoutSidebarRightCollapse,
|
|
IconLayoutSidebarRightExpand,
|
|
} from "@tabler/icons-react";
|
|
import {
|
|
ActionIcon,
|
|
BoxProps,
|
|
ElementProps,
|
|
MantineColor,
|
|
MantineSize,
|
|
} from "@mantine/core";
|
|
import React from "react";
|
|
|
|
export interface SidebarToggleProps extends BoxProps, ElementProps<"button"> {
|
|
size?: MantineSize | `compact-${MantineSize}` | (string & {});
|
|
color?: MantineColor;
|
|
opened?: boolean;
|
|
}
|
|
|
|
export default function SidebarToggle({
|
|
opened,
|
|
size = "sm",
|
|
...others
|
|
}: SidebarToggleProps) {
|
|
return (
|
|
<ActionIcon size={size} {...others} variant="subtle" color="gray">
|
|
{opened ? (
|
|
<IconLayoutSidebarRightExpand />
|
|
) : (
|
|
<IconLayoutSidebarRightCollapse />
|
|
)}
|
|
</ActionIcon>
|
|
);
|
|
}
|