Closed with-heart closed 2 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/devdaojobboard/dao-job-board/DCDAea2m6jjD9pM31h15T8XpzJKG
✅ Preview: https://dao-job-board-git-clean-up-responsive-props-devdaojobboard.vercel.app
This PR cleans up the way we're using responsive object props.
There are three types of cleanup involved here. I think it's easier to explain the responsive object prop syntax as a whole first, so that it's obvious why there are three types of cleanup.
How responsive object props syntax works
When specifying responsive objects, it's important to always start with a
base
value. Thebase
is basically the default value for that prop.To make this responsive, we can add keys for specific breakpoints. If a breakpoint isn't defined, it will use the value from the definition of the next smallest breakpoint that is defined. If there isn't a smaller breakpoint defined, the
base
value is used.Essentially we can look at the priority like this:
base
< definition for breakpoint smaller than user's breakpoint < exact definition for user's breakpointHere's the breakdown of the values at each breakpoint for the above example:
sm
16px
sm
16px
md
18px
lg
18px
xl
24px
2xl
24px
We didn't need to define values for
sm
,lg
, or2xl
because they fall back to the definition of the next smallest defined breakpoint.sm
falls back tobase
,lg
falls back tomd
, and2xl
falls back toxl
.Types of cleanup
base
key. Some of them started withsm
which will break for screen sizes smaller than thesm
breakpoint.base
,sm
andmd
, we only need to definebase
assm
andmd
will fall back to thebase
value.base
and any other breakpoint, we don't need to use responsive syntax at all.