Skip to content

Commit

Permalink
Start v3.0
Browse files Browse the repository at this point in the history
- Add TypeScript
- Update React, Babel, Webpack versions to latest
  • Loading branch information
mcallegari10 committed Mar 6, 2020
1 parent 6cf0856 commit 4eb0ec3
Show file tree
Hide file tree
Showing 15 changed files with 15,049 additions and 9,754 deletions.
8 changes: 5 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"presets": [
["env", {
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
}
}],
"react"
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"transform-class-properties",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
["module-resolver", {
"root": ["./src"],
"alias": {
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib
dev
webpack.config*
11 changes: 6 additions & 5 deletions dev/App.js → dev/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { Component } from 'react';
import * as React from 'react';

import { Widget, addResponseMessage, setQuickButtons, toggleMsgLoader } from '../index';

export default class App extends Component {
export default class App extends React.Component {
componentDidMount() {
addResponseMessage('Welcome to this awesome chat!');
}

handleNewUserMessage = (newMessage) => {
handleNewUserMessage = (newMessage: any) => {
toggleMsgLoader();
setTimeout(() => {
toggleMsgLoader();
toggleMsgLoader();
if (newMessage === 'fruits') {
setQuickButtons([ { label: 'Apple', value: 'apple' }, { label: 'Orange', value: 'orange' }, { label: 'Pear', value: 'pear' }, { label: 'Banana', value: 'banana' } ]);
} else {
Expand All @@ -18,7 +19,7 @@ export default class App extends Component {
}, 2000);
}

handleQuickButtonClicked = (e) => {
handleQuickButtonClicked = (e: any) => {
addResponseMessage('Selected ' + e);
setQuickButtons([]);
}
Expand Down
4 changes: 2 additions & 2 deletions dev/main.js → dev/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

import App from './App';

Expand Down
Loading

0 comments on commit 4eb0ec3

Please sign in to comment.