-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
45 changed files
with
20,681 additions
and
709 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
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,81 @@ | ||
import React, { Component } from "react"; | ||
import Login from "./components/LoginOut"; | ||
import UserUpdate from "./components/UserUpdate"; | ||
import Err from "./components/Error"; | ||
import "./index.css"; | ||
|
||
// this is similar to original auth but designed to fit in modal | ||
class Auth extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
user: { | ||
login: "Login with credential", | ||
register: "Register an account", | ||
forgot: "Forgot your password?" | ||
}, | ||
info: { | ||
email: "Change your email", | ||
password: "Change your password" | ||
}, | ||
message: "", | ||
response: "" | ||
}; | ||
} | ||
|
||
flagResponse = (flag, message) => { | ||
this.setState({ response: message }); | ||
}; | ||
|
||
flagState = (mode, name) => { | ||
const { [name]: value } = this.state[mode]; | ||
this.setState({ message: value }); | ||
}; | ||
|
||
renderBody(swt) { | ||
switch (swt) { | ||
case "user_auth": | ||
return <Login flag={this.flagState} result={this.flagResponse} />; | ||
case "info_auth": | ||
return <UserUpdate flag={this.flagState} result={this.flagResponse} />; | ||
default: | ||
console.log("errrrr"); | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
const mode = this.props.switch; | ||
const { user, info } = this.state; | ||
mode.match(/\user/) | ||
? this.setState({ message: user.login }) | ||
: this.setState({ message: info.email }); | ||
} | ||
|
||
render() { | ||
const { message, response } = this.state; | ||
|
||
return [ | ||
<div key="modalheader" className="modal-header"> | ||
<h5 className="modal-title">{message}</h5> | ||
<button | ||
type="button" | ||
className="close" | ||
data-dismiss="modal" | ||
aria-label="Close" | ||
> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div>, | ||
<div key="modalbody" className="modal-body"> | ||
{this.renderBody(this.props.switch)} | ||
</div>, | ||
response ? ( | ||
<div key="messagebody" className="modal-footer"> | ||
<Err response={response} /> | ||
</div> | ||
) : null | ||
]; | ||
} | ||
} | ||
|
||
export default Auth; |
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,12 @@ | ||
import React, { Component } from "react"; | ||
import "./style.css"; | ||
|
||
const Err = props => { | ||
return ( | ||
<div className="card text-white bg-danger mb-3"> | ||
<div className="card-body">{props.response}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Err; |
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 { default } from "./Error"; |
Empty file.
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,31 @@ | ||
input[type="submit"] { | ||
display: inline-block; | ||
border-radius: .25rem; | ||
border-width: 0px; | ||
padding: .5rem 1rem; | ||
color: white; | ||
background-color: #007bff; | ||
cursor: pointer; | ||
--webkit-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
-moz-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
-ms-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
-o-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
} | ||
|
||
input[type="submit"]:hover { | ||
background-color: #0768d0; | ||
} | ||
|
||
p.--anchor>a { | ||
cursor: pointer; | ||
--webkit-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
-moz-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
-ms-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
-o-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; | ||
} | ||
|
||
p.--anchor>a:hover { | ||
color: #ff2b2b !important; | ||
} |
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
Oops, something went wrong.