Skip to content

Commit

Permalink
feat: CListGroup: add accent functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
woothu committed Jun 29, 2020
1 parent 7bc7f96 commit 94256a1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/components/index.d.ts
Expand Up @@ -374,14 +374,18 @@ export declare class CListGroup extends Vue {
tag?: string
flush?: boolean
horizontal?: string | boolean
accent?: boolean
}

export declare class CListGroupItem extends CLink {
tag?: string
action?: boolean
color?: string
accent?: string
}

export declare class CListGroupItemDivider extends Vue {}

export declare class CMedia extends Vue {
addAsideMargin?: boolean
addAsideClasses?: string | Array<any> | object
Expand Down
6 changes: 4 additions & 2 deletions src/components/list-group/CListGroup.vue
Expand Up @@ -10,7 +10,8 @@ export default {
default: 'ul'
},
flush: Boolean,
horizontal: [Boolean, String]
horizontal: [Boolean, String],
accent: Boolean
},
render (h, { props, data, children }) {
const hor = props.horizontal
Expand All @@ -19,7 +20,8 @@ export default {
staticClass: 'list-group',
class: {
'list-group-flush': !hor && props.flush,
[`list-group-horizontal${horizontalClassSuffix}`]: hor
[`list-group-horizontal${horizontalClassSuffix}`]: hor,
'list-group-accent': props.accent
},
attrs: {
role: data.attrs ? data.attrs.role || 'list-items' : 'list-items'
Expand Down
4 changes: 3 additions & 1 deletion src/components/list-group/CListGroupItem.vue
Expand Up @@ -10,7 +10,8 @@ const props = Object.assign(
default: 'li'
},
action: Boolean,
color: String
color: String,
accent: String
},
linkPropsFactory()
)
Expand Down Expand Up @@ -45,6 +46,7 @@ export default {
staticClass: 'list-group-item',
class: {
[`list-group-item-${props.color}`]: props.color,
[`list-group-item-accent-${props.accent}`]: props.accent,
'list-group-item-action': isAction,
'active': props.active,
'disabled': props.disabled
Expand Down
3 changes: 2 additions & 1 deletion src/components/list-group/tests/CListGroup.spec.js
Expand Up @@ -10,7 +10,8 @@ const wrapper = mount(Component, {

const customWrapper = mount(Component, {
propsData: {
flush: true
flush: true,
accent: true
},
slots: {
default: 'CListGroup content'
Expand Down
3 changes: 2 additions & 1 deletion src/components/list-group/tests/CListGroupItem.spec.js
Expand Up @@ -7,7 +7,8 @@ const customWrapper = mount(Component, {
propsData: {
tag: 'button',
action: true,
color: 'success'
color: 'success',
accent: 'success'
},
slots: {
default: 'CListGroupItem content'
Expand Down
Expand Up @@ -9,7 +9,7 @@ exports[`CListGroup renders correctly 1`] = `

exports[`CListGroup renders correctly with flush option 1`] = `
<ul
class="list-group list-group-flush"
class="list-group list-group-flush list-group-accent"
role="list-items"
>
<template>
Expand Down
Expand Up @@ -8,7 +8,7 @@ exports[`CListGroupItem renders correctly 1`] = `

exports[`CListGroupItem renders correctly 2`] = `
<button
class="list-group-item list-group-item-success list-group-item-action"
class="list-group-item list-group-item-success list-group-item-accent-success list-group-item-action"
type="button"
>
<template>
Expand Down

0 comments on commit 94256a1

Please sign in to comment.