From c5d9f44de299e54e7cd4f71b02dd63d6a5edb423 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Mon, 17 Apr 2017 17:29:39 -0400 Subject: [PATCH] split out ToolbarButton component --- .../MarkdownControlElements/Toolbar.js | 28 ++++++------------- .../MarkdownControlElements/ToolbarButton.js | 21 ++++++++++++++ 2 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 src/components/Widgets/MarkdownControlElements/ToolbarButton.js diff --git a/src/components/Widgets/MarkdownControlElements/Toolbar.js b/src/components/Widgets/MarkdownControlElements/Toolbar.js index 6f34274f..9f23069c 100644 --- a/src/components/Widgets/MarkdownControlElements/Toolbar.js +++ b/src/components/Widgets/MarkdownControlElements/Toolbar.js @@ -1,31 +1,21 @@ import React, { PropTypes } from 'react'; import { List } from 'immutable'; +import ToolbarButton from './ToolbarButton'; import { Icon } from '../../UI'; import styles from './Toolbar.css'; -function button(label, icon, action, active) { - const classNames = List([styles.Button]); - return (
  • - -
  • ); -} - -function toggle(...args) { - return
    {button(...args)}
    ; -} - function Toolbar(props) { const { onH1, onH2, onBold, onItalic, onLink, onToggleMode, rawMode } = props; return ( ); } diff --git a/src/components/Widgets/MarkdownControlElements/ToolbarButton.js b/src/components/Widgets/MarkdownControlElements/ToolbarButton.js new file mode 100644 index 00000000..77035cf2 --- /dev/null +++ b/src/components/Widgets/MarkdownControlElements/ToolbarButton.js @@ -0,0 +1,21 @@ +import React, { PropTypes } from 'react'; +import classnames from 'classnames'; +import { Icon } from '../../UI'; +import styles from './Toolbar.css'; + +const ToolbarButton = ({ label, icon, action, active }) => ( +
  • + +
  • +); + +ToolbarButton.propTypes = { + label: PropTypes.string.isRequired, + icon: PropTypes.string, + action: PropTypes.func.isRequired, + active: PropTypes.bool, +}; + +export default ToolbarButton;