diff --git a/.gitignore b/.gitignore
index 0f319d1a..91d44bea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,6 +84,10 @@ local.properties
*/.idea/
+/.idea
+
+WebApp.iml
+
# Sensitive or high-churn files
*/.idea/**/dataSources/
*/.idea/**/dataSources.ids
diff --git a/src/__tests__/__snapshots__/storybook.test.ts.snap b/src/__tests__/__snapshots__/storybook.test.ts.snap
index 19fcf8f1..af6a5056 100644
--- a/src/__tests__/__snapshots__/storybook.test.ts.snap
+++ b/src/__tests__/__snapshots__/storybook.test.ts.snap
@@ -636,6 +636,396 @@ exports[`Storyshots Health default 1`] = `
`;
+exports[`Storyshots Login default 1`] = `
+
Profile
+
{
+ logout()
+ }}
+ >
+ Logout
+
)}
diff --git a/src/components/basicElements/Login.css b/src/components/basicElements/Login.css
new file mode 100644
index 00000000..e69de29b
diff --git a/src/components/basicElements/Login.stories.tsx b/src/components/basicElements/Login.stories.tsx
new file mode 100644
index 00000000..df97bdd2
--- /dev/null
+++ b/src/components/basicElements/Login.stories.tsx
@@ -0,0 +1,54 @@
+import React from "react";
+import {storiesOf} from "@storybook/react";
+import {BrowserRouter} from "react-router-dom";
+import '../../style/custom.scss';
+import Login, {LoginHeader, LoginInput, LoginInteractionArea} from "./Login";
+import {action} from "@storybook/addon-actions";
+
+storiesOf("Login", module)
+ .add("default", () =>
+
+
+
+ )
+
+ .add("onlyHeader", () =>
+
+
+
+ )
+
+ .add("onlyInput", () => (
+
+ console.log("Clicked on submit")}
+ username={""}
+ setUsername={action("changed username")}
+ password={""}
+ setPassword={action("changed password")}
+ isLoading={false}
+ setIsLoading={action("is loading")}
+ stayLoggedIn={false}
+ setStayLoggedIn={action("changed stay logged in")}
+ errorMessage={""}
+ />
+
+ )
+ )
+
+ .add("interactionArea", () =>
+
+ console.log("Clicked on submit")}
+ username={""}
+ setUsername={action("changed username")}
+ password={""}
+ setPassword={action("changed password")}
+ isLoading={false}
+ setIsLoading={action("is loading")}
+ stayLoggedIn={false}
+ setStayLoggedIn={action("changed stay logged in")}
+ errorMessage={""}
+ />
+
+ )
\ No newline at end of file
diff --git a/src/components/basicElements/Login.tsx b/src/components/basicElements/Login.tsx
index c0e94775..821dfa41 100644
--- a/src/components/basicElements/Login.tsx
+++ b/src/components/basicElements/Login.tsx
@@ -1,70 +1,167 @@
-import React, {FormEvent, ReactElement, useState} from 'react';
-import {Button, Form, Container, Row,Col,Spinner} from "react-bootstrap";
+import React, {Dispatch, FormEvent, ReactElement, SetStateAction, useState} from 'react';
+import {Button, Col, Container, Form, Image, Row, Spinner} from "react-bootstrap";
import {loginWithUsernameAndPassword} from "../../background/api/auth";
+import logo from "../../assets/images/logos/logoWithWhiteBorder.png";
+
+export interface LoginInputInterface {
+ handleSubmit: (event: FormEvent) => void,
+ username: string|number|string[]|undefined,
+ setUsername: Dispatch
>,
+ password: string|number|string[]|undefined,
+ setPassword: Dispatch>,
+ isLoading: boolean,
+ setIsLoading: Dispatch>,
+ stayLoggedIn: boolean,
+ setStayLoggedIn: Dispatch>,
+ errorMessage: string|null
+}
+
function Login(): ReactElement {
const [userName, setUsername] = useState("");
const [password, setPassword] = useState("");
const [stayLoggedIn, setStayLoggedIn] = useState(true);
const [errorMessage, setErrorMessage] = useState("");
- const [loading,setLoading]=useState(false);
+ const [isLoading, setIsLoading] = useState(false);
const handleSubmit = (event: FormEvent) => {
event.preventDefault();
- setLoading(true)
- loginWithUsernameAndPassword(userName, password,stayLoggedIn)
+ setIsLoading(true)
+ loginWithUsernameAndPassword(userName, password, stayLoggedIn)
.then(() => {
//nothing to do here :)
setErrorMessage("");
- setLoading(false);
+ setIsLoading(false);
})
.catch(((error) => {
console.log(error);
- setLoading(false)
+ setIsLoading(false)
setErrorMessage(error.response?.data.message);
}))
};
+ return (
+
+
+ );
+}
+
+export function LoginInteractionArea(props: LoginInputInterface) {
+ const {
+ handleSubmit,
+ username,
+ setUsername,
+ password,
+ setPassword,
+ isLoading,
+ setIsLoading,
+ stayLoggedIn,
+ setStayLoggedIn,
+ errorMessage,
+ } = props
+ return (
+
+
+
+
+ )
+}
+export function LoginHeader() {
return (
-
-
-
-