mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 23:15:46 +01:00
Add growth option for the main appshelf
This commit is contained in:
@@ -10,5 +10,6 @@
|
||||
},
|
||||
"credits": {
|
||||
"madeWithLove": "Made with ❤️ by @"
|
||||
}
|
||||
},
|
||||
"grow": "Grow grid (take all space)"
|
||||
}
|
||||
@@ -95,7 +95,7 @@ const AppShelf = (props: any) => {
|
||||
onDragEnd={handleDragEnd}
|
||||
>
|
||||
<SortableContext items={config.services}>
|
||||
<Grid gutter="lg" align="center">
|
||||
<Grid gutter="lg" grow={config.settings.grow}>
|
||||
{filtered.map((service) => (
|
||||
<Grid.Col key={service.id} span="content">
|
||||
<SortableItem service={service} key={service.id} id={service.id}>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ColorSelector } from './ColorSelector';
|
||||
import { OpacitySelector } from './OpacitySelector';
|
||||
import { AppCardWidthSelector } from './AppCardWidthSelector';
|
||||
import { ShadeSelector } from './ShadeSelector';
|
||||
import { GrowthSelector } from './GrowthSelector';
|
||||
|
||||
export default function TitleChanger() {
|
||||
const { config, setConfig } = useConfig();
|
||||
@@ -74,6 +75,7 @@ export default function TitleChanger() {
|
||||
<Button type="submit">{t('buttons.submit')}</Button>
|
||||
</Stack>
|
||||
</form>
|
||||
<GrowthSelector />
|
||||
<ColorSelector type="primary" />
|
||||
<ColorSelector type="secondary" />
|
||||
<ShadeSelector />
|
||||
|
||||
30
src/components/Settings/GrowthSelector.tsx
Normal file
30
src/components/Settings/GrowthSelector.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Switch } from '@mantine/core';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useState } from 'react';
|
||||
import { useConfig } from '../../tools/state';
|
||||
|
||||
export function GrowthSelector() {
|
||||
const { config, setConfig } = useConfig();
|
||||
const defaultPosition = config?.settings?.grow || false;
|
||||
const [growState, setGrowState] = useState(defaultPosition);
|
||||
const { t } = useTranslation('settings/common.json');
|
||||
const toggleGrowState = () => {
|
||||
setGrowState(!growState);
|
||||
setConfig({
|
||||
...config,
|
||||
settings: {
|
||||
...config.settings,
|
||||
grow: !growState,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Switch
|
||||
label={t('settings/common:grow')}
|
||||
checked={growState === true}
|
||||
onChange={() => toggleGrowState()}
|
||||
size="md"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -48,15 +48,11 @@ export function WidgetsPositionSwitch() {
|
||||
};
|
||||
|
||||
return (
|
||||
<Group>
|
||||
<div className={classes.root}>
|
||||
<Switch
|
||||
label={t('label')}
|
||||
checked={widgetPosition === 'left'}
|
||||
onChange={() => toggleWidgetPosition()}
|
||||
size="md"
|
||||
/>
|
||||
</div>
|
||||
{t('label')}
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface Settings {
|
||||
customCSS?: string;
|
||||
appOpacity?: number;
|
||||
widgetPosition?: string;
|
||||
grow?: boolean;
|
||||
appCardWidth?: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user