Skip to content

Commit

Permalink
Merge pull request #174 from Lemoncode/feature/#128-make-radio-button…
Browse files Browse the repository at this point in the history
…-editable

Feature/#128 Made radio button editable
  • Loading branch information
brauliodiez authored Aug 12, 2024
2 parents c456adf + f4acfa6 commit 2c4704e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/components/front-components/radiobutton-shape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const radioButtonShapeRestrictions: ShapeSizeRestrictions = {
};

export const RadioButtonShape = forwardRef<any, ShapeProps>(
({ x, y, width, height, id, onSelected, ...shapeProps }, ref) => {
({ x, y, width, height, id, onSelected, text, ...shapeProps }, ref) => {
const { width: restrictedWidth, height: restrictedHeight } =
fitSizeToShapeSizeRestrictions(
radioButtonShapeRestrictions,
Expand Down Expand Up @@ -62,7 +62,7 @@ export const RadioButtonShape = forwardRef<any, ShapeProps>(
<Text
x={radius * 2 + 10}
y={radius * 0.5 + 5}
text="Select me!"
text={text}
fontFamily="Comic Sans MS, cursive"
fontSize={20}
fill="none"
Expand Down
3 changes: 3 additions & 0 deletions src/pods/canvas/canvas.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const doesShapeAllowInlineEdition = (shapeType: ShapeType): boolean => {
case 'button':
case 'textarea':
case 'accordion':
case 'radiobutton':
return true;
default:
return false;
Expand All @@ -147,6 +148,8 @@ const generateDefaultTextValue = (shapeType: ShapeType): string | undefined => {
return 'Select an option';
case 'button':
return 'Click Me!';
case 'radiobutton':
return 'Select me!';
case 'textarea':
return 'Your text here...';
case 'accordion':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const renderRadioButton = (
onDragEnd={handleDragEnd(shape.id)}
onTransform={handleTransform}
onTransformEnd={handleTransform}
isEditable={shape.allowsInlineEdition}
text={shape.text}
/>
);
};

0 comments on commit 2c4704e

Please sign in to comment.