From 8b6da43086e012f27eed796514577df658f60b14 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 19 Jul 2024 15:41:39 +0300 Subject: [PATCH] chore: add margin auto to icon inside web component --- iconify-icon/icon/demo/usage.html | 74 +++++++++++++++++++++++++++ iconify-icon/icon/src/render/style.ts | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/iconify-icon/icon/demo/usage.html b/iconify-icon/icon/demo/usage.html index 9a112a7..b3dfc91 100644 --- a/iconify-icon/icon/demo/usage.html +++ b/iconify-icon/icon/demo/usage.html @@ -151,6 +151,11 @@ icon: { body: '', }, + animated: { + body: '', + width: 14, + height: 24, + }, }, }); })(); @@ -333,6 +338,75 @@ mode="style" >

+

+ Non-square animated icon (with border): + + +

+

+ Making icon square with attributes (with border): + + + + +

+

+ Making icon square with style (with border): + + + + +

Hidden icons, appear on scroll

diff --git a/iconify-icon/icon/src/render/style.ts b/iconify-icon/icon/src/render/style.ts index e090583..974f395 100644 --- a/iconify-icon/icon/src/render/style.ts +++ b/iconify-icon/icon/src/render/style.ts @@ -38,6 +38,6 @@ export function updateStyle(parent: Element | ShadowRoot, inline: boolean) { styleNode.textContent = ':host{display:inline-block;vertical-align:' + (inline ? '-0.125em' : '0') + - '}span,svg{display:block}' + + '}span,svg{display:block;margin:auto}' + customStyle; }