wp-chinese-converter/assets/css/blocks-frontend.css
feibisi 2e42b5bb83 Refactor block styles registration and update frontend CSS
Moved block styles registration to a dedicated method hooked to 'init', allowing block.json to reference registered styles. Updated frontend CSS for language switcher and conversion status for improved appearance and consistency, and removed visual styles from non-conversion blocks on the frontend.
2025-11-07 20:21:18 +08:00

240 lines
4.7 KiB
CSS

.wpcc-language-switcher {
margin: 1rem 0;
}
.wpcc-language-switcher.wpcc-horizontal {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.wpcc-language-switcher.wpcc-dropdown {
display: inline-block;
}
.wpcc-horizontal-switcher {
display: flex;
gap: 6px;
align-items: center;
flex-wrap: wrap;
}
.wpcc-lang-item {
display: inline-block;
}
.wpcc-lang-item .wpcc-link {
display: inline-block;
padding: 4px 10px;
background: #f0f0f0;
color: #333;
text-decoration: none;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 12px;
transition: background-color 0.2s ease, border-color 0.2s ease;
}
.wpcc-lang-item .wpcc-link:hover {
background: #e0e0e0;
border-color: #ccc;
}
.wpcc-lang-item.wpcc-current .wpcc-link {
background: #0073aa;
color: #fff;
border-color: #0073aa;
}
.wpcc-lang-item.wpcc-current .wpcc-link:hover {
background: #005a87;
border-color: #005a87;
}
.wpcc-lang-item.wpcc-no-conversion .wpcc-link {
background: #f9f9f9;
color: #666;
border-color: #ddd;
}
.wpcc-lang-item.wpcc-no-conversion .wpcc-link:hover {
background: #f0f0f0;
border-color: #ccc;
}
.wpcc-dropdown-switcher {
padding: 6px 8px;
border: 1px solid #ddd;
background: #fff;
font-size: 12px;
cursor: pointer;
min-width: 150px;
border-radius: 5px;
transition: border-color 0.2s ease;
}
.wpcc-dropdown-switcher:hover {
border-color: #bbb;
}
.wpcc-dropdown-switcher:focus {
outline: 2px solid #0073aa;
outline-offset: 0;
border-color: #0073aa;
}
.wpcc-conversion-status {
margin: 0.5rem 0;
display: inline-block;
}
.wpcc-status-container {
display: flex;
align-items: center;
gap: 6px;
}
.wpcc-status-text {
font-size: 12px;
color: #333;
}
.wpcc-conversion-status.wpcc-format-badge .wpcc-status-text {
background: #0073aa;
color: #fff;
padding: 2px 6px;
border-radius: 3px;
font-size: 11px;
}
.wpcc-conversion-status.wpcc-format-text .wpcc-status-text {
color: #333;
font-size: 12px;
}
.wpcc-conversion-status.wpcc-format-minimal .wpcc-status-text {
font-size: 11px;
color: #666;
}
/* 不转换区块在前台不显示任何视觉样式 */
.wpcc-no-conversion-wrapper {
/* 仅保留功能性标记,无视觉样式 */
}
.wpcc-no-conversion-header {
display: none; /* 前台隐藏标题 */
}
.wpcc-label {
display: none; /* 前台隐藏标签 */
}
.wpcc-no-conversion-content {
/* 内容正常显示,无额外样式 */
}
@media (max-width: 768px) {
.wpcc-horizontal-switcher {
display: flex;
align-items: stretch;
flex-direction: column;
flex-direction: row;
flex-wrap: nowrap;
gap: 6px;
}
.wpcc-lang-item {
width: 100%;
}
.wpcc-lang-item .wpcc-link {
padding: 8px 12px;
font-size: 14px;
text-align: center;
width: 100%;
box-sizing: border-box;
}
.wpcc-dropdown-switcher {
width: 100%;
padding: 8px 12px;
font-size: 14px;
}
}
.wpcc-language-switcher.wpcc-size-small .wpcc-lang-item .wpcc-link {
padding: 2px 6px;
font-size: 11px;
}
.wpcc-language-switcher.wpcc-size-large .wpcc-lang-item .wpcc-link {
padding: 6px 12px;
font-size: 15px;
}
.wpcc-language-switcher.wpcc-size-small .wpcc-dropdown-switcher {
padding: 4px 6px;
font-size: 11px;
min-width: 120px;
}
.wpcc-language-switcher.wpcc-size-large .wpcc-dropdown-switcher {
padding: 8px 12px;
font-size: 15px;
min-width: 180px;
}
/* 前台所有不转换区块的边框变体都不显示 */
.wpcc-no-conversion-wrapper.wpcc-border-solid,
.wpcc-no-conversion-wrapper.wpcc-border-dashed,
.wpcc-no-conversion-wrapper.wpcc-border-none {
border: none;
background: transparent;
padding: 0;
margin: 0;
}
.wpcc-conversion-status.wpcc-clickable {
cursor: pointer;
}
.wpcc-conversion-status.wpcc-clickable:hover .wpcc-status-text {
text-decoration: underline;
}
.wpcc-language-switcher.wpcc-size-small .wpcc-horizontal-switcher {
gap: 4px;
}
.wpcc-language-switcher.wpcc-size-large .wpcc-horizontal-switcher {
gap: 12px;
}
.wpcc-language-switcher.wpcc-size-small .wpcc-dropdown-switcher {
height: 28px;
}
.wpcc-language-switcher.wpcc-size-large .wpcc-dropdown-switcher {
height: 44px;
}
.wpcc-language-switcher .wpcc-lang-item .wpcc-link[target="_blank"]::after {
content: " ↗";
font-size: 0.8em;
opacity: 0.7;
margin-left: 2px;
}
.wpcc-language-switcher .wpcc-custom-label {
font-weight: 500;
}
.wpcc-language-switcher.wpcc-sorted-alphabetical .wpcc-lang-item {
order: 1;
}
.wpcc-language-switcher.wpcc-current-first .wpcc-lang-item.wpcc-current {
order: -1;
}