@kiwicom/orbit-components
Version:
<div align="center"> <a href="https://orbit.kiwi" target="_blank"> <img alt="orbit-components" src="https://orbit.kiwi/wp-content/uploads/2018/08/orbit-components.png" srcset="https://orbit.kiwi/wp-content/uploads/2018/08/orbit-components@2x.png 2x"
31 lines (24 loc) • 1.9 kB
JavaScript
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import * as React from "react";
import styled from "styled-components";
import defaultTokens from "../defaultTokens";
import TYPE_OPTIONS from "./consts";
const StyledFormFeedback = styled((_ref) => {
let { theme, type } = _ref,
props = _objectWithoutProperties(_ref, ["theme", "type"]);
return React.createElement("div", props);
}).withConfig({
displayName: "FormFeedback__StyledFormFeedback"
})(["color:", ";font-family:", ";font-size:", ";font-weight:", ";line-height:", ";width:100%;margin-top:2px;position:absolute;bottom:-", "px;& a{color:", ";font-weight:", ";text-decoration:underline;cursor:pointer;}strong,b{font-weight:", ";color:", ";}"], ({ theme, type }) => type === TYPE_OPTIONS.ERROR ? theme.orbit.colorTextError : theme.orbit.colorTextSecondary, ({ theme }) => theme.orbit.fontFamily, ({ theme }) => theme.orbit.fontSizeFormFeedback, ({ theme, type }) => type === TYPE_OPTIONS.ERROR ? theme.orbit.fontWeightMedium : theme.orbit.fontWeightNormal, ({ theme }) => theme.orbit.lineHeightText, ({ theme }) => Math.floor(theme.orbit.lineHeightText * parseInt(theme.orbit.fontSizeFormFeedback, 10)) + 2, ({ theme, type }) => type === TYPE_OPTIONS.ERROR ? theme.orbit.colorTextError : theme.orbit.colorTextAttention, ({ theme }) => theme.orbit.fontWeightMedium, ({ theme }) => theme.fontWeightMedium, ({ theme }) => theme.paletteInkNormal);
StyledFormFeedback.defaultProps = {
theme: defaultTokens
};
const FormFeedback = props => {
const { children, type = TYPE_OPTIONS.HELP, dataTest } = props;
return React.createElement(
StyledFormFeedback,
{ type: type, "data-test": dataTest },
children
);
};
export default FormFeedback;