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
dbd12ea4
Commit
dbd12ea4
authored
Oct 13, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Jan 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update shared components in `ThreadCard`
parent
524ae825
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
ThreadCard.js
src/sidebar/components/ThreadCard.js
+4
-6
ThreadCard-test.js
src/sidebar/components/test/ThreadCard-test.js
+4
-2
No files found.
src/sidebar/components/ThreadCard.js
View file @
dbd12ea4
import
{
Card
}
from
'@hypothesis/frontend-shared'
;
import
classnames
from
'classnames'
;
import
{
Card
,
CardContent
}
from
'@hypothesis/frontend-shared/lib/next'
;
import
debounce
from
'lodash.debounce'
;
import
{
useCallback
,
useEffect
,
useMemo
,
useRef
}
from
'preact/hooks'
;
...
...
@@ -75,9 +74,8 @@ function ThreadCard({ frameSync, thread }) {
return
(
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
<
Card
classes
=
{
classnames
(
'p-3 cursor-pointer focus-visible-ring'
,
{
'is-hovered'
:
isHovered
,
})}
active
=
{
!!
isHovered
}
classes
=
"cursor-pointer focus-visible-ring theme-clean:border-none"
data
-
testid
=
"thread-card"
elementRef
=
{
cardRef
}
tabIndex
=
{
-
1
}
...
...
@@ -95,7 +93,7 @@ function ThreadCard({ frameSync, thread }) {
onMouseLeave
=
{()
=>
focusThreadAnnotation
(
null
)}
key
=
{
thread
.
id
}
>
{
threadContent
}
<
CardContent
>
{
threadContent
}
<
/CardContent
>
<
/Card
>
);
}
...
...
src/sidebar/components/test/ThreadCard-test.js
View file @
dbd12ea4
...
...
@@ -59,12 +59,14 @@ describe('ThreadCard', () => {
assert
(
wrapper
.
find
(
'Thread'
).
props
().
thread
===
fakeThread
);
});
it
(
'
applies a hovered CSS class
if the annotation thread is hovered'
,
()
=>
{
it
(
'
sets Card to active
if the annotation thread is hovered'
,
()
=>
{
fakeStore
.
isAnnotationHovered
.
returns
(
true
);
const
wrapper
=
createComponent
();
assert
.
isTrue
(
wrapper
.
find
(
threadCardSelector
).
hasClass
(
'is-hovered'
));
assert
.
isTrue
(
wrapper
.
find
(
'Card[data-testid="thread-card"]'
).
props
().
active
);
});
describe
(
'mouse and click events'
,
()
=>
{
...
...
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