import { highlightBarKeyboardCommands } from '../../lib/keyboardShortcuts/navigationShortcuts'
import { useKeyboardShortcuts } from '../../lib/keyboardShortcuts/useKeyboardShortcuts'
import { isAndroid } from '../../lib/deviceType'
import { styled, theme } from '../tokens/stitches.config'
import { AnchoredPopover } from '../patterns/AnchoredPopover'
import { StyledText } from '../elements/StyledText'
import { Button } from '../elements/Button'
import { HStack, Box } from '../elements/LayoutPrimitives'
import { TrashIcon } from '../elements/images/TrashIcon'
import { PenWithColorIcon } from '../elements/images/PenWithColorIcon'
import { Note } from 'phosphor-react'
type PageCoordinates = {
pageX: number
pageY: number
}
export type HighlightAction =
| 'delete'
| 'create'
| 'comment'
| 'share'
| 'post'
| 'unshare'
type HighlightBarProps = {
anchorCoordinates: PageCoordinates
isNewHighlight: boolean
isSharedToFeed: boolean
isTouchscreenDevice: boolean
handleButtonClick: (action: HighlightAction) => void
}
export function HighlightBar(props: HighlightBarProps): JSX.Element {
if (props.isTouchscreenDevice) {
return (
)
} else {
return (
css=
{{
width: '350px',
background: '$grayBg',
borderRadius: '4px',
border: '1px solid $grayBorder',
boxShadow: '$cardBoxShadow',
}}
)
}
}
function BarContent(props: HighlightBarProps): JSX.Element {
useKeyboardShortcuts(
highlightBarKeyboardCommands((action) => {
switch (action) {
case 'createHighlight':
props.handleButtonClick('create')
break
case 'openNoteModal':
props.handleButtonClick('comment')
break
case 'openPostModal':
break
}
})
)
const Separator = styled('div', {
width: '1px',
maxWidth: '1px',
height: '100%',
background: '$grayBorder',
})
return (
{props.isNewHighlight ? (
) : (
)}
{/*
*/}
)
}