Skip to content

Commit 7ffcf0d

Browse files
committed
Merge branch 'jumbotron' into woothu
2 parents 3d24789 + 81a05e9 commit 7ffcf0d

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { mergeData } from 'vue-functional-data-merge'
2+
3+
export const props = {
4+
tag: {
5+
type: String,
6+
default: 'div'
7+
},
8+
fluid: Boolean,
9+
header: String,
10+
lead: String,
11+
variant: String,
12+
borderVariant: String,
13+
textVariant: String,
14+
}
15+
16+
export default {
17+
functional: true,
18+
name: 'CJumbotron',
19+
props,
20+
render (h, { props, data, slots }) {
21+
let childNodes = []
22+
const $slots = slots()
23+
24+
if ($slots.header || props.header){
25+
const header = $slots.header || h('h1', { staticClass: 'display-3' }, props.header)
26+
childNodes.push(header)
27+
}
28+
29+
if ($slots.lead || props.lead){
30+
const lead = $slots.lead || h('p', { staticClass: 'lead' }, props.lead)
31+
childNodes.push(lead)
32+
}
33+
34+
if ($slots.default)
35+
childNodes.push($slots.default)
36+
37+
if (props.fluid) {
38+
childNodes = [h(
39+
'div',
40+
{ staticClass: 'container-fluid' },
41+
childNodes
42+
)]
43+
}
44+
45+
return h(
46+
props.tag,
47+
mergeData(data, {
48+
staticClass: 'jumbotron',
49+
class: {
50+
'jumbotron-fluid': props.fluid,
51+
[`text-${props.textVariant}`]: Boolean(props.textVariant),
52+
[`bg-${props.variant}`]: Boolean(props.variant),
53+
[`border-${props.borderVariant}`]: Boolean(props.borderVariant),
54+
'border': Boolean(props.borderVariant)
55+
}
56+
}),
57+
childNodes
58+
)
59+
}
60+
}

src/components/Jumbotron/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import CJumbotron from './CJumbotron'
2+
3+
export {
4+
CJumbotron
5+
}

src/components/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export * from './ListGroup'
1919
<<<<<<< HEAD
2020
<<<<<<< HEAD
2121
<<<<<<< HEAD
22+
<<<<<<< HEAD
2223
export * from './Toolip'
2324
=======
2425
export * from './Pagination'
@@ -29,3 +30,6 @@ export * from './Navbar'
2930
=======
3031
export * from './Media'
3132
>>>>>>> media
33+
=======
34+
export * from './Jumbotron'
35+
>>>>>>> jumbotron

0 commit comments

Comments
 (0)