diff options
author | 2021-11-22 13:38:53 -0700 | |
---|---|---|
committer | 2021-11-22 13:38:53 -0700 | |
commit | ce8f8e06c0d79fbe44538a1d63c5bf3a79ba27ff (patch) | |
tree | cca0a8f06b680ceac2cbb347415d3ef88c4d4df8 /examples/framework-multiple/src | |
parent | e49452325ce563ac7e46291d4654037075702316 (diff) | |
download | astro-ce8f8e06c0d79fbe44538a1d63c5bf3a79ba27ff.tar.gz astro-ce8f8e06c0d79fbe44538a1d63c5bf3a79ba27ff.tar.zst astro-ce8f8e06c0d79fbe44538a1d63c5bf3a79ba27ff.zip |
Clean up styling for framework-* examples (#1970)
Diffstat (limited to 'examples/framework-multiple/src')
7 files changed, 56 insertions, 54 deletions
diff --git a/examples/framework-multiple/src/components/PreactCounter.tsx b/examples/framework-multiple/src/components/PreactCounter.tsx index bfead53da..9c9bf73a1 100644 --- a/examples/framework-multiple/src/components/PreactCounter.tsx +++ b/examples/framework-multiple/src/components/PreactCounter.tsx @@ -8,12 +8,12 @@ export function PreactCounter({ 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-multiple/src/components/ReactCounter.jsx b/examples/framework-multiple/src/components/ReactCounter.jsx index 4b7c4bfa3..eca3cd2f7 100644 --- a/examples/framework-multiple/src/components/ReactCounter.jsx +++ b/examples/framework-multiple/src/components/ReactCounter.jsx @@ -13,7 +13,7 @@ export function Counter({ children }) { <pre>{count}</pre> <button onClick={add}>+</button> </div> - <div className="children">{children}</div> + <div className="counter-message">{children}</div> </> ); } diff --git a/examples/framework-multiple/src/components/SolidCounter.tsx b/examples/framework-multiple/src/components/SolidCounter.tsx index 5a9ebe9d5..63fe5cb11 100644 --- a/examples/framework-multiple/src/components/SolidCounter.tsx +++ b/examples/framework-multiple/src/components/SolidCounter.tsx @@ -13,7 +13,7 @@ export default function SolidCounter({ children }) { <pre>{count()}</pre> <button onClick={add}>+</button> </div> - <div class="children">{children}</div> + <div class="counter-message">{children}</div> </> ); } diff --git a/examples/framework-multiple/src/components/SvelteCounter.svelte b/examples/framework-multiple/src/components/SvelteCounter.svelte index 8d6b3f5e1..3cab8c43a 100644 --- a/examples/framework-multiple/src/components/SvelteCounter.svelte +++ b/examples/framework-multiple/src/components/SvelteCounter.svelte @@ -13,10 +13,10 @@ </script> <div class="counter"> - <button on:click={subtract}>-</button> - <pre>{ count }</pre> - <button on:click={add}>+</button> + <button on:click={subtract}>-</button> + <pre>{ count }</pre> + <button on:click={add}>+</button> </div> -<div class="children"> - <slot /> +<div class="counter-message"> + <slot /> </div> diff --git a/examples/framework-multiple/src/components/VueCounter.vue b/examples/framework-multiple/src/components/VueCounter.vue index 2703b8b9b..6c04c401a 100644 --- a/examples/framework-multiple/src/components/VueCounter.vue +++ b/examples/framework-multiple/src/components/VueCounter.vue @@ -4,7 +4,7 @@ <pre>{{ count }}</pre> <button @click="add()">+</button> </div> - <div class="children"> + <div class="counter-message"> <slot /> </div> </template> diff --git a/examples/framework-multiple/src/pages/index.astro b/examples/framework-multiple/src/pages/index.astro index 5982e9460..e27a5466d 100644 --- a/examples/framework-multiple/src/pages/index.astro +++ b/examples/framework-multiple/src/pages/index.astro @@ -13,58 +13,39 @@ import SvelteCounter from '../components/SvelteCounter.svelte'; --- <html lang="en"> <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width" /> - - <link rel="icon" type="image/x-icon" href="/favicon.ico" /> - - <style> - :global(:root) { - font-family: system-ui; - padding: 2em 0; - } - :global(.counter) { - display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - place-items: center; - font-size: 2em; - margin-top: 2em; - } - :global(.children) { - display: grid; - place-items: center; - margin-bottom: 2em; - } - </style> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width"> + <link rel="icon" type="image/x-icon" href="/favicon.ico"> + <link rel="stylesheet" type="text/css" href={Astro.resolve('../styles/global.css')}> </head> <body> - <main> + <main> + + <react.Counter client:visible> + <h1>Hello React!</h1> + <p>What's up?</p> + </react.Counter> - <react.Counter client:visible> - <h1>Hello React!</h1> - <p>What's up?</p> - </react.Counter> + <PreactCounter client:visible> + <h1>Hello Preact!</h1> + </PreactCounter> - <PreactCounter client:visible> - <h1>Hello Preact!</h1> - </PreactCounter> + <SolidCounter client:visible> + <h1>Hello Solid!</h1> + </SolidCounter> - <SolidCounter client:visible> - <h1>Hello Solid!</h1> - </SolidCounter> + <VueCounter client:visible> + <h1>Hello Vue!</h1> + </VueCounter> - <VueCounter client:visible> - <h1>Hello Vue!</h1> - </VueCounter> + <SvelteCounter client:visible> + <h1>Hello Svelte!</h1> + </SvelteCounter> - <SvelteCounter client:visible> - <h1>Hello Svelte!</h1> - </SvelteCounter> + <A /> - <A /> - - <Renamed /> + <Renamed /> - </main> + </main> </body> </html> diff --git a/examples/framework-multiple/src/styles/global.css b/examples/framework-multiple/src/styles/global.css new file mode 100644 index 000000000..5997a5afd --- /dev/null +++ b/examples/framework-multiple/src/styles/global.css @@ -0,0 +1,21 @@ +html, +body { + font-family: system-ui; + margin: 0; +} + +body { + padding: 2rem; +} + +.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; +} |