File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @primer/react " : patch
3+ ---
4+
5+ TreeView: Increase touch target size for coarse pointers
Original file line number Diff line number Diff line change @@ -169,19 +169,24 @@ const Item: React.FC<TreeViewItemProps> = ({
169169 }
170170 } }
171171 sx = { {
172+ '--toggle-width' : '1rem' , // 16px
172173 position : 'relative' ,
173174 display : 'grid' ,
174- gridTemplateColumns : `calc(${ level - 1 } * 8px) 16px 1fr` ,
175+ gridTemplateColumns : `calc(${ level - 1 } * (var(--toggle-width) / 2)) var(--toggle-width) 1fr` ,
175176 gridTemplateAreas : `"spacer toggle content"` ,
176177 width : '100%' ,
177- height : 32 ,
178+ height : '2rem' , // 32px
178179 fontSize : 1 ,
179180 color : 'fg.default' ,
180181 borderRadius : 2 ,
181182 cursor : 'pointer' ,
182183 '&:hover' : {
183184 backgroundColor : 'actionListItem.default.hoverBg'
184185 } ,
186+ '@media (pointer: coarse)' : {
187+ '--toggle-width' : '1.5rem' , // 24px
188+ height : '2.75rem' // 44px
189+ } ,
185190 // WARNING: styled-components v5.2 introduced a bug that changed
186191 // how it expands `&` in CSS selectors. The following selectors
187192 // are unnecessarily specific to work around that styled-components bug.
Original file line number Diff line number Diff line change @@ -11,7 +11,16 @@ export type BetterCssProperties = {
1111 : SystemCssProperties [ K ]
1212}
1313
14- export type BetterSystemStyleObject = BetterCssProperties | SystemStyleObject
14+ // Support CSS custom properties in the `sx` prop
15+ type CSSCustomProperties = {
16+ [ key : `--${string } `] : string | number
17+ }
18+
19+ type CSSSelectorObject = {
20+ [ cssSelector : string ] : SystemStyleObject | CSSCustomProperties
21+ }
22+
23+ export type BetterSystemStyleObject = BetterCssProperties | SystemStyleObject | CSSCustomProperties | CSSSelectorObject
1524
1625export interface SxProp {
1726 sx ?: BetterSystemStyleObject
You can’t perform that action at this time.
0 commit comments