-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into schedules_refactor
- Loading branch information
Showing
83 changed files
with
2,991 additions
and
2,135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-84 Bytes
(100%)
...apshots/Mobile-creates-a-transaction-from-accounts-id-page-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-186 Bytes
(99%)
...apshots/Mobile-creates-a-transaction-from-accounts-id-page-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-89 Bytes
(99%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-183 Bytes
(99%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-3-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+68 Bytes
(100%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-4-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
|
||
import { css } from 'glamor'; | ||
import remarkGfm from 'remark-gfm'; | ||
|
||
import { useResponsive } from '../ResponsiveProvider'; | ||
import { type CSSProperties, theme } from '../style'; | ||
import { remarkBreaks, sequentialNewlinesPlugin } from '../util/markdown'; | ||
|
||
import Text from './common/Text'; | ||
|
||
const remarkPlugins = [sequentialNewlinesPlugin, remarkGfm, remarkBreaks]; | ||
|
||
const markdownStyles = css({ | ||
display: 'block', | ||
maxWidth: 350, | ||
padding: 8, | ||
overflowWrap: 'break-word', | ||
'& p': { | ||
margin: 0, | ||
':not(:first-child)': { | ||
marginTop: '0.25rem', | ||
}, | ||
}, | ||
'& ul, & ol': { | ||
listStylePosition: 'inside', | ||
margin: 0, | ||
paddingLeft: 0, | ||
}, | ||
'&>* ul, &>* ol': { | ||
marginLeft: '1.5rem', | ||
}, | ||
'& li>p': { | ||
display: 'contents', | ||
}, | ||
'& blockquote': { | ||
paddingLeft: '0.75rem', | ||
borderLeft: '3px solid ' + theme.markdownDark, | ||
margin: 0, | ||
}, | ||
'& hr': { | ||
borderTop: 'none', | ||
borderLeft: 'none', | ||
borderRight: 'none', | ||
borderBottom: '1px solid ' + theme.markdownNormal, | ||
}, | ||
'& code': { | ||
backgroundColor: theme.markdownLight, | ||
padding: '0.1rem 0.5rem', | ||
borderRadius: '0.25rem', | ||
}, | ||
'& pre': { | ||
padding: '0.5rem', | ||
backgroundColor: theme.markdownLight, | ||
borderRadius: '0.5rem', | ||
margin: 0, | ||
':not(:first-child)': { | ||
marginTop: '0.25rem', | ||
}, | ||
'& code': { | ||
background: 'inherit', | ||
padding: 0, | ||
borderRadius: 0, | ||
}, | ||
}, | ||
'& table, & th, & td': { | ||
border: '1px solid ' + theme.markdownNormal, | ||
}, | ||
'& table': { | ||
borderCollapse: 'collapse', | ||
wordBreak: 'break-word', | ||
}, | ||
'& td': { | ||
padding: '0.25rem 0.75rem', | ||
}, | ||
}); | ||
|
||
type NotesProps = { | ||
notes: string; | ||
editable?: boolean; | ||
focused?: boolean; | ||
onChange?: (value: string) => void; | ||
onBlur?: (value: string) => void; | ||
getStyle?: (editable: boolean) => CSSProperties; | ||
}; | ||
|
||
export default function Notes({ | ||
notes, | ||
editable, | ||
focused, | ||
onChange, | ||
onBlur, | ||
getStyle, | ||
}: NotesProps) { | ||
const { isNarrowWidth } = useResponsive(); | ||
const _onChange = value => { | ||
onChange?.(value); | ||
}; | ||
|
||
const textAreaRef = useRef<HTMLTextAreaElement>(); | ||
|
||
useEffect(() => { | ||
if (focused && editable) { | ||
textAreaRef.current.focus(); | ||
} | ||
}, [focused, editable]); | ||
|
||
return editable ? ( | ||
<textarea | ||
ref={textAreaRef} | ||
className={`${css({ | ||
border: '1px solid ' + theme.buttonNormalBorder, | ||
padding: 7, | ||
...(!isNarrowWidth && { minWidth: 350, minHeight: 120 }), | ||
outline: 'none', | ||
backgroundColor: theme.tableBackground, | ||
color: theme.tableText, | ||
...getStyle?.(editable), | ||
})}`} | ||
value={notes || ''} | ||
onChange={e => _onChange(e.target.value)} | ||
onBlur={e => onBlur?.(e.target.value)} | ||
placeholder="Notes (markdown supported)" | ||
/> | ||
) : ( | ||
<Text {...markdownStyles} style={{ ...getStyle?.(editable) }}> | ||
<ReactMarkdown remarkPlugins={remarkPlugins} linkTarget="_blank"> | ||
{notes} | ||
</ReactMarkdown> | ||
</Text> | ||
); | ||
} |
Oops, something went wrong.