diff options
Diffstat (limited to 'examples/framework-react')
-rw-r--r-- | examples/framework-react/src/components/Counter.css | 11 | ||||
-rw-r--r-- | examples/framework-react/src/components/Counter.jsx | 3 | ||||
-rw-r--r-- | examples/framework-react/src/pages/index.astro | 18 |
3 files changed, 18 insertions, 14 deletions
diff --git a/examples/framework-react/src/components/Counter.css b/examples/framework-react/src/components/Counter.css new file mode 100644 index 000000000..5d3de4803 --- /dev/null +++ b/examples/framework-react/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-react/src/components/Counter.jsx b/examples/framework-react/src/components/Counter.jsx index b7b219aae..e222d680f 100644 --- a/examples/framework-react/src/components/Counter.jsx +++ b/examples/framework-react/src/components/Counter.jsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import './Counter.css'; export default function Counter({ children, count: initialCount }) { const [count, setCount] = useState(initialCount); @@ -12,7 +13,7 @@ export default function Counter({ children, count: initialCount }) { <pre>{count}</pre> <button onClick={add}>+</button> </div> - <div className="children">{children}</div> + <div className="counter-message">{children}</div> </> ); } diff --git a/examples/framework-react/src/pages/index.astro b/examples/framework-react/src/pages/index.astro index ba30fed6f..dd2950782 100644 --- a/examples/framework-react/src/pages/index.astro +++ b/examples/framework-react/src/pages/index.astro @@ -14,21 +14,13 @@ const someProps = { <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> |