UNPKG

2.27 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5require('./miscellaneous.js');
6var environment = require('./environment.js');
7
8// generic names in our components.
9
10var DEFAULT_FONT_FAMILY = 'aragon-ui';
11var MONOSPACE_FONT_FAMILY = 'aragon-ui-monospace';
12var monospace = function monospace() {
13 return "\n font-family: ".concat(MONOSPACE_FONT_FAMILY, ", monospace;\n");
14};
15var FONT_SIZES = {
16 xxsmall: '11px',
17 xsmall: '12px',
18 small: '14px',
19 normal: '15px',
20 large: '16px',
21 xlarge: '20px',
22 xxlarge: '22px',
23 great: '37px'
24};
25var FONT_WEIGHTS = {
26 normal: '400',
27 bold: '600',
28 bolder: '800'
29};
30
31var fontSizeCss = function fontSizeCss(size) {
32 var fontSize = FONT_SIZES[size];
33 return fontSize !== undefined ? "\n line-height: 1.5;\n font-size: ".concat(fontSize, "\n ") : '';
34};
35
36var weightCss = function weightCss(weight) {
37 var fontWeight = FONT_WEIGHTS[weight];
38 return fontWeight !== undefined ? "font-weight: ".concat(fontWeight) : '';
39};
40
41var smallcapsCss = function smallcapsCss(smallcaps) {
42 return smallcaps ? "\n text-transform: lowercase;\n font-variant: small-caps;\n " : '';
43};
44
45var monospaceCss = function monospaceCss(monospace) {
46 return monospace ? "\n font-family: ".concat(MONOSPACE_FONT_FAMILY, ", monospace;\n ") : '';
47};
48
49function font(_ref) {
50 var size = _ref.size,
51 weight = _ref.weight,
52 _ref$smallcaps = _ref.smallcaps,
53 smallcaps = _ref$smallcaps === void 0 ? false : _ref$smallcaps,
54 _ref$monospace = _ref.monospace,
55 monospace = _ref$monospace === void 0 ? false : _ref$monospace,
56 _ref$deprecationNotic = _ref.deprecationNotice,
57 deprecationNotice = _ref$deprecationNotic === void 0 ? true : _ref$deprecationNotic;
58
59 if (deprecationNotice) {
60 environment.warnOnce('font()', 'font() is deprecated. Please use textStyle() instead.');
61 }
62
63 return "\n ".concat(fontSizeCss(size), ";\n ").concat(weightCss(weight), ";\n ").concat(smallcapsCss(smallcaps), ";\n ").concat(monospaceCss(monospace), ";\n ");
64}
65
66exports.DEFAULT_FONT_FAMILY = DEFAULT_FONT_FAMILY;
67exports.MONOSPACE_FONT_FAMILY = MONOSPACE_FONT_FAMILY;
68exports.font = font;
69exports.monospace = monospace;
70//# sourceMappingURL=font.js.map