Skip to content

Commit a8f632f

Browse files
authored
fix: scroll on refresh (#1118)
1 parent 8410839 commit a8f632f

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

app.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export default defineConfig(
7171
themes: ["min-light", "material-theme-ocean"],
7272
themeCssSelector: (theme) => `[data-theme="${theme.type}"]`,
7373
frames: false,
74+
styleOverrides: {
75+
twoSlash: {
76+
cursorColor: "var(--twoslash-cursor)",
77+
},
78+
},
7479
},
7580
toc: {
7681
minDepth: 2,

src/routes/solid-meta/reference/meta/title.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Title } from "@solidjs/meta";
1515

1616
### Setting the title for your site
1717

18-
```tsx twoslash filename="root.tsx" {5}
18+
```tsx twoslash title="root.tsx" {5}
1919
import { MetaProvider, Title } from "@solidjs/meta";
2020
export default function Root() {
2121
return (

src/routes/solid-start/advanced/request-events.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SolidStart uses `event.locals` to pass around a local context where needed.
1111

1212
When adding fields to `event.locals`, the fields can be typed:
1313

14-
```tsx filename="global.d.ts'
14+
```tsx title="global.d.ts"
1515
/// <reference types="@solidjs/start/env" />
1616
declare module App {
1717
interface RequestEventLocals {

src/routes/solid-start/building-your-application/routing.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Without this, you could see some unexpected hydration errors.
4343
`<FileRoutes />` will generate a route for each file in the `routes` directory and its subdirectories. For a route to be rendered as a page, it must default export a component.
4444
This component represents the content that will be rendered when users visit the page:
4545

46-
```tsx filename="routes/index.tsx"
46+
```tsx title="routes/index.tsx"
4747
export default function Index() {
4848
return <div>Welcome to my site!</div>;
4949
}
@@ -91,7 +91,7 @@ by using `props.children` in the layout.
9191

9292
<TabsCodeBlocks>
9393
<div id="ts">
94-
```tsx filename="routes/blog.tsx" title="blog.tsx"
94+
```tsx title="routes/blog.tsx"
9595
import { RouteSectionProps } from "@solidjs/router";
9696

9797
export default function BlogLayout(props: RouteSectionProps) {
@@ -100,7 +100,7 @@ export default function BlogLayout(props: RouteSectionProps) {
100100
```
101101
</div>
102102
<div id="js">
103-
```jsx filename="routes/blog.jsx" title="blog.tsx"
103+
```jsx title="routes/blog.jsx"
104104
export default function BlogLayout(props) {
105105
return <div>{props.children}</div>;
106106
}

src/styles.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
html,
2020
.custom-scrollbar {
21-
scroll-behavior: smooth;
2221
scroll-padding-top: 6rem;
2322

2423
scrollbar-color: #778292 #e7ecf2;
@@ -127,4 +126,13 @@
127126
/* pace from solidbase */
128127
:root {
129128
--bprogress-color: theme('colors.blue.500') !important;
129+
}
130+
131+
/* twoslash from solidbase */
132+
html {
133+
--twoslash-cursor: #24292E;
134+
}
135+
136+
html[data-theme="dark"] {
137+
--twoslash-cursor: #BABED8;
130138
}

src/ui/page-issue-link.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, createMemo } from "solid-js";
1+
import { Component, createMemo, createSignal, onMount } from "solid-js";
22
import { Icon } from "solid-heroicons";
33
import { exclamationTriangle } from "solid-heroicons/outline";
44
import { useI18n } from "~/i18n/i18n-context";
@@ -7,6 +7,10 @@ import { getEntryFileName } from "~/i18n/helpers";
77
export const PageIssueLink: Component = () => {
88
const i18n = useI18n();
99

10+
const [mounted, setMounted] = createSignal(false);
11+
12+
onMount(() => setMounted(true));
13+
1014
const srcPath = createMemo(() => {
1115
return (
1216
"https://github.com/solidjs/solid-docs-next/issues/new" +
@@ -16,7 +20,7 @@ export const PageIssueLink: Component = () => {
1620
"&template=CONTENT.yml" +
1721
"&title=[Content]:" +
1822
`&subject=${getEntryFileName()}` +
19-
`&page=${window.location.href}`
23+
`&page=${mounted() ? window.location.href : ""}`
2024
);
2125
});
2226

0 commit comments

Comments
 (0)