3.45.0 • Published 9 days ago

@redpanda-data/ui v3.45.0

Weekly downloads
-
License
-
Repository
-
Last release
9 days ago

Redpanda UI

React Typescript component library for Redpanda UI projects.

Conventional Commits release tests

🏛️ Base library

This library uses Chakra UI as the basis for all components.

🧱 Custom components

Create a component in the src/components/ directory, then export it from src/components/index.ts.

Component directory structure:

src/
  exports.ts
  assets/
  styles/
  components/
    index.ts
    Button/
      Button.tsx
      Button.test.tsx
      Button.stories.tsx

Exporting a component in src/components/index.ts

export { default as Button } from './Button/Button';

Generate

TODO - add generator for new components with the correct directory, index, component, story, and test files.

### Overrides

To override any default components from the base library. Simply create a new component with the same name, and add it to src/components/index.ts.

Including components from other libraries

Create a custom component, and import the component you need from your package. Ensure that you use the hooks provided in Chakra for theming light and dark modes.

🎨 Styles

Custom CSS and SCSS can be used but is mostly not needed as Chakra provides all of the base styles we need. Refer to the Chakra documentation for styles and prop based styles.

Global CSS

this library will export a global css file with your custom css, make sure you import it from @redpanda-data/dist/index.css.

SASS support

yuor scss or sass files will be transpiled to a single css file when imported on any file, output file will be index.css

🧪 Storybook

We use storybook to preview components and test them.

Run npm run build-storybook for static assets. Run npm run storybook and go to http://localhost:6006

This storybook setup closely follows this approach:

Test coverage

We are using @testing-library/react to write the tests for UI.

Run npm run test to see the coverage for the library.

A few things to remember when writing tests for UI components:

  1. The goal is to increase confidence in using the library, not to test every prop.
  2. If the component is simple e.g: only has a prop that changes a 'backgroundColor', then using storybook controls is enough confidence, we do not need to write a test for this.
  3. Write tests for clear branches in logic, and to test stateful changes to a component. e.g: a date-picker will have internal state and is sufficiently complex that it will need multiple tests.
  4. Use your judgement whether visually testing is important.

Local Development with Cloud/Admin UI

When making changes to the UI library (components, styles, etc.), it's nice to test those changes within the context of your local-running Cloud UI. Using yalc, you can link Cloud UI to your local ui repo and see those changes reflected with your Cloud UI instance using the following steps:

  1. Install yalc on your machine: npm i -g yalc
  2. Within the ui repo, run yalc publish. This will publish your local ui repo to your local yalc store (registry).
  3. Within the cloud-ui (or admin-ui) repo, add the newly-added yalc dependency: yalc add @redpanda-data/ui
  4. Withing the cloud-ui (or admin-ui) repo, install the new dependency: npm i

After making any code changes within your local ui repo, run yalc push to update the local yalc store and have your changes pushed to the cloud-ui (or admin-ui) repo.

Once you're done testing local changes, it's important to unlink the local ui repo from cloud-ui (or admin-ui) by running: yalc remove @redpanda-data/ui.

Visual testing

When viewing a component in storybook, check that it works with both light and dark modes.

Accessibility tests

Ensure that tests pass all critical accessibilty violations. If unsure about visual elements contact the design team for input.

🏖️ Playground

Use the files in the directory playground/ as a scratchpad for trying out components. It uses a standard CRA setup.

Run npm run playground to see the playground in the browser at http://localhost:3000

🚀 Deployment

We are using release-please to hande the release of this library, notice it relies on conventional commits to generate semver, releases and changelog.

build:

We use rollup for building the app, simply run npm run build to generate the built files and types.

how to release for prod:

Every push to main will generate a release pull request, when the PR is approved and merged it will publish the new version of the package to npm.

Note: To ensure a release is auto-created, be sure to rebase/merge back into your branch before merging your PR.

Keep in mind: PRs that use the docs or chore commit lint prefix will not trigger a new release. It's recommended to prefix your PR title with "feat" or "fix" when releasing a new feature or fix, respectively.

contribution guideline:

You should use conventional commits for your commits, you can run npm run commit it will prompt a helper to generate your commits. there are some git hooks to validate your commits and some prettier style enforcement.

3.45.0

9 days ago

3.44.0

23 days ago

3.43.0

1 month ago

3.42.0

1 month ago

3.39.1-beta.0

1 month ago

3.39.1-beta.2

1 month ago

3.39.1-beta.1

1 month ago

3.40.0

1 month ago

3.41.0

1 month ago

3.39.0

2 months ago

3.38.2

2 months ago

3.38.3

2 months ago

3.38.1

2 months ago

3.38.0

2 months ago

3.37.1

3 months ago

3.36.0

3 months ago

3.36.1

3 months ago

3.37.0

3 months ago

3.35.1

3 months ago

3.35.0

3 months ago

3.35.0-alpha.0

4 months ago

3.36.0-alpha.0

4 months ago

3.38.0-alpha.0

4 months ago

3.34.2

4 months ago

3.37.0-alpha.0

4 months ago

3.34.1

4 months ago

3.34.0

5 months ago

3.20.0

7 months ago

3.24.0

7 months ago

3.17.0

8 months ago

3.17.2

8 months ago

3.17.1

8 months ago

3.31.0

6 months ago

3.6.0

10 months ago

3.12.0

9 months ago

3.24.1

7 months ago

3.28.0

6 months ago

3.21.0

7 months ago

3.14.0

9 months ago

3.18.0

8 months ago

3.4.1-beta.1

10 months ago

3.32.0

5 months ago

3.13.0

9 months ago

3.5.0

10 months ago

3.25.1

7 months ago

3.25.0

7 months ago

3.25.3

7 months ago

3.25.2

7 months ago

3.25.5

7 months ago

3.29.0

6 months ago

3.25.4

7 months ago

3.25.6

7 months ago

3.22.0

7 months ago

3.30.0-beta.0

6 months ago

3.15.0

8 months ago

3.9.0

9 months ago

3.19.0

8 months ago

3.4.0

10 months ago

3.8.0

10 months ago

3.33.0

5 months ago

3.10.0

9 months ago

3.26.0

7 months ago

3.23.0

7 months ago

3.26.0-beta.0

7 months ago

3.17.1-beta.1

8 months ago

3.16.0

8 months ago

3.3.0

10 months ago

3.30.0

6 months ago

3.30.1

6 months ago

3.11.0

9 months ago

3.7.1

10 months ago

3.7.0

10 months ago

3.2.0-beta.1

10 months ago

3.8.1-beta.1

9 months ago

3.15.0-alpha.1

9 months ago

3.27.0

6 months ago

3.2.0

10 months ago

3.1.0

10 months ago

2.27.0

12 months ago

2.34.0

11 months ago

2.30.0

12 months ago

2.38.0

11 months ago

2.41.0

11 months ago

2.29.1-beta.0

12 months ago

2.26.0

12 months ago

2.33.0

11 months ago

2.28.1-beta.0

12 months ago

2.37.0

11 months ago

2.40.0

11 months ago

2.29.0

12 months ago

2.32.0

11 months ago

3.0.0

10 months ago

2.36.0

11 months ago

2.43.0

11 months ago

2.35.1-beta.0

11 months ago

2.35.1-beta.1

11 months ago

2.28.0

12 months ago

2.31.0

12 months ago

3.0.1-alpha.0

10 months ago

2.39.0

11 months ago

2.35.0

11 months ago

2.42.0

11 months ago

2.26.0-beta.4

12 months ago

2.25.0

1 year ago

2.22.1-beta.3

1 year ago

2.22.1-beta.2

1 year ago

2.22.1-beta.1

1 year ago

2.22.1-beta.0

1 year ago

2.22.1-beta.5

1 year ago

2.22.1-beta.4

1 year ago

2.20.0

1 year ago

2.22.0

1 year ago

2.20.1

1 year ago

2.24.1-beta.1

1 year ago

2.26.0-beta.2

12 months ago

2.24.1-beta.2

1 year ago

2.26.0-beta.1

12 months ago

2.26.0-beta.0

12 months ago

2.24.0

1 year ago

2.23.1-beta.0

1 year ago

2.22.0-beta.0

1 year ago

2.19.1-beta.0

1 year ago

2.19.1-beta.1

1 year ago

2.21.0

1 year ago

2.23.1-beta.1

1 year ago

2.23.0

1 year ago

2.26.0-beta.3

12 months ago

2.19.0

1 year ago

2.17.0

1 year ago

2.17.1

1 year ago

2.15.0

1 year ago

2.15.1

1 year ago

2.18.0

1 year ago

2.16.0

1 year ago

2.14.0

1 year ago

2.5.2-alpha.1

1 year ago

2.11.0

1 year ago

2.3.0

2 years ago

2.2.1

2 years ago

2.12.0

1 year ago

2.2.0

2 years ago

2.1.1

2 years ago

2.5.0

1 year ago

2.10.0

1 year ago

2.4.0

1 year ago

2.7.0

1 year ago

2.6.1

1 year ago

2.5.2

1 year ago

2.6.0

1 year ago

2.5.1

1 year ago

2.9.0

1 year ago

2.8.0

1 year ago

2.6.2

1 year ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.6.2-alpha.2

1 year ago

2.6.2-alpha.1

1 year ago

2.8.0-alpha.0

1 year ago

2.11.0-beta.1

1 year ago

2.13.0

1 year ago

2.11.0-alpha.1

1 year ago

1.2.0

2 years ago

1.1.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.1.2

2 years ago

1.0.3

2 years ago

1.3.0-alpha.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

0.1.0-beta.0

2 years ago

1.0.0

2 years ago

0.1.0-alpha.0

2 years ago