-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathcol.scss
More file actions
81 lines (64 loc) · 2.32 KB
/
col.scss
File metadata and controls
81 lines (64 loc) · 2.32 KB
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
@import "./col.vars";
// Column
// --------------------------------------------------
:host {
/**
* @prop --col-unit-size: The size of each Column unit.
*/
--col-unit-size: calc(
(100% - (var(--ion-grid-columns, 12) - 1) * var(--ion-grid-gap, 0px)) / var(--ion-grid-columns, 12)
);
/**
* @prop --ion-grid-columns: The number of total Columns in the Grid
* @prop --ion-grid-column-padding: Padding for the Column
* @prop --ion-grid-column-padding-xs: Padding for the Column on xs screens and up
* @prop --ion-grid-column-padding-sm: Padding for the Column on sm screens and up
* @prop --ion-grid-column-padding-md: Padding for the Column on md screens and up
* @prop --ion-grid-column-padding-lg: Padding for the Column on lg screens and up
* @prop --ion-grid-column-padding-xl: Padding for the Column on xl screens and up
*/
@include make-breakpoint-padding($grid-column-paddings);
@include margin(0);
box-sizing: border-box;
position: relative;
flex: 1;
min-height: 1px; // Prevent columns from collapsing when empty
overflow: auto;
}
:host(.ion-grid-col-auto) {
flex: 0 0 auto;
}
:host([class^="ion-grid-col--"]),
:host([class*=" ion-grid-col--"]) {
flex: 0 0
calc(var(--ion-grid-col-span) * var(--col-unit-size) + (var(--ion-grid-col-span) - 1) * var(--ion-grid-gap, 0px));
max-width: calc(
var(--ion-grid-col-span) * var(--col-unit-size) + (var(--ion-grid-col-span) - 1) * var(--ion-grid-gap, 0px)
);
}
:host([class^="ion-grid-offset-col--"]),
:host([class*=" ion-grid-offset-col--"]) {
--margin-calc: calc(
var(--col-unit-size) * var(--ion-grid-col-margin) + (var(--ion-grid-gap, 0px) * var(--ion-grid-col-margin))
);
@include margin-horizontal(var(--margin-calc), 0);
}
/*
* While the number of columns can be customized, we generate
* a default set of classes for 12 columns. In the future, this
* will be configurable at build time as Ionic becomes more modular.
* For now, 12 columns is a practical default. Developers who need
* more columns can override or extend these styles as needed.
*/
$grid-col-number: 12;
@for $i from 1 through $grid-col-number {
:host(.ion-grid-col--#{$i}) {
--ion-grid-col-span: #{$i};
}
:host(.ion-grid-order-col--#{$i}) {
order: #{$i};
}
:host(.ion-grid-offset-col--#{$i}) {
--ion-grid-col-margin: #{$i};
}
}