mirror of
https://github.com/XFox111/my-website.git
synced 2026-04-22 07:28:01 +03:00
chore(ui): pre-wrap for alert message
This commit is contained in:
@@ -21,4 +21,9 @@
|
||||
{
|
||||
@include body1Stronger;
|
||||
}
|
||||
|
||||
.message
|
||||
{
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@ const AlertMessage: React.FC = async () =>
|
||||
if (!response.ok || !alertText)
|
||||
return null;
|
||||
|
||||
const title: string = alertText.split("\n", 1)[0];
|
||||
const message: string = alertText.substring(title.length);
|
||||
const title: string = alertText.split("\n", 1)[0].trim();
|
||||
const message: string = alertText.substring(title.length + 1).trim();
|
||||
|
||||
return (
|
||||
<div role="alert" className={ cls.alertBox } aria-label={ alertText }>
|
||||
<ChatWarningRegular className={ cls.icon } />
|
||||
<div>
|
||||
<p className={ cls.title }>{ title }</p>
|
||||
<p dangerouslySetInnerHTML={ { __html: message } } />
|
||||
<p className={ cls.message } dangerouslySetInnerHTML={ { __html: message } } />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user