1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-06 06:07:33 +02:00

feat: Square size

This commit is contained in:
Phuoc Nguyen
2022-09-19 21:14:16 +07:00
parent ec8c32556e
commit 02b7e880ec
2 changed files with 14 additions and 4 deletions

View File

@@ -53,8 +53,9 @@ module.exports = function(eleventyConfig) {
const w = width || randomInteger(1, 4) * 20;
return `<div class="rectangle rectangle--${direction} rectangle--${s} rectangle--${w}"></div>`;
});
eleventyConfig.addShortcode('square', function() {
return `<div class="square"></div>`;
eleventyConfig.addShortcode('square', function(size) {
const s = size || 'sm';
return `<div class="square square--${s}"></div>`;
});
// `corner` can be one of `t`, `r`, `b`, `l`, `tr`, `br`, `tl`, `bl`
eleventyConfig.addShortcode('triangle', function(corner, size) {

View File

@@ -1,6 +1,15 @@
.square {
background: rgba(0, 0, 0, 0.3);
border-radius: 0.25rem;
height: 100%;
width: 100%;
height: var(--square-size);
width: var(--square-size);
}
.square--sm {
--square-size: 0.5rem;
}
.square--md {
--square-size: 2rem;
}
.square--lg {
--square-size: 4rem;
}