Specifyapp / parsers

Specify helps you unify your brand identity by collecting, storing and distributing design tokens and assets — automatically.
https://specifyapp.com
Other
111 stars 15 forks source link

[to-tailwind] fontSizeFormat should also change units for line-height and letter-spacing #181

Closed abdavid closed 1 year ago

abdavid commented 1 year ago

👋

We are currently going through accessibility testing and have identified that line-heights are exported in px regardless of the fontSizeFormat option.

My suggestion is as follows;

Line height:

https://github.com/Specifyapp/parsers/blob/00b3e41aa7b9e8fe9663b7978fd9d69d4c96a3c9/parsers/to-tailwind/tokens/textStyle.ts#L23-L24

IF the line height is unitless, then do not do any convertion. IF the line height is not unitless then ensure that the configuration option fontSizeFormat is used for converting the measurement like shown here.

https://github.com/Specifyapp/parsers/blob/00b3e41aa7b9e8fe9663b7978fd9d69d4c96a3c9/parsers/to-tailwind/tokens/textStyle.ts#L43-L46

Letter spacing:

https://github.com/Specifyapp/parsers/blob/00b3e41aa7b9e8fe9663b7978fd9d69d4c96a3c9/parsers/to-tailwind/tokens/textStyle.ts#L19-L20

IF fontSizeFormat is not set, then do not do any convertion. IF the letter spacing is not the same unit as the configuration option fontSizeFormat then convert the measurement like shown here.

https://github.com/Specifyapp/parsers/blob/00b3e41aa7b9e8fe9663b7978fd9d69d4c96a3c9/parsers/to-tailwind/tokens/textStyle.ts#L43-L46

ChucKN0risK commented 1 year ago

Thanks for your suggestion @abdavid. I agree with you and we'll update the to-tailwind parser accordingly. I'll let you once it's deployed :)