Files
Homarr/src/components/Dashboard/Tiles/HomarrCardWrapper.tsx

30 lines
841 B
TypeScript
Raw Normal View History

2022-12-10 22:14:31 +01:00
import { Card, CardProps } from '@mantine/core';
import { ReactNode } from 'react';
2023-07-21 18:08:40 +09:00
import { useCardStyles } from '../../layout/Common/useCardStyles';
2022-12-20 11:34:07 +09:00
import { useEditModeStore } from '../Views/useEditModeStore';
2022-12-10 22:14:31 +01:00
interface HomarrCardWrapperProps extends CardProps {
children: ReactNode;
isCategory?: boolean;
2022-12-10 22:14:31 +01:00
}
export const HomarrCardWrapper = ({ ...props }: HomarrCardWrapperProps) => {
const { isCategory = false, ...restProps } = props;
2022-12-10 22:14:31 +01:00
const {
cx,
classes: { card: cardClass },
} = useCardStyles(isCategory);
2022-12-20 11:34:07 +09:00
const isEditMode = useEditModeStore((x) => x.enabled);
2022-12-17 00:28:46 +09:00
return (
<Card
{...restProps}
className={cx(restProps.className, cardClass, 'dashboard-gs-generic-item')}
2022-12-17 00:28:46 +09:00
withBorder
2022-12-20 11:34:07 +09:00
style={{ cursor: isEditMode ? 'move' : 'default' }}
2022-12-17 00:28:46 +09:00
radius="lg"
2023-01-03 22:31:37 +09:00
shadow="sm"
2022-12-17 00:28:46 +09:00
/>
);
2022-12-10 22:14:31 +01:00
};