@@ -10,6 +10,7 @@ import {
1010 splitCSVContentIntoRows ,
1111} from '@/common/utils/active-element-selector.utils' ;
1212import { useGroupShapeProps } from '../../mock-components.utils' ;
13+ import { useResizeOnFontSizeChange } from '../../front-text-components/front-text-hooks/resize-fontsize-change.hook' ;
1314
1415const buttonBarShapeSizeRestrictions : ShapeSizeRestrictions = {
1516 minWidth : 200 ,
@@ -49,13 +50,11 @@ export const ButtonBarShape = forwardRef<any, ShapeProps>((props, ref) => {
4950 const csvData = splitCSVContentIntoRows ( text ) ;
5051 const headers = extractCSVHeaders ( csvData [ 0 ] ) ;
5152 const tabLabels = headers . map ( header => header . text ) ;
52-
53+ const verticalPadding = 8 ;
5354 const dynamicTabWidth = restrictedWidth / tabLabels . length ;
5455
55- const { stroke, strokeStyle, fill, textColor } = useShapeProps (
56- otherProps ,
57- BASIC_SHAPE
58- ) ;
56+ const { stroke, strokeStyle, fill, textColor, fontSize, fontVariant } =
57+ useShapeProps ( otherProps , BASIC_SHAPE ) ;
5958
6059 const activeTab = otherProps ?. activeElement ?? 0 ;
6160
@@ -65,29 +64,30 @@ export const ButtonBarShape = forwardRef<any, ShapeProps>((props, ref) => {
6564 shapeType ,
6665 ref
6766 ) ;
67+ useResizeOnFontSizeChange ( id , { x, y } , text , fontSize , fontVariant ) ;
6868
6969 return (
7070 < Group { ...commonGroupProps } { ...shapeProps } >
7171 { tabLabels . map ( ( header , index ) => (
7272 < Group key = { index } x = { index * dynamicTabWidth } >
7373 < Rect
7474 width = { dynamicTabWidth }
75- height = { restrictedHeight }
75+ height = { restrictedHeight - verticalPadding }
7676 fill = { index === activeTab ? 'lightblue' : fill }
7777 stroke = { stroke }
7878 strokeWidth = { 1 }
7979 dash = { strokeStyle }
8080 />
8181 < Text
8282 x = { 0 }
83- y = { 18 }
83+ y = { restrictedHeight / 2 - fontSize / 2 }
8484 width = { dynamicTabWidth - 20 }
8585 height = { restrictedHeight - 20 }
8686 ellipsis = { true }
8787 wrap = "none"
8888 text = { header } // Use the header text
8989 fontFamily = "Arial"
90- fontSize = { 16 }
90+ fontSize = { fontSize }
9191 fill = { textColor }
9292 align = "center"
9393 />
0 commit comments