fix(widgets): align user card action buttons
This commit is contained in:
+1
-58
@@ -4962,13 +4962,6 @@ body:has(.modal.in) .float-btn,
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-content .article-docs-footer a icon {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
font-size: 13px;
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-content .article-docs-footer a text {
|
.article-content .article-docs-footer a text {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
@@ -7992,8 +7985,7 @@ badge.top,
|
|||||||
color: var(--focus-color);
|
color: var(--focus-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabbar-item > svg,
|
.tabbar-item > svg {
|
||||||
.tabbar-item > icon {
|
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
@@ -8035,12 +8027,6 @@ badge.top,
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabbar-item .btn-newadd icon {
|
|
||||||
width: 46px;
|
|
||||||
height: 46px;
|
|
||||||
margin: 0 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabbar-item .btn-newadd text {
|
.tabbar-item .btn-newadd text {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
@@ -9070,32 +9056,6 @@ img.alignleft {
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drop-newadd icon,
|
|
||||||
.share-btn icon {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
display: inline-flex;
|
|
||||||
border-radius: 100%;
|
|
||||||
background: var(--main-border-color);
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 22px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drop-newadd icon > svg {
|
|
||||||
margin: 0 !important;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.share-btn icon .icon {
|
|
||||||
margin: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.share-button .share-btn icon {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.share-button .share-btn .icon {
|
.share-button .share-btn .icon {
|
||||||
width: 1em;
|
width: 1em;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
@@ -9116,14 +9076,6 @@ img.alignleft {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.horizontal .share-btn icon {
|
|
||||||
display: flex;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drop-newadd {
|
.drop-newadd {
|
||||||
border-radius: var(--main-radius);
|
border-radius: var(--main-radius);
|
||||||
}
|
}
|
||||||
@@ -9134,11 +9086,6 @@ img.alignleft {
|
|||||||
color: var(--muted-color);
|
color: var(--muted-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.drop-newadd icon {
|
|
||||||
margin-right: 6px;
|
|
||||||
background: var(--this-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.drop-newadd .btn-newadd {
|
.drop-newadd .btn-newadd {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -12837,10 +12784,6 @@ body.error404 {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tilt-cases-actions .but > icon {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tilt-cases-actions .but:hover {
|
.tilt-cases-actions .but:hover {
|
||||||
transform: translateY(-2px);
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -222,7 +222,7 @@ final class UserRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡片按钮1(legacy zib_get_new_add_btns 的 post 类型 parity)。
|
* 卡片按钮1(legacy zib_get_new_add_btns 的单按钮 parity:正则剥掉 icon/text,输出纯文字药丸)。
|
||||||
*/
|
*/
|
||||||
private static function new_add_btn(string $type, string $class, string $text): string {
|
private static function new_add_btn(string $type, string $class, string $text): string {
|
||||||
if ($type !== 'post') {
|
if ($type !== 'post') {
|
||||||
@@ -232,7 +232,7 @@ final class UserRenderer {
|
|||||||
if ($url === '') {
|
if ($url === '') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return '<a rel="nofollow" class="newadd-btns ' . esc_attr($class) . '" href="' . esc_url($url) . '"><icon class="jb-green"><i class="fa fas fa-edit" aria-hidden="true"></i></icon><text>' . esc_html($text) . '</text></a>';
|
return '<a rel="nofollow" class="newadd-btns ' . esc_attr($class) . '" href="' . esc_url($url) . '">' . esc_html($text) . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function card_link(string $url, string $class, string $text, bool $nofollow = false): string {
|
private static function card_link(string $url, string $class, string $text, bool $nofollow = false): string {
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ test('user and author widgets render the reference state contract', () => {
|
|||||||
assert.match(data.logged, /<div class="user-desc mt10 muted-2-color em09">/)
|
assert.match(data.logged, /<div class="user-desc mt10 muted-2-color em09">/)
|
||||||
assert.doesNotMatch(data.logged, /data-post-type=/)
|
assert.doesNotMatch(data.logged, /data-post-type=/)
|
||||||
|
|
||||||
|
assert.match(data.logged_buttons, /class="newadd-btns but pw-1em mr6 jb-pink" href="https:\/\/example\.test\/new-post">发布文章<\/a>/)
|
||||||
|
assert.match(data.logged_buttons, /rel="nofollow" href="https:\/\/example\.test\/user-center" class="but pw-1em ml6 jb-blue">用户中心<\/a>/)
|
||||||
|
assert.doesNotMatch(data.logged_buttons, /<icon|<text>/)
|
||||||
|
|
||||||
assert.match(data.author, /^<div class="mb20"><div class="user-card zib-widget widget">/)
|
assert.match(data.author, /^<div class="mb20"><div class="user-card zib-widget widget">/)
|
||||||
assert.match(data.author, /data-lazy-type="lazy_cover"/)
|
assert.match(data.author, /data-lazy-type="lazy_cover"/)
|
||||||
assert.match(data.author, /data-post-type="post" data-post-style="card"/)
|
assert.match(data.author, /data-post-type="post" data-post-style="card"/)
|
||||||
|
|||||||
@@ -152,6 +152,12 @@ namespace {
|
|||||||
'show_button' => false,
|
'show_button' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$logged_buttons = aksrt_render_user_widget_state('user_card', [
|
||||||
|
'show_img_bg' => false,
|
||||||
|
'button_1_text' => '发布文章',
|
||||||
|
'button_2_text' => '用户中心',
|
||||||
|
]);
|
||||||
|
|
||||||
$GLOBALS['aksrt_user_card_state']['current_user_id'] = 2;
|
$GLOBALS['aksrt_user_card_state']['current_user_id'] = 2;
|
||||||
$GLOBALS['aksrt_user_card_state']['post'] = new WP_Post(33, 9);
|
$GLOBALS['aksrt_user_card_state']['post'] = new WP_Post(33, 9);
|
||||||
$author = aksrt_render_user_widget_state('author_card', [
|
$author = aksrt_render_user_widget_state('author_card', [
|
||||||
@@ -168,6 +174,7 @@ namespace {
|
|||||||
'guest_no_registration' => $guest_no_registration,
|
'guest_no_registration' => $guest_no_registration,
|
||||||
'closed' => $closed,
|
'closed' => $closed,
|
||||||
'logged' => $logged,
|
'logged' => $logged,
|
||||||
|
'logged_buttons' => $logged_buttons,
|
||||||
'author' => $author,
|
'author' => $author,
|
||||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user