medbelle-ui-v4 v4.2.38
MEDBELLE-UI
Shared UI components library for Medbelle projects.
Installation
npm i -S @medbelle/medbelle-ui
Usage
import React from 'react';
import { Text, Title } from '@medbelle/medbelle-ui/Typography';
import ChatBubble from '@medbelle/medbelle-ui/ChatBubble';
const MyComponent = props => {
return (
<ChatBubble>
<Title rank={2}>Title</Title>
<Text>Body</Text>
</ChatBubble>
);
};
Contents
Components
You can see list of available components and their usage at: https://styleguide.medbelle.com/
Theming
- ThemeProvider - you need to wrap your root component with theme provider in order to create context for library components styling.
import ThemeProvider from '@medbelle/medbelle-ui/ThemeProvider';
const Root = () => (
<ThemeProvider>
<MyApp />
</ThemeProvider>
);
Constants
- ConstantsProvider - you need to wrap your root component with constants provider in order to create context for library constants (texts, messages, icons and etc).
import ConstantsProvider from '@medbelle/medbelle-ui/constantsProvider';
const Root = () => (
<ConstantsProvider>
<MyApp />
</ConstantsProvider>
);
Helper methods
Library development
Tools
- styled-components - is used for components styling.
Styleguide
Storybook is used to create styleguide site - https://styleguide.medbelle.com/.
For each exportable component storybook page should be created.
Linting
Eslint + Prettier are used to make code style consistent.
There is pre-commit hook via husky + lint-staged for eslint and prettier to run against staged files.
You may run eslint manually using next command:
npm run lint
Testing
For testing purposes storyshots is used which snapshots all component's stories using Jest. Tests run on preversion hook. To run test manually use following command:
npm run test
Running it locally
From library root directory
yarn build
will build the library into/dist
cd dist/
yarn link
will register the package
In medbelle-next root directory
yarn
to update/install all the necessary librariesyarn link "@medbelle/medbelle-ui"
will create a symlink namedmedbelle-next/node_modules/@medbelle/medbelle-ui
that links to your local copy of the medbelle-ui project.
To reverse this process, simply use yarn unlink
or yarn unlink "@medbelle/medbelle-ui"
You need to be aware you need to rebuild on every change you made in medbelle-ui, but you are not required to run yarn link
again, you'll also need to stop the current local server from medbelle-next and start it again.
Publishing
Before publishing a new version please use npm version [patch|minor|major]
to add a new version and then use npm publish dist
in order to only publish the dist directory.
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago