@1024pix/pix-ui 55.10.0 → 55.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,12 @@
1
1
  <div class={{this.classNames}} ...attributes>
2
- {{yield to="navigation"}}
3
- {{yield to="main"}}
4
- {{yield to="footer"}}
2
+ <section
3
+ class="pix-app-layout__banner"
4
+ id="pix-layout-banner-container"
5
+ {{on-window-resize this.handleMarginContainerNavigation}}
6
+ >
7
+ {{yield to="banner"}}
8
+ </section>
9
+ <div class="pix-app-layout__navigation">{{yield to="navigation"}}</div>
10
+ <div class="pix-app-layout__main">{{yield to="main"}}</div>
11
+ <div class="pix-app-layout__footer">{{yield to="footer"}}</div>
5
12
  </div>
@@ -1,8 +1,33 @@
1
1
  import { VARIANTS } from '@1024pix/pix-ui/helpers/variants';
2
2
  import { warn } from '@ember/debug';
3
+ import { service } from '@ember/service';
3
4
  import Component from '@glimmer/component';
4
-
5
5
  export default class PixAppLayout extends Component {
6
+ @service elementHelper;
7
+
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ this.elementHelper.waitForElement('pix-layout-banner-container').then((elementList) => {
12
+ this.#computeMarginTopElement(elementList);
13
+ });
14
+ }
15
+
16
+ #computeMarginTopElement(bannerContainer) {
17
+ const baseFontRemRatio = Number(
18
+ getComputedStyle(document.querySelector('html')).fontSize.match(/\d+(\.\d+)?/)[0],
19
+ );
20
+ const bannerHeight = bannerContainer.getBoundingClientRect().height;
21
+ const top = bannerHeight / baseFontRemRatio;
22
+
23
+ const layoutElement = document.querySelector('.pix-app-layout');
24
+ layoutElement.style.setProperty('--pix-app-layout-top', `${top}rem`);
25
+ }
26
+
27
+ handleMarginContainerNavigation = (element) => {
28
+ this.#computeMarginTopElement(element);
29
+ };
30
+
6
31
  get variant() {
7
32
  const value = this.args.variant ?? 'primary';
8
33
  warn(
@@ -8,6 +8,7 @@ export default class PixMNavigation extends Component {
8
8
  super(...args);
9
9
  this._navigationId = 'navigation-' + guidFor(this);
10
10
  }
11
+
11
12
  @tracked
12
13
  navigationMenuOpened = false;
13
14
 
@@ -3,30 +3,73 @@
3
3
  .pix-app-layout {
4
4
  display: grid;
5
5
  grid-template-areas:
6
- "navigation main main"
7
- "navigation footer footer";
8
- grid-template-rows: 1fr min-content;
6
+ "banner banner"
7
+ "navigation main"
8
+ "navigation footer";
9
+ grid-template-rows: min-content 1fr;
9
10
  grid-template-columns: min-content 1fr;
10
- gap: var(--pix-spacing-6x);
11
11
  min-height: 100dvh;
12
- padding: var(--pix-spacing-6x);
13
12
 
14
- & > *:first-child {
13
+ @include breakpoints.device-is('mobile') {
14
+ display: flex;
15
+ flex-direction: column;
16
+ }
17
+
18
+ &__banner {
19
+ position: sticky;
20
+ top: 0;
21
+ z-index: 3;
22
+ grid-area: banner;
23
+ }
24
+
25
+ &__navigation {
26
+ position: sticky;
27
+ bottom: var(--pix-spacing-6x);
28
+ z-index: 1;
15
29
  grid-area: navigation;
30
+ min-height: calc(100vh - var(--pix-spacing-6x));
31
+ margin: auto 0 0;
32
+ padding: calc(var(--pix-app-layout-top) + var(--pix-spacing-6x)) 0 0 var(--pix-spacing-6x);
33
+
34
+ @include breakpoints.device-is('mobile') {
35
+ position: unset;
36
+ z-index: auto;
37
+ min-height: auto;
38
+ padding: var(--pix-spacing-2x) var(--pix-spacing-2x) 0 var(--pix-spacing-2x);
39
+ }
40
+ }
41
+
42
+ &__main, &__footer {
43
+ width: 100%;
44
+ max-width: 93rem;
45
+ margin: 0 auto;
46
+ padding: 0 var(--pix-spacing-6x);
47
+
48
+ @include breakpoints.device-is('mobile') {
49
+ padding: 0 var(--pix-spacing-2x);
50
+ }
16
51
  }
17
52
 
18
- & > *:nth-child(2) {
53
+ &__main {
19
54
  grid-area: main;
55
+ padding-top: var(--pix-spacing-6x);
56
+
57
+ @include breakpoints.device-is('mobile') {
58
+ padding-top: var(--pix-spacing-2x);
59
+ }
20
60
  }
21
61
 
22
- & > *:nth-child(3) {
62
+ &__footer {
23
63
  grid-area: footer;
24
- }
64
+ padding-bottom: var(--pix-spacing-6x);
25
65
 
26
- @include breakpoints.device-is('mobile') {
27
- display: block
66
+ @include breakpoints.device-is('mobile') {
67
+ padding-bottom: var(--pix-spacing-2x);
68
+ }
28
69
  }
29
70
 
71
+
72
+
30
73
  &--admin {
31
74
  background-color: var(--pix-primary-10);
32
75
 
@@ -6,34 +6,25 @@
6
6
  --bg-color-active: rgb(var(--pix-neutral-100-inline), 30%);
7
7
  --pix-navigation-width: 15rem;
8
8
 
9
- position: sticky;
10
- bottom: var(--pix-spacing-6x);
11
- z-index: 1;
12
9
  display: flex;
13
10
  flex-direction: column;
14
11
  gap:var(--pix-spacing-6x);
15
12
  align-items: stretch;
16
13
  justify-content: space-between;
17
14
  width: var(--pix-navigation-width);
18
- height: auto;
19
- min-height: calc(100vh - var(--pix-spacing-6x) * 2);
20
-
21
- // using a margin top / bottom allow user to discover rapidly
22
- // the part of sidebar that is above the fold
23
- margin-top: auto;
15
+ min-height: calc(100vh - var(--pix-app-layout-top) - 2 * var(--pix-spacing-6x));
24
16
  padding: var(--pix-spacing-6x) var(--pix-spacing-4x);
25
17
  color: var(--pix-navigation-text-color);
26
18
  background-color: var(--pix-navigation-color);
27
19
  border-radius: var(--pix-spacing-6x);
28
20
 
29
-
30
21
  @include breakpoints.device-is('mobile') {
31
- position: static;
32
22
  flex-direction: column;
33
23
  align-items: stretch;
34
24
  width: 100%;
35
25
  max-width: none;
36
26
  min-height: auto;
27
+ margin-top: 0;
37
28
  padding: 0;
38
29
 
39
30
  &--opened {
@@ -49,7 +40,6 @@
49
40
 
50
41
  img {
51
42
  display: block;
52
- width: 132px;
53
43
  height: 48px;
54
44
  margin:0 auto;
55
45
  }
@@ -0,0 +1,12 @@
1
+ import { modifier } from 'ember-modifier';
2
+
3
+ export default modifier(function onWindowResize(element, [action]) {
4
+ const actionWithElement = () => action(element);
5
+
6
+ window.addEventListener('resize', actionWithElement);
7
+ actionWithElement();
8
+
9
+ return () => {
10
+ window.removeEventListener('resize', actionWithElement);
11
+ };
12
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "55.10.0",
3
+ "version": "55.11.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"