2024-04-11 16:48:52 +02:00
|
|
|
import { Body, Container, Html, Markdown, Preview } from 'jsx-email'
|
2024-04-04 14:34:42 +02:00
|
|
|
import { Signature } from './components/Signature.tsx'
|
2024-04-02 14:45:12 +02:00
|
|
|
import type { Template } from '../types.ts'
|
2024-04-11 16:48:52 +02:00
|
|
|
import { BaseStyle, bodyCss, messageCss, textCss } from './styles/base.tsx'
|
2024-07-15 14:27:53 +02:00
|
|
|
import type { JSX } from 'preact'
|
2024-04-02 14:45:12 +02:00
|
|
|
|
|
|
|
function Message(
|
|
|
|
{ summary, body }: { summary?: string; body: string },
|
2024-07-15 14:27:53 +02:00
|
|
|
): JSX.Element {
|
2024-04-02 14:45:12 +02:00
|
|
|
return (
|
2024-04-11 16:48:52 +02:00
|
|
|
<Html lang='fr' style={{ fontSize: '14px' }}>
|
|
|
|
<BaseStyle />
|
2024-04-02 14:45:12 +02:00
|
|
|
<Preview>{summary}</Preview>
|
2024-04-11 16:48:52 +02:00
|
|
|
<Body style={bodyCss}>
|
|
|
|
<Container style={messageCss}>
|
|
|
|
<Markdown style={textCss}>{body}</Markdown>
|
|
|
|
</Container>
|
2024-04-02 17:28:35 +02:00
|
|
|
<Signature />
|
2024-04-02 14:45:12 +02:00
|
|
|
</Body>
|
|
|
|
</Html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-04-02 15:11:28 +02:00
|
|
|
const template: Template<typeof Message, Parameters<typeof Message>[0]> = {
|
2024-04-02 14:45:12 +02:00
|
|
|
props: [
|
|
|
|
{
|
|
|
|
name: 'Résumé',
|
|
|
|
description: 'Résumé du mail.',
|
|
|
|
required: false,
|
|
|
|
multiline: false,
|
|
|
|
tag: 'summary',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Message',
|
|
|
|
description: 'Contenu du mail (markdown).',
|
|
|
|
required: true,
|
|
|
|
multiline: true,
|
|
|
|
tag: 'body',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
name: 'message',
|
|
|
|
description: 'Message mail en markdown.',
|
|
|
|
builder: Message,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default template
|
|
|
|
//summary <90c
|