|
1 | 1 | @extends('shorturl::layout') |
2 | 2 |
|
3 | 3 | @section('shorturl.content') |
4 | | - <div class="col-12"> |
5 | | - <h1 class="text-center mb-5"> |
6 | | - <img class="logo-title" src="{{ asset('/gallib/shorturl/images/short.png') }}" alt="Laravel Short Url"> |
7 | | - Laravel Short Url |
8 | | - </h1> |
9 | | - @if (session('short_url')) |
10 | | - <div class="alert alert-success" role="alert"> |
11 | | - Your shortened url is: <a class="font-weight-bold" href="{{ session('short_url') }}" title="your shortened url">{{ session('short_url') }}</a> (<a class="copy-clipboard" href="javascript:void(0);" data-clipboard-text="{{ session('short_url') }}">Copy link to clipboard</a>) |
| 4 | + @if (session('short_url')) |
| 5 | + <div role="alert" class="mb-8 p-5 rounded-lg border border-green-400 bg-green-300 text-green-900 flex"> |
| 6 | + <span class="mr-2"> |
| 7 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 8 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
| 9 | + </svg> |
| 10 | + </span> |
| 11 | + Your shortened url is: <a class="font-semibold mr-1" href="{{ session('short_url') }}" title="your shortened url">{{ session('short_url') }}</a> (<a class="copy-clipboard underline" href="javascript:void(0);" data-clipboard-text="{{ session('short_url') }}">Copy link to clipboard</a>) |
| 12 | + </div> |
| 13 | + @endif |
| 14 | + |
| 15 | + <form method="POST" action="{{ route('shorturl.url.update', $url->id) }}"> |
| 16 | + @method('PUT') |
| 17 | + @csrf |
| 18 | + <div class="grid grid-cols-2 gap-4 my-2"> |
| 19 | + <div class="col-span-2"> |
| 20 | + <input type="text" class="w-full h-12 rounded-lg {{ $errors->has('url') ? 'border border-red-700' : '' }}" id="url" name="url" placeholder="Paste an url" aria-label="Paste an url" value="{{ old('url', $url->url) }}"> |
| 21 | + @if ($errors->has('url')) |
| 22 | + <span class="text-xs text-red-700">{{ $errors->first('url') }}</span> |
| 23 | + @endif |
| 24 | + </div> |
| 25 | + <div> |
| 26 | + <label for="code">Custom alias (optional)</label> |
| 27 | + <input type="text" class="w-full h-12 rounded-lg {{ $errors->has('code') ? 'border border-red-700' : '' }}" id="code" name="code" placeholder="Set your custom alias" value="{{ old('code', $url->code) }}"> |
| 28 | + @if ($errors->has('code')) |
| 29 | + <span class="text-xs text-red-700">{{ $errors->first('code') }}</span> |
| 30 | + @endif |
12 | 31 | </div> |
13 | | - @endif |
14 | | - <form method="POST" action="{{ route('shorturl.url.update', $url->id) }}"> |
15 | | - @method('PUT') |
16 | | - @csrf |
17 | | - <div class="input-group"> |
18 | | - <input type="text" class="form-control form-control-lg {{ $errors->has('url') ? 'is-invalid' : '' }}" id="url" name="url" placeholder="Paste an url" aria-label="Paste an url" value="{{ old('url', $url->url) }}"> |
19 | | - <div class="input-group-append"> |
20 | | - <button class="btn btn-primary" type="submit">Shorten</button> |
21 | | - </div> |
| 32 | + <div> |
| 33 | + <label for="expires_at">Expires at (optional)</label> |
| 34 | + <input type="datetime-local" class="w-full h-12 rounded-lg {{ $errors->has('expires_at') ? 'border border-red-700' : '' }}" id="expires_at" name="expires_at" placeholder="Set your expiration date" value="{{ old('expires_at', ($url->couldExpire() ? $url->expires_at->format('Y-m-d\TH:i') : null)) }}"> |
| 35 | + @if ($errors->has('expires_at')) |
| 36 | + <span class="text-xs text-red-700">{{ $errors->first('expires_at') }}</span> |
| 37 | + @endif |
22 | 38 | </div> |
23 | | - @if ($errors->has('url')) |
24 | | - <small id="url-error" class="form-text text-danger"> |
25 | | - {{ $errors->first('url') }} |
26 | | - </small> |
27 | | - @endif |
28 | | - <div class="row mt-3"> |
29 | | - <div class="col-4"> |
30 | | - <div class="form-group"> |
31 | | - <label for="code">Custom alias (optional)</label> |
32 | | - <input type="text" class="form-control {{ $errors->has('code') ? 'is-invalid' : '' }}" id="code" name="code" placeholder="Set your custom alias" value="{{ old('code', $url->code) }}"> |
33 | | - @if ($errors->has('code')) |
34 | | - <small id="code-error" class="form-text text-danger"> |
35 | | - {{ $errors->first('code') }} |
36 | | - </small> |
37 | | - @endif |
38 | | - </div> |
39 | | - </div> |
40 | | - <div class="col-4"> |
41 | | - <div class="form-group"> |
42 | | - <label for="expires_at">Expires at (optional)</label> |
43 | | - <input type="datetime-local" class="form-control {{ $errors->has('expires_at') ? 'is-invalid' : '' }}" id="expires_at" name="expires_at" placeholder="Set your expiration date" value="{{ old('expires_at', ($url->couldExpire() ? $url->expires_at->format('Y-m-d\TH:i') : null)) }}"> |
44 | | - @if ($errors->has('expires_at')) |
45 | | - <small id="code-error" class="form-text text-danger"> |
46 | | - {{ $errors->first('expires_at') }} |
47 | | - </small> |
48 | | - @endif |
49 | | - </div> |
50 | | - </div> |
51 | | - <div class="col-4 text-right">By <a href="https://github.com/gallib/laravel-short-url" title="by gallib/laravel-short-url" target="_blank">Gallib/laravel-short-url</a></div> |
| 39 | + <div> |
| 40 | + <button class="h-12 px-5 text-teal-100 transition-colors duration-150 bg-teal-700 rounded-lg focus:shadow-outline hover:bg-teal-800" type="submit">Shorten</button> |
52 | 41 | </div> |
53 | | - </form> |
54 | | - </div> |
| 42 | + <div class="text-right">By <a class="font-semibold" href="https://github.com/gallib/laravel-short-url" title="by gallib/laravel-short-url" target="_blank">Gallib/laravel-short-url</a></div> |
| 43 | + </div> |
| 44 | + </form> |
55 | 45 | @endsection |
56 | 46 |
|
57 | 47 | @push('scripts') |
58 | | - <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script> |
| 48 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.10/clipboard.min.js"></script> |
59 | 49 | <script> |
60 | 50 | var clipboard = new ClipboardJS('.copy-clipboard'); |
61 | 51 |
|
|
0 commit comments