-
Notifications
You must be signed in to change notification settings - Fork 2
Core 20 highlight edit navigation #2558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
949727b
353afe9
7d986f6
b1e34e0
600cdff
4edcff8
ee4b4bf
0367b9c
1435e90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ export default styled(MainContent)` | |
.highlight { | ||
position: relative; | ||
z-index: 1; | ||
user-select: none; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prevent text selection in highlights, in particular by double-clicking, but overlapping highlights aren't allowed anyway, so this prevents error messages. |
||
} | ||
|
||
/* stylelint-disable selector-class-pattern */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,9 @@ function Card(props: CardProps) { | |
); | ||
} | ||
|
||
type ComputedProps = ReturnType<typeof useComputedProps>; | ||
type CommonProps = ComputedProps['commonProps']; | ||
|
||
function NoteOrCard({ | ||
props, | ||
setHighlightRemoved, | ||
|
@@ -179,7 +182,7 @@ function NoteOrCard({ | |
props: CardPropsWithBookAndPage; | ||
setHighlightRemoved: React.Dispatch<React.SetStateAction<boolean>>; | ||
locationFilterId: string; | ||
computedProps: ReturnType<typeof useComputedProps>; | ||
computedProps: ComputedProps; | ||
}) { | ||
const { | ||
focusCard, | ||
|
@@ -219,7 +222,7 @@ function NoteOrCard({ | |
/> | ||
) : ( | ||
<EditCardWithOnCreate | ||
cardProps={props as CardPropsWithBookAndPage} | ||
cardProps={props} | ||
commonProps={{ ...commonProps, onRemove }} | ||
locationFilterId={locationFilterId} | ||
hasUnsavedHighlight={hasUnsavedHighlight} | ||
|
@@ -230,9 +233,8 @@ function NoteOrCard({ | |
); | ||
} | ||
|
||
type ComputedProps = ReturnType<typeof useComputedProps>; | ||
type EditCardProps = { | ||
commonProps: object; | ||
commonProps: CommonProps & {onRemove: () => void}; | ||
cardProps: CardPropsWithBookAndPage; | ||
locationFilterId: string; | ||
} & Pick<ComputedProps, 'hasUnsavedHighlight' | 'setEditing'>; | ||
|
@@ -291,12 +293,13 @@ const StyledCard = styled(Card)` | |
// Styling is expensive and most Cards don't need to render | ||
function PreCard(props: CardProps) { | ||
const computedProps = useComputedProps(props); | ||
const hideUnfocusedEditCard = computedProps.annotation ? {} : {isHidden: !props.shouldFocusCard}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edit card now only appears when making edits to the highlight/note |
||
|
||
if (!computedProps.annotation && (!props.isActive)) { | ||
return null; | ||
} | ||
return ( | ||
<StyledCard {...props} /> | ||
<StyledCard {...{...props, ...hideUnfocusedEditCard}} /> | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Padding was doubled in the dialog title bar