summaryrefslogtreecommitdiffstats
path: root/pkg/lib/cockpit-components-listing-panel.scss
blob: c258ae697514dc08ba77c9e1c572791b669b0faf (plain)
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
.ct-listing-panel {
  display: flex;
  flex-wrap: wrap;

  &-actions {
    order: 2;
    flex-grow: 1;
    padding-block: var(--pf-v5-global--spacer--sm);
    padding-inline: var(--pf-v5-global--spacer--md) var(--pf-v5-global--spacer--lg);
  }

  &-caption {
    margin-inline-start: auto;
  }

  &-tabs {
    flex-grow: 1;
    order: 1;
  }

  .pf-v5-c-tab-content {
    order: 3;
    flex-basis: 100%;
  }

  &-body {
    // Don't let PF4 automatically add a border in tables inside the body
    --pf-v5-c-table__expandable-row--after--BorderLeftWidth: 0;
    --pf-v5-c-table--border-width--base: 0;

    // Add some sizing to the body
    padding-block: var(--pf-v5-global--spacer--md);
    padding-inline: var(--pf-v5-global--spacer--lg);
    inline-size: 100%;

    // Containing hack part 1
    float: inline-start;

    &::after {
      // Containing hack part 2: Clearfix CSS hack,
      // to allow children content to float fine without setting overflow
      content: "";
      clear: both;
      display: table;
    }
  }
}

.ct-table {
  > tbody > .pf-v5-c-table__expandable-row {
    // Don't scroll table's expanded contents vertically.
    // Instead, rely on page scrolling.
    // Important for mobile; also useful for desktop.
    overflow-block: visible !important;
    max-block-size: unset !important;
  }
}

// PF4 upstream issue to adopt expand animation:
// https://github.com/patternfly/patternfly-design/issues/899

@media not all and (prefers-reduced-motion: reduce) {
  // Add expansion animations when prefers-reduced isn't enabled
  .ct-table .pf-v5-c-table__expandable-row-content {
    // Animation ends at or before 2/3 in most cases; so we extend by 1.5 to compensate
    animation: ctListingPanelShow calc(var(--pf-v5-global--TransitionDuration) * 1.5) var(--pf-v5-global--TimingFunction);
  }
}

@keyframes ctListingPanelShow {
  0% {
    // The animation needs to flow downward to feel natural
    transform-origin: top;
    // Overflow will revert when done (but should be hidden during animation)
    overflow: hidden;
    max-block-size: 0;
    // Padding should 'tween between 0 and the actual padding (unstated)
    padding-block: 0;
  }

  67% {
    // Max height is tricky in animations, as auto doesn't work
    // 100vh makes sense, but would cause different speeds on different devices
    // Screens are almost all =< 12000px; data is almost always smaller
    // we'll relax it to to 100vh at 100%, just in case.
    max-block-size: 1200px;
  }

  100% {
    // Allow content to extend to the height of the screen (just in case)
    max-block-size: 100vh;
  }
}