WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Brand component does not support logo-only dark mode #2219

@theblindfrog

Description

@theblindfrog

Flux version

2.9.0

Livewire version

3.7.0

Tailwind version

4.1.17

Browser and Operating System

Chrome on MacOS

What is the problem?

When using the sidebar.brand component, there's support for a 'dark mode' logo being shown IF a 'name' is passed.
However, if you don't want to use the 'name' pattern, there's a fallback for just using the logo, which doesn't support using a dark mode logo, even if you have one.

Easy one to fix, and happy to provide a PR if it would be accepted.
I appreciate that I can publish the template, but this felt like something that you'd expect to 'just work'

Code snippets to replicate the problem

This'd how I'd fix this

From https://github.com/livewire/flux/blob/main/stubs/resources/views/flux/sidebar/brand.blade.php

<?php if ($name): ?>
    // omitted for brevity
<?php else: ?>
    <a href="{{ $href }}" {{ $attributes->class($classes) }} data-flux-sidebar-brand>
        <?php if ($logo instanceof \Illuminate\View\ComponentSlot): ?>
            <div {{ $logo->attributes->class('flex items-center justify-center [:where(&)]:h-6 [:where(&)]:min-w-6 [:where(&)]:rounded-sm overflow-hidden shrink-0') }}>
                {{ $logo }}
            </div>
        <?php else: ?>
            <div class="flex items-center justify-center h-6 rounded-sm overflow-hidden shrink-0">
+              <?php if ($logoDark): ?>
+                    <img src="{{ $logo }}" alt="{{ $alt }}" class="h-6 dark:hidden" />
+                    <img src="{{ $logoDark }}" alt="{{ $alt }}" class="h-6 hidden dark:block" />
-                <?php if ($logo): ?>
+                <?php elseif ($logo): ?>
                    <img src="{{ $logo }}" alt="{{ $alt }}" class="h-6" />
                <?php else: ?>
                    {{ $slot }}
                <?php endif; ?>
            </div>
        <?php endif; ?>
    </a>
<?php endif; ?>

Screenshots/ screen recordings of the problem

Image Image

Light mode and dark mode; when a dark mode version is provided

How do you expect it to work?

Dark mode logo to be shown when name is not provided.

<flux:sidebar.brand
    href="{{ route('dashboard') }}"
    logo="{{ asset('img/logo_v0.svg') }}"
    logoDark="{{ asset('img/logo_v0_dark.svg') }}"
    alt="Pay By QR"
/>
Image

Please confirm (incomplete submissions will not be addressed)

  • I have provided easy and step-by-step instructions to reproduce the bug.
  • I have provided code samples as text and NOT images.
  • I understand my bug report will be closed if I haven't met the criteria above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions