File: divider.scss

package info (click to toggle)
cockpit 354-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 308,956 kB
  • sloc: javascript: 775,606; python: 40,351; ansic: 35,655; cpp: 11,117; sh: 3,511; makefile: 580; xml: 261
file content (104 lines) | stat: -rw-r--r-- 2,995 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
@use '../../sass-utilities' as *;

$pf-v6-c-divider--breakpoint-map: build-breakpoint-map("sm", "md", "lg", "xl", "2xl");
$pf-v6-c-divider--spacer-map: build-spacer-map("none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl");

// * Divider horizontal
@mixin pf-v6-c-divider--m-horizontal {
  flex-direction: row;
  width: 100%;
  height: var(--#{$divider}--Size);  // apply size to height in horizontal orientation
}

// * Divider vertical
@mixin pf-v6-c-divider--m-vertical {
  flex-direction: column;
  width: var(--#{$divider}--Size); // apply size to width in vertical orientation
  height: inherit;
}

@include pf-root($divider) {
  // * Divider
  --#{$divider}--Display: flex;
  --#{$divider}--Color: var(--pf-t--global--border--color--default);
  --#{$divider}--Size: var(--pf-t--global--border--width--divider--default);

  // * Divider before
  --#{$divider}--before--FlexBasis: 100%;
}

// - Divider
.#{$divider} {
  @include pf-v6-c-divider--m-horizontal; // default, set to orientation to horizontal
  @include pf-v6-hidden-visible(var(--#{$divider}--Display));

  flex-shrink: 0;
  align-items: stretch;
  align-self: stretch;
  justify-content: center;
  border: 0; // removes the default border styling on an hr

  // - Divider before
  &::before {
    flex-basis: var(--#{$divider}--before--FlexBasis);
    content: "";
    background-color: var(--#{$divider}--Color);
    border-block-start: var(--#{$divider}--Size) solid transparent;
    border-inline-start: var(--#{$divider}--Size) solid transparent;
  }

  // - Divider horizontal
  &.pf-m-horizontal {
    @include pf-v6-c-divider--m-horizontal;
  }

  // - Divider vertical
  &.pf-m-vertical {
    @include pf-v6-c-divider--m-vertical;
  }

  // - Divider spacer insets
  @each $spacer, $spacer-value in $pf-v6-c-divider--spacer-map {
    @if $spacer == none {
      $spacer-value: 0%;
    }

    &.pf-m-inset-#{$spacer} {
      --#{$divider}--before--FlexBasis: calc(100% - #{$spacer-value} * 2);
    }
  }
}

// TODO: move this loop to separate file for resize observer implementation
// TODO: make responsive values opt in/out
// stylelint-disable
.#{$divider} {
  @each $breakpoint, $breakpoint-value in $pf-v6-c-divider--breakpoint-map {
    $breakpoint-name: '-on-' + #{$breakpoint};

    @include pf-v6-apply-breakpoint($breakpoint) {
      &.pf-m-horizontal#{$breakpoint-name} {
        @include pf-v6-c-divider--m-horizontal;
      }
    }

    @include pf-v6-apply-breakpoint($breakpoint) {
      &.pf-m-vertical#{$breakpoint-name} {
        @include pf-v6-c-divider--m-vertical;
      }
    }

    @include pf-v6-apply-breakpoint($breakpoint) {
      @each $spacer, $spacer-value in $pf-v6-c-divider--spacer-map {
        &.pf-m-inset-#{$spacer}#{$breakpoint-name} {
          @if $spacer == none {
            --#{$divider}--before--FlexBasis: 100%;
          } @else {
            --#{$divider}--before--FlexBasis: calc(100% - #{$spacer-value} * 2);
          }
        }
      }
    }
  }
}
// stylelint-enable