1 | import "core-js/modules/es.array.index-of.js";
|
2 | import "core-js/modules/es.array.map.js";
|
3 | import "core-js/modules/es.object.assign.js";
|
4 | import "core-js/modules/es.object.keys.js";
|
5 |
|
6 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
7 |
|
8 | function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
9 |
|
10 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11 |
|
12 | import React from 'react';
|
13 | import { styled } from '@storybook/theming';
|
14 | import { transparentize } from 'polished';
|
15 | import { withReset } from '../typography/shared';
|
16 | import { getBlockBackgroundStyle } from './BlockBackgroundStyles';
|
17 | var Label = styled.div(function (_ref) {
|
18 | var theme = _ref.theme;
|
19 | return {
|
20 | marginRight: 30,
|
21 | fontSize: "".concat(theme.typography.size.s1, "px"),
|
22 | color: theme.base === 'light' ? transparentize(0.4, theme.color.defaultText) : transparentize(0.6, theme.color.defaultText)
|
23 | };
|
24 | });
|
25 | var Sample = styled.div({
|
26 | overflow: 'hidden',
|
27 | whiteSpace: 'nowrap',
|
28 | textOverflow: 'ellipsis'
|
29 | });
|
30 | var TypeSpecimen = styled.div({
|
31 | display: 'flex',
|
32 | flexDirection: 'row',
|
33 | alignItems: 'baseline',
|
34 | '&:not(:last-child)': {
|
35 | marginBottom: '1rem'
|
36 | }
|
37 | });
|
38 | var Wrapper = styled.div(withReset, function (_ref2) {
|
39 | var theme = _ref2.theme;
|
40 | return Object.assign({}, getBlockBackgroundStyle(theme), {
|
41 | margin: '25px 0 40px',
|
42 | padding: '30px 20px'
|
43 | });
|
44 | });
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | export var Typeset = function Typeset(_ref3) {
|
51 | var fontFamily = _ref3.fontFamily,
|
52 | fontSizes = _ref3.fontSizes,
|
53 | fontWeight = _ref3.fontWeight,
|
54 | sampleText = _ref3.sampleText,
|
55 | props = _objectWithoutProperties(_ref3, ["fontFamily", "fontSizes", "fontWeight", "sampleText"]);
|
56 |
|
57 | return React.createElement(Wrapper, _extends({}, props, {
|
58 | className: "docblock-typeset"
|
59 | }), fontSizes.map(function (size) {
|
60 | return React.createElement(TypeSpecimen, {
|
61 | key: size
|
62 | }, React.createElement(Label, null, size), React.createElement(Sample, {
|
63 | style: {
|
64 | fontFamily: fontFamily,
|
65 | fontSize: size,
|
66 | fontWeight: fontWeight,
|
67 | lineHeight: 1.2
|
68 | }
|
69 | }, sampleText || 'Was he a beast if music could move him so?'));
|
70 | }));
|
71 | };
|
72 | Typeset.displayName = "Typeset"; |
\ | No newline at end of file |