Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #52 from accordproject/dl-add-to-contract
Browse files Browse the repository at this point in the history
feat(ContractEditor): update to use new SlateAsInputEditor from cicero-ui
  • Loading branch information
DianaLease authored Jun 4, 2019
2 parents 5125a7d + 843bf12 commit aceebb8
Show file tree
Hide file tree
Showing 13 changed files with 241 additions and 393 deletions.
36 changes: 36 additions & 0 deletions demo/src/defaultClauseValue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
export default {
object: 'value',
document: {
object: 'document',
data: {},
nodes: [
{
object: 'block',
type: 'clause',
data: {
tag: 'clause',
attributes: {
src: 'https://templates.accordproject.org/archives/[email protected]'
},
attributeString: 'src = "https://templates.accordproject.org/archives/[email protected]"',
content: '\n Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, "Dan" (the Seller) shall pay to "Steve" (the Buyer) for every 2 days of delay penalty amounting to 10.5% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 55% of the total value of the Equipment involved in late delivery. If the delay is more than 15 days, the Buyer is entitled to terminate this Contract.\n ',
closed: false
},
nodes: [
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: '\n Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, "Dan" (the Seller) shall pay to "Steve" (the Buyer) for every 2 days of delay penalty amounting to 10.5% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 55% of the total value of the Equipment involved in late delivery. If the delay is more than 15 days, the Buyer is entitled to terminate this Contract.\n ',
marks: []
}
]
}
]
},
]
}
};
123 changes: 123 additions & 0 deletions demo/src/defaultContractValue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
export default {
object: 'value',
document: {
object: 'document',
data: {},
nodes: [
{
object: 'block',
type: 'heading_one',
data: {},
nodes: [
{
object: 'text',
text: 'Supply Agreement',
marks: []
}
]
},
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'This is a supply agreement between Party A and Party B.',
marks: []
}
]
},
{
object: 'block',
type: 'heading_one',
data: {},
nodes: [
{
object: 'text',
text: 'Payment',
marks: []
}
]
},
{
object: 'block',
type: 'clause',
data: {
tag: 'clause',
attributes: {
src: 'https://templates.accordproject.org/archives/[email protected]'
},
attributeString: 'src = "https://templates.accordproject.org/archives/[email protected]"',
content: '\n Upon the signing of this Agreement, "Dan" shall pay the total purchase price to "Steve" in the amount of 0.01 USD.\n ',
closed: false
},
nodes: [
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: '\n Upon the signing of this Agreement, "Dan" shall pay the total purchase price to "Steve" in the amount of 0.01 USD.\n ',
marks: []
}
]
}
]
},
{
object: 'block',
type: 'heading_two',
data: {},
nodes: [
{
object: 'text',
text: 'Late Delivery And Penalty',
marks: []
}
]
},
{
object: 'block',
type: 'clause',
data: {
tag: 'clause',
attributes: {
src: 'https://templates.accordproject.org/archives/[email protected]'
},
attributeString: 'src = "https://templates.accordproject.org/archives/[email protected]"',
content: '\n Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, "Dan" (the Seller) shall pay to "Steve" (the Buyer) for every 2 days of delay penalty amounting to 10.5% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 55% of the total value of the Equipment involved in late delivery. If the delay is more than 15 days, the Buyer is entitled to terminate this Contract.\n ',
closed: false
},
nodes: [
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: '\n Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, "Dan" (the Seller) shall pay to "Steve" (the Buyer) for every 2 days of delay penalty amounting to 10.5% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 55% of the total value of the Equipment involved in late delivery. If the delay is more than 15 days, the Buyer is entitled to terminate this Contract.\n ',
marks: []
}
]
}
]
},
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'End.',
marks: []
}
]
}
]
}
};
28 changes: 4 additions & 24 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,8 @@ import { Template, Clause } from '@accordproject/cicero-core';
import 'semantic-ui-css/semantic.min.css';
import ClauseEditor from '../../src/ClauseEditor';
import ContractEditor from '../../src/ContractEditor';

const clauseEditorInitialMarkdown = `<clause src="https://templates.accordproject.org/archives/[email protected]">
Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, "Dan" (the Seller) shall pay to "Steve" (the Buyer) for every 2 days of delay penalty amounting to 10.5% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 55% of the total value of the Equipment involved in late delivery. If the delay is more than 15 days, the Buyer is entitled to terminate this Contract.
</clause>`;

const contractEditorInitialMarkdown = `# Supply Agreement
This is a supply agreement between Party A and Party B.
# Payment
<clause src="https://templates.accordproject.org/archives/[email protected]">
Upon the signing of this Agreement, <variable name="buyer">"Dan"</variable> shall pay the total purchase price to <variable name="seller">"Steve"</variable> in the amount of 0.01 USD.
</clause>
## Late Delivery And Penalty
<clause src="https://templates.accordproject.org/archives/[email protected]">
Late Delivery and Penalty. In case of delayed delivery except for Force Majeure cases, "Dan" (the Seller) shall pay to "Steve" (the Buyer) for every 2 days of delay penalty amounting to 10.5% of the total value of the Equipment whose delivery has been delayed. Any fractional part of a days is to be considered a full days. The total amount of penalty shall not however, exceed 55% of the total value of the Equipment involved in late delivery. If the delay is more than 15 days, the Buyer is entitled to terminate this Contract.
</clause>
End.
`;
import defaultContractValue from './defaultContractValue';
import defaultClauseValue from './defaultClauseValue';

/**
* A demo component that uses ContractEditor and
Expand Down Expand Up @@ -66,13 +46,13 @@ function Demo() {
const demo = activeItem === 'clauseEditor'
? <ClauseEditor
lockText={false}
markdown={clauseEditorInitialMarkdown}
value={defaultClauseValue}
onChange={onChange}
onParse={onParse}
/>
: <ContractEditor
lockText={false}
markdown={contractEditorInitialMarkdown}
value={defaultContractValue}
onChange={onChange}
/>;

Expand Down
33 changes: 29 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@accordproject/cicero-core": "^0.12.3",
"@accordproject/markdown-editor": "^0.4.9",
"@accordproject/markdown-editor": "^0.4.13",
"lodash": "^4.17.11",
"mini-css-extract-plugin": "^0.7.0",
"node-sass": "^4.12.0",
Expand Down
6 changes: 2 additions & 4 deletions src/ClauseEditor/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

exports[`<ClauseEditor /> on initialization renders page correctly 1`] = `
<div>
<MarkdownEditor
<ContractEditor
lockText={true}
markdown=""
markdownMode={false}
onChange={[Function]}
plugins={Array []}
showEditButton={true}
value={null}
/>
<ParseResult
parseResult={null}
Expand Down
2 changes: 1 addition & 1 deletion src/ClauseEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function ClauseEditor(props) {
return (
<div>
<ContractEditor
markdown={props.markdown}
value={props.value}
lockText={props.lockText}
plugins={props.plugins}
onChange={onChange}
Expand Down
2 changes: 1 addition & 1 deletion src/ClauseEditor/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import toJson from 'enzyme-to-json';
import ClauseEditor from './index';

const props = {
markdown: '',
value: null,
onParse: () => 1,
onChange: () => 1,
lockText: true,
Expand Down
Loading

0 comments on commit aceebb8

Please sign in to comment.