1
0
mirror of https://github.com/flarum/core.git synced 2025-01-17 14:18:33 +01:00

Fix email confirmation alert

Currently, the controls are on a new line due to the container div. We want to wrap ALL children of the alert, including the controls, in the container div.

We need to split it into a separate class so that we can add modify the alert vnode AFTER the alert component's `view` logic has been applied.
This commit is contained in:
Alexander Skvortsov 2020-10-03 18:47:27 -04:00
parent 27d562f3fc
commit f8a0d9459a

View File

@ -52,13 +52,18 @@ export default function alertEmailConfirmation(app) {
}
}
class ContainedAlert extends Alert {
view(vnode) {
const vdom = super.view(vnode);
return { ...vdom, children: [<div className="container">{vdom.children}</div>] };
}
}
m.mount($('<div/>').insertBefore('#content')[0], {
view: () => (
<Alert dismissible={false} controls={[<ResendButton />]}>
<div className="container">
{app.translator.trans('core.forum.user_email_confirmation.alert_message', { email: <strong>{user.email()}</strong> })}
</div>
</Alert>
<ContainedAlert dismissible={false} controls={[<ResendButton />]}>
{app.translator.trans('core.forum.user_email_confirmation.alert_message', { email: <strong>{user.email()}</strong> })}
</ContainedAlert>
),
});
}