import React, { ReactNode } from 'react'
import { InfoBox, MessageBox, Text } from '@adminjs/design-system'
import { useTranslation } from '../../hooks/index.js'
/**
* @memberof ErrorMessageBox
* @alias ErrorMessageBoxProps
*/
export type ErrorMessageBoxProps = {
title: string;
children: ReactNode;
testId?: string;
}
/**
* @class
* Prints error message
*
* @component
* @private
* @example
* return (
*
* Text below the title
*
* )
*/
const ErrorMessageBox: React.FC = (props) => {
const { children, title, testId } = props
return (
{children}
)
}
const NoResourceError: React.FC<{ resourceId: string }> = (props) => {
const { resourceId } = props
const { translateMessage } = useTranslation()
return (
{translateMessage('error404Resource', resourceId, { resourceId })}
)
}
const NoActionError: React.FC<{ resourceId: string; actionName: string }> = (props) => {
const { resourceId, actionName } = props
const { translateMessage } = useTranslation()
return (
{translateMessage('error404Action', resourceId, { resourceId, actionName })}
)
}
const NoRecordError: React.FC<{
resourceId: string;
recordId: string;
}> = (props) => {
const { resourceId, recordId } = props
const { translateMessage } = useTranslation()
return (
{translateMessage('error404Record', resourceId, { resourceId, recordId })}
)
}
export {
NoResourceError,
NoActionError,
NoRecordError,
ErrorMessageBox,
ErrorMessageBox as default,
}