Project

General

Profile

1
// Name:            Table
2
// Description:     Styles for tables
3
//
4
// Component:       `uk-table`
5
//
6
// Modifiers:       `uk-table-middle`
7
//                  `uk-table-striped`
8
//                  `uk-table-small`
9
//                  `uk-table-hover`
10
//                  `uk-table-shrink`
11
//                  `uk-table-expand`
12
//                  `uk-table-link`
13
//
14
// States:          `uk-active`
15
//
16
// ========================================================================
17

    
18

    
19
// Variables
20
// ========================================================================
21

    
22
@table-margin-vertical:                         @global-margin;
23

    
24
@table-cell-padding-vertical:                   16px;
25
@table-cell-padding-horizontal:                 12px;
26

    
27
@table-header-cell-font-size:                   @global-font-size;
28
@table-header-cell-font-weight:                 bold;
29
@table-header-cell-color:                       @global-color;
30

    
31
@table-footer-font-size:                        @global-small-font-size;
32

    
33
@table-caption-font-size:                       @global-small-font-size;
34
@table-caption-color:                           @global-muted-color;
35

    
36
@table-row-active-background:                   #ffd;
37

    
38
@table-striped-row-background:                  @global-muted-background;
39

    
40
@table-hover-row-background:                    @table-row-active-background;
41

    
42
@table-small-cell-padding-vertical:             10px;
43
@table-small-cell-padding-horizontal:           12px;
44

    
45
@table-expand-min-width:                        300px;
46

    
47

    
48
/* ========================================================================
49
   Component: Table
50
 ========================================================================== */
51

    
52
/*
53
 * 1. Remove most spacing between table cells.
54
 * 2. Behave like a block element
55
 * 3. Style
56
 */
57

    
58
.uk-table {
59
    /* 1 */
60
    border-collapse: collapse;
61
    border-spacing: 0;
62
    /* 2 */
63
    width: 100%;
64
    /* 3 */
65
    margin-bottom: @table-margin-vertical;
66
}
67

    
68
/* Add margin if adjacent element */
69
* + .uk-table { margin-top: @table-margin-vertical; }
70

    
71

    
72
/* Header cell
73
 ========================================================================== */
74

    
75
/*
76
 * 1. Style
77
 */
78

    
79
.uk-table th {
80
    padding: @table-cell-padding-vertical @table-cell-padding-horizontal;
81
    text-align: left;
82
    vertical-align: bottom;
83
    /* 1 */
84
    font-size: @table-header-cell-font-size;
85
    font-weight: @table-header-cell-font-weight;
86
    color: @table-header-cell-color;
87
    .hook-table-header-cell;
88
}
89

    
90

    
91
/* Cell
92
 ========================================================================== */
93

    
94
.uk-table td {
95
    padding: @table-cell-padding-vertical @table-cell-padding-horizontal;
96
    vertical-align: top;
97
    .hook-table-cell;
98
}
99

    
100

    
101
/* Footer
102
 ========================================================================== */
103

    
104
.uk-table tfoot {
105
    font-size: @table-footer-font-size;
106
    .hook-table-footer;
107
}
108

    
109

    
110
/* Caption
111
 ========================================================================== */
112

    
113
.uk-table caption {
114
    font-size: @table-caption-font-size;
115
    text-align: left;
116
    color: @table-caption-color;
117
    .hook-table-caption;
118
}
119

    
120

    
121
/* Row
122
 ========================================================================== */
123

    
124
.uk-table > tr.uk-active,
125
.uk-table tbody tr.uk-active {
126
    background: @table-row-active-background;
127
    .hook-table-row-active;
128
}
129

    
130

    
131
/* Alignment modifier
132
 ========================================================================== */
133

    
134
.uk-table-middle,
135
.uk-table-middle td { vertical-align: middle !important; }
136

    
137

    
138
/* Style modifiers
139
 ========================================================================== */
140

    
141
/*
142
 * Striped
143
 */
144

    
145
.uk-table-striped > tr:nth-of-type(odd),
146
.uk-table-striped tbody tr:nth-of-type(odd) {
147
    background: @table-striped-row-background;
148
    .hook-table-striped;
149
}
150

    
151
/*
152
 * Hover
153
 */
154

    
155
.uk-table-hover > tr:hover,
156
.uk-table-hover tbody tr:hover {
157
    background: @table-hover-row-background;
158
    .hook-table-hover;
159
}
160

    
161

    
162
/* Size modifier
163
 ========================================================================== */
164

    
165
.uk-table-small th,
166
.uk-table-small td {
167
    padding: @table-small-cell-padding-vertical @table-small-cell-padding-horizontal;
168
    .hook-table-small;
169
}
170

    
171

    
172
/* Cell size modifier
173
 ========================================================================== */
174

    
175
.uk-table-shrink { width: 1px; }
176
.uk-table-expand { min-width: @table-expand-min-width; }
177

    
178

    
179
/* Cell link modifier
180
 ========================================================================== */
181

    
182
.uk-table-link { padding: 0 !important; }
183

    
184
.uk-table-link > a {
185
    display: block;
186
    padding: @table-cell-padding-vertical @table-cell-padding-horizontal;
187
}
188

    
189
.uk-table-small .uk-table-link > a { padding: @table-small-cell-padding-vertical @table-small-cell-padding-horizontal; }
190

    
191

    
192
// Hooks
193
// ========================================================================
194

    
195
.hook-table-misc;
196

    
197
.hook-table() {}
198
.hook-table-header-cell() {}
199
.hook-table-cell() {}
200
.hook-table-footer() {}
201
.hook-table-caption() {}
202
.hook-table-row-active() {}
203
.hook-table-striped() {}
204
.hook-table-small() {}
205
.hook-table-hover() {}
206
.hook-table-small() {}
207
.hook-table-misc() {}
(57-57/66)