diff --git a/webapp/components/_new/generic/CounterIcon/CounterIcon.story.js b/webapp/components/_new/generic/CounterIcon/CounterIcon.story.js index 9d7debbc6..85b49f631 100644 --- a/webapp/components/_new/generic/CounterIcon/CounterIcon.story.js +++ b/webapp/components/_new/generic/CounterIcon/CounterIcon.story.js @@ -2,7 +2,7 @@ import { storiesOf } from '@storybook/vue' import helpers from '~/storybook/helpers' import CounterIcon from './CounterIcon.vue' -storiesOf('CounterIcon', module) +storiesOf('Generic/CounterIcon', module) .addDecorator(helpers.layout) .add('default', () => ({ @@ -15,6 +15,20 @@ storiesOf('CounterIcon', module) .add('high count', () => ({ components: { CounterIcon }, template: ` - + + `, + })) + + .add('danger', () => ({ + components: { CounterIcon }, + template: ` + + `, + })) + + .add('count is 0', () => ({ + components: { CounterIcon }, + template: ` + `, })) diff --git a/webapp/components/_new/generic/CounterIcon/CounterIcon.vue b/webapp/components/_new/generic/CounterIcon/CounterIcon.vue index 87d90a9b1..6202f823c 100644 --- a/webapp/components/_new/generic/CounterIcon/CounterIcon.vue +++ b/webapp/components/_new/generic/CounterIcon/CounterIcon.vue @@ -1,7 +1,7 @@ @@ -10,12 +10,20 @@ export default { props: { icon: { type: String, required: true }, count: { type: Number, required: true }, + danger: { type: Boolean, default: false }, }, computed: { cappedCount() { return this.count <= 99 ? this.count : '99+' - } - } + }, + counterClass() { + let counterClass = 'count' + if (this.danger) counterClass += ' --danger' + if (this.count === 0) counterClass += ' --inactive' + + return counterClass + }, + }, } @@ -42,6 +50,14 @@ export default { font-size: 10px; line-height: 1; text-align: center; + + &.--danger { + background-color: $color-danger; + } + + &.--inactive { + background-color: $color-neutral-60; + } } }