-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a blade component for the front page blocks.
A blade component for the front page blocks minimizes the boilerplate for adding new blocks. It also makes it easier for a service to override the front view and add their own blocks.
- Loading branch information
1 parent
d9a7389
commit 2b78f08
Showing
7 changed files
with
66 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div {{ $attributes->merge(['class' => 'bg-white rounded p-4 mb-4']) }}> | ||
<div class="flex flex-row mb-2"> | ||
<div class="flex-1 font-bold tracking-wide uppercase">{{ $title }}</div> | ||
@if ($url) | ||
<div class="rounded bg-gray-100 border px-2"> | ||
<a class="text-blue-600" href="{{ $url }}">{{ $url }}</a> | ||
|
||
<span | ||
class="bg-secondary ml-1 px-1 text-xs text-white rounded cursor-default" | ||
title="Only {{ $httpMethod }} method allowed" | ||
>{{ $httpMethod }}</span> | ||
|
||
<span | ||
class="bg-purple-500 ml-1 px-1 text-xs text-white rounded cursor-default" | ||
title="Returns {{ $responseType }}" | ||
>{{ $responseType }}</span> | ||
|
||
@if ($requiresToken) | ||
<span | ||
class="bg-purple-500 ml-1 px-1 text-xs text-white rounded cursor-default" | ||
title="Requires token authentication" | ||
>token</span> | ||
@endif | ||
</div> | ||
@endif | ||
</div> | ||
{{ $slot }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Butler\Service\View\Components; | ||
|
||
use Illuminate\View\Component; | ||
|
||
class FrontBlock extends Component | ||
{ | ||
public function __construct( | ||
public string $title, | ||
public ?string $httpMethod = null, | ||
public ?string $responseType = null, | ||
public ?string $url = null, | ||
public bool $requiresToken = false, | ||
) { | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('service::components.front-block'); | ||
} | ||
} |