Skip to content

Commit df956f5

Browse files
committed
fix: a link cannot click sometimes
1 parent 31918fa commit df956f5

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

docs/.island/config.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ function getTutorialSidebar() {
7474
items: [
7575
{ text: 'Conventional Routing', link: '/guide/conventional-route' },
7676
{ text: 'Using MDX', link: '/guide/use-mdx' },
77-
{ text: 'Custom Page', link: '/guide/custom-page' }
77+
{ text: 'Custom Page', link: '/guide/custom-page' },
78+
{ text: 'SPA Mode', link: '/guide/spa-mode' },
79+
{ text: 'Static Assets', link: '/guide/static-assets' },
80+
{ text: 'Extension', link: '/guide/extension' }
7881
]
7982
}
8083
];

src/node/utils.ts

+16
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,19 @@ export const createHash = (info: string): string => {
1111
}
1212
return createHashFunc('sha256').update(info).digest('hex').slice(0, 8);
1313
};
14+
15+
export const parseUrl = (
16+
url: string
17+
): {
18+
url: string;
19+
query: string;
20+
hash: string;
21+
} => {
22+
const [withoutHash, hash = ''] = url.split('#');
23+
const [cleanedUrl, query = ''] = withoutHash.split('?');
24+
return {
25+
url: cleanedUrl,
26+
query,
27+
hash
28+
};
29+
};

src/runtime/sideEffects.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { inBrowser } from './utils';
22

3-
const DEFAULT_NAV_HEIGHT = 72;
3+
const DEFAULT_NAV_HEIGHT = 60;
44

55
// Control the scroll behavior of the browser when user clicks on a link
66
if (inBrowser()) {

src/theme-default/logic/useAsideAnchor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function isBottom() {
1010
);
1111
}
1212

13-
const NAV_HEIGHT = 72;
13+
const NAV_HEIGHT = 60;
1414

1515
export function useAsideAnchor(
1616
prevActiveLinkRef: React.MutableRefObject<HTMLAnchorElement | null>,

src/theme-default/styles/doc.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
.island-doc h6::before {
2222
display: block;
2323
content: '';
24-
margin-top: -70px;
25-
height: 70px;
24+
margin-top: -56px;
25+
height: 56px;
2626
visibility: hidden;
2727
pointer-events: none;
2828
}

src/theme-default/styles/vars.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@
323323
:root {
324324
--island-nav-height: var(--island-nav-height-mobile);
325325
--island-nav-height-mobile: 56px;
326-
--island-nav-height-desktop: 72px;
326+
--island-nav-height-desktop: 60px;
327327
}
328328

329329
@media (min-width: 960px) {

0 commit comments

Comments
 (0)