chore: code cleaning (#21)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import Note from './components/Note';
|
||||
import Template from './Template';
|
||||
import { Note } from './components/Note';
|
||||
import { Template } from './Template';
|
||||
|
||||
export default function ConfirmationTemplate(code: string) {
|
||||
export const ConfirmationTemplate = (code: string) => {
|
||||
return {
|
||||
subject: 'Welcome!',
|
||||
template: (
|
||||
@@ -46,4 +46,4 @@ export default function ConfirmationTemplate(code: string) {
|
||||
/>
|
||||
)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,10 +2,10 @@ import React from 'react';
|
||||
import { summirize } from '@utils/summarize';
|
||||
import { NewsType } from '@utils/validationSchemas';
|
||||
import createDOMPurify from 'isomorphic-dompurify';
|
||||
import Template from './Template';
|
||||
import newsletterSubject from '@utils/newsletterSubject';
|
||||
import getNewsletterSubject from '@utils/getNewsletterSubject';
|
||||
import { Template } from './Template';
|
||||
|
||||
export default async function NewsletterTemplate(stories: NewsType[]) {
|
||||
export const NewsletterTemplate = async (stories: NewsType[]) => {
|
||||
const summary = await summirize(stories);
|
||||
const sanitizedSummary = createDOMPurify.sanitize(summary, {
|
||||
USE_PROFILES: { html: true },
|
||||
@@ -17,7 +17,7 @@ export default async function NewsletterTemplate(stories: NewsType[]) {
|
||||
throw new Error('Failed to sanitize summary');
|
||||
}
|
||||
|
||||
const topic = newsletterSubject(sanitizedSummary);
|
||||
const topic = getNewsletterSubject(sanitizedSummary);
|
||||
|
||||
return {
|
||||
subject: topic,
|
||||
@@ -66,4 +66,4 @@ export default async function NewsletterTemplate(stories: NewsType[]) {
|
||||
/>
|
||||
)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import Footer from './components/Footer';
|
||||
import { Footer } from './components/Footer';
|
||||
|
||||
interface TemplateProps {
|
||||
title: string;
|
||||
@@ -7,11 +7,11 @@ interface TemplateProps {
|
||||
variant?: string;
|
||||
}
|
||||
|
||||
export default function Template({
|
||||
export const Template = ({
|
||||
title,
|
||||
body,
|
||||
variant = 'default'
|
||||
}: TemplateProps) {
|
||||
}: TemplateProps) => {
|
||||
const isNewsletter = variant === 'newsletter';
|
||||
|
||||
return (
|
||||
@@ -74,4 +74,4 @@ export default function Template({
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import Note from './components/Note';
|
||||
import Template from './Template';
|
||||
import { Note } from './components/Note';
|
||||
import { Template } from './Template';
|
||||
|
||||
export default function UnsubscribeTemplate() {
|
||||
export const UnsubscribeTemplate = () => {
|
||||
return {
|
||||
subject: 'Unsubscribe confirmation',
|
||||
template: (
|
||||
@@ -55,4 +55,4 @@ export default function UnsubscribeTemplate() {
|
||||
/>
|
||||
)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Home
|
||||
} from 'lucide-react';
|
||||
|
||||
export default function Footer() {
|
||||
export const Footer = () => {
|
||||
return (
|
||||
<footer
|
||||
style={{
|
||||
@@ -167,4 +167,4 @@ export default function Footer() {
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,10 +2,10 @@ interface NoteProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function Note({ children }: NoteProps) {
|
||||
export const Note = ({ children }: NoteProps) => {
|
||||
return (
|
||||
<div className='mt-6 rounded-md bg-gray-50 p-4 text-sm text-gray-600'>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user