1
0
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:
2025-07-22 14:50:28 +00:00
parent 1992ee8f29
commit 6d4c931091
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -21,4 +21,9 @@
{ {
@include body1Stronger; @include body1Stronger;
} }
.message
{
white-space: pre-wrap;
}
} }
+3 -3
View File
@@ -26,15 +26,15 @@ const AlertMessage: React.FC = async () =>
if (!response.ok || !alertText) if (!response.ok || !alertText)
return null; return null;
const title: string = alertText.split("\n", 1)[0]; const title: string = alertText.split("\n", 1)[0].trim();
const message: string = alertText.substring(title.length); const message: string = alertText.substring(title.length + 1).trim();
return ( return (
<div role="alert" className={ cls.alertBox } aria-label={ alertText }> <div role="alert" className={ cls.alertBox } aria-label={ alertText }>
<ChatWarningRegular className={ cls.icon } /> <ChatWarningRegular className={ cls.icon } />
<div> <div>
<p className={ cls.title }>{ title }</p> <p className={ cls.title }>{ title }</p>
<p dangerouslySetInnerHTML={ { __html: message } } /> <p className={ cls.message } dangerouslySetInnerHTML={ { __html: message } } />
</div> </div>
</div> </div>
); );