This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1382 from SumOfUs/development
Release
- Loading branch information
Showing
67 changed files
with
1,558 additions
and
96 deletions.
There are no files selected for viewing
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
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
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
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
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,15 @@ | ||
.container { | ||
section { | ||
padding: 2em 4%; | ||
clear: both; | ||
|
||
.one-column { | ||
max-width: 1000px; | ||
margin: auto; | ||
} | ||
} | ||
|
||
.alternate-bg { | ||
background-color: #ececec; | ||
} | ||
} |
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
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
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,21 @@ | ||
// @flow | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import { EmailPluginConfig } from './interfaces'; | ||
import EmailParliament from '../modules/EmailParliament'; | ||
|
||
type Options = { | ||
el: HTMLElement, | ||
config: EmailPluginConfig, | ||
[key: string]: any, | ||
}; | ||
|
||
export const init = (options: Options) => { | ||
if (!options.config.active) return; | ||
if (options.el) { | ||
render( | ||
<EmailParliament config={options.config} onSend={options.onSend} />, | ||
options.el | ||
); | ||
} | ||
}; |
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,53 @@ | ||
// @flow | ||
|
||
type PluginErrorOptions = { | ||
name?: string, | ||
message: string, | ||
}; | ||
|
||
export class PluginError { | ||
name: string; | ||
message: string; | ||
constructor(options: PluginErrorOptions) { | ||
this.name = options.name || 'PluginError'; | ||
this.message = options.message; | ||
} | ||
|
||
toString() { | ||
return `${this.name}: ${this.message}`; | ||
} | ||
} | ||
|
||
export const MODULES = { | ||
'email-ukparliament': () => import('./email-ukparliament'), | ||
}; | ||
|
||
// Lists supported async modules | ||
export const list = (): string[] => Object.keys(MODULES); | ||
|
||
// Loads an async module. | ||
export const load = async (name: string, options: any) => { | ||
const loader = MODULES[name]; | ||
if (!loader) { | ||
throw new PluginError({ | ||
message: `Plugin "${name}" is not available or does not support dynamic loading.`, | ||
}); | ||
} | ||
const plugin = await loader(); | ||
plugin.init(options); | ||
}; | ||
|
||
export const modules = { | ||
// Attaches the async feature to the champaign global | ||
// object. | ||
setup(champaign: any) { | ||
Object.assign(champaign, { | ||
modules: { | ||
load, | ||
list, | ||
}, | ||
}); | ||
}, | ||
}; | ||
|
||
export default modules; |
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,15 @@ | ||
// @flow | ||
|
||
export interface PluginConfig { | ||
ref: string; | ||
active: boolean; | ||
locale: string; | ||
pageId: number; | ||
pluginId: number; | ||
title: string; | ||
} | ||
|
||
export interface EmailPluginConfig extends PluginConfig { | ||
subject: string; | ||
template: string; | ||
} |
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
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
Oops, something went wrong.