@chayns-components/core
Version:
A set of beautiful React components for developing your own applications with chayns.
132 lines (123 loc) • 4.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StyledGroupedImage = exports.StyledGroupImageElement = exports.StyledCornerImage = exports.StyledCornerElement = void 0;
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const StyledGroupedImage = exports.StyledGroupedImage = _styledComponents.default.div`
flex: 0 0 auto;
height: ${({
$height
}) => $height}px;
position: relative;
width: ${({
$height
}) => $height}px;
${({
$shouldShowKeyboardHighlighting
}) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
&:focus-visible {
${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
}
`}
`;
const StyledGroupImageElement = exports.StyledGroupImageElement = _styledComponents.default.div.attrs(({
$isSecondImage,
$hasMultipleImages,
$hasCornerImage,
$uuid
}) => {
let clipPath;
if ($isSecondImage && $hasCornerImage || !$isSecondImage && !$hasMultipleImages && $hasCornerImage) {
clipPath = `url(#care-of-mask--${$uuid})`;
} else if (!$isSecondImage && $hasMultipleImages) {
clipPath = `url(#second-image-mask--${$uuid})`;
}
return {
style: {
clipPath
}
};
})`
aspect-ratio: 1;
border-radius: ${({
$shouldShowRoundImage
}) => $shouldShowRoundImage ? '50%' : '0'};
position: absolute;
overflow: hidden;
${({
$hasMultipleImages,
$isSecondImage
}) => {
if (!$hasMultipleImages) {
return (0, _styledComponents.css)`
height: 100%;
`;
}
if ($isSecondImage) {
return (0, _styledComponents.css)`
height: 80%;
`;
}
return (0, _styledComponents.css)`
height: 76%;
`;
}}
${({
$isSecondImage
}) => $isSecondImage ? (0, _styledComponents.css)`
bottom: 0;
right: 0;
` : (0, _styledComponents.css)`
top: 0;
left: 0;
`}
${({
$background,
$shouldPreventBackground,
theme
}) => !$shouldPreventBackground && (0, _styledComponents.css)`
background: ${$background || `rgba(${theme['text-rgb'] ?? '0,0,0'}, 0.1)`};
box-shadow: 0 0 0 1px rgba(${theme['009-rgb']}, 0.08) inset;
`}
img {
width: 100%;
height: 100%;
object-fit: cover;
}
`;
const StyledCornerImage = exports.StyledCornerImage = _styledComponents.default.img`
aspect-ratio: 1;
bottom: 0;
height: ${({
$hasMultipleImages
}) => $hasMultipleImages ? '28%' : '38%'};
position: absolute;
right: 0;
${({
$background,
$shouldPreventBackground,
theme
}) => !$shouldPreventBackground && (0, _styledComponents.css)`
background: ${$background || `rgba(${theme['text-rgb'] ?? '0,0,0'}, 0.1)`};
box-shadow: 0 0 0 1px rgba(${theme['009-rgb']}, 0.08) inset;
`}
`;
const StyledCornerElement = exports.StyledCornerElement = _styledComponents.default.span`
height: 18px;
width: 18px;
position: absolute;
bottom: 0;
right: -5px;
display: flex;
align-items: center;
justify-content: center;
& > * {
max-height: 100%;
max-width: 100%;
display: block;
}
`;
//# sourceMappingURL=GroupedImage.styles.js.map