Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Livewire/CreateCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class CreateCode extends Component
{
public bool $includeLegend = true;

public string $message;

protected array $symbols = [
Expand Down
8 changes: 6 additions & 2 deletions resources/views/components/legend.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
@props(['letters'])
@props(['letters', 'includeLegend' => true])

<div class="flex flex-wrap mt-auto">
@foreach ($letters as $letter => $symbol)
<div class="flex flex-col items-center border border-white/10 print:border-gray-400 p-2">
<div
@class([
'flex flex-col items-center border border-white/10 print:border-gray-400 p-2',
'print:hidden' => ! $includeLegend,
])>
<span class="mb-2 font-bold">{{ ucwords($letter) }}</span>
<span class="material-symbols-outlined character">{{ $symbol }}</span>
</div>
Expand Down
6 changes: 5 additions & 1 deletion resources/views/livewire/create-code.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
class="bg-white/10 text-white py-2 px-3 rounded-xl w-full"></textarea>

<div class="mt-2 flex justify-end">
<div class="flex items-center mr-3">
<input type="checkbox" wire:model.live="includeLegend" class="mr-2 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-600 ring-offset-gray-800 focus:ring-2" @disabled(! $message)>
<label for="includeLegend">Include Legend</label>
</div>
<button type="button" @disabled(! $message) @click="window.print()" class="bg-blue-500 px-4 py-1 text-sm font-semibold rounded-md disabled:bg-gray-300">Print</button>
</div>
</form>

<x-code :message="$message" :letters="$this->letters"/>

@if ($message)
<x-legend :letters="$this->letters" />
<x-legend :letters="$this->letters" :includeLegend="$includeLegend" />
@endif
</div>