-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
running template on an old version of rollup package
- Loading branch information
Showing
29 changed files
with
543 additions
and
19 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// add preview stuff | ||
// we need to find footer component | ||
const EmailTemplateBodyComponent = (params) => { | ||
const { footer, logoTop, logoBottom, content } = params; | ||
|
||
if (!footer) { | ||
throw new Error('no footer was passed'); | ||
} | ||
if (!logoTop || !logoBottom) { | ||
throw new Error('invalid logo'); | ||
} | ||
|
||
return `<Body>${content}</Body>`; | ||
}; | ||
|
||
export default EmailTemplateBodyComponent; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const footerComponent = (children) => { | ||
return `<Footer>${children}</Footer>`; | ||
}; | ||
|
||
export default footerComponent; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const headComponent = (params) => { | ||
const { title, headStyles, fonts } = params; | ||
|
||
if (!title) throw new Error('no title was passed'); | ||
if (!headStyles) throw new Error('invalid headStyles'); | ||
if (!fonts) throw new Error('invalid fonts'); | ||
|
||
return `<Head title=${title} styles=${headStyles} fonts=${fonts} />`; | ||
}; | ||
|
||
export default headComponent; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function mainComponent(params) { | ||
if (!params) { | ||
throw new Error('no Params was passed'); | ||
} | ||
|
||
const { head, body } = params; | ||
|
||
if (!head) { | ||
throw new Error('no headComponent was passed'); // todo change it later | ||
} | ||
|
||
if (!body) { | ||
throw new Error('bodyComponent'); | ||
} | ||
|
||
return ` | ||
import React from "react"; | ||
const Content = () => { | ||
return ( | ||
<Template> | ||
${head} | ||
${body} | ||
</Template> | ||
); | ||
}; | ||
export default Content; | ||
`; | ||
} | ||
|
||
export default mainComponent; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const config = { | ||
contact: 'https://sponsor.hackernoon.com/newsletter?ref=noonifications.tech', | ||
mailingAddress: 'PO Box 2206, Edwards CO, 81632, U.S.A.', | ||
unsubscribe: '#', | ||
}; | ||
|
||
export default config; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { displayFactoryTwo } from 'email-template-object'; | ||
|
||
import EmailTemplateBodyComponent from '../components/bodyComponent'; | ||
import footerString from '../display/displayFooter'; | ||
|
||
// const ERROR_BODY = '`bodyContent` is a required option for `renderTemplate`'; | ||
|
||
import { | ||
logoTopComponent, | ||
logoBottomComponent, | ||
} from 'atherdon-newsletter-react-layouts-innercomponents'; | ||
|
||
const checkingBodyContent = (bodyContent) => { | ||
if (!bodyContent) { | ||
throw new Error('`bodyContent` is a required option for `renderTemplate`'); | ||
} | ||
}; | ||
|
||
// const ContentData = ''; | ||
|
||
let addon1 = { | ||
footer: footerString, | ||
|
||
logoTop: logoTopComponent(), | ||
logoBottom: logoBottomComponent(), | ||
|
||
content: '[[THIS IS PLACE FOR A CONTENT INSIDE]', | ||
|
||
// previewText: previewTextComponent('[AMA PREVIEW TEXT]') | ||
}; | ||
|
||
//variant one | ||
const settings = { | ||
component: EmailTemplateBodyComponent, | ||
// params: { footerComponent, logoTop, logoBottom, content }, | ||
params: addon1, | ||
// subcomponents: { } | ||
}; | ||
|
||
const BodyFactory = new displayFactoryTwo(); | ||
// console.log(BodyFactory.create(settings)) | ||
export default BodyFactory.create(settings); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import misc from 'atherdon-newsletter-react-layouts-miscellaneous'; | ||
|
||
import { displayFactoryTwo } from 'email-template-object'; | ||
|
||
import footerComponent from '../components/footerComponent'; | ||
|
||
let mailingAddress = 'PO Box 2206, Edwards CO, 81632, U.S.A.'; | ||
let contact = | ||
'https://sponsor.hackernoon.com/newsletter?ref=noonifications.tech'; | ||
|
||
const {} = misc; | ||
|
||
const addon1 = { | ||
children: '', | ||
// sponsor: '' | ||
}; | ||
|
||
const settings = { | ||
component: footerComponent, | ||
params: addon1, | ||
}; | ||
|
||
const FooterFactory = new displayFactoryTwo(); | ||
// console.log(FooterFactory.create(settings)); | ||
|
||
export default FooterFactory.create(settings); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// import factory from './factory'; | ||
import { displayFactoryTwo } from 'email-template-object'; | ||
|
||
// partials | ||
import Miscellaneous from 'atherdon-newsletter-react-layouts-miscellaneous'; | ||
import headComponent from '../components/headComponent'; | ||
|
||
const { fontsComponent, headStylesComponent } = Miscellaneous; | ||
const title = `The Secrets of High-Performing DevOps teams`; | ||
|
||
// ---- | ||
// const ERROR_TITLE = '`title` is a required option for `renderTemplate`' | ||
|
||
const checkingTitle = (title) => { | ||
if (!title) { | ||
throw new Error('`title` is a required option for `renderTemplate`'); | ||
} | ||
}; | ||
// --- | ||
|
||
// fonts, headStyles | ||
|
||
let addon1 = { | ||
title, | ||
headStyles: headStylesComponent(), | ||
fonts: fontsComponent(), | ||
|
||
// logoTop:logoTopComponent(), | ||
// logoBottom: logoBottomComponent(), | ||
|
||
// content:'[[THIS IS PLACE FOR A CONTENT INSIDE]', | ||
// previewText:previewTextComponent('[AMA PREVIEW TEXT]') | ||
}; | ||
|
||
//variant one | ||
const settings = { | ||
component: headComponent, | ||
params: addon1, | ||
}; | ||
|
||
// console.log(addon1) | ||
// console.log(settings) | ||
|
||
const Factory = new displayFactoryTwo(); | ||
// console.log(Factory.create(settings)); | ||
export default Factory.create(settings); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { displayFactoryTwo } from 'email-template-object'; | ||
|
||
import MainComponent from '../components/mainComponent'; | ||
|
||
import HeadString from './displayHead'; | ||
|
||
// TODO we need to be able to pass content variable from this | ||
// file and | ||
import BodyString from './displayBody'; | ||
|
||
// import EmailTemplateBodyComponent from '../components/bodyComponent'; | ||
|
||
// const title = `The Secrets of High-Performing DevOps teams`; | ||
const content = '[THIS IS PLACE FOR A CONTENT INSIDE]'; | ||
// const content2 = ContentComponent; | ||
|
||
let addon1 = { | ||
head: HeadString, | ||
body: BodyString, | ||
// body: EmailTemplateBodyComponent() | ||
parsedContent: content, | ||
}; | ||
|
||
//variant one | ||
const settings = { | ||
component: MainComponent, | ||
|
||
params: addon1, | ||
}; | ||
|
||
const Factory = new displayFactoryTwo(); | ||
|
||
export default Factory.create(settings); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { headComponent } from '../components/head'; | ||
|
||
import { EmailTemplateBodyComponent } from '../components/body'; | ||
|
||
import mainComponent from '../components/mainComponent'; | ||
|
||
let addon1 = { | ||
footer: footerString, | ||
|
||
logoTop: logoTopComponent(), | ||
logoBottom: logoBottomComponent(), | ||
content: '[[THIS IS PLACE FOR A CONTENT INSIDE]', | ||
previewText: previewTextComponent('[AMA PREVIEW TEXT]'), | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import EmailTemplateBodyComponent from './components/bodyComponent'; | ||
import headComponent from './components/headComponent'; | ||
import mainComponent from './components/mainComponent'; | ||
|
||
import footerComponent from './components/footerComponent'; | ||
|
||
// import misc from "./misc/"; | ||
|
||
// import typography from "./typography/"; | ||
|
||
// import { reactFullTemplate } from "./reactFullTemplate"; | ||
|
||
// const layout = { | ||
// body, | ||
// misc, | ||
// typography, | ||
// reactFullTemplate, | ||
// }; | ||
|
||
// export default layout; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import HeadString from './display/displayHead'; | ||
|
||
import BodyString from './display/displayBody'; | ||
|
||
import FooterString from './display/displayFooter'; | ||
|
||
import MainString from './display/displayMain'; | ||
|
||
console.log(MainString); | ||
|
||
const printHead = () => { | ||
return HeadString; | ||
}; | ||
|
||
const printMain = () => { | ||
return MainString; | ||
}; | ||
|
||
const printFooter = () => { | ||
return FooterString; | ||
}; | ||
|
||
const printBody = () => { | ||
return BodyString; | ||
}; | ||
|
||
export { printMain, printBody, printFooter, printHead }; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { printMain, printFooter, printBody, printHead } from '../src/methods' | ||
|
||
import { writingFile } from 'markup-generator'; | ||
// console.log(printMain()) | ||
// console.log(printHead()) | ||
|
||
|
||
|
||
// var generateEmptyTemplateComponent = require('../src/t/emptyTemplate'); | ||
|
||
// var generateTemplateComponent = require('../src/t/generateTemplate'); | ||
|
||
|
||
|
||
describe('test helpers', () => { | ||
|
||
|
||
test('rendering head component', () => { | ||
|
||
const string1 = printHead(); | ||
|
||
writingFile(string1, 'lit-empty'); | ||
|
||
// // console.log(string); | ||
expect(printHead()).toBeDefined(); | ||
|
||
|
||
}); | ||
|
||
|
||
test('rendering Footer Component', () => { | ||
|
||
const string2 = printFooter(); | ||
|
||
writingFile(string2, 'lit-empty'); | ||
|
||
// console.log(string); | ||
expect(printFooter()).toBeDefined(); | ||
|
||
// writingFile(string2); | ||
|
||
}); | ||
|
||
test('rendering Body Component', () => { | ||
|
||
const string3 = printBody(); | ||
|
||
// console.log(string); | ||
expect(printBody()).toBeDefined(); | ||
|
||
// writingFile(string3); | ||
writingFile(string3, 'lit-empty'); | ||
}); | ||
|
||
|
||
|
||
// test('rendering Empty Template', () => { | ||
|
||
// const string = generateEmptyTemplateComponent(); | ||
// console.log(string); | ||
// }); | ||
|
||
|
||
test('rendering Main Component', () => { | ||
|
||
|
||
const string4 = printMain(); | ||
|
||
// // console.log(string); | ||
|
||
expect(printMain()).toBeDefined(); | ||
|
||
// writingFile(string4); | ||
writingFile(string4, 'lit-empty'); | ||
expect(typeof string4).toBe('string'); | ||
|
||
}); | ||
|
||
|
||
}); |
Oops, something went wrong.