1+ import { ISettingRegistry } from '@jupyterlab/coreutils' ;
2+
13import * as React from 'react' ;
4+ import TextareaAutosize from 'react-textarea-autosize' ;
25import { classes } from 'typestyle' ;
6+
37import {
48 stagedCommitButtonDisabledStyle ,
59 stagedCommitButtonReadyStyle ,
@@ -12,6 +16,7 @@ import {
1216export interface ICommitBoxProps {
1317 hasFiles : boolean ;
1418 commitFunc : ( message : string ) => Promise < void > ;
19+ settings : ISettingRegistry . ISettings ;
1520}
1621
1722export interface ICommitBoxState {
@@ -73,16 +78,13 @@ export class CommitBox extends React.Component<
7378 className = { stagedCommitStyle }
7479 onKeyPress = { event => this . onKeyPress ( event ) }
7580 >
76- < textarea
81+ < TextareaAutosize
7782 className = { classes ( textInputStyle , stagedCommitMessageStyle ) }
7883 disabled = { ! this . props . hasFiles }
79- placeholder = {
80- this . props . hasFiles
81- ? 'Input message to commit staged changes'
82- : 'Stage your changes before commit'
83- }
84- value = { this . state . value }
84+ minRows = { 2 }
8585 onChange = { this . handleChange }
86+ placeholder = { this . _placeholder ( ) }
87+ value = { this . state . value }
8688 />
8789 < input
8890 className = { this . commitButtonStyle ( this . props . hasFiles ) }
@@ -97,4 +99,16 @@ export class CommitBox extends React.Component<
9799 </ form >
98100 ) ;
99101 }
102+
103+ protected _placeholder = ( ) : string => {
104+ if ( this . props . settings . composite [ 'simpleStaging' ] ) {
105+ return this . props . hasFiles
106+ ? 'Input message to commit selected changes'
107+ : 'Select changes to enable commit' ;
108+ } else {
109+ return this . props . hasFiles
110+ ? 'Input message to commit staged changes'
111+ : 'Stage your changes before commit' ;
112+ }
113+ } ;
100114}
0 commit comments