Question By
Unsolved

May be a piece of code is missing in the "combining table and form builder"

happytodev

Dec 14th, 2024 03:23 AM

Hello,

Maybe I'm wrong, in this case you can delete this question.

But it seems the x-modal component code is missing in this part of tutorial : Combining the Table and Form Builder

=> Unable to locate a class or view for component [modal].

I think the missing component is resources/themes/anchor/components/elements/modal.blade.php

bobbyiliev

Dec 16th, 2024 09:12 AM

Hey!

Ah yes indeed! A quick fix is to add the missing modal following:

<!-- resources/themes/{theme}/components/elements/modal.blade.php -->
<div
    x-data="{ open: false }"
    x-cloak
    @click.away="open = false"
    class="relative"
>
    <div @click="open = true">
        {{ $trigger ?? '' }}
    </div>

    <div
        x-show="open"
        x-transition
        class="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"
    >
        <div
            class="bg-white rounded-lg shadow-lg w-full max-w-{{ $width ?? 'md' }} p-6"
            @keydown.escape.window="open = false"
        >
            <div class="flex items-center justify-between pb-2 mb-4 border-b">
                {{ $header ?? '' }}
                <button @click="open = false" class="text-gray-500 hover:text-gray-700">
                    &times;
                </button>
            </div>

            <div class="space-y-4">
                {{ $slot }}
            </div>
        </div>
    </div>
</div>

I will have to update the docs to include that modal, or maybe just include it in the wave repo instead, will think about it!

Let me know how it goes!