Skip to content

hot fix for dinamic size of font for buttonBox component#337

Merged
anovazzi1 merged 2 commits into
devfrom
examplesHotFix
May 24, 2023
Merged

hot fix for dinamic size of font for buttonBox component#337
anovazzi1 merged 2 commits into
devfrom
examplesHotFix

Conversation

@anovazzi1
Copy link
Copy Markdown
Contributor

Dynamic Font Size for ButtonBox Component

Description

The ButtonBox component, which is used in the examples modal, has been enhanced to have a dynamic font size that adjusts based on the length of the text and the dimensions of its parent element. This improvement ensures that the text within the ButtonBox component remains readable and properly fits within its container.

Changes Made

  • Added a new fontSize state variable to track the font size within the ButtonBox component.
  • Utilized the useEffect hook to calculate and update the font size dynamically.
  • Implemented logic to check for both vertical and horizontal overflow of the text within the parent container.
  • Decreased the font size incrementally until the text fits within the parent element's dimensions.
  • Updated the component to apply the calculated font size to the text element.

Testing Done

  • Manually tested the ButtonBox component with various text lengths and parent container dimensions.
  • Verified that the font size was adjusted correctly to fit the text within the parent element without overflowing.

@anovazzi1 anovazzi1 requested a review from lucaseduoli May 23, 2023 19:35
@anovazzi1 anovazzi1 merged commit 0c45186 into dev May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant