Skip to content

Commit

Permalink
✨ Allow to customize labels in favor of i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
linx4200 committed Oct 10, 2018
1 parent 82b1706 commit de38cbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/components/Photoshop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
</div>
<div :class="['vc-ps-controls', disableFields ? 'vc-ps-controls__disable-fields' : '']">
<div class="vc-ps-previews">
<div class="vc-ps-previews__label">new</div>
<div class="vc-ps-previews__label">{{ newLabel }}</div>
<div class="vc-ps-previews__swatches">
<div class="vc-ps-previews__pr-color" :aria-label="`New color is ${colors.hex}`" :style="{background: colors.hex}"></div>
<div class="vc-ps-previews__pr-color" :aria-label="`Current color is ${currentColor}`" :style="{background: currentColor}" @click="clickCurrentColor"></div>
</div>
<div class="vc-ps-previews__label">current</div>
<div class="vc-ps-previews__label">{{ currentLabel }}</div>
</div>
<div class="vc-ps-actions" v-if="!disableFields">
<div class="vc-ps-ac-btn" role="button" :aria-label="acceptLabel" @click="handleAccept">{{ acceptLabel }}</div>
Expand Down Expand Up @@ -81,6 +81,14 @@ export default {
resetLabel: {
type: String,
default: 'Reset'
},
newLabel: {
type: String,
default: 'new'
},
currentLabel: {
type: String,
default: 'current'
}
},
components: {
Expand Down
6 changes: 5 additions & 1 deletion src/components/common/EditableInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@input="update"
ref="input"
>
<span :for="label" class="vc-input__label" :id="labelId">{{label}}</span>
<span :for="label" class="vc-input__label" :id="labelId">{{labelSpanText}}</span>
<span class="vc-input__desc">{{desc}}</span>
</div>
</template>
Expand All @@ -18,6 +18,7 @@ export default {
name: 'editableInput',
props: {
label: String,
labelText: String,
desc: String,
value: [String, Number],
max: Number,
Expand All @@ -43,6 +44,9 @@ export default {
},
labelId() {
return `input__label__${this.label}__${Math.random().toString().slice(2, 5)}`;
},
labelSpanText() {
return this.labelText || this.label;
}
},
methods: {
Expand Down

0 comments on commit de38cbf

Please sign in to comment.