Skip to content

Commit

Permalink
perf: 优化页面细节上的过渡效果
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed Feb 4, 2024
1 parent 42bf148 commit 526e8d1
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 39 deletions.
3 changes: 2 additions & 1 deletion theme/src/client/components/Flyout/MenuGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defineProps<{
padding: 12px 12px 0;
margin: 12px -12px 0;
border-top: 1px solid var(--vp-c-divider);
transition: border-top var(--t-color);
}
.menu-group:first-child {
Expand All @@ -45,6 +46,6 @@ defineProps<{
font-weight: 600;
line-height: 32px;
color: var(--vp-c-text-2);
transition: color 0.25s;
transition: color var(--t-color);
}
</style>
5 changes: 3 additions & 2 deletions theme/src/client/components/Flyout/MenuLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const page = usePageData()
padding: 12px 12px 0;
margin: 12px -12px 0;
border-top: 1px solid var(--vp-c-divider);
transition: border-top var(--t-color);
}
.link {
Expand All @@ -45,8 +46,8 @@ const page = usePageData()
white-space: nowrap;
border-radius: 6px;
transition:
background-color 0.25s,
color 0.25s;
background-color var(--t-color),
color var(--t-color);
}
.link:hover {
Expand Down
6 changes: 4 additions & 2 deletions theme/src/client/components/Flyout/VMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defineProps<{
border: 1px solid var(--vp-c-divider);
border-radius: 12px;
box-shadow: var(--vp-shadow-3);
transition: background-color 0.5s;
transition: background-color var(--t-color), border var(--t-color);
}
.menu-wrapper :deep(.group) {
Expand All @@ -46,6 +46,7 @@ defineProps<{
.menu-wrapper :deep(.group + .group) {
padding: 11px 12px 12px;
border-top: 1px solid var(--vp-c-divider);
transition: border-top var(--t-color);
}
.menu-wrapper :deep(.group:last-child) {
Expand All @@ -55,6 +56,7 @@ defineProps<{
.menu-wrapper :deep(.group + .item) {
padding: 11px 16px 0;
border-top: 1px solid var(--vp-c-divider);
transition: border-top var(--t-color);
}
.menu-wrapper :deep(.item) {
Expand All @@ -68,7 +70,7 @@ defineProps<{
font-weight: 500;
line-height: 28px;
color: var(--vp-c-text-2);
transition: color 0.5s;
transition: color var(--t-color);
}
.menu-wrapper :deep(.action) {
Expand Down
8 changes: 4 additions & 4 deletions theme/src/client/components/Flyout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
<style scoped>
.flyout-wrapper {
position: relative;
transition: color 0.25s;
transition: color var(--t-color);
}
.text {
Expand All @@ -76,14 +76,14 @@ export default {
font-weight: 500;
line-height: normal;
color: var(--vp-c-text-1);
transition: color 0.25s;
transition: color var(--t-color);
}
.icon {
width: 20px;
height: 20px;
fill: currentcolor;
transition: fill 0.25s;
transition: fill var(--t-color);
}
.menu {
Expand Down Expand Up @@ -131,7 +131,7 @@ export default {
height: var(--vp-nav-height);
padding: 0 10px;
color: var(--vp-c-text-1);
transition: color 0.5s;
transition: color var(--t-color);
}
.option-icon {
Expand Down
1 change: 0 additions & 1 deletion theme/src/client/components/Nav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ provide('close-screen', closeScreen)
z-index: var(--vp-z-index-nav);
width: 100%;
pointer-events: none;
transition: background-color 0.5s;
}
.nav-wrapper.fixed {
Expand Down
3 changes: 1 addition & 2 deletions theme/src/client/components/SocialLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ const svg = computed(() => {
width: 36px;
height: 36px;
color: var(--vp-c-text-2);
transition: color 0.5s;
transition: color var(--t-color);
}
.social-link:hover {
color: var(--vp-c-text-1);
transition: color 0.25s;
}
.social-link > :deep(svg) {
Expand Down
18 changes: 0 additions & 18 deletions theme/src/client/components/SwitchAppearance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,8 @@ function useAppearance() {
}
function setClass(dark: boolean): void {
const css = document.createElement('style')
css.type = 'text/css'
css.appendChild(
document.createTextNode(
`:not(.switch-appearance):not(.switch-appearance *) {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}`,
),
)
document.head.appendChild(css)
checked.value = dark
classList[dark ? 'add' : 'remove']('dark')
const _ = window.getComputedStyle(css).opacity
document.head.removeChild(css)
}
return toggle
Expand Down
6 changes: 2 additions & 4 deletions theme/src/client/components/VButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ function linkTo(e: Event) {
text-align: center;
white-space: nowrap;
border: 1px solid transparent;
transition:
color 0.25s,
border-color 0.25s,
background-color 0.25s;
transition: var(--t-color);
transition-property: border, color, background-color;
}
.VPButton:active {
Expand Down
16 changes: 11 additions & 5 deletions theme/src/client/components/VFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,24 @@ onMounted(() => {
.plume-footer {
position: relative;
z-index: var(--vp-z-index-footer);
padding: 32px 24px;
padding: 24px;
background-color: var(--vp-c-bg);
border-top: 1px solid var(--vp-c-gutter);
transition: all 0.25s;
transition: all var(--t-color);
}
.plume-footer p {
color: var(--vp-c-text-2);
transition: color var(--t-color);
}
.plume-footer :deep(a) {
color: var(--vp-c-text-2);
text-decoration-line: underline;
text-underline-offset: 2px;
transition:
color,
text-underline-offset 0.25s;
color var(--t-color),
text-underline-offset var(--t-color);
}
.plume-footer :deep(a:hover) {
Expand All @@ -63,7 +69,7 @@ onMounted(() => {
@media (min-width: 768px) {
.plume-footer {
padding: 32px;
padding: 24px;
}
}
Expand Down
2 changes: 2 additions & 0 deletions theme/src/client/components/global/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ withDefaults(defineProps<Props>(), {
line-height: 22px;
border: 1px solid transparent;
border-radius: 12px;
transition: var(--t-color);
transition-property: color, background-color, border-color;
transform: translateY(-2px);
}
Expand Down
1 change: 1 addition & 0 deletions theme/src/client/components/global/ExternalLinkIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const show = computed(() => matter.value.externalLink !== false)
height: 0.8em;
color: var(--vp-c-text-3);
vertical-align: middle;
transition: color var(--t-color);
}
@media print {
Expand Down

0 comments on commit 526e8d1

Please sign in to comment.