WowPress-Tailwind/theme/template-parts/components/toggle-button.php

25 lines
1.2 KiB
PHP

<?php
use WoWPress\Frontend\Icon;
?>
<div>
<label style="" for="tb_<?= $this->id ?>" class="w-full <?=$this->fullHeight?"h-full":""?> flex <?= $this->row ? 'flex-row gap-2' : 'flex-col' ?> items-center justify-center h-auto select-none cursor-pointer border py-3 px-6
font-bold border-<?=$this->color_no?> transition-colors duration-200 ease-in-out has-[:checked]:bg-<?=$this->color_yes?> has-[:checked]:text-black has-[:checked]:border-<?=$this->color_yes?>">
<input type="<?= $this->type ?>" value="<?=$this->value?>" id="tb_<?= $this->id ?>" name="<?= $this->name ?>" class="peer group hidden" <?= $this->disabled ? 'disabled' : '' ?> <?= $this->checked ? 'checked' : '' ?> />
<div class="peer-checked:block hidden">
<?php
if ($this->icons) : ?>
<?= Icon::get($this->icon_yes) ?>
<?php else : ?>
Ja
<?php endif; ?>
</div>
<div class="peer-checked:hidden block">
<?php if ($this->icons) : ?>
<?= Icon::get($this->icon_no) ?>
<?php else : ?>
Nein
<?php endif; ?>
</div>
<?= $this->text ?>
</label>
</div>