wix-style-react
Version:
wix-style-react
44 lines (39 loc) • 988 B
JavaScript
import React from 'react';
import { any, string } from 'prop-types';
import Text from 'wix-style-react/Text';
/** Capitalize first character */
export function capitalize(str) {
if (!str) {
return undefined;
}
return str[0].toUpperCase() + str.substring(1);
}
export function propsToJsxString(props) {
return Object.entries(props).reduce(function (acc, entry) {
var propName = entry[0];
var propValue = entry[1];
if (propName !== 'children') {
return acc + ' ' + propName + '="' + propValue + '"';
} else {
return acc;
}
}, '');
}
export var ExampleWrapper = function ExampleWrapper(_ref) {
var children = _ref.children,
label = _ref.label;
return React.createElement(
'div',
{ style: { padding: '10px' } },
children,
React.createElement(
Text,
{ size: 'tiny', weight: 'thin', light: true, secondary: true },
label
)
);
};
ExampleWrapper.propTypes = {
children: any,
label: string
};