-
Notifications
You must be signed in to change notification settings - Fork 46
/
Grid.vue
167 lines (161 loc) · 5.93 KB
/
Grid.vue
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<template>
<section :class="$style.component">
<FlexGrid tagName="section">
<FlexRow v-bind:gutter="16">
<FlexCol v-bind:xs="12">
<h1 id="grid">Grid</h1>
</FlexCol>
</FlexRow>
<FlexRow v-bind:gutter="16">
<FlexCol v-bind:xs="12">
<h3>
Our flexbox grid is based on a 12-unit grid system where each column counts for 1/12
of the grid.
</h3>
<p>
Put differently, 12-units represents 100% of the width of the containing
element your grid resides within. For example, a 3 unit column takes up a fourth of the full width, 4 unit columns a third,
6 unit columns a half, and so on.
</p>
<div :class="$style.hotips">
<p :class="$style.tip">
<span class="quoted">The grid system is an aid, not a guarantee.</span>
<a
href="https://www.goodreads.com/quotes/9110726-the-grid-system-is-an-aid-not-a-guarantee-it"
>Josef Müller-Brockmann</a>
</p>
<div :class="$style.tipcontent">
<p>
AgnosticUI's grid leverages
<a
href="https://evgenyrodionov.github.io/flexboxgrid2/"
>flexboxgrid2</a>
under the hood, which in turn leverages
<a
href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox"
>Flexbox</a>.
</p>
<p>
The grid uses a declarative approach where you add certain CSS classes to your html markup to
layout your page or section on a 12-unit grid.
If you're using the CSS AgnosticUI package, you can simply apply the global CSS classes
you see in the demo below. However, if you're using React, Svelte, or
Vue, you should utilize that framework's version of FlexGrid as it will provide
localized CSS via
<a
href="https://github.com/css-modules/css-modules"
>CSS Modules</a> (React, Vue) or
<a href="https://vuejs.org/v2/guide/single-file-components.html">SFC</a> styles (Svelte).
</p>
<h5 :class="$style.customize">Gutters</h5>
<p>
Our implementation removes “magic gutters” so subdivisions are predictable. You
can certainly apply gutters yourself, but we feel “automagical” grid gutters to more harm then good.
</p>
</div>
</div>
<p>
FlexGrid is a work-in-progress, so please first check the
<a
href="https://github.com/AgnosticUI/agnosticui/issues/1"
>Component Coverage List</a> to see if your framework of choice has been
implemented yet. If so, you should have a look at the corresponding framework's
<a
href="https://storybook.js.org/"
>Storybook</a> examples.
</p>
<div class="flexgrid-container">
<div class="row" :class="$style.demoOnly">
<div class="col-xs-12 col-sm-4 col-lg-6">
<p :class="$style.demoOnlyField">xs={12} sm={4} lg={6}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-6">
<p :class="$style.demoOnlyField">xs={12} sm={4} lg={6}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p :class="$style.demoOnlyField">xs={12} sm={4} lg={3}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p :class="$style.demoOnlyField">xs={12} sm={4} lg={3}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p :class="$style.demoOnlyField">xs={12} sm={4} lg={3}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p :class="$style.demoOnlyField">xs={12} sm={4} lg={3}</p>
</div>
</div>
</div>
</FlexCol>
</FlexRow>
<FlexRow v-bind:gutter="16">
<FlexCol v-bind:xs="12">
<pre v-highlightjs>
<code class="html">
<div class="flexgrid-container">
<div class="row">
<div class="col-xs-12 col-sm-4 col-lg-6">
<p>xs={12} sm={4} lg={6}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-6">
<p>xs={12} sm={4} lg={6}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p>xs={12} sm={4} lg={3}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p>xs={12} sm={4} lg={3}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p>xs={12} sm={4} lg={3}</p>
</div>
<div class="col-xs-12 col-sm-4 col-lg-3">
<p>xs={12} sm={4} lg={3}</p>
</div>
</div>
</div>
</code>
</pre>
</FlexCol>
</FlexRow>
</FlexGrid>
</section>
</template>
<script>
import FlexGrid from "agnosticui/FlexGrid/FlexGrid";
import FlexRow from "agnosticui/FlexGrid/FlexRow";
import FlexCol from "agnosticui/FlexGrid/FlexCol";
export default {
name: "Grid",
components: {
FlexCol,
FlexGrid,
FlexRow,
},
};
</script>
<style module>
.component {
composes: component from "./partials.module.css";
}
.hotips {
composes: hotips from "./partials.module.css";
}
.tipcontent {
composes: tipcontent from "./partials.module.css";
}
.tip {
composes: tip from "./partials.module.css";
}
.customize {
margin-top: var(--Space-56);
margin-bottom: var(--Space-8);
}
.demoOnly {
padding: 2rem 0;
}
.demoOnlyField {
border: 1px solid #cccccc;
padding: 1.5rem 3rem;
}
</style>