jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
54 lines (46 loc) • 1.97 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var tslib_es6 = require('../../../../../node_modules/tslib/tslib.es6.js');
var React = require('react');
var React__default = _interopDefault(React);
var styled = require('styled-components');
var styled__default = _interopDefault(styled);
var Close = require('../../../../icons/Close.js');
/**
* @file index.tsx
*
* @fileoverview Flag component. Renders a flag component.
*/
const StyledDivFlag = styled__default.div `
display: inline-flex;
transition: all ease-in 100ms;
line-height: ${props => props.theme.flag.lineHeight};
margin: ${props => props.theme.flag.margin};
background-color: ${props => props.theme.flag.backgroundColor[props.flagStyle]};
padding: ${props => props.theme.flag.padding};
border-radius: ${props => props.theme.flag.borderRadius};
font-size: ${props => props.theme.flag.fontSize};
color: ${props => props.theme.flag.color[props.flagStyle]};
button {
cursor: pointer;
color: ${props => props.theme.flag.color[props.flagStyle]};
margin-left: ${props => props.theme.flag.closeButton.margin};
}
> svg {
margin: ${props => props.theme.flag.svg.margin};
padding-right: ${props => props.theme.flag.svg.padding};
flex-shrink: 0;
}
`;
/**
* The flag is a label style element that can be used to show information.
*/
const Flag = (_a) => {
var { flagStyle = 'secondary', children, onClose } = _a, props = tslib_es6.__rest(_a, ["flagStyle", "children", "onClose"]);
return (React.createElement(StyledDivFlag, Object.assign({ flagStyle: flagStyle }, props),
children,
onClose && (React.createElement("button", { onClick: onClose },
React.createElement(Close.CloseIcon, { height: "20", width: "20", title: "Close" })))));
};
exports.Flag = Flag;