Created
October 4, 2023 09:48
-
-
Save ReVoid/6c8150c0f9a48c200dbf9e1fd67ba14a to your computer and use it in GitHub Desktop.
UI Element size tokens example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SizeToken = 'XSmall' | 'Small' | 'Medium' | 'Large' | 'XLarge'; | |
type ElementSizeVariant<T = string> = T extends SizeToken ? T | 'Medium' : { width: number, height: number }; | |
type ButtonSize = ElementSizeVariant<'Small' | 'Large'>; // 'Small' | 'Large' | 'Medium'; | |
type CardSize = ElementSizeVariant; // { width: number, height: number } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment