mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
🔀 Merge pull request #222 from Aimsucks/app-card-with-slider
✨ Slidable service span in customizations
This commit is contained in:
@@ -106,7 +106,14 @@ const AppShelf = (props: any) => {
|
||||
<SortableContext items={config.services}>
|
||||
<Grid gutter="xl" align="center">
|
||||
{filtered.map((service) => (
|
||||
<Grid.Col key={service.id} span={6} xl={2} xs={4} sm={3} md={3}>
|
||||
<Grid.Col
|
||||
key={service.id}
|
||||
span={6}
|
||||
xl={config.settings.appCardWidth || 2}
|
||||
xs={4}
|
||||
sm={3}
|
||||
md={3}
|
||||
>
|
||||
<SortableAppShelfItem service={service} key={service.id} id={service.id} />
|
||||
</Grid.Col>
|
||||
))}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useForm } from '@mantine/form';
|
||||
import { useConfig } from '../../tools/state';
|
||||
import { ColorSelector } from './ColorSelector';
|
||||
import { OpacitySelector } from './OpacitySelector';
|
||||
import { AppCardWidthSelector } from './AppCardWidthSelector';
|
||||
import { ShadeSelector } from './ShadeSelector';
|
||||
|
||||
export default function TitleChanger() {
|
||||
@@ -58,6 +59,7 @@ export default function TitleChanger() {
|
||||
<ColorSelector type="secondary" />
|
||||
<ShadeSelector />
|
||||
<OpacitySelector />
|
||||
<AppCardWidthSelector />
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
|
||||
32
src/components/Settings/AppCardWidthSelector.tsx
Normal file
32
src/components/Settings/AppCardWidthSelector.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import React from 'react';
|
||||
import { Group, Text, Slider } from '@mantine/core';
|
||||
import { useConfig } from '../../tools/state';
|
||||
|
||||
export function AppCardWidthSelector() {
|
||||
const { config, setConfig } = useConfig();
|
||||
|
||||
const setappCardWidth = (appCardWidth: number) => {
|
||||
setConfig({
|
||||
...config,
|
||||
settings: {
|
||||
...config.settings,
|
||||
appCardWidth,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Group direction="column" spacing="xs" grow>
|
||||
<Text>App Width</Text>
|
||||
<Slider
|
||||
label={null}
|
||||
defaultValue={config.settings.appCardWidth}
|
||||
step={0.2}
|
||||
min={0.8}
|
||||
max={2}
|
||||
styles={{ markLabel: { fontSize: 'xx-small' } }}
|
||||
onChange={(value) => setappCardWidth(value)}
|
||||
/>
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export interface Settings {
|
||||
background?: string;
|
||||
appOpacity?: number;
|
||||
widgetPosition?: string;
|
||||
appCardWidth?: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
|
||||
Reference in New Issue
Block a user