Skip to content

Commit

Permalink
Merge pull request #57 from Qeneke/patch-1
Browse files Browse the repository at this point in the history
Added prop closedTitle and closedMessage
  • Loading branch information
nitin42 committed Feb 23, 2019
2 parents 29537a0 + 30a26c3 commit 0c1040c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ you can also handle the result with a callback

### Minimise, maximise and close the window

```jsx
<Terminal
closedTitle='OOPS! You closed the window.'
closedMessage='Click on the icon to reopen.'
/>
```

<p align="center">
<img src="https://camo.githubusercontent.com/3748e38abc72cb7860ba8f2272c0329ded5bfe23/687474703a2f2f672e7265636f726469742e636f2f5a5965554b6d62414e512e676966" />
</p>
Expand Down Expand Up @@ -418,6 +425,8 @@ Use
| **description** | object | {} |
| **commands** | object | { clear, help, show, } |
| **msg** | string | - |
| **closedTitle** | string | OOPS! You closed the window. |
| **closedMessage** | string | Click on the icon to reopen. |
| **watchConsoleLogging** | bool | false |
| **commandPassThrough** | function | null |
| **promptSymbol** | string | > |
Expand Down
6 changes: 4 additions & 2 deletions src/js/components/Terminal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ class Terminal extends Component {
// Show msg (on window close)
getNote = () => (
<Note>
<h1>OOPS! You closed the window.</h1>
<h1>
{this.props.closedTitle}
</h1>
<img
src="https://camo.githubusercontent.com/95ad3fffa11193f85dedbf14ca67e4c5c07182d0/687474703a2f2f69636f6e732e69636f6e617263686976652e636f6d2f69636f6e732f70616f6d656469612f736d616c6c2d6e2d666c61742f313032342f7465726d696e616c2d69636f6e2e706e67"
width="200"
Expand All @@ -277,7 +279,7 @@ class Terminal extends Component {
onKeyPress={this.toggleState('show')}
onClick={this.toggleState('show')}
/>
Click on the icon to reopen.
{this.props.closedMessage}
</Note>
);

Expand Down
4 changes: 4 additions & 0 deletions src/js/components/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const TerminalPropTypes = {
hideTopBar: PropTypes.bool,
allowTabs: PropTypes.bool,
msg: PropTypes.string,
closedTitle: PropTypes.string,
closedMessage: PropTypes.string,
color: PropTypes.string,
style: PropTypes.object, // eslint-disable-line
prompt: PropTypes.string,
Expand Down Expand Up @@ -79,6 +81,8 @@ export const TerminalDefaultProps = {
allowTabs: true,
showActions: true,
msg: '',
closedTitle: 'OOPS! You closed the window.',
closedMessage: 'Click on the icon to reopen.',
color: 'green',
style: {},
prompt: 'green',
Expand Down

0 comments on commit 0c1040c

Please sign in to comment.