fix(widgets): align user-card checkin badge with reference font and UI

Render the explicit-class variant as an <a> badge (reference parity) so
it inherits the card font instead of the UA button stylesheet, and add
the reference icon spacing (ml3 mr6). FA5 fa-calendar-check retained;
the header dropdown keeps its <button> runtime.
This commit is contained in:
2026-09-19 13:39:38 +08:00
parent dc6bf34262
commit effdac91fd
+16 -1
View File
@@ -13,7 +13,9 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
*
* @param int $user_id Current user ID.
* @param bool $compact Render a short card-friendly label.
* @param string|null $class Override the button classes (keeps data-signin behavior).
* @param string|null $class Override the classes and render the reference-parity
* <a> badge (user-card 签到书签); null keeps the header
* dropdown <button> runtime.
*/
function aksrt_header_user_checkin_btn(int $user_id = 0, bool $compact = false, ?string $class = null): string {
$user_id = $user_id > 0 ? $user_id : get_current_user_id();
@@ -30,6 +32,19 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
$signed = \AKSRT\Credits\Signin::get_instance()->is_signed_today($user_id);
$classes = $class ?? ('but block c-yellow aksrt-header-checkin' . ($compact ? ' aksrt-header-checkin--compact' : ''));
// Card badge variant (explicit $class, e.g. the user-card 签到 badge):
// reference parity renders an <a> so the badge inherits the card font
// instead of the UA button stylesheet (font/UI 1:1 with the reference).
if ($class !== null) {
return '<a class="' . esc_attr($classes . ($signed ? ' is-done' : '')) . '" href="javascript:;" data-signin-btn'
. ' data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '"'
. ' data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '">'
. '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>'
. '<span data-signin-label>' . esc_html($signed ? __('已签到', 'aksrt') : __('签到', 'aksrt')) . '</span>'
. '</a>';
}
if ($signed) {
return '<button type="button" class="' . esc_attr($classes . ' is-done') . '" data-signin-btn data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '" data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '" disabled>'
. '<i class="fa fas fa-calendar-check" aria-hidden="true"></i>'