Skip to content

Commit a772f63

Browse files
committed
chore: review comments
1 parent a437229 commit a772f63

File tree

7 files changed

+58
-46
lines changed

7 files changed

+58
-46
lines changed

starters/apps/library/src/components/counter/counter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { component$, PropsOf, useSignal } from "@qwik.dev/core";
1+
import { component$, useSignal } from "@qwik.dev/core";
22

3-
export const Counter = component$<PropsOf<"div">>(() => {
3+
export const Counter = component$(() => {
44
const count = useSignal(0);
55

66
return (

starters/apps/library/src/components/logo/logo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { component$, PropsOf } from "@qwik.dev/core";
1+
import { component$ } from "@qwik.dev/core";
22

3-
export const Logo = component$<PropsOf<"div">>(() => {
3+
export const Logo = component$(() => {
44
return (
55
<div>
66
<a href="https://qwik.dev/">

starters/apps/library/src/entry.dev.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
/**
22
* WHAT IS THIS FILE?
33
*
4-
* SSR entry point, in all cases the application is rendered outside the browser, this
5-
* entry point will be the common one.
6-
*
7-
* - Server (express, cloudflare...)
8-
* - npm run start
9-
* - npm run preview
10-
* - npm run build
4+
* SSR renderer function, used by Qwik Router.
115
*
6+
* Note that this is the only place the Qwik renderer is called.
7+
* On the client, containers resume and do not call render.
128
*/
13-
import {
14-
renderToStream,
15-
type RenderToStreamOptions,
16-
} from "@qwik.dev/core/server";
9+
import { createRenderer } from "@qwik.dev/router";
1710
import Root from "./root";
1811

19-
export default function (opts: RenderToStreamOptions) {
20-
return renderToStream(<Root />, opts);
21-
}
12+
export default createRenderer((opts) => {
13+
return {
14+
jsx: <Root />,
15+
options: {
16+
...opts,
17+
// Use container attributes to set attributes on the html tag.
18+
containerAttributes: {
19+
lang: "en-us",
20+
...opts.containerAttributes,
21+
},
22+
serverData: {
23+
...opts.serverData,
24+
// These are the default values for the document head and are overridden by the `head` exports
25+
// documentHead: {
26+
// title: "My App",
27+
// },
28+
},
29+
},
30+
};
31+
});

starters/apps/library/src/root.tsx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
1-
import { QwikRouterProvider, RouterOutlet } from "@qwik.dev/router";
1+
import { component$ } from "@qwik.dev/core";
2+
import {
3+
DocumentHeadTags,
4+
RouterOutlet,
5+
useLocation,
6+
useQwikRouter,
7+
} from "@qwik.dev/router";
8+
9+
import "./global.css";
10+
11+
export default component$(() => {
12+
useQwikRouter();
13+
const { url } = useLocation();
14+
15+
/**
16+
* This is the root of a QwikRouter site. It contains the document's `<head>` and `<body>`. You can adjust them as you see fit.
17+
*/
218

3-
export default () => {
419
return (
5-
<QwikRouterProvider>
20+
<>
621
<head>
722
<meta charset="utf-8" />
8-
<title>Qwik Blank App</title>
23+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
24+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
25+
26+
<DocumentHeadTags />
27+
28+
<link rel="canonical" href={url.href} />
929
</head>
1030
<body>
1131
<RouterOutlet />
1232
</body>
13-
</QwikRouterProvider>
33+
</>
1434
);
15-
};
35+
});

starters/apps/library/src/routes/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ export default component$(() => {
77
<>
88
<h1>Qwik Library Starter</h1>
99
<p>
10-
This is a Qwik library starter. Make your components and export them
11-
from `src/index.ts`. This playground app will not be bundled with your
12-
library. You can use the Router like a normal Qwik app with the Qwik
13-
Router.
10+
This is a playground meant for testing your library. Make your
11+
components and export them from `src/index.ts`. This playground app will
12+
not be bundled with your library. You can use the Router like a normal
13+
Qwik app with the Qwik Router.
1414
</p>
1515
<Logo />
1616
<Counter />

starters/apps/library/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"strict": true,
1010
"declaration": true,
1111
"declarationDir": "lib",
12-
"rootDir": "src",
1312
"resolveJsonModule": true,
1413
"moduleResolution": "Bundler",
1514
"esModuleInterop": true,

0 commit comments

Comments
 (0)