@guardian/source-foundations
我们的外观设计都是从这些原子上建造的。 可用于任何CSS-in-JS图书馆.
此软件包是 源设计系统。 。 。 .
安装
通过Yarn作为JavaScript软件包安装基础:
$ yarn add @guardian/source-foundations
或:
$ npm install @guardian/source-foundations
颜色
守护者的颜色可见于 palette 文档。 。 。 .
空间
我们 空间 系统结构为4px的递增.
import { space } from '@guardian/source-foundations';
const spaceAfter = css`
margin-bottom: ${space[3]}px;
`;
// margin-bottom: 12px;
大小
大小 单元可以用来设置一个组件的高度、最大高度、宽度或最大宽度.
import { width, height } from '@guardian/source-foundations';
const checkbox = css`
width: ${width.inputXsmall}px;
height: ${height.inputXsmall}px;
`;
// width: 24px;
// height: 24px;
类型
类型 表示为根据所希望的字体家族和大小返回 CSS 片段的方法.
import { headline } from '@guardian/source-foundations';
const h1 = css`
${headline.medium()};
`;
// font-family: GH Guardian Headline, Georgia, serif;
// font-size: 2.13rem;
媒体查询
我们提供 媒体查询 用于我们网格布局中的每个断点.
import { from, until, between } from '@guardian/source-foundations';
const styles = css`
padding: 0 10px;
${from.mobileLandscape} {
padding: 0 20px;
}
${between.phablet.and.desktop} {
padding: 0 32px;
}
${until.wide} {
padding: 0 40px;
}
`;
// padding: 0 10px;
// @media (min-width: 480px) {
// padding: 0 20px;
// }
// @media (min-width: 660px) and (max-width: 979px) {
// padding: 0 32px;
// }
// @media (max-width: 1300px) {
// padding: 0 40px;
// }