frenic / csstype

Strict TypeScript and Flow types for style based on MDN data
MIT License
1.73k stars 72 forks source link

How to migrate from old version to latest version #182

Open zydjohnHotmail opened 1 year ago

zydjohnHotmail commented 1 year ago

Hi, I have some code using the old version of csstype, but I am not sure it is from this repo or not. I have the following code in TypeScript: import { FontWeightProperty, ColorProperty, FontFamilyProperty, BorderColorProperty, BorderProperty, BorderRadiusProperty, HeightProperty, WidthProperty, FontSizeProperty, LineHeightProperty, PaddingProperty, MarginProperty, } from 'csstype'; / Colors / const colorWhite: ColorProperty = '#FFFFFF'; const gradientPurple: ColorProperty = linear-gradient(300.29deg, ${primaryColorLight} -9.7%, ${primaryColor} 85.28%);

/ Padding / const spacingMultiplier = 4; const spacingHalfUnit: PaddingProperty | MarginProperty = px(spacingMultiplier 0.5); / Fonts / const fontMontserrat: FontFamilyProperty = 'Montserrat, sans-serif'; const fontSizeXs: FontSizeProperty = px(10); / Border / const borderColor: BorderColorProperty = '#CCCCCC'; const borderSize: BorderProperty = px(1); / Button */ const buttonRadiusSm: BorderRadiusProperty = px(16); const buttonRadiusLg: BorderRadiusProperty = px(24);

const buttonHeightSm: HeightProperty = px(32); const buttonHeightLg: HeightProperty = px(48); And some other code to make rather complicated UI interface, the code looks nice. But I can't find any exported module in the latest version (3.1.2) having any of the imported module names. Please advise, if the above code was for npm 'csstype' old version, if yes, how can I migrate them to new version. If no, let me know if the latest version (3.1.2) "csstype" can write the similar code or not. Thanks,