✨(frontend) add narrow "alert" dialog mode for concise messages
Introduce new narrow-width alert dialog variant to improve readability of short messages by preventing excessively long line lengths that occur when brief alerts use standard dialog widths.
This commit is contained in:
committed by
aleb_the_flash
parent
3dc23be101
commit
214dc87b1f
@@ -28,6 +28,10 @@ const box = cva({
|
|||||||
width: '30rem',
|
width: '30rem',
|
||||||
maxWidth: '100%',
|
maxWidth: '100%',
|
||||||
},
|
},
|
||||||
|
alert: {
|
||||||
|
width: '24rem',
|
||||||
|
maxWidth: '100%',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
variant: {
|
variant: {
|
||||||
light: {
|
light: {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export type DialogProps = RACDialogProps & {
|
|||||||
* after user interaction
|
* after user interaction
|
||||||
*/
|
*/
|
||||||
onOpenChange?: (isOpen: boolean) => void
|
onOpenChange?: (isOpen: boolean) => void
|
||||||
type?: 'flex'
|
type?: 'flex' | 'alert'
|
||||||
innerRef?: MutableRefObject<HTMLDivElement | null>
|
innerRef?: MutableRefObject<HTMLDivElement | null>
|
||||||
size?: 'full' | 'large'
|
size?: 'full' | 'large'
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,12 @@ export const Dialog = ({
|
|||||||
...dialogProps
|
...dialogProps
|
||||||
}: DialogProps) => {
|
}: DialogProps) => {
|
||||||
const isAlert = dialogProps['role'] === 'alertdialog'
|
const isAlert = dialogProps['role'] === 'alertdialog'
|
||||||
const boxType = dialogProps['type'] !== 'flex' ? 'dialog' : undefined
|
const boxType =
|
||||||
|
dialogProps['type'] === 'alert'
|
||||||
|
? 'alert'
|
||||||
|
: dialogProps['type'] !== 'flex'
|
||||||
|
? 'dialog'
|
||||||
|
: undefined
|
||||||
return (
|
return (
|
||||||
<StyledModalOverlay
|
<StyledModalOverlay
|
||||||
isKeyboardDismissDisabled={isAlert}
|
isKeyboardDismissDisabled={isAlert}
|
||||||
|
|||||||
Reference in New Issue
Block a user