* create AuthorizeBtnContainer * remove Servers and AuthorizeBtn from Schemes' concern * add AuthorizeBtnContainer to base * strengthen OAS3 definitionsToAuthorize * drop obsolete tests * linter fixes
31 lines
952 B
JavaScript
31 lines
952 B
JavaScript
import React from "react"
|
|
import PropTypes from "prop-types"
|
|
|
|
export default class AuthorizeBtn extends React.Component {
|
|
static propTypes = {
|
|
onClick: PropTypes.func,
|
|
isAuthorized: PropTypes.bool,
|
|
showPopup: PropTypes.bool,
|
|
getComponent: PropTypes.func.isRequired
|
|
}
|
|
|
|
render() {
|
|
let { isAuthorized, showPopup, onClick, getComponent } = this.props
|
|
|
|
//must be moved out of button component
|
|
const AuthorizationPopup = getComponent("authorizationPopup", true)
|
|
|
|
return (
|
|
<div className="auth-wrapper">
|
|
<button className={isAuthorized ? "btn authorize locked" : "btn authorize unlocked"} onClick={onClick}>
|
|
<span>Authorize</span>
|
|
<svg width="20" height="20">
|
|
<use href={ isAuthorized ? "#locked" : "#unlocked" } xlinkHref={ isAuthorized ? "#locked" : "#unlocked" } />
|
|
</svg>
|
|
</button>
|
|
{ showPopup && <AuthorizationPopup /> }
|
|
</div>
|
|
)
|
|
}
|
|
}
|