Alert
Props
- anchorOrigin - (not required) position of the alert
anchorOrigin?: {
vertical: "top" | "bottom";
horizontal: "left" | "center" | "right";
}
- closeSnack - (required) function to close the alert
- state - (required) state of the alert
state: {
open: boolean;
type: "success" | "error";
message: string;
}
Usage
import { Alert } from 'react-componentry'
const App = () => {
const [state, setState] = useState({
open: false,
type: "success",
message: "This is a success alert"
})
const closeSnack = () => {
setState({
...state,
open: false
})
}
return (
<Alert
state={state}
closeSnack={closeSnack}
/>
)
}