leno-shared-components v1.2.0
Repository for all Leno projects' shared components
Local Development
To use locally:
git clone git@bitbucket.org:lenoit/leno-shared-components.git
- run
npm i
- Navigate to project that will use this package
- run
npm install --save ../path/to/this/repo
* - Navigate to your
tailwind.config.ts
(if one isn't present, you can runnpx tailwindcss init
) - Alter your config like this:
import tailwindConfig from "path/to/leno-components";
const config: Config = {
...tailwindConfig,
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"/path/to/leno-components/src/**/*.{jsx,tsx,js,ts,config}",
],
};
This should allow you to use the tailwind.config provided from the package in your project.
*Please note, that this will also allow access to ALL custom styles or animations from the package.*
Installing the package normally
- Navigate to your project's directory
- run
npm i leno-shared-components
- Start coding!
Publishing the library
- Open the package directory (leno-shared-components)
- Change whatever needs changing
- Open
package.json
and find the following line ("version": "1.0.1"
) - Increment the version number appropriately:
- small changes - last number
- medium changes (component additions, etc) - second last number
- major changes (big changes to entire design) - first number
- run
npm publish
Using the Button component
Currently the library holds only a button component. To use it in it's most basic variant write:
<Button text={'test'} />
Icons can be added on the left/right side of the button with the iconLeft
andiconRight
properties.
*Please Note these properties only take a React.ReactElement
so be sure to wrap any SVGs you send in a component*
Colors and sizes can be added with the color
and size
props. Values currently include primary, error, warning, neutral
and sm,md,lg,xl
respectively.
If anything even more specific is required. A prop called btnClassNames
is added. This will allow you to pass and classes (incl. tailwind ones) to the button.