ItsJonQ / g2

✨ An experimental reimagining of WordPress components
http://g2-components.com/
MIT License
105 stars 12 forks source link

Fix `getHeadingFontSize` types #279

Closed sarayourfriend closed 3 years ago

sarayourfriend commented 3 years ago

Allows passing size="3" OR size={3}, following the ReactText convention.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/itsjonq/g2/GKWCAKRdoYp3cg9pGhGExJuwCBg2
✅ Preview: https://g2-git-fix-getheadingfontsize-itsjonq.vercel.app

ItsJonQ commented 3 years ago

Interesting! Check out the snapshot diff:

    -   font-size: calc(1 * 13px);
    -   font-size: calc(1 * var(--wp-g2-font-size));
    +   font-size: calc((13 / 13) * 13px);
    +   font-size: calc((13 / 13) * var(--wp-g2-font-size));

Mathematically, I think it's still the same :). It looks like we'd be relying more on the CSS calc, which is fine :D

sarayourfriend commented 3 years ago

@ItsJonQ Yeah, they're mathematically the same (it made it easier to write unit tests for 😁) I'll update those snapshots, whoops!