Skip to content

Commit

Permalink
feat: use forms in templates (#331)
Browse files Browse the repository at this point in the history
* Update code snippets to use the platform

* Add change
  • Loading branch information
TejasQ authored and amrbashir committed Feb 13, 2023
1 parent 03d4025 commit 4beabe2
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .changes/platform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-tauri-app": "patch"
"create-tauri-app-js": "patch"
---

Fix generated output to use HTML forms properly.
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-next-ts/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ function App() {
<p>Click on the Tauri, Next, and React logos to learn more.</p>

<div className="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>

<p>{greetMsg}</p>
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-next/src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ function App() {
<p>Click on the Tauri, Next, and React logos to learn more.</p>

<div className="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>

<p>{greetMsg}</p>
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-preact-ts/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ export function App<FC>() {
<p>Click on the Tauri, Vite, and Preact logos to learn more.</p>

<div class="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>
<p>{greetMsg}</p>
</div>
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-preact/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ export function App() {
<p>Click on the Tauri, Vite, and Preact logos to learn more.</p>

<div class="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>
<p>{greetMsg}</p>
</div>
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-react-ts/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ function App() {
<p>Click on the Tauri, Vite, and React logos to learn more.</p>

<div className="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>
<p>{greetMsg}</p>
</div>
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-react/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ function App() {
<p>Click on the Tauri, Vite, and React logos to learn more.</p>

<div className="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>

<p>{greetMsg}</p>
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/fragments/fragment-solid/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ function App() {
<p>Click on the Tauri, Vite, and Solid logos to learn more.</p>

<div class="row">
<div>
<form
onSubmit={(e) => {
e.preventDefault();
greet();
}}
>
<input
id="greet-input"
onChange={(e) => setName(e.currentTarget.value)}
placeholder="Enter a name..."
/>
<button type="button" onClick={() => greet()}>
Greet
</button>
</div>
<button type="submit">Greet</button>
</form>
</div>

<p>{greetMsg}</p>
Expand Down

0 comments on commit 4beabe2

Please sign in to comment.