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
5cbe0233
Commit
5cbe0233
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 `AnnotationShareInfo` to use `Icon`, simpler styling
parent
6fce0ccd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
28 deletions
+14
-28
AnnotationShareInfo.js
src/sidebar/components/Annotation/AnnotationShareInfo.js
+9
-11
AnnotationShareInfo-test.js
...ar/components/Annotation/test/AnnotationShareInfo-test.js
+5
-5
AnnotationShareInfo.scss
src/styles/sidebar/components/AnnotationShareInfo.scss
+0
-11
sidebar.scss
src/styles/sidebar/sidebar.scss
+0
-1
No files found.
src/sidebar/components/Annotation/AnnotationShareInfo.js
View file @
5cbe0233
import
{
SvgIcon
}
from
'@hypothesis/frontend-shared'
;
import
{
Icon
,
Link
}
from
'@hypothesis/frontend-shared'
;
import
{
useStoreProxy
}
from
'../../store/use-store'
;
import
{
useStoreProxy
}
from
'../../store/use-store'
;
import
{
isPrivate
}
from
'../../helpers/permissions'
;
import
{
isPrivate
}
from
'../../helpers/permissions'
;
/**
/**
* @typedef {import("../../../types/api").Annotation} Annotation
* @typedef {import("../../../types/api").Annotation} Annotation
* @typedef {import('../../../types/api').Group} Group
*/
*/
/**
/**
...
@@ -30,25 +29,24 @@ function AnnotationShareInfo({ annotation }) {
...
@@ -30,25 +29,24 @@ function AnnotationShareInfo({ annotation }) {
const
annotationIsPrivate
=
isPrivate
(
annotation
.
permissions
);
const
annotationIsPrivate
=
isPrivate
(
annotation
.
permissions
);
return
(
return
(
<
div
className
=
"
AnnotationShareInfo
hyp-u-layout-row--align-baseline"
>
<
div
className
=
"hyp-u-layout-row--align-baseline"
>
{
group
&&
linkToGroup
&&
(
{
group
&&
linkToGroup
&&
(
<
a
<
Link
class
Name
=
"hyp-u-layout-row--align-baseline u-color-text-
-muted"
class
es
=
"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 p-link--muted p-link--hover
-muted"
href
=
{
group
.
links
.
html
}
href
=
{
group
.
links
.
html
}
target
=
"_blank"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
>
{
group
.
type
===
'open'
?
(
{
group
.
type
===
'open'
?
(
<
SvgIcon
className
=
"AnnotationShareInfo__icon
"
name
=
"public"
/>
<
Icon
classes
=
"u-icon--xsmall
"
name
=
"public"
/>
)
:
(
)
:
(
<
SvgIcon
className
=
"AnnotationShareInfo__icon
"
name
=
"groups"
/>
<
Icon
classes
=
"u-icon--xsmall
"
name
=
"groups"
/>
)}
)}
<
span
className
=
"AnnotationShareInfo__group-info"
>
{
group
.
name
}
<
/span
>
<
span
>
{
group
.
name
}
<
/span
>
<
/
a
>
<
/
Link
>
)}
)}
{
annotationIsPrivate
&&
!
linkToGroup
&&
(
{
annotationIsPrivate
&&
!
linkToGroup
&&
(
<
span
className
=
"hyp-u-layout-row--align-baseline u-color-text--muted"
>
<
span
className
=
"hyp-u-layout-row--align-baseline u-color-text--muted"
>
<
span
className
=
"AnnotationShareInfo__
private-info"
>
Only
me
<
/span
>
<
span
data
-
testid
=
"
private-info"
>
Only
me
<
/span
>
<
/span
>
<
/span
>
)}
)}
<
/div
>
<
/div
>
...
...
src/sidebar/components/Annotation/test/AnnotationShareInfo-test.js
View file @
5cbe0233
...
@@ -58,18 +58,18 @@ describe('AnnotationShareInfo', () => {
...
@@ -58,18 +58,18 @@ describe('AnnotationShareInfo', () => {
it
(
'should display a group icon for private and restricted groups'
,
()
=>
{
it
(
'should display a group icon for private and restricted groups'
,
()
=>
{
const
wrapper
=
createAnnotationShareInfo
();
const
wrapper
=
createAnnotationShareInfo
();
const
groupIcon
=
wrapper
.
find
(
'
SvgIcon
'
);
const
groupIcon
=
wrapper
.
find
(
'
Icon[name="groups"]
'
);
assert
.
equal
(
groupIcon
.
prop
(
'name'
),
'groups'
);
assert
.
isTrue
(
groupIcon
.
exists
()
);
});
});
it
(
'should display a public/world icon for open groups'
,
()
=>
{
it
(
'should display a public/world icon for open groups'
,
()
=>
{
fakeGroup
.
type
=
'open'
;
fakeGroup
.
type
=
'open'
;
const
wrapper
=
createAnnotationShareInfo
();
const
wrapper
=
createAnnotationShareInfo
();
const
groupIcon
=
wrapper
.
find
(
'
SvgIcon
'
);
const
groupIcon
=
wrapper
.
find
(
'
Icon[name="public"]
'
);
assert
.
equal
(
groupIcon
.
prop
(
'name'
),
'public'
);
assert
.
isTrue
(
groupIcon
.
exists
()
);
});
});
it
(
'should not show a link to third-party groups'
,
()
=>
{
it
(
'should not show a link to third-party groups'
,
()
=>
{
...
@@ -110,7 +110,7 @@ describe('AnnotationShareInfo', () => {
...
@@ -110,7 +110,7 @@ describe('AnnotationShareInfo', () => {
fakeGetGroup
.
returns
({
name
:
'Some Name'
,
links
:
{}
});
fakeGetGroup
.
returns
({
name
:
'Some Name'
,
links
:
{}
});
const
wrapper
=
createAnnotationShareInfo
();
const
wrapper
=
createAnnotationShareInfo
();
const
privacyText
=
wrapper
.
find
(
'
.AnnotationShareInfo__private-info
'
);
const
privacyText
=
wrapper
.
find
(
'
[data-testid="private-info"]
'
);
assert
.
isOk
(
privacyText
.
exists
());
assert
.
isOk
(
privacyText
.
exists
());
assert
.
equal
(
privacyText
.
text
(),
'Only me'
);
assert
.
equal
(
privacyText
.
text
(),
'Only me'
);
...
...
src/styles/sidebar/components/AnnotationShareInfo.scss
deleted
100644 → 0
View file @
6fce0ccd
@use
'../../variables'
as
var
;
@use
'../../mixins/layout'
;
@use
'../../mixins/utils'
;
.AnnotationShareInfo
{
&
__icon
{
@include
utils
.
icon--xsmall
;
// This margin is currently needed because the icon is within an `a` element
margin-right
:
5px
;
}
}
src/styles/sidebar/sidebar.scss
View file @
5cbe0233
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
@use
'./components/AnnotationPublishControl'
;
@use
'./components/AnnotationPublishControl'
;
@use
'./components/AnnotationQuote'
;
@use
'./components/AnnotationQuote'
;
@use
'./components/AnnotationShareControl'
;
@use
'./components/AnnotationShareControl'
;
@use
'./components/AnnotationShareInfo'
;
@use
'./components/AutocompleteList'
;
@use
'./components/AutocompleteList'
;
@use
'./components/Excerpt'
;
@use
'./components/Excerpt'
;
@use
'./components/FilterSelect'
;
@use
'./components/FilterSelect'
;
...
...
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