From 319fed0af3e3813b71967f57660f4d97bb0e08df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannik=20R=C3=B6del?= Date: Tue, 21 Sep 2021 13:09:04 +0200 Subject: [PATCH] Add icons to actions component --- index.md | 59 ++++++++++++++++ styles/components/_actions.scss | 120 ++++++++++++++++++++++++++++++++ styles/lib/_motion.scss | 3 + 3 files changed, 182 insertions(+) create mode 100644 styles/lib/_motion.scss diff --git a/index.md b/index.md index d8372ef..b6b7f1b 100644 --- a/index.md +++ b/index.md @@ -10,17 +10,76 @@ Wir bieten Bedürftigen Zugang in die digitale Welt

Wie du mitmachen kannst

Wenn du Lust hast unseren Verein zu unterstützen, dann komm' vorbei und bastel mit! Oder spende Geld, mit dem wir unsere anfallenden Kosten bezahlen!

+

Computer bekommen

+

Computer spenden

+ + + + + + + + + + + + + + + + +
+

Zeit spenden

+ + + + + + + + + + + + + + + + + +
+

Geld spenden

+ + + + + + + +
diff --git a/styles/components/_actions.scss b/styles/components/_actions.scss index b7087d8..720aa33 100644 --- a/styles/components/_actions.scss +++ b/styles/components/_actions.scss @@ -1,4 +1,5 @@ @use '../lib/colors'; +@use '../lib/motion'; @use '../lib/layout'; // Actions are another module that is present on the home page. It shows a small @@ -22,6 +23,8 @@ } > a { + display: flex; + flex-direction: column-reverse; margin: layout.$large-gap 0; padding: layout.$large-gap; background: colors.$gray-50; @@ -33,6 +36,16 @@ margin: 0; text-transform: uppercase; } + + > svg { + align-self: center; + margin-bottom: layout.$normal-gap; + height: 10rem; + } + + &:hover { + @extend %action-icon-hover; + } } @media screen and (min-width: layout.$breakpoint) { @@ -62,3 +75,110 @@ } } } + +.action-icon { + overflow: visible; + fill: colors.$main-text; + // This seems to prevent jittering in Firefox: + pointer-events: none; + + &:hover { + @extend %action-icon-hover; + } + + .emphasis-gradient > stop { + stop-color: colors.$blue-500; + transition: motion.$gentle stop-color; + } + + .emphasis { + transition: motion.$gentle transform; + + &.heart-left { + transform-origin: top left; + } + + &.heart-right { + transform-origin: top right; + } + + &.coin { + transform-origin: 58% 39%; + } + } +} + +%action-icon-hover { + .emphasis-gradient { + @keyframes action-icon-emphasis-gradient-1 { + 0% { stop-color: colors.$blue-500; } + 40% { stop-color: colors.$yellow-500; } + 80% { stop-color: colors.$teal-500; } + } + + @keyframes action-icon-emphasis-gradient-2 { + 0% { stop-color: colors.$blue-500; } + 20% { stop-color: colors.$blue-800; } + 60% { stop-color: colors.$yellow-500; } + 100% { stop-color: colors.$teal-500; } + } + + @for $i from 1 through 2 { + > stop:nth-of-type(#{$i}) { + stop-color: colors.$teal-500; + animation: + motion.$prominent 0s 1 normal backwards running + action-icon-emphasis-gradient-#{$i}; + } + } + } + + .heart-left { + $final-transformation: + translateX(-0.8rem) translateY(1.4rem) scale(1.5) rotate(-25deg); + + @keyframes action-icon-heart-left { + 0% { transform: none; } + 50% { + transform: + translateX(0.2rem) translateY(0.8rem) scale(1.2) rotate(-10deg); + } + 100% { transform: $final-transformation; } + } + + transform: $final-transformation; + animation: + motion.$gentle 0s 1 normal backwards running action-icon-heart-left; + } + + .heart-right { + $final-transformation: + translateX(1.4rem) translateY(-0.1rem) scale(1.6) rotate(15deg); + + @keyframes action-icon-heart-right { + 0% { transform: none; } + 50% { + transform: + translateX(1.3rem) translateY(0.8rem) scale(1.4) rotate(30deg); + } + 100% { transform: $final-transformation; } + } + + transform: $final-transformation; + animation: + motion.$gentle 0s 1 normal backwards running action-icon-heart-right; + } + + .coin { + $final-transformation: scale(0.8); + + @keyframes action-icon-coin { + 0% { transform: none; } + 50% { transform: scale(1.1); } + 100% { transform: $final-transformation; } + } + + transform: $final-transformation; + animation: motion.$gentle 0s 1 normal backwards running action-icon-coin; + } +} diff --git a/styles/lib/_motion.scss b/styles/lib/_motion.scss new file mode 100644 index 0000000..208d645 --- /dev/null +++ b/styles/lib/_motion.scss @@ -0,0 +1,3 @@ +$subtle: 0.1s cubic-bezier(0.56, 0.03, 0.35, 0.9); +$gentle: 0.2s cubic-bezier(1, 0.11, 0.41, 0.69); +$prominent: 0.7s cubic-bezier(.45,.16,.38,.7);