-
Notifications
You must be signed in to change notification settings - Fork 9
Integrating With UIComponents
-
It's simple. Let's add that into your project:
yarn add @intellihr/ui-components react react-dom foundation-sites jquery styled-components # or npm i @intellihr/ui-components react react-dom foundation-sites jquery styled-components -
Then included the project css and this project's components css into your project's entry point. e.g. in CRA, it's the
index.js:import '@intellihr/ui-components/dist/index.css' import '@intellihr/ui-components/dist/ui-components.css'
-
Make sure your project knows how to handle css file type, which is quite simple if you use webpack(and normally your project should have already setup):
{ test: /\.css$/, use: [ require.resolve('style-loader'), { loader: require.resolve('css-loader') } ] }
-
Then you could start using the components! Test out by:
import { Callout } from '@intellihr/ui-components' <Callout type="info"> <div className="title"> Information! </div> Bringing you the lasted news. </Callout>
In order to test how components we're developing look live in the website, we need to be able to point our local builds to the local ui-components that is in development.
- Run ui-components as per usual in your local environment by running
yarnand thendocker-compose up local - Open a second terminal in the ui-components folder and run
yarn build:watch - Modify your SPA build's
docker-compose.override.ymlas per the example file to include the volume link to your local ui-components. The tells docker to replace thenode_modules/intellihr/ui-componentsfolder in SPA with your host'sui-componentsfolder. - Run SPA as per usual in your local environment by running
yarnand thendocker-compose up local- any changes you make in your local ui-components should now be reflected in your SPA pages
-
Run ui-components as per usual in your local environment by running
yarnand thendocker-compose up local -
Open a second terminal in the ui-components folder and run
yarn build:watch -
Open a third terminal in the ui-components folder and run
yarn link- you should get a success message like the following in your terminal:success Registered "@intellihr/ui-components" -
Navigate to your Lapis workspace in the terminal, and run
yarn link "@intellihr/ui-components"- this will create a symlink between your local ui-components build, and the package folder in LapisNote: Running
yarnin the Lapis workspace will destroy the symlink, so if you need to runyarndo so before you link ui-components to Lapis.To check if your symlink is working you can run
ls -al node_modules/@intellihr/in your Lapis workspace, and you should see something like this signifying the link:ui-components -> ../../../../../.config/yarn/link/@intellihr/ui-components -
Run Lapis as per usual using
docker-compose up localandyarn build:watchin two terminals - any changes you make in your local ui-components should now be reflected in your Lapis pages -
To remove the symlink you can run
yarn unlink "@intellihr/ui-components"in the Lapis workspace, andyarn unlinkin the ui-components workspace. Once you have removed the symlink you will need to runyarnin the Lapis workspace again to pull its original ui-components package.