This repo is deprecated. New scss and js should be added to playbook
or directly into nitro-web
. Eventually, all storybook
styles and functionality will also be moved into playbook
or nitro-web
. If you are touching this repository, it should be in an effort to move out logic, and not add.
This repo provides the tools to implement view components which make up the visual appearance of Nitro.
- Stylesheets for the app navigation and general appearance
- Self-contained React components for use in building views
The intent of this repo was to provide a base on which other UIs can be built such that they maintain visual consistency and the Nitro brand. That will now be the intent of playbook
.
- Quick Start
- Local Storybook Development in Nitro-Web
- Publishing a new version
- Updating in
nitro-web
- Converting Existing Components
From the current project directory, run:
- ensure you are running proper node version (see
package.json
=>engines
) yarn install
yarn run storybook
- navigate to localhost:9001
Its easy to create and test out a component on nitro in real time, even with hot reload. You can point your local storybook folder as you develop it.
gem "nitro_sg", :path => "/path/to/storybook/locally"
"nitro-sg": "/path/to/storybook/locally",
If you have any problems with assets not showing try running:
bundle exec rake assets:clobber
Increase your version in the following files:
lib/nitro_sg/version.rb
package.json
Be sure and run the following anytime you version up:
yarn install && bundle install
Get your nitro-storybook
PR approved and merged into the nitro-storybook
's master
branch.
If you are not an owner of the nitro-sg
gem, then first ask a member of the UX/UI to add you. You must have/create a free rubygems.org account first.
Once you are an owner, and your PR is merged, checkout the master
branch and pull in your changes. Next, run gem build nitro_sg.gemspec
. This will create the gem artifact, called something like nitro_sg-3.4.5.gem
, where 3.4.5
is your new version.
You can then push your gem up to rubygems.org
with nitro_sg-3.4.5.gem
.
If you are not an owner of the nitro-sg
package, then first ask a member of the UX/UI to add you. You must have/create a free npmjs.com account first.
Once you are an owner, and your PR is merged, checkout the master
branch and pull in your changes. Then, run npm publish
.
You’ll need to point to a something published when your ready to deploy it.
Currently, nitro_sg
is listed as a dependency in Umbrella's Gemfile
:
gem "nitro_sg", "3.4.5"
And in two component's gemspec
files, nitro_theme
and apm
:
s.add_dependency "nitro_sg", "3.4.5"
After updating to a new version in these places, run bundle install
in apm
and nitro_theme
. Then follow up by running components/do.sh bundle --quiet
from root to iterate through every component and refresh their Gemfile.lock
s. Be sure to specify a version in you Ruby gem files! (3.4.5
) Otherwise, fuzzy matching will not force an update across Nitro.
Update the package.json
in the nitro_react
component with a version like so:
"nitro-sg": "3.4.5",
Then be sure to run yarn install
in both nitro_react
and on Umbrella.
If your updated styling does not show up, you may have old assets you need to remove. Try
bundle exec rake assets:clobber
Conversion of existing components to nitro_react
is a little different since we already have a decent class structure in the jsx component. There are, however, a few considerations:
- Use Flow.js types instead of
PropTypes
- use
class
instead offunction
(see the examples below) - Try and fix as many eslint and Flow warnings as possible - this is your chance and the time is now! 😬 💀
- Create a
Props
flow typetype Props = { children?: Array<React.Node>, bold: boolean, italic: boolean, className: string, }
- Add the type to your class
export default class Foo extends React.Component<Props> { static defaultProps = {} props: Props ...
- You can still deconstruct
this.props
in any of your methods in the normal wayconst {bar} = this.props
- Lint your code
yarn run lint
- For some lint warning you can
yarn run lint-fix
which will automagically fix things like indentation.