create-skybridge 2.0.0-alpha.ea364cb → 2.0.0-alpha.ff0caf0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@/index.css";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useUser } from "skybridge/web";
|
|
5
5
|
import Nav from "./components/nav.js";
|
|
6
6
|
import Progress from "./components/progress.js";
|
|
7
7
|
import Outro from "./components/steps/outro.js";
|
|
@@ -18,8 +18,8 @@ const STEPS = [
|
|
|
18
18
|
] as const;
|
|
19
19
|
|
|
20
20
|
export default function Onboarding() {
|
|
21
|
-
//
|
|
22
|
-
const { theme } =
|
|
21
|
+
// useUser: read user environment info (theme, locale, user agent).
|
|
22
|
+
const { theme } = useUser();
|
|
23
23
|
|
|
24
24
|
const [step, setStep] = useState(0);
|
|
25
25
|
const { img } = useMascot();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useUser } from "skybridge/web";
|
|
3
3
|
import { darkTheme, lightTheme } from "../design/tokens";
|
|
4
4
|
import { cx } from "../lib/cx";
|
|
5
5
|
import { viewFrame } from "./view-frame.css";
|
|
@@ -10,8 +10,8 @@ import { viewFrame } from "./view-frame.css";
|
|
|
10
10
|
* variables the color contract declares) and paints the base surface + font +
|
|
11
11
|
* content color so descendants inherit from the DS instead of the host page.
|
|
12
12
|
*
|
|
13
|
-
* It follows the host theme via
|
|
14
|
-
* (e.g. always light), drop
|
|
13
|
+
* It follows the host theme via useUser(). To lock the widget to one palette
|
|
14
|
+
* (e.g. always light), drop useUser and hardcode the theme class.
|
|
15
15
|
*
|
|
16
16
|
* Keep view entry files thin: render <ViewFrame> at the root and let this carry
|
|
17
17
|
* the theme + base-style boilerplate.
|
|
@@ -19,7 +19,7 @@ import { viewFrame } from "./view-frame.css";
|
|
|
19
19
|
type ViewFrameProps = HTMLAttributes<HTMLDivElement>;
|
|
20
20
|
|
|
21
21
|
export function ViewFrame({ className, ...rest }: ViewFrameProps) {
|
|
22
|
-
const { theme } =
|
|
22
|
+
const { theme } = useUser();
|
|
23
23
|
const themeClass = theme === "dark" ? darkTheme : lightTheme;
|
|
24
24
|
|
|
25
25
|
return <div {...rest} className={cx(themeClass, viewFrame, className)} />;
|