Skip to content

Commit

Permalink
feat: add data-ui5-compact-size attribute to root when compact is set (
Browse files Browse the repository at this point in the history
…#382)

- in order to have easier styling of the sizes of the components all the css
should be applied to the root of the element (such as width, height, etc).
- when having a compact size setting applied, all components should change their sizes, in
order to track this change in the css we add a private data attribute to the root of each element
  • Loading branch information
MapTo0 authored May 13, 2019
1 parent 8220d16 commit cbf00a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/base/src/UI5Element.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getWCNoConflict } from "./Configuration.js";
import { getWCNoConflict, getCompactSize } from "./Configuration.js";
import DOMObserver from "./compatibility/DOMObserver.js";
import ShadowDOM from "./compatibility/ShadowDOM.js";
import UI5ElementMetadata from "./UI5ElementMetadata.js";
Expand Down Expand Up @@ -78,6 +78,12 @@ class UI5Element extends HTMLElement {
}

async _initializeShadowRoot() {
const isCompact = getCompactSize();

if (isCompact) {
this.setAttribute("data-ui5-compact-size", "");
}

if (this.constructor.getMetadata().getNoShadowDOM()) {
return Promise.resolve();
}
Expand Down

0 comments on commit cbf00a8

Please sign in to comment.