Skip to content

Commit 38cf5c8

Browse files
committed
font variant to resize
1 parent f0ffe53 commit 38cf5c8

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/common/components/mock-components/front-rich-components/horizontal-menu/horizontal-menu.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
splitCSVContentIntoRows,
1111
} from '@/common/utils/active-element-selector.utils';
1212
import { useGroupShapeProps } from '../../mock-components.utils';
13+
import { useResizeOnFontSizeChange } from '../../front-text-components/front-text-hooks/resize-fontsize-change.hook';
1314

1415
const horizontalMenuShapeSizeRestrictions: ShapeSizeRestrictions = {
1516
minWidth: 200,
@@ -54,8 +55,15 @@ export const HorizontalMenu = forwardRef<any, ShapeProps>((props, ref) => {
5455
const totalMargins = restrictedWidth - itemSpacing * (numberOfItems + 1);
5556
const itemWidth = totalMargins / numberOfItems;
5657

57-
const { stroke, strokeStyle, fill, textColor, borderRadius, fontSize } =
58-
useShapeProps(otherProps, BASIC_SHAPE);
58+
const {
59+
stroke,
60+
strokeStyle,
61+
fill,
62+
textColor,
63+
borderRadius,
64+
fontSize,
65+
fontVariant,
66+
} = useShapeProps(otherProps, BASIC_SHAPE);
5967

6068
const itemVerticalPadding = 4;
6169

@@ -67,7 +75,7 @@ export const HorizontalMenu = forwardRef<any, ShapeProps>((props, ref) => {
6775
shapeType,
6876
ref
6977
);
70-
78+
useResizeOnFontSizeChange(id, { x, y }, text, fontSize, fontVariant);
7179
return (
7280
<Group {...commonGroupProps} {...shapeProps}>
7381
<Rect
@@ -102,6 +110,7 @@ export const HorizontalMenu = forwardRef<any, ShapeProps>((props, ref) => {
102110
align="center"
103111
wrap="none"
104112
ellipsis={true}
113+
fontVariant={fontVariant}
105114
/>
106115
</Group>
107116
))}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const generateDefaultOtherProps = (
4949
borderRadius: `${BASIC_SHAPE.DEFAULT_CORNER_RADIUS}`,
5050
activeElement: 0,
5151
fontSize: FONT_SIZE_VALUES.NORMALTEXT,
52+
fontVariant: `${INPUT_SHAPE.DEFAULT_FONT_VARIANT}`,
5253
};
5354
case 'datepickerinput':
5455
case 'timepickerinput':

0 commit comments

Comments
 (0)