Responsive values given as array-like objects
- Dominant language
- TypeScript
- Stars
- 414
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
Styled System has introduced [array-based responsive](https://styled-system.com/responsive-styles) styling, reducing the burden caused by manually written media queries.
## Details
To avoid confusion between the array and object notation, `undefined` should be preferred over `null` for skipping a breakpoint:
```js
sx({ width: [, , '25%'] }); // Good, sparse array
sx({ width: [undefined, undefined, '25%'] }); // Better, more explicit
sx({ width: { 2: '25%' } }); // Best, concise while being explicit
sx({ width: { 600: '25%' } }); // Okay, custom one-off breakpoint of >=600px
sx({ width: [null, null, '25%'] }); // Bad, null may suggest that the value gets reset
sx({ width: { 0: null, 2: '25%' } }); // Bad, null isn't necessary here
```
Contributor guide
Research direction
Start by locating the TypeScript implementation of the sx responsive-value handling and any existing tests for array and object breakpoint notation. Compare how sparse arrays, undefined values, null values, and numeric breakpoint keys are currently interpreted. Done means the documented examples behave consistently without treating null as an intentional reset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100