mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 07:25:48 +01:00
🐛 Fix colors of card wrapper when category
This commit is contained in:
@@ -5,18 +5,20 @@ import { useEditModeStore } from '../Views/useEditModeStore';
|
|||||||
|
|
||||||
interface HomarrCardWrapperProps extends CardProps {
|
interface HomarrCardWrapperProps extends CardProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
isCategory?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HomarrCardWrapper = ({ ...props }: HomarrCardWrapperProps) => {
|
export const HomarrCardWrapper = ({ ...props }: HomarrCardWrapperProps) => {
|
||||||
|
const { isCategory = false, ...restProps } = props;
|
||||||
const {
|
const {
|
||||||
cx,
|
cx,
|
||||||
classes: { card: cardClass },
|
classes: { card: cardClass },
|
||||||
} = useCardStyles();
|
} = useCardStyles(isCategory);
|
||||||
const isEditMode = useEditModeStore((x) => x.enabled);
|
const isEditMode = useEditModeStore((x) => x.enabled);
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
{...props}
|
{...restProps}
|
||||||
className={cx(props.className, cardClass)}
|
className={cx(restProps.className, cardClass)}
|
||||||
withBorder
|
withBorder
|
||||||
style={{ cursor: isEditMode ? 'move' : 'default' }}
|
style={{ cursor: isEditMode ? 'move' : 'default' }}
|
||||||
radius="lg"
|
radius="lg"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Group, Title } from '@mantine/core';
|
import { createStyles, Group, Title } from '@mantine/core';
|
||||||
import { CategoryType } from '../../../../types/category';
|
import { CategoryType } from '../../../../types/category';
|
||||||
import { HomarrCardWrapper } from '../../Tiles/HomarrCardWrapper';
|
import { HomarrCardWrapper } from '../../Tiles/HomarrCardWrapper';
|
||||||
import { useEditModeStore } from '../../Views/useEditModeStore';
|
import { useEditModeStore } from '../../Views/useEditModeStore';
|
||||||
@@ -15,7 +15,7 @@ export const DashboardCategory = ({ category }: DashboardCategoryProps) => {
|
|||||||
const isEditMode = useEditModeStore((x) => x.enabled);
|
const isEditMode = useEditModeStore((x) => x.enabled);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomarrCardWrapper pt={10} mx={10}>
|
<HomarrCardWrapper pt={10} mx={10} isCategory>
|
||||||
<Group position="apart" align="center">
|
<Group position="apart" align="center">
|
||||||
<Title order={3}>{category.name}</Title>
|
<Title order={3}>{category.name}</Title>
|
||||||
{isEditMode ? <CategoryEditMenu category={category} /> : null}
|
{isEditMode ? <CategoryEditMenu category={category} /> : null}
|
||||||
|
|||||||
@@ -1,21 +1,34 @@
|
|||||||
import { createStyles } from '@mantine/core';
|
import { createStyles } from '@mantine/core';
|
||||||
import { useConfigContext } from '../../config/provider';
|
import { useConfigContext } from '../../config/provider';
|
||||||
|
|
||||||
export const useCardStyles = () => {
|
export const useCardStyles = (isCategory: boolean) => {
|
||||||
const { config } = useConfigContext();
|
const { config } = useConfigContext();
|
||||||
const appOpacity = config?.settings.customization.appOpacity;
|
const appOpacity = config?.settings.customization.appOpacity;
|
||||||
return createStyles(({ colorScheme }, _params) => {
|
return createStyles(({ colorScheme }, _params) => {
|
||||||
const opacity = (appOpacity || 100) / 100;
|
const opacity = (appOpacity || 100) / 100;
|
||||||
|
|
||||||
|
if (colorScheme === 'dark') {
|
||||||
|
if (isCategory) {
|
||||||
|
return {
|
||||||
|
card: {
|
||||||
|
backgroundColor: `rgba(32, 33, 35, ${opacity}) !important`,
|
||||||
|
borderColor: `rgba(37, 38, 43, ${opacity})`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
card: {
|
||||||
|
backgroundColor: `rgba(37, 38, 43, ${opacity}) !important`,
|
||||||
|
borderColor: `rgba(37, 38, 43, ${opacity})`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
card: {
|
card: {
|
||||||
backgroundColor:
|
backgroundColor: `rgba(255, 255, 255, ${opacity}) !important`,
|
||||||
colorScheme === 'dark'
|
borderColor: `rgba(233, 236, 239, ${opacity})`,
|
||||||
? `rgba(37, 38, 43, ${opacity}) !important`
|
|
||||||
: `rgba(255, 255, 255, ${opacity}) !important`,
|
|
||||||
borderColor:
|
|
||||||
colorScheme === 'dark'
|
|
||||||
? `rgba(37, 38, 43, ${opacity})`
|
|
||||||
: `rgba(233, 236, 239, ${opacity})`,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user