Skip to content

Commit 9dfdb8d

Browse files
authored
fix: make settings grid responsive (#1463)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a new SettingsGrid component for consistent and responsive grid layouts. * **Refactor** * Updated settings-related layouts to use the new SettingsGrid component, improving maintainability and visual consistency across the interface. * **Chores** * Removed an unused CSS breakpoint variable from global styles. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 407585c commit 9dfdb8d

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script setup lang="ts">
2+
import { cn } from '@/lib/utils';
3+
4+
const props = defineProps<{
5+
class?: string;
6+
}>();
7+
</script>
8+
9+
<template>
10+
<div
11+
:class="cn('settings-grid grid gap-2 items-baseline md:pl-3 md:gap-x-10 md:gap-y-6', props.class)"
12+
>
13+
<slot />
14+
</div>
15+
</template>
16+
17+
<style>
18+
.settings-grid {
19+
grid-template-columns: 1fr;
20+
}
21+
22+
@media (min-width: 768px) {
23+
.settings-grid {
24+
grid-template-columns: 35% 1fr;
25+
}
26+
27+
.settings-grid > *:nth-child(odd) {
28+
text-align: end;
29+
}
30+
}
31+
</style>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import CardWrapper from '@/components/layout/CardWrapper.vue';
22
import PageContainer from '@/components/layout/PageContainer.vue';
3+
import SettingsGrid from '@/components/layout/SettingsGrid.vue';
34

4-
export { CardWrapper, PageContainer };
5+
export { CardWrapper, PageContainer, SettingsGrid };

unraid-ui/src/forms/UnraidSettingsLayout.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* @prop cells - Available cells
1616
*/
1717
18+
import SettingsGrid from '@/components/layout/SettingsGrid.vue';
1819
import { useJsonFormsVisibility } from '@/forms/composables/useJsonFormsVisibility';
1920
import type { HorizontalLayout } from '@jsonforms/core';
2021
import { DispatchRenderer, type RendererProps } from '@jsonforms/vue';
@@ -32,10 +33,7 @@ const elements = computed(() => {
3233
</script>
3334

3435
<template>
35-
<div
36-
v-if="isVisible"
37-
class="grid grid-cols-settings items-baseline pl-3 gap-y-6 [&>*:nth-child(odd)]:text-end [&>*:nth-child(even)]:ml-10"
38-
>
36+
<SettingsGrid v-if="isVisible">
3937
<template v-for="(element, _i) in elements" :key="_i">
4038
<DispatchRenderer
4139
:schema="layout.layout.value.schema"
@@ -46,5 +44,5 @@ const elements = computed(() => {
4644
:cells="layout.layout.value.cells"
4745
/>
4846
</template>
49-
</div>
47+
</SettingsGrid>
5048
</template>

unraid-ui/src/styles/globals.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@
168168
--max-width-800px: 800px;
169169
--max-width-1024px: 1024px;
170170

171-
/* Breakpoints */
172-
--breakpoint-*: initial;
173-
174171
/* Animations */
175172
--animate-mark-2: mark-2 1.5s ease infinite;
176173
--animate-mark-3: mark-3 1.5s ease infinite;

web/components/ConnectSettings/ConnectSettings.ce.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { storeToRefs } from 'pinia';
88
import { watchDebounced } from '@vueuse/core';
99
import { useMutation, useQuery } from '@vue/apollo-composable';
1010
11-
import { BrandButton, jsonFormsRenderers, Label } from '@unraid/ui';
11+
import { BrandButton, jsonFormsRenderers, Label, SettingsGrid } from '@unraid/ui';
1212
import { JsonForms } from '@jsonforms/vue';
1313
1414
import { useServerStore } from '~/store/server';
@@ -102,9 +102,7 @@ const onChange = ({ data }: { data: Record<string, unknown> }) => {
102102

103103
<template>
104104
<!-- common api-related actions -->
105-
<div
106-
class="grid grid-cols-settings items-baseline pl-3 gap-y-6 [&>*:nth-child(odd)]:text-end [&>*:nth-child(even)]:ml-10"
107-
>
105+
<SettingsGrid>
108106
<template v-if="connectPluginInstalled">
109107
<Label>Account Status:</Label>
110108
<div v-html="'<unraid-auth></unraid-auth>'"/>
@@ -115,7 +113,7 @@ const onChange = ({ data }: { data: Record<string, unknown> }) => {
115113
'<unraid-download-api-logs></unraid-download-api-logs>'
116114
"
117115
/>
118-
</div>
116+
</SettingsGrid>
119117
<!-- auto-generated settings form -->
120118
<div class="mt-6 pl-3 [&_.vertical-layout]:space-y-6">
121119
<JsonForms

0 commit comments

Comments
 (0)