Improve "Send Code" button style.

This commit is contained in:
Yang Luo 2021-06-27 00:50:14 +08:00
parent 2ba44748c2
commit a42a76400e
6 changed files with 36 additions and 33 deletions

View File

@ -85,7 +85,7 @@ export const ResetModal = (props) => {
</Row> </Row>
<Row style={{width: "100%", marginBottom: "20px"}}> <Row style={{width: "100%", marginBottom: "20px"}}>
<CountDownInput <CountDownInput
defaultButtonText={i18next.t("code:Send code")} defaultButtonText={i18next.t("code:Send Code")}
textBefore={i18next.t("code:Code You Received")} textBefore={i18next.t("code:Code You Received")}
placeHolder={i18next.t("code:Enter your code")} placeHolder={i18next.t("code:Enter your code")}
onChange={setCode} onChange={setCode}

View File

@ -318,7 +318,7 @@ class ForgetPage extends React.Component {
<CountDownInput <CountDownInput
disabled={this.state.username === "" || this.state.verifyType === ""} disabled={this.state.username === "" || this.state.verifyType === ""}
placeHolder={i18next.t("code:Verify code")} placeHolder={i18next.t("code:Verify code")}
defaultButtonText={i18next.t("code:Send code")} defaultButtonText={i18next.t("code:Send Code")}
onButtonClick={UserBackend.sendCode} onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[ onButtonClickArgs={[
this.state.email, this.state.email,
@ -333,7 +333,7 @@ class ForgetPage extends React.Component {
<CountDownInput <CountDownInput
disabled={this.state.username === "" || this.state.verifyType === ""} disabled={this.state.username === "" || this.state.verifyType === ""}
placeHolder={i18next.t("code:Verify code")} placeHolder={i18next.t("code:Verify code")}
defaultButtonText={i18next.t("code:Send code")} defaultButtonText={i18next.t("code:Send Code")}
onButtonClick={UserBackend.sendCode} onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[ onButtonClickArgs={[
this.state.phone, this.state.phone,

View File

@ -241,7 +241,7 @@ class SignupPage extends React.Component {
> >
<CountDownInput <CountDownInput
disabled={!this.state.validEmail} disabled={!this.state.validEmail}
defaultButtonText={i18next.t("code:Send code")} defaultButtonText={i18next.t("code:Send Code")}
onButtonClick={UserBackend.sendCode} onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[this.state.email, "email", application?.organizationObj.owner + "/" + application?.organizationObj.name]} onButtonClickArgs={[this.state.email, "email", application?.organizationObj.owner + "/" + application?.organizationObj.name]}
coolDownTime={60} coolDownTime={60}
@ -335,7 +335,7 @@ class SignupPage extends React.Component {
> >
<CountDownInput <CountDownInput
disabled={!this.state.validPhone} disabled={!this.state.validPhone}
defaultButtonText={i18next.t("code:Send code")} defaultButtonText={i18next.t("code:Send Code")}
onButtonClick={UserBackend.sendCode} onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[this.state.phone, "phone", application.organizationObj.owner + "/" + application.organizationObj.name]} onButtonClickArgs={[this.state.phone, "phone", application.organizationObj.owner + "/" + application.organizationObj.name]}
coolDownTime={60} coolDownTime={60}

View File

@ -12,13 +12,15 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import {Col, Input, Modal, Row} from "antd"; import {Button, Col, Input, Modal, Row} from "antd";
import React from "react"; import React from "react";
import * as Setting from "../Setting"; import * as Setting from "../Setting";
import i18next from "i18next"; import i18next from "i18next";
import * as UserBackend from "../backend/UserBackend"; import * as UserBackend from "../backend/UserBackend";
import { AuditOutlined, VerifiedOutlined } from "@ant-design/icons"; import { AuditOutlined, VerifiedOutlined } from "@ant-design/icons";
const { Search } = Input;
export const CountDownInput = (props) => { export const CountDownInput = (props) => {
const {defaultButtonText, disabled, prefix, textBefore, placeHolder, onChange, coolDownTime, onButtonClick, onButtonClickArgs} = props; const {defaultButtonText, disabled, prefix, textBefore, placeHolder, onChange, coolDownTime, onButtonClick, onButtonClickArgs} = props;
const [buttonText, setButtonText] = React.useState(defaultButtonText); const [buttonText, setButtonText] = React.useState(defaultButtonText);
@ -112,28 +114,29 @@ export const CountDownInput = (props) => {
}; };
return ( return (
<Input <div>
addonBefore={textBefore} <Search
disabled={disabled} addonBefore={textBefore}
prefix={prefix !== null ? getIcon(prefix) : null} disabled={disabled}
placeholder={placeHolder} prefix={prefix !== null ? getIcon(prefix) : null}
onChange={e => onChange(e.target.value)} placeholder={placeHolder}
addonAfter={ onChange={e => onChange(e.target.value)}
<div> enterButton={
<button <Button type={"primary"} disabled={disabled}>
disabled={disabled} <div style={{fontSize: 14}}>
onClick={clickButton} {buttonText}
style={{backgroundColor: "#fafafa", border: "none"}}> </div>
{buttonText} </Button>
</button> }
<Modal onSearch={clickButton}
visible={visible} />
onCancel={handleCancel} <Modal
onOk={handleOk} visible={visible}
> onCancel={handleCancel}
{renderCheck()} onOk={handleOk}
</Modal> >
</div> {renderCheck()}
}/> </Modal>
</div>
); );
} }

View File

@ -66,10 +66,10 @@
"Missing parameter.": "Missing parameter." "Missing parameter.": "Missing parameter."
}, },
"code": "code":
{ {
"Verify code": "Verify code", "Verify code": "Verify code",
"Please input your verification code!": "Please input your verification code!", "Please input your verification code!": "Please input your verification code!",
"Send code": "Send code", "Send Code": "Send Code",
"Empty Code": "Empty Code", "Empty Code": "Empty Code",
"Code Sent": "Code Sent", "Code Sent": "Code Sent",
"Code You Received": "Code You Received", "Code You Received": "Code You Received",

View File

@ -76,7 +76,7 @@
"Wrong code!": "验证码错误!", "Wrong code!": "验证码错误!",
"Code You Received": "验证码", "Code You Received": "验证码",
"Empty Code": "验证码为空", "Empty Code": "验证码为空",
"Send code": "发送验证码", "Send Code": "发送验证码",
"code sent": "验证码已发送", "code sent": "验证码已发送",
"Email code": "邮箱验证码", "Email code": "邮箱验证码",
"Phone code": "手机验证码", "Phone code": "手机验证码",