@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
51 lines • 1.45 kB
JavaScript
import React from "react";
import styled from "styled-components";
import defaultTheme from "../defaultTheme";
const StyledAsterisk = styled.span.withConfig({
displayName: "FormLabel__StyledAsterisk",
componentId: "sc-1927civ-0"
})(["font-weight:", ";color:", ";font-size:", ";vertical-align:top;"], ({
theme
}) => theme.orbit.fontWeightBold, ({
theme,
filled
}) => !filled ? theme.orbit.colorTextError : theme.orbit.colorFormLabelFilled, ({
theme
}) => theme.orbit.fontSizeFormLabel);
StyledAsterisk.defaultProps = {
theme: defaultTheme
};
const FormLabel = styled(({
className,
children,
required,
filled,
dataTest,
id
}) => React.createElement("span", {
className: className,
"data-test": dataTest,
id: id
}, required && React.createElement(StyledAsterisk, {
"aria-hidden": "true",
filled: filled
}, "*", " "), React.createElement("span", null, children))).withConfig({
displayName: "FormLabel",
componentId: "sc-1927civ-1"
})(["display:block;font-family:", ";font-size:", ";color:", ";line-height:", ";margin-bottom:", ";"], ({
theme
}) => theme.orbit.fontFamily, ({
theme
}) => theme.orbit.fontSizeFormLabel, ({
theme,
filled,
disabled
}) => !filled || disabled ? theme.orbit.colorFormLabel : theme.orbit.colorFormLabelFilled, ({
theme
}) => theme.orbit.lineHeightTextSmall, ({
theme
}) => theme.orbit.spaceXXSmall);
FormLabel.defaultProps = {
theme: defaultTheme
};
export default FormLabel;