-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25fa5b1
commit 717cc79
Showing
7 changed files
with
128 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './components/badge/Badge'; |
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,2 @@ | ||
'use strict'; | ||
module.exports = require('./components/badge/Badge.vue'); |
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,9 @@ | ||
import Vue from 'vue'; | ||
|
||
declare class Badge extends Vue { | ||
value?: any; | ||
severity?: string; | ||
size?: string; | ||
} | ||
|
||
export default Badge; |
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,56 @@ | ||
<template> | ||
<span :class="containerClass"> | ||
<template v-if="!$slots.default">{{value}}</template> | ||
<template v-else> | ||
<slot> | ||
</slot> | ||
<span :class="badgeClass">{{value}}</span> | ||
</template> | ||
</span> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
value: null, | ||
severity: null, | ||
size: null | ||
}, | ||
computed: { | ||
containerClass() { | ||
return this.$slots.default ? 'p-overlay-badge p-component': this.badgeClass; | ||
}, | ||
badgeClass() { | ||
return ['p-badge', { | ||
'p-badge-lg': this.size === 'large', | ||
'p-badge-xl': this.size === 'xlarge', | ||
'p-badge-info': this.severity === 'info', | ||
'p-badge-success': this.severity === 'success', | ||
'p-badge-warning': this.severity === 'warning', | ||
'p-badge-danger': this.severity === 'danger' | ||
}]; | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.p-badge { | ||
display: inline-block; | ||
border-radius: 50%; | ||
text-align: center; | ||
} | ||
.p-overlay-badge { | ||
position: relative; | ||
display: inline-block; | ||
} | ||
.p-overlay-badge .p-badge { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
transform: translate(1em, -1em); | ||
margin: 0; | ||
} | ||
</style> |
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
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