Skip to content

Commit

Permalink
perf(style): Remove redundant class attribute to simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo-Messi committed Aug 27, 2024
1 parent 351d977 commit a03ad6b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 29 deletions.
10 changes: 2 additions & 8 deletions packages/Lumen/components/Announcement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,26 @@ const prelink = computed(() => frontmatter.value.hero?.prelink)
:href="prelink.link"
:target="prelink.target"
rel="noopener"
class="custom-link"
class="prelink"
>
<span v-html="prelink.title"></span>
</a>
</template>

<style lang="scss" scoped>
.custom-link {
.prelink {
display: inline-flex;
align-items: center;
border-radius: 0.8rem;
padding: 0.3rem 1.5rem;
font-size: 0.8rem;
font-weight: 600;
margin-bottom: 1rem;
border: 1px solid var(--vp-button-alt-border);
color: var(--vp-button-alt-text);
background-color: var(--vp-button-alt-bg);
text-decoration: none !important;
transition:
background-color 0.3s ease,
transform 0.2s ease;
&:hover {
border-color: var(--vp-button-alt-hover-border);
color: var(--vp-button-alt-hover-text);
background-color: var(--vp-button-alt-hover-bg);
transform: translateY(-1px);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/Lumen/components/DocAsideLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ export default defineComponent({
transform: scale(1.75);
}
.hide,
.info {
.hide {
opacity: 0.9;
}
Expand Down
9 changes: 2 additions & 7 deletions packages/Lumen/components/DocBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default defineComponent({
<!-- 如果有标签,则显示标签 -->
<span v-if="item.tag" class="tag">{{ item.tag }}</span>
<!-- 如果图标是图片,则显示图片 -->
<span v-if="isImage(item.icon)" class="icon-container">
<span v-if="isImage(item.icon)">
<img :src="item.icon" alt="icon" class="icon-container" />
</span>
<!-- 如果图标不是图片,则显示 Font Awesome 图标 -->
Expand Down Expand Up @@ -114,12 +114,7 @@ export default defineComponent({
</template>

<style lang="scss" scoped>
/* 在非深色模式下隐藏深色模式图标 */
:root:not(.dark) .dark-only {
display: none;
}
/* 在深色模式下隐藏浅色模式图标 */
:root:not(.dark) .dark-only,
:root:is(.dark) .light-only {
display: none;
}
Expand Down
7 changes: 1 addition & 6 deletions packages/Lumen/components/DocBoxCube.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,7 @@ export default defineComponent({
</template>

<style lang="scss" scoped>
/* 在非深色模式下隐藏深色模式图标 */
:root:not(.dark) .dark-only {
display: none;
}
/* 在深色模式下隐藏浅色模式图标 */
:root:not(.dark) .dark-only,
:root:is(.dark) .light-only {
display: none;
}
Expand Down
7 changes: 1 addition & 6 deletions packages/Lumen/components/DocLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,7 @@ export default defineComponent({
</template>

<style lang="scss" scoped>
/* 在非深色模式下隐藏深色模式图标 */
:root:not(.dark) .dark-only {
display: none;
}
/* 在深色模式下隐藏浅色模式图标 */
:root:not(.dark) .dark-only,
:root:is(.dark) .light-only {
display: none;
}
Expand Down

0 comments on commit a03ad6b

Please sign in to comment.