@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.
42 lines • 1.52 kB
JavaScript
import * as React from "react";
import styled, { css } from "styled-components";
import mq from "../../../utils/mediaQuery";
import defaultTheme from "../../../defaultTheme";
const getPadding = ({
noPadding,
useMargins,
theme
}) => {
if (noPadding) return null;
if (!useMargins) {
return css(["padding:", ";", ""], theme.orbit.spaceMedium, mq.largeMobile(css(["padding:", ";"], theme.orbit.spaceLarge)));
}
return css(["padding:", " 0;margin:0 ", ";", ""], theme.orbit.spaceMedium, theme.orbit.spaceMedium, mq.largeMobile(css(["padding:", " 0;margin:0 ", ";"], theme.orbit.spaceLarge, theme.orbit.spaceLarge)));
};
const StyledTileContent = styled.div.withConfig({
displayName: "TileContent__StyledTileContent",
componentId: "sc-1wb43fk-0"
})(["", ""], ({
theme,
withBorder,
withPointer
}) => css(["font-size:", ";line-height:", ";", ";", ";", ";"], theme.orbit.fontSizeTextNormal, theme.orbit.lineHeightTextNormal, withPointer && css(["cursor:pointer;"]), withBorder && css(["border-top:1px solid ", ";"], theme.orbit.paletteCloudNormal), getPadding));
StyledTileContent.defaultProps = {
theme: defaultTheme
};
const TileContent = /*#__PURE__*/React.forwardRef(({
children,
noPadding,
withPointer,
withBorder,
useMargins = true
}, ref) => {
return /*#__PURE__*/React.createElement(StyledTileContent, {
noPadding: noPadding,
ref: ref,
withPointer: withPointer,
withBorder: withBorder,
useMargins: useMargins
}, children);
});
export default TileContent;