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
ed2f95a5
Commit
ed2f95a5
authored
Nov 02, 2021
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Nov 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `Actions`, reduce classnames
parent
75d81727
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
37 deletions
+18
-37
Annotation.js
src/sidebar/components/Annotation/Annotation.js
+14
-8
Annotation-test.js
src/sidebar/components/Annotation/test/Annotation-test.js
+4
-29
No files found.
src/sidebar/components/Annotation/Annotation.js
View file @
ed2f95a5
import
{
Actions
}
from
'@hypothesis/frontend-shared'
;
import
classnames
from
'classnames'
;
import
{
useStoreProxy
}
from
'../../store/use-store'
;
...
...
@@ -60,9 +61,7 @@ function Annotation({
return
(
<
article
className
=
{
classnames
(
'Annotation'
,
'hyp-u-vertical-spacing'
,
{
'Annotation--missing'
:
!
annotation
,
'Annotation--reply'
:
isReply
,
className
=
{
classnames
(
'hyp-u-vertical-spacing'
,
{
'is-collapsed'
:
threadIsCollapsed
,
'is-focused'
:
isFocused
,
})}
...
...
@@ -95,8 +94,8 @@ function Annotation({
)}
{
!
isCollapsedReply
&&
(
<
footer
className
=
"Annotation__footer"
>
<
div
className
=
"hyp-u-layout-row
Annotation__controls
"
>
<
footer
>
<
div
className
=
"hyp-u-layout-row"
>
{
showReplyToggle
&&
(
<
AnnotationReplyToggle
onToggleReplies
=
{
onToggleReplies
}
...
...
@@ -104,14 +103,21 @@ function Annotation({
threadIsCollapsed
=
{
threadIsCollapsed
}
/
>
)}
{
isSaving
&&
<
div
className
=
"Annotation__actions"
>
Saving
...
<
/div>
}
{
isSaving
&&
(
<
div
className
=
"hyp-u-layout-row--justify-right hyp-u-stretch"
data
-
testid
=
"saving-message"
>
Saving
...
<
/div
>
)}
{
annotation
&&
showActions
&&
(
<
div
className
=
"hyp-u-layout-row--justify-right
hyp-u-stretch"
>
<
Actions
classes
=
"
hyp-u-stretch"
>
<
AnnotationActionBar
annotation
=
{
annotation
}
onReply
=
{
onReply
}
/
>
<
/
div
>
<
/
Actions
>
)}
<
/div
>
<
/footer
>
...
...
src/sidebar/components/Annotation/test/Annotation-test.js
View file @
ed2f95a5
...
...
@@ -72,34 +72,6 @@ describe('Annotation', () => {
$imports
.
$restore
();
});
describe
(
'annotation classnames'
,
()
=>
{
it
(
'should assign a reply class if the annotation is a reply'
,
()
=>
{
const
wrapper
=
createComponent
({
isReply
:
true
,
threadIsCollapsed
:
false
,
});
const
annot
=
wrapper
.
find
(
'.Annotation'
);
assert
.
isTrue
(
annot
.
hasClass
(
'Annotation--reply'
));
assert
.
isFalse
(
annot
.
hasClass
(
'is-collapsed'
));
});
it
(
'applies a focused class if annotation is focused'
,
()
=>
{
fakeStore
.
isAnnotationFocused
.
returns
(
true
);
const
wrapper
=
createComponent
({
threadIsCollapsed
:
false
});
const
annot
=
wrapper
.
find
(
'.Annotation'
);
assert
.
isTrue
(
annot
.
hasClass
(
'is-focused'
));
});
it
(
'should assign a collapsed class if the annotation thread is collapsed'
,
()
=>
{
const
wrapper
=
createComponent
({
threadIsCollapsed
:
true
});
const
annot
=
wrapper
.
find
(
'.Annotation'
);
assert
.
isTrue
(
annot
.
hasClass
(
'is-collapsed'
));
});
});
describe
(
'annotation quote'
,
()
=>
{
it
(
'renders quote if annotation has a quote'
,
()
=>
{
fakeMetadata
.
quote
.
returns
(
'quote'
);
...
...
@@ -132,7 +104,10 @@ describe('Annotation', () => {
const
wrapper
=
createComponent
();
assert
.
include
(
wrapper
.
find
(
'.Annotation__actions'
).
text
(),
'Saving...'
);
assert
.
include
(
wrapper
.
find
(
'[data-testid="saving-message"]'
).
text
(),
'Saving...'
);
});
describe
(
'reply thread toggle'
,
()
=>
{
...
...
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