Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Structure code properly(for the Auth elements) #36

Merged
merged 3 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 7 additions & 50 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AuthElements } from "./AuthElements.jsx";
import { Component } from "react";
import "./index.css";

Expand Down Expand Up @@ -191,56 +192,12 @@ class SignInStuff extends Component {
}
render() {
return (
<div
style={{
display: "grid",
alignItems: "right",
justifyContent: "right",
}}
>
<h1 id="banner"> </h1>
<br />
<form onSubmit={this.signInWithGoogle}>
<button
id="google"
style={{ width: "300px", height: "50px" }}
type="submit"
>
Sign in with Google
</button>
</form>
<br />
<br />
<form onSubmit={this.signUserOut}>
<button
type="submit"
id="signOut"
style={{ width: "300px", height: "50px" }}
>
Sign out
</button>
</form>
<form onSubmit={this.signInUsingMicrosoft}>
<button
type="submit"
id="microsoft"
style={{ width: "300px", height: "50px" }}
>
Sign in with Microsoft
</button>
</form>
<br />
<br />
<form onSubmit={this.deleteAccount}>
<button
id="delete"
style={{ width: "300px", height: "50px" }}
type="submit"
>
Delete account
</button>
</form>
</div>
<AuthElements
google={this.signInWithGoogle}
out={this.signUserOut}
microsoft={this.signInUsingMicrosoft}
delete={this.deleteAccount}
/>
);
}
}
66 changes: 66 additions & 0 deletions src/AuthElements.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
export function AuthElements(props) {
return (
<div
style={{
display: "grid",
alignItems: "right",
justifyContent: "right",
}}
>
<h1 id="banner"> </h1>
<br />
<form onSubmit={props.google}>
<button
id="google"
style={{
width: "300px",
height: "50px",
}}
type="submit"
>
Sign in with Google
</button>
</form>
<br />
<br />
<form onSubmit={props.out}>
<button
type="submit"
id="signOut"
style={{
width: "300px",
height: "50px",
}}
>
Sign out
</button>
</form>
<form onSubmit={props.microsoft}>
<button
type="submit"
id="microsoft"
style={{
width: "300px",
height: "50px",
}}
>
Sign in with Microsoft
</button>
</form>
<br />
<br />
<form onSubmit={props.delete}>
<button
id="delete"
style={{
width: "300px",
height: "50px",
}}
type="submit"
>
Delete account
</button>
</form>
</div>
);
}