KhulnaSoft UI is a UI component library that implements Pajamas, our design system. KhulnaSoft UI is written in Vue.js and its objectives are to:
- Create reusable UI components to accelerate frontend development.
- Create UI consistency for all components within KhulnaSoft.
See https://khulnasoft.github.io/khulnasoft-ui/ for documentation.
-
To use KhulnaSoft UI in your project, add it as a dependency:
yarn add @khulnasoft/ui
Note: Make sure to also install KhulnaSoft UI's peer dependencies. Refer to the
package.json
for the list of peer dependencies and their expected versions. -
In your main entrypoint before importing or using any component:
import setConfigs from '@khulnasoft/ui/dist/config' setConfigs()
This will set the global configs used by KhulnaSoft UI.
-
Include the required stylesheets in your app. Refer to the CSS docs for installation options.
-
Import the components as desired:
import { GlButton } from '@khulnasoft/ui';
Note: KhulnaSoft UI is compatible with tree-shaking, you may enable this in your project to reduce bundle sizes.
Note: KhulnaSoft UI isn't designed to be built on Windows natively. Either WSL or GitPod can be used to set up a UNIX-like environment in which to build it.
Make sure you have Node 16.x (LTS) and Yarn 1.22 or newer.
# Clone the project
git clone [email protected]:khulnasoft/khulnasoft-ui.git
# Navigate to the root of the project
cd khulnasoft-ui
# Install all the dependencies of the project
yarn # or yarn install
# Build and launch storybook to see the components in the browser
yarn storybook
Go to http://localhost:9001/
Components’ unit tests live in the tests/components
. The tests are organized following the same
directory structure used to organize components.
-
yarn test:unit
runs all unit tests. -
yarn test:unit:watch
runs all unit tests in watch mode. -
yarn test:unit:debug
runs all unit tests and allow to attach a debugger to the test runner process. -
yarn jest [name_pattern]
runs spec files that match the specified name pattern.
-
yarn jest datepicker
will match all spec files with a name that contains the word datepicker. -
yarn jest datepicker -t "when draw event is emitted"
goes a step further and only runs the test with a description that matches the argument passed to thet
flag.
Even though we try to avoid writing complex SASS code to maintain CSS complexity low, we’ve
implemented some functions that benefit from automated testing. SASS tests live in the tests/scss
directory. KhulnaSoft UI uses sass-true to implement these tests, and
jest run them.
yarn jest run_scss_tests
runs all SCSS tests.
KhulnaSoft UI uses visual snapshot tests to prevent introducing regressions with CSS and layout changes on components. Read more on this in the visual testing documentation.
KhulnaSoft UI components are a reference implementation of the Pajamas Design System components. These components should conform with the design system specs, and they should look correct in the pajamas website and the KhulnaSoft product. Please see Debugging KhulnaSoft UI issues with KhulnaSoft product CSS for information on how to debug issues with KhulnaSoft product CSS in KhulnaSoft UI.
Components’ end to end tests live in the cypress/e2e
folder. See our
end to end testing documentation for more details.
yarn run cypress open
runs Cypress locally to run end to end tests.
KhulnaSoft UI uses design tokens to maintain a single source of truth that, through automation, can be formatted for different uses. Read more on this in the design tokens documentation.
See Updating KhulnaSoft UI Packages for information on how the
@khulnasoft/ui
package is kept up to date in various projects.
Please refer to CONTRIBUTING.md for details on how to add new components and contribute in general to KhulnaSoft UI.
Any question? Have a look at our FAQ.md, you might find the answer there.