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
3ce41b10
Unverified
Commit
3ce41b10
authored
Apr 08, 2019
by
Robert Knight
Committed by
GitHub
Apr 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1039 from hypothesis/react-annotation-action-button
Convert `<annotation-action-button>` component to React
parents
e88434af
9246e478
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
18 deletions
+33
-18
annotation-action-button.js
src/sidebar/components/annotation-action-button.js
+26
-9
annotation-test.js
src/sidebar/components/test/annotation-test.js
+6
-1
index.js
src/sidebar/index.js
+1
-1
annotation-action-button.html
src/sidebar/templates/annotation-action-button.html
+0
-7
No files found.
src/sidebar/components/annotation-action-button.js
View file @
3ce41b10
'use strict'
;
'use strict'
;
module
.
exports
=
{
const
classnames
=
require
(
'classnames'
);
controllerAs
:
'vm'
,
const
propTypes
=
require
(
'prop-types'
);
bindings
:
{
const
{
createElement
}
=
require
(
'preact'
);
icon
:
'<'
,
isDisabled
:
'<'
,
function
AnnotationActionButton
({
icon
,
isDisabled
,
label
,
onClick
})
{
label
:
'<'
,
return
(
onClick
:
'&'
,
<
button
},
className
=
"btn btn-clean annotation-action-btn"
template
:
require
(
'../templates/annotation-action-button.html'
),
onClick
=
{
onClick
}
disabled
=
{
isDisabled
}
aria
-
label
=
{
label
}
h
-
tooltip
>
<
i
className
=
{
classnames
(
icon
,
'btn-icon'
)}
/
>
<
/button
>
);
}
AnnotationActionButton
.
propTypes
=
{
/** A CSS classname corresponding to an `h` icon */
icon
:
propTypes
.
string
.
isRequired
,
isDisabled
:
propTypes
.
bool
.
isRequired
,
label
:
propTypes
.
string
.
isRequired
,
onClick
:
propTypes
.
func
.
isRequired
,
};
};
module
.
exports
=
AnnotationActionButton
;
src/sidebar/components/test/annotation-test.js
View file @
3ce41b10
...
@@ -155,7 +155,12 @@ describe('annotation', function() {
...
@@ -155,7 +155,12 @@ describe('annotation', function() {
.
module
(
'h'
,
[])
.
module
(
'h'
,
[])
.
component
(
'annotation'
,
annotationComponent
())
.
component
(
'annotation'
,
annotationComponent
())
.
component
(
'annotationActionButton'
,
{
.
component
(
'annotationActionButton'
,
{
bindings
:
require
(
'../annotation-action-button'
).
bindings
,
bindings
:
{
icon
:
'<'
,
isDisabled
:
'<'
,
label
:
'<'
,
onClick
:
'&'
,
},
})
})
.
component
(
'markdown'
,
{
.
component
(
'markdown'
,
{
bindings
:
require
(
'../markdown'
).
bindings
,
bindings
:
require
(
'../markdown'
).
bindings
,
...
...
src/sidebar/index.js
View file @
3ce41b10
...
@@ -142,7 +142,7 @@ function startAngularApp(config) {
...
@@ -142,7 +142,7 @@ function startAngularApp(config) {
.
component
(
'annotationHeader'
,
require
(
'./components/annotation-header'
))
.
component
(
'annotationHeader'
,
require
(
'./components/annotation-header'
))
.
component
(
.
component
(
'annotationActionButton'
,
'annotationActionButton'
,
require
(
'./components/annotation-action-button'
)
wrapReactComponent
(
require
(
'./components/annotation-action-button'
)
)
)
)
.
component
(
.
component
(
'annotationShareDialog'
,
'annotationShareDialog'
,
...
...
src/sidebar/templates/annotation-action-button.html
deleted
100644 → 0
View file @
e88434af
<button
class=
"btn btn-clean annotation-action-btn"
ng-click=
"vm.onClick()"
ng-disabled=
"vm.isDisabled"
aria-label=
"{{ vm.label }}"
h-tooltip
>
<i
class=
"{{ vm.icon }} btn-icon"
></i>
</button>
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