-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2e07f5
commit 0b2f9b9
Showing
10 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,12 @@ | |
"value": "yes" | ||
} | ||
], | ||
"mm+twj": [ | ||
{ | ||
"type": 0, | ||
"value": "login" | ||
} | ||
], | ||
"y0k/u3": [ | ||
{ | ||
"type": 0, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,12 @@ | |
"value": "ja" | ||
} | ||
], | ||
"mm+twj": [ | ||
{ | ||
"type": 0, | ||
"value": "inloggen" | ||
} | ||
], | ||
"y0k/u3": [ | ||
{ | ||
"type": 0, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Auto-generated file. Do not modify manually. | ||
export * from "./login"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./login"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { Login } from "./login"; | ||
|
||
const meta = { | ||
title: "Templates/Login", | ||
component: Login, | ||
argTypes: { onSubmit: { action: "onSubmit" } }, | ||
} satisfies Meta<typeof Login>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const LoginTemplate: Story = { | ||
args: { | ||
autoComplete: "off", | ||
fields: [ | ||
{ | ||
label: "Gebruikersnaam", | ||
name: "username", | ||
}, | ||
{ | ||
label: "Wachtwoord", | ||
name: "Password", | ||
}, | ||
], | ||
labelSubmit: "Log in", | ||
nonFieldErrors: ["Username or password invalid"], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from "react"; | ||
|
||
import { | ||
Body, | ||
Card, | ||
Column, | ||
Container, | ||
Form, | ||
FormProps, | ||
Grid, | ||
Hr, | ||
Logo, | ||
Page, | ||
} from "../../components"; | ||
import { ucFirst } from "../../lib/format/string"; | ||
import { useIntl } from "../../lib/i18n/useIntl"; | ||
|
||
export type LoginProps = FormProps; | ||
|
||
/** | ||
* Login template | ||
* @constructor | ||
*/ | ||
export const Login: React.FC<LoginProps> = ({ labelSubmit, ...formProps }) => { | ||
const intl = useIntl(); | ||
|
||
const labelLogin = labelSubmit | ||
? labelSubmit | ||
: intl.formatMessage({ | ||
description: "templates.Login: The login button label", | ||
defaultMessage: "inloggen", | ||
}); | ||
|
||
return ( | ||
<Page valign="middle"> | ||
<Container> | ||
<Grid> | ||
<Column start={5} span={4}> | ||
<Card> | ||
<Body> | ||
<Logo /> | ||
<Hr /> | ||
<Form labelSubmit={ucFirst(labelLogin)} {...formProps} /> | ||
</Body> | ||
</Card> | ||
</Column> | ||
</Grid> | ||
</Container> | ||
</Page> | ||
); | ||
}; |