From 7717c8e04019772a3fe08ab9a1b4a94b02d593e3 Mon Sep 17 00:00:00 2001 From: fermarinsanchez Date: Fri, 12 Jan 2024 00:32:07 +0100 Subject: [PATCH] fix(ScoreFronstage): fix float numbers to 2 decimals --- .../ScoreFronstage/Average/Average.js | 16 ++++---- .../feedback/ScoreFronstage/Badge/Badge.js | 6 ++- packages/components/src/tokens.compiled.js | 41 ++++--------------- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/packages/components/src/feedback/ScoreFronstage/Average/Average.js b/packages/components/src/feedback/ScoreFronstage/Average/Average.js index 8a99d3556..16d1becf4 100644 --- a/packages/components/src/feedback/ScoreFronstage/Average/Average.js +++ b/packages/components/src/feedback/ScoreFronstage/Average/Average.js @@ -6,14 +6,14 @@ import { Box } from '../../../layout'; const Average = ({ label, score, minGrade, maxGrade, ...props }) => { const { classes, cx } = AverageStyles({ score, minGrade }, { name: 'Average' }); - const renderScore = () => { - return ( - <> - {score.letter || score.number} - {!score.letter && {`/${maxGrade}`}} - - ); - }; + const renderScore = () => ( + <> + + {score.letter || Number.isInteger(score.number) ? score.number : score.number.toFixed(2)} + + {!score.letter && {`/${maxGrade}`}} + + ); return ( diff --git a/packages/components/src/feedback/ScoreFronstage/Badge/Badge.js b/packages/components/src/feedback/ScoreFronstage/Badge/Badge.js index 9769594da..14b7fd609 100644 --- a/packages/components/src/feedback/ScoreFronstage/Badge/Badge.js +++ b/packages/components/src/feedback/ScoreFronstage/Badge/Badge.js @@ -6,7 +6,11 @@ import { Box } from '../../../layout'; const Badge = ({ score, minGrade, nonCalificable, ...props }) => { const { classes } = BadgeStyles({ score, minGrade, nonCalificable }, { name: 'Badge' }); - return {score.letter || score.number}; + return ( + + {score.letter || Number.isInteger(score.number) ? score.number : score.number.toFixed(2)} + + ); }; Badge.defaultProps = BADGE_DEFAULT_PROPS; diff --git a/packages/components/src/tokens.compiled.js b/packages/components/src/tokens.compiled.js index c0c8660b3..ad11f90d1 100644 --- a/packages/components/src/tokens.compiled.js +++ b/packages/components/src/tokens.compiled.js @@ -1153,7 +1153,7 @@ export default { "y": 0, "blur": 4, "spread": 0, - "color": "#ffffff", + "color": "#ffffff26", "type": "dropShadow" }, "type": "boxShadow" @@ -1234,17 +1234,8 @@ export default { "type": "color" }, "hover--reverse-transparent": { - "value": "#ffffff", - "type": "color", - "$extensions": { - "studio.tokens": { - "modify": { - "type": "alpha", - "value": "0.15", - "space": "lch" - } - } - } + "value": "#ffffff26", + "type": "color" }, "down": { "value": "#F1FFBD", @@ -4939,30 +4930,12 @@ export default { "color": { "primary": { "default": { - "value": "#4D5358", - "type": "color", - "$extensions": { - "studio.tokens": { - "modify": { - "type": "alpha", - "value": "0.4", - "space": "lch" - } - } - } + "value": "#4d535866", + "type": "color" }, "hover": { - "value": "#4D5358", - "type": "color", - "$extensions": { - "studio.tokens": { - "modify": { - "type": "alpha", - "value": "0.7", - "space": "lch" - } - } - } + "value": "#4d5358b3", + "type": "color" }, "down": { "value": "#4D5358",