Skip to content

Commit c4664c1

Browse files
committed
feat: CRow, CContainer: add tag prop, change prop names in CRow
1 parent b079872 commit c4664c1

File tree

7 files changed

+20
-14
lines changed

7 files changed

+20
-14
lines changed

src/components/Grid/CContainer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ export default {
66
name: 'CContainer',
77
props: {
88
fluid: Boolean,
9+
tag: String
910
},
1011
render (h, { props, data, children }) {
1112
return h(
12-
'div',
13+
props.tag || 'div',
1314
mergeData(data, {
1415
class: {
1516
'container': !props.fluid,

src/components/Grid/CRow.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import { mergeData } from 'vue-functional-data-merge'
33
44
const props = {
5+
tag: String,
56
noGutters: Boolean,
6-
alignV: {
7+
alignVertical: {
78
type: String,
89
validator: str => ['', 'start', 'end', 'center','baseline', 'stretch'].includes(str)
910
},
10-
alignH: {
11+
alignHorizontal: {
1112
type: String,
1213
validator: str => ['', 'start', 'end', 'center','between', 'around'].includes(str)
1314
}
@@ -19,13 +20,13 @@ export default {
1920
props,
2021
render (h, { props, data, children }) {
2122
return h(
22-
'div',
23+
props.tag || 'div',
2324
mergeData(data, {
2425
staticClass: 'row',
2526
class: {
2627
'no-gutters': props.noGutters,
27-
[`align-items-${props.alignV}`]: props.alignV,
28-
[`justify-content-${props.alignH}`]: props.alignH,
28+
[`align-items-${props.alignVertical}`]: props.alignVertical,
29+
[`justify-content-${props.alignHorizontal}`]: props.alignHorizontal,
2930
}
3031
}),
3132
children

src/components/Grid/tests/CContainer.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const defaultWrapper = mount(Component)
66
const customWrapper = mount(Component, {
77
propsData: {
88
fluid: true,
9+
tag: 'header'
910
},
1011
slots: {
1112
default: 'CContainer content'

src/components/Grid/tests/CRow.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ const ComponentName = 'CRow'
55
const defaultWrapper = mount(Component)
66
const customWrapper = mount(Component, {
77
propsData: {
8+
tag: 'header',
89
noGutters: true,
9-
alignV: 'center',
10-
alignH: 'start'
10+
alignVertical: 'center',
11+
alignHorizontal: 'start'
1112
},
1213
slots: {
1314
default: 'CRow content'

src/components/Grid/tests/__snapshots__/CContainer.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ exports[`CContainer renders correctly 1`] = `
77
`;
88

99
exports[`CContainer renders correctly 2`] = `
10-
<div
10+
<header
1111
class="container-fluid"
1212
>
1313
<template>
1414
CContainer content
1515
</template>
16-
</div>
16+
</header>
1717
`;

src/components/Grid/tests/__snapshots__/CRow.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ exports[`CRow renders correctly 1`] = `
77
`;
88

99
exports[`CRow renders correctly 2`] = `
10-
<div
10+
<header
1111
class="row no-gutters align-items-center justify-content-start"
1212
>
1313
<template>
1414
CRow content
1515
</template>
16-
</div>
16+
</header>
1717
`;

src/components/index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,14 @@ export declare class CCol extends Vue {
284284

285285
export declare class CContainer extends Vue {
286286
fluid: boolean
287+
tag: string
287288
}
288289

289290
export declare class CRow extends Vue {
291+
tag: string
290292
noGutters: boolean
291-
alignV: string
292-
alignH: string
293+
alignVertical: string
294+
alignHorizontal: string
293295
}
294296

295297
export declare class CHeader extends Vue {

0 commit comments

Comments
 (0)