Skip to content

Commit

Permalink
feat(styles): add BTP Tool Layout component [ci visual] (#4866)
Browse files Browse the repository at this point in the history
  • Loading branch information
InnaAtanasova authored Oct 3, 2023
1 parent a83ecfa commit 848a2d9
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/styles/src/fundamental-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
@import "variant-management";
@import "navigation";
@import "navigation-menu";
@import "tool-layout";

// BTP Specific components/overwrites
@import "./btp/avatar.scss";
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_fiori_3.scss
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,8 @@

/** Tokenizer */
--fdTokenizer_Indicator_Color: var(--sapTextColor);

/** Tool Layout */
--fdToolLayout_Background: #eaecee;
--sapToolLayoutContent_Shadow1: 0 0 0.125rem 0 rgba(34, 53, 72, 0.16), 0 0.5rem 1rem 0 rgba(34, 53, 72, 0.16);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_fiori_3_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader4Size);
--fdObject_List_Title_Font_Weight: var(--sapFontHeaderWeight);
--fdObject_List_Number_Font_Size: 1.375rem;

/** Tool Layout */
--fdToolLayout_Background: #0a0d10;
--sapToolLayoutContent_Shadow1: 0 0 0.125rem 0 rgba(0, 0, 0, 0.16), 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.32);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_fiori_3_hcb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader4Size);
--fdObject_List_Title_Font_Weight: var(--sapFontHeaderWeight);
--fdObject_List_Number_Font_Size: 1.375rem;

/** Tool Layout */
--fdToolLayout_Background: var(--sapBackgroundColor);
--sapToolLayoutContent_Shadow1: 0 0 0 0.0625rem #fff, 0 0.5rem 1rem 0 fade(#fff, 16);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_fiori_3_hcw.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader4Size);
--fdObject_List_Title_Font_Weight: var(--sapFontHeaderWeight);
--fdObject_List_Number_Font_Size: 1.375rem;

/** Tool Layout */
--fdToolLayout_Background: var(--sapBackgroundColor);
--sapToolLayoutContent_Shadow1: 0 0 0 0.0625rem #000, 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.16);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_fiori_3_light_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader4Size);
--fdObject_List_Title_Font_Weight: var(--sapFontHeaderWeight);
--fdObject_List_Number_Font_Size: 1.375rem;

/** Tool Layout */
--fdToolLayout_Background: #eaecee;
--sapToolLayoutContent_Shadow1: 0 0 0.125rem 0 rgba(34, 53, 72, 0.16), 0 0.5rem 1rem 0 rgba(34, 53, 72, 0.16);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_horizon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,8 @@

/** Nested List */
--fdNested_List_Border_Corner_Radius: var(--sapPopover_BorderCornerRadius);

/** Tool Layout */
--fdToolLayout_Background: #eaecee;
--sapToolLayoutContent_Shadow1: 0 0 0.125rem 0 rgba(34, 53, 72, 0.16), 0 0.5rem 1rem 0 rgba(34, 53, 72, 0.16);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_horizon_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader5Size);
--fdObject_List_Title_Font_Weight: bolder;
--fdObject_List_Number_Font_Size: 1.25rem;

/** Tool Layout */
--fdToolLayout_Background: #0a0d10;
--sapToolLayoutContent_Shadow1: 0 0 0.125rem 0 rgba(0, 0, 0, 0.16), 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.32);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_horizon_hcb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader5Size);
--fdObject_List_Title_Font_Weight: bolder;
--fdObject_List_Number_Font_Size: 1.25rem;

/** Tool Layout */
--fdToolLayout_Background: var(--sapBackgroundColor);
--sapToolLayoutContent_Shadow1: 0 0 0 0.0625rem #fff, 0 0.5rem 1rem 0 fade(#fff, 16);
}
4 changes: 4 additions & 0 deletions packages/styles/src/theming/sap_horizon_hcw.scss
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,8 @@
--fdObject_List_Title_Font_Size: var(--sapFontHeader5Size);
--fdObject_List_Title_Font_Weight: bolder;
--fdObject_List_Number_Font_Size: 1.25rem;

/** Tool Layout */
--fdToolLayout_Background: var(--sapBackgroundColor);
--sapToolLayoutContent_Shadow1: 0 0 0 0.0625rem #000, 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.16);
}
89 changes: 89 additions & 0 deletions packages/styles/src/tool-layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
@import './new-settings';
@import './mixins';

$block: #{$fd-namespace}-tool-layout;

.#{$block} {
--fdToolLayout_Padding: 0.5rem 0.5rem 0 0.5rem;
--fdToolLayout_Navigation_Container_Margin_Top: 0.5rem;
--fdToolLayout_Navigation_Container_Margin_Right: 0.5rem;
--fdToolLayout_Content_Container_Margin_Top: 0.5rem;
--fdToolLayout_Content_Container_Border_Radius: 0.5rem 0.5rem 0 0;
--fdToolLayout_Content_Container_Background: var(--sapBackgroundColor);
--fdToolLayout_Content_Container_BoxShadow: var(--sapToolLayoutContent_Shadow1);

@include fd-reset();

width: 100%;
height: 100%;
padding: var(--fdToolLayout_Padding);
background: var(--fdToolLayout_Background);

&__container {
@include fd-reset();

@include fd-flex() {
flex-wrap: wrap;
}
}

&__header-container {
@include fd-reset();
}

&__navigation-container {
@include fd-reset();
@include fd-set-margin-right(var(--fdToolLayout_Navigation_Container_Margin_Right));

margin-top: var(--fdToolLayout_Navigation_Container_Margin_Top);

&--popup {
--fdToolLayout_Navigation_Container_Margin_Top: 0;
--fdToolLayout_Navigation_Container_Margin_Right: 0;
}

&--horizontal {
--fdToolLayout_Navigation_Container_Margin_Top: 0;
--fdToolLayout_Navigation_Container_Margin_Right: 0;

flex: 1;
min-width: 100%;

& + .#{$block}__content-container {
min-width: 100%;
}
}
}

&__content-container {
@include fd-reset();

flex: 1;
height: 100%;
width: 100%;
margin-top: var(--fdToolLayout_Content_Container_Margin_Top);
box-shadow: var(--fdToolLayout_Content_Container_BoxShadow);
background: var(--fdToolLayout_Content_Container_Background);
border-radius: var(--fdToolLayout_Content_Container_Border_Radius);

&--transparent {
--fdToolLayout_Content_Container_Background: transparent;
--fdToolLayout_Content_Container_BoxShadow: none;
}

&--list {
--fdToolLayout_Content_Container_Background: var(--sapGroup_ContentBackground);
}
}

&--tablet {
--fdToolLayout_Padding: 0.5rem;
--fdToolLayout_Content_Container_Border_Radius: 0.5rem;
}

&--phone {
--fdToolLayout_Padding: 0.25rem;
--fdToolLayout_Content_Container_Margin_Top: 0.25rem;
--fdToolLayout_Content_Container_Border_Radius: 0.25rem;
}
}
18 changes: 18 additions & 0 deletions packages/styles/stories/BTP/tool-layout/desktop.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="fd-tool-layout">
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__header-container"
style="width: 100%; height: 3rem; background: #00677F;">
</div>
</div>
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__navigation-container"
style="width: 15rem; height: 20rem; background: #00677F;">
</div>
<div
class="fd-tool-layout__content-container"
style="width: 100%; height: 20rem; background: #00677F;"></div>
</div>
</div>

13 changes: 13 additions & 0 deletions packages/styles/stories/BTP/tool-layout/mobile.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="fd-tool-layout fd-tool-layout--phone" style="width: 20rem;">
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__header-container"
style="width: 100%; height: 3rem; background: #00677F;">
</div>
</div>
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__content-container"
style="width: 100%; height: 20rem; background: #00677F;"></div>
</div>
</div>
37 changes: 37 additions & 0 deletions packages/styles/stories/BTP/tool-layout/tablet.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<h4>With Vertical Navigation</h4>
<div class="fd-tool-layout fd-tool-layout--tablet">
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__header-container"
style="width: 100%; height: 3rem; background: #00677F;">
</div>
</div>
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__navigation-container"
style="width: 5rem; height: 20rem; background: #00677F;">
</div>
<div
class="fd-tool-layout__content-container"
style="width: 100%; height: 20rem; background: #00677F;"></div>
</div>
</div>
<br><br>
<h4>With Horizontal Navigation</h4>
<div class="fd-tool-layout fd-tool-layout--tablet">
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__header-container"
style="width: 100%; height: 3rem; background: #00677F;">
</div>
</div>
<div class="fd-tool-layout__container">
<div
class="fd-tool-layout__navigation-container fd-tool-layout__navigation-container--horizontal"
style="width: 100%; height: 3rem; background: #00677F;">
</div>
<div
class="fd-tool-layout__content-container"
style="width: 100%; height: 20rem; background: #00677F;"></div>
</div>
</div>
58 changes: 58 additions & 0 deletions packages/styles/stories/BTP/tool-layout/tool-layout.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import desktopExampleHtml from './desktop.example.html?raw';
import tabletExampleHtml from './tablet.example.html?raw';
import mobileExampleHtml from './mobile.example.html?raw';

import '../../../src/tool-layout.scss';

export default {
title: 'BTP/Tool Layout',
parameters: {
description: `The Tool Layout is an essential part of most BTP tools. The layout combines the Tool Header and the Navigation components in one consistent structure. In addition, it provides necessary interaction between the two components out of the box.
## Anatomy
- <b>Tool Header </b>- always present and is a top-aligned UI element that contains global actions and controls navigation
- <b>Navigation </b>- side navigation in all of its variants (expanded, snapped)
- <b>Content </b>- an empty container area that can hold any content.
## Structure
- <code>.fd-tool-layout</code>
- <code>.fd-tool-layout--tablet</code>&nbsp; - modifier class for tablets
- <code>.fd-tool-layout--phone</code>&nbsp; - modifier class for phones
- <code>.fd-tool-layout__container</code>
- <code>.fd-tool-layout__header-container</code>&nbsp; - wraping element around the Tool Header
- <code>.fd-tool-layout__header-container--popup</code>&nbsp; - modifier class for when the Tool Header is a Popup
- <code>.fd-tool-layout__header-container--horizontal</code>&nbsp; - modifier class for when the Tool Header is horizontal
- <code>.fd-tool-layout__navigation-container</code>&nbsp; - wraping element around the Navigation (all its variants)
- <code>.fd-tool-layout__content-container</code>&nbsp; - wraping element around the page content. By default, the background of the content area is <code>var(--sapBackgroundColor)</code>
- <code>.fd-tool-layout__content-container--transparent</code>&nbsp; - modifier class to apply transparent background to the content area.
- <code>.fd-tool-layout__content-container--list</code>&nbsp; - modifier class to apply list <code>var(--sapGroup_ContentBackground)</code> background to the content area.
`,
tags: ['btp']
}
};
export const Desktop = () => desktopExampleHtml;
Desktop.parameters = {
docs: {
description: {
story: ``
}
}
};


export const Tablet = () => tabletExampleHtml;
Tablet.parameters = {
docs: {
description: {
story: `Apply the <code>fd-tool-layout--tablet</code> modifier class for tablet devices.`
}
}
};

export const Mobile = () => mobileExampleHtml;
Mobile.parameters = {
docs: {
description: {
story: `Apply the <code>fd-tool-layout--phone</code> modifier class for mobile devices.`
}
}
};

0 comments on commit 848a2d9

Please sign in to comment.