Skip to content

Commit f90e4c1

Browse files
pdanpdanrstoenescu
authored andcommitted
Add full responsive spacing (quasarframework#2586)
1 parent f4ed124 commit f90e4c1

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

dev/components/css/size-addon.vue

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<template>
2+
<div class="layout-padding">
3+
<template v-for="b in bp">
4+
<h5 :key="`h${ b }`">Breakpoint {{ b || 'NONE' }}</h5>
5+
<div class="row items-center" :key="`h${ b }`">
6+
<div class="box" v-for="s in sz" :key="`b${ b }-${ s }`">
7+
<div :class="`q-pa${ b }-${ s } q-ma${ b }-${ s }`"/>
8+
</div>
9+
</div>
10+
</template>
11+
</div>
12+
</template>
13+
14+
<style lang="stylus">
15+
.box
16+
position relative
17+
display inline-flex
18+
margin 2em
19+
background rgba(255, 150, 0, .3)
20+
width 200px
21+
height 200px
22+
div
23+
flex 1 1 100%
24+
background rgba(0, 200, 0, .3)
25+
&:before
26+
content ''
27+
display block
28+
width 100%
29+
height 100%
30+
background rgba(0, 0, 255, .3)
31+
&:after
32+
content attr(class)
33+
position absolute
34+
bottom 0
35+
left 0
36+
right 0
37+
transform translateY(100%)
38+
padding .5em
39+
background rgba(100, 100, 100, .1)
40+
text-align center
41+
42+
</style>
43+
44+
<script>
45+
export default {
46+
data () {
47+
return {
48+
bp: ['', '-xs', '-sm', '-md', '-lg', '-xl'],
49+
sz: ['xs', 'sm', 'md', 'lg', 'xl']
50+
}
51+
},
52+
created () {
53+
import('./flex-addon.styl')
54+
}
55+
}
56+
</script>

src/css/flex-addon.styl

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,50 @@ fg($name, $size)
2323
$column-{$name}-reverse
2424
flex-direction column-reverse
2525

26+
for $space, $value in $spaces
27+
.q-pa{$name}-{$space}
28+
padding: $value.y $value.x
29+
.q-pl{$name}-{$space}
30+
padding-left: $value.x
31+
.q-pr{$name}-{$space}
32+
padding-right: $value.x
33+
.q-pt{$name}-{$space}
34+
padding-top: $value.y
35+
.q-pb{$name}-{$space}
36+
padding-bottom: $value.y
37+
.q-px{$name}-{$space}
38+
@extends .q-pl{$name}-{$space}, .q-pr{$name}-{$space}
39+
.q-py{$name}-{$space}
40+
@extends .q-pt{$name}-{$space}, .q-pb{$name}-{$space}
41+
.q-ma{$name}-{$space}
42+
margin: $value.y $value.x
43+
.q-ml{$name}-{$space}
44+
margin-left: $value.x
45+
.q-mr{$name}-{$space}
46+
margin-right: $value.x
47+
.q-mt{$name}-{$space}
48+
margin-top: $value.y
49+
.q-mb{$name}-{$space}
50+
margin-bottom: $value.y
51+
.q-mx{$name}-{$space}
52+
@extends .q-ml{$name}-{$space}, .q-mr{$name}-{$space}
53+
.q-my{$name}-{$space}
54+
@extends .q-mt{$name}-{$space}, .q-mb{$name}-{$space}
55+
56+
.q-ml{$name}-auto
57+
margin-left auto
58+
.q-mr{$name}-auto
59+
margin-right auto
60+
.q-mx{$name}-auto
61+
@extends .q-ml{$name}-auto, .q-mr{$name}-auto
62+
63+
.q-my-{$name}-form:not(.q-if-full-width)
64+
margin-top $input-margin-top
65+
margin-bottom $input-margin-bottom
66+
&.q-if-dense
67+
margin-top $input-dense-margin-top
68+
margin-bottom $input-dense-margin-bottom
69+
2670
.row, .column, .flex
2771
if $noProcNotZero
2872
{fr('&.inline<name>', $name)}

0 commit comments

Comments
 (0)