diff --git a/src/components/Canvas/Sections/Colors.vue b/src/components/Canvas/Sections/Colors.vue index 002a4a6..43a1e84 100644 --- a/src/components/Canvas/Sections/Colors.vue +++ b/src/components/Canvas/Sections/Colors.vue @@ -1,31 +1,38 @@ @@ -75,7 +109,8 @@ export default { data () { return { - selectedProp: 'backgroundColor' + selectedProp: 'backgroundColor', + groupColors: false } }, @@ -84,6 +119,10 @@ export default { return this.data[this.selectedProp] }, + groupedColorItems () { + return this.groupColorByName(this.selectedColorItems) + }, + selectedPropClassPrefix () { const map = { backgroundColor: 'bg', @@ -108,7 +147,34 @@ export default { border: `2px solid ${value}` } } + }, + groupColorByName (items) { + const groups = {} + for (const key in items) { + if (items.hasOwnProperty(key)) { + const group = key.substring(0, key.lastIndexOf('-')) + if (!groups[group]) { + groups[group] = [] + } + groups[group].push({ key, value: items[key] }) + } + } + return groups } } } + +