Skip to content

A self-hosted media server and file management system

feat: generalise input label when not in form

aminnausin52354638623c
diff --git a/resources/js/components/cards/LibraryCardMenu.vue b/resources/js/components/cards/LibraryCardMenu.vue
index fa6cda96..2a8dc886 100644
--- a/resources/js/components/cards/LibraryCardMenu.vue
+++ b/resources/js/components/cards/LibraryCardMenu.vue
@@ -1,9 +1,9 @@
<script setup lang="ts">
import type { CategoryResource, FolderResource } from '@/types/resources';
-import FormInputLabel from '@/components/labels/FormInputLabel.vue';
import InputSelect from '@/components/pinesUI/InputSelect.vue';
import ButtonText from '@/components/inputs/ButtonText.vue';
+import InputLabel from '@/components/labels/InputLabel.vue';
import ProiconsArrowSync from '~icons/proicons/arrow-sync';
import ProiconsLockOpen from '~icons/proicons/lock-open';
@@ -33,7 +33,7 @@ const props = withDefaults(
</div>
<div class="[&>*]:w-full grid gap-2 [&>*]:dark:bg-neutral-900 [&>*]:h-8 [&>*]:disabled:opacity-60">
<div class="flex flex-col gap-1 !h-auto !bg-transparent">
- <FormInputLabel :field="{ text: 'Default Folder', name: 'Default Folder' }" class="font-normal" />
+ <InputLabel text="Default Folder" name="Default Folder" class="font-normal" />
<InputSelect
id="default-folder"
root-class="flex-1 rounded-l-none capitalize !w-full !whitespace-nowrap col-span-2 "
diff --git a/resources/js/components/inputs/ToggleBase.vue b/resources/js/components/inputs/ToggleBase.vue
index e85713d2..4c753970 100755
--- a/resources/js/components/inputs/ToggleBase.vue
+++ b/resources/js/components/inputs/ToggleBase.vue
@@ -1,6 +1,7 @@
<script setup>
const model = defineModel();
const { name } = defineProps(['name']);
+// NEEDS A REWORK
</script>
<template>
diff --git a/resources/js/components/labels/FormInputLabel.vue b/resources/js/components/labels/FormInputLabel.vue
index d97852ec..e7979808 100755
--- a/resources/js/components/labels/FormInputLabel.vue
+++ b/resources/js/components/labels/FormInputLabel.vue
@@ -1,9 +1,15 @@
<script setup lang="ts">
-const props = defineProps(['field', 'textSize', 'class']);
+import type { FormField } from '@/types/types';
+
+const props = defineProps<{
+ field: FormField;
+ textSize?: string;
+ class?: string;
+}>();
</script>
<template>
- <label :for="field?.name" :class="`block font-medium text-gray-700 dark:text-neutral-200 ${textSize ? textSize : 'text-sm'} ${props.class ?? ''}`">
+ <label :for="field?.name" :class="[`block font-medium text-gray-700 dark:text-neutral-200`, textSize ? textSize : 'text-sm', `${props.class ?? ''}`]">
{{ field?.text }}
</label>
<p v-if="field?.subtext" class="text-sm/6 text-gray-500 dark:text-gray-400">{{ field.subtext }}</p>
diff --git a/resources/js/components/labels/InputLabel.vue b/resources/js/components/labels/InputLabel.vue
new file mode 100644
index 00000000..c4d8a952
--- /dev/null
+++ b/resources/js/components/labels/InputLabel.vue
@@ -0,0 +1,16 @@
+<script setup lang="ts">
+const props = defineProps<{
+ name?: string;
+ text?: string;
+ subtext?: string;
+ class?: string;
+ subtextClass?: string;
+}>();
+</script>
+
+<template>
+ <label :for="name" :class="[`font-medium text-gray-700 dark:text-neutral-200`, props.class]">
+ {{ text }}
+ </label>
+ <p v-if="subtext" :class="['text-sm/6 text-gray-500 dark:text-gray-400', subtextClass]">{{ subtext }}</p>
+</template>
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vue
index 452df031..669cabb7 100755
--- a/resources/js/components/table/TableBase.vue
+++ b/resources/js/components/table/TableBase.vue
@@ -5,7 +5,6 @@ import { onMounted, ref } from 'vue';
import TextInputLabelled from '@/components/inputs/TextInputLabelled.vue';
import TablePagination from '@/components/table/TablePagination.vue';
-import FormInputLabel from '@/components/labels/FormInputLabel.vue';
import InputSelect from '@/components/pinesUI/InputSelect.vue';
import ButtonIcon from '@/components/inputs/ButtonIcon.vue';
import useTable from '@/composables/useTable.ts';
@@ -86,7 +85,6 @@ onMounted(() => {
/>
<span class="flex items-end gap-2 flex-wrap">
<div class="flex gap-2 flex-col w-full sm:w-40 flex-1">
- <FormInputLabel :field="{ name: 'sort', text: 'Sort by:' }" class="hidden" />
<InputSelect
:name="'sort'"
:placeholder="'Sort by...'"