@@ -30,7 +30,7 @@ export function usePopoverZIndex() {
30
30
}
31
31
32
32
export type SideModalProps = {
33
- title ? : string
33
+ title : string
34
34
subtitle ?: ReactNode
35
35
onDismiss : ( ) => void
36
36
isOpen : boolean
@@ -53,7 +53,6 @@ export function SideModal({
53
53
animate = true ,
54
54
errors,
55
55
} : SideModalProps ) {
56
- const titleId = 'side-modal-title'
57
56
const AnimatedDialogContent = animated ( Dialog . Content )
58
57
59
58
const config = { tension : 650 , mass : 0.125 }
@@ -81,40 +80,39 @@ export function SideModal({
81
80
< DialogOverlay />
82
81
< AnimatedDialogContent
83
82
className = "DialogContent ox-side-modal pointer-events-auto fixed bottom-0 right-0 top-0 z-sideModal m-0 flex w-[32rem] flex-col justify-between border-l p-0 bg-raise border-secondary elevation-2"
84
- aria-labelledby = { titleId }
85
83
style = { {
86
84
transform : x . to ( ( value ) => `translate3d(${ value } %, 0px, 0px)` ) ,
87
85
} }
86
+ // shuts off a warning from radix about dialog content needing a description
87
+ aria-describedby = { undefined }
88
88
>
89
- { title && (
90
- < Dialog . Title asChild >
91
- < >
92
- < SideModal . Title id = { titleId } title = { title } subtitle = { subtitle } />
93
-
94
- { errors && errors . length > 0 && (
95
- < div className = "mb-6" >
96
- < Message
97
- variant = "error"
98
- content = {
99
- errors . length === 1 ? (
100
- errors [ 0 ]
101
- ) : (
102
- < >
103
- < div > { errors . length } issues:</ div >
104
- < ul className = "ml-4 list-disc" >
105
- { errors . map ( ( error , idx ) => (
106
- < li key = { idx } > { error } </ li >
107
- ) ) }
108
- </ ul >
109
- </ >
110
- )
111
- }
112
- title = { errors . length > 1 ? 'Errors' : 'Error' }
113
- />
114
- </ div >
115
- ) }
116
- </ >
89
+ < div className = "items-top mb-4 mt-8" >
90
+ < Dialog . Title className = "flex w-full items-center justify-between break-words pr-8 text-sans-2xl" >
91
+ { title }
117
92
</ Dialog . Title >
93
+ { subtitle }
94
+ </ div >
95
+ { errors && errors . length > 0 && (
96
+ < div className = "mb-6" >
97
+ < Message
98
+ variant = "error"
99
+ content = {
100
+ errors . length === 1 ? (
101
+ errors [ 0 ]
102
+ ) : (
103
+ < >
104
+ < div > { errors . length } issues:</ div >
105
+ < ul className = "ml-4 list-disc" >
106
+ { errors . map ( ( error , idx ) => (
107
+ < li key = { idx } > { error } </ li >
108
+ ) ) }
109
+ </ ul >
110
+ </ >
111
+ )
112
+ }
113
+ title = { errors . length > 1 ? 'Errors' : 'Error' }
114
+ />
115
+ </ div >
118
116
) }
119
117
{ children }
120
118
</ AnimatedDialogContent >
@@ -128,26 +126,6 @@ export function SideModal({
128
126
129
127
export const ResourceLabel = classed . h3 `mt-2 flex items-center gap-1.5 text-sans-md text-accent`
130
128
131
- SideModal . Title = ( {
132
- title,
133
- id,
134
- subtitle,
135
- } : {
136
- title : string
137
- id ?: string
138
- subtitle ?: ReactNode
139
- } ) => (
140
- < div className = "items-top mb-4 mt-8" >
141
- < h2
142
- className = "flex w-full items-center justify-between break-words pr-8 text-sans-2xl"
143
- id = { id }
144
- >
145
- { title }
146
- </ h2 >
147
- { subtitle }
148
- </ div >
149
- )
150
-
151
129
// separate component because otherwise eslint thinks it's not a component and
152
130
// gets mad about the use of hooks
153
131
function SideModalBody ( { children } : { children ?: ReactNode } ) {
0 commit comments