2023-12-14 06:06:36 -05:00
|
|
|
import Close from './close'
|
|
|
|
import usePersistedState from '../hooks/use-persisted-state'
|
2022-10-12 10:52:53 -04:00
|
|
|
|
|
|
|
type SystemMessageProps = {
|
|
|
|
id: string
|
|
|
|
children: React.ReactNode
|
|
|
|
}
|
|
|
|
|
|
|
|
function SystemMessage({ id, children }: SystemMessageProps) {
|
|
|
|
const [hidden, setHidden] = usePersistedState(
|
|
|
|
`systemMessage.hide.${id}`,
|
|
|
|
false
|
|
|
|
)
|
|
|
|
|
|
|
|
if (hidden) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li className="system-message">
|
2024-10-14 04:00:41 -04:00
|
|
|
{id !== 'protected' ? (
|
|
|
|
<Close onDismiss={() => setHidden(true)} variant="dark" />
|
|
|
|
) : null}
|
2022-10-12 10:52:53 -04:00
|
|
|
{children}
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SystemMessage
|