fix(navigation): let CSS size the nav logo and drop the inline width cap
The navbar logo carried an inline `height:36px;width:auto;max-width:{logo_width}px`
while `.navbar-logo > img` already owns `height:36px;padding:0 30px`. Under
`box-sizing:border-box` that max-width capped the border box, so the 60px of
horizontal padding stayed inside it and wide logos were squeezed against a
fixed height, breaking the intrinsic aspect ratio.
- Render the nav logo with no inline sizing; CSS alone sizes it.
- Add a `$lazy` argument to jio_get_adaptive_theme_img() so the navbar can emit
the real src up front instead of a square lazyload placeholder; defaults to
'auto' so every other caller keeps the lazy_other behaviour.
- Remove the superseded logo_width plumbing: the setting (PHP + VUE schemas),
Settings::logo_width(), jio_get_site_logo_width(), the --jio-logo-width token
and the unused has_logo context key.
- Cover the contract in the header reference test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3ce5bfc20c
commit
8e74b60570
9 files changed
+36
-43
No files matched your search
@@ -158,7 +158,6 @@ class GlobalSchema {
|
||||
['key' => 'logo', 'title' => 'Logo 设置', 'fields' => [
|
||||
['key' => 'site_logo', 'label' => '站点 Logo', 'type' => 'media', 'default' => ''],
|
||||
['key' => 'site_logo_dark', 'label' => '暗色模式 Logo', 'type' => 'media', 'default' => ''],
|
||||
['key' => 'logo_width', 'label' => 'Logo 宽度', 'type' => 'number', 'default' => 150, 'min' => 50, 'max' => 400],
|
||||
['key' => 'logo_text', 'label' => 'Logo 文字', 'type' => 'input', 'default' => ''],
|
||||
]],
|
||||
['key' => 'favicon', 'title' => '站点图标', 'fields' => [
|
||||
|
||||
@@ -18,7 +18,6 @@ class InlineStyleBuilder {
|
||||
$main_radius = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::main_radius() : 12;
|
||||
$container_max = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::container_max_width() : 1200;
|
||||
$font_family = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::font_family() : 'system';
|
||||
$logo_width = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::logo_width() : 150;
|
||||
$sidebar_cfg = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::get_sidebar_config() : ['width' => 311, 'enabled' => true, 'position' => 'right'];
|
||||
$list_settings = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::get_post_list_style_settings() : [];
|
||||
|
||||
@@ -47,7 +46,6 @@ class InlineStyleBuilder {
|
||||
'--font-display' => $font_stacks['display'],
|
||||
'--font-ui' => $font_stacks['ui'],
|
||||
'--font-heading' => $font_stacks['ui'],
|
||||
'--jio-logo-width' => $logo_width . 'px',
|
||||
'--nav-height' => '60px',
|
||||
];
|
||||
|
||||
|
||||
@@ -149,7 +149,6 @@ trait DisplayPageGroups {
|
||||
'site_logo' => self::logo_url(),
|
||||
'site_logo_dark' => self::logo_dark_url(),
|
||||
'logo_text' => self::logo_text(),
|
||||
'logo_width' => self::logo_width(),
|
||||
'site_favicon' => self::favicon_url(),
|
||||
'theme_mode' => self::theme_mode(),
|
||||
'theme_mode_button' => self::get_theme_mode_button_positions(),
|
||||
|
||||
@@ -199,14 +199,6 @@ trait FacadeBulk {
|
||||
|
||||
|
||||
|
||||
/** 获取导航 Logo 宽度 */
|
||||
public static function logo_width(): int {
|
||||
$width = (int) self::get_value('logo_width', 150);
|
||||
return max(50, min(400, $width));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 获取Favicon URL */
|
||||
public static function custom_favicon_url(): string {
|
||||
$favicon = (string) self::get_value('site_favicon', '');
|
||||
|
||||
Reference in new issue
Block a user