-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLoginForm.tsx
More file actions
37 lines (33 loc) · 1.01 KB
/
LoginForm.tsx
File metadata and controls
37 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { useState, useEffect } from "react";
import { LoginButton } from "@inrupt/solid-ui-react";
import { Button, TextField, FormGroup, Container } from "@material-ui/core";
const LoginForm = () => {
const [idp, setIdp] = useState("https://inrupt.net");
const [currentUrl, setCurrentUrl] = useState("https://localhost:3000");
useEffect(() => {
setCurrentUrl(window.location.href);
}, [setCurrentUrl]);
return (
<Container fixed>
<FormGroup>
<TextField
label="Identity Provider"
placeholder="Identity Provider"
type="url"
value={idp}
onChange={(e) => setIdp(e.target.value)}
InputProps={{
endAdornment: (
<LoginButton oidcIssuer={idp} redirectUrl={currentUrl}>
<Button variant="contained" color="primary">
Login
</Button>
</LoginButton>
),
}}
/>
</FormGroup>
</Container>
);
}
export default LoginForm;