2016-09-07 23:47:22 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
import InlineSVG from 'react-inlinesvg';
|
2017-02-22 20:29:35 +01:00
|
|
|
|
2016-09-07 23:47:22 +02:00
|
|
|
const exitUrl = require('../../../images/exit.svg');
|
|
|
|
|
2016-09-08 03:48:45 +02:00
|
|
|
class KeyboardShortcutModal extends React.Component {
|
|
|
|
componentDidMount() {
|
|
|
|
this.isMac = navigator.userAgent.toLowerCase().indexOf('mac') !== -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<section className="keyboard-shortcuts">
|
|
|
|
<header className="keyboard-shortcuts__header">
|
|
|
|
<h2>Keyboard Shortcuts</h2>
|
|
|
|
<button className="keyboard-shortcuts__close" onClick={this.props.closeModal}>
|
|
|
|
<InlineSVG src={exitUrl} alt="Close Keyboard Shortcuts Overlay" />
|
|
|
|
</button>
|
|
|
|
</header>
|
2016-11-08 18:39:46 +01:00
|
|
|
<ul title="keyboard shortcuts">
|
2016-09-08 03:48:45 +02:00
|
|
|
<li className="keyboard-shortcut-item">
|
|
|
|
<span className="keyboard-shortcut__command">Shift + Tab</span>
|
|
|
|
<span>Tidy</span>
|
|
|
|
</li>
|
|
|
|
<li className="keyboard-shortcut-item">
|
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + S' : 'Control + S'}
|
|
|
|
</span>
|
|
|
|
<span>Save</span>
|
|
|
|
</li>
|
|
|
|
<li className="keyboard-shortcut-item">
|
2016-09-28 21:17:29 +02:00
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + [' : 'Control + ['}
|
|
|
|
</span>
|
|
|
|
<span>Indent Code Left</span>
|
2016-09-08 03:48:45 +02:00
|
|
|
</li>
|
|
|
|
<li className="keyboard-shortcut-item">
|
2016-09-28 21:17:29 +02:00
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + ]' : 'Control + ]'}
|
|
|
|
</span>
|
|
|
|
<span>Indent Code Right</span>
|
2016-09-08 03:48:45 +02:00
|
|
|
</li>
|
|
|
|
<li className="keyboard-shortcut-item">
|
2016-09-28 21:17:29 +02:00
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + /' : 'Control + /'}
|
|
|
|
</span>
|
2016-09-08 03:48:45 +02:00
|
|
|
<span>Comment Line</span>
|
|
|
|
</li>
|
2016-09-28 21:17:29 +02:00
|
|
|
<li className="keyboard-shortcut-item">
|
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + Enter' : 'Control + Enter'}</span>
|
|
|
|
<span>Start Sketch</span>
|
|
|
|
</li>
|
|
|
|
<li className="keyboard-shortcut-item">
|
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + Shift + Enter' : 'Control + Shift + Enter'}
|
|
|
|
</span>
|
|
|
|
<span>Stop Sketch</span>
|
|
|
|
</li>
|
2016-11-08 18:39:46 +01:00
|
|
|
<li className="keyboard-shortcut-item">
|
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + Shift + 1' : 'Control + Shift + 1'}
|
|
|
|
</span>
|
2016-11-12 17:53:02 +01:00
|
|
|
<span>Toggle Text-based Canvas</span>
|
2016-11-08 18:39:46 +01:00
|
|
|
</li>
|
|
|
|
<li className="keyboard-shortcut-item">
|
|
|
|
<span className="keyboard-shortcut__command">
|
|
|
|
{this.isMac ? 'Command + Shift + 2' : 'Control + Shift + 2'}
|
|
|
|
</span>
|
|
|
|
<span>Turn Off Text-based Canvas</span>
|
|
|
|
</li>
|
2016-09-08 03:48:45 +02:00
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
2016-09-07 23:47:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
KeyboardShortcutModal.propTypes = {
|
|
|
|
closeModal: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default KeyboardShortcutModal;
|