Skip to content

Commit 9123109

Browse files
Merge pull request #4 from commitd/sh-update
2 parents 0b74ae4 + 3d3eda1 commit 9123109

24 files changed

+658
-582
lines changed

.drone.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ steps:
2323
from_secret: github_token
2424
commands:
2525
- npm publish --access public
26+
- yarn deploy-storybook --ci
2627
when:
2728
ref:
2829
- refs/tags/v*
30+
31+
- name: announce
32+
image: plugins/slack
33+
settings:
34+
channel: group-dev
35+
webhook:
36+
from_secret: slack_webhook
37+
template: >
38+
:tada: New version ${DRONE_TAG} of `@committed/annotation-viewer` available
39+
when:
40+
ref:
41+
- refs/tags/v*
42+
status:
43+
- success

README.md

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,63 @@
22

33
> Annotation Viewer
44
5-
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6-
5+
[![Committed Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fcommitted.software%2Fbadge)](https://committed.io)
6+
[![Build Status](https://drone.committed.software/api/badges/commitd/annotation-viewer/status.svg)](https://drone.committed.software/commitd/annotation-viewer)
7+
[![Storybook](https://cdn.jsdelivr.net/gh/storybookjs/brand@master/badge/badge-storybook.svg)](https://committed.software/annotation-viewer)
78
![](images/example.png)
89

910
## Install
1011

1112
```bash
12-
yarn add @committed/annotation-viewer
13+
yarn add @committed/annotation-viewer @committed/components @material-ui/core
14+
```
15+
16+
Peer dependencies
17+
18+
```bash
19+
yarn add @committed/components @material-ui/core
1320
```
1421

1522
## Usage
1623

1724
```tsx
18-
import * as React from 'react'
19-
20-
import Viewer from '@committed/annotation-viewer'
25+
import React from 'react'
26+
import { AnnotationViewer } from '@committed/annotation-viewer'
2127

2228
class Example extends React.Component {
2329
render() {
2430
return (
25-
<Viewer
26-
text="The British people are represented by members of Parliament"
27-
marks={[
28-
{
29-
offset: 4,
30-
length: 7,
31-
markType: 'NORP'
32-
},
33-
{
34-
offset: 49,
35-
length: 10,
36-
markType: 'ORG'
37-
}
38-
]}
39-
inlines={[
40-
{
41-
offset: 4,
42-
length: 55
43-
}
44-
]}
45-
/>
31+
<AnnotationViewer
32+
text="The British people are represented by members of Parliament"
33+
marks={[
34+
{
35+
offset: 4,
36+
length: 7,
37+
type: 'NORP'
38+
},
39+
{
40+
offset: 49,
41+
length: 10,
42+
type: 'ORG'
43+
}
44+
]}
45+
inlines={[
46+
{
47+
offset: 4,
48+
length: 55,
49+
type: 'Link'
50+
}
51+
]}
52+
/>
4653
)
4754
}
4855
}
4956
```
5057

58+
> NB The committed component `ThemeProvider` must be in the react component stack. (Future versions may remove these pees dependencies.)
59+
60+
Further examples of use and configuration options can be seen in the [storybook](https://committed.software/annotation-viewer).
61+
5162
## Development
5263

5364
The main build is currently performed using Rollup and `yarn build`.
@@ -68,7 +79,7 @@ yarn build-storybook
6879

6980
To run the example:
7081

71-
```
82+
```bash
7283
yarn
7384
yarn build
7485
cd example
@@ -78,4 +89,4 @@ yarn start
7889

7990
## License
8091

81-
© [Committed Software](https://github.com/commitd)
92+
[MIT](/LICENSE) - © Committed Software 2020 https://committed.io

example/index.tsx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,31 @@ import { AnnotationViewer } from '../dist'
66

77
const App = () => {
88
return (
9-
<div>
10-
<ThemeProvider>
11-
<AnnotationViewer
12-
text="The British people are represented by members of Parliament"
13-
marks={[
14-
{
15-
offset: 4,
16-
length: 7,
17-
markType: 'NORP'
18-
},
9+
<ThemeProvider>
10+
<AnnotationViewer
11+
text="The British people are represented by members of Parliament"
12+
marks={[
13+
{
14+
offset: 4,
15+
length: 7,
16+
type: 'NORP'
17+
},
1918

20-
{
21-
offset: 49,
22-
length: 10,
23-
markType: 'ORG'
24-
}
25-
]}
26-
inlines={[
27-
{
28-
offset: 4,
29-
length: 55
30-
}
31-
]}
32-
/>
33-
</ThemeProvider>
34-
</div>
19+
{
20+
offset: 49,
21+
length: 10,
22+
type: 'ORG'
23+
}
24+
]}
25+
inlines={[
26+
{
27+
offset: 4,
28+
length: 55,
29+
type: 'link'
30+
}
31+
]}
32+
/>
33+
</ThemeProvider>
3534
)
3635
}
3736

example/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
"build": "parcel build index.html"
99
},
1010
"dependencies": {
11-
"@committed/components": "^3.2.0",
12-
"@material-ui/core": "^4.11.0",
1311
"react-app-polyfill": "^1.0.0"
1412
},
1513
"alias": {
14+
"@committed/components": "../node_modules/@committed/components",
15+
"@material-ui/core": "../node_modules/@material-ui/core",
16+
"@material-ui/icons": "../node_modules/@material-ui/icons",
1617
"react": "../node_modules/react",
1718
"react-dom": "../node_modules/react-dom/profiling",
1819
"scheduler/tracing": "../node_modules/scheduler/tracing-profiling"

0 commit comments

Comments
 (0)