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
|
|
|
|
2023-08-01 15:23:31 +02: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;
|
2022-12-30 17:04:56 +01:00
|
|
|
isCategory?: boolean;
|
2022-12-10 22:14:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const HomarrCardWrapper = ({ ...props }: HomarrCardWrapperProps) => {
|
2022-12-30 17:04:56 +01:00
|
|
|
const { isCategory = false, ...restProps } = props;
|
2022-12-10 22:14:31 +01:00
|
|
|
const {
|
|
|
|
|
cx,
|
|
|
|
|
classes: { card: cardClass },
|
2022-12-30 17:04:56 +01:00
|
|
|
} = 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
|
2022-12-30 17:04:56 +01:00
|
|
|
{...restProps}
|
2023-02-10 23:37:08 +01:00
|
|
|
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
|
|
|
};
|