Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
ccd26460
Commit
ccd26460
authored
Apr 05, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Apr 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename some internal boolean state values and setters
Remove "is" from some state-related reference names.
parent
ea183502
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
AnnotationBody.js
src/sidebar/components/Annotation/AnnotationBody.js
+18
-17
No files found.
src/sidebar/components/Annotation/AnnotationBody.js
View file @
ccd26460
...
...
@@ -20,25 +20,26 @@ import TagListItem from '../TagListItem';
/**
* Button to expand or collapse the annotation excerpt (content)
*
* @param {object} props
* @param {string} [props.classes]
* @param {(collapse:boolean) => void} props.set
Is
Collapsed
* @param {boolean} props.
isC
ollapsed
* @param {(collapse:boolean) => void} props.setCollapsed
* @param {boolean} props.
c
ollapsed
*/
function
ToggleExcerptButton
({
classes
,
set
IsCollapsed
,
isC
ollapsed
})
{
const
toggleText
=
isC
ollapsed
?
'More'
:
'Less'
;
function
ToggleExcerptButton
({
classes
,
set
Collapsed
,
c
ollapsed
})
{
const
toggleText
=
c
ollapsed
?
'More'
:
'Less'
;
return
(
<
LabeledButton
classes
=
{
classnames
(
'text-grey-7 font-normal'
,
classes
)}
expanded
=
{
!
isC
ollapsed
}
onClick
=
{()
=>
set
IsCollapsed
(
!
isC
ollapsed
)}
expanded
=
{
!
c
ollapsed
}
onClick
=
{()
=>
set
Collapsed
(
!
c
ollapsed
)}
title
=
{
`Toggle visibility of full annotation text: Show
${
toggleText
}
`
}
>
<
div
className
=
"flex items-center gap-x-2"
>
<
Icon
classes
=
"!text-tiny"
name
=
{
isC
ollapsed
?
'expand'
:
'collapse'
}
title
=
{
isC
ollapsed
?
'expand'
:
'collapse'
}
name
=
{
c
ollapsed
?
'expand'
:
'collapse'
}
title
=
{
c
ollapsed
?
'expand'
:
'collapse'
}
/
>
<
div
>
{
toggleText
}
<
/div
>
<
/div
>
...
...
@@ -60,11 +61,11 @@ function ToggleExcerptButton({ classes, setIsCollapsed, isCollapsed }) {
function
AnnotationBody
({
annotation
,
settings
})
{
// Should the text content of `Excerpt` be rendered in a collapsed state,
// assuming it is collapsible (exceeds allotted collapsed space)?
const
[
isCollapsed
,
setIs
Collapsed
]
=
useState
(
true
);
const
[
collapsed
,
set
Collapsed
]
=
useState
(
true
);
// Does the text content of `Excerpt` take up enough vertical space that
// collapsing/expanding is relevant?
const
[
isCollapsible
,
setIs
Collapsible
]
=
useState
(
false
);
const
[
collapsible
,
set
Collapsible
]
=
useState
(
false
);
const
store
=
useStoreProxy
();
const
defaultAuthority
=
store
.
defaultAuthority
();
...
...
@@ -94,11 +95,11 @@ function AnnotationBody({ annotation, settings }) {
<
div
className
=
"space-y-4"
>
{
showExcerpt
&&
(
<
Excerpt
collapse
=
{
isC
ollapsed
}
collapse
=
{
c
ollapsed
}
collapsedHeight
=
{
400
}
inlineControls
=
{
false
}
onCollapsibleChanged
=
{
set
Is
Collapsible
}
onToggleCollapsed
=
{
set
Is
Collapsed
}
onCollapsibleChanged
=
{
setCollapsible
}
onToggleCollapsed
=
{
setCollapsed
}
overflowThreshold
=
{
20
}
>
<
MarkdownView
...
...
@@ -110,7 +111,7 @@ function AnnotationBody({ annotation, settings }) {
/
>
<
/Excerpt
>
)}
{(
isC
ollapsible
||
showTagList
)
&&
(
{(
c
ollapsible
||
showTagList
)
&&
(
<
div
className
=
"flex flex-row gap-x-2"
>
<
div
className
=
"grow"
>
{
showTagList
&&
(
...
...
@@ -129,15 +130,15 @@ function AnnotationBody({ annotation, settings }) {
<
/TagList
>
)}
<
/div
>
{
isC
ollapsible
&&
(
{
c
ollapsible
&&
(
<
div
>
<
ToggleExcerptButton
classes
=
{
classnames
(
// Pull button up toward bottom of excerpt content
'-mt-3'
)}
isCollapsed
=
{
isC
ollapsed
}
set
IsCollapsed
=
{
setIs
Collapsed
}
collapsed
=
{
c
ollapsed
}
set
Collapsed
=
{
set
Collapsed
}
/
>
<
/div
>
)}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment