Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(styles): add square Nested Button to BTP [ci visual] #4953

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading