Skip to content

Commit 3a6781b

Browse files
committed
use buttons
1 parent 360b0b7 commit 3a6781b

3 files changed

Lines changed: 34 additions & 28 deletions

File tree

frontend/src/ts/components/common/Button.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type BaseProps = {
2121
};
2222

2323
type ButtonProps = BaseProps & {
24+
type?: "button" | "submit" | "reset";
2425
href?: never;
2526
sameTarget?: true;
2627
disabled?: boolean;
@@ -107,7 +108,8 @@ export function Button(props: ButtonProps | AnchorProps): JSXElement {
107108
}
108109
else={
109110
<button
110-
type="button"
111+
// oxlint-disable-next-line button-has-type
112+
type={(props as ButtonProps).type ?? "button"}
111113
class={getClasses()}
112114
onClick={() => props.onClick?.()}
113115
onMouseEnter={() => props.onMouseEnter?.()}

frontend/src/ts/components/pages/login/Login.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
showNoticeNotification,
1515
showErrorNotification,
1616
} from "../../../stores/notifications";
17+
import { Button } from "../../common/Button";
1718
import { H3 } from "../../common/Headers";
1819
import { Separator } from "../../common/Separator";
1920

@@ -82,20 +83,22 @@ export function Login(): JSXElement {
8283
class="p-0"
8384
/>
8485
<div class="grid grid-cols-2 gap-4">
85-
<button
86-
type="button"
86+
<Button
87+
fa={{
88+
icon: "fa-google",
89+
variant: "brand",
90+
}}
8791
disabled={!getLoginPageInputsEnabled()}
8892
onClick={handleSignInWithGoogle}
89-
>
90-
<i class="fab fa-google"></i>
91-
</button>
92-
<button
93-
type="button"
93+
/>
94+
<Button
95+
fa={{
96+
icon: "fa-github",
97+
variant: "brand",
98+
}}
9499
disabled={!getLoginPageInputsEnabled()}
95100
onClick={handleSignInWithGitHub}
96-
>
97-
<i class="fab fa-github"></i>
98-
</button>
101+
/>
99102
</div>
100103
<form class="grid w-full gap-2" onSubmit={handleSignIn}>
101104
<Separator text="or" />
@@ -128,24 +131,23 @@ export function Login(): JSXElement {
128131
<div>remember me</div>
129132
</label>
130133
</div>
131-
<button
134+
<Button
132135
type="submit"
133136
class="signIn"
134137
disabled={!getLoginPageInputsEnabled()}
135-
>
136-
<i class="fas fa-sign-in-alt"></i>
137-
sign in
138-
</button>
138+
fa={{
139+
icon: "fa-sign-in-alt",
140+
}}
141+
text="sign in"
142+
/>
139143
</form>
140-
<button
141-
type="button"
142-
class="text text-xs"
143-
style={{ "justify-content": "right" }}
144+
<Button
145+
variant="text"
146+
class="w-max justify-self-end text-xs"
147+
text="forgot password?"
144148
onClick={() => ForgotPasswordModal.show()}
145149
disabled={!getLoginPageInputsEnabled()}
146-
>
147-
forgot password?
148-
</button>
150+
/>
149151
</div>
150152
);
151153
}

frontend/src/ts/components/pages/login/Register.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { isDevEnvironment } from "../../../utils/misc";
2828
import { remoteValidation } from "../../../utils/remote-validation";
2929
import TypoList from "../../../utils/typo-list";
30+
import { Button } from "../../common/Button";
3031
import { H3 } from "../../common/Headers";
3132
import { ValidatedInput } from "../../ui/ValidatedInput";
3233

@@ -213,13 +214,14 @@ export function Register(): JSXElement {
213214
setPasswordVerifyValid(passwordValid() && result.success);
214215
}}
215216
/>
216-
<button
217+
<Button
217218
type="submit"
218219
disabled={!isRegisterFormComplete() || !getLoginPageInputsEnabled()}
219-
>
220-
<i class="fas fa-user-plus"></i>
221-
sign up
222-
</button>
220+
fa={{
221+
icon: "fa-user-plus",
222+
}}
223+
text="sign up"
224+
/>
223225
</form>
224226
</div>
225227
);

0 commit comments

Comments
 (0)