add astro template for front #13
@ -2,10 +2,10 @@
|
||||
import type { Form as Props } from 'types';
|
||||
import Button from 'components/ui/Button.astro';
|
||||
|
||||
const { inputs, textarea, disclaimer, button = 'Contact us', description = '' } = Astro.props;
|
||||
const { inputs, textarea, disclaimer, button = 'Contact us', description = '', id, method, enctype } = Astro.props;
|
||||
---
|
||||
|
||||
<form>
|
||||
<form id={id} method={method} enctype={enctype}>
|
||||
{
|
||||
inputs &&
|
||||
inputs.map(
|
||||
|
@ -13,6 +13,9 @@ const {
|
||||
disclaimer,
|
||||
button,
|
||||
description,
|
||||
formid,
|
||||
method,
|
||||
enctype,
|
||||
|
||||
id,
|
||||
isDark = false,
|
||||
@ -33,6 +36,9 @@ const {
|
||||
disclaimer={disclaimer}
|
||||
button={button}
|
||||
description={description}
|
||||
id={formid}
|
||||
method={method}
|
||||
enctype={enctype}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
@ -3,6 +3,8 @@ import Layout from 'layouts/PageLayout.astro';
|
||||
//import Layout from 'layouts/Layout.astro';
|
||||
import AstroUtils from "libs/AstroUtils";
|
||||
import PocketBase from 'pocketbase'
|
||||
import ContactUs from 'components/widgets/Contact.astro';
|
||||
import FormContainer from 'components/ui/Form.astro';
|
||||
|
||||
|
||||
const pb = Astro.locals.pb
|
||||
@ -11,7 +13,10 @@ if(pb.authStore.isValid){
|
||||
return Astro.redirect("/account")
|
||||
}
|
||||
|
||||
const res = await AstroUtils.wrap(async () => {
|
||||
console.log(Astro.request.method);
|
||||
|
||||
|
||||
await AstroUtils.wrap(async () => {
|
||||
if (Astro.request.method !== 'POST') {
|
||||
return
|
||||
}
|
||||
@ -38,9 +43,24 @@ const metadata = {
|
||||
---
|
||||
|
||||
<Layout metadata={metadata}>
|
||||
<form id="account-creation" method="post" enctype="multipart/form-data">
|
||||
<input required name="username" placeholder="Pseudo ou email"/>
|
||||
<input required name="password" type="password" placeholder="Mot de passe" />
|
||||
<button>Connection</button>
|
||||
</form>
|
||||
<ContactUs
|
||||
formid="account-creation"
|
||||
title="Inscription"
|
||||
subtitle="Incrivez-vous pour sauvegardez vos recherche"
|
||||
button='Connexion'
|
||||
method='post'
|
||||
enctype="multipart/form-data"
|
||||
inputs={[
|
||||
{
|
||||
type: 'text',
|
||||
name: 'username',
|
||||
label: 'Nom d\'utilisateur ou e-mail',
|
||||
placeholder: "michel@example.com"
|
||||
},
|
||||
{
|
||||
type: "password",
|
||||
name: "password"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Layout>
|
||||
|
@ -3,6 +3,8 @@ import Layout from 'layouts/PageLayout.astro';
|
||||
//import Layout from 'layouts/Layout.astro';
|
||||
import AstroUtils from 'libs/AstroUtils';
|
||||
import { getEnv } from 'libs/Env';
|
||||
import ContactUs from 'components/widgets/Contact.astro';
|
||||
import Form from 'components/ui/Form.astro';
|
||||
|
||||
const pb = Astro.locals.pb
|
||||
|
||||
|
7
front/src/types.d.ts
vendored
7
front/src/types.d.ts
vendored
@ -210,6 +210,9 @@ export interface Form {
|
||||
disclaimer?: Disclaimer
|
||||
button?: string
|
||||
description?: string
|
||||
id?: string
|
||||
method?: string
|
||||
enctype?: string
|
||||
}
|
||||
|
||||
// WIDGETS
|
||||
@ -285,4 +288,6 @@ export interface Content extends Omit<Headline, 'classes'>, Widget {
|
||||
callToAction?: CallToAction
|
||||
}
|
||||
|
||||
export interface Contact extends Omit<Headline, 'classes'>, Form, Widget {}
|
||||
export interface Contact extends Omit<Headline, 'classes'>, Form, Widget {
|
||||
formid?: string
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user