mishka-group / mishka_template_creator

Mishka Template Creator for Phoenix and Phoenix LiveView
8 stars 1 forks source link

Create basic UI components #4

Open shahryarjb opened 1 year ago

shahryarjb commented 1 year ago

To make a dynamic template and later a drag and drop editor, we need to implement a series of basic components. It should be server side rendered and be ordered by Sortable JS.


If you want to create a JS{} and copy this for HTML side, use this in your LiveView handle_call:

JS.push("delete", value: %{id: id, type: "dom"})
    |> hide_modal("delete_confirm")
    |> Map.get(:ops)
    |> Jason.encode!()

@MonaAghili

shahryarjb commented 1 year ago

https://user-images.githubusercontent.com/8413604/230317413-e15b0fb0-5d93-4278-b23a-83db4fe800b6.mp4

shahryarjb commented 1 year ago
<h3 class="mb-5 text-lg font-bold text-gray-900">Choose an arrangement:</h3>
        <ul class="grid w-full gap-6 grid-cols-3">
          <li>
            <input type="checkbox" id="react-option" value="" class="hidden peer" required="" />
            <label
              for="react-option"
              class="inline-flex items-center justify-between w-full p-5 text-gray-500 bg-white border-2 border-gray-200 rounded-lg cursor-pointer peer-checked:border-blue-600 hover:text-gray-600 dark:peer-checked:text-gray-300 peer-checked:text-gray-600 hover:bg-gray-50"
            >
              <div class="block text-center w-full">
                <Heroicons.adjustments_vertical class="mb-2 w-7 h-7 mx-auto" />
                <div class="w-full text-lg font-semibold text-center">Vertical</div>
              </div>
            </label>
          </li>
          <li>
            <input type="checkbox" id="flowbite-option" value="" class="hidden peer" />
            <label
              for="flowbite-option"
              class="inline-flex items-center justify-between w-full p-5 text-gray-500 bg-white border-2 border-gray-200 rounded-lg cursor-pointer peer-checked:border-blue-600 hover:text-gray-600 dark:peer-checked:text-gray-300 peer-checked:text-gray-600 hover:bg-gray-50"
            >
              <div class="block text-center w-full">
                <Heroicons.adjustments_horizontal class="mb-2 w-7 h-7 mx-auto" />
                <div class="w-full text-lg font-semibold">Horizontal</div>
              </div>
            </label>
          </li>
        </ul>