-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
* Nested Guidelines pages * Fix sort order of generated nav items * Update Getting Started page * Update Code conventions page * Add naming convention image * Update BEM syntax copy * Add credit links * Build documentation * Add Internationalization docs * Add Grid guidance Resolves https://jira.cms.gov/browse/HDSG-70 * Build docs
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: Code conventions | ||
--- | ||
|
||
<p class="ds-text--lead"> | ||
The design system favors clarity over succinctness. This means the design system may be verbose, but it should deliver clarity and resilience in exchange. Keeping CSS legible and scalable means sacrificing a shorter syntax. | ||
</p> | ||
|
||
## CSS naming convention | ||
|
||
<img src="{{root}}/public/images/naming-convention.svg" class="ds-u-border--1" /> | ||
|
||
### Namespace | ||
|
||
To avoid conflicting with other libraries and existing code, the design system namespaces its CSS class names with `ds-`. | ||
|
||
### Prefix | ||
|
||
Prefixes are added to class names to make it more apparent what job the class is doing. | ||
|
||
| Prefix | Description | | ||
| ------ | ----------- | | ||
| `l-` | Indicates layout-related styles. These classes may be used in any number of unrelated contexts. Example: `.ds-l-container` | | ||
| `c-` | Indicates a component. Example: `.ds-c-button` | ||
| `u-` | Indicates a utility. Example: `.ds-u-color--base` | | ||
| `is-`, `has-` | Indicates state. | | ||
|
||
### BEM syntax | ||
|
||
Following the namespace and prefix is a name conforming to [BEM syntax](http://getbem.com/introduction/). | ||
|
||
Put all together, a CSS class can be broken down to these key parts: `[NAMESPACE]-[PREFIX]-[BLOCK]__[ELEMENT]--[MODIFIER]` | ||
|
||
- **Block** is a standalone entity that is meaningful on its own. For example: `.ds-c-card`, `.ds-c-button` | ||
- **Element** is a part of a block that has no standalone meaning and is semantically tied to its block, such as `.ds-c-card__title` | ||
- **Modifier** is a flag on a block or element and is used to change appearance or behavior. For example: `.ds-c-button--primary`, `ds-u-color--primary`, `ds-u-margin--3` | ||
|
||
[BEM’s strict naming rules can be found here](http://getbem.com/naming/). | ||
|
||
## Credits | ||
|
||
The CSS naming convention outlined here was heavily influenced by: | ||
|
||
- [CSS Architecture for Design Systems](http://bradfrost.com/blog/post/css-architecture-for-design-systems/), by Brad Frost | ||
- [Thoughtful CSS Architecture](https://seesparkbox.com/foundry/thoughtful_css_architecture), by Nathan Rambeck | ||
- [More Transparent UI Code with Namespaces](https://csswizardry.com/2015/03/more-transparent-ui-code-with-namespaces/), by Harry Roberts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: Grid layout | ||
--- | ||
|
||
Choosing a suitable grid framework is dependent on several factors. Some of these factors are browser support, if and which CSS preprocessor is being used, degree of customizability, and [layout mode](https://developer.mozilla.org/en-US/docs/Web/CSS/Layout_mode) preference. | ||
|
||
As a result, the design system doesn't currently include its own grid framework and instead suggests that you pick from existing solutions, based on what works best for your project and preferences. | ||
|
||
Below is a non-exhaustive list of existing grid solutions: | ||
|
||
- [Neat](http://neat.bourbon.io/) | ||
- [Flexbox Grid](http://flexboxgrid.com/) | ||
- [Susy](http://susy.oddbird.net/) | ||
- [Unsemantic](https://unsemantic.com/) | ||
- [Bootstrap grid](http://getbootstrap.com/css/#grid) | ||
|
||
If you have more suggestions, feel free to [open a ticket](https://github.com/CMSgov/design-system/issues/new). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Internationalization | ||
--- | ||
|
||
The design system's React components accepts all text as `props`, and it is the app's responsibility to provide the internationalized strings. | ||
|
||
For example: | ||
|
||
```jsx | ||
import {Alert} from '@cmsgov/design-system-core'; | ||
import i18n from 'i18n'; | ||
|
||
export default function() { | ||
return ( | ||
<Alert heading={i18n('success')}> | ||
{i18n('account.created')} | ||
</Alert> | ||
); | ||
} | ||
|
||
``` |