diff --git a/src/TipBox.vue b/src/TipBox.vue index ce22a1a3..3ba58c42 100644 --- a/src/TipBox.vue +++ b/src/TipBox.vue @@ -1,16 +1,26 @@ @@ -53,14 +63,17 @@ }, heading: { type: String, - default: null, - }, + default: '', + }, light: { type: Boolean, default: false, } }, computed: { + hasHeaderBool() { + return !!this.heading; + }, isDefault() { return this.type === 'none' }, @@ -83,24 +96,45 @@ }, lightStyle() { if (this.light) { - switch (this.type) { + switch (this.type) { case 'warning': - return 'border-warning text-warning alert-border-left'; + return 'border-warning text-warning alert-border-left'; case 'info': case 'definition': - return 'border-info text-info alert-border-left'; + return 'border-info text-info alert-border-left'; case 'success': case 'tip': - return 'border-sucess text-success alert-border-left'; + return 'border-success text-success alert-border-left'; case 'important': case 'wrong': - return 'border-danger text-danger alert-border-left'; + return 'border-danger text-danger alert-border-left'; default: - return ''; - } + return 'alert-border-left'; + } } return ''; }, + headingStyle() { + if (this.light) { + return ''; + } + + switch (this.type) { + case 'warning': + return 'alert-warning-darker'; + case 'info': + case 'definition': + return 'alert-info-darker'; + case 'success': + case 'tip': + return 'alert-success-darker'; + case 'important': + case 'wrong': + return 'alert-danger-darker'; + default: + return 'alert-default-darker'; + } + }, customStyle() { var style = {}; if (this.backgroundColor) { @@ -146,40 +180,47 @@ default: return ''; } + }, + headingContent() { + return md.renderInline(this.heading); } } } + + + \ No newline at end of file diff --git a/src/index.js b/src/index.js index cbcf61e3..707373ea 100644 --- a/src/index.js +++ b/src/index.js @@ -17,6 +17,7 @@ import tipBox from './TipBox.vue' import tooltip from './Tooltip.vue' import trigger from './trigger.vue' import typeahead from './Typeahead.vue' +import stylesheetSwitcher from "./stylesheetSwitcher.vue"; const components = { affix, @@ -38,6 +39,7 @@ const components = { tooltip, trigger, typeahead, + styleswitcher: stylesheetSwitcher, } const directives = { diff --git a/src/stylesheetSwitcher.vue b/src/stylesheetSwitcher.vue new file mode 100644 index 00000000..dfa4b81a --- /dev/null +++ b/src/stylesheetSwitcher.vue @@ -0,0 +1,62 @@ + + +