Skip to content

Commit 19b0741

Browse files
committed
fixes typescript errors, removes Dialog's 'sx' prop dev stories
1 parent 475b5fb commit 19b0741

File tree

2 files changed

+2
-109
lines changed

2 files changed

+2
-109
lines changed

packages/react/src/Dialog/Dialog.dev.stories.tsx

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -87,113 +87,6 @@ export const WithCss = ({width, height, subtitle}: DialogStoryProps) => {
8787
)
8888
}
8989

90-
function SxHeader({title, subtitle, dialogLabelId}: React.PropsWithChildren<DialogProps & {dialogLabelId: string}>) {
91-
if (typeof title === 'string' && typeof subtitle === 'string') {
92-
return (
93-
<Dialog.Header sx={{color: 'accent.emphasis'}}>
94-
<h1 id={dialogLabelId}>{title.toUpperCase()}</h1>
95-
</Dialog.Header>
96-
)
97-
}
98-
return null
99-
}
100-
function SxBody({children}: React.PropsWithChildren<DialogProps>) {
101-
return <Dialog.Body sx={{color: 'danger.emphasis'}}>{children}</Dialog.Body>
102-
}
103-
function SxFooter({footerButtons}: React.PropsWithChildren<DialogProps>) {
104-
return (
105-
<Dialog.Footer sx={{fontFamily: 'Times New Roman'}}>
106-
{footerButtons ? <Dialog.Buttons buttons={footerButtons} /> : null}
107-
</Dialog.Footer>
108-
)
109-
}
110-
export const WithSx = ({width, height, subtitle}: DialogStoryProps) => {
111-
const [isOpen, setIsOpen] = useState(true)
112-
const onDialogClose = useCallback(() => setIsOpen(false), [])
113-
return (
114-
<>
115-
<Button onClick={() => setIsOpen(!isOpen)}>Show dialog</Button>
116-
{isOpen && (
117-
<Dialog
118-
title="My Dialog"
119-
subtitle={subtitle ? 'This is a subtitle!' : undefined}
120-
width={width}
121-
height={height}
122-
renderHeader={SxHeader}
123-
renderBody={SxBody}
124-
renderFooter={SxFooter}
125-
onClose={onDialogClose}
126-
footerButtons={[
127-
{buttonType: 'danger', content: 'Delete the universe', onClick: onDialogClose},
128-
{buttonType: 'primary', content: 'Proceed'},
129-
]}
130-
sx={{borderColor: 'accent.emphasis', borderWidth: '1px', borderStyle: 'solid', animation: 'none !important'}}
131-
>
132-
{lipsum}
133-
</Dialog>
134-
)}
135-
</>
136-
)
137-
}
138-
139-
function SxAndCssHeader({
140-
title,
141-
subtitle,
142-
dialogLabelId,
143-
}: React.PropsWithChildren<DialogProps & {dialogLabelId: string}>) {
144-
if (typeof title === 'string' && typeof subtitle === 'string') {
145-
return (
146-
<Dialog.Header sx={{color: 'accent.emphasis'}} className="testCustomClassnameColor">
147-
<h1 id={dialogLabelId}>{title.toUpperCase()}</h1>
148-
</Dialog.Header>
149-
)
150-
}
151-
return null
152-
}
153-
function SxAndCssBody({children}: React.PropsWithChildren<DialogProps>) {
154-
return (
155-
<Dialog.Body sx={{color: 'danger.emphasis'}} className="testCustomClassnameColor">
156-
{children}
157-
</Dialog.Body>
158-
)
159-
}
160-
function SxAndCssFooter({footerButtons}: React.PropsWithChildren<DialogProps>) {
161-
return (
162-
<Dialog.Footer sx={{fontFamily: 'Times New Roman'}} className="testCustomClassnameMono">
163-
{footerButtons ? <Dialog.Buttons buttons={footerButtons} /> : null}
164-
</Dialog.Footer>
165-
)
166-
}
167-
export const WithSxAndCss = ({width, height, subtitle}: DialogStoryProps) => {
168-
const [isOpen, setIsOpen] = useState(true)
169-
const onDialogClose = useCallback(() => setIsOpen(false), [])
170-
return (
171-
<>
172-
<Button onClick={() => setIsOpen(!isOpen)}>Show dialog</Button>
173-
{isOpen && (
174-
<Dialog
175-
title="My Dialog"
176-
subtitle={subtitle ? 'This is a subtitle!' : undefined}
177-
width={width}
178-
height={height}
179-
renderHeader={SxAndCssHeader}
180-
renderBody={SxAndCssBody}
181-
renderFooter={SxAndCssFooter}
182-
onClose={onDialogClose}
183-
footerButtons={[
184-
{buttonType: 'danger', content: 'Delete the universe', onClick: onDialogClose},
185-
{buttonType: 'primary', content: 'Proceed'},
186-
]}
187-
sx={{borderColor: 'border.accent', borderWidth: '1px', borderStyle: 'solid', animation: 'none !important'}}
188-
className="testCustomClassnameBorder"
189-
>
190-
{lipsum}
191-
</Dialog>
192-
)}
193-
</>
194-
)
195-
}
196-
19790
export const WithScrollBody = () => {
19891
const [isOpen, setIsOpen] = useState(false)
19992
const buttonRef = useRef<HTMLButtonElement>(null)

packages/react/src/Dialog/Dialog.features.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ function CustomHeader({
7979
return null
8080
}
8181
function CustomBody({children}: React.PropsWithChildren<DialogProps>) {
82-
return <Dialog.Body sx={{bg: 'danger.subtle'}}>{children}</Dialog.Body>
82+
return <Dialog.Body style={{backgroundColor: 'var(--bgColor-danger-muted)'}}>{children}</Dialog.Body>
8383
}
8484
function CustomFooter({footerButtons}: React.PropsWithChildren<DialogProps>) {
8585
return (
86-
<Dialog.Footer sx={{bg: 'attention.subtle'}}>
86+
<Dialog.Footer style={{backgroundColor: 'var(--bgColor-attention-muted)'}}>
8787
{footerButtons ? <Dialog.Buttons buttons={footerButtons} /> : null}
8888
</Dialog.Footer>
8989
)

0 commit comments

Comments
 (0)