Improve UserMessage Component
Users messages should be displayed in the same way over the whole application. I think that was the goal of the UserMessage Component. So I find that UserMessages might be very useful.
However, I see two problems:
- It is not obvious its usage as we need to do several imports if we want to use it:
import { ERROR_MESSAGE_TYPE, INFO_MESSAGE_TYPE } from '../../constants/EventTypes.js';
import UserMessage from '../../components/UserMessage.js';
Besides, I don't think constants/EventTypes is the right place for the ERROR_MESSAGE_TYPE, INFO_MESSAGE_TYPE definition.
- I would composite ErrorUserMessage, InfoUserMessage and WarningUserMesssage that will allow an easier usage. Probably just sending as props the title and the message to show. These components will use the existing UserMessage component that should be not exported.
Example:
<ErrorUserMessage title="Network connection Problem" message="An error was produced while retrieving data for the servers." />