From ce92a71b1d68c19048839e12314b7893e53f1123 Mon Sep 17 00:00:00 2001 From: 0phoff <0phoff@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:57:45 +0100 Subject: [PATCH] Added Shape component --- components/Shape.vue | 67 +++++++++++++++++++++++++++++++++++++++++++ example.md | 49 +++++++++++++++++++++---------- styles/components.css | 26 +++++++++++++++++ 3 files changed, 127 insertions(+), 15 deletions(-) create mode 100644 components/Shape.vue diff --git a/components/Shape.vue b/components/Shape.vue new file mode 100644 index 0000000..ac0d0e1 --- /dev/null +++ b/components/Shape.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/example.md b/example.md index 115dc42..d177901 100644 --- a/example.md +++ b/example.md @@ -271,6 +271,33 @@ color-opacity: 0.6 # Components +--- +layout: stack +content-class: gap-5 py-5 +--- + +# Block +::content:: + + +This is a block. + + + +This is another block with a different color and some UnoCSS styling. + + + + +Similarly to the image layout, a block can have a background image and a (transparent) background overlay color. + + + + --- layout: stack content-class: flex-row gap-25 mb-14 @@ -309,26 +336,18 @@ content-class: flex-row gap-25 mb-14 --- layout: stack -content-class: gap-5 py-5 +content-class: flex-row gap-25 mb-14 --- -# Block +# Shape ::content:: - -This is a block. - + + + + + - -This is another block with a different color and some UnoCSS styling. - - -Similarly to the image layout, a block can have a background image and a (transparent) background overlay color. - diff --git a/styles/components.css b/styles/components.css index d6a8ec2..f841b52 100644 --- a/styles/components.css +++ b/styles/components.css @@ -151,6 +151,32 @@ } +/* + * SHAPE + * Element that has a clip-path property to draw various geometric shapes (octagon, rhombus, hexagon). + * + * Variables + * --shape-size: Size (width) of the element + * --shape-aspect: Aspect ratio of the element + * --shape-horizontal-clip: Horizontal clipping distance + * --shape-vertical-clip: Vertical clipping distance + */ +.shape { + width: var(--shape-size); + aspect-ratio: var(--shape-aspect, 1); + clip-path: polygon( + var(--shape-horizontal-clip) 0, + calc(100% - var(--shape-horizontal-clip)) 0, + 100% var(--shape-vertical-clip), + 100% calc(100% - var(--shape-vertical-clip)), + calc(100% - var(--shape-horizontal-clip)) 100%, + var(--shape-horizontal-clip) 100%, + 0 calc(100% - var(--shape-vertical-clip)), + 0 var(--shape-vertical-clip) + ); +} + + /* * STACK * Element where all the childs get stacked (vertically by default).