|
| 1 | +// This code borrowed from bi-app https://github.com/anasnakawa/bi-app-less |
| 2 | + |
| 3 | +// padding |
| 4 | +// ------------------------------------------ |
| 5 | +.padding-left(@distance) when (@bi-app-left = left) { |
| 6 | + padding-left: @distance; |
| 7 | +} |
| 8 | + |
| 9 | +.padding-left(@distance) when (@bi-app-left = right) { |
| 10 | + padding-right: @distance; |
| 11 | +} |
| 12 | + |
| 13 | +.padding-right(@distance) when (@bi-app-right = right) { |
| 14 | + padding-right: @distance; |
| 15 | +} |
| 16 | + |
| 17 | +.padding-right(@distance) when (@bi-app-right = left) { |
| 18 | + padding-left: @distance; |
| 19 | +} |
| 20 | + |
| 21 | +.padding(@top, @right, @bottom, @left) when (@bi-app-left = left) { |
| 22 | + padding: @top @right @bottom @left; |
| 23 | +} |
| 24 | + |
| 25 | +.padding(@top, @right, @bottom, @left) when (@bi-app-left = right) { |
| 26 | + padding: @top @left @bottom @right; |
| 27 | +} |
| 28 | + |
| 29 | +// margin |
| 30 | +// ------------------------------------------ |
| 31 | +.margin-left(@distance) when (@bi-app-left = left) { |
| 32 | + margin-left: @distance; |
| 33 | +} |
| 34 | + |
| 35 | +.margin-left(@distance) when (@bi-app-left = right) { |
| 36 | + margin-right: @distance; |
| 37 | +} |
| 38 | + |
| 39 | +.margin-right(@distance) when (@bi-app-right = right) { |
| 40 | + margin-right: @distance; |
| 41 | +} |
| 42 | + |
| 43 | +.margin-right(@distance) when (@bi-app-right = left) { |
| 44 | + margin-left: @distance; |
| 45 | +} |
| 46 | + |
| 47 | +.margin(@top, @right, @bottom, @left) when (@bi-app-left = left) { |
| 48 | + margin: @top @right @bottom @left; |
| 49 | +} |
| 50 | + |
| 51 | +.margin(@top, @right, @bottom, @left) when (@bi-app-left = right) { |
| 52 | + margin: @top @left @bottom @right; |
| 53 | +} |
| 54 | + |
| 55 | +// float |
| 56 | +// ------------------------------------------ |
| 57 | +.bi-app-float-left() { |
| 58 | + float: @bi-app-left; |
| 59 | +} |
| 60 | + |
| 61 | +.bi-app-float-right() { |
| 62 | + float: @bi-app-right; |
| 63 | +} |
| 64 | + |
| 65 | +.float(@direction) when (@direction = left) { |
| 66 | + .bi-app-float-left; |
| 67 | +} |
| 68 | + |
| 69 | +.float(@direction) when (@direction = right) { |
| 70 | + .bi-app-float-right; |
| 71 | +} |
| 72 | + |
| 73 | +// text-align |
| 74 | +// ------------------------------------------ |
| 75 | +.bi-app-text-align-left() { |
| 76 | + text-align: @bi-app-left; |
| 77 | +} |
| 78 | + |
| 79 | +.bi-app-text-align-right() { |
| 80 | + text-align: @bi-app-right; |
| 81 | +} |
| 82 | + |
| 83 | +.text-align(@direction) when (@direction = left) { |
| 84 | + .bi-app-text-align-left; |
| 85 | +} |
| 86 | + |
| 87 | +.text-align(@direction) when (@direction = right) { |
| 88 | + .bi-app-text-align-right; |
| 89 | +} |
| 90 | + |
| 91 | +// clear |
| 92 | +// ------------------------------------------ |
| 93 | +.bi-app-clear-left() { |
| 94 | + clear: @bi-app-left; |
| 95 | +} |
| 96 | + |
| 97 | +.bi-app-clear-right() { |
| 98 | + clear: @bi-app-right; |
| 99 | +} |
| 100 | + |
| 101 | +.clear(@direction) when (@direction = left) { |
| 102 | + .bi-app-clear-left; |
| 103 | +} |
| 104 | + |
| 105 | +.clear(@direction) when (@direction = right) { |
| 106 | + .bi-app-clear-right; |
| 107 | +} |
| 108 | + |
| 109 | +// left / right |
| 110 | +// ------------------------------------------ |
| 111 | +.left(@distance) when (@bi-app-left = left) { |
| 112 | + left: @distance; |
| 113 | +} |
| 114 | + |
| 115 | +.left(@distance) when (@bi-app-left = right) { |
| 116 | + right: @distance; |
| 117 | +} |
| 118 | + |
| 119 | +.right(@distance) when (@bi-app-right = right) { |
| 120 | + right: @distance; |
| 121 | +} |
| 122 | + |
| 123 | +.right(@distance) when (@bi-app-right = left) { |
| 124 | + left: @distance; |
| 125 | +} |
| 126 | + |
| 127 | +// border |
| 128 | +// ------------------------------------------ |
| 129 | + |
| 130 | +// width |
| 131 | +.border-left-width(@width) when (@bi-app-left = left) { |
| 132 | + border-left-width: @width; |
| 133 | +} |
| 134 | + |
| 135 | +.border-left-width(@width) when (@bi-app-left = right) { |
| 136 | + border-right-width: @width; |
| 137 | +} |
| 138 | + |
| 139 | +.border-right-width(@width) when (@bi-app-right = right) { |
| 140 | + border-right-width: @width; |
| 141 | +} |
| 142 | + |
| 143 | +.border-right-width(@width) when (@bi-app-right = left) { |
| 144 | + border-left-width: @width; |
| 145 | +} |
| 146 | + |
| 147 | +.border-width(@top, @right, @bottom, @left) when (@bi-app-left = left) { |
| 148 | + border-width: @top @right @bottom @left; |
| 149 | +} |
| 150 | + |
| 151 | +.border-width(@top, @right, @bottom, @left) when (@bi-app-left = right) { |
| 152 | + border-width: @top @left @bottom @right; |
| 153 | +} |
| 154 | + |
| 155 | +// style |
| 156 | +.border-left-style(@style) when (@bi-app-left = left) { |
| 157 | + border-left-style: @style; |
| 158 | +} |
| 159 | + |
| 160 | +.border-left-style(@style) when (@bi-app-left = right) { |
| 161 | + border-right-style: @style; |
| 162 | +} |
| 163 | + |
| 164 | +.border-right-style(@style) when (@bi-app-right = right) { |
| 165 | + border-right-style: @style; |
| 166 | +} |
| 167 | + |
| 168 | +.border-right-style(@style) when (@bi-app-right = left) { |
| 169 | + border-left-style: @style; |
| 170 | +} |
| 171 | + |
| 172 | +.border-style(@top, @right, @bottom, @left) when (@bi-app-left = left) { |
| 173 | + border-style: @top @right @bottom @left; |
| 174 | +} |
| 175 | + |
| 176 | +.border-style(@top, @right, @bottom, @left) when (@bi-app-left = right) { |
| 177 | + border-style: @top @left @bottom @right; |
| 178 | +} |
| 179 | + |
| 180 | +// color |
| 181 | +.border-left-color(@color) when (@bi-app-left = left) { |
| 182 | + border-left-color: @color; |
| 183 | +} |
| 184 | + |
| 185 | +.border-left-color(@color) when (@bi-app-left = right) { |
| 186 | + border-right-color: @color; |
| 187 | +} |
| 188 | + |
| 189 | +.border-right-color(@color) when (@bi-app-right = right) { |
| 190 | + border-right-color: @color; |
| 191 | +} |
| 192 | + |
| 193 | +.border-right-color(@color) when (@bi-app-right = left) { |
| 194 | + border-left-color: @color; |
| 195 | +} |
| 196 | + |
| 197 | +.border-color(@top, @right, @bottom, @left) when (@bi-app-left = left) { |
| 198 | + border-color: @top @right @bottom @left; |
| 199 | +} |
| 200 | + |
| 201 | +.border-color(@top, @right, @bottom, @left) when (@bi-app-left = right) { |
| 202 | + border-color: @top @left @bottom @right; |
| 203 | +} |
| 204 | + |
| 205 | +// generic border |
| 206 | +.border-left(@border) when (@bi-app-left = left) { |
| 207 | + border-left: @border; |
| 208 | +} |
| 209 | + |
| 210 | +.border-left(@border) when (@bi-app-left = right) { |
| 211 | + border-right: @border; |
| 212 | +} |
| 213 | + |
| 214 | +.border-right(@border) when (@bi-app-right = right) { |
| 215 | + border-right: @border; |
| 216 | +} |
| 217 | + |
| 218 | +.border-right(@border) when (@bi-app-right = left) { |
| 219 | + border-left: @border; |
| 220 | +} |
| 221 | + |
| 222 | +// radius |
| 223 | +.border-top-left-radius(@radius) when (@bi-app-left = left) { |
| 224 | + -webkit-border-top-left-radius: @radius; |
| 225 | + border-top-left-radius: @radius; |
| 226 | +} |
| 227 | + |
| 228 | +.border-top-left-radius(@radius) when (@bi-app-left = right) { |
| 229 | + -webkit-border-top-right-radius: @radius; |
| 230 | + border-top-right-radius: @radius; |
| 231 | +} |
| 232 | + |
| 233 | +.border-top-right-radius(@radius) when (@bi-app-right = right) { |
| 234 | + -webkit-border-top-right-radius: @radius; |
| 235 | + border-top-right-radius: @radius; |
| 236 | +} |
| 237 | + |
| 238 | +.border-top-right-radius(@radius) when (@bi-app-right = left) { |
| 239 | + -webkit-border-top-left-radius: @radius; |
| 240 | + border-top-left-radius: @radius; |
| 241 | +} |
| 242 | + |
| 243 | +.border-bottom-left-radius(@radius) when (@bi-app-left = left) { |
| 244 | + -webkit-border-bottom-left-radius: @radius; |
| 245 | + border-bottom-left-radius: @radius; |
| 246 | +} |
| 247 | + |
| 248 | +.border-bottom-left-radius(@radius) when (@bi-app-left = right) { |
| 249 | + -webkit-border-bottom-right-radius: @radius; |
| 250 | + border-bottom-right-radius: @radius; |
| 251 | +} |
| 252 | + |
| 253 | +.border-bottom-right-radius(@radius) when (@bi-app-right = right) { |
| 254 | + -webkit-border-bottom-right-radius: @radius; |
| 255 | + border-bottom-right-radius: @radius; |
| 256 | +} |
| 257 | + |
| 258 | +.border-bottom-right-radius(@radius) when (@bi-app-right = left) { |
| 259 | + -webkit-border-bottom-left-radius: @radius; |
| 260 | + border-bottom-left-radius: @radius; |
| 261 | +} |
| 262 | + |
| 263 | +.border-right-radius(@radius) { |
| 264 | + .border-top-right-radius(@radius); |
| 265 | + .border-bottom-right-radius(@radius); |
| 266 | +} |
| 267 | + |
| 268 | +.border-left-radius(@radius) { |
| 269 | + .border-top-left-radius(@radius); |
| 270 | + .border-bottom-left-radius(@radius); |
| 271 | +} |
| 272 | + |
| 273 | +.border-top-radius(@radius) { |
| 274 | + .border-top-left-radius(@radius); |
| 275 | + .border-top-right-radius(@radius); |
| 276 | +} |
| 277 | + |
| 278 | +.border-bottom-radius(@radius) { |
| 279 | + .border-bottom-left-radius(@radius); |
| 280 | + .border-bottom-right-radius(@radius); |
| 281 | +} |
| 282 | + |
| 283 | +.border-radius(@topLeft, @topRight: null, @bottomRight: null, @bottomLeft: null) when (@topRight = null) { |
| 284 | + -webkit-border-radius: @topLeft; |
| 285 | + border-radius: @topLeft; |
| 286 | +} |
| 287 | + |
| 288 | +.border-radius(@topLeft, @topRight: null, @bottomRight: null, @bottomLeft: null) when not (@topRight = null) { |
| 289 | + .border-top-left-radius(@topLeft); |
| 290 | + .border-top-right-radius(@topRight); |
| 291 | + .border-bottom-right-radius(@bottomRight); |
| 292 | + .border-bottom-left-radius(@bottomLeft); |
| 293 | +} |
0 commit comments