Skip to content

Commit

Permalink
fix(SkeletonText): prevent negative px width values (#13270)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandra Davila <[email protected]>
  • Loading branch information
emyarod and aledavila authored Mar 6, 2023
1 parent b4d3e74 commit 13d5afc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react/src/components/SkeletonText/SkeletonText.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const SkeletonText = ({
useIsomorphicEffect(() => {
refs.current.map((item, j) => {
const randomPercentWidth = getRandomInt(0, 75, j) + 'px';
const randomPxWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
const randomPxWidth =
getRandomInt(Math.max(widthNum - 75, 0), widthNum, j) + 'px';

if (item) {
if (widthPercent && paragraph) {
Expand Down

0 comments on commit 13d5afc

Please sign in to comment.