wix-style-react
Version:
wix-style-react
92 lines (85 loc) • 2.77 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import React from 'react';
import { string, bool } from 'prop-types';
import classNames from 'classnames';
import typography from '../../src/Typography';
import styles from './styles.scss';
var headingClasses = function headingClasses(props) {
var _classNames;
return classNames((_classNames = {}, _defineProperty(_classNames, typography[props.appearance], props.appearance), _defineProperty(_classNames, typography.light, props.light), _classNames));
};
var HeadingExample = function HeadingExample(props) {
var boolLabel = function boolLabel(val) {
return val === undefined ? '[false]' : val ? 'true' : 'false';
};
var light = boolLabel(props.light);
return React.createElement(
'tr',
null,
React.createElement(
'td',
null,
props.appearance
),
React.createElement(
'td',
null,
light
),
React.createElement(
'td',
{ style: { backgroundColor: props.light ? 'black' : 'white' } },
React.createElement(
'span',
{ className: headingClasses(props) },
'This is a heading'
)
)
);
};
HeadingExample.propTypes = {
appearance: string.isRequired,
light: bool,
note: string
};
export function renderHeadingTable() {
return React.createElement(
'table',
{ className: styles.table },
React.createElement(
'thead',
null,
React.createElement(
'tr',
null,
React.createElement(
'th',
null,
'Appearance'
),
React.createElement(
'th',
null,
'Light'
),
React.createElement(
'th',
null,
'Example'
)
)
),
React.createElement(HeadingExample, { appearance: 'h1' }),
React.createElement(HeadingExample, { appearance: 'h2' }),
React.createElement(HeadingExample, { appearance: 'h3' }),
React.createElement(HeadingExample, { appearance: 'h4' }),
React.createElement(HeadingExample, { appearance: 'h5' }),
React.createElement(HeadingExample, { appearance: 'h6' }),
React.createElement(HeadingExample, { appearance: 'h1', light: true }),
React.createElement(HeadingExample, { appearance: 'h2', light: true }),
React.createElement(HeadingExample, { appearance: 'h3', light: true }),
React.createElement(HeadingExample, { appearance: 'h4', light: true }),
React.createElement(HeadingExample, { appearance: 'h5', light: true }),
React.createElement(HeadingExample, { appearance: 'h6', light: true })
);
}