This package contains React components that should be used while developing UI for WEKA applications.
- Run
yarn install
to install the necessary dependencies. - Run
yarn link
to create a symlink between the package and your local environment. - Inside the parent repository, run
yarn link "@weka/weka-ui-components"
to link the package. - Run the parent repository with the
--force
option to see changes.
To release a new version of the package:
- Open a pull request to the
main
branch. - A new release will be created for each merged PR.
https://weka.github.io/weka-ui-components
yarn run storybook
We are using conventional commits. Here are some examples:
feat: commit message (ticket)
- Use this for commits that introduce a new feature to the codebase.fix: commit message (ticket)
- Use this for commits that fix a bug in the codebase.chore: commit message (ticket)
- Use this for commits related to routine tasks or maintenance chores in the codebase.
- Open a pull request to the
weka-ui-components
. - Inside parent repositories where you want to update the components, run
yarn add @weka.io/weka-ui-components@https://github.com/weka/weka-ui-components#<pr_branch_name>
with your PR branch name instead of<pr_branch_name>
. - Open a PR for the parent repository.
- After merging the components PR, wait a few minutes for release and get the latest tag from here.
- Inside parent repositories where you want to update the components, run
yarn add @weka.io/weka-ui-components@https://github.com/weka/weka-ui-components#<latest_tag>
with the tag instead of<latest_tag>
. - Update PRs for parent repositories.
Add to the head
element:
<style>
/* optimization to remove flickering between reloads */
html {
background: #f5f5f5;
}
html.dark-mode {
background: #3d3d3d;
}
@media (prefers-color-scheme: dark) {
html {
background: #3d3d3d;
}
}
html.light-mode {
background: #f5f5f5;
}
</style>
Add above all other scripts inside the body
element:
<script>
// optimization to remove flickering between reloads
const savedDarkMode = localStorage.getItem('isDarkMode')
if (savedDarkMode) {
if (savedDarkMode === 'true') {
document.documentElement.classList.add('dark-mode')
document.body.classList.add('dark-mode')
} else if (savedDarkMode === 'false') {
document.documentElement.classList.add('light-mode')
document.body.classList.add('light-mode')
}
window.addEventListener('DOMContentLoaded', () => {
document.documentElement.classList.remove('dark-mode')
document.documentElement.classList.remove('light-mode')
})
}
</script>
Wrap your app with DarkModeProvider
and call useDarkMode
for getting the current value.