Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
bugfix(template) established product template (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
derpdead authored and bleto committed Jan 23, 2020
1 parent 1b5ef4f commit 7ce2125
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 14 deletions.
4 changes: 2 additions & 2 deletions components/Forms/ProductTemplateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ export default {
case TYPES.MULTI_SELECT:
return ProductTemplateOptions;
case TYPES.NUMERIC:
return ProductTemplateNumeric;
case TYPES.TEXT:
case TYPES.UNIT:
case TYPES.PRICE:
return ProductTemplateNumeric;
case TYPES.TEXT:
return ProductTemplateSingleLine;
case 'SECTION TITLE':
return ProductTemplateSection;
Expand Down
2 changes: 1 addition & 1 deletion components/Icon/BaseIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns="http://www.w3.org/2000/svg"
:width="width"
:height="height"
viewBox="0 0 24 24"
:viewBox="`0 0 ${width} ${height}`"
:aria-label="iconName"
role="presentation">
<g :fill="iconColor">
Expand Down
39 changes: 39 additions & 0 deletions components/Icon/Others/IconResize.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright © Bold Brand Commerce Sp. z o.o. All rights reserved.
* See LICENSE for license details.
*/
<template>
<BaseIcon
:width="size"
:height="size"
:icon-color="fillColor">
<path :d="drawingCommands" />
</BaseIcon>
</template>

<script>
import BaseIcon from '~/components/Icon/BaseIcon';
import { GRAPHITE } from '~/assets/scss/_variables/_colors.scss';
export default {
name: 'IconResize',
components: {
BaseIcon,
},
props: {
fillColor: {
type: String,
default: GRAPHITE,
},
size: {
type: [String, Number],
default: '24',
},
},
data() {
return {
drawingCommands: 'M7 1H8V2H7V1ZM6 3V2H7V3H6ZM5 4V3H6V4H5ZM4 5V4H5V5H4ZM3 6V5H4V6H3ZM2 7V6H3V7H2ZM2 7V8H1V7H2ZM7 6H6V7H5V8H6V7H7V6ZM7 6V5H8V6H7Z',
};
},
};
</script>
2 changes: 1 addition & 1 deletion components/Template/Product/ProductTemplateNumeric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
},
computed: {
inputType() {
return { type: 'text' };
return { type: 'number' };
},
},
watch: {
Expand Down
7 changes: 5 additions & 2 deletions components/Template/Product/ProductTemplateSingleLine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ export default {
},
},
watch: {
value() {
this.localValue = this.value;
value: {
immediate: true,
handler() {
this.localValue = this.value;
},
},
},
};
Expand Down
1 change: 0 additions & 1 deletion components/Template/ProductDesigner/ElementContentBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default {
padding-left: 10px;
background-color: $WHITESMOKE;
overflow: hidden;
resize: both;
&--disabled {
resize: none;
Expand Down
15 changes: 9 additions & 6 deletions components/Template/ProductDesigner/LayoutElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
@dragstart="onDragStart"
@dragend="onDragEnd">
<slot name="content" />
<div
<IconResize
v-if="!disabled"
size="8"
class="layout-element__resizer"
@mousedown="initResizeDrag" />
@mousedown.native="initResizeDrag" />
</div>
</template>

Expand Down Expand Up @@ -42,12 +43,16 @@ import {
removeLayoutElementCopyFromDocumentBody,
} from '~/model/template_designer/layout/LayoutElementCopy';
import { DRAGGED_ELEMENT } from '~/defaults/grid';
import IconResize from '~/components/Icon/Others/IconResize';
const registerResizeEventListenersModule = () => import('~/model/resize/registerResizeEventListeners');
const unregisterResizeEventListenersModule = () => import('~/model/resize/unregisterResizeEventListeners');
export default {
name: 'LayoutElement',
components: {
IconResize,
},
props: {
index: {
type: Number,
Expand Down Expand Up @@ -343,10 +348,8 @@ export default {
&__resizer {
position: absolute;
bottom: 0;
right: 0;
width: 10px;
height: 10px;
bottom: 2px;
right: 2px;
cursor: se-resize;
}
Expand Down
3 changes: 2 additions & 1 deletion core/components/Hints/ErrorHint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<label
class="info-hint"
:title="hint">
<IconError size="16" />
<IconError size="24" />
</label>
</template>

Expand Down Expand Up @@ -34,5 +34,6 @@ export default {
align-items: center;
width: 24px;
height: 24px;
transform: scale(0.8);
}
</style>

0 comments on commit 7ce2125

Please sign in to comment.