Created
October 3, 2022 03:39
-
-
Save ancyrweb/719eb298415f46062734b0703fdf8b0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { Injectable } from '@nestjs/common'; | |
import { | |
render, | |
MjmlBody, | |
Mjml, | |
MjmlHead, | |
MjmlFont, | |
MjmlPreview, | |
MjmlSection, | |
MjmlColumn, | |
MjmlText, | |
} from 'mjml-react'; | |
import { CommentDTO } from './comment.interfaces'; | |
@Injectable() | |
export class CommentEmailGenerator { | |
generateCommentEmail(data: CommentDTO) { | |
const { html, errors } = render( | |
<Mjml> | |
<MjmlHead> | |
<MjmlFont | |
name="Lato" | |
href="https://fonts.googleapis.com/css?family=Lato" | |
/> | |
<MjmlPreview>A new comment has been added</MjmlPreview> | |
</MjmlHead> | |
<MjmlBody> | |
<MjmlSection> | |
<MjmlColumn> | |
<MjmlText>{data.text}</MjmlText> | |
</MjmlColumn> | |
</MjmlSection> | |
</MjmlBody> | |
</Mjml>, | |
{ validationLevel: 'soft' }, | |
); | |
return html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment