/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { useHistory } from "react-router-dom"; import { LocationState } from "../models"; import Alert from "../components/Alert"; import Link from "../components/Link"; import { useTranslation } from "react-i18next"; interface Props { id?: string; } function AlertContainer(props: Props) { const history = useHistory(); const { t } = useTranslation(); const { state } = history.location; if (!state || !state.alert || state.id !== props.id) { return null; } return (
{state.alert.message}{" "} {state.alert.linkLabel}
) : ( state.alert.message ) } slim /> ); } export default AlertContainer;