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 }) {
return (
<div

View File

@@ -1,55 +1,44 @@
import * as React from "react";
import { useThemeHooks } from "@redocly/theme/core/hooks";
import clsx from 'clsx'
import * as React from 'react';
import { useThemeHooks } from '@redocly/theme/core/hooks';
const alertStyle: React.CSSProperties = {
const alertStyle = {
position: "relative",
margin: "0px",
zIndex: 9999,
};
interface AlertTemplateProps {
message: string;
link: string;
button: string;
show: boolean;
zIndex: "9999",
}
export default function AlertTemplate({
message,
link,
button,
show,
}: AlertTemplateProps): React.JSX.Element {
const { useTranslate } = useThemeHooks();
const { translate } = useTranslate();
if (!show) return null;
return (
<div
className={`web-banner`}
style={{ ...alertStyle }}
>
<div className="banner-content">
<div className="event-info">{translate(message)}</div>
<button
onClick={() => window.open(link, "_blank")}
className="ticket-button"
>
<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>
// )
function typeToClass(type: string): string {
if(type === "error") {
return "alert-danger"
} else if(type === "success") {
return "alert-success"
} else if(type === "info") {
return "alert-info"
} else {
return ""
}
}
interface AlertTemplateProps {
message: string
options: {
type: string
}
style: any
close: any // Callback to close the alert early
}
export default function AlertTemplate ({ message, options, style, close }: AlertTemplateProps): React.JSX.Element {
const { useTranslate } = useThemeHooks();
const { translate } = useTranslate()
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>
)
}