Skip to content

Commit

Permalink
rm unitless
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Apr 19, 2024
1 parent a890178 commit 1a630db
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/transformers/floatToPixel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {isNumber} from '../filters'
* @param value
* @returns string
*/
export const convertFloatToPixel = (token: StyleDictionary.TransformedToken, unitless?: boolean) => {
export const convertFloatToPixel = (token: StyleDictionary.TransformedToken) => {
// short circut if value is not a number
if (
typeof token.value !== 'number' ||
Expand All @@ -17,7 +17,7 @@ export const convertFloatToPixel = (token: StyleDictionary.TransformedToken, uni
// convert value
const convertedValue = token.$extensions?.['org.primer.data']?.fontSize * token.value
// return converted value
return unitless ? convertedValue : `${convertedValue}px`
return `${convertedValue}px`
}
/**
* @description converts fontFamily tokens value to string
Expand All @@ -29,6 +29,5 @@ export const floatToPixel: StyleDictionary.Transform = {
type: `value`,
transitive: true,
matcher: isNumber,
transformer: (token: StyleDictionary.TransformedToken, platform: StyleDictionary.Platform): string =>
convertFloatToPixel(token, platform.options?.unitless ?? false),
transformer: (token: StyleDictionary.TransformedToken): string => convertFloatToPixel(token),
}

0 comments on commit 1a630db

Please sign in to comment.