From c6630a66608677aabf566f6feaade992dd9e3e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Curda?= Date: Wed, 8 Jan 2025 10:38:40 +0100 Subject: [PATCH] fixup! Feat(web): Introduce Drawer component #DS-1580 --- .../web/src/scss/components/Drawer/README.md | 52 +++++++------------ .../scss/components/Drawer/_DrawerPanel.scss | 15 +++--- .../web/src/scss/components/Drawer/index.html | 22 +++----- 3 files changed, 36 insertions(+), 53 deletions(-) diff --git a/packages/web/src/scss/components/Drawer/README.md b/packages/web/src/scss/components/Drawer/README.md index e6135119a4..0cf132f8e8 100644 --- a/packages/web/src/scss/components/Drawer/README.md +++ b/packages/web/src/scss/components/Drawer/README.md @@ -5,8 +5,8 @@ The Drawer component is a container that slides in from side of the screen. It c The Drawer is a composition of several subcomponents: - [Drawer](#drawer) - - [DrawerCloseButton](#drawer-close-button) - - [DrawerPanel](#drawer-panel) + - [DrawerCloseButton](#drawerclosebutton) + - [DrawerPanel](#drawerpanel) 👉 The animation effect of this component is dependent on the `prefers-reduced-motion` media query. @@ -15,7 +15,7 @@ The Drawer is a composition of several subcomponents: ```html - + ``` @@ -25,7 +25,7 @@ The `Drawer` component can be aligned to the left or right side of the screen us ```html - + ``` @@ -42,14 +42,8 @@ The `DrawerCloseButton` component is a button that closes the drawer when clicke aria-controls="my-drawer-dialog" aria-expanded="false" > - Close @@ -67,31 +61,25 @@ The `DrawerPanel` component is a container for the content that will be displaye ``` -## Full implementation +## Full Example ```html -
+
diff --git a/packages/web/src/scss/components/Drawer/_DrawerPanel.scss b/packages/web/src/scss/components/Drawer/_DrawerPanel.scss index b9a990fb16..80a50be74d 100644 --- a/packages/web/src/scss/components/Drawer/_DrawerPanel.scss +++ b/packages/web/src/scss/components/Drawer/_DrawerPanel.scss @@ -1,13 +1,14 @@ @use 'sass:map'; +@use '@tokens' as tokens; @use 'theme'; .DrawerPanel { - --drawer-translate-x: 0%; + --#{tokens.$css-variable-prefix}drawer-translate-x: 0%; display: flex; flex-direction: column; box-sizing: border-box; - width: theme.$drawer-panel-width; + width: var(--#{tokens.$css-variable-prefix}drawer-panel-width, #{theme.$drawer-panel-width}); height: theme.$drawer-panel-height; max-height: theme.$drawer-panel-max-height; color: theme.$drawer-panel-text-color; @@ -22,16 +23,16 @@ } } -.Drawer--left .DrawerPanel { - --drawer-translate-x: -100%; +.Drawer--left > .DrawerPanel { + ----#{tokens.$css-variable-prefix}drawer-translate-x: -100%; } -.Drawer--right .DrawerPanel { - --drawer-translate-x: 100%; +.Drawer--right > .DrawerPanel { + --#{tokens.$css-variable-prefix}drawer-translate-x: 100%; } .Drawer[open] .DrawerPanel { - --drawer-translate-x: 0%; + --#{tokens.$css-variable-prefix}drawer-translate-x: 0%; } .DrawerPanel__content { diff --git a/packages/web/src/scss/components/Drawer/index.html b/packages/web/src/scss/components/Drawer/index.html index 53c089e67a..67262d47e0 100644 --- a/packages/web/src/scss/components/Drawer/index.html +++ b/packages/web/src/scss/components/Drawer/index.html @@ -3,17 +3,15 @@