forked from canonical/vanilla-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_patterns_table-mobile-card.scss
134 lines (116 loc) · 3.18 KB
/
_patterns_table-mobile-card.scss
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
@import 'settings';
@mixin vf-p-table-mobile-card {
.p-table--mobile-card {
td::before,
tbody th::before {
@extend %muted-heading;
}
@media screen and (max-width: $breakpoint-medium) {
thead {
display: none;
}
tbody {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
tr {
border: $border;
border-radius: $border-radius;
display: flex;
flex-direction: column;
margin-bottom: $spv-outer--scaleable;
overflow: auto; // prevent overflow of child margins
padding: 0 $sph-inner--large calc(#{$spv-inner--large} - 1px);
width: calc(50% - #{0.5 * map-get($grid-gutter-widths, medium)});
}
// stylelint-disable selector-no-qualifying-type
td,
tbody th {
display: flex;
min-width: 100%;
overflow: hidden;
padding-bottom: $spv-nudge-compensation;
padding-left: calc(50% + #{0.5 * $sph-inner});
padding-right: 0;
padding-top: $spv-nudge;
position: relative;
text-align: left !important;
text-overflow: ellipsis;
width: 100%;
word-break: break-word;
&[aria-label] {
text-align: right;
}
&[aria-label]::before {
content: attr(aria-label);
display: block;
flex: 0 0 auto;
margin-bottom: $spv-inner--small - map-get($nudges, nudge--small);
margin-left: -100%;
overflow: hidden;
padding-right: #{$sph-inner};
padding-top: $sp-unit - map-get($nudges, nudge--small);
text-align: right;
text-overflow: ellipsis;
width: 100%;
}
&.u-align--right {
justify-content: unset !important;
}
}
// stylelint-enable selector-no-qualifying-type
// Styles contextual menus differently within mobile-card tables
.p-contextual-menu {
width: 100%;
// Initial menu item for actions should be hidden
[role='menuitem'] {
display: none;
}
}
.p-contextual-menu__dropdown {
box-shadow: none;
display: block;
max-width: 100%;
position: relative;
&::before {
display: none;
}
}
.p-contextual-menu__group {
padding: 0;
+ .p-contextual-menu__group {
margin-top: $sp-small;
padding-top: $sp-small;
}
}
// Any link items should be styled as a button element
.p-contextual-menu__link {
border: {
color: $color-mid-light;
radius: 0.125rem;
style: solid;
width: 1px;
}
box-sizing: border-box;
color: $color-x-dark;
cursor: pointer;
display: block;
line-height: $sp-medium;
outline: none;
padding: $sp-small $sp-large;
text-align: center;
text-decoration: none;
width: 100%;
+ .p-contextual-menu__link {
margin-top: $sp-x-small;
}
}
}
@media screen and (max-width: $breakpoint-small) {
tr {
width: 100%;
}
}
}
}