v0.0.2
Demos (demo panel, opens in a new tab)

Store settings

The store settings that open from a gear button on the right edge: light or dark, the colour, the width and the language. The choices are made and kept in the browser; the package keeps no choice on the server.

zb:theme-switcher · store sections zubazar/ui-pro

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Turning the settings panel on

PHP

Turn the panel on with SHOP_THEME_SWITCHING=true; the store's routes sit in the zb.theme:commerce group.

php
// .env
SHOP_THEME_SWITCHING=true

// routes/web.php
Route::middleware('zb.theme:commerce')->group(function () {
    // … the store's routes
});
PropValues
switchingtrue: the visitor's settings panel (light/dark, colour, width, language), in the browser (SHOP_THEME_SWITCHING)
zb.theme:commercePicks the request's theme from the setting (commerce.theme); reads neither the address nor a cookie

The settings panel

The settings panel: view
BLADE

The panel is the drawer form of the kit's zb:theme-switcher; it slides in from the right when the gear in the middle of the right edge is pressed.

blade
{{-- While the panel is on, <zb:shop.document> adds it itself. --}}
<zb:theme-switcher as="drawer" name="shop-settings" :title="__('Store settings')"
    :sections="\Zubazar\Commerce\Shop::SWITCHER" :reset-url="\Zubazar\Commerce\Shop::resetUrl()" />

Developer notes

Events, hooks and details
  • The panel is on in the demo store, and the demo application offers the theme, navbar and footer choice with its own code; off, everyone sees the configured look and the panel is not drawn.
  • The panel opens without dimming the page or locking its scroll.
  • The sections (Shop::SWITCHER): the mode, the colour, the enabled themes with small previews when the application links to them, the navbar and footer presets, the width, the language in a store with several, and the store's topLinks().
  • The mode, the colour and the width apply at once and are kept in the browser; a theme, navbar, footer or language choice reloads the page and the panel stays open.
  • While the panel is on, the theme's colour is only a default; the "Theme default" preset is the theme's own navbar or footer (the link key theme).
  • "Reset to default" clears the browser's choices and, when the application gives a reset link, goes there too.
  • 1.x's <zb:shop.theme-switcher /> tag draws the same panel until 3.0.
Zubazar UI · ZubazarDesigned for people.