Importing contract and bootstrap css

This commit is contained in:
Richard Ramos 2018-05-10 12:31:10 -04:00 committed by Pascal Precht
parent c4961d69b6
commit 8acf136c01
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
3 changed files with 35 additions and 8 deletions

View File

@ -26,16 +26,25 @@ class ScaffoldingReact {
fs.writeFileSync(filePath, result); fs.writeFileSync(filePath, result);
} }
build(contract){ _buildHTML(contract){
const filename = contract.className.toLowerCase(); const filename = contract.className.toLowerCase();
this._generateFile(contract, 'index.html.tpl', 'html', this._generateFile(contract, 'index.html.tpl', 'html',
{ {
'title': contract.className, 'title': contract.className,
'filename': filename 'filename': filename
}); });
}
this._generateFile(contract, 'dapp.js.tpl', 'js', {}); build(contract){
this._buildHTML(contract);
const filename = contract.className.toLowerCase();
this._generateFile(contract, 'dapp.js.tpl', 'js',
{
'title': contract.className + ' autogenerated UI',
'contractName': contract.className
});
// Update config // Update config
const contents = fs.readFileSync("./embark.json"); const contents = fs.readFileSync("./embark.json");

View File

@ -1,9 +1,26 @@
import EmbarkJS from 'Embark/EmbarkJS';
import {{contractName}} from 'Embark/contracts/{{contractName}}';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Tabs, Tab } from 'react-bootstrap'; import { Tabs, Tab } from 'react-bootstrap';
class {{contractName}}UI extends React.Component {
constructor (props) {
super(props);
this.state = {
};
}
render(){
return (<h2>Test</h2>);
}
}
ReactDOM.render(<div> ReactDOM.render(<div>
ABCDE <h1>{{title}}</h1>
<{{contractName}}UI />
</div>, </div>,
document.getElementById('app') document.getElementById('app')
); );

View File

@ -2,6 +2,7 @@
<html lang="en" dir="ltr"> <html lang="en" dir="ltr">
<head> <head>
<title>{{title}}</title> <title>{{title}}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head> </head>
<body class="container"> <body class="container">
<div id="app"></div> <div id="app"></div>