diff --git a/packages/shared/src/client/demo/demo.module.scss b/packages/shared/src/client/demo/demo.module.scss index f8b009d0..5f9e1e7e 100644 --- a/packages/shared/src/client/demo/demo.module.scss +++ b/packages/shared/src/client/demo/demo.module.scss @@ -1,35 +1,35 @@ .codeDisplay { - padding: 10px; - .hide { + padding: 10px; + .hide { + display: none; + } + summary { + cursor: pointer; + } + &[open] { + .show { display: none; } - summary { - cursor: pointer; + .hide { + display: inline; } - &[open] { - .show { - display: none; + } + .tabs { + margin-bottom: -10px; + text-wrap: nowrap; + overflow: auto; + button { + all: unset; + cursor: pointer; + padding: 10px 20px; + &.active { + background: #2465; } - .hide { - display: inline; - } - } - .tabs { - margin-bottom: -10px; - text-wrap: nowrap; - overflow: auto; - button { - all: unset; - cursor: pointer; - padding: 10px 20px; - &.active { - background: #2465; - } - &:hover { - background: #2495; - } + &:hover { + background: #2495; } } + } } .flex { @@ -37,9 +37,23 @@ justify-content: center; align-items: center; flex-wrap: wrap; - gap: 20px; + gap: 25px; + & > * { + box-shadow: 0 0 5px red; + padding: 20px; + border-radius: 10px; + } +} +.header { + display: flex; + box-shadow: 0 0 5px red; + align-items: center; + margin: 0 -30px; + margin-bottom: 30px; + padding: 0 30px; + justify-content: center; + gap: 35px; } - .demo { width: var(--max-width); max-width: 95vw; @@ -53,7 +67,7 @@ & > * { flex-grow: 1; } - + img { display: block; max-width: 500px; @@ -65,6 +79,10 @@ h2 { text-align: center; } + button { + cursor: pointer; + margin: 5px 10px; + } } .preview { diff --git a/packages/shared/src/client/demo/demo.tsx b/packages/shared/src/client/demo/demo.tsx index c3b64be4..665f7ab0 100644 --- a/packages/shared/src/client/demo/demo.tsx +++ b/packages/shared/src/client/demo/demo.tsx @@ -9,6 +9,9 @@ import { WithSelector } from "./with-selectors"; import withSelectorCode from "./with-selectors/with-selectors.tsx?raw"; import storeCode from "./with-selectors/store.ts?raw"; import couter2Code from "./with-selectors/counter.tsx?raw"; +import counterWithoutSelectorscode from "./with-selectors/counter-without-selectors.tsx?raw"; +import headerCode from "./with-selectors/header.tsx?raw"; +import userDataCode from "./with-selectors/user-data.tsx?raw"; const basicExCode = [ { filename: "counter.tsx", code: counterCode }, @@ -17,7 +20,10 @@ const basicExCode = [ const withSelectorExCode = [ { filename: "store.ts", code: storeCode }, + { filename: "header.tsx", code: headerCode }, { filename: "counter.tsx", code: couter2Code }, + { filename: "counter-without-selectors.tsx", code: counterWithoutSelectorscode }, + { filename: "user-data.tsx", code: userDataCode }, { filename: "with-selectors.tsx", code: withSelectorCode }, ]; diff --git a/packages/shared/src/client/demo/with-selectors/counter-without-selectors.tsx b/packages/shared/src/client/demo/with-selectors/counter-without-selectors.tsx index 526f86d3..9ccb1432 100644 --- a/packages/shared/src/client/demo/with-selectors/counter-without-selectors.tsx +++ b/packages/shared/src/client/demo/with-selectors/counter-without-selectors.tsx @@ -7,8 +7,8 @@ export function CounterWithoutSelectors() { renderCount.current++; return (
Rerender is triggered every time the state changes.
Count: {count}
diff --git a/packages/shared/src/client/demo/with-selectors/counter.tsx b/packages/shared/src/client/demo/with-selectors/counter.tsx index 204b7860..d8984595 100644 --- a/packages/shared/src/client/demo/with-selectors/counter.tsx +++ b/packages/shared/src/client/demo/with-selectors/counter.tsx @@ -7,8 +7,8 @@ export function Counter() { renderCount.current++; return (Rerender is triggered by RGS only when count changes.
Count: {count}
diff --git a/packages/shared/src/client/demo/with-selectors/header.tsx b/packages/shared/src/client/demo/with-selectors/header.tsx index a6fe377a..517d5a57 100644 --- a/packages/shared/src/client/demo/with-selectors/header.tsx +++ b/packages/shared/src/client/demo/with-selectors/header.tsx @@ -1,12 +1,13 @@ import { useRef } from "react"; import { useStore } from "./store"; +import styles from "../demo.module.scss"; export function Header() { const [{ name }] = useStore("name"); const renderCount = useRef(0); renderCount.current++; return ( -