-
Notifications
You must be signed in to change notification settings - Fork 79
/
moveThoughtDown.tsx
38 lines (35 loc) · 1.34 KB
/
moveThoughtDown.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react'
import { Key } from 'ts-key-enum'
import IconType from '../@types/Icon'
import Shortcut from '../@types/Shortcut'
import moveThoughtDown from '../action-creators/moveThoughtDown'
import isDocumentEditable from '../util/isDocumentEditable'
// eslint-disable-next-line jsdoc/require-jsdoc
const Icon = ({ fill = 'black', size = 20, style }: IconType) => (
<svg
version='1.1'
className='icon'
xmlns='http://www.w3.org/2000/svg'
width={size}
height={size}
fill={fill}
style={style}
viewBox='0 0 19.481 19.481'
enableBackground='new 0 0 19.481 19.481'
>
<g>
<path d='m10.201,.758l2.478,5.865 6.344,.545c0.44,0.038 0.619,0.587 0.285,0.876l-4.812,4.169 1.442,6.202c0.1,0.431-0.367,0.77-0.745,0.541l-5.452-3.288-5.452,3.288c-0.379,0.228-0.845-0.111-0.745-0.541l1.442-6.202-4.813-4.17c-0.334-0.289-0.156-0.838 0.285-0.876l6.344-.545 2.478-5.864c0.172-0.408 0.749-0.408 0.921,0z' />
</g>
</svg>
)
const moveThoughtDownShortcut: Shortcut = {
id: 'moveThoughtDown',
label: 'Move Thought Down',
description: 'Move the current thought down.',
gesture: 'dud',
keyboard: { key: Key.ArrowDown, meta: true, shift: true },
svg: Icon,
canExecute: getState => isDocumentEditable() && !!getState().cursor,
exec: dispatch => dispatch(moveThoughtDown()),
}
export default moveThoughtDownShortcut