Skip to content

Commit

Permalink
Add className to Blankslate (#4866)
Browse files Browse the repository at this point in the history
* add classname

* extend

* Create fifty-foxes-drop.md
  • Loading branch information
langermank authored Aug 21, 2024
1 parent 6c69bff commit 587603b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-foxes-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Add `className` to Blankslate
13 changes: 10 additions & 3 deletions packages/react/src/Blankslate/Blankslate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export type BlankslateProps = React.PropsWithChildren<{
* Increase the padding of this component
*/
spacious?: boolean

className?: string
}>

const StyledBlankslate = styled.div`
Expand Down Expand Up @@ -126,13 +128,18 @@ const BlankslateContainerQuery = `
}
`

function Blankslate({border, children, narrow, spacious}: BlankslateProps) {
function Blankslate({border, children, narrow, spacious, className}: BlankslateProps) {
const enabled = useFeatureFlag('primer_react_css_modules')

if (enabled) {
return (
<div className={classes.Container}>
<div className={classes.Blankslate} data-border={border} data-narrow={narrow} data-spacious={spacious}>
<div
className={cx(classes.Blankslate, className)}
data-border={border}
data-narrow={narrow}
data-spacious={spacious}
>
{children}
</div>
</div>
Expand All @@ -147,7 +154,7 @@ function Blankslate({border, children, narrow, spacious}: BlankslateProps) {
*/}
<style type="text/css" dangerouslySetInnerHTML={{__html: BlankslateContainerQuery}} />
<StyledBlankslate>
<div className="Blankslate" data-border={border} data-narrow={narrow} data-spacious={spacious}>
<div className={cx('Blankslate', className)} data-border={border} data-narrow={narrow} data-spacious={spacious}>
{children}
</div>
</StyledBlankslate>
Expand Down

0 comments on commit 587603b

Please sign in to comment.