Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme-default): improve navbar sidebar links style #339

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/.vuepress/components/VPNavbarDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ watch(
color: inherit;
line-height: 1.7rem;

a {
.auto-link {
position: relative;

display: block;

margin-bottom: 0;
padding: 0 1.5rem 0 1.25rem;
padding: 0 1.25rem;
border-bottom: none;

font-weight: 400;
Expand All @@ -271,7 +271,7 @@ watch(
color: var(--vp-c-accent);
}

&.route-link-active {
&.auto-link-active {
color: var(--vp-c-accent);

&::after {
Expand Down Expand Up @@ -322,10 +322,10 @@ watch(
padding: 0 1.5rem 0 1.25rem;
}

> a {
> .auto-link {
font-weight: inherit;

&.route-link-active {
&.auto-link-active {
&::after {
display: none;
}
Expand Down
15 changes: 8 additions & 7 deletions docs/.vuepress/components/VPSidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,17 @@ onBeforeUnmount(() => {
font-weight: 600;
}

.vp-icon {
margin-inline-end: 0.25em;
.auto-link {
display: block;
}
}

a.vp-sidebar-item {
cursor: pointer;
&.auto-link {
display: block;
cursor: pointer;

&:hover {
color: var(--vp-c-accent);
&:hover {
color: var(--vp-c-accent);
}
}
}
</style>
12 changes: 3 additions & 9 deletions e2e/docs/.vuepress/components/ArticleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,9 @@ defineProps<{
transform: scaleX(0);
}

&:hover {
&::after {
visibility: visible;
transform: scaleX(1);
}
}

a {
color: inherit;
&:hover::after {
visibility: visible;
transform: scaleX(1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/.vuepress/layouts/Category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const categoryMap = useBlogCategory<ArticleInfo>('category')
font-size: 14px;
}

a {
.route-link {
color: inherit;
}

Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/.vuepress/layouts/Tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const tagMap = useBlogCategory<ArticleInfo>('tag')
font-size: 14px;
}

a {
.route-link {
color: inherit;
}

Expand Down
10 changes: 5 additions & 5 deletions themes/theme-default/src/client/components/VPNavbarDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ watch(
color: inherit;
line-height: 1.7rem;

a {
.auto-link {
position: relative;

display: block;

margin-bottom: 0;
padding: 0 1.5rem 0 1.25rem;
padding: 0 1.25rem;
border-bottom: none;

font-weight: 400;
Expand All @@ -257,7 +257,7 @@ watch(
color: var(--vp-c-accent);
}

&.route-link-active {
&.auto-link-active {
color: var(--vp-c-accent);

&::after {
Expand Down Expand Up @@ -308,10 +308,10 @@ watch(
padding: 0 1.5rem 0 1.25rem;
}

> a {
> .auto-link {
font-weight: inherit;

&.route-link-active {
&.auto-link-active {
&::after {
display: none;
}
Expand Down
15 changes: 8 additions & 7 deletions themes/theme-default/src/client/components/VPNavbarItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ useUpdateDeviceStatus(
display: none;
}

a {
display: inline-block;
.auto-link {
color: inherit;
line-height: 1.4rem;

&:hover,
&.route-link-active {
&.auto-link-active {
color: var(--vp-c-text);
}
}
Expand All @@ -88,16 +87,18 @@ useUpdateDeviceStatus(
margin-left: 0;
}

a {
.auto-link {
&:hover,
&.route-link-active {
&.auto-link-active {
color: var(--vp-c-accent);
}
}

> a {
> .auto-link {
display: inline-block;

&:hover,
&.route-link-active {
&.auto-link-active {
margin-bottom: -2px;
border-bottom: 2px solid var(--vp-c-accent);

Expand Down
2 changes: 1 addition & 1 deletion themes/theme-default/src/client/components/VPPageNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ useEventListener('keydown', (event): void => {
display: none;
}

.route-link {
.auto-link {
display: inline-block;
flex-grow: 1;

Expand Down
4 changes: 2 additions & 2 deletions themes/theme-default/src/client/components/VPSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defineSlots<{
@media (max-width: $MQMobile) {
display: block;

.vp-navbar-dropdown-item a.route-link-active::after {
.vp-navbar-dropdown-item .route-link-active::after {
top: calc(1rem - 2px);
}
}
Expand All @@ -97,7 +97,7 @@ defineSlots<{
list-style-type: none;
}

a {
.auto-link {
font-weight: 600;
}
}
Expand Down
15 changes: 10 additions & 5 deletions themes/theme-default/src/client/components/VPSidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,18 @@ onBeforeUnmount(() => {
color: var(--vp-c-accent);
font-weight: 600;
}
}

a.vp-sidebar-item {
cursor: pointer;
.auto-link {
display: block;
}

&:hover {
color: var(--vp-c-accent);
&.auto-link {
display: block;
cursor: pointer;

&:hover {
color: var(--vp-c-accent);
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ onMounted(() => {

// get the active sidebar item DOM, whose href equals to the current route
const activeSidebarItem = document.querySelector(
`.vp-sidebar a.vp-sidebar-item[href="${route.path}${hash}"]`,
`.vp-sidebar .vp-sidebar-item.auto-link[href="${route.path}${hash}"]`,
)
if (!activeSidebarItem) return

Expand Down Expand Up @@ -74,9 +74,5 @@ onMounted(() => {
padding: 0;
list-style-type: none;
}

a {
display: inline-block;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,8 @@ defineProps({
transform: scaleX(0);
}

&:hover {
&::after {
visibility: visible;
transform: scaleX(1);
}
}

a {
color: inherit;
&:hover::after {
visibility: visible;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const categoryMap = useBlogCategory('category')
padding-bottom: 0 !important;
font-size: 14px;

a {
.route-link {
color: inherit;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const tagMap = useBlogCategory('tag')
padding-bottom: 0 !important;
font-size: 14px;

a {
.route-link {
color: inherit;
}

Expand Down
Loading