Skip to content

Commit a45c905

Browse files
Aarti Nanwani SamtaniAarti Nanwani Samtani
authored andcommitted
add stroke & icon size properties
1 parent 06d965f commit a45c905

5 files changed

Lines changed: 33 additions & 6 deletions

File tree

src/common/components/mock-components/front-basic-shapes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export * from './large-arrow-shape';
1010
export * from './image-shape';
1111
export * from './modal-cover-shape';
1212
export * from './cilinder-basic-shape';
13-
export * from './mouse-cursor-basic-shape';
13+
export * from './mouse-cursor/mouse-cursor-basic-shape';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { IconSize } from '@/core/model';
2+
3+
export const returnIconSize = (iconSize: IconSize): number[] => {
4+
switch (iconSize) {
5+
case 'XS':
6+
return [25, 25];
7+
case 'S':
8+
return [50, 50];
9+
case 'M':
10+
return [100, 100];
11+
case 'L':
12+
return [125, 125];
13+
case 'XL':
14+
return [150, 150];
15+
default:
16+
return [50, 50];
17+
}
18+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './mouse-cursor-basic-shape';

src/common/components/mock-components/front-basic-shapes/mouse-cursor-basic-shape.tsx renamed to src/common/components/mock-components/front-basic-shapes/mouse-cursor/mouse-cursor-basic-shape.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { ShapeSizeRestrictions, ShapeType, BASE_ICONS_URL } from '@/core/model';
22
import { forwardRef, useEffect, useState } from 'react';
3-
import { ShapeProps } from '../shape.model';
3+
import { ShapeProps } from '../../shape.model';
44
import { loadSvgWithFill } from '@/common/utils/svg.utils';
55
import { Group, Image } from 'react-konva';
66
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions';
7-
import { returnIconSize } from '../front-components/icon/icon-shape.business';
8-
import { useGroupShapeProps } from '../mock-components.utils';
7+
import { returnIconSize } from './icon-shape.business';
8+
import { useGroupShapeProps } from '../../mock-components.utils';
9+
import { useShapeProps } from '../../../shapes/use-shape-props.hook';
10+
import { BASIC_SHAPE } from '../../front-components/shape.const';
911

1012
const MouseCursorSizeRestrictions: ShapeSizeRestrictions = {
1113
minWidth: 25,
@@ -43,6 +45,7 @@ export const MouseCursorShape = forwardRef<any, ShapeProps>((props, ref) => {
4345
);
4446

4547
const { width: restrictedWidth, height: restrictedHeight } = restrictedSize;
48+
const { stroke } = useShapeProps(otherProps, BASIC_SHAPE);
4649
const commonGroupProps = useGroupShapeProps(
4750
props,
4851
restrictedSize,
@@ -54,10 +57,10 @@ export const MouseCursorShape = forwardRef<any, ShapeProps>((props, ref) => {
5457
//const imgRef = useRef(null);
5558
const fileName = 'cursor.svg';
5659
useEffect(() => {
57-
loadSvgWithFill(`${BASE_ICONS_URL}${fileName}`, '').then(img => {
60+
loadSvgWithFill(`${BASE_ICONS_URL}${fileName}`, `${stroke}`).then(img => {
5861
setImage(img);
5962
});
60-
}, []);
63+
}, [stroke]);
6164
return (
6265
<Group {...commonGroupProps} {...shapeProps}>
6366
{image && (

src/pods/canvas/model/shape-other-props.utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ export const generateDefaultOtherProps = (
266266
iconSize: 'M',
267267
stroke: BASIC_SHAPE.DEFAULT_STROKE_COLOR,
268268
};
269+
case 'mouseCursor':
270+
return {
271+
stroke: BASIC_SHAPE.DEFAULT_STROKE_COLOR,
272+
iconSize: 'M',
273+
};
269274
case 'image':
270275
return {
271276
imageSrc: '',

0 commit comments

Comments
 (0)