@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.
Files changed (2) hide show
  1. package/README.md +41 -60
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,88 +1,69 @@
1
- This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1
+ # @obolnetwork/obol-ui
2
2
 
3
- ## Getting Started
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
- First, run the development server:
5
+ ## Installation
6
6
 
7
7
  ```bash
8
- npm run dev
8
+ yarn add @obolnetwork/obol-ui
9
9
  # or
10
- yarn dev
10
+ npm install @obolnetwork/obol-ui
11
11
  ```
12
12
 
13
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
13
+ ## Usage
14
14
 
15
- You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
15
+ ```tsx
16
+ import { Button, Text, Flex } from "@obolnetwork/obol-ui";
16
17
 
17
- [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
18
-
19
- The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
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
- ## Testing
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
- ### Running tests
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
- ```bash
28
- yarn run test
32
+ ```tsx
33
+ import { globalCss, getCssText } from "@obolnetwork/obol-ui";
29
34
  ```
30
35
 
31
- This will start the Jest test runner, which will automatically find and run all the tests in our project that match the naming pattern *.test.js or *.spec.js. located at __tests__ You can also run a specific test file by running the following command:
36
+ ## Components
32
37
 
33
- ```bash
34
- yarn run test <path-to-file>
35
- ```
38
+ The library follows Atomic Design methodology:
36
39
 
37
- This will run only the tests in the Button.test.js file.
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
- ### Writing tests
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
- Here's an example test file:
44
+ **Organisms** Advisory, Footer, HeroSection, Selector, TwoColumnSection.
43
45
 
44
- ```typescript
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
- describe("Button Component", () => {
50
- describe("On Click Listener", () => {
51
- const user = userEvent.setup();
52
- const mockProps = {
53
- onClick: jest.fn(),
54
- };
48
+ ## Development
55
49
 
56
- test("Calls onClick function passed in", async () => {
57
- render(<Button {...mockProps}>test</Button>);
50
+ ```bash
51
+ # Run Storybook for local component development
52
+ yarn storybook
58
53
 
59
- const testButton = screen.getByText("test");
60
- await user.click(testButton);
54
+ # Build the design system
55
+ yarn ds:build
61
56
 
62
- expect(mockProps.onClick).toHaveBeenCalledTimes(1);
63
- });
64
- });
65
- });
57
+ # Run tests
58
+ yarn test
66
59
  ```
67
60
 
68
- In this example, we're testing the Button component by rendering it with different props and checking that the correct elements are present and that the onClick function is called when the button is clicked.
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
- ## Deploy on Vercel
63
+ - [Obol Network](https://obol.org)
64
+ - [Documentation](https://docs.obol.org)
65
+ - [GitHub](https://github.com/ObolNetwork/obol-packages)
85
66
 
86
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
67
+ ## License
87
68
 
88
- Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
69
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-ui",
3
- "version": "1.1.17",
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 $(semver $npm_package_version -i major) && npm publish --tag latest",
20
- "ds:release:minor": "npm version $(semver $npm_package_version -i minor) && npm publish --tag latest",
21
- "ds:release:patch": "npm version $(semver $npm_package_version -i patch) && npm publish --tag latest",
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}\"",