@borderlessvr/essentials
v0.1.5
Published
UI components for Borderless' React Apps
Downloads
5
Readme
Borderless Essentials
Getting Started: Consumer mode
npm i @borderlessvr/essentials
What's the best way to get acquainted with Essentials?
- Colors
- Learn what colors we offer
- Learn the contextual color variables and use them whenever feasible in your code over the direct name of the raw color
/* layout colors */
--color-fg: app default text color
--color-bg: the app background color level
--color-surface: one layer up from background
--color-surface-active: tertiary color of surface to use for active and hover states
--color-border: common border color
--color-primary: main accent color
--color-secondary: secondary accent color
/* status colors */
--color-err: (red) color used for error text, icons, background colors and borders
--color-warn: (orange) color used for warn scenarios icons, background colors and borders
--color-validation: (green) color used for "valid" verification, success use-cases
--color-info: (light blue) color used for non-status related notifications and iconography
--color-disabled-bg: (grey) background color for disabled components/surfaces
--color-disabled-fg: (grey) text color for disabled components
- Fonts and common typography mixins
- Workhorse elements
- BvrButton
- Card
- Form elements
- Modal
- Common icons
- IconX - also used as the plus
- IconCheck
- IconsModuleType - has the 4 icons for the types of modules, run via switch
- Logo
- Upcoming: Storybook documentation
Getting Started: Developer mode
git clone
down the reponpm install
Are you trying to run local dev in publisher while symlinked to essentials?
npm link
HERE FIRSTnpm link @borderlessvr/essentials
wherever you're working
Creating a new component?
- Clone the
_template/
directory incomponents/
and update the names across the JSX and SCSS files- This will give you correct paths to style vars, the expected setup of PropTypes, etc
- Please try to follow this flow when building JSX files
- Imports, in correct order according to format on save settings of the linter
- Docs
- Component open
- Props
- Nearly all components in Essentials will have a
className
prop at least, please do not remove it from the template code - Heavily interactible components (form els) will often times have
...otherProps
to ease unusual use-case scenarios
- Nearly all components in Essentials will have a
- Top-level React hooks: useNavigation, useRef, etc
- Local methods
- Common naming patterns: handleEvent wraps onEvent-like props to execute them, and any local to component actions
- useEffect hooks, ordered as needed
- Don't forget useEffect is synchronous, so cascade them smart
- return (markup)
- PropTypes
- Please keep the
any
types limited
- Please keep the
- defaultProps
- For function props, always add a default console log call like "Forgot an onChange for the BvrButton"
- Tests!
- There are test coverage thresholds set on this repo. Please add something to the
index.test.jsx
that came with the template copy paste
- There are test coverage thresholds set on this repo. Please add something to the
Dev Standards
When working in Essentials please follow these guidelines
Git
- Git flow feature-branching model for new work
- Please
git pull origin main
on your feature branch(es) daily - Please
git push
at least once daily - CodeBranch naming strategy
feat/
: new featuresfix/
: fixeschore/
: used for version bumps, quick tasks for releases, etc
- Preferred commit style
- fix:
- feat:
- Try to only use for adding an atomic commit of a new feature
- style:
- docs:
- wip:
Workspace
- Accept the recommended packages for VS Code. If you missed it, the list is in
.vscode/extensions.json
Linting
- We employ both ESLint and Stylelint
- Prior to opening a PR, please run
npm run lint:js
andnpm run lint:styles
to be sure your code doesn't introduce inconsistencies to our codestyle
JS & JSX
- ESLint formatOnSave is your friend
- All JSX components require
propTypes
anddefaultProps
to be set up- If you're unsure of the incoming shape, use
any
, it'll warn not error out
- If you're unsure of the incoming shape, use
- Always try to use non-destructive actions like
.slice()
andshallowClone
from the project utils to create copies of lists and objects you're manipulating
Styles
- There is a thorough order of attributes enforced by Stylelint, please enable formatOnSave for SCSS
- Use
rem
overpx
, with the exception of1px
and2px
- Do not use
em
ever - Try to rely on
margin-bottom
overmargin-top
- Use padding to support internal size and margin for maintaining space away from other elements
- Thinking about adding a color var to a component's SCSS? Maybe don't, check for an existing color, and then the "next closest" color already in the system before adding any 1-off colors
Release Process
NOTE: Do these steps after you've commited the last of the changes for your release
npm run lint:js && npm run lint:styles && npm test
Address any errors before proceeding- Search project for current version number
0.0.x
- Update
README.md
badge links - Update
package.json
version - Update
CHANGELOG.md
with overview of new material in the version (copy previous entry, update date, and Announcement and Changes fields) npm i
to update thepackage-lock.json
git add -A
git commit -m "chore: Release v0.0.x"
git tag -a v0.0.x -m "Release v0.0.x"
git push --follow-tags
- Make sure that all passes, and is merged
npm publish