mirror of
https://github.com/owncast/owncast.git
synced 2024-11-27 09:45:36 +03:00
a123967645
* move components folder and fix build errors Fixes https://github.com/owncast/owncast/issues/689 * Prettified Code! Co-authored-by: nebunez <nebunez@users.noreply.github.com>
26 lines
652 B
TypeScript
26 lines
652 B
TypeScript
import React, { useState } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
export const AlertMessageContext = React.createContext({
|
|
message: null,
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
setMessage: (text?: string) => null,
|
|
});
|
|
|
|
const AlertMessageProvider = ({ children }) => {
|
|
const [message, setMessage] = useState('');
|
|
|
|
const providerValue = {
|
|
message,
|
|
setMessage,
|
|
};
|
|
return (
|
|
<AlertMessageContext.Provider value={providerValue}>{children}</AlertMessageContext.Provider>
|
|
);
|
|
};
|
|
|
|
AlertMessageProvider.propTypes = {
|
|
children: PropTypes.element.isRequired,
|
|
};
|
|
|
|
export default AlertMessageProvider;
|