Closed devdoomari closed 7 years ago
The way I would write that is:
import { style } from 'typestyle';
import { percent } from 'csx';
const $baseXpos = 108;
const class2 = style({
width: percent($baseXpos *2)
});
We have helpers that suffix with the right unit. I think it might be overkill to do a fluent api when straightforward TypeScript can do the same thing.
@notoriousb1t I wondered if that would be ok for the original writer of code, who might have intended $baseXpos to be of 'percent'... (e.g. cannot be used in a wrong context)
but I guess that's ok - think I can persuade him if he complains :+1:
I'm converting a sass-style to typestyle, so this might be a 'sass-minded' mode of thinking...
Here's an old code that uses 'variables' in sass:
as you can see, $baseXpos is in 'percent', and it's multiplication-able.
What do you think about having an extra-api for value manipulation? e.g: