From 5227498c92b64efbe214749fa364429a69c3b665 Mon Sep 17 00:00:00 2001 From: Sascha Karnatz <122262394+sascha-karnatz@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:07:29 +0200 Subject: [PATCH] Add color option to spinner The option is only used in the image gallery, but is now possible to use every color inside the spinner. --- app/assets/stylesheets/alchemy/spinner.scss | 28 ++++++------------- .../alchemy_admin/components/spinner.js | 8 ++++-- app/javascript/alchemy_admin/image_loader.js | 20 ++++--------- app/javascript/alchemy_admin/spinner.js | 6 ++-- 4 files changed, 24 insertions(+), 38 deletions(-) diff --git a/app/assets/stylesheets/alchemy/spinner.scss b/app/assets/stylesheets/alchemy/spinner.scss index bbb28c2046..5548c18dbb 100644 --- a/app/assets/stylesheets/alchemy/spinner.scss +++ b/app/assets/stylesheets/alchemy/spinner.scss @@ -5,31 +5,21 @@ transform: translate(-50%, -50%); text-align: center; line-height: 1; - - path { - fill: currentColor; - opacity: 1; - animation: spinner 1s infinite ease-in-out both; - } - - &.spinner--tiny { - width: 8px; - height: 8px; - } + width: var(--spinner-size, 32px); + height: var(--spinner-size, 32px); &.spinner--small { - width: 16px; - height: 16px; + --spinner-size: 16px; } - &.spinner--medium { - width: 32px; - height: 32px; + &.spinner--large { + --spinner-size: 48px; } - &.spinner--large { - width: 48px; - height: 48px; + path { + fill: var(--spinner-color, currentColor); + opacity: 1; + animation: spinner 1s infinite ease-in-out both; } .hex2 { diff --git a/app/javascript/alchemy_admin/components/spinner.js b/app/javascript/alchemy_admin/components/spinner.js index ca359962a9..8b478bc70c 100644 --- a/app/javascript/alchemy_admin/components/spinner.js +++ b/app/javascript/alchemy_admin/components/spinner.js @@ -2,12 +2,16 @@ import { AlchemyHTMLElement, html } from "./alchemy_html_element" class Spinner extends AlchemyHTMLElement { static properties = { - size: { default: "medium" } + size: { default: "medium" }, + color: { default: "currentColor" } } render() { return html` -