@obolnetwork/obol-ui 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -60
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,88 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
# @obolnetwork/obol-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Obol Network's shared React component library, built with [Stitches](https://stitches.dev/) and organised using [Atomic Design](https://bradfrost.com/blog/post/atomic-web-design/) principles.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
yarn add @obolnetwork/obol-ui
|
|
9
9
|
# or
|
|
10
|
-
|
|
10
|
+
npm install @obolnetwork/obol-ui
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Usage
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button, Text, Flex } from "@obolnetwork/obol-ui";
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
export default function App() {
|
|
19
|
+
return (
|
|
20
|
+
<Flex direction="column" gap="2">
|
|
21
|
+
<Text>Hello from Obol UI</Text>
|
|
22
|
+
<Button onClick={() => console.log("clicked")}>Get Started</Button>
|
|
23
|
+
</Flex>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
We use Jest and React Testing Library for testing our React components and functions. Jest is a testing framework that provides us with test runners, assertions, and mocks, while React Testing Library is a set of utilities that helps us write tests that are closer to how our end-users will interact with our application.
|
|
28
|
+
### Theme setup
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
To run the tests, simply run the following command in your terminal:
|
|
30
|
+
Obol UI uses Stitches for styling. Import and apply the global CSS reset in your app's entry point:
|
|
26
31
|
|
|
27
|
-
```
|
|
28
|
-
|
|
32
|
+
```tsx
|
|
33
|
+
import { globalCss, getCssText } from "@obolnetwork/obol-ui";
|
|
29
34
|
```
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
## Components
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
yarn run test <path-to-file>
|
|
35
|
-
```
|
|
38
|
+
The library follows Atomic Design methodology:
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
**Atoms** — Avatar, Badge, Box, Button, Checkbox, Container, Flex, Grid, IconButton, Image, Link, NavigationMenu, NumberField, ProgressBar, Separator, Skeleton, Switch, Text, TextField, Toggle, Tooltip, and more.
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
We write tests using Jest and React Testing Library in the same file as the component or function we are testing. For example, if we are testing a component called Button, we would create a file called Button.test.js in the same directory as the Button.js file.
|
|
42
|
+
**Molecules** — Accordion, Card, Dialog, Navbar, NotificationCard, Pagination, Profile, ProgressTracker, RadioGroup, ResponsiveDialog, Table, Tabs, and more.
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
**Organisms** — Advisory, Footer, HeroSection, Selector, TwoColumnSection.
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
import { Button } from "../../../components/atoms/Button/Button";
|
|
46
|
-
import { render, screen } from "@testing-library/react";
|
|
47
|
-
import userEvent from "@testing-library/user-event";
|
|
46
|
+
**Utilities** — Color variants, media query hooks, shared styles and types.
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
describe("On Click Listener", () => {
|
|
51
|
-
const user = userEvent.setup();
|
|
52
|
-
const mockProps = {
|
|
53
|
-
onClick: jest.fn(),
|
|
54
|
-
};
|
|
48
|
+
## Development
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
```bash
|
|
51
|
+
# Run Storybook for local component development
|
|
52
|
+
yarn storybook
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
# Build the design system
|
|
55
|
+
yarn ds:build
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
});
|
|
57
|
+
# Run tests
|
|
58
|
+
yarn test
|
|
66
59
|
```
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
Husky and pre-commit hooks
|
|
71
|
-
We use Husky to manage Git hooks, such as pre-commit hooks. Our pre-commit hook runs the tests before committing any code changes, ensuring that we only commit code that passes all the tests.
|
|
72
|
-
|
|
73
|
-
If you try to commit changes that break the tests, Husky will prevent the commit from going through and display an error message in your terminal.
|
|
74
|
-
|
|
75
|
-
## Learn More
|
|
76
|
-
|
|
77
|
-
To learn more about Next.js, take a look at the following resources:
|
|
78
|
-
|
|
79
|
-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
80
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
81
|
-
|
|
82
|
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
61
|
+
## Links
|
|
83
62
|
|
|
84
|
-
|
|
63
|
+
- [Obol Network](https://obol.org)
|
|
64
|
+
- [Documentation](https://docs.obol.org)
|
|
65
|
+
- [GitHub](https://github.com/ObolNetwork/obol-packages)
|
|
85
66
|
|
|
86
|
-
|
|
67
|
+
## License
|
|
87
68
|
|
|
88
|
-
|
|
69
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obolnetwork/obol-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"storybook": "storybook dev -p 6006",
|
|
17
17
|
"build-storybook": "storybook build",
|
|
18
18
|
"ds:build": "rollup -c",
|
|
19
|
-
"ds:release:major": "npm version
|
|
20
|
-
"ds:release:minor": "npm version
|
|
21
|
-
"ds:release:patch": "npm version
|
|
19
|
+
"ds:release:major": "npm version major --no-git-tag-version && npm publish --tag latest",
|
|
20
|
+
"ds:release:minor": "npm version minor --no-git-tag-version && npm publish --tag latest",
|
|
21
|
+
"ds:release:patch": "npm version patch --no-git-tag-version && npm publish --tag latest",
|
|
22
22
|
"test": "jest",
|
|
23
23
|
"prepare": "husky",
|
|
24
24
|
"format:write": "prettier --write \"**/*.{css,js,json,jsx,ts,tsx}\"",
|