@vchasno/shared-components v0.1.23
Shared Components library for Vchasno web applications
📦 Install
npm install @vchasno/shared-componentsyarn add @vchasno/shared-components🔨 Usage
Supports React ^16.8.0 || ^17.0.0 || ^18.0.0
import React from 'react';
import { Logo } from '@vchasno/shared-components';
const App = () => (
<>
<Logo type="edi" />
</>
);Styles
Development
Css modules are supported, if you need to create Component.module.css file or Component.css file with global styles
Need to provide a way to customize styles for each component. The native way to do this is to use global css class with prefix vchasno-shared- and css variables with prefix --vchasno-shared-
Or you can use css modules and has some specific props to customize styles like className or headerClassName etc.
/* lib/compponen/Comp */
import React from 'react';
import cn from 'classnames';
import css from './Comp.module.css'; // local styles .root, .title
// or
import './Comp.css'; // global styles .shared-component-Comp
interface CompProps {
className?: string; // prop to customize styles
}
const Comp = ({ className }) => (
<div className={cn('shared-component-Comp', css.root, className)}>
<div className={css.title}>Title</div>
</div>
);TypeScript
shared-components is written in TypeScript with complete definitions
🌍 Internationalization
Supports only Ukrainian language
🔗 Links
Development
Install dependencies
npm installAdd new component
npm run devnpm run generate <ComponentName>Go to http://localhost:6006/ and start developing
To create story see Storybook docs or other components
Build storybook
npm run build-storybookBuild
npm run buildPublish new version
Publish new version to npm registry can only be done with CI/CD
To publish new version:
- Make changes in new branch (e.g.
feature/new-component) - Add changes to CHANGELOG.md (see Keep a Changelog)
- Commit changes
- Create tag with version (e.g.
v0.1.2) runnpm version patch|minor|major - Push changes to remote and create MR to
masterbranch - Merge changes to
masterbranch (CI/CD will publish new version to npm registry)
10 months ago
10 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago