web/packages/design/README.md
This package contains the source code of Gravitational Design System
As CSS-in-JS libraries matured and with the emergence of such great tools as storybook, it became significantly easier and faster to build UI components and design systems.
We looked at other design-systems and we realized that it's easier to build it ourselves rather than trying to customize/override the third-party components.
This design system has a limited feature set designed around Gravitational requirements.
This design system takes advantage of the two great libraries styled-components and styled-system.
Please refer to the following articles to get familiar with the general concept and principles on which this design system is built.
Build Better Component Libraries with Styled System
Component Based Design System With Styled-System
Here are some general rules for using typography in our apps:
<H1/>, <P/> to <Text typography="..."/> if we can assign semantics to a given piece of content.<Text typography="..."/> to using custom font sizes and
other text attributes.<H1/>, <H2/>, <H3/>, <H4/> wrappers render actual HTML tags,
which is better for accessibility. Usage examples:
<H1/> — page titles, empty result set notifications followed up by
additional content.<H2/> — dialog titles, dialog-like side panel titles, resource enrollment
subpage titles.<H3/> — explanatory side panel titles, resource enrollment step boxes.bold
attribute, or revert to using <Text typography="h?"/>.<H1/> through <H3/> headings, use <Subtitle1/>
through <Subtitle3/> components. Don’t use subtitle typography for more than
a short subtitle right next to the heading.<header> HTML element.<P/> if your text consists of actual sentences. This component
automatically handle inter-paragraph spacing without disrupting the external
margins. It doesn’t enforce any typography, so it defaults to whatever is
inherited from the component (body2 is the global default). unless a line break is exactly what is appropriate (e.g.
in code or command snippets). Prefer paragraphs or other block elements to
separate text vertically.<P1/> through <P3/> for paragraphs that explicitly override typography
to body1 through body3, respectively. Note that picking between them
doesn’t have anything to do with their level in document’s heading hierarchy;
having multiple versions of these is only a shortcut for applying different
body typography to paragraphs.caps
modifier or the <H4/> component, which uses all caps for its content; this
way, it will be easier to refactor your code.