Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

3.0 KB
Raw Blame
@props([
    'id',
    'errorId' => null,
    'hostLabel' => 'Domain',
    'hostPlaceholder' => 'app.example.com',
    'inheritedPortExpression' => null,
])

<div class="grid gap-4 sm:grid-cols-[8rem_minmax(0,1fr)_8rem]">
    <div class="min-w-0">
        <x-forms.listbox id="{{ $id }}.scheme" htmlId="{{ $id }}-protocol" label="Protocol" portal :options="[
            ['value' => 'https', 'label' => 'https'],
            ['value' => 'http', 'label' => 'http'],
        ]" />
    </div>

    <div class="min-w-0">
        <div class="mb-1.5 flex h-4 w-full items-center gap-1.5">
            <label for="{{ $id }}-host" class="mb-0! flex items-center gap-1.5 leading-4">
                {{ $hostLabel }} <x-highlighted text="*" />
            </label>
        </div>
        <input id="{{ $id }}-host" type="text" class="input" wire:model="{{ $id }}.host"
            placeholder="{{ $hostPlaceholder }}" autocomplete="off" required />
        @error($errorId ?? "{$id}.host")
            @php
                preg_match('/(https?:\/\/\S+)$/', $message, $validationLinkMatches);
                $validationLink = $validationLinkMatches[1] ?? null;
            @endphp
            <p class="mt-1 text-[12px] text-red-500">
                @if ($validationLink)
                    {{ str($message)->beforeLast($validationLink)->trim() }}
                    <a class="font-medium underline" href="{{ $validationLink }}">Set them here.</a>
                @else
                    {{ $message }}
                @endif
            </p>
        @enderror
    </div>

    <div class="min-w-0">
        <div class="mb-1.5 flex h-4 w-full items-center gap-1.5">
            <label for="{{ $id }}-port" class="mb-0! flex items-center gap-1.5 leading-4">Port</label>
        </div>
        <input id="{{ $id }}-port" type="number" class="input" wire:model="{{ $id }}.port"
            placeholder="3000" min="1" max="65535" inputmode="numeric"
            @if ($inheritedPortExpression)
                x-bind:placeholder="({{ $inheritedPortExpression }}) ?? ''"
            @endif />
    </div>

    @if ($inheritedPortExpression)
        <div class="min-w-0 sm:col-span-3"
            x-show="!({{ $inheritedPortExpression }}) && !$wire.{{ $id }}?.port" x-cloak>
            <x-callout type="danger" title="Port is required">
                The proxy cannot route this domain. Enter the port your container listens on in the Port field.
            </x-callout>
        </div>
    @endif

    <div class="min-w-0 sm:col-span-3">
        <div class="mb-1.5 flex h-4 w-full items-center gap-1.5">
            <label for="{{ $id }}-path" class="mb-0! flex items-center gap-1.5 leading-4">Path</label>
        </div>
        <input id="{{ $id }}-path" type="text" class="input" wire:model="{{ $id }}.path"
            placeholder="/api/v3" autocomplete="off" />
        <p class="mt-1 text-[12px] text-neutral-500 dark:text-fg-dim">
            Optional path, query, or fragment appended after the domain and port.
        </p>
    </div>
</div>