mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-08 22:45:49 +01:00
✨ Add gridstack dashboard layout
This commit is contained in:
45
src/components/Dashboard/Views/ViewToggleButton.tsx
Normal file
45
src/components/Dashboard/Views/ViewToggleButton.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { ActionIcon, Button, Text, Tooltip } from '@mantine/core';
|
||||
import { IconEdit, IconEditOff } from '@tabler/icons';
|
||||
import { useScreenLargerThan } from '../../../tools/hooks/useScreenLargerThan';
|
||||
import { useEditModeStore } from './useEditModeStore';
|
||||
|
||||
export const ViewToggleButton = () => {
|
||||
const screenLargerThanMd = useScreenLargerThan('md');
|
||||
const { enabled: isEditMode, toggleEditMode } = useEditModeStore();
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
label={
|
||||
<Text align="center">
|
||||
In edit mode, you can adjust
|
||||
<br />
|
||||
the size and position of your tiles.
|
||||
</Text>
|
||||
}
|
||||
>
|
||||
{screenLargerThanMd ? (
|
||||
<Button
|
||||
variant={isEditMode ? 'filled' : 'default'}
|
||||
h={44}
|
||||
w={180}
|
||||
leftIcon={isEditMode ? <IconEditOff /> : <IconEdit />}
|
||||
onClick={() => toggleEditMode()}
|
||||
color={isEditMode ? 'red' : undefined}
|
||||
radius="md"
|
||||
>
|
||||
<Text>{isEditMode ? 'Exit Edit Mode' : 'Enter Edit Mode'}</Text>
|
||||
</Button>
|
||||
) : (
|
||||
<ActionIcon
|
||||
onClick={() => toggleEditMode()}
|
||||
variant="default"
|
||||
radius="md"
|
||||
size="xl"
|
||||
color="blue"
|
||||
>
|
||||
{isEditMode ? <IconEditOff /> : <IconEdit />}
|
||||
</ActionIcon>
|
||||
)}
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user