Skip to content

Commit

Permalink
Change layout of field (put button in input)
Browse files Browse the repository at this point in the history
  • Loading branch information
thilojaeggi committed Jul 4, 2023
1 parent ec940c4 commit a972d1a
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions app/templates/inputs/installer_switches.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,36 @@
<option x-text="key" :value="key"></option>
</template>
</select>
<div class="bg-gray-100 dark:bg-neutral-800 p-2 rounded-md mt-2">
<template x-for="(item, index) in switches" :key="index">
<div class="mt-2 flex items-center">
<div class="flex flex-col">
<label :for="item.key" class="block text-gray-700 dark:text-gray-300 " x-text="item.key"><span
class="text-red-500">*</span></label>
<input :id="item.key" :name="item.key" type="text" x-bind:required="fileChosen" x-model="item.value"
class="block w-full px-3 py-2 mt-1 text-gray-600 dark:text-gray-200 placeholder-gray-400 bg-white dark:bg-neutral-950 border border-gray-200 dark:border-gray-50/30 rounded-md focus:border-blue-400 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-40">
<div class="bg-gray-100 dark:bg-neutral-800 w-full md:w-3/5 p-2 rounded-md mt-2">
<template x-for="(item, index) in switches" :key="index">
<div class="mt-2 flex items-center">
<div class="flex flex-col w-full">
<label :for="item.key" class="block text-gray-700 dark:text-gray-300 " x-text="item.key"><span
class="text-red-500">*</span></label>

<div
class="flex flex-row justify-center items-center bg-white dark:bg-neutral-950 border border-gray-200 dark:border-gray-50/30 rounded-md focus-within:ring-2 focus-within:ring-blue-500">
<input :id="item.key" :name="item.key" type="text" x-bind:required="fileChosen"
x-model="item.value"
class="block w-full px-3 py-2 text-gray-600 dark:text-gray-200 placeholder-gray-400 bg-transparent ring-0 border-none outline-none">
<button @click="
availableSwitches.push(item.key);
switches.splice(index, 1)" type="button"
class="group p-1 mr-1 text-gray-500 transition-colors hover:bg-red-100 dark:bg-neutral-900 duration-300 rounded-md cursor-pointer self-center justify-self-center">
<svg class="group-hover:stroke-red-500 transition-color duration-300 h-6 w-6" fill="none"
stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round"
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0">
</path>
</svg>
</button>
</div>



</div>
</div>
<button @click="
availableSwitches.push(item.key);
switches.splice(index, 1)" type="button"
class="mt-7 ml-1 px-1 group py-1 text-gray-500 transition-colors hover:bg-red-100 dark:bg-neutral-900 duration-300 rounded-md cursor-pointer self-center justify-self-center">
<svg class="group-hover:stroke-red-500 transition-color duration-300 h-6 w-6" fill="none"
stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round"
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0">
</path>
</svg>
</button>
</div>
</template>
</template>
</div>
</div>

0 comments on commit a972d1a

Please sign in to comment.