mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 04:05:49 +00:00
Update convert-template Add basic page Add it to the sidebar Fix a broken link Fix translate usage and add linebreaks Fix indents Add basic sidebar Port over init button logic Migrate submit_and_notify and start dest addr Get the payment button working Componentize the Send XRP Payment button Add basic escrow button Componentize payment channel Migrate Trust For Migrate Send Issued Currency Add partial payment progres bar logic Use the component for the partial payment Add support for escrow finish Log transactions in sidebar Debugging partial payment setup Add support for changing destinationAddress Finish adding bootstrap growl notifications Use 'client' instead of 'api' Move DestinationAddressInput to component and remove ids Split the page into separate files Remove the old files for this page Update links Add space Add comment deprecating bootstrap-growl jquery Fix typing errors PR Comments Pt 1 Small PR fixes Encapsulate isValidDestinationAddress
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import clsx from 'clsx'
|
||
import * as React from 'react';
|
||
import { useTranslate } from '@portal/hooks';
|
||
|
||
const alertStyle = {
|
||
position: "relative",
|
||
margin: "0px",
|
||
zIndex: "9999",
|
||
}
|
||
|
||
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 { 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>
|
||
)
|
||
}
|