Skip to content

Commit 75b9c20

Browse files
langermankTylerJDev
authored andcommitted
Add missing wide CSS + className to Stack (#4957)
* add missing css + classname * Create fuzzy-jobs-deny.md
1 parent ccd8e71 commit 75b9c20

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

.changeset/fuzzy-jobs-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Add missing `wide` CSS + className to Stack

packages/react/src/Stack/Stack.docs.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
"name": "padding",
3636
"type": "'none' | 'condensed' | 'normal' | 'spacious' | ResponsiveValue<'none' | 'condensed' | 'normal' | 'spacious'>",
3737
"description": "Specify the padding of the stack container."
38+
},
39+
{
40+
"name": "className",
41+
"type": "string"
3842
}
3943
],
4044
"subcomponents": [
@@ -45,6 +49,10 @@
4549
"name": "grow",
4650
"type": "boolean | ResponsiveValue<boolean>",
4751
"description": "Allow item to keep size or expand to fill the available space."
52+
},
53+
{
54+
"name": "className",
55+
"type": "string"
4856
}
4957
]
5058
}

packages/react/src/Stack/Stack.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@ const StyledStack = styled.div`
281281
&[data-justify-wide='space-evenly'] {
282282
justify-content: space-evenly;
283283
}
284+
285+
&[data-wrap-wide='wrap'] {
286+
flex-wrap: wrap;
287+
}
288+
289+
&[data-wrap-wide='nowrap'] {
290+
flex-wrap: nowrap;
291+
}
284292
}
285293
`
286294

@@ -342,6 +350,7 @@ type StackProps<As> = React.PropsWithChildren<{
342350
* @default none
343351
*/
344352
padding?: Padding
353+
className?: string
345354
}>
346355

347356
function Stack<As extends ElementType>({
@@ -353,6 +362,7 @@ function Stack<As extends ElementType>({
353362
justify = 'start',
354363
padding = 'none',
355364
wrap = 'nowrap',
365+
className,
356366
...rest
357367
}: StackProps<As> & React.ComponentPropsWithoutRef<ElementType extends As ? As : 'div'>) {
358368
const BaseComponent = as ?? 'div'
@@ -361,6 +371,7 @@ function Stack<As extends ElementType>({
361371
<StyledStack
362372
{...rest}
363373
as={BaseComponent}
374+
className={className}
364375
{...getResponsiveAttributes('gap', gap)}
365376
{...getResponsiveAttributes('direction', direction)}
366377
{...getResponsiveAttributes('align', align)}
@@ -416,18 +427,20 @@ type StackItemProps<As> = React.PropsWithChildren<{
416427
* @default false
417428
*/
418429
grow?: boolean | ResponsiveValue<boolean>
430+
className?: string
419431
}>
420432

421433
function StackItem<As extends ElementType>({
422434
as,
423435
children,
424436
grow,
437+
className,
425438
...rest
426439
}: StackItemProps<As> & React.ComponentPropsWithoutRef<ElementType extends As ? As : 'div'>) {
427440
const BaseComponent = as ?? 'div'
428441

429442
return (
430-
<StyledStackItem {...rest} as={BaseComponent} {...getResponsiveAttributes('grow', grow)}>
443+
<StyledStackItem {...rest} as={BaseComponent} className={className} {...getResponsiveAttributes('grow', grow)}>
431444
{children}
432445
</StyledStackItem>
433446
)

0 commit comments

Comments
 (0)