summaryrefslogtreecommitdiff
path: root/examples/framework-preact/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/framework-preact/src')
-rw-r--r--examples/framework-preact/src/components/Counter.css12
-rw-r--r--examples/framework-preact/src/components/Counter.tsx26
-rw-r--r--examples/framework-preact/src/pages/index.astro47
3 files changed, 43 insertions, 42 deletions
diff --git a/examples/framework-preact/src/components/Counter.css b/examples/framework-preact/src/components/Counter.css
index 5d3de4803..fb21044d7 100644
--- a/examples/framework-preact/src/components/Counter.css
+++ b/examples/framework-preact/src/components/Counter.css
@@ -1,11 +1,11 @@
.counter {
- display: grid;
- font-size: 2em;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- margin-top: 2em;
- place-items: center;
+ display: grid;
+ font-size: 2em;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ margin-top: 2em;
+ place-items: center;
}
.counter-message {
- text-align: center;
+ text-align: center;
}
diff --git a/examples/framework-preact/src/components/Counter.tsx b/examples/framework-preact/src/components/Counter.tsx
index a2ed0277d..61a9f9d5a 100644
--- a/examples/framework-preact/src/components/Counter.tsx
+++ b/examples/framework-preact/src/components/Counter.tsx
@@ -3,18 +3,18 @@ import { useState } from 'preact/hooks';
import './Counter.css';
export default function Counter({ children }) {
- const [count, setCount] = useState(0);
- const add = () => setCount((i) => i + 1);
- const subtract = () => setCount((i) => i - 1);
+ const [count, setCount] = useState(0);
+ const add = () => setCount((i) => i + 1);
+ const subtract = () => setCount((i) => i - 1);
- return (
- <>
- <div class="counter">
- <button onClick={subtract}>-</button>
- <pre>{count}</pre>
- <button onClick={add}>+</button>
- </div>
- <div class="counter-message">{children}</div>
- </>
- );
+ return (
+ <>
+ <div class="counter">
+ <button onClick={subtract}>-</button>
+ <pre>{count}</pre>
+ <button onClick={add}>+</button>
+ </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 4811f6e31..77ce1c2c7 100644
--- a/examples/framework-preact/src/pages/index.astro
+++ b/examples/framework-preact/src/pages/index.astro
@@ -1,31 +1,32 @@
---
// Component Imports
-import Counter from '../components/Counter.tsx'
+import Counter from '../components/Counter.tsx';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
---
+
<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>
- html,
- body {
- font-family: system-ui;
- margin: 0;
- }
- body {
- padding: 2rem;
- }
- </style>
- </head>
- <body>
- <main>
- <Counter client:visible>
- <h1>Hello, Preact!</h1>
- </Counter>
- </main>
- </body>
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width" />
+ <link rel="icon" type="image/x-icon" href="/favicon.ico" />
+ <style>
+ html,
+ body {
+ font-family: system-ui;
+ margin: 0;
+ }
+ body {
+ padding: 2rem;
+ }
+ </style>
+ </head>
+ <body>
+ <main>
+ <Counter client:visible>
+ <h1>Hello, Preact!</h1>
+ </Counter>
+ </main>
+ </body>
</html>