Merge pull request #1883 from iminoso/webpack

Installing skeleton Webpack build tool on front end
This commit is contained in:
Ian Minoso 2016-10-26 12:02:05 -04:00 committed by GitHub
commit f306177f01
13 changed files with 150 additions and 36 deletions

9
static/js/app.tsx Normal file
View file

@ -0,0 +1,9 @@
import * as React from "react";
import * as angular from "angular";
import repoHeader from "./directives/components/component";
angular.module('quayPages').directive('repoHeader', function(reactDirective) {
return reactDirective(repoHeader);
});

View file

@ -0,0 +1,10 @@
import * as React from "react";
class repoHeader extends React.Component<{}, {}> {
render () {
return <p> The component for the header</p>;
}
}
export default repoHeader;

View file

@ -1,20 +0,0 @@
/**
* A react component implemented using the ngReact library
*/
var testComponent = React.createClass({
propTypes: {
firstProp: React.PropTypes.string.isRequired,
secondProp: React.PropTypes.string.isRequired
},
render: function() {
return React.DOM.span(null,
'This is a react component: ' + this.props.firstProp + ' ' + this.props.secondProp
);
}
});
angular.module('quayPages').value('test-component', testComponent);
angular.module('quayPages').directive('testComponent', function(reactDirective) {
return reactDirective('testComponent');
});

View file

@ -4,17 +4,8 @@
<div class="page-content">
<!-- New Public Repo Page experiment -->
<div ng-if="newRepoExperiment" class="main-panel">
<!-- Test React Component -->
<div>
<div>
<div>This is using the generic react-component directive</div>
<react-component name="test-component" props="reactProps"/>
</div>
<div>
<div>This is creating a specific directive corresponding to a react component</div>
<test-component first-prop="reactProps.firstProp" second-prop="reactProps.secondProp"/>
</div>
</div>
<!-- React Components -->
<repo-header />
</div>
<!-- Old Repo Page -->
<div ng-if="!newRepoExperiment">