@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.
28 lines (26 loc) • 1.15 kB
JavaScript
import * as React from "react";
import styled from "styled-components";
import { StyledText } from "../Text";
import { StyledHeading } from "../Heading";
var StyledTruncate = styled.div.withConfig({
displayName: "Truncate__StyledTruncate",
componentId: "jwxsw1-0"
})(["", ";"], function (_ref) {
var maxWidth = _ref.maxWidth;
return "\n min-width: 0;\n flex: 0 1 ".concat(maxWidth === "none" ? "100%" : maxWidth, ";\n max-width: ").concat(maxWidth, ";\n ");
});
var StyledTruncateContent = styled.div.withConfig({
displayName: "Truncate__StyledTruncateContent",
componentId: "jwxsw1-1"
})(["&,", ",", "{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}"], StyledText, StyledHeading);
var Truncate = function Truncate(_ref2) {
var children = _ref2.children,
_ref2$maxWidth = _ref2.maxWidth,
maxWidth = _ref2$maxWidth === void 0 ? "100%" : _ref2$maxWidth,
dataTest = _ref2.dataTest;
return /*#__PURE__*/React.createElement(StyledTruncate, {
maxWidth: maxWidth,
"data-test": dataTest
}, /*#__PURE__*/React.createElement(StyledTruncateContent, null, children));
};
export default Truncate;