-
Create isolated, predictable, configurable UI components.
-
Change the way that eng-design team operates by creating a workflow and audit trail that is based on reviewing modules.
-
UI component's code and appearance are reviewed at the same time, with the same scope.
-
Automatically be aware of changes to modules that depend on the one you are changing. Encourage decomposition of UI where appropriate.
-
Roll out at smallest scale first, with only partial workflow. Lower risk.
Rough idea of component-based UI organization.
.
└── ui
├── README.md
├── STYLE.md
├── component
│ ├── grid
│ │ ├── bower.json
│ │ ├── README.md
│ │ ├── OWNERS
│ │ ├── css
│ │ │ └── grid.css
│ │ ├── template
│ │ │ ├── core.mustache
│ │ │ └── cell.mustache
│ │ └── test
│ │ └── integration
│ │ └── spec.mustache
│ ├── page-profile
│ │ ├── bower.json
│ │ ├── README.md
│ │ ├── OWNERS
│ │ ├── js
│ │ │ └── page-profile.js
│ │ ├── template
│ │ │ └── core.mustache
│ │ └── test
│ │ ├── unit
│ │ │ └── spec.js
│ │ └── integration
│ │ └── spec.mustache
│ └── tweet
│ ├── bower.json
│ ├── README.md
│ ├── OWNERS
│ ├── css
│ │ ├── tweet.editing.css
│ │ └── tweet.css
│ ├── js
│ │ ├── tweet.with-promoted.js
│ │ └── tweet.js
│ ├── template
│ │ ├── actions.mustache
│ │ ├── core.mustache
│ │ ├── context.mustache
│ │ ├── footer.mustache
│ │ ├── header.mustache
│ │ └── media.mustache
│ └── test
│ ├── unit
│ │ ├── with-promoted.spec.js
│ │ └── spec.js
│ └── integration
│ └── spec.mustache
└── util
Hide the component implementation details.
- Every component has a unique namespace.
- Every component is developed in isolation (i.e., it doesn't care where it might end up)
- All CSS rules in the component's CSS must start with the namespace.
- No rules in the component CSS may use nested-component modifiers in selectors. (i.e., don't do this
.Tweetbox .Button--submit
) - Every component is responsible for HTML/Mustache templates with configuration options (server-side logic –
#with_some_optional_part
,#extra_classes
- and template inheritance placeholders).
A component could be a button or an entire page. Compose components from others without having to be concerned with the inner component implementation details.
Some presentation logic and configuration will end up in the server-side views (due to the limitations of our templating engines) and JS files.
- If a UI component needs to undergo logical state changes in the client, then a Flight component is created to manage it and the corresponding presentation.
- It is bound to the UI component by the ancestral context (so, a tweetbox would have to bind the Button component to any button it wants to apply the behaviour to).
- The component defines events to respond to and emit.
USE BOWER to specify local dependencies, e.g., 'tweetbox' depends on '../button', '../textarea', etc. Depends on whole components; should help trace HTML/CS/JS dependencies and generate bundles with only the modules needed by a part of the UI.
Huxley or PhantomCSS
- Load the dedicated visual test file in isolation with mock data.
- Each static state is represented.
- Interactive flows are carried out.
- Screenshots compared between master and your branch.
- Check that module is rendering as expected.
- Run tests for all modules to find out how higher-level modules are impacted.
- Check that modules are rendering to satisfaction (or fix them)
- Put up review with image diffs so teams can see how their modules are changed.
Changed. The templates could roughly reflect the UI component structure without being as verbose as the names we use in the template code:
grid/template/core
,grid/template/cell