Skip to content

Commit

Permalink
add first version of code
Browse files Browse the repository at this point in the history
  • Loading branch information
robindemourat committed Jan 12, 2019
1 parent 1a51ed1 commit f3b030c
Show file tree
Hide file tree
Showing 58 changed files with 12,564 additions and 0 deletions.
239 changes: 239 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"globals": {
"__PUBLIC_URL__": false,
"__OVIDE_VERSION__": false,
"__SOURCE_REPOSITORY__": false,
"FONIO_CONFIG": false,
"db": false
},
"plugins": [
"mocha",
"react"
],
"settings": {
"react": {
"version": "16.0.2"
}
},
"extends": [
"@robindemourat/eslint-config/es7",
"@robindemourat/eslint-config/react"
],
"rules": {
"require-jsdoc": 2,
"react/jsx-no-bind": 0,


"react/jsx-handler-names": [2, {
"eventHandlerPrefix": "handle",
"eventHandlerPropPrefix": "on"
}],

"no-case-declarations": 0,
"no-useless-escape": 0,
"arrow-parens": [
2,
"always"
],
"arrow-spacing": [
2,
{
"before": true,
"after": true
}
],
"constructor-super": 0,
"generator-star-spacing": 0,
"no-class-assign": 0,
"no-confusing-arrow": 2,
"no-const-assign": 2,
"no-this-before-super": 0,
"no-var": 2,
"object-shorthand": [
2,
"always"
],
"prefer-arrow-callback": 0,
"prefer-const": 2,
"prefer-spread": 0,
"prefer-reflect": 0,
"require-yield": 0,
"react/jsx-uses-react": 2,
"react/no-multi-comp": 0,
"react/prop-types": 0,
"react/display-name": 0,
"react/jsx-wrap-multilines": 2,
"react/self-closing-comp": 2,
"react/jsx-no-comment-textnodes": 2,
"react/no-danger": 2,
"react/no-is-mounted": 2,
"react/no-deprecated": 2,
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-render-return-value": 2,
"react/react-in-jsx-scope": 2,
"react/jsx-uses-vars": 2,
"react/jsx-pascal-case": 2,
"react/jsx-no-undef": 2,
"react/no-unknown-property": 2,

"react/jsx-curly-spacing": [
2,
"always",
{
"allowMultiline": true,
"spacing":
{
"objectLiterals": "always"
}
}
],
"react/jsx-equals-spacing": [
2,
"never"
],

"react/sort-prop-types": 2,
"react/jsx-boolean-value": 2,
"react/sort-comp": 2,
"react/jsx-no-duplicate-props": 2,
"react/jsx-max-props-per-line": [
2,
{
"maximum": 1,
"when": "always"
}
],
"react/jsx-no-literals": 0,
"react/jsx-indent-props": [2, 2],
"react/jsx-indent": [2, 2],
"react/jsx-closing-bracket-location": [
2,
"tag-aligned"
],

"react/jsx-tag-spacing": 2,
"react/no-direct-mutation-state": 2,
"react/forbid-prop-types": 0,
"react/prefer-es6-class": 2,
"react/jsx-key": 2,
"react/no-string-refs": 2,
"react/no-set-state": 0,
"react/prefer-stateless-function": 2,
"react/require-render-return": 2,
"react/jsx-first-prop-new-line": 2,
"react/jsx-no-target-blank": 2,
"react/jsx-filename-extension": [
2,
{
"extensions": [
".js",
".jsx"
]
}
],
"react/require-optimization": 2,
"react/no-find-dom-node": 2,

"object-curly-spacing": [
2,
"always"
],
"brace-style": [
2,
"stroustrup",
{
"allowSingleLine": false
}
],
"block-spacing": [
2,
"always"
],
"array-bracket-spacing": [
2,
"always"
],
"rest-spread-spacing": [
2,
"never"
],
"array-bracket-newline": [
2,
"consistent"
],
"space-in-parens": [
2,
"always"
],

"no-multiple-empty-lines": [2,
{
"max": 1
}],
"key-spacing": [
2,
{
"beforeColon": false
}
],
"no-mixed-spaces-and-tabs": 2,
"multiline-comment-style": [
2,
"starred-block"
],
"lines-around-comment": [
2,
{
"beforeBlockComment": true
}
],
"computed-property-spacing": [
2,
"never"
],

"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"linebreak-style": [
"error",
"unix"
],
"switch-colon-spacing": [
2,
{
"after": true,
"before": false
}
],

"prefer-template": 2,
"react/boolean-prop-naming": 2,
"react/no-typos": 2,
"react/no-unescaped-entities": 2,
"react/no-will-update-set-state": 2,
"react/void-dom-elements-no-children": 2,
"react/jsx-child-element-spacing": 2,
"react/jsx-closing-tag-location": 2,
"react/jsx-curly-brace-presence": [
2,
{
"props": "always",
"children": "never"
}
]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store

# Runtime data
pids
Expand Down
27 changes: 27 additions & 0 deletions dist/components/Authors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const Authors = ({
authors,
displayRole = false
}) => authors.map((author, index) => _react.default.createElement("span", {
className: "author'",
key: index
}, author.given.trim(), " ", author.family.trim(), displayRole && author.role ? ` (${author.role})` : '')).reduce((prev, curr, index) => {
if (index > 0) {
return [prev, ', ', curr];
}

return [curr];
}, []);

var _default = Authors;
exports.default = _default;
64 changes: 64 additions & 0 deletions dist/components/BackCover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _MarkdownPlayer = _interopRequireDefault(require("./MarkdownPlayer"));

var _Authors = _interopRequireDefault(require("./Authors"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = ({
production: {
metadata
},
edition,
data: {
backgroundColor,
useAbstract = true,
customMarkdownContents,
animatedBackground,
customCoverFooter
} = {},
id
}) => {
const {
data: editionData = {}
} = edition;
const finalTitle = editionData.publicationTitle || metadata.title;
const finalSubtitle = editionData.publicationSubtitle || metadata.subtitle;
return _react.default.createElement("section", {
className: `composition-block back-cover ${animatedBackground && animatedBackground !== 'none' ? `with-animated-background-${animatedBackground}` : ''}`,
style: {
backgroundColor
}
}, _react.default.createElement("div", {
className: 'back-cover-content'
}, _react.default.createElement("h2", {
id: id,
className: 'back-cover-title'
}, finalTitle), finalSubtitle && _react.default.createElement("h3", {
className: 'back-cover-subtitle'
}, finalSubtitle), metadata.authors && _react.default.createElement("h3", {
className: 'back-cover-authors'
}, _react.default.createElement(_Authors.default, {
authors: metadata.authors
})), _react.default.createElement("div", {
className: 'back-cover-text'
}, useAbstract && _react.default.createElement(_MarkdownPlayer.default, {
src: metadata.abstract
}), customMarkdownContents && customMarkdownContents.trim().length ? _react.default.createElement(_MarkdownPlayer.default, {
src: customMarkdownContents
}) : null), customCoverFooter && customCoverFooter.length > 0 && _react.default.createElement("div", {
className: 'back-cover-footer'
}, _react.default.createElement(_MarkdownPlayer.default, {
src: customCoverFooter
}))));
};

exports.default = _default;
Loading

0 comments on commit f3b030c

Please sign in to comment.