summaryrefslogtreecommitdiffstats
path: root/apps/web-shared/src/styles/components/interactive-table.scss
blob: f239c62782bd4bb0e596c4bac3be97a268c53f7e (plain) (blame)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@use '../base' as *;
@use 'menu.scss' as *;
@use 'menu-bar.scss' as *;

/* --------------------------------

File#: _3_interactive-table
Title: Interactive Table
Descr: Table with the option of sorting data and selecting rows to perform specific actions
Usage: codyhouse.co/license

-------------------------------- */

.int-table {
  overflow: hidden;
  border-bottom: 2px solid var(--color-contrast-lower);
}

.int-table__inner {
  position: relative;
  overflow: auto;

  &::-webkit-scrollbar { // custom scrollbar style
    height: 8px;
    width: 8px;
  }

  &::-webkit-scrollbar-track { // progress bar
    background-color: var(--color-contrast-lower);
  }

  &::-webkit-scrollbar-thumb { // handle
    background-color: alpha(var(--color-contrast-higher), 0.9);
    border-radius: 50em;
  }

  &::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-contrast-higher);
  }
}

.int-table__table {
  width: 100%;
}

.int-table__header {
  .int-table__cell {
    background-color: var(--color-bg);
    box-shadow: 0 2px 0 var(--color-contrast-lower);
  }
}

.int-table__body {
  .int-table__row {
    border-bottom: 1px solid var(--color-contrast-lower);

    &:last-child {
      border-bottom: none;
    }
  }

  .int-table__row--checked {
    background-color: alpha(var(--color-primary), 0.1);
    border-color: alpha(var(--color-primary), 0.25);
  }
}

.int-table__cell { // standard cell
  padding: var(--space-xxxs);
}

.int-table__cell--th { // header cell
  font-weight: 600;
}

.int-table__cell--sort { // header cell with sorting option
  user-select: none;

  &:hover, &:focus-within {
    background-color: alpha(var(--color-contrast-higher), 0.075);
  }

  &:hover {
    cursor: pointer;
  }
}

.int-table__cell--focus {
  background-color: alpha(var(--color-primary), 0.15);
}

.int-table__sort-icon { // sorting icon indicator
  .arrow-up, .arrow-down {
    fill: alpha(var(--color-contrast-higher), 0.3);
  }
}

.int-table__cell--asc .int-table__sort-icon .arrow-up,
.int-table__cell--desc .int-table__sort-icon .arrow-down {
  fill: var(--color-contrast-higher);
}

.int-table__checkbox {
  --custom-checkbox-size: 18px;
  --custom-checkbox-marker-size: 16px;
  display: block;
  width: var(--custom-checkbox-size);
  height: var(--custom-checkbox-size);
}

.int-table__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  cursor: pointer;

  .icon {
    display: block;
    width: 16px;
    height: 16px;
  }
}

// --sticky-header
.int-table--sticky-header {
  position: relative;
  z-index: 1;

  .int-table__inner {
    max-height: 605px;
  }

  .int-table__header {
    .int-table__cell {
      position: sticky;
      top: 0;
      z-index: 2;
    }
  }
}

// actions
.int-table-actions {
  .menu-bar {
    --menu-bar-button-size: 38px; // size of the menu buttons
    --menu-bar-icon-size: 16px; // size of the icons inside the buttons
    --menu-bar-horizontal-gap: var(--space-xxxxs); // horizontal gap between buttons
    --menu-bar-vertical-gap: 4px; // vertical gap between buttons and labels (tooltips)
    --menu-bar-label-size: var(--text-xs); // label font size
  }

  .menu-bar__icon {
    color: alpha(var(--color-contrast-higher), 0.5);
  }
}