Skip to content

Commit 7cfddc9

Browse files
committed
Merge branch 'grid' into woothu
2 parents a671be1 + 54e324b commit 7cfddc9

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

src/components/Grid/CColumn.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { mergeData } from 'vue-functional-data-merge'
2+
3+
export default {
4+
functional: true,
5+
render (h, { props, data, children }) {
6+
return h(
7+
'div',
8+
mergeData(data,
9+
{
10+
class: { col: !data.class && !data.staticClass }
11+
}
12+
),
13+
children
14+
)
15+
}
16+
}

src/components/Grid/CContainer.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { mergeData } from 'vue-functional-data-merge'
2+
3+
export default {
4+
functional: true,
5+
props: {
6+
fluid: Boolean,
7+
},
8+
render (h, { props, data, children }) {
9+
return h(
10+
'div',
11+
mergeData(data, {
12+
class: {
13+
'container': !props.fluid,
14+
'container-fluid': props.fluid
15+
}
16+
}),
17+
children
18+
)
19+
}
20+
}

src/components/Grid/CRow.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { mergeData } from 'vue-functional-data-merge'
2+
import { arrayIncludes } from '../../utils/array'
3+
4+
const props = {
5+
noGutters: Boolean,
6+
alignV: {
7+
type: String,
8+
validator: str => arrayIncludes(['start', 'end', 'center','baseline', 'stretch'], str)
9+
},
10+
alignH: {
11+
type: String,
12+
validator: str => arrayIncludes(['start', 'end', 'center','between', 'around'], str)
13+
},
14+
}
15+
16+
export default {
17+
functional: true,
18+
props,
19+
render (h, { props, data, children }) {
20+
return h(
21+
'div',
22+
mergeData(data, {
23+
staticClass: 'row',
24+
class: {
25+
'no-gutters': props.noGutters,
26+
[`align-items-${props.alignV}`]: props.alignV,
27+
[`justify-content-${props.alignH}`]: props.alignH,
28+
}
29+
}),
30+
children
31+
)
32+
}
33+
}

src/components/Grid/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import CColumn from './CColumn'
2+
import CRow from './CRow'
3+
import CContainer from './CContainer'
4+
5+
export {
6+
CColumn,
7+
CRow,
8+
CContainer
9+
}

src/components/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export * from './Button'
1616
export * from './Card'
1717
export * from './Dropdown'
1818
<<<<<<< HEAD
19+
<<<<<<< HEAD
1920
export * from './ListGroup'
2021
<<<<<<< HEAD
2122
<<<<<<< HEAD
@@ -37,3 +38,6 @@ export * from './Jumbotron'
3738
=======
3839
export * from './Image'
3940
>>>>>>> image
41+
=======
42+
export * from './Grid'
43+
>>>>>>> grid

0 commit comments

Comments
 (0)