Skip to content

Instantly share code, notes, and snippets.

@RobinDev
Last active December 27, 2023 08:10
Show Gist options
  • Select an option

  • Save RobinDev/ea24869b9a9e571bda95370330cda2ab to your computer and use it in GitHub Desktop.

Select an option

Save RobinDev/ea24869b9a9e571bda95370330cda2ab to your computer and use it in GitHub Desktop.

Revisions

  1. RobinDev revised this gist Dec 27, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ public function display(
    string $tooltipextraClass = '',
    ?string $extraAttributes = '',
    ): void
    {
    {
    ?>

    <button
  2. RobinDev revised this gist Dec 27, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,8 @@ public function display(
    string $tooltipextraClass = '',
    ?string $extraAttributes = '',
    ): void
    { ?>
    {
    ?>

    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
  3. RobinDev revised this gist Dec 27, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@

    use League\Plates\Template\Template;
    use League\Plates\Template\TemplateClassInterface;
    use PiedWeb\SeoStatus\Plates\AbstractTemplate;
    use PiedWeb\SeoStatus\Plates\TemplateExtension;
    use App\Plates\AbstractTemplate;
    use App\Plates\TemplateExtension;

    use function Symfony\Component\String\u;

  4. RobinDev revised this gist Dec 27, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,7 @@ public function display(
    ?string $extraAttributes = '',
    ): void
    { ?>

    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
    @@ -36,6 +37,7 @@ class="focus:outline-none inline-block <?= $extraClass ?>"
    <span class="rounded-full border-gray-300 border text-gray-300 inline-block ml-2 hover:bg-white w-[22px] text-sm text-center">?</span>
    <?php } ?>
    </button>

    <?php
    }

  5. RobinDev revised this gist Dec 27, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ public function display(
    ?string $extraAttributes = '',
    ): void
    { ?>
    <button
    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
    content: '',
  6. RobinDev revised this gist Dec 27, 2023. 1 changed file with 15 additions and 15 deletions.
    30 changes: 15 additions & 15 deletions TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -21,21 +21,21 @@ public function display(
    ): void
    { ?>
    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
    content: '',
    allowHTML: true,
    interactive: true,
    theme: 'light',
    appendTo: document.body
    }"
    x-tooltip.raw="<?= u('<span class="max-h-[50vh] overflow-y-auto block '.$tooltipextraClass.'">'.$tooltipText.'</span>')->replace('"', '&quot;') ?>"
    <?= $extraAttributes ?>>
    <?= $text ?>
    <?php if ('' === $text) { ?>
    <span class="rounded-full border-gray-300 border text-gray-300 inline-block ml-2 hover:bg-white w-[22px] text-sm text-center">?</span>
    <?php } ?>
    </button>
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
    content: '',
    allowHTML: true,
    interactive: true,
    theme: 'light',
    appendTo: document.body
    }"
    x-tooltip.raw="<?= u('<span class="max-h-[50vh] overflow-y-auto block '.$tooltipextraClass.'">'.$tooltipText.'</span>')->replace('"', '&quot;') ?>"
    <?= $extraAttributes ?>>
    <?= $text ?>
    <?php if ('' === $text) { ?>
    <span class="rounded-full border-gray-300 border text-gray-300 inline-block ml-2 hover:bg-white w-[22px] text-sm text-center">?</span>
    <?php } ?>
    </button>
    <?php
    }

  7. RobinDev revised this gist Dec 27, 2023. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,6 @@ public function display(
    ?string $extraAttributes = '',
    ): void
    { ?>
    <?php $extraClass = match ($extraClass) { 'dotted' => 'border-gray-400 border-b border-dotted', default => $extraClass } ?>
    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
  8. RobinDev revised this gist Dec 27, 2023. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -7,20 +7,20 @@
    use PiedWeb\SeoStatus\Plates\AbstractTemplate;
    use PiedWeb\SeoStatus\Plates\TemplateExtension;

    use function Symfony\Component\String\u;

    class TooltipTpl extends AbstractTemplate implements TemplateClassInterface
    {
    public function display(
    Template $t,
    TemplateExtension $ext,
    Template $t,
    string|int|float $text = '',
    string $tooltipText = '',
    string $extraClass = 'text-sky-600 focus:text-gray-400',
    string $tooltipextraClass = '',
    ?string $extraAttributes = '',
    ): void
    { ?>
    <?php $tooltipContent = '<span class="max-h-[50vh] overflow-y-auto block '.$tooltipextraClass.'">'.$tooltipText.'</span>' ?>
    <?php $extraClass = match ($extraClass) { 'dotted' => 'border-gray-400 border-b border-dotted', default => $extraClass } ?>
    <?php $extraClass = match ($extraClass) { 'dotted' => 'border-gray-400 border-b border-dotted', default => $extraClass } ?>
    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
    @@ -30,7 +30,7 @@ class="focus:outline-none inline-block <?= $extraClass ?>"
    theme: 'light',
    appendTo: document.body
    }"
    x-tooltip.raw="<?= $ext->u($tooltipContent)->replace('"', '&quot;') ?>"
    x-tooltip.raw="<?= u('<span class="max-h-[50vh] overflow-y-auto block '.$tooltipextraClass.'">'.$tooltipText.'</span>')->replace('"', '&quot;') ?>"
    <?= $extraAttributes ?>>
    <?= $text ?>
    <?php if ('' === $text) { ?>
  9. RobinDev created this gist Dec 23, 2023.
    49 changes: 49 additions & 0 deletions TooltipTpl.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    <?php

    namespace App\Template\Partial; // src/Template/Partial/TooltipTpl.php

    use League\Plates\Template\Template;
    use League\Plates\Template\TemplateClassInterface;
    use PiedWeb\SeoStatus\Plates\AbstractTemplate;
    use PiedWeb\SeoStatus\Plates\TemplateExtension;

    class TooltipTpl extends AbstractTemplate implements TemplateClassInterface
    {
    public function display(
    Template $t,
    TemplateExtension $ext,
    string|int|float $text = '',
    string $tooltipText = '',
    string $extraClass = 'text-sky-600 focus:text-gray-400',
    string $tooltipextraClass = '',
    ?string $extraAttributes = '',
    ): void
    { ?>
    <?php $tooltipContent = '<span class="max-h-[50vh] overflow-y-auto block '.$tooltipextraClass.'">'.$tooltipText.'</span>' ?>
    <?php $extraClass = match ($extraClass) { 'dotted' => 'border-gray-400 border-b border-dotted', default => $extraClass } ?>
    <button
    class="focus:outline-none inline-block <?= $extraClass ?>"
    x-tooltip="{
    content: '',
    allowHTML: true,
    interactive: true,
    theme: 'light',
    appendTo: document.body
    }"
    x-tooltip.raw="<?= $ext->u($tooltipContent)->replace('"', '&quot;') ?>"
    <?= $extraAttributes ?>>
    <?= $text ?>
    <?php if ('' === $text) { ?>
    <span class="rounded-full border-gray-300 border text-gray-300 inline-block ml-2 hover:bg-white w-[22px] text-sm text-center">?</span>
    <?php } ?>
    </button>
    <?php
    }

    /**
    * Autogenerated constructor.
    */
    public function __construct(public string|int|float $text = '', public string $tooltipText = '', public string $extraClass = 'text-sky-600 focus:text-gray-400', public string $tooltipextraClass = '', public ?string $extraAttributes = '')
    {
    }
    }