Skip to content

Commit ed3cf36

Browse files
authored
Merge pull request #669 from ianhi:commit-button
Use title to describe why commit button is disabled
2 parents 6169af0 + e332ddc commit ed3cf36

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/CommitBox.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export class CommitBox extends React.Component<
6868
*/
6969
render(): React.ReactElement {
7070
const disabled = !(this.props.hasFiles && this.state.summary);
71+
const title = !this.props.hasFiles
72+
? 'Disabled: No files are staged for commit'
73+
: !this.state.summary
74+
? 'Disabled: No commit message summary'
75+
: 'Commit';
7176
return (
7277
<form className={commitFormClass}>
7378
<input
@@ -90,7 +95,7 @@ export class CommitBox extends React.Component<
9095
<input
9196
className={commitButtonClass}
9297
type="button"
93-
title="Commit"
98+
title={title}
9499
value="Commit"
95100
disabled={disabled}
96101
onClick={this._onCommitClick}

0 commit comments

Comments
 (0)