UNPKG

3.69 kBSCSSView Raw
1@import 'variables';
2@import 'default-theme';
3@import 'list-shared';
4
5$md-list-side-padding: 16px;
6$md-list-avatar-size: 40px;
7$md-list-icon-size: 24px;
8
9/* Normal list variables */
10$md-list-top-padding: 8px;
11$md-list-font-size: 16px;
12$md-list-secondary-font: 14px;
13// height for single-line lists
14$md-list-base-height: 48px;
15// height for single-line lists with avatars
16$md-list-avatar-height: 56px;
17// spec requires two- and three-line lists be taller
18$md-list-two-line-height: 72px;
19$md-list-three-line-height: 88px;
20
21/* Dense list variables */
22$md-dense-top-padding: 4px;
23$md-dense-font-size: 13px;
24$md-dense-base-height: 40px;
25$md-dense-avatar-height: 48px;
26$md-dense-two-line-height: 60px;
27$md-dense-three-line-height: 76px;
28
29/*
30This mixin provides all list-item styles, changing font size and height
31based on whether the list is in dense mode.
32*/
33@mixin md-list-item-base($font-size, $base-height, $avatar-height,
34 $two-line-height, $three-line-height) {
35
36 .md-list-item {
37 display: flex;
38 flex-direction: row;
39 align-items: center;
40 font-family: $md-font-family;
41 box-sizing: border-box;
42 font-size: $font-size;
43 height: $base-height;
44 padding: 0 $md-list-side-padding;
45 color: md-color($md-foreground, base);
46 }
47
48 &.md-list-avatar .md-list-item {
49 height: $avatar-height;
50 }
51
52 &.md-2-line .md-list-item {
53 height: $two-line-height;
54 }
55
56 &.md-3-line .md-list-item {
57 height: $three-line-height;
58 }
59
60 .md-list-text {
61 @include md-line-wrapper-base();
62 padding: 0 $md-list-side-padding;
63
64 &:first-child {
65 padding: 0;
66 }
67 }
68
69 [md-list-avatar] {
70 width: $md-list-avatar-size;
71 height: $md-list-avatar-size;
72 border-radius: 50%;
73 }
74
75 [md-list-icon] {
76 width: $md-list-icon-size;
77 height: $md-list-icon-size;
78 border-radius: 50%;
79 padding: 4px;
80 }
81}
82
83/*
84This mixin provides all subheader styles, adjusting heights and padding
85based on whether the list is in dense mode.
86*/
87@mixin md-subheader-base($top-padding, $secondary-size, $base-height) {
88 display: block;
89 box-sizing: border-box;
90 height: $base-height;
91 padding: $md-list-side-padding;
92 margin: 0;
93
94 font-size: $secondary-size;
95 font-weight: 500;
96 color: md-color($md-foreground, secondary-text);
97
98 &:first-child {
99 margin-top: -$top-padding;
100 }
101}
102
103md-list, md-nav-list {
104 padding-top: $md-list-top-padding;
105 display: block;
106
107 [md-subheader] {
108 @include md-subheader-base(
109 $md-list-top-padding,
110 $md-list-secondary-font,
111 $md-list-base-height
112 );
113 }
114
115
116 md-list-item, a[md-list-item] {
117 @include md-list-item-base(
118 $md-list-font-size,
119 $md-list-base-height,
120 $md-list-avatar-height,
121 $md-list-two-line-height,
122 $md-list-three-line-height
123 );
124
125 @include md-line-base($md-list-secondary-font);
126 }
127}
128
129
130md-list[dense], md-nav-list[dense] {
131 padding-top: $md-dense-top-padding;
132 display: block;
133
134 [md-subheader] {
135 @include md-subheader-base(
136 $md-dense-top-padding,
137 $md-dense-font-size,
138 $md-dense-base-height
139 );
140 }
141
142 md-list-item, a[md-list-item] {
143 @include md-list-item-base(
144 $md-dense-font-size,
145 $md-dense-base-height,
146 $md-dense-avatar-height,
147 $md-dense-two-line-height,
148 $md-dense-three-line-height
149 );
150
151 @include md-line-base($md-dense-font-size);
152 }
153
154}
155
156md-divider {
157 display: block;
158 border-top: 1px solid md-color($md-foreground, divider);
159 margin: 0;
160}
161
162md-nav-list {
163 a {
164 text-decoration: none;
165 color: inherit;
166 }
167
168 .md-list-item {
169 cursor: pointer;
170
171 &:hover, &.md-list-item-focus {
172 outline: none;
173 background: md-color($md-background, 'hover');
174 }
175 }
176}