[system] Allow `theme.spacing()` to return a number
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Motivation 🔦
I love the spacing utility function because it makes keeping spacing consistent throughout an application very easy, but in some cases, I want to tweak the value returned by it a little. This is currently quite difficult because the function always returns a string with "px" appended to it.
Currently, if I want to, for example, add 2 to the return value of the spacing function, I would have to do something like this:
`${Number(theme.spacing(3).slice(0, -2)) + 2}px`
I did check to see if the spacing value provided to createTheme() was exposed anywhere in the Theme object, but it didn't look like it was.
- I have searched the issues of this repository and believe that this is not a duplicate.
Summary 💡
There should be some way (possibly a fifth argument?) to make the spacing function return a number. If this isn't possible, then the spacing multiplier value provided to createTheme() should be exposed somewhere in the Theme object so that developers can use it to do the multiplication themselves.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the theme.spacing and createTheme entry points described in the issue, then inspect how spacing values are represented and tested. Determine which API behavior is intended, such as numeric output or exposing the multiplier; done means the chosen behavior is supported without string parsing and is covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- design, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100