Skip to content

Commit 064128b

Browse files
committed
Add default Button type
1 parent 8f04f5a commit 064128b

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/app/components/Button.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import styled from "styled-components";
22

3-
const Button = styled.button`
3+
const Button = styled.button.attrs((props) => ({
4+
type: props.type ?? "button",
5+
}))`
46
margin-right: 5px;
57
68
&:disabled {

src/app/components/CancelButton.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const CancelButton = ({previousUrl = "/"}) => {
66
const history = useHistory();
77
return (
88
<Button
9+
type="reset"
910
className="muted-button"
1011
onClick={(e) => {
1112
e.preventDefault();

src/features/questions/QuestionForm.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const QuestionForm = ({ questionId, formRef = null }) => {
9999
<div className="flex-row">
100100
<div className="flex-small">
101101
<Button
102+
type="submit"
102103
onClick={handleSubmit}
103104
disabled={!canSubmit}
104105
className={canSubmit ? "" : "muted-button"}

src/helpers/globals.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ export const makeCancelable = (promise) => {
7979

8080
const wrappedPromise = new Promise((resolve, reject) => {
8181
promise.then((val) =>
82-
hasCanceled_ ? reject({isCanceled: true}) : resolve(val)
82+
hasCanceled_ ? reject({ isCanceled: true }) : resolve(val)
8383
);
8484
promise.catch((error) =>
85-
hasCanceled_ ? reject({isCanceled: true}) : reject(error)
85+
hasCanceled_ ? reject({ isCanceled: true }) : reject(error)
8686
);
8787
});
8888

0 commit comments

Comments
 (0)