odp-shared-components-poc
v0.6.0
Published
A collection of reusable React components.
Readme
odp-shared-components-poc
A collection of reusable React components.
Project Structure
/odp-shared-components
├── /dist # Compiled output
├── /src # Source code
│ ├── /components # Individual components
│ │ ├── ProductName # Example component
│ │ │ ├── index.js
│ │ │ ├── styles.module.css
│ │ ├── ... # Other components
│ ├── index.js # Main export file
├── .babelrc
├── .eslintrc
├── package.json
├── rollup.config.jsInstallation
To install in your project:
npm install odp-shared-components-poc --legacy-peer-depsUsage
import React from "react";
import ProductName from "odp-components";
const App = () => {
return <ProductName name="Example Product" className="custom-class" />;
};
export default App;Adding a New Component
To add a new component:
- Create a new folder inside
src/components/. - Implement the component in
index.js. - If necessary, create a
styles.module.cssfor scoped styles. - Export the new component in
src/index.js.
Running Locally with npm link
To work on this package and test it in another project:
- Inside the
odp-shared-components-pocdirectory, run:npm link - Inside the consuming project, run:
npm link odp-shared-components-poc - Restart the consuming project's development server if needed.
Publishing to NPM
To publish a new version:
- Ensure all changes are committed.
- Update the version in
package.json(e.g.,1.0.1 → 1.0.2). - Run:
npm publish --access public
