diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/kitchen-sink/src/components/PreactCounter.tsx | 20 | ||||
-rw-r--r-- | examples/kitchen-sink/src/components/ReactCounter.jsx | 20 | ||||
-rw-r--r-- | examples/snowpack/README.md | 26 | ||||
-rw-r--r-- | examples/snowpack/src/components/CompanyLogo.jsx | 2 | ||||
-rw-r--r-- | examples/snowpack/src/components/PluginSearchPage.jsx | 6 | ||||
-rw-r--r-- | examples/snowpack/src/components/docsearch.js | 31 | ||||
-rw-r--r-- | examples/snowpack/src/data/version.js | 4 | ||||
-rw-r--r-- | examples/snowpack/src/pages/guides/web-worker.md | 2 |
8 files changed, 60 insertions, 51 deletions
diff --git a/examples/kitchen-sink/src/components/PreactCounter.tsx b/examples/kitchen-sink/src/components/PreactCounter.tsx index 9f1e8d887..e3761643f 100644 --- a/examples/kitchen-sink/src/components/PreactCounter.tsx +++ b/examples/kitchen-sink/src/components/PreactCounter.tsx @@ -3,18 +3,18 @@ import { useState } from 'preact/hooks'; /** a counter written in Preact */ export default function PreactCounter({ 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 className="counter"> + return ( + <> + <div className="counter"> <button onClick={subtract}>-</button> <pre>{count}</pre> <button onClick={add}>+</button> - </div> - <div className="children"> - {children} - </div> - </> + </div> + <div className="children">{children}</div> + </> + ); } diff --git a/examples/kitchen-sink/src/components/ReactCounter.jsx b/examples/kitchen-sink/src/components/ReactCounter.jsx index 384dd9918..92871a8d8 100644 --- a/examples/kitchen-sink/src/components/ReactCounter.jsx +++ b/examples/kitchen-sink/src/components/ReactCounter.jsx @@ -2,18 +2,18 @@ import React, { useState } from 'react'; /** a counter written in React */ export default function ReactCounter({ 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 className="counter"> + return ( + <> + <div className="counter"> <button onClick={subtract}>-</button> <pre>{count}</pre> <button onClick={add}>+</button> - </div> - <div className="children"> - {children} - </div> - </> + </div> + <div className="children">{children}</div> + </> + ); } diff --git a/examples/snowpack/README.md b/examples/snowpack/README.md index 11e615e1a..c3a71d6f8 100644 --- a/examples/snowpack/README.md +++ b/examples/snowpack/README.md @@ -1,21 +1,21 @@ # Astro Demo -## Getting setup +## Getting set up -1. Checkout Astro at: https://github.com/snowpackjs/astro - - 1. Install and build Astro: +1. Check out Astro at: https://github.com/snowpackjs/astro - ```shell - npm install - npm run build - ``` + 1. Install and build Astro: - 2. Link Astro: + ```shell + npm install + npm run build + ``` - ```shell - npm link - ``` + 2. Link Astro: + + ```shell + npm link + ``` 2. In this project link Astro and install other deps: @@ -34,4 +34,4 @@ npm run start ```shell npm run build -```
\ No newline at end of file +``` diff --git a/examples/snowpack/src/components/CompanyLogo.jsx b/examples/snowpack/src/components/CompanyLogo.jsx index 98be3f2eb..fc652f864 100644 --- a/examples/snowpack/src/components/CompanyLogo.jsx +++ b/examples/snowpack/src/components/CompanyLogo.jsx @@ -1,4 +1,4 @@ -import {h} from 'preact'; +import { h } from 'preact'; export default function CompanyLogo({ user }) { return ( diff --git a/examples/snowpack/src/components/PluginSearchPage.jsx b/examples/snowpack/src/components/PluginSearchPage.jsx index 51c7e6b0f..4ed46cb74 100644 --- a/examples/snowpack/src/components/PluginSearchPage.jsx +++ b/examples/snowpack/src/components/PluginSearchPage.jsx @@ -117,5 +117,9 @@ function PluginSearchPageLive() { } export default function PluginSearchPage(props) { - return import.meta.env.astro ? <div>Loading...</div> : <PluginSearchPageLive {...props} /> + return import.meta.env.astro ? ( + <div>Loading...</div> + ) : ( + <PluginSearchPageLive {...props} /> + ); } diff --git a/examples/snowpack/src/components/docsearch.js b/examples/snowpack/src/components/docsearch.js index d7ae95f30..f2b9e6441 100644 --- a/examples/snowpack/src/components/docsearch.js +++ b/examples/snowpack/src/components/docsearch.js @@ -1,17 +1,20 @@ import docsearch from 'docsearch.js/dist/cdn/docsearch.min.js'; -customElements.define('doc-search', class extends HTMLElement { - connectedCallback() { - if(!this._setup) { - const apiKey = this.getAttribute('api-key'); - const selector = this.getAttribute('selector'); - docsearch({ - apiKey: apiKey, - indexName: 'snowpack', - inputSelector: selector, - debug: true // Set debug to true if you want to inspect the dropdown - }); - this._setup = true; +customElements.define( + 'doc-search', + class extends HTMLElement { + connectedCallback() { + if (!this._setup) { + const apiKey = this.getAttribute('api-key'); + const selector = this.getAttribute('selector'); + docsearch({ + apiKey: apiKey, + indexName: 'snowpack', + inputSelector: selector, + debug: true, // Set debug to true if you want to inspect the dropdown + }); + this._setup = true; + } } - } -});
\ No newline at end of file + }, +); diff --git a/examples/snowpack/src/data/version.js b/examples/snowpack/src/data/version.js index 19a63491c..53f8ca53e 100644 --- a/examples/snowpack/src/data/version.js +++ b/examples/snowpack/src/data/version.js @@ -1,2 +1,4 @@ -const snowpackManifest = JSON.parse(fs.readFileSync(path.join(__dirname, '../../snowpack/package.json'), 'utf8')); +const snowpackManifest = JSON.parse( + fs.readFileSync(path.join(__dirname, '../../snowpack/package.json'), 'utf8'), +); export default snowpackManifest.version; diff --git a/examples/snowpack/src/pages/guides/web-worker.md b/examples/snowpack/src/pages/guides/web-worker.md index 4329c489a..56bce9774 100644 --- a/examples/snowpack/src/pages/guides/web-worker.md +++ b/examples/snowpack/src/pages/guides/web-worker.md @@ -28,4 +28,4 @@ const worker = new Worker(new URL('./esm-worker.js', import.meta.url), { name: 'my-worker', type: 'module', }); -```
\ No newline at end of file +``` |