client/src/components/SlateEditor/MarkButton.js
author ymh <ymh.work@gmail.com>
Fri, 16 Nov 2018 11:19:13 +0100
changeset 173 0e6703cd0968
permissions -rw-r--r--
Correct the Note editor. Split the source file in sub components. Correct a timing problem on the editor checkbox.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
173
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import React from 'react';
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
import { withNamespaces } from 'react-i18next';
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
/**
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * Render a mark-toggling toolbar button.
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @param {String} type
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * @param {String} icon
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 * @return {Element}
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 */
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
export default withNamespaces("")(({icon, isActive, onMouseDown, t}) => (
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
  <span className={"button sticky-top" + ((!isActive)?" text-primary":" text-dark")} onMouseDown={onMouseDown} data-active={isActive} title={t("common." + icon)} >
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    <span className="material-icons">{icon}</span>
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
  </span>
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
));
0e6703cd0968 Correct the Note editor.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17