mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-17 02:31:18 +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 { useMantineTheme } from '@mantine/core';
|
||||||
import create from 'zustand';
|
import create from 'zustand';
|
||||||
|
import { useConfigContext } from '../../../../config/provider';
|
||||||
|
|
||||||
export const useGridstackStore = create<GridstackStoreType>((set, get) => ({
|
export const useGridstackStore = create<GridstackStoreType>((set, get) => ({
|
||||||
mainAreaWidth: null,
|
mainAreaWidth: null,
|
||||||
@@ -27,11 +28,16 @@ export const useNamedWrapperColumnCount = (): 'small' | 'medium' | 'large' | nul
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useWrapperColumnCount = () => {
|
export const useWrapperColumnCount = () => {
|
||||||
|
const { config } = useConfigContext();
|
||||||
|
const numberOfSidebars =
|
||||||
|
(config?.settings.customization.layout.enabledLeftSidebar ? 1 : 0) +
|
||||||
|
(config?.settings.customization.layout.enabledRightSidebar ? 1 : 0);
|
||||||
|
|
||||||
switch (useNamedWrapperColumnCount()) {
|
switch (useNamedWrapperColumnCount()) {
|
||||||
case 'large':
|
case 'large':
|
||||||
return 12;
|
return 15 - numberOfSidebars * 2;
|
||||||
case 'medium':
|
case 'medium':
|
||||||
return 6;
|
return 9 - numberOfSidebars * 2;
|
||||||
case 'small':
|
case 'small':
|
||||||
return 3;
|
return 3;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user