Return alertTemplate to original state remove non used code

This commit is contained in:
akcodez
2025-02-18 11:42:04 -08:00
parent a782ef0f1c
commit b722c784fd
2 changed files with 39 additions and 63 deletions

View File

@@ -158,19 +158,6 @@ export function Navbar(props) {
); );
} }
export function XrplApexEvent({ message, button, link, show, date }) {
const { useTranslate } = useThemeHooks();
const { translate } = useTranslate();
if (show) {
return (
<div className="xrpl-apex-event">
</div>
);
}
return null;
}
export function TopNavCollapsible({ children }) { export function TopNavCollapsible({ children }) {
return ( return (
<div <div

View File

@@ -1,55 +1,44 @@
import * as React from "react"; import clsx from 'clsx'
import { useThemeHooks } from "@redocly/theme/core/hooks"; import * as React from 'react';
import { useThemeHooks } from '@redocly/theme/core/hooks';
const alertStyle: React.CSSProperties = {
const alertStyle = {
position: "relative", position: "relative",
margin: "0px", margin: "0px",
zIndex: 9999, zIndex: "9999",
}; }
interface AlertTemplateProps {
message: string; function typeToClass(type: string): string {
link: string; if(type === "error") {
button: string; return "alert-danger"
show: boolean; } else if(type === "success") {
return "alert-success"
} else if(type === "info") {
return "alert-info"
} else {
return ""
}
} }
export default function AlertTemplate({ interface AlertTemplateProps {
message, message: string
link, options: {
button, type: string
show, }
}: AlertTemplateProps): React.JSX.Element { style: any
const { useTranslate } = useThemeHooks(); close: any // Callback to close the alert early
const { translate } = useTranslate(); }
if (!show) return null;
return ( export default function AlertTemplate ({ message, options, style, close }: AlertTemplateProps): React.JSX.Element {
<div const { useTranslate } = useThemeHooks();
className={`web-banner`} const { translate } = useTranslate()
style={{ ...alertStyle }} return(
> <div className={clsx("bootstrap-growl alert alert-dismissible", typeToClass(options.type))} style={{ ...alertStyle, ...style }}>
<div className="banner-content"> <button className="close" data-dismiss="alert" type="button" onClick={close}>
<div className="event-info">{translate(message)}</div> <span aria-hidden="true">×</span>
<button <span className="sr-only">{translate("Close")}</span>
onClick={() => window.open(link, "_blank")} </button>
className="ticket-button" {message}
> </div>
<span className="button-text">{translate(button)}</span> )
<img
src="https://cdn.builder.io/api/v1/image/assets/7f21b7559e5f46cebba4373859bcb6b5/bb74a0f169c7bf5ebfe70eabaef024556dd89f9a3e47a03da76851b4f66dab43?apiKey=7f21b7559e5f46cebba4373859bcb6b5&"
alt=""
className="button-icon"
/>
</button>
</div>
</div>
);
// return(
// <div className={clsx("bootstrap-growl alert alert-dismissible", typeToClass(options.type))} style={{ ...alertStyle, ...style }}>
// <button className="close" data-dismiss="alert" type="button" onClick={close}>
// <span aria-hidden="true">×</span>
// <span className="sr-only">{translate("Close")}</span>
// </button>
// {message}
// </div>
// )
} }