Skip to content

Commit

Permalink
Removed bind and changed branding to Collaborizm from React.
Browse files Browse the repository at this point in the history
  • Loading branch information
aharshac committed Jul 11, 2017
1 parent 85b352e commit f60dc64
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 34 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"deploy": "npm run build && firebase deploy",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"preserve": "npm run build",
"serve": "serve -s build -p 3000"
},
"description": "[![collaborizm](https://img.shields.io/badge/Collaborizm-sign%20up-brightgreen.svg)](https://www.collaborizm.com)",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React Markdown Table Generator</title>
<title>Collaborizm Markdown Table Generator</title>
</head>
<body>
<div id="root"></div>
Expand Down
43 changes: 15 additions & 28 deletions src/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,13 @@ export default class App extends Component {
alertModalHidden: true,
helpModalHidden: true,
};

this.handleTableNew = this.handleTableNew.bind(this);
this.handleTableImport = this.handleTableImport.bind(this);
this.handleCellEdit = this.handleCellEdit.bind(this);
this.handleCellEditDone = this.handleCellEditDone.bind(this);
this.clearRows = this.clearRows.bind(this);
this.generateMarkdown = this.generateMarkdown.bind(this);

this.setNewModalHidden = this.setNewModalHidden.bind(this);
this.setImportModalHidden = this.setImportModalHidden.bind(this);
this.setEditCellHidden = this.setEditCellHidden.bind(this);
this.setClearModalHidden = this.setClearModalHidden.bind(this);
this.setAlertModalHidden = this.setAlertModalHidden.bind(this);
}

componentDidMount() {
const appState = loadAppState();
if (appState) {
const { rowSize, colSize, importText } = appState;
if (rowSize && rowSize) {
if (rowSize && colSize) {
this.setState({ rowSize, colSize, importText });
return;
}
Expand All @@ -73,20 +60,20 @@ export default class App extends Component {
saveAppState({ rowSize, colSize, importText });
}

setNewModalHidden(newModalHidden = true) { this.setState({ newModalHidden }); }
setNewModalHidden = (newModalHidden = true) => this.setState({ newModalHidden });

setImportModalHidden(importModalHidden = true) { this.setState({ importModalHidden }); }
setImportModalHidden = (importModalHidden = true) => this.setState({ importModalHidden });

setEditCellHidden(editCellHidden = true) { this.setState({ editCellHidden }); }
setEditCellHidden = (editCellHidden = true) => this.setState({ editCellHidden });

setClearModalHidden(clearModalHidden = true) { this.setState({ clearModalHidden }); }
setClearModalHidden = (clearModalHidden = true) => this.setState({ clearModalHidden });

setAlertModalHidden(alertModalHidden, alert = '') { this.setState({ alertModalHidden, alert }); }
setAlertModalHidden = (alertModalHidden, alert = '') => this.setState({ alertModalHidden, alert });

setHelpModalHidden = (helpModalHidden) => this.setState({ helpModalHidden });


handleTableNew(rowSize, colSize) {
handleTableNew = (rowSize, colSize) => {
clearAppState();
//this.grid.clearTable();
rowSize = parseInt(rowSize, 10);
Expand All @@ -95,7 +82,7 @@ export default class App extends Component {
this.setState({ result: '', rowSize, colSize, newModalHidden: true });
}

handleTableImport(text) {
handleTableImport = (text) => {
const data = Importer.tableToArray(text);
if (!data) {
this.setState({ importText: text, importModalHidden: true, alertModalHidden: false, alert: 'Could not import invalid table.' });
Expand All @@ -107,28 +94,28 @@ export default class App extends Component {
}
}

handleCellEdit(row, column, text) {
handleCellEdit = (row, column, text) => {
this.setState({ editRow: parseInt(row, 10), editCol: parseInt(column, 10), editText: text, editCellHidden: false });
}

handleCellEditDone(row, column, text) {
handleCellEditDone = (row, column, text) => {
this.grid.updateEditedCell(row, column, text);
this.setState({ editRow: null, editCol: null, editText: '', editCellHidden: true });
}

clearRows() {
clearRows = () => {
this.grid.clearTable();
this.setState({ result: '', clearModalHidden: true });
}

generateMarkdown() {
generateMarkdown = () => {
this.grid.getTableRows((table, align) => {
const md = MdTable(table, { align });
this.setState({ result: md });
});
}

getHtmlOutput(result) {
getHtmlOutput = (result) => {
if (!result) return null;
return(
<pre className="result-code">
Expand All @@ -141,7 +128,7 @@ export default class App extends Component {
);
}

getCopyButton(result) {
getCopyButton = (result) => {
if (!result) return null;
return(
<CopyToClipboard text={result} onCopy={() => this.setAlertModalHidden(false, 'Output is copied to the clipboard.')}>
Expand All @@ -160,7 +147,7 @@ export default class App extends Component {
return (
<div className="app">
<div className="app-header">
<h2>React Markdown Table Generator</h2>
<h2>Collaborizm Markdown Table Generator</h2>
<a href="https://www.collaborizm.com" target="_blank">
<img src={LogoCollaborizm} className="logo-collaborizm" alt="logo" />
</a>
Expand Down
10 changes: 5 additions & 5 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ body {
}

body.modal-open .app{
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
}

0 comments on commit f60dc64

Please sign in to comment.