From ce8f8e06c0d79fbe44538a1d63c5bf3a79ba27ff Mon Sep 17 00:00:00 2001 From: Drew Powers <1369770+drwpow@users.noreply.github.com> Date: Mon, 22 Nov 2021 13:38:53 -0700 Subject: [PATCH] Clean up styling for framework-* examples (#1970) --- .../src/components/PreactCounter.tsx | 4 +- .../src/components/ReactCounter.jsx | 2 +- .../src/components/SolidCounter.tsx | 2 +- .../src/components/SvelteCounter.svelte | 10 +-- .../src/components/VueCounter.vue | 2 +- .../framework-multiple/src/pages/index.astro | 69 +++++++------------ .../framework-multiple/src/styles/global.css | 21 ++++++ .../src/components/Counter.css | 11 +++ .../src/components/Counter.tsx | 5 +- .../framework-preact/src/pages/index.astro | 18 ++--- .../src/components/Counter.css | 11 +++ .../src/components/Counter.jsx | 3 +- .../framework-react/src/pages/index.astro | 18 ++--- .../src/components/Counter.css | 11 +++ .../src/components/Counter.jsx | 1 + .../framework-solid/src/pages/index.astro | 17 ++--- .../src/components/Counter.svelte | 15 +++- .../framework-svelte/src/pages/index.astro | 18 ++--- .../framework-vue/src/components/Counter.vue | 15 +++- examples/framework-vue/src/pages/index.astro | 18 ++--- 20 files changed, 149 insertions(+), 122 deletions(-) create mode 100644 examples/framework-multiple/src/styles/global.css create mode 100644 examples/framework-preact/src/components/Counter.css create mode 100644 examples/framework-react/src/components/Counter.css create mode 100644 examples/framework-solid/src/components/Counter.css 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 ( <> -
+
{count}
-
{children}
+
{children}
); } 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 }) {
{count}
-
{children}
+
{children}
); } 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 }) {
{count()}
-
{children}
+
{children}
); } 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 @@
- -
{ count }
- + +
{ count }
+
-
- +
+
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 @@
{{ count }}
-
+
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'; --- - - - - - - + + + + -
+
- -

Hello React!

-

What's up?

-
+ +

Hello React!

+

What's up?

+
- -

Hello Preact!

-
+ +

Hello Preact!

+
- -

Hello Solid!

-
+ +

Hello Solid!

+
- -

Hello Vue!

-
+ +

Hello Vue!

+
- -

Hello Svelte!

-
+ +

Hello Svelte!

+
- - - + -
+ + +
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; +} 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 ( <> -
+
{count}
-
{children}
+
{children}
); } 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' 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 }) {
{count}
-
{children}
+
{children}
); } 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 = { diff --git a/examples/framework-solid/src/components/Counter.css b/examples/framework-solid/src/components/Counter.css new file mode 100644 index 000000000..3ee017965 --- /dev/null +++ b/examples/framework-solid/src/components/Counter.css @@ -0,0 +1,11 @@ +.counter { + display: grid; + font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); + margin-top: 3em; + place-items: center; +} + +.counter-message { + text-align: center; +} diff --git a/examples/framework-solid/src/components/Counter.jsx b/examples/framework-solid/src/components/Counter.jsx index a008a709f..bbd435f09 100644 --- a/examples/framework-solid/src/components/Counter.jsx +++ b/examples/framework-solid/src/components/Counter.jsx @@ -1,4 +1,5 @@ import { createSignal } from 'solid-js'; +import './Counter.css'; export default function Counter({ children }) { const [count, setCount] = createSignal(0); diff --git a/examples/framework-solid/src/pages/index.astro b/examples/framework-solid/src/pages/index.astro index 57369c320..af4669816 100644 --- a/examples/framework-solid/src/pages/index.astro +++ b/examples/framework-solid/src/pages/index.astro @@ -6,19 +6,14 @@ import Counter from '../components/Counter.jsx'; - diff --git a/examples/framework-svelte/src/components/Counter.svelte b/examples/framework-svelte/src/components/Counter.svelte index 9aaf421c1..2f4c07339 100644 --- a/examples/framework-svelte/src/components/Counter.svelte +++ b/examples/framework-svelte/src/components/Counter.svelte @@ -15,6 +15,19 @@
{ count }
-
+
+ + diff --git a/examples/framework-svelte/src/pages/index.astro b/examples/framework-svelte/src/pages/index.astro index 8cf84ef53..e5e7883d0 100644 --- a/examples/framework-svelte/src/pages/index.astro +++ b/examples/framework-svelte/src/pages/index.astro @@ -12,21 +12,13 @@ import Counter from '../components/Counter.svelte' diff --git a/examples/framework-vue/src/components/Counter.vue b/examples/framework-vue/src/components/Counter.vue index 2703b8b9b..155717ea4 100644 --- a/examples/framework-vue/src/components/Counter.vue +++ b/examples/framework-vue/src/components/Counter.vue @@ -4,7 +4,7 @@
{{ count }}
-
+
@@ -25,3 +25,16 @@ export default { }, }; + + diff --git a/examples/framework-vue/src/pages/index.astro b/examples/framework-vue/src/pages/index.astro index c7679c46e..449c3a614 100644 --- a/examples/framework-vue/src/pages/index.astro +++ b/examples/framework-vue/src/pages/index.astro @@ -12,21 +12,13 @@ import Counter from '../components/Counter.vue'