0.1.5 • Published 2 years ago
@borderlessvr/essentials v0.1.5
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 clonedown the reponpm install
Are you trying to run local dev in publisher while symlinked to essentials?
npm linkHERE FIRSTnpm link @borderlessvr/essentialswherever 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
classNameprop at least, please do not remove it from the template code - Heavily interactible components (form els) will often times have
...otherPropsto 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
anytypes 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.jsxthat 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 mainon your feature branch(es) daily - Please
git pushat 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:jsandnpm run lint:stylesto be sure your code doesn't introduce inconsistencies to our codestyle
JS & JSX
- ESLint formatOnSave is your friend
- All JSX components require
propTypesanddefaultPropsto 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()andshallowClonefrom 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
removerpx, with the exception of1pxand2px - Do not use
emever - Try to rely on
margin-bottomovermargin-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 testAddress any errors before proceeding- Search project for current version number
0.0.x - Update
README.mdbadge links - Update
package.jsonversion - Update
CHANGELOG.mdwith overview of new material in the version (copy previous entry, update date, and Announcement and Changes fields) npm ito update thepackage-lock.jsongit add -Agit 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