Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 38 additions & 32 deletions src/components/NotePage/NoteDetail/NoteDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
mdiArrowSplitVertical,
mdiFormatText,
mdiDeleteEmpty,
mdiRestore
mdiRestore,
mdiTagOutline
} from '@mdi/js'
import ToolbarIconButton from '../../atoms/ToolbarIconButton'
import Toolbar from '../../atoms/Toolbar'
Expand All @@ -28,6 +29,7 @@ import {
} from '../../../lib/styled/styleFunctions'
import ToolbarExportButton from '../../atoms/ToolbarExportButton'
import { getFileList } from '../../../lib/dnd'
import Icon from '../../atoms/Icon'

export const StyledNoteDetailContainer = styled.div`
${secondaryBackgroundColor}
Expand Down Expand Up @@ -415,10 +417,7 @@ export default class NoteDetail extends React.Component<
)}
</div>
<Toolbar>
<TagList
tags={this.state.tags}
removeTagByName={this.removeTagByName}
/>
<Icon className='icon' path={mdiTagOutline} />
<input
className='tagInput'
ref={this.newTagNameInputRef}
Expand All @@ -427,36 +426,43 @@ export default class NoteDetail extends React.Component<
onChange={this.updateNewTagName}
onKeyDown={this.handleNewTagNameInputKeyDown}
/>
<ToolbarSeparator />
<ToolbarExportButton note={this.props.note} />
<ToolbarIconButton onClick={() => {}} path={mdiFormatText} />
<ToolbarIconButton
className={splitMode ? 'active' : ''}
onClick={toggleSplitMode}
path={mdiArrowSplitVertical}
/>
<ToolbarIconButton
className={previewMode ? 'active' : ''}
onClick={togglePreviewMode}
path={mdiEyeOutline}

<TagList
tags={this.state.tags}
removeTagByName={this.removeTagByName}
/>
{note.trashed ? (
<>
<ToolbarIconButton
onClick={this.untrashNote}
path={mdiRestore}
/>
<ToolbarIconButton
onClick={this.purgeNote}
path={mdiDeleteEmpty}
/>
</>
) : (
<ToolbarSeparator />
<div className='icons'>
<ToolbarExportButton note={this.props.note} />
<ToolbarIconButton onClick={() => {}} path={mdiFormatText} />
<ToolbarIconButton
onClick={this.trashNote}
path={mdiTrashCan}
className={splitMode ? 'active' : ''}
onClick={toggleSplitMode}
path={mdiArrowSplitVertical}
/>
)}
<ToolbarIconButton
className={previewMode ? 'active' : ''}
onClick={togglePreviewMode}
path={mdiEyeOutline}
/>
{note.trashed ? (
<>
<ToolbarIconButton
onClick={this.untrashNote}
path={mdiRestore}
/>
<ToolbarIconButton
onClick={this.purgeNote}
path={mdiDeleteEmpty}
/>
</>
) : (
<ToolbarIconButton
onClick={this.trashNote}
path={mdiTrashCan}
/>
)}
</div>
</Toolbar>
</>
)}
Expand Down
35 changes: 24 additions & 11 deletions src/components/NotePage/NoteDetail/TagList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback } from 'react'
import Icon from '../../atoms/Icon'
import { mdiClose, mdiTagOutline } from '@mdi/js'
import { mdiClose } from '@mdi/js'
import styled from '../../../lib/styled'
import { iconColor } from '../../../lib/styled/styleFunctions'

Expand All @@ -24,11 +24,23 @@ const TagListItem = ({ tagName, removeTagByName }: TagListItemProps) => {
)
}

const StyledParentContainer = styled.div`
flex: 0 1 auto;
height: 100%;
overflow: hidden;
`

const StyledContainer = styled.div`
display: flex;
overflow: auto;
padding-bottom: 17px;
padding-rigth: 4%;

.listItem {
margin: 0 2px;
height: 32px;
display: flex;
align-items: center;
}

.icon {
Expand Down Expand Up @@ -60,16 +72,17 @@ interface TagListProps {

const TagList = ({ tags, removeTagByName }: TagListProps) => {
return (
<StyledContainer>
<Icon className='icon' path={mdiTagOutline} />
{tags.map(tag => (
<TagListItem
key={tag}
tagName={tag}
removeTagByName={removeTagByName}
/>
))}
</StyledContainer>
<StyledParentContainer>
<StyledContainer>
{tags.map(tag => (
<TagListItem
key={tag}
tagName={tag}
removeTagByName={removeTagByName}
/>
))}
</StyledContainer>
</StyledParentContainer>
)
}

Expand Down
7 changes: 7 additions & 0 deletions src/components/atoms/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ const Toolbar = styled.div`
align-items: center;
${borderTop}
padding: 0 5px;

.icons {
flex: 1 0 0;
align-items: center;
display: flex;
justify-content: flex-end;
}
`

export default Toolbar
4 changes: 3 additions & 1 deletion src/components/atoms/ToolbarExportButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { usePreferences } from '../../lib/preferences'
import { rehypeCodeMirror } from './MarkdownPreviewer'
import { usePreviewStyle } from '../../lib/preview'
import { downloadString } from '../../lib/download'
import { mdiFileExport } from '@mdi/js'
import Icon from './Icon'

const sanitizeSchema = mergeDeepRight(gh, {
attributes: { '*': ['className'] }
Expand Down Expand Up @@ -132,7 +134,7 @@ const ToolbarExportButton = ({ className, note }: ToolbarExportButtonProps) => {
onClick={openExportButtonContextMenu}
className={className}
>
<span>Export</span>
<Icon path={mdiFileExport} />
</StyledButton>
)
}
Expand Down