Skip to content

Commit ec8cf72

Browse files
committed
running template on an old version of rollup package
1 parent 754f7e8 commit ec8cf72

29 files changed

+543
-19
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// add preview stuff
2+
// we need to find footer component
3+
const EmailTemplateBodyComponent = (params) => {
4+
const { footer, logoTop, logoBottom, content } = params;
5+
6+
if (!footer) {
7+
throw new Error('no footer was passed');
8+
}
9+
if (!logoTop || !logoBottom) {
10+
throw new Error('invalid logo');
11+
}
12+
13+
return `<Body>${content}</Body>`;
14+
};
15+
16+
export default EmailTemplateBodyComponent;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const footerComponent = (children) => {
2+
return `<Footer>${children}</Footer>`;
3+
};
4+
5+
export default footerComponent;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const headComponent = (params) => {
2+
const { title, headStyles, fonts } = params;
3+
4+
if (!title) throw new Error('no title was passed');
5+
if (!headStyles) throw new Error('invalid headStyles');
6+
if (!fonts) throw new Error('invalid fonts');
7+
8+
return `<Head title=${title} styles=${headStyles} fonts=${fonts} />`;
9+
};
10+
11+
export default headComponent;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function mainComponent(params) {
2+
if (!params) {
3+
throw new Error('no Params was passed');
4+
}
5+
6+
const { head, body } = params;
7+
8+
if (!head) {
9+
throw new Error('no headComponent was passed'); // todo change it later
10+
}
11+
12+
if (!body) {
13+
throw new Error('bodyComponent');
14+
}
15+
16+
return `
17+
import React from "react";
18+
19+
const Content = () => {
20+
return (
21+
<Template>
22+
${head}
23+
${body}
24+
</Template>
25+
);
26+
};
27+
28+
export default Content;
29+
30+
`;
31+
}
32+
33+
export default mainComponent;

1.4/___src/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const config = {
2+
contact: 'https://sponsor.hackernoon.com/newsletter?ref=noonifications.tech',
3+
mailingAddress: 'PO Box 2206, Edwards CO, 81632, U.S.A.',
4+
unsubscribe: '#',
5+
};
6+
7+
export default config;

1.4/___src/display/displayBody.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { displayFactoryTwo } from 'email-template-object';
2+
3+
import EmailTemplateBodyComponent from '../components/bodyComponent';
4+
import footerString from '../display/displayFooter';
5+
6+
// const ERROR_BODY = '`bodyContent` is a required option for `renderTemplate`';
7+
8+
import {
9+
logoTopComponent,
10+
logoBottomComponent,
11+
} from 'atherdon-newsletter-react-layouts-innercomponents';
12+
13+
const checkingBodyContent = (bodyContent) => {
14+
if (!bodyContent) {
15+
throw new Error('`bodyContent` is a required option for `renderTemplate`');
16+
}
17+
};
18+
19+
// const ContentData = '';
20+
21+
let addon1 = {
22+
footer: footerString,
23+
24+
logoTop: logoTopComponent(),
25+
logoBottom: logoBottomComponent(),
26+
27+
content: '[[THIS IS PLACE FOR A CONTENT INSIDE]',
28+
29+
// previewText: previewTextComponent('[AMA PREVIEW TEXT]')
30+
};
31+
32+
//variant one
33+
const settings = {
34+
component: EmailTemplateBodyComponent,
35+
// params: { footerComponent, logoTop, logoBottom, content },
36+
params: addon1,
37+
// subcomponents: { }
38+
};
39+
40+
const BodyFactory = new displayFactoryTwo();
41+
// console.log(BodyFactory.create(settings))
42+
export default BodyFactory.create(settings);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import misc from 'atherdon-newsletter-react-layouts-miscellaneous';
2+
3+
import { displayFactoryTwo } from 'email-template-object';
4+
5+
import footerComponent from '../components/footerComponent';
6+
7+
let mailingAddress = 'PO Box 2206, Edwards CO, 81632, U.S.A.';
8+
let contact =
9+
'https://sponsor.hackernoon.com/newsletter?ref=noonifications.tech';
10+
11+
const {} = misc;
12+
13+
const addon1 = {
14+
children: '',
15+
// sponsor: ''
16+
};
17+
18+
const settings = {
19+
component: footerComponent,
20+
params: addon1,
21+
};
22+
23+
const FooterFactory = new displayFactoryTwo();
24+
// console.log(FooterFactory.create(settings));
25+
26+
export default FooterFactory.create(settings);

1.4/___src/display/displayHead.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// import factory from './factory';
2+
import { displayFactoryTwo } from 'email-template-object';
3+
4+
// partials
5+
import Miscellaneous from 'atherdon-newsletter-react-layouts-miscellaneous';
6+
import headComponent from '../components/headComponent';
7+
8+
const { fontsComponent, headStylesComponent } = Miscellaneous;
9+
const title = `The Secrets of High-Performing DevOps teams`;
10+
11+
// ----
12+
// const ERROR_TITLE = '`title` is a required option for `renderTemplate`'
13+
14+
const checkingTitle = (title) => {
15+
if (!title) {
16+
throw new Error('`title` is a required option for `renderTemplate`');
17+
}
18+
};
19+
// ---
20+
21+
// fonts, headStyles
22+
23+
let addon1 = {
24+
title,
25+
headStyles: headStylesComponent(),
26+
fonts: fontsComponent(),
27+
28+
// logoTop:logoTopComponent(),
29+
// logoBottom: logoBottomComponent(),
30+
31+
// content:'[[THIS IS PLACE FOR A CONTENT INSIDE]',
32+
// previewText:previewTextComponent('[AMA PREVIEW TEXT]')
33+
};
34+
35+
//variant one
36+
const settings = {
37+
component: headComponent,
38+
params: addon1,
39+
};
40+
41+
// console.log(addon1)
42+
// console.log(settings)
43+
44+
const Factory = new displayFactoryTwo();
45+
// console.log(Factory.create(settings));
46+
export default Factory.create(settings);

0 commit comments

Comments
 (0)