From e43c59aae0f743be5da682266b11e53001911b59 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sat, 2 Mar 2024 22:02:31 +0800 Subject: [PATCH] Simplify css naming Signed-off-by: Ryan Wang --- .../src/base-comment-item-action.ts | 20 +++--- .../comment-widget/src/base-comment-item.ts | 36 +++++----- packages/comment-widget/src/base-form.ts | 70 +++++++++---------- packages/comment-widget/src/comment-item.ts | 4 +- .../comment-widget/src/comment-pagination.ts | 26 +++---- .../comment-widget/src/comment-replies.ts | 8 +-- packages/comment-widget/src/comment-widget.ts | 10 +-- packages/comment-widget/src/reply-item.ts | 14 ++-- packages/comment-widget/src/user-avatar.ts | 18 ++--- 9 files changed, 103 insertions(+), 103 deletions(-) diff --git a/packages/comment-widget/src/base-comment-item-action.ts b/packages/comment-widget/src/base-comment-item-action.ts index 0200ba0..219a7c3 100644 --- a/packages/comment-widget/src/base-comment-item-action.ts +++ b/packages/comment-widget/src/base-comment-item-action.ts @@ -8,24 +8,24 @@ export class BaseCommentItemAction extends LitElement { override render() { return html` -
-
+
+
- ${this.text} + ${this.text}
`; } static override styles = css` - .base-comment-item-action { + .item-action { display: inline-flex; align-items: center; cursor: pointer; margin-right: 0.5rem; } - .base-comment-item-action-icon { + .item-action__icon { display: inline-flex; align-items: center; justify-content: center; @@ -36,26 +36,26 @@ export class BaseCommentItemAction extends LitElement { padding: 0.45rem; } - .base-comment-item-action-icon ::slotted(svg) { + .item-action__icon ::slotted(svg) { color: var(--component-comment-item-action-color); width: 1rem; height: 1rem; } - .base-comment-item-action-text { + .item-action__text { color: var(--component-comment-item-action-color); user-select: none; } - .base-comment-item-action:hover .base-comment-item-action-icon { + .item-action:hover .item-action__icon { background-color: var(--component-comment-item-action-bg-color-hover); } - .base-comment-item-action:hover .base-comment-item-action-text { + .item-action:hover .item-action__text { color: var(--component-comment-item-action-color-hover); } - .base-comment-item-action:hover .base-comment-item-action-icon ::slotted(svg) { + .item-action:hover .item-action__icon ::slotted(svg) { color: var(--component-comment-item-action-color-hover); } `; diff --git a/packages/comment-widget/src/base-comment-item.ts b/packages/comment-widget/src/base-comment-item.ts index 269d818..4b09714 100644 --- a/packages/comment-widget/src/base-comment-item.ts +++ b/packages/comment-widget/src/base-comment-item.ts @@ -26,25 +26,25 @@ export class BaseCommentItem extends LitElement { content = ''; override render() { - return html`
-
+ return html`
+
-
-
-
${this.userDisplayName}
-
${timeAgo(this.creationTime)}
- ${!this.approved ? html`
审核中
` : ''} +
+
+
${this.userDisplayName}
+
${timeAgo(this.creationTime)}
+ ${!this.approved ? html`
审核中
` : ''}
-
+
${this.content}
-
+
@@ -57,48 +57,48 @@ export class BaseCommentItem extends LitElement { varStyles, baseStyles, css` - .base-comment-item { + .item { display: flex; gap: 0.75rem; padding: 1rem 0; } - .base-comment-item-main { + .item__main { flex: 1; } - .base-comment-item-meta { + .item__meta { display: flex; align-items: center; gap: 0.75rem; } - .base-comment-item-author { + .item__author { font-weight: 500; } - .base-comment-item-meta-info { + .item__meta-info { color: darkcyan; font-size: 0.75rem; line-height: 1rem; } - .base-comment-item-content { + .item__content { margin-top: 0.5rem; } - .base-comment-item-content pre { + .item__content pre { white-space: pre-wrap; overflow-wrap: break-word; } - .base-comment-item-actions { + .item__actions { margin-top: 0.5rem; display: flex; align-items: center; } - .animate-breath { + .item--animate-breath { animation: breath 1s ease-in-out infinite; } diff --git a/packages/comment-widget/src/base-form.ts b/packages/comment-widget/src/base-form.ts index d7e10d1..ed46158 100644 --- a/packages/comment-widget/src/base-form.ts +++ b/packages/comment-widget/src/base-form.ts @@ -132,10 +132,10 @@ export class BaseForm extends LitElement { } renderAccountInfo() { - return html`