-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
list.scss
189 lines (156 loc) · 4.33 KB
/
list.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
@import '../core/style/variables';
@import '../core/style/list-common';
$mat-list-side-padding: 16px;
$mat-list-avatar-size: 40px;
// Normal list variables
$mat-list-top-padding: 8px;
// height for single-line lists
$mat-list-base-height: 48px;
// height for single-line lists with avatars
$mat-list-avatar-height: 56px;
// spec requires two- and three-line lists be taller
$mat-list-two-line-height: 72px;
$mat-list-three-line-height: 88px;
$mat-list-icon-size: 24px;
// Dense list variables
$mat-dense-top-padding: 4px;
$mat-dense-base-height: 40px;
$mat-dense-avatar-height: 48px;
$mat-dense-two-line-height: 60px;
$mat-dense-three-line-height: 76px;
$mat-dense-list-icon-size: 20px;
// This mixin provides all list-item styles, changing font size and height
// based on whether the list is in dense mode.
@mixin mat-list-item-base($base-height, $avatar-height,
$two-line-height, $three-line-height, $icon-size) {
// Prevents the wrapper `mat-list-item-content` from collapsing due to it
// being `inline` by default.
display: block;
.mat-list-item-content {
display: flex;
flex-direction: row;
align-items: center;
box-sizing: border-box;
height: $base-height;
padding: 0 $mat-list-side-padding;
position: relative;
}
.mat-list-item-ripple {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
// Disable pointer events for the ripple container because the container will overlay the
// user content and we don't want to disable mouse events on the user content.
// Pointer events can be safely disabled because the ripple trigger element is the host element.
pointer-events: none;
}
&.mat-list-item-avatar .mat-list-item-content {
height: $avatar-height;
}
&.mat-2-line .mat-list-item-content {
height: $two-line-height;
}
&.mat-3-line .mat-list-item-content {
height: $three-line-height;
}
// list items with more than 3 lines should expand to match
// the height of its contained text
&.mat-multi-line .mat-list-item-content {
height: 100%;
padding: 8px $mat-list-side-padding;
}
.mat-list-text {
@include mat-line-wrapper-base();
padding: 0 $mat-list-side-padding;
// We only want to override the padding if there isn't
// an avatar or icon before the element. Since the ripple
// will always be the first child in the container, we
// check whether this element is the second child.
&:nth-child(2) {
padding: 0;
}
}
.mat-list-avatar {
flex-shrink: 0;
width: $mat-list-avatar-size;
height: $mat-list-avatar-size;
border-radius: 50%;
}
.mat-list-icon {
width: $icon-size;
height: $icon-size;
font-size: $icon-size;
box-sizing: content-box;
border-radius: 50%;
padding: 4px;
}
}
.mat-subheader {
display: block;
box-sizing: border-box;
padding: $mat-list-side-padding;
// This needs slightly more specificity, because it
// can be overwritten by the typography styles.
.mat-list & {
margin: 0;
}
}
// This mixin adjusts the heights and padding based on whether the list is in dense mode.
@mixin mat-subheader-spacing($top-padding, $base-height) {
height: $base-height;
&:first-child {
margin-top: -$top-padding;
}
}
.mat-list, .mat-nav-list {
padding-top: $mat-list-top-padding;
display: block;
.mat-subheader {
@include mat-subheader-spacing($mat-list-top-padding, $mat-list-base-height);
}
.mat-list-item {
@include mat-list-item-base(
$mat-list-base-height,
$mat-list-avatar-height,
$mat-list-two-line-height,
$mat-list-three-line-height,
$mat-list-icon-size
);
}
}
.mat-list[dense], .mat-nav-list[dense] {
padding-top: $mat-dense-top-padding;
display: block;
.mat-subheader {
@include mat-subheader-spacing($mat-dense-top-padding, $mat-dense-base-height);
}
.mat-list-item {
@include mat-list-item-base(
$mat-dense-base-height,
$mat-dense-avatar-height,
$mat-dense-two-line-height,
$mat-dense-three-line-height,
$mat-dense-list-icon-size
);
}
}
.mat-divider {
display: block;
border-top-style: solid;
border-top-width: 1px;
margin: 0;
}
.mat-nav-list {
a {
text-decoration: none;
color: inherit;
}
.mat-list-item-content {
cursor: pointer;
&:hover, &.mat-list-item-focus {
outline: none;
}
}
}