@chayns-components/gallery
Version:
A set of beautiful React components for developing your own applications with chayns.
93 lines (89 loc) • 3.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StyledGalleryItemWrapper = exports.StyledGalleryEditModeWrapper = exports.StyledGallery = void 0;
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _gallery = require("../types/gallery");
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 StyledGallery = exports.StyledGallery = _styledComponents.default.div`
width: 100%;
`;
const StyledGalleryItemWrapper = exports.StyledGalleryItemWrapper = _styledComponents.default.div`
display: grid;
gap: 5px;
${({
$viewMode,
$uploadedFileLength
}) => {
if ($viewMode === _gallery.GalleryViewMode.GRID) {
return (0, _styledComponents.css)`
> div:first-child {
grid-column: 1 / -1;
}
${() => {
switch ($uploadedFileLength) {
case 1:
return (0, _styledComponents.css)`
grid-template-columns: 1fr;
`;
case 2:
return (0, _styledComponents.css)`
grid-template-columns: repeat(2, 1fr);
> div:first-child {
grid-column: span 1;
}
`;
case 3:
return (0, _styledComponents.css)`
grid-template-columns: repeat(2, 1fr);
> div:first-child {
grid-column: span 2;
}
`;
default:
return (0, _styledComponents.css)`
grid-template-columns: repeat(3, minmax(0, 1fr));
> div:not(:first-child) {
grid-column: span 1;
}
`;
}
}}
`;
}
switch ($uploadedFileLength) {
case 1:
return (0, _styledComponents.css)`
grid-template-columns: 1fr;
`;
case 2:
return (0, _styledComponents.css)`
grid-template-columns: repeat(2, 1fr);
`;
case 3:
return (0, _styledComponents.css)`
grid-template-columns: repeat(3, 1fr);
`;
default:
return (0, _styledComponents.css)`
grid-template-columns: repeat(2, 1fr);
> div:nth-child(-n + 2) {
grid-row: 1;
}
`;
}
}}
aspect-ratio: ${({
$ratio
}) => $ratio};
`;
const StyledGalleryEditModeWrapper = exports.StyledGalleryEditModeWrapper = _styledComponents.default.div`
display: grid;
grid-template-columns: ${({
$fileMinWidth
}) => `repeat(auto-fill, minmax(${$fileMinWidth}px, 1fr))`};
grid-auto-rows: 1fr;
gap: 6px;
`;
//# sourceMappingURL=Gallery.styles.js.map