UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

125 lines (117 loc) 2.85 kB
import styled, { css } from 'styled-components'; import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles'; export const StyledGroupedImage = styled.div` flex: 0 0 auto; height: ${({ $height }) => $height}px; position: relative; width: ${({ $height }) => $height}px; ${({ $shouldShowKeyboardHighlighting }) => $shouldShowKeyboardHighlighting && css` &:focus-visible { ${keyboardFocusHighlightingRingCss} } `} `; export const StyledGroupImageElement = styled.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 css` height: 100%; `; } if ($isSecondImage) { return css` height: 80%; `; } return css` height: 76%; `; }} ${({ $isSecondImage }) => $isSecondImage ? css` bottom: 0; right: 0; ` : css` top: 0; left: 0; `} ${({ $background, $shouldPreventBackground, theme }) => !$shouldPreventBackground && 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; } `; export const StyledCornerImage = styled.img` aspect-ratio: 1; bottom: 0; height: ${({ $hasMultipleImages }) => $hasMultipleImages ? '28%' : '38%'}; position: absolute; right: 0; ${({ $background, $shouldPreventBackground, theme }) => !$shouldPreventBackground && 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; `} `; export const StyledCornerElement = styled.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