-
Notifications
You must be signed in to change notification settings - Fork 1
/
_mixin.scss
151 lines (130 loc) · 4.13 KB
/
_mixin.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
@import "util";
$_fx-layout-current-direction: null;
@mixin fx-layout($direction-wrap: row, $axis: null, $layout-gap-value: null) {
$direction: row;
$wrap: null;
$main-axis-value: null;
$cross-axis-value: null;
@if type-of($direction-wrap) == string {
$direction: $direction-wrap;
} @else if type-of($direction-wrap) == list {
$direction: nth($direction-wrap, 1);
$wrap: nth($direction-wrap, 2);
}
@if $axis != null {
@if type-of($axis) == list {
$main-axis-value: nth($axis, 1);
$cross-axis-value: nth($axis, 2);
} @else if type-of($axis) == string {
$main-axis-value: $axis;
$cross-axis-value: stretch;
}
}
@include _support-value($direction, (row, column, row-reverse, column-reverse));
@include _support-value($wrap, (wrap, null));
$max-cross: if($direction == column or $direction == column-reverse, width, height);
$_fx-layout-current-direction: $direction !global;
display: flex;
box-sizing: border-box;
flex-direction: $direction;
@include _fx-layout-align-main-axis($main-axis-value);
@include _fx-layout-align-cross-axis($cross-axis-value);
@include _fx-wrap($wrap);
@include _fx-layout-gap($layout-gap-value, $direction);
@if $cross-axis-value != null {
max-#{$max-cross}: 100%;
}
}
@mixin fx-flex($params: '', $parent-direction: null) {
$parent-direction: if($parent-direction != null, $parent-direction,
if($_fx-layout-current-direction != null, $_fx-layout-current-direction, row));
@include _support-value($parent-direction, (row, column, row-reverse, column-reverse));
$grow: 1;
$shrink: 1;
$basis: 0%;
$min-value: null;
$max-value: null;
$max-cross: if($parent-direction == column or $parent-direction == column-reverse, height, width);
@if type-of($params) == string {
@include _support-value($params, ('', none, nogrow, grow, initial, auto, noshrink));
@if $params == '' {
// default 값 사용
} @else if $params == none {
$grow: 0;
$shrink: 0;
$basis: auto;
} @else if $params == nogrow {
$grow: 0;
$shrink: 1;
$basis: auto;
} @else if $params == grow {
$grow: 1;
$shrink: 1;
$basis: 100%;
$max-value: 100%;
} @else if $params == initial {
$grow: 0;
$shrink: 1;
$basis: auto;
} @else if $params == auto {
$grow: 1;
$shrink: 1;
$basis: auto;
$min-value: auto;
} @else if $params == noshrink {
$grow: 1;
$shrink: 0;
$basis: auto;
}
} @else if type-of($params) == number {
@include _support-value(unit($params), ('', '%', px, vh, vw));
@if $params != 0 {
$params: if(unitless($params), $params + '%', $params);
$basis: $params;
$max-value: $basis;
$min-value: if(unit($basis) == px, $basis, null);
}
} @else if type-of($params) == list {
$grow: nth($params, 1);
$shrink: nth($params, 2);
$basis: nth($params, 3);
}
box-sizing: border-box;
flex-grow: $grow;
flex-shrink: $shrink;
flex-basis: $basis;
@if $max-value != null {
max-#{$max-cross}: $max-value;
}
@if $min-value != null {
min-#{$max-cross}: $min-value;
}
}
@mixin fx-flex-order($order: 0) {
@include _only-support-int($order);
order: $order;
}
@mixin fx-flex-offset($offset, $parent-direction: null) {
$parent-direction: if($parent-direction != null, $parent-direction,
if($_fx-layout-current-direction != null, $_fx-layout-current-direction, row));
@include _support-value(unit($offset), ('', '%', px, vh, vw));
@include _support-value($parent-direction, (row, column, row-reverse, column-reverse));
$offset: if(unitless($offset), $offset + '%', $offset);
$margin-direction: if($parent-direction == column or $parent-direction == column-reverse, top, left);
margin-#{$margin-direction}: $offset;
}
@mixin fx-flex-align($align) {
@include _support-value($align, (start, center, end, baseline, stretch));
$align: if($align == start or $align == end, flex-#{$align}, $align);
align-self: $align;
}
@mixin fx-flex-fill {
margin: 0;
width: 100%;
height: 100%;
min-width: 100%;
min-height: 100%;
}
@mixin fx-fill {
@include fx-flex-fill;
}