Hi!
Really enjoying the dynamic variable generators in Bricks. They’re super useful for building consistent spacing and sizing systems.
That said, I ran into a small issue that can cause some confusing results.
The problem (See screenshot):
When the scale gets very small (especially on the lower end), the generated values can flip. Meaning the min value ends up being larger than the max value. Which is super weird to use.
For example:
–space-4xs
Min: 5.24px
Max: 4.95px
That obviously doesn’t make much sense, and it kind of breaks the logic of how the system is supposed to work.
Why it’s an issue
- A minimum value being bigger than a maximum just feels wrong.
- It can lead to weird or unpredictable behavior in responsive setups for smaller screens.
- You end up having to manually fix values, which defeats the purpose of using a generator in the first place
Suggested fix:
A simple safeguard would solve this.
If the calculated min value is higher than the max value, just set it equal to the max.
–space-4xs > –space-4xs
Min: 5.24px > Max: 4.95px
Max: 4.95px > Max: 4.95px
I’ve seen this handled this way in Core Framework, and it works well. It keeps everything consistent without requiring user input.
