Put the highlight menu in a container
This commit is contained in:
@ -182,7 +182,6 @@ export function MarkdownNote(props: MarkdownNote): JSX.Element {
|
|||||||
css={{
|
css={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
...RcEditorStyles(isDark, true),
|
...RcEditorStyles(isDark, true),
|
||||||
pr: '25px',
|
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
|
onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
if (event.code.toLowerCase() === 'escape') {
|
if (event.code.toLowerCase() === 'escape') {
|
||||||
|
|||||||
@ -15,12 +15,22 @@ import { HighlightViewNote } from './HighlightNotes'
|
|||||||
import ReactMarkdown from 'react-markdown'
|
import ReactMarkdown from 'react-markdown'
|
||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import { isDarkTheme } from '../../lib/themeUpdater'
|
import { isDarkTheme } from '../../lib/themeUpdater'
|
||||||
|
import { HighlightsMenu } from '../templates/homeFeed/HighlightItem'
|
||||||
|
import { ReadableItem } from '../../lib/networking/queries/useGetLibraryItemsQuery'
|
||||||
|
import { UserBasicData } from '../../lib/networking/queries/useGetViewerQuery'
|
||||||
|
|
||||||
type HighlightViewProps = {
|
type HighlightViewProps = {
|
||||||
|
item: ReadableItem
|
||||||
|
viewer: UserBasicData
|
||||||
highlight: Highlight
|
highlight: Highlight
|
||||||
author?: string
|
author?: string
|
||||||
title?: string
|
title?: string
|
||||||
updateHighlight: (highlight: Highlight) => void
|
updateHighlight: (highlight: Highlight) => void
|
||||||
|
|
||||||
|
viewInReader: (highlightId: string) => void
|
||||||
|
|
||||||
|
setLabelsTarget: (target: Highlight) => void
|
||||||
|
setShowConfirmDeleteHighlightId: (set: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledQuote = styled(Blockquote, {
|
const StyledQuote = styled(Blockquote, {
|
||||||
@ -38,13 +48,14 @@ export function HighlightView(props: HighlightViewProps): JSX.Element {
|
|||||||
const [noteMode, setNoteMode] = useState<'preview' | 'edit'>('preview')
|
const [noteMode, setNoteMode] = useState<'preview' | 'edit'>('preview')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HStack
|
<VStack
|
||||||
css={{
|
css={{
|
||||||
p: '5px',
|
p: '0px',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
alignItems: 'stretch',
|
alignItems: 'stretch',
|
||||||
bg: isDark ? '#3D3D3D' : '$thBackground',
|
bg: isDark ? '#3D3D3D' : '$thBackground',
|
||||||
borderRadius: '6px',
|
borderRadius: '6px',
|
||||||
|
border: '1px solid $thBorderSubtle',
|
||||||
boxShadow: '0px 4px 4px rgba(33, 33, 33, 0.1)',
|
boxShadow: '0px 4px 4px rgba(33, 33, 33, 0.1)',
|
||||||
'@mdDown': {
|
'@mdDown': {
|
||||||
p: '0px',
|
p: '0px',
|
||||||
@ -52,6 +63,27 @@ export function HighlightView(props: HighlightViewProps): JSX.Element {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<VStack
|
<VStack
|
||||||
|
css={{
|
||||||
|
borderBottom: '1px solid $thBorderSubtle',
|
||||||
|
width: '100%',
|
||||||
|
height: '40px',
|
||||||
|
paddingRight: '10px',
|
||||||
|
}}
|
||||||
|
distribution="end"
|
||||||
|
alignment="end"
|
||||||
|
>
|
||||||
|
<HighlightsMenu
|
||||||
|
item={props.item}
|
||||||
|
viewer={props.viewer}
|
||||||
|
highlight={props.highlight}
|
||||||
|
viewInReader={props.viewInReader}
|
||||||
|
setLabelsTarget={props.setLabelsTarget}
|
||||||
|
setShowConfirmDeleteHighlightId={
|
||||||
|
props.setShowConfirmDeleteHighlightId
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</VStack>
|
||||||
|
{/* <VStack
|
||||||
css={{
|
css={{
|
||||||
minHeight: '100%',
|
minHeight: '100%',
|
||||||
width: '10px',
|
width: '10px',
|
||||||
@ -63,7 +95,6 @@ export function HighlightView(props: HighlightViewProps): JSX.Element {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <CaretDown size={12} color="#898989" weight="fill" /> */}
|
|
||||||
<Box
|
<Box
|
||||||
css={{
|
css={{
|
||||||
width: '2px',
|
width: '2px',
|
||||||
@ -75,7 +106,7 @@ export function HighlightView(props: HighlightViewProps): JSX.Element {
|
|||||||
marginBottom: '25px',
|
marginBottom: '25px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</VStack>
|
</VStack> */}
|
||||||
|
|
||||||
<VStack
|
<VStack
|
||||||
css={{
|
css={{
|
||||||
@ -140,6 +171,6 @@ export function HighlightView(props: HighlightViewProps): JSX.Element {
|
|||||||
/>
|
/>
|
||||||
</HStack>
|
</HStack>
|
||||||
</VStack>
|
</VStack>
|
||||||
</HStack>
|
</VStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,6 +130,8 @@ export function LibraryHighlightGridCard(
|
|||||||
<SpanBox key={`hv-${highlight.id}`}>
|
<SpanBox key={`hv-${highlight.id}`}>
|
||||||
<HighlightView
|
<HighlightView
|
||||||
key={highlight.id}
|
key={highlight.id}
|
||||||
|
viewer={props.viewer}
|
||||||
|
item={props.item}
|
||||||
highlight={highlight}
|
highlight={highlight}
|
||||||
updateHighlight={(highlight) => {
|
updateHighlight={(highlight) => {
|
||||||
console.log('updated highlight: ', highlight)
|
console.log('updated highlight: ', highlight)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useState } from 'react'
|
|||||||
import { Highlight } from '../../../lib/networking/fragments/highlightFragment'
|
import { Highlight } from '../../../lib/networking/fragments/highlightFragment'
|
||||||
import { ReadableItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
|
import { ReadableItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
|
||||||
import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery'
|
import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery'
|
||||||
import { HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
|
import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
|
||||||
import { HighlightView } from '../../patterns/HighlightView'
|
import { HighlightView } from '../../patterns/HighlightView'
|
||||||
import { HighlightsMenu } from '../homeFeed/HighlightItem'
|
import { HighlightsMenu } from '../homeFeed/HighlightItem'
|
||||||
|
|
||||||
@ -35,19 +35,18 @@ export function HighlightViewItem(props: HighlightViewItemProps): JSX.Element {
|
|||||||
>
|
>
|
||||||
<VStack css={{ width: '100%', height: '100%' }}>
|
<VStack css={{ width: '100%', height: '100%' }}>
|
||||||
<HighlightView
|
<HighlightView
|
||||||
|
viewer={props.viewer}
|
||||||
|
item={props.item}
|
||||||
highlight={props.highlight}
|
highlight={props.highlight}
|
||||||
updateHighlight={props.updateHighlight}
|
updateHighlight={props.updateHighlight}
|
||||||
|
viewInReader={props.viewInReader}
|
||||||
|
setLabelsTarget={props.setSetLabelsTarget}
|
||||||
|
setShowConfirmDeleteHighlightId={
|
||||||
|
props.setShowConfirmDeleteHighlightId
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<SpanBox css={{ mb: '15px' }} />
|
<SpanBox css={{ mb: '15px' }} />
|
||||||
</VStack>
|
</VStack>
|
||||||
<HighlightsMenu
|
|
||||||
item={props.item}
|
|
||||||
viewer={props.viewer}
|
|
||||||
highlight={props.highlight}
|
|
||||||
viewInReader={props.viewInReader}
|
|
||||||
setLabelsTarget={props.setSetLabelsTarget}
|
|
||||||
setShowConfirmDeleteHighlightId={props.setShowConfirmDeleteHighlightId}
|
|
||||||
/>
|
|
||||||
</HStack>
|
</HStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -367,7 +367,10 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element {
|
|||||||
<SetHighlightLabelsModalPresenter
|
<SetHighlightLabelsModalPresenter
|
||||||
highlight={labelsTarget}
|
highlight={labelsTarget}
|
||||||
highlightId={labelsTarget.id}
|
highlightId={labelsTarget.id}
|
||||||
onOpenChange={() => setLabelsTarget(undefined)}
|
onOpenChange={() => {
|
||||||
|
mutate()
|
||||||
|
setLabelsTarget(undefined)
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{props.showConfirmDeleteNote && (
|
{props.showConfirmDeleteNote && (
|
||||||
|
|||||||
@ -66,6 +66,7 @@ export function HighlightsMenu(props: HighlightsMenuProps): JSX.Element {
|
|||||||
triggerElement={
|
triggerElement={
|
||||||
<Box
|
<Box
|
||||||
css={{
|
css={{
|
||||||
|
marginLeft: 'auto',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
height: '20px',
|
height: '20px',
|
||||||
width: '20px',
|
width: '20px',
|
||||||
|
|||||||
Reference in New Issue
Block a user