diff options
Diffstat (limited to 'examples/framework-preact/src')
-rw-r--r-- | examples/framework-preact/src/components/Counter.css | 11 | ||||
-rw-r--r-- | examples/framework-preact/src/components/Counter.tsx | 5 | ||||
-rw-r--r-- | examples/framework-preact/src/pages/index.astro | 18 |
3 files changed, 19 insertions, 15 deletions
diff --git a/examples/framework-preact/src/components/Counter.css b/examples/framework-preact/src/components/Counter.css new file mode 100644 index 000000000..5d3de4803 --- /dev/null +++ b/examples/framework-preact/src/components/Counter.css @@ -0,0 +1,11 @@ +.counter { + display: grid; + font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); + margin-top: 2em; + place-items: center; +} + +.counter-message { + text-align: center; +} diff --git a/examples/framework-preact/src/components/Counter.tsx b/examples/framework-preact/src/components/Counter.tsx index 7c520b167..a2ed0277d 100644 --- a/examples/framework-preact/src/components/Counter.tsx +++ b/examples/framework-preact/src/components/Counter.tsx @@ -1,5 +1,6 @@ import { h, Fragment } from 'preact'; import { useState } from 'preact/hooks'; +import './Counter.css'; export default function Counter({ children }) { const [count, setCount] = useState(0); @@ -8,12 +9,12 @@ export default function Counter({ children }) { return ( <> - <div className="counter"> + <div class="counter"> <button onClick={subtract}>-</button> <pre>{count}</pre> <button onClick={add}>+</button> </div> - <div className="children">{children}</div> + <div class="counter-message">{children}</div> </> ); } diff --git a/examples/framework-preact/src/pages/index.astro b/examples/framework-preact/src/pages/index.astro index eefc24414..4811f6e31 100644 --- a/examples/framework-preact/src/pages/index.astro +++ b/examples/framework-preact/src/pages/index.astro @@ -11,21 +11,13 @@ import Counter from '../components/Counter.tsx' <meta name="viewport" content="width=device-width" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <style> - :global(:root) { + html, + body { font-family: system-ui; - padding: 2em 0; + margin: 0; } - :global(.counter) { - display: grid; - font-size: 2em; - grid-template-columns: repeat(3, minmax(0, 1fr)); - margin-top: 2em; - place-items: center; - } - :global(.children) { - display: grid; - margin-bottom: 2em; - place-items: center; + body { + padding: 2rem; } </style> </head> |