-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jumbotron): Convert to functional component (#932)
* feat(jumbotron): Convert to functional component * Use FC version of jumbotron * ESLint * Delete jumbotron.vue * typo fix * Update demo.html * Update jumbotron.spec.js * Update jumbotron.spec.js * Update demo.html * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Update jumbotron.spec.js * Merge dev into branch (#935) * fix(docs): feedback doc in form group (#934) * feat(b-col): restore `.offset-*` col classes + new b-container and b-row components 🍾🍻🎉 (#929) * feat(col): BS4 column component * feat(col): getting column working * fixed index.js from merge * feat(col): restore .offset-* col classes 🍾 * feat(test): added b-col test suite * [b-col] Update to docs * feat(b-row): New functional component * Make b-row component available * docs:(componentvdoc.vue): Handle pages that don't have a main component * Rename docs page * Rename docs/components/col/README.md to docs/components/grid/README.md * Rename docs/components/col/index.js to docs/components/grid/index.js * Rename docs/components/col/meta.json to docs/components/grid/meta.json * Update index.js * Update README.md * feat(b-conatiner): new functional component b-container component that supports optional fluid prop * make b-container available * [b-container]: ESLint * Update meta.json * Update README.md * [b-row] Add no-cgutters prop * Update README.md * Update README.md * Rename docs/components/grid/README.md to docs/components/layout/README.md * Rename docs/components/grid/index.js to docs/components/layout/index.js * Rename docs/components/grid/meta.json to docs/components/layout/meta.json * rename /docs/grid to /docs/layout * Update meta.json * Update meta.json * [b-row]: demo.html fixture * [b-row] demo.js * Update demo.html * [b-row] Tests * [b-container] demo.html * [b-container] demo.js * [b-container] tests * Update container.spec.js * docs typo * fix(jumbotron): continer wrapper only needed in fluid mode * fix(jumbotron): minor update * revert(jumbotron): Wrong branch :p * fix(docs): toggle navbar @md to keep content from wrapping * feat(docs): add BS4 docs to Layout page * Update jumbotron.js * Update jumbotron.js * Update jumbotron.spec.js * Update demo.html * Update jumbotron.spec.js * Update jumbotron.spec.js * Attempt last part of tests * Update demo.html * Final tests
- Loading branch information
1 parent
023f078
commit 5f2df53
Showing
5 changed files
with
299 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { mergeData } from "../utils"; | ||
import { assign } from "../utils/object"; | ||
import Container from './container'; | ||
|
||
export const props = { | ||
fluid: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
containerFluid: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
header: { | ||
type: String, | ||
default: null | ||
}, | ||
headerTag: { | ||
type: String, | ||
default: 'h1' | ||
}, | ||
headerLevel: { | ||
type: Number, | ||
default: 3 | ||
}, | ||
lead: { | ||
type: String, | ||
default: null | ||
}, | ||
leadTag: { | ||
type: String, | ||
default: 'p' | ||
}, | ||
tag: { | ||
type: String, | ||
default: 'div' | ||
} | ||
}; | ||
|
||
export default { | ||
functional: true, | ||
props, | ||
render(h, { props, data, slots }) { | ||
// The order of the conditionals matter. | ||
// We are building the component markup in order. | ||
let childNodes = []; | ||
|
||
// Header | ||
if (props.header || slots().header) { | ||
childNodes.push(h( | ||
props.headerTag, | ||
{ | ||
class: { | ||
[`display-${props.headerLevel}`]: Boolean(props.headerLevel) | ||
} | ||
}, | ||
slots().header || props.header | ||
)); | ||
} | ||
|
||
// Lead | ||
if (props.lead || slots().lead) { | ||
childNodes.push(h( | ||
props.leadTag, | ||
{ staticClass: 'lead' }, | ||
slots().lead || props.lead | ||
)); | ||
} | ||
|
||
// Default slot | ||
if (slots().default) { | ||
childNodes.push(slots().default); | ||
} | ||
|
||
// If fluid, wrap content in a container/container-fluid | ||
if (props.fluid) { | ||
// Children become a child of a container | ||
childNodes = [h( | ||
Container, | ||
{ props: { 'fluid': props.containerFluid } }, | ||
childNodes | ||
)]; | ||
} | ||
// Return the jumbotron | ||
return h( | ||
props.tag, | ||
mergeData(data, { | ||
staticClass: "jumbotron", | ||
class: { 'jumbotron-fluid': props.fluid } | ||
}), | ||
childNodes | ||
); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,38 @@ | ||
<div id="app"> | ||
<b-jumbotron header="BootstrapVue" | ||
lead="Bootstrap 4 Components for Vue.js 2" > | ||
<p>For more information visit website</p> | ||
<b-btn variant="primary" href="#">Docs</b-btn> | ||
<!-- default --> | ||
<b-jumbotron ref="default" header="header prop" lead="lead prop"> | ||
<p>content</p> | ||
</b-jumbotron> | ||
<br> | ||
|
||
<!-- tags --> | ||
<b-jumbotron ref="tags" tag="article" header-tag="h2" header="header prop" lead-tag="div" lead="lead prop"> | ||
<p>content</p> | ||
</b-jumbotron> | ||
<br> | ||
|
||
<!-- header level --> | ||
<b-jumbotron ref="level" :header-level="4" header="header prop" lead="lead prop"> | ||
<p>content</p> | ||
</b-jumbotron> | ||
<br> | ||
|
||
<!-- slots --> | ||
<b-jumbotron ref="slots" header="header prop" lead="lead prop"> | ||
<template slot="header">header slot</template> | ||
<template slot="lead">lead slot</template> | ||
<p>content</p> | ||
</b-jumbotron> | ||
<br> | ||
|
||
<!-- content only --> | ||
<b-jumbotron ref="content"><p>content</p></b-jumbotron> | ||
<br> | ||
|
||
<!-- fluid only --> | ||
<b-jumbotron ref="fluid" fluid header="header" lead="lead"><p>content</p></b-jumbotron> | ||
<br> | ||
|
||
<!-- containerfluid --> | ||
<b-jumbotron ref="containerFluid" fluid container-fluid header="header" lead="lead"><p>content</p></b-jumbotron> | ||
</div> |