@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.
48 lines • 1.41 kB
JavaScript
import React from "react";
import styled from "styled-components";
import defaultTokens from "../defaultTokens";
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: defaultTokens
};
const FormLabel = styled(({
className,
children,
required,
filled,
dataTest
}) => React.createElement("span", {
className: className,
"data-test": dataTest
}, required && React.createElement(StyledAsterisk, {
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.lineHeightText, ({
theme
}) => theme.orbit.spaceXXSmall);
FormLabel.defaultProps = {
theme: defaultTokens
};
export default FormLabel;