Skip to content

Commit

Permalink
feat(styles): add square Nested Button to BTP (#4953)
Browse files Browse the repository at this point in the history
  • Loading branch information
InnaAtanasova authored Nov 2, 2023
1 parent ca467d5 commit 40b939c
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 3 deletions.
29 changes: 26 additions & 3 deletions packages/styles/src/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,15 @@ $fd-button-badge-spacing: 0.25rem;
The code is done this way (not overwriting the CSS variables of Button)
in case we need to move to a separate component or library in future
*/
&--nested {
--fdButton_Nested_Size: 1.25rem;

@mixin nestedButtonBase {
--fdButton_Nested_Size: 1.5rem;
--fdButton_Nested_Icon_Size: 0.75rem;
--fdButton_Nested_Click_Area: 2rem;
--fdButton_Nested_Color: var(--sapContent_IconColor);
--fdButton_Nested_Background: var(--sapButton_Lite_Background);
--fdButton_Nested_Border_Color: var(--fdButton_ToolHeader_Border_Color_Normal);
--fdButton_Nested_Border_Radius: 0.75rem;
--fdButton_Nested_Border_Radius: 1rem;

@include fd-set-square(var(--fdButton_Nested_Size));

Expand Down Expand Up @@ -343,7 +344,29 @@ $fd-button-badge-spacing: 0.25rem;
}

@include fd-compact-and-condensed() {
--fdButton_Nested_Size: 1.375rem;
--fdButton_Nested_Click_Area: 1.625rem;
}
}

&--nested,
&--nested-square {
@include nestedButtonBase ();
}

&--nested-square {
--fdButton_Nested_Border_Radius: 0.1875rem;

@include fd-active() {
--fdButton_Nested_Border_Radius: 0.1875rem;

@include fd-focus() {
--fdButton_Nested_Border_Radius: 0.1875rem;
}
}

@include fd-focus() {
--fdButton_Nested_Border_Radius: 0.1875rem;
}
}
}
11 changes: 11 additions & 0 deletions packages/styles/stories/BTP/button/button.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import toolHeaderButtonExampleHtml from './tool-header.example.html?raw';
import nestedButtonExampleHtml from './nested.example.html?raw';
import nestedSquareButtonExampleHtml from './nested-square.example.html?raw';
import description from './button.md?raw';

import '../../../src/icon.scss';
Expand Down Expand Up @@ -32,3 +33,13 @@ NestedButton.parameters = {
}
}
};

export const NestedSquareButton = () => nestedSquareButtonExampleHtml;
NestedSquareButton.parameters = {
docs: {
description: {
story: `Use the <code>.fd-button--nested-square</code> modifier class with the <code>.fd-button</code> base class for aquare nested button.
`
}
}
};
36 changes: 36 additions & 0 deletions packages/styles/stories/BTP/button/nested-square.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<h4>normal</h4>
<div class="fddocs-container fddocs-button-container">
<button class="fd-button fd-button--nested-square" aria-label="Close">
<i class="sap-icon--decline" role="presentation"></i>
</button>
</div>

<h4>hover</h4>
<div class="fddocs-container fddocs-button-container">
<button class="fd-button fd-button--nested-square is-hover" aria-label="Close">
<i class="sap-icon--decline" role="presentation"></i>
</button>
</div>

<h4>active</h4>
<div class="fddocs-container fddocs-button-container">
<button class="fd-button fd-button--nested-square is-active" aria-label="Close">
<i class="sap-icon--decline" role="presentation"></i>
</button>
</div>

<h4>focus</h4>
<div class="fddocs-container fddocs-button-container">
<button class="fd-button fd-button--nested-square is-focus" aria-label="Close">
<i class="sap-icon--decline" role="presentation"></i>
</button>
</div>

<h4>disabled</h4>
<div class="fddocs-container fddocs-button-container">
<button class="fd-button fd-button--nested-square is-disabled" aria-label="Close">
<i class="sap-icon--decline" role="presentation"></i>
</button>
</div>


40 changes: 40 additions & 0 deletions packages/styles/tests/__snapshots__/styles.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,46 @@ exports[`Check stories > BTP/Button > Story NestedButton > Should match snapshot
</div>


"
`;

exports[`Check stories > BTP/Button > Story NestedSquareButton > Should match snapshot 1`] = `
"<h4>normal</h4>
<div class=\\"fddocs-container fddocs-button-container\\">
<button class=\\"fd-button fd-button--nested-square\\" aria-label=\\"Close\\">
<i class=\\"sap-icon--decline\\" role=\\"presentation\\"></i>
</button>
</div>

<h4>hover</h4>
<div class=\\"fddocs-container fddocs-button-container\\">
<button class=\\"fd-button fd-button--nested-square is-hover\\" aria-label=\\"Close\\">
<i class=\\"sap-icon--decline\\" role=\\"presentation\\"></i>
</button>
</div>

<h4>active</h4>
<div class=\\"fddocs-container fddocs-button-container\\">
<button class=\\"fd-button fd-button--nested-square is-active\\" aria-label=\\"Close\\">
<i class=\\"sap-icon--decline\\" role=\\"presentation\\"></i>
</button>
</div>

<h4>focus</h4>
<div class=\\"fddocs-container fddocs-button-container\\">
<button class=\\"fd-button fd-button--nested-square is-focus\\" aria-label=\\"Close\\">
<i class=\\"sap-icon--decline\\" role=\\"presentation\\"></i>
</button>
</div>

<h4>disabled</h4>
<div class=\\"fddocs-container fddocs-button-container\\">
<button class=\\"fd-button fd-button--nested-square is-disabled\\" aria-label=\\"Close\\">
<i class=\\"sap-icon--decline\\" role=\\"presentation\\"></i>
</button>
</div>


"
`;

Expand Down

0 comments on commit 40b939c

Please sign in to comment.