Form Template
This commit is contained in:
parent
6a658ef747
commit
c15c671bf7
5 changed files with 102 additions and 77 deletions
|
|
@ -12,7 +12,7 @@ export default function ToggleSubscription() {
|
||||||
const user = await api.getUserInfo();
|
const user = await api.getUserInfo();
|
||||||
setSubscription(user.subscription);
|
setSubscription(user.subscription);
|
||||||
};
|
};
|
||||||
fetchUser();
|
fetchUser(); // TODO: Ersetzen mit getUser()
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleSubscription = async (e: JSX.TargetedEvent<HTMLFormElement>) => {
|
const handleSubscription = async (e: JSX.TargetedEvent<HTMLFormElement>) => {
|
||||||
|
|
@ -20,7 +20,6 @@ export default function ToggleSubscription() {
|
||||||
setError('');
|
setError('');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(subscription)
|
|
||||||
api.toggleSubscription(subscription)
|
api.toggleSubscription(subscription)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Registrierung fehlgeschlagen');
|
setError(err instanceof Error ? err.message : 'Registrierung fehlgeschlagen');
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const localeDate = formatLocalizedDateString(postData.date);
|
||||||
<span>{localeDate}</span>
|
<span>{localeDate}</span>
|
||||||
</div>
|
</div>
|
||||||
<slot />
|
<slot />
|
||||||
<NavBack client:only />
|
<NavBack client:visible />
|
||||||
<p class="disclaimer">
|
<p class="disclaimer">
|
||||||
Disclaimer: Dieser Artikel ist ausschließlich privat und wird nicht durch
|
Disclaimer: Dieser Artikel ist ausschließlich privat und wird nicht durch
|
||||||
Produktplatzierung, Affiliate-Links oder ähnliches Unterstützt. Links
|
Produktplatzierung, Affiliate-Links oder ähnliches Unterstützt. Links
|
||||||
|
|
|
||||||
76
blog/src/layouts/Form.astro
Normal file
76
blog/src/layouts/Form.astro
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
---
|
||||||
|
import NavBack from "../islands/NavBack";
|
||||||
|
import Main from "../layouts/Main.astro";
|
||||||
|
|
||||||
|
const { title, subtitle, text, buttonText, eventString } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<Main>
|
||||||
|
<div id="background">
|
||||||
|
<div id="content">
|
||||||
|
<img src="../..//blog_img/england/titelbild_england.webp" />
|
||||||
|
<div id="form">
|
||||||
|
<h1>{title}</h1>
|
||||||
|
<span>{subtitle}</span>
|
||||||
|
<p>{text}</p>
|
||||||
|
<slot />
|
||||||
|
<div id="buttons">
|
||||||
|
<NavBack client:load />
|
||||||
|
<button
|
||||||
|
onclick={`window.dispatchEvent(new Event("${eventString}"))`}
|
||||||
|
class="submit-btn"
|
||||||
|
>
|
||||||
|
⚓︎ {buttonText}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Main>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#background {
|
||||||
|
background-image: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
var(--primary-dark),
|
||||||
|
var(--primary-color)
|
||||||
|
);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content {
|
||||||
|
background-color: white;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: 300px;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#form {
|
||||||
|
padding: 32px 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
#buttons {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: end;
|
||||||
|
padding-top: 32px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,81 +1,20 @@
|
||||||
---
|
---
|
||||||
import LoginForm from "../islands/LoginForm";
|
import LoginForm from "../islands/LoginForm";
|
||||||
import NavBack from "../islands/NavBack";
|
import NavBack from "../islands/NavBack";
|
||||||
import Main from "../layouts/Main.astro";
|
import Form from "../layouts/Form.astro";
|
||||||
---
|
---
|
||||||
|
|
||||||
<Main>
|
<Form
|
||||||
<div id="background">
|
title="Login"
|
||||||
<div id="content">
|
subtitle="Gib deinen persönlichen Code ein"
|
||||||
<img src="../..//blog_img/england/titelbild_england.webp" />
|
text="Meld dich an, um deine Daten zu bearbeiten. Gib dafür den
|
||||||
<div id="form">
|
|
||||||
<h1>Login</h1>
|
|
||||||
<span>Gib deinen persönlichen Code ein</span>
|
|
||||||
<p>
|
|
||||||
Meld dich an, um deine Daten zu bearbeiten. Gib dafür den
|
|
||||||
Code ein, denn du nach dem registrieren via E-Mail erhalten
|
Code ein, denn du nach dem registrieren via E-Mail erhalten
|
||||||
hast.
|
hast."
|
||||||
</p>
|
buttonText="Anmelden"
|
||||||
|
eventString="submit-login"
|
||||||
|
>
|
||||||
<LoginForm client:load />
|
<LoginForm client:load />
|
||||||
|
<a href="/register">Noch keinen Account? Hier Anmelden</a>
|
||||||
|
</Form>
|
||||||
|
|
||||||
<div id="buttons">
|
<style></style>
|
||||||
<NavBack client:load />
|
|
||||||
<button
|
|
||||||
onclick="window.dispatchEvent(new Event('submit-login'))"
|
|
||||||
class="submit-btn"
|
|
||||||
>
|
|
||||||
⚓︎ Anmelden
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Main>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
#background {
|
|
||||||
background-image: linear-gradient(
|
|
||||||
to bottom,
|
|
||||||
var(--primary-dark),
|
|
||||||
var(--primary-color)
|
|
||||||
);
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 0 20%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content {
|
|
||||||
background-color: white;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
width: 100%;
|
|
||||||
height: 300px;
|
|
||||||
object-fit: cover;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#form {
|
|
||||||
padding: 32px 64px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#buttons {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: end;
|
|
||||||
padding-top: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0;
|
|
||||||
padding-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
11
blog/src/pages/register.astro
Normal file
11
blog/src/pages/register.astro
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
import Form from "../layouts/Form.astro";
|
||||||
|
---
|
||||||
|
|
||||||
|
<Form
|
||||||
|
title="Willkommen!"
|
||||||
|
subtitle="E-Mail Erinnerung für neue Artikel"
|
||||||
|
text="Endlich könnt E-Mail Erinnerungen erhalten, wenn wir neue Artikel veröffentlichen. Für die spätere Kommentarfunktion fragen wir gleich den Namen mit ab."
|
||||||
|
buttonText="Registrieren"
|
||||||
|
eventString="submit-register"
|
||||||
|
/>
|
||||||
Loading…
Add table
Reference in a new issue