Skip to content

Commit b722c78

Browse files
committed
Return alertTemplate to original state remove non used code
1 parent a782ef0 commit b722c78

File tree

2 files changed

+37
-61
lines changed

2 files changed

+37
-61
lines changed

@theme/components/Navbar/Navbar.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,6 @@ export function Navbar(props) {
158158
);
159159
}
160160

161-
export function XrplApexEvent({ message, button, link, show, date }) {
162-
const { useTranslate } = useThemeHooks();
163-
const { translate } = useTranslate();
164-
if (show) {
165-
return (
166-
<div className="xrpl-apex-event">
167-
168-
</div>
169-
);
170-
}
171-
return null;
172-
}
173-
174161
export function TopNavCollapsible({ children }) {
175162
return (
176163
<div
Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,44 @@
1-
import * as React from "react";
2-
import { useThemeHooks } from "@redocly/theme/core/hooks";
3-
4-
const alertStyle: React.CSSProperties = {
1+
import clsx from 'clsx'
2+
import * as React from 'react';
3+
import { useThemeHooks } from '@redocly/theme/core/hooks';
4+
5+
const alertStyle = {
56
position: "relative",
67
margin: "0px",
7-
zIndex: 9999,
8-
};
9-
interface AlertTemplateProps {
10-
message: string;
11-
link: string;
12-
button: string;
13-
show: boolean;
8+
zIndex: "9999",
9+
}
10+
11+
function typeToClass(type: string): string {
12+
if(type === "error") {
13+
return "alert-danger"
14+
} else if(type === "success") {
15+
return "alert-success"
16+
} else if(type === "info") {
17+
return "alert-info"
18+
} else {
19+
return ""
20+
}
1421
}
1522

16-
export default function AlertTemplate({
17-
message,
18-
link,
19-
button,
20-
show,
21-
}: AlertTemplateProps): React.JSX.Element {
23+
interface AlertTemplateProps {
24+
message: string
25+
options: {
26+
type: string
27+
}
28+
style: any
29+
close: any // Callback to close the alert early
30+
}
31+
32+
export default function AlertTemplate ({ message, options, style, close }: AlertTemplateProps): React.JSX.Element {
2233
const { useTranslate } = useThemeHooks();
23-
const { translate } = useTranslate();
24-
if (!show) return null;
25-
return (
26-
<div
27-
className={`web-banner`}
28-
style={{ ...alertStyle }}
29-
>
30-
<div className="banner-content">
31-
<div className="event-info">{translate(message)}</div>
32-
<button
33-
onClick={() => window.open(link, "_blank")}
34-
className="ticket-button"
35-
>
36-
<span className="button-text">{translate(button)}</span>
37-
<img
38-
src="https://cdn.builder.io/api/v1/image/assets/7f21b7559e5f46cebba4373859bcb6b5/bb74a0f169c7bf5ebfe70eabaef024556dd89f9a3e47a03da76851b4f66dab43?apiKey=7f21b7559e5f46cebba4373859bcb6b5&"
39-
alt=""
40-
className="button-icon"
41-
/>
42-
</button>
43-
</div>
34+
const { translate } = useTranslate()
35+
return(
36+
<div className={clsx("bootstrap-growl alert alert-dismissible", typeToClass(options.type))} style={{ ...alertStyle, ...style }}>
37+
<button className="close" data-dismiss="alert" type="button" onClick={close}>
38+
<span aria-hidden="true">×</span>
39+
<span className="sr-only">{translate("Close")}</span>
40+
</button>
41+
{message}
4442
</div>
45-
);
46-
// return(
47-
// <div className={clsx("bootstrap-growl alert alert-dismissible", typeToClass(options.type))} style={{ ...alertStyle, ...style }}>
48-
// <button className="close" data-dismiss="alert" type="button" onClick={close}>
49-
// <span aria-hidden="true">×</span>
50-
// <span className="sr-only">{translate("Close")}</span>
51-
// </button>
52-
// {message}
53-
// </div>
54-
// )
43+
)
5544
}

0 commit comments

Comments
 (0)