@zilliz/zui
v1.0.38
Published
## Some rules we need to follow
Downloads
617
Readme
Zilliz design system
Some rules we need to follow
- If we need to export className, export classes prop like mui.
- All css module named as index.module.css
- test
Component style
- In business folder we use css module
- In core folder we use sx
Create Component
- Go to core folder
- Create component folder like ZButton
- Create component like ZButton.tsx, and component name need start with Z like ZButton.
- Export component in core/index.tsx (Easy for use as lib)
Add Component Story
- Go to stories folder
- Create ZButton.stories.tsx
- Export different component demos like:
import React from 'react';
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { ZButton } from '../../../core';
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
title: 'Basic/Button',
component: ZButton,
} as ComponentMeta<typeof ZButton>;
export const Primary: ComponentStory<typeof ZButton> = args => {
return (
<ZButton
{...args}
onClick={action('custom button click')}
children="Primary Button"
color="primary"
/>
);
};
- Component doc (Optional).
Test Components
Unit tests:
- Go to
test
folder - Create
ZButton.spec.tsx
and implement the tested behavior - Run
yarn test
to check your work
- Go to
Visual tests:
We use
chromatic
for automate visual testing. It will detecte UI changes whenever you open a new pull request tomain
branch. You can go to PR checks and clickUI test
to see detail.
Publish
- Create PR to dev branch
- Merge into dev branch after code review
- Action will publish to dev website
- Create PR to main branch
- Paste story component url in comment
- Merge into main branch after ui team review.
- Action will publish to prod website
- Release with tag, change version in package.json, and action will publish to npm.