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
d491a691
Commit
d491a691
authored
Nov 01, 2021
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Nov 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update `AnnotationHeader` with `Icon`, simpler styles
parent
627620da
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
47 deletions
+23
-47
AnnotationHeader.js
src/sidebar/components/Annotation/AnnotationHeader.js
+17
-14
AnnotationHeader-test.js
...debar/components/Annotation/test/AnnotationHeader-test.js
+6
-6
AnnotationHeader.scss
src/styles/sidebar/components/AnnotationHeader.scss
+0
-26
sidebar.scss
src/styles/sidebar/sidebar.scss
+0
-1
No files found.
src/sidebar/components/Annotation/AnnotationHeader.js
View file @
d491a691
import
{
Svg
Icon
,
LinkButton
}
from
'@hypothesis/frontend-shared'
;
import
{
Icon
,
LinkButton
}
from
'@hypothesis/frontend-shared'
;
import
{
useMemo
}
from
'preact/hooks'
;
import
{
withServices
}
from
'../../service-context'
;
...
...
@@ -114,11 +114,14 @@ function AnnotationHeader({
store
.
setExpanded
(
/** @type {string} */
(
annotation
.
id
),
true
);
return
(
<
header
className
=
"AnnotationHeader"
>
<
div
className
=
"AnnotationHeader__row hyp-u-horizontal-spacing--2"
>
<
header
>
<
div
className
=
"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2"
style
=
"flex-wrap:wrap-reverse"
>
{
annotationIsPrivate
&&
!
isEditing
&&
(
<
Svg
Icon
class
Name
=
"AnnotationHeader__icon
"
<
Icon
class
es
=
"u-icon--xsmall
"
name
=
"lock"
title
=
"This annotation is visible only to you"
/>
...
...
@@ -146,17 +149,17 @@ function AnnotationHeader({
<
/div
>
{
showExtendedInfo
&&
(
<
div
className
=
"AnnotationHeader__row hyp-u-horizontal-spacing--2"
>
<
div
className
=
"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2"
style
=
"flex-wrap:wrap-reverse"
>
<
AnnotationShareInfo
annotation
=
{
annotation
}
/
>
{
!
isEditing
&&
isHighlight
(
annotation
)
&&
(
<
div
className
=
"AnnotationHeader__highlight"
>
<
SvgIcon
<
Icon
name
=
"highlight"
title
=
"This is a highlight. Click 'edit' to add a note or tag."
inline
=
{
true
}
className
=
"AnnotationHeader__highlight-icon"
classes
=
"u-icon--xsmall u-color-text--muted"
/>
<
/div
>
)}
{
showDocumentInfo
&&
(
<
AnnotationDocumentInfo
...
...
src/sidebar/components/Annotation/test/AnnotationHeader-test.js
View file @
d491a691
...
...
@@ -84,7 +84,7 @@ describe('AnnotationHeader', () => {
const
wrapper
=
createAnnotationHeader
();
assert
.
isTrue
(
wrapper
.
find
(
'
Svg
Icon'
).
filter
({
name
:
'lock'
}).
exists
());
assert
.
isTrue
(
wrapper
.
find
(
'Icon'
).
filter
({
name
:
'lock'
}).
exists
());
});
it
(
'should not render an "Only Me" icon if the annotation is being edited'
,
()
=>
{
...
...
@@ -92,7 +92,7 @@ describe('AnnotationHeader', () => {
const
wrapper
=
createAnnotationHeader
({
isEditing
:
true
});
assert
.
isFalse
(
wrapper
.
find
(
'
Svg
Icon'
).
filter
({
name
:
'lock'
}).
exists
());
assert
.
isFalse
(
wrapper
.
find
(
'Icon'
).
filter
({
name
:
'lock'
}).
exists
());
});
it
(
'should not render an "Only Me" icon if the annotation is not private'
,
()
=>
{
...
...
@@ -100,7 +100,7 @@ describe('AnnotationHeader', () => {
const
wrapper
=
createAnnotationHeader
();
assert
.
isFalse
(
wrapper
.
find
(
'
Svg
Icon'
).
filter
({
name
:
'lock'
}).
exists
());
assert
.
isFalse
(
wrapper
.
find
(
'Icon'
).
filter
({
name
:
'lock'
}).
exists
());
});
});
...
...
@@ -298,7 +298,7 @@ describe('AnnotationHeader', () => {
const
wrapper
=
createAnnotationHeader
({
isEditing
:
false
,
});
const
highlightIcon
=
wrapper
.
find
(
'
.AnnotationHeader__highlight
'
);
const
highlightIcon
=
wrapper
.
find
(
'
Icon[name="highlight"]
'
);
assert
.
isTrue
(
highlightIcon
.
exists
());
});
...
...
@@ -308,7 +308,7 @@ describe('AnnotationHeader', () => {
const
wrapper
=
createAnnotationHeader
({
isEditing
:
false
,
});
const
highlightIcon
=
wrapper
.
find
(
'
.AnnotationHeader__highlight
'
);
const
highlightIcon
=
wrapper
.
find
(
'
Icon[name="highlight"]
'
);
assert
.
isFalse
(
highlightIcon
.
exists
());
});
...
...
@@ -414,7 +414,7 @@ describe('AnnotationHeader', () => {
isEditing
:
true
,
isHighlight
:
true
,
});
const
highlight
=
wrapper
.
find
(
'
.AnnotationHeader__highlight
'
);
const
highlight
=
wrapper
.
find
(
'
Icon[name="highlight"]
'
);
assert
.
isFalse
(
highlight
.
exists
());
});
...
...
src/styles/sidebar/components/AnnotationHeader.scss
deleted
100644 → 0
View file @
627620da
@use
'../../mixins/buttons'
;
@use
'../../mixins/forms'
;
@use
'../../mixins/layout'
;
@use
'../../mixins/utils'
;
@use
'../../variables'
as
var
;
.AnnotationHeader
{
&
__row
{
@include
layout
.
row
(
$align
:
baseline
);
// Wrap onto multiple rows from bottom to top
flex-wrap
:
wrap-reverse
;
}
&
__icon
{
@include
utils
.
icon--xsmall
;
color
:
var
.
$color-text
;
}
&
__highlight-icon
{
@include
utils
.
icon--small
;
color
:
var
.
$color-text--light
;
// Pull the icon down a tad for better vertical alignment with other
// items in the same layout row
margin-bottom
:
-1px
;
}
}
src/styles/sidebar/sidebar.scss
View file @
d491a691
...
...
@@ -20,7 +20,6 @@
// ----------
@use
'./components/Annotation'
;
@use
'./components/AnnotationBody'
;
@use
'./components/AnnotationHeader'
;
@use
'./components/AnnotationPublishControl'
;
@use
'./components/AnnotationQuote'
;
@use
'./components/AnnotationShareControl'
;
...
...
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