From b54bee9bc108667b5fdcb0334661033870e4c14a Mon Sep 17 00:00:00 2001 From: Giorgi Cheishvili Date: Fri, 27 Oct 2023 20:46:56 +0400 Subject: [PATCH] chore: moved btp button examples into the BTP subfolder (#4925) * fix: moved btp button elements into the btp sub-section and added btp modifier[ci visual] BREAKING CHANGE: `fd-button--btp` is required to have a badge on btp button * fix: excessive CSS overrides [ci visual] * fix: fixed incorrect usage of the badged buttons in tool-header[ci visual] * fix: fall back to the main version of the button[ci visual] --- packages/styles/src/button.scss | 3 ++ packages/styles/stories/BTP/button/button.md | 2 + .../stories/BTP/button/button.stories.js | 34 +++++++++++++++++ .../button/nested.example.html | 0 .../button/tool-header.example.html | 0 .../BTP/tool-header/desktop.example.html | 28 +++++++------- .../BTP/tool-header/mobile.example.html | 30 +++++++-------- .../BTP/tool-header/tablet.example.html | 38 +++++++++---------- .../Components/button/button.stories.js | 21 ---------- 9 files changed, 87 insertions(+), 69 deletions(-) create mode 100644 packages/styles/stories/BTP/button/button.md create mode 100644 packages/styles/stories/BTP/button/button.stories.js rename packages/styles/stories/{Components => BTP}/button/nested.example.html (100%) rename packages/styles/stories/{Components => BTP}/button/tool-header.example.html (100%) diff --git a/packages/styles/src/button.scss b/packages/styles/src/button.scss index 7216eb02d6..1a4339e5db 100644 --- a/packages/styles/src/button.scss +++ b/packages/styles/src/button.scss @@ -257,6 +257,9 @@ $fd-button-badge-spacing: 0.25rem; border-radius: 100%; background: var(--sapContent_BadgeBackground); border: 0.0625rem solid var(--fdButton_ToolHeader_Badge_Border_Color); + color: var(--sapContent_BadgeBackground); + padding: 0; + overflow: hidden; } } diff --git a/packages/styles/stories/BTP/button/button.md b/packages/styles/stories/BTP/button/button.md new file mode 100644 index 0000000000..735878a312 --- /dev/null +++ b/packages/styles/stories/BTP/button/button.md @@ -0,0 +1,2 @@ +BTP button is an over-style over the Button(Horizon) and is intended to be used within the controls and patterns for the BTP area. +BTP over-styling adds wo additional button types: `tool header` and `nested` diff --git a/packages/styles/stories/BTP/button/button.stories.js b/packages/styles/stories/BTP/button/button.stories.js new file mode 100644 index 0000000000..8c2036be7f --- /dev/null +++ b/packages/styles/stories/BTP/button/button.stories.js @@ -0,0 +1,34 @@ +import toolHeaderButtonExampleHtml from './tool-header.example.html?raw'; +import nestedButtonExampleHtml from './nested.example.html?raw'; +import description from './button.md?raw'; + +import '../../../src/icon.scss'; +import '../../../src/button.scss'; + +export default { + title: 'BTP/Button', + parameters: { + description, + tags: ['a11y', 'btp', 'horizon-only'] + } +}; + +export const ToolHeaderButton = () => toolHeaderButtonExampleHtml; +ToolHeaderButton.parameters = { + docs: { + description: { + story: `The Tool Header button is based on the Button (Horizon) Transparent/LiteButton, but has over-styling of the shape, size and interaction states. It is intended to be used within the controls and patterns for the BTP area. Use the .fd-button--tool-header modifier class for this type of button. +` + } + } +}; + +export const NestedButton = () => nestedButtonExampleHtml; +NestedButton.parameters = { + docs: { + description: { + story: `The Nested button is also intended to be used within the controls and patterns for the BTP area. Use the .fd-button--nested modifier class with the .fd-button base class for this type of button. +` + } + } +}; diff --git a/packages/styles/stories/Components/button/nested.example.html b/packages/styles/stories/BTP/button/nested.example.html similarity index 100% rename from packages/styles/stories/Components/button/nested.example.html rename to packages/styles/stories/BTP/button/nested.example.html diff --git a/packages/styles/stories/Components/button/tool-header.example.html b/packages/styles/stories/BTP/button/tool-header.example.html similarity index 100% rename from packages/styles/stories/Components/button/tool-header.example.html rename to packages/styles/stories/BTP/button/tool-header.example.html diff --git a/packages/styles/stories/BTP/tool-header/desktop.example.html b/packages/styles/stories/BTP/tool-header/desktop.example.html index 7756f773a6..466d230183 100644 --- a/packages/styles/stories/BTP/tool-header/desktop.example.html +++ b/packages/styles/stories/BTP/tool-header/desktop.example.html @@ -23,11 +23,11 @@

Without Menu Button (default)

tabindex="0" /> - +
Product Name
- +
Second Title
@@ -77,13 +77,13 @@

Without Menu Button (default)

- +
- +
- +
- +
Without Menu Button (default) title="John Doe" aria-label="John Doe" > -
+ @@ -153,11 +153,11 @@

With Menu Button

tabindex="0" /> - +
Product Name
- +
Second Title
@@ -207,13 +207,13 @@

With Menu Button

- +
- +
- +
- +
With Menu Button title="John Doe" aria-label="John Doe" > -
+ diff --git a/packages/styles/stories/BTP/tool-header/mobile.example.html b/packages/styles/stories/BTP/tool-header/mobile.example.html index f703471003..c9d9e17f61 100644 --- a/packages/styles/stories/BTP/tool-header/mobile.example.html +++ b/packages/styles/stories/BTP/tool-header/mobile.example.html @@ -14,7 +14,7 @@

Phone

- +
Phone tabindex="0" />
- +
Product Name
- +
Second Title
@@ -85,13 +85,13 @@

Phone

- +
- +
- +
- +
Phone (Expanded Search) tabindex="0" />
- +
Product Name
- +
Second Title
@@ -215,13 +215,13 @@

Phone (Expanded Search)

- +
- +
- +
- - + +
Phone (Expanded Search) aria-label="John Doe" >
- + diff --git a/packages/styles/stories/BTP/tool-header/tablet.example.html b/packages/styles/stories/BTP/tool-header/tablet.example.html index a25ed479d9..d54371c68f 100644 --- a/packages/styles/stories/BTP/tool-header/tablet.example.html +++ b/packages/styles/stories/BTP/tool-header/tablet.example.html @@ -31,11 +31,11 @@

Tablet - Landscape

tabindex="0" /> - +
Product Name
- +
Second Title
@@ -85,13 +85,13 @@

Tablet - Landscape

- +
- +
- +
- +
Tablet - Portrait tabindex="0" />
- +
Product Name
- +
Second Title
@@ -215,13 +215,13 @@

Tablet - Portrait

- +
- +
- +
- +
Tablet - Portrait aria-label="John Doe" >
- + @@ -292,11 +292,11 @@

Tablet - Portrait (Expanded Search)

tabindex="0" /> - +
Product Name
- +
Second Title
@@ -346,13 +346,13 @@

Tablet - Portrait (Expanded Search)

- +
- +
- +
- +
toolHeaderButtonExampleHtml; -ToolHeaderButton.parameters = { - docs: { - description: { - story: `The Tool Header button is based on the Button (Horizon) Transparent/LiteButton, but has over-styling of the shape, size and interaction states. It is intended to be used within the controls and patterns for the BTP area. Use the .fd-button--tool-header modifier class for this type of button. -` - } - } -}; - -export const NestedButton = () => nestedButtonExampleHtml; -NestedButton.parameters = { - docs: { - description: { - story: `The Nested button is also intended to be used within the controls and patterns for the BTP area. Use the .fd-button--nested modifier class with the .fd-button base class for this type of button. -` - } - } -};