mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 09:25:47 +01:00
Make column size dependant on number of sidebars
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useMantineTheme } from '@mantine/core';
|
||||
import create from 'zustand';
|
||||
import { useConfigContext } from '../../../../config/provider';
|
||||
|
||||
export const useGridstackStore = create<GridstackStoreType>((set, get) => ({
|
||||
mainAreaWidth: null,
|
||||
@@ -27,11 +28,16 @@ export const useNamedWrapperColumnCount = (): 'small' | 'medium' | 'large' | nul
|
||||
};
|
||||
|
||||
export const useWrapperColumnCount = () => {
|
||||
const { config } = useConfigContext();
|
||||
const numberOfSidebars =
|
||||
(config?.settings.customization.layout.enabledLeftSidebar ? 1 : 0) +
|
||||
(config?.settings.customization.layout.enabledRightSidebar ? 1 : 0);
|
||||
|
||||
switch (useNamedWrapperColumnCount()) {
|
||||
case 'large':
|
||||
return 12;
|
||||
return 15 - numberOfSidebars * 2;
|
||||
case 'medium':
|
||||
return 6;
|
||||
return 9 - numberOfSidebars * 2;
|
||||
case 'small':
|
||||
return 3;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user