Skip to content

Commit

Permalink
BREAKING CHANGE: Change components names
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Nov 22, 2023
1 parent d5b6a96 commit c595843
Show file tree
Hide file tree
Showing 30 changed files with 582 additions and 224 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ import {WebForms} from '@astro-utils/forms/forms.js';
### Simple example
```astro
---
import { Bind } from "@astro-utils/forms";
import { BindForm, Button, Input } from "@astro-utils/forms/forms.js";
import { Bind, BindForm, BButton, BInput } from "@astro-utils/forms/forms.js";
import Layout from "../layouts/Layout.astro";
const form = Bind();
Expand All @@ -68,14 +67,14 @@ function formSubmit(){
<Layout>
<BindForm bind={form}>
{showSubmitText}
<h4>What you name*</h4>
<Input type={'text'} name="name" maxlength={20} required/>
<BInput type="text" name="name" maxlength={20} required/>
<h4>Enter age*</h4>
<Input type={'int'} name="age" required/>
<BInput type="int" name="age" required/>
<Button onClick={formSubmit} whenFormOK>Submit</Button>
<BButton onClick={formSubmit} whenFormOK>Submit</BButton>
</BindForm>
</Layout>
```
Expand All @@ -89,7 +88,7 @@ import { defineConfig } from 'astro/config';
import astroFormsDebug from "@astro-utils/forms/dist/integration.js";

export default defineConfig({
output: 'server',
output: 'server',
integrations: [astroFormsDebug]
});
```
6 changes: 4 additions & 2 deletions examples/simple-form/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { defineConfig } from 'astro/config';
import {defineConfig} from 'astro/config';
import react from '@astrojs/react';

// https://astro.build/config
export default defineConfig({
output: "server"
output: "server",
integrations: [react()]
});
5 changes: 5 additions & 0 deletions examples/simple-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"dependencies": {
"@astro-utils/express-endpoints": "^0.0.1",
"@astro-utils/forms": "^0.0.1",
"@astrojs/react": "^3.0.6",
"astro": "^3.5.5",
"bootstrap": "^5.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"reactstrap": "^9.2.1",
"zod": "^3.22.4"
}
}
14 changes: 7 additions & 7 deletions examples/simple-form/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
import Layout from '../layouts/Layout.astro';
import { Bind } from "@astro-utils/forms";
import { BindForm, Button, Input } from "@astro-utils/forms/forms.js";
import Layout from "../layouts/Layout.astro";
import {BButton, Bind, BindForm, BInput} from '@astro-utils/forms/forms.js';
import {Button} from 'reactstrap';
import 'bootstrap/dist/css/bootstrap.css';
const form = Bind({age: 0, name: ''});
let showSubmitText: string;
Expand All @@ -11,17 +12,16 @@ function formSubmit(){
showSubmitText = `You name is ${form.name}, you are ${form.age} years old. `;
}
---

<Layout title="Welcome to Astro Metro.">
<BindForm bind={form}>
{showSubmitText}

<h4>What you name*</h4>
<Input type="text" name="name" maxlength={20} required/>
<BInput type="text" name="name" maxlength={20} required/>

<h4>Enter age*</h4>
<Input type="int" name="age" required/>
<BInput type="int" name="age" required/>

<Button onClick={formSubmit} whenFormOK>Submit</Button>
<BButton as={Button} props={{color: 'info'}} onClick={formSubmit} whenFormOK>Submit</BButton>
</BindForm>
</Layout>
6 changes: 5 additions & 1 deletion examples/simple-form/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "astro/tsconfigs/base"
"extends": "astro/tsconfigs/base",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}
Loading

0 comments on commit c595843

Please sign in to comment.