Skip to content

Commit

Permalink
fix: snackbar crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed May 31, 2024
1 parent 676666c commit cdc1fec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/theme/src/Components/Snackbar/PopupSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { memo, useRef, useCallback } from 'react'
import { memo, useRef, useCallback, type RefAttributes } from 'react'
import { Typography, alpha, collapseClasses } from '@mui/material'
import {
SnackbarProvider,
Expand Down Expand Up @@ -80,18 +80,18 @@ export const PopupSnackbarProvider = memo<SnackbarProviderProps>(function PopupS
)
})

interface PopupSnackbarContentProps {
interface PopupSnackbarContentProps extends RefAttributes<HTMLDivElement> {
id: SnackbarKey
title: SnackbarMessage
message?: string | React.ReactNode
variant?: VariantType
}

function PopupSnackbarContent({ id, title, message, variant }: PopupSnackbarContentProps) {
function PopupSnackbarContent({ id, title, message, variant, ref }: PopupSnackbarContentProps) {
const { classes, cx } = useStyles()

return (
<SnackbarContent key={id} className={cx(classes.content, classes[variant!])}>
<SnackbarContent ref={ref} key={id} className={cx(classes.content, classes[variant!])}>
<Typography className={classes.title} component="div">
{title}
</Typography>
Expand Down
6 changes: 3 additions & 3 deletions packages/theme/src/Components/Snackbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, memo, useCallback } from 'react'
import { useRef, memo, useCallback, type RefAttributes } from 'react'
import { keyframes } from 'tss-react'
import {
SnackbarProvider,
Expand Down Expand Up @@ -186,7 +186,7 @@ const useStyles = makeStyles<StyleProps, 'title' | 'message'>()((theme, { offset
}
})

interface CustomSnackbarContentProps {
interface CustomSnackbarContentProps extends RefAttributes<HTMLDivElement> {
id: SnackbarKey
title: SnackbarMessage
message?: string | React.ReactNode
Expand Down Expand Up @@ -222,7 +222,7 @@ function CustomSnackbarContent(props: CustomSnackbarContentProps) {
renderedAction = typeof props.action === 'function' ? props.action(props.id) : props.action
}
return (
<SnackbarContent className={cx(classes.content, classes[props.variant!])}>
<SnackbarContent ref={props.ref} className={cx(classes.content, classes[props.variant!])}>
{variantIcon ?
<div className={classes.icon}>{variantIcon}</div>
: null}
Expand Down

0 comments on commit cdc1fec

Please sign in to comment.