Skip to content

Commit 01f3eff

Browse files
committed
prettier
1 parent df4c69d commit 01f3eff

14 files changed

Lines changed: 141 additions & 187 deletions

src/__t/fullTemplate.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
21
//---
32

4-
const reactFullTemplateComponent = (headComponent, bodyComponent, content='') => {
5-
if(!headComponent){
6-
throw new Error('no head was passed');
7-
}
8-
9-
return `
3+
const reactFullTemplateComponent = (
4+
headComponent,
5+
bodyComponent,
6+
content = ''
7+
) => {
8+
if (!headComponent) {
9+
throw new Error('no head was passed');
10+
}
11+
12+
return `
1013
import React from "react";
1114
1215
const Content = () => {
@@ -21,7 +24,6 @@ const reactFullTemplateComponent = (headComponent, bodyComponent, content='') =>
2124
export default Content;
2225
2326
`;
24-
25-
}
26-
27-
export { reactFullTemplateComponent }
27+
};
28+
29+
export { reactFullTemplateComponent };

src/__t/generateTemplate.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// import things....
22

3+
const generateTemplateComponent = () => {};
34

4-
const generateTemplateComponent = () => {
5-
6-
}
7-
8-
export default generateTemplateComponent;
5+
export default generateTemplateComponent;

src/components/bodyComponent.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
// add preview stuff
22
// we need to find footer component
33
const EmailTemplateBodyComponent = (params) => {
4-
54
const { footer, logoTop, logoBottom, content } = params;
65

7-
8-
if(!footer){
6+
if (!footer) {
97
throw new Error('no footer was passed');
108
}
11-
if(!logoTop || !logoBottom){
9+
if (!logoTop || !logoBottom) {
1210
throw new Error('invalid logo');
1311
}
1412

15-
return `<Body>${content}</Body>`;
16-
}
17-
18-
export default EmailTemplateBodyComponent;
13+
return `<Body>${content}</Body>`;
14+
};
15+
16+
export default EmailTemplateBodyComponent;

src/components/footerComponent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const footerComponent = (children) => {
2-
return `<Footer>${children}</Footer>`;
3-
}
2+
return `<Footer>${children}</Footer>`;
3+
};
44

5-
export default footerComponent;
5+
export default footerComponent;

src/components/headComponent.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
const headComponent = (params) => {
2+
const { title, headStyles, fonts } = params;
23

3-
const { title, headStyles, fonts } = params;
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');
47

5-
if (!title) throw new Error('no title was passed');
6-
if (!headStyles) throw new Error('invalid headStyles');
7-
if (!fonts) throw new Error('invalid fonts');
8-
9-
return `<Head title=${title} styles=${headStyles} fonts=${fonts} />`
10-
11-
}
8+
return `<Head title=${title} styles=${headStyles} fonts=${fonts} />`;
9+
};
1210

1311
export default headComponent;

src/components/mainComponent.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
function mainComponent(params) {
2-
3-
if (!params) {
4-
throw new Error('no Params was passed');
5-
}
6-
7-
const { head, body } = params;
8-
2+
if (!params) {
3+
throw new Error('no Params was passed');
4+
}
95

10-
if (!head) {
11-
throw new Error('no headComponent was passed'); // todo change it later
12-
}
6+
const { head, body } = params;
137

14-
if (!body) {
15-
throw new Error('bodyComponent');
16-
}
8+
if (!head) {
9+
throw new Error('no headComponent was passed'); // todo change it later
10+
}
1711

12+
if (!body) {
13+
throw new Error('bodyComponent');
14+
}
1815

19-
return `
16+
return `
2017
import React from "react";
2118
2219
const Content = () => {
@@ -33,6 +30,4 @@ function mainComponent(params) {
3330
`;
3431
}
3532

36-
37-
38-
export default mainComponent;
33+
export default mainComponent;

src/config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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+
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;

src/display/displayBody.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
1-
21
import { displayFactoryTwo } from 'email-template-object';
32

43
import EmailTemplateBodyComponent from '../components/bodyComponent';
54
import footerString from '../display/displayFooter';
65

76
// const ERROR_BODY = '`bodyContent` is a required option for `renderTemplate`';
87

9-
import {
10-
logoTopComponent, logoBottomComponent
8+
import {
9+
logoTopComponent,
10+
logoBottomComponent,
1111
} from 'atherdon-newsletter-react-layouts-innercomponents';
1212

13-
1413
const checkingBodyContent = (bodyContent) => {
15-
if (!bodyContent) {
16-
throw new Error('`bodyContent` is a required option for `renderTemplate`');
17-
}
18-
}
14+
if (!bodyContent) {
15+
throw new Error('`bodyContent` is a required option for `renderTemplate`');
16+
}
17+
};
1918

2019
// const ContentData = '';
2120

22-
2321
let addon1 = {
24-
footer: footerString,
25-
26-
logoTop:logoTopComponent(),
27-
logoBottom: logoBottomComponent(),
28-
29-
content: '[[THIS IS PLACE FOR A CONTENT INSIDE]'
22+
footer: footerString,
3023

31-
// previewText: previewTextComponent('[AMA PREVIEW TEXT]')
24+
logoTop: logoTopComponent(),
25+
logoBottom: logoBottomComponent(),
3226

33-
}
27+
content: '[[THIS IS PLACE FOR A CONTENT INSIDE]',
3428

29+
// previewText: previewTextComponent('[AMA PREVIEW TEXT]')
30+
};
3531

3632
//variant one
3733
const settings = {
38-
component: EmailTemplateBodyComponent,
39-
// params: { footerComponent, logoTop, logoBottom, content },
40-
params: addon1,
41-
// subcomponents: { }
42-
43-
}
34+
component: EmailTemplateBodyComponent,
35+
// params: { footerComponent, logoTop, logoBottom, content },
36+
params: addon1,
37+
// subcomponents: { }
38+
};
4439

4540
const BodyFactory = new displayFactoryTwo();
4641
// console.log(BodyFactory.create(settings))
47-
export default BodyFactory.create(settings);
42+
export default BodyFactory.create(settings);

src/display/displayFooter.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ let mailingAddress = 'PO Box 2206, Edwards CO, 81632, U.S.A.';
88
let contact =
99
'https://sponsor.hackernoon.com/newsletter?ref=noonifications.tech';
1010

11-
12-
const {
13-
14-
} = misc;
11+
const {} = misc;
1512

1613
const addon1 = {
17-
children: '',
18-
// sponsor: ''
19-
}
14+
children: '',
15+
// sponsor: ''
16+
};
2017

2118
const settings = {
22-
component: footerComponent,
23-
params: addon1,
24-
}
19+
component: footerComponent,
20+
params: addon1,
21+
};
2522

2623
const FooterFactory = new displayFactoryTwo();
2724
// console.log(FooterFactory.create(settings));
2825

29-
export default FooterFactory.create(settings);
26+
export default FooterFactory.create(settings);

src/display/displayHead.js

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,38 @@ import { displayFactoryTwo } from 'email-template-object';
55
import Miscellaneous from 'atherdon-newsletter-react-layouts-miscellaneous';
66
import headComponent from '../components/headComponent';
77

8-
98
const { fontsComponent, headStylesComponent } = Miscellaneous;
109
const title = `The Secrets of High-Performing DevOps teams`;
1110

1211
// ----
1312
// const ERROR_TITLE = '`title` is a required option for `renderTemplate`'
1413

15-
1614
const checkingTitle = (title) => {
17-
if (!title) {
18-
throw new Error('`title` is a required option for `renderTemplate`');
19-
}
20-
}
15+
if (!title) {
16+
throw new Error('`title` is a required option for `renderTemplate`');
17+
}
18+
};
2119
// ---
2220

23-
2421
// fonts, headStyles
2522

2623
let addon1 = {
24+
title,
25+
headStyles: headStylesComponent(),
26+
fonts: fontsComponent(),
2727

28-
title,
29-
headStyles: headStylesComponent(),
30-
fonts: fontsComponent()
28+
// logoTop:logoTopComponent(),
29+
// logoBottom: logoBottomComponent(),
3130

32-
// logoTop:logoTopComponent(),
33-
// logoBottom: logoBottomComponent(),
34-
35-
// content:'[[THIS IS PLACE FOR A CONTENT INSIDE]',
36-
// previewText:previewTextComponent('[AMA PREVIEW TEXT]')
37-
38-
}
31+
// content:'[[THIS IS PLACE FOR A CONTENT INSIDE]',
32+
// previewText:previewTextComponent('[AMA PREVIEW TEXT]')
33+
};
3934

4035
//variant one
4136
const settings = {
42-
component: headComponent,
43-
params: addon1,
44-
45-
}
37+
component: headComponent,
38+
params: addon1,
39+
};
4640

4741
// console.log(addon1)
4842
// console.log(settings)

0 commit comments

Comments
 (0)