commit
stringlengths 40
40
| old_file
stringlengths 4
150
| new_file
stringlengths 4
150
| old_contents
stringlengths 0
3.26k
| new_contents
stringlengths 1
4.43k
| subject
stringlengths 15
501
| message
stringlengths 15
4.06k
| lang
stringclasses 4
values | license
stringclasses 13
values | repos
stringlengths 5
91.5k
| diff
stringlengths 0
4.35k
|
---|---|---|---|---|---|---|---|---|---|---|
701d838dfc5afd616ccc94c2083bcc3564067342 | app/assets/javascripts/components/search_container.js.jsx | app/assets/javascripts/components/search_container.js.jsx | var SearchContainer = React.createClass({
sendQuery: function() {
if(this.state.searchQuery === '') { return; };
this.setState({ isSearching: true });
$.ajax({
url: '/api/search/amazon/?query=' + this.state.searchQuery,
method: 'get',
dataType: 'json',
contentType: 'application/json',
error: function(jqXHR, textStatus, errorThrown) {
alert('Search error:', errorThrown);
},
success: function(data, textStatus, jqXHR) {
this.setState({
listItems: data,
isSearching: false
});
}.bind(this),
always: function() {
this.setState({ isSearching: false })
}.bind(this)
});
},
componentWillReceiveProps: function(nextProps) {
if(this.props.searchQuery != nextProps.searchQuery) {
this.setState({
searchQuery: nextProps.searchQuery,
})
}
},
componentDidUpdate: function(prevProps, prevState) {
if(prevState.searchQuery != this.state.searchQuery) {
this.sendQuery();
}
},
getInitialState: function() {
return {
searchQuery: this.props.searchQuery,
listItems: [],
isSearching: false
};
},
render: function() {
return (
<div>
<h2>Amazon suggestions</h2>
<SearchResultsList listItems={ this.state.listItems } isSearching={ this.state.isSearching } />
</div>
);
}
});
| var SearchContainer = React.createClass({
sendQuery: function() {
if(this.state.searchQuery === '') { return; };
this.setState({
isSearching: true,
listItems: []
});
$.ajax({
url: '/api/search/amazon/?query=' + this.state.searchQuery,
method: 'get',
dataType: 'json',
contentType: 'application/json',
error: function(jqXHR, textStatus, errorThrown) {
alert('Search error:', errorThrown);
},
success: function(data, textStatus, jqXHR) {
this.setState({
listItems: data,
isSearching: false
});
}.bind(this),
always: function() {
this.setState({ isSearching: false })
}.bind(this)
});
},
componentWillReceiveProps: function(nextProps) {
if(this.props.searchQuery != nextProps.searchQuery) {
this.setState({
searchQuery: nextProps.searchQuery,
})
}
},
componentDidUpdate: function(prevProps, prevState) {
if(prevState.searchQuery != this.state.searchQuery) {
this.sendQuery();
}
},
getInitialState: function() {
return {
searchQuery: this.props.searchQuery,
listItems: [],
isSearching: false
};
},
render: function() {
return (
<div>
<h2 className="u-mb-2">Amazon suggestions</h2>
<SearchResultsList listItems={ this.state.listItems } isSearching={ this.state.isSearching } />
</div>
);
}
});
| Reset search result list when new search begins. | Reset search result list when new search begins.
| JSX | mit | kirillis/mytopten,kirillis/mytopten,krisimmig/mytopten,krisimmig/mytopten,krisimmig/mytopten,kirillis/mytopten | ---
+++
@@ -2,7 +2,10 @@
sendQuery: function() {
if(this.state.searchQuery === '') { return; };
- this.setState({ isSearching: true });
+ this.setState({
+ isSearching: true,
+ listItems: []
+ });
$.ajax({
url: '/api/search/amazon/?query=' + this.state.searchQuery,
@@ -49,7 +52,7 @@
render: function() {
return (
<div>
- <h2>Amazon suggestions</h2>
+ <h2 className="u-mb-2">Amazon suggestions</h2>
<SearchResultsList listItems={ this.state.listItems } isSearching={ this.state.isSearching } />
</div>
); |
4c8153f8fba051440ef52023d58f36cd221537ae | template/src/components/toggle-button/toggle-button.jsx | template/src/components/toggle-button/toggle-button.jsx | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import styles from './toggle-button.less';
class ToggleButton extends Component {
static displayName = 'ToggleButton';
static propTypes = {
onClick: PropTypes.func,
children: PropTypes.node
};
static defaultProps = {
children: 'Toggle Status'
};
componentDidMount() {
this.noop();
}
// A no-operation so that the linter passes for the compass-plugin template,
// without the need to an ignore rule, because we want the linter to fail when this
// dependency is "for-real" not being used (ie: in an actual plugin).
noop = () => {
const node = ReactDOM.findDOMNode(this);
return node;
};
/**
* Render ToggleButton.
*
* @returns {React.Component} the rendered component.
*/
render() {
return (
<button
className={classnames(styles.button, styles['button--ghost'], styles['button--animateFromTop'])}
type="button"
onClick={this.props.onClick}>
<span className={classnames(styles['button-text'])}>
{this.props.children}
</span>
</button>
);
}
}
export default ToggleButton;
export { ToggleButton };
| import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import styles from './toggle-button.less';
class ToggleButton extends Component {
static displayName = 'ToggleButton';
static propTypes = {
onClick: PropTypes.func,
children: PropTypes.node
};
static defaultProps = {
children: 'Toggle Status'
};
componentDidMount() {
this.noop();
}
// A no-operation so that the linter passes for the compass-plugin template,
// without the need to an ignore rule, because we want the linter to fail when this
// dependency is "for-real" not being used (ie: in an actual plugin).
noop = () => {
const node = ReactDOM.findDOMNode(this);
return node;
};
/**
* Render ToggleButton.
*
* @returns {React.Component} the rendered component.
*/
render() {
return (
<button
className={classnames(styles.button, styles['button--ghost'], styles['button--animateFromTop'])}
type="button"
onClick={this.props.onClick}>
<span className={classnames(styles['button-text'])}>
{this.props.children}
</span>
</button>
);
}
}
export default ToggleButton;
export { ToggleButton };
| Correct default indentation on toggle button | Correct default indentation on toggle button
| JSX | apache-2.0 | mongodb-js/compass-plugin,mongodb-js/compass-plugin | ---
+++
@@ -36,14 +36,14 @@
*/
render() {
return (
- <button
- className={classnames(styles.button, styles['button--ghost'], styles['button--animateFromTop'])}
- type="button"
- onClick={this.props.onClick}>
- <span className={classnames(styles['button-text'])}>
- {this.props.children}
- </span>
- </button>
+ <button
+ className={classnames(styles.button, styles['button--ghost'], styles['button--animateFromTop'])}
+ type="button"
+ onClick={this.props.onClick}>
+ <span className={classnames(styles['button-text'])}>
+ {this.props.children}
+ </span>
+ </button>
);
}
} |
777153092fafe6c8a6161b30a9f366360f1e527a | client/app/widgets/CrisisPrevention/__tests___/index.spec.jsx | client/app/widgets/CrisisPrevention/__tests___/index.spec.jsx | // @flow
import { render } from 'enzyme';
import React from 'react';
import CrisisPrevention from '../index';
describe('CrisisPrevention', () => {
it('renders the component', () => {
let wrapper;
expect(() => {
wrapper = render(<CrisisPrevention />);
}).not.toThrow();
expect(wrapper).not.toBeNull();
});
});
| import { render } from 'enzyme';
import React from 'react';
import CrisisPrevention from '../index';
describe('CrisisPrevention', () => {
it('renders the component', () => {
let wrapper;
expect(() => {
wrapper = render(<CrisisPrevention />);
}).not.toThrow();
expect(wrapper).not.toBeNull();
});
});
| Remove @flow from CrisisPrevention test | Remove @flow from CrisisPrevention test
| JSX | agpl-3.0 | julianguyen/ifme,cartothemax/ifme,julianguyen/ifme,cartothemax/ifme,julianguyen/ifme,cartothemax/ifme,cartothemax/ifme,julianguyen/ifme | ---
+++
@@ -1,4 +1,3 @@
-// @flow
import { render } from 'enzyme';
import React from 'react';
import CrisisPrevention from '../index'; |
951f0d7e508155dec305cf7a3321a12f1f28fe9a | src/main/webapp/resources/js/pages/launch/LaunchParameters.jsx | src/main/webapp/resources/js/pages/launch/LaunchParameters.jsx | import React from "react";
import { SectionHeading } from "../../components/ant.design/SectionHeading";
import { SavedParameters } from "./parameters/SavedParameters";
import { LaunchParametersWithOptions } from "./LaunchParametersWithOptions";
import { useLaunch } from "./launch-context";
/**
* React component to render any parameters required for a pipeline launch
* @param form
* @returns {JSX.Element}
* @constructor
*/
export function LaunchParameters({ form }) {
const [{ dynamicSources, parameterWithOptions, parameterSets }] = useLaunch();
return (
<section>
<SectionHeading id="launch-parameters">
{i18n("LaunchParameters.title")}
</SectionHeading>
{parameterSets && <SavedParameters form={form} sets={parameterSets} />}
{parameterWithOptions && (
<LaunchParametersWithOptions parameters={parameterWithOptions} />
)}
{dynamicSources && (
<LaunchParametersWithOptions parameters={dynamicSources} />
)}
</section>
);
}
| import React from "react";
import { SectionHeading } from "../../components/ant.design/SectionHeading";
import { SavedParameters } from "./parameters/SavedParameters";
import { LaunchParametersWithOptions } from "./LaunchParametersWithOptions";
import { useLaunch } from "./launch-context";
/**
* React component to render any parameters required for a pipeline launch
* @param form
* @returns {JSX.Element}
* @constructor
*/
export function LaunchParameters({ form }) {
const [{ dynamicSources, parameterWithOptions, parameterSets }] = useLaunch();
return (
<section>
<SectionHeading id="launch-parameters">
{i18n("LaunchParameters.title")}
</SectionHeading>
{parameterSets[0]?.parameters.length ? (
<SavedParameters form={form} sets={parameterSets} />
) : null}
{parameterWithOptions && (
<LaunchParametersWithOptions parameters={parameterWithOptions} />
)}
{dynamicSources && (
<LaunchParametersWithOptions parameters={dynamicSources} />
)}
</section>
);
}
| Hide saved parameters if there are none | Hide saved parameters if there are none
| JSX | apache-2.0 | phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida | ---
+++
@@ -18,7 +18,9 @@
<SectionHeading id="launch-parameters">
{i18n("LaunchParameters.title")}
</SectionHeading>
- {parameterSets && <SavedParameters form={form} sets={parameterSets} />}
+ {parameterSets[0]?.parameters.length ? (
+ <SavedParameters form={form} sets={parameterSets} />
+ ) : null}
{parameterWithOptions && (
<LaunchParametersWithOptions parameters={parameterWithOptions} />
)} |
f986aac31189f2a1318b6c4157843e8ae9218e10 | app/operator/visitors/visitor/detailed_description/index.jsx | app/operator/visitors/visitor/detailed_description/index.jsx | import React from 'react';
import * as moment from 'moment';
export default React.createClass({
propTypes: {
firstTime: React.PropTypes.number.isRequired,
lastTime: React.PropTypes.number.isRequired,
remote: React.PropTypes.string.isRequired,
invitedBy: React.PropTypes.string,
invitationTime: React.PropTypes.number,
invitationsCount: React.PropTypes.number.isRequired,
chatsCount: React.PropTypes.number.isRequired
},
getDefaultProps() {
return {
invitationTime: '-',
invitedBy: '-'
};
},
render() {
return (
<dl>
<dt>First seen:</dt>
<dd>{moment.unix(this.props.firstTime).fromNow()}</dd>
<dt>Last seen:</dt>
<dd>{moment.unix(this.props.lastTime).fromNow()}</dd>
<dt>Address:</dt>
<dd>{this.props.address}</dd>
<dt>Invited by</dt>
<dd>{this.props.invitedBy}</dd>
<dt>Invitation Time:</dt>
<dd>{this.props.invitationTime}</dd>
<dt>Invitations / Chats:</dt>
<dd>{this.props.invitationsCount} / {this.props.chatsCount}</dd>
</dl>
);
}
});
| import React from 'react';
import * as moment from 'moment';
export default React.createClass({
propTypes: {
firstTime: React.PropTypes.number.isRequired,
lastTime: React.PropTypes.number.isRequired,
remote: React.PropTypes.string.isRequired,
invitedBy: React.PropTypes.string,
invitationTime: React.PropTypes.number,
invitationsCount: React.PropTypes.number.isRequired,
chatsCount: React.PropTypes.number.isRequired
},
getDefaultProps() {
return {
invitationTime: null,
invitedBy: '-'
};
},
render() {
return (
<dl>
<dt>First seen:</dt>
<dd>{this._formatTimeDiff(this.props.firstTime)}</dd>
<dt>Last seen:</dt>
<dd>{this._formatTimeDiff(this.props.lastTime)}</dd>
<dt>Address:</dt>
<dd>{this.props.address}</dd>
<dt>Invited by</dt>
<dd>{this.props.invitedBy}</dd>
<dt>Invitation Time:</dt>
<dd>{this.props.invitationTime
? this._formatTimeDiff(this.props.invitationTime)
: '-'}</dd>
<dt>Invitations / Chats:</dt>
<dd>{this.props.invitationsCount} / {this.props.chatsCount}</dd>
</dl>
);
},
_formatTimeDiff(timestamp) {
return moment.unix(timestamp).fromNow();
}
});
| Use Moment.js for visitor's invitation time | Use Moment.js for visitor's invitation time | JSX | apache-2.0 | JustBlackBird/mibew-ui,JustBlackBird/mibew-ui | ---
+++
@@ -14,7 +14,7 @@
getDefaultProps() {
return {
- invitationTime: '-',
+ invitationTime: null,
invitedBy: '-'
};
},
@@ -23,18 +23,24 @@
return (
<dl>
<dt>First seen:</dt>
- <dd>{moment.unix(this.props.firstTime).fromNow()}</dd>
+ <dd>{this._formatTimeDiff(this.props.firstTime)}</dd>
<dt>Last seen:</dt>
- <dd>{moment.unix(this.props.lastTime).fromNow()}</dd>
+ <dd>{this._formatTimeDiff(this.props.lastTime)}</dd>
<dt>Address:</dt>
<dd>{this.props.address}</dd>
<dt>Invited by</dt>
<dd>{this.props.invitedBy}</dd>
<dt>Invitation Time:</dt>
- <dd>{this.props.invitationTime}</dd>
+ <dd>{this.props.invitationTime
+ ? this._formatTimeDiff(this.props.invitationTime)
+ : '-'}</dd>
<dt>Invitations / Chats:</dt>
<dd>{this.props.invitationsCount} / {this.props.chatsCount}</dd>
</dl>
);
+ },
+
+ _formatTimeDiff(timestamp) {
+ return moment.unix(timestamp).fromNow();
}
}); |
217e26230573d32b515b9c76f17d7edcbdc51bb7 | src/components/util/hydra_aware.jsx | src/components/util/hydra_aware.jsx | "use strict";
var React = require('react')
, Immutable = require('immutable')
module.exports = function makeHydraLinkAware(Component) {
var HydraAwareComponent = React.createClass({
propTypes: {
data: React.PropTypes.instanceOf(Immutable.Map)
},
hasHydraOperation(type) {
var { data } = this.props
return data
.get('hydra:operation')
.some(operation => (
operation.get('type') === `hydra:${type}ResourceOperation`))
},
canCreate() {
return this.hasHydraOperation('Create')
},
canReplace() {
return this.hasHydraOperation('Replace')
},
canDelete() {
return this.hasHydraOperation('Delete')
},
render() {
return (
<Component
{...this.props}
canCreate={this.canCreate}
canReplace={this.canReplace}
canDelete={this.canDelete} />
)
}
});
return HydraAwareComponent
}
| "use strict";
var React = require('react')
, Immutable = require('immutable')
module.exports = function makeHydraLinkAware(Component) {
var HydraAwareComponent = React.createClass({
propTypes: {
data: React.PropTypes.instanceOf(Immutable.Map)
},
hasHydraOperation(type) {
var { data } = this.props
return data
.get('hydra:operation')
.some(operation => (
operation.get('@type') === `hydra:${type}ResourceOperation`))
},
canCreate() {
return this.hasHydraOperation('Create')
},
canReplace() {
return this.hasHydraOperation('Replace')
},
canDelete() {
return this.hasHydraOperation('Delete')
},
render() {
return (
<Component
{...this.props}
canCreate={this.canCreate}
canReplace={this.canReplace}
canDelete={this.canDelete} />
)
}
});
return HydraAwareComponent
}
| Use @type instead of type for detecting hydra operations | Use @type instead of type for detecting hydra operations
| JSX | agpl-3.0 | editorsnotes/editorsnotes-renderer | ---
+++
@@ -15,7 +15,7 @@
return data
.get('hydra:operation')
.some(operation => (
- operation.get('type') === `hydra:${type}ResourceOperation`))
+ operation.get('@type') === `hydra:${type}ResourceOperation`))
},
canCreate() { |
bab7eece59505be3bd827730f9725519bb19d406 | imports/ui/report-view/table/element-characteristic-filter.jsx | imports/ui/report-view/table/element-characteristic-filter.jsx | import { Meteor } from 'meteor/meteor';
import React, { PropTypes } from 'react';
import { Glyphicon, OverlayTrigger, Popover, FormGroup, Checkbox } from 'react-bootstrap';
import Elements from '../../../api/elements/elements.js';
const ElementCharacteristicFilter = (props) => {
const originalElement = Elements.collection.findOne(props.element.elementId);
return (
<OverlayTrigger
trigger="click"
placement="right"
rootClose
overlay={
<Popover title="Characteristics" >
<FormGroup>
{originalElement.characteristics.map((characteristic) => {
return (
<Checkbox
checked={isPresent(characteristic, props.element.characteristicIds)}
onClick={() => Meteor.call('Reports.toggleCharacteristic',
props.reportId,
props.element.elementId,
characteristic._id,
isPresent(characteristic, props.element.characteristicIds)
)}
>
{characteristic.value}
</Checkbox>
);
})}
</FormGroup>
</Popover>
}
>
<Glyphicon className="pull-right" glyph="filter" />
</OverlayTrigger>
);
};
const isPresent = (characteristic, reportElementCharacteristicIds) => {
return reportElementCharacteristicIds.indexOf(characteristic._id) > -1;
};
ElementCharacteristicFilter.propTypes = {
element: PropTypes.object.isRequired,
reportId: PropTypes.string.isRequired,
};
export default ElementCharacteristicFilter;
| import { Meteor } from 'meteor/meteor';
import React, { PropTypes } from 'react';
import { Glyphicon, OverlayTrigger, Popover, FormGroup, Checkbox } from 'react-bootstrap';
import Elements from '../../../api/elements/elements.js';
const ElementCharacteristicFilter = (props) => {
const originalElement = Elements.collection.findOne(props.element.elementId);
return (
<OverlayTrigger
trigger="click"
placement="right"
rootClose
overlay={
<Popover id={originalElement._id} title="Characteristics" >
<FormGroup>
{originalElement.characteristics.map((characteristic) => {
return (
<Checkbox
checked={isPresent(characteristic, props.element.characteristicIds)}
onClick={() => Meteor.call('Reports.toggleCharacteristic',
props.reportId,
props.element.elementId,
characteristic._id,
isPresent(characteristic, props.element.characteristicIds)
)}
key={characteristic._id}
>
{characteristic.value}
</Checkbox>
);
})}
</FormGroup>
</Popover>
}
>
<Glyphicon className="pull-right" glyph="filter" />
</OverlayTrigger>
);
};
const isPresent = (characteristic, reportElementCharacteristicIds) => {
return reportElementCharacteristicIds.indexOf(characteristic._id) > -1;
};
ElementCharacteristicFilter.propTypes = {
element: PropTypes.object.isRequired,
reportId: PropTypes.string.isRequired,
};
export default ElementCharacteristicFilter;
| Add id to popover and key to characteristics list in popover | Add id to popover and key to characteristics list in popover
| JSX | mit | minden/data-furnace,minden/data-furnace | ---
+++
@@ -11,7 +11,7 @@
placement="right"
rootClose
overlay={
- <Popover title="Characteristics" >
+ <Popover id={originalElement._id} title="Characteristics" >
<FormGroup>
{originalElement.characteristics.map((characteristic) => {
return (
@@ -23,6 +23,7 @@
characteristic._id,
isPresent(characteristic, props.element.characteristicIds)
)}
+ key={characteristic._id}
>
{characteristic.value}
</Checkbox> |
2ed8c85956bd2ff40eacc83bc00e11c42c7e2c72 | src/components/SelectField/SelectFieldContainer.jsx | src/components/SelectField/SelectFieldContainer.jsx | import { connect } from 'react-redux'
import SelectField from './SelectField'
import * as Actions from '../../actions'
function mapStateToProps(state) {
const { category, categories } = state.filter
const menuItems = Object.keys(categories).map((item) => (
{ text: categories[item], value: item }
))
return {
category,
menuItems,
}
}
function mapDispatchToProps(dispatch) {
return {
onChange: (evt) => {
dispatch(Actions.filterCategory(evt.target.value))
dispatch(Actions.updateComicList(0))
},
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(SelectField)
| import { connect } from 'react-redux'
import SelectField from './SelectField'
import * as Actions from '../../actions'
function mapStateToProps(state) {
const { category, categories } = state.filter
const menuItems = Object.keys(categories).map((item) => (
{ text: categories[item], value: item }
))
return {
selectedValue: category,
menuItems,
}
}
function mapDispatchToProps(dispatch) {
return {
onChange: (evt) => {
dispatch(Actions.filterCategory(evt.target.value))
dispatch(Actions.updateComicList(0))
},
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(SelectField)
| Fix incorrect category after navigating back from ComicViewer | Fix incorrect category after navigating back from ComicViewer
| JSX | mit | rickychien/comiz,rickychien/comiz | ---
+++
@@ -11,7 +11,7 @@
))
return {
- category,
+ selectedValue: category,
menuItems,
}
} |
3c47a38afa78201040fa9702cad66f24081d0219 | src/components/semver-checker.jsx | src/components/semver-checker.jsx | var React = require('react'),
semver = require('semver'),
SemverCheckerForm = require('./semver-checker-form.jsx'),
SemverFeedback = require('./semver-feedback.jsx'),
SemverExplain = require('./semver-explain.jsx');
var SemverChecker = React.createClass({
getInitialState: function() {
return {
satisfies: null,
version: null,
constraint: null
};
},
resetState: function() {
this.setState(this.getInitialState());
},
handleSemverCheck: function(version, constraint) {
this.setState({
satisfies: !!semver.satisfies(version, constraint),
version: version,
constraint: constraint
});
},
handleSemverValidate: function(version) {
return semver.valid(version);
},
handleConstraintValidate: function(constraint) {
return semver.validRange(constraint);
},
render: function() {
return (
<div>
<SemverCheckerForm resetState={ this.resetState } onSemverCheck={ this.handleSemverCheck }
onSemverValidate={ this.handleSemverValidate } onConstraintValidate={ this.handleConstraintValidate } />
<SemverFeedback satisfies={ this.state.satisfies } version={ this.state.version } constraint={ this.state.constraint } />
<SemverExplain version={ this.state.version } constraint={ this.state.constraint } />
</div>
);
}
});
module.exports = SemverChecker;
| var React = require('react'),
semver = require('semver'),
SemverCheckerForm = require('./semver-checker-form.jsx'),
SemverFeedback = require('./semver-feedback.jsx'),
SemverExplain = require('./semver-explain.jsx');
var SemverChecker = React.createClass({
getInitialState: function() {
return {
satisfies: null,
version: null,
constraint: null
};
},
resetState: function() {
this.setState(this.getInitialState());
},
handleSemverCheck: function(version, constraint) {
this.setState({
satisfies: !!semver.satisfies(version, constraint),
version: version,
constraint: constraint
});
},
handleSemverValidate: function(version) {
return semver.valid(version);
},
handleConstraintValidate: function(constraint) {
return '' === constraint ? false : semver.validRange(constraint);
},
render: function() {
return (
<div>
<SemverCheckerForm resetState={ this.resetState } onSemverCheck={ this.handleSemverCheck }
onSemverValidate={ this.handleSemverValidate } onConstraintValidate={ this.handleConstraintValidate } />
<SemverFeedback satisfies={ this.state.satisfies } version={ this.state.version } constraint={ this.state.constraint } />
<SemverExplain version={ this.state.version } constraint={ this.state.constraint } />
</div>
);
}
});
module.exports = SemverChecker;
| Fix empty constraint considered as "*" constraint | Fix empty constraint considered as "*" constraint
| JSX | mit | jubianchi/semver-check,jubianchi/semver-check | ---
+++
@@ -29,7 +29,7 @@
},
handleConstraintValidate: function(constraint) {
- return semver.validRange(constraint);
+ return '' === constraint ? false : semver.validRange(constraint);
},
render: function() { |
eac771a103fb03b6da08f8a07dcd613b3d680356 | src/routes/root/routes/organizations/components/value-proposition/content.jsx | src/routes/root/routes/organizations/components/value-proposition/content.jsx | const content = {
title: 'Organizations',
subTitle: 'Your Business Partner for Software Development',
text: `From hiring the right tech professionals to untapping your team’s talent,
we’re here to help you achieve your goals and grow your business. Hundreds of businesses
and organizations trust Agile Actors to form teams for successful projects and keep
their workforce sharp.`,
};
export default content; | const content = {
title: 'Business Services',
subTitle: 'Your Business Partner for Software Development',
text: `
From hiring the right tech professionals to untapping your team’s talent,
we’re here to help you achieve your goals and grow your business. Hundreds of businesses
and organizations trust Agile Actors to form teams for successful projects and keep
their workforce sharp.
`,
};
export default content;
| Change title "Organizations" to "Business Services" | Change title "Organizations" to "Business Services"
| JSX | mit | dimitrisafendras/multiGame,dimitrisafendras/multiGame | ---
+++
@@ -1,10 +1,12 @@
const content = {
- title: 'Organizations',
+ title: 'Business Services',
subTitle: 'Your Business Partner for Software Development',
- text: `From hiring the right tech professionals to untapping your team’s talent,
- we’re here to help you achieve your goals and grow your business. Hundreds of businesses
- and organizations trust Agile Actors to form teams for successful projects and keep
- their workforce sharp.`,
+ text: `
+ From hiring the right tech professionals to untapping your team’s talent,
+ we’re here to help you achieve your goals and grow your business. Hundreds of businesses
+ and organizations trust Agile Actors to form teams for successful projects and keep
+ their workforce sharp.
+ `,
};
export default content; |
47636ef71c8fb94064736b374a77e95a9f556560 | chrome-extension/src/Store.jsx | chrome-extension/src/Store.jsx | import {createStore} from "redux"
export const INITIAL_STATE = Symbol("Initial state")
export const LIKED_STATE = Symbol("Liked state")
export const SET_DISLIKE = Symbol("Set dislike")
export const UNSET_DISLIKE = Symbol("Unset dislike")
const dislikeStore = (state = {disliked: false, liked: false, count: 0}, action) => {
switch (action.type) {
case INITIAL_STATE:
for (const prop in action.data) {
state[prop] = action.data[prop]
}
return state
case LIKED_STATE:
state.liked = action.data
return state
case SET_DISLIKE:
state.disliked = true
state.count++
return state
case UNSET_DISLIKE:
state.disliked = false
state.count--
return state
default:
return state
}
}
export const Store = createStore(dislikeStore)
| import {createStore} from "redux"
export const INITIAL_STATE = Symbol("Initial state")
export const LIKED_STATE = Symbol("Liked state")
export const SET_DISLIKE = Symbol("Set dislike")
export const UNSET_DISLIKE = Symbol("Unset dislike")
const dislikeStore = (state = {disliked: false, liked: false, count: NaN}, action) => {
switch (action.type) {
case INITIAL_STATE:
for (const prop in action.data) {
state[prop] = action.data[prop]
}
return state
case LIKED_STATE:
state.liked = action.data
return state
case SET_DISLIKE:
state.disliked = true
state.count++
return state
case UNSET_DISLIKE:
state.disliked = false
state.count--
return state
default:
return state
}
}
export const Store = createStore(dislikeStore)
| Change default count to NaN | Change default count to NaN
| JSX | mit | mzyy94/yokunaine,mzyy94/yokunaine | ---
+++
@@ -5,7 +5,7 @@
export const SET_DISLIKE = Symbol("Set dislike")
export const UNSET_DISLIKE = Symbol("Unset dislike")
-const dislikeStore = (state = {disliked: false, liked: false, count: 0}, action) => {
+const dislikeStore = (state = {disliked: false, liked: false, count: NaN}, action) => {
switch (action.type) {
case INITIAL_STATE:
for (const prop in action.data) { |
a29d66fc6042952aa83f0e96f277ba568cc28e06 | client/components/NoteList.jsx | client/components/NoteList.jsx | import React from 'react';
// import SearchBar from './SearchBar.jsx';
// Eventually use searchbar inside browse notes?
// Is styling better that way?
import NoteItem from './NoteItem.jsx';
const NoteList = props => (
<div className="notes-list">
<ul>
{props.notes.map(element =>
<NoteItem
store={props.store}
key={element._id}
noteId={element._id}
title={element.title}
text={element.text}
username={props.username}
/>
)}
</ul>
</div>
);
NoteList.propTypes = {
notes: React.PropTypes.arrayOf(React.PropTypes.object),
username: React.PropTypes.string
};
export default NoteList;
| import React from 'react';
// import SearchBar from './SearchBar.jsx';
// Eventually use searchbar inside browse notes?
// Is styling better that way?
import NoteItem from './NoteItem.jsx';
const NoteList = props => (
<div className="notes-list">
<ul>
{props.notes.map(element =>
<NoteItem
store={props.store}
key={element._id}
noteId={element._id}
title={element.title}
text={element.text}
username={props.username}
/>
)}
</ul>
</div>
);
NoteList.propTypes = {
notes: React.PropTypes.arrayOf(React.PropTypes.object),
username: React.PropTypes.string,
};
export default NoteList;
| Fix some linting errors with React proptypes | Fix some linting errors with React proptypes
| JSX | mit | enchanted-spotlight/Plato,enchanted-spotlight/Plato | ---
+++
@@ -25,7 +25,7 @@
NoteList.propTypes = {
notes: React.PropTypes.arrayOf(React.PropTypes.object),
- username: React.PropTypes.string
+ username: React.PropTypes.string,
};
export default NoteList; |
7ac561f5ddaa5551858be32e542d6a9b5f3b9628 | webapp/utils/requireAuth.jsx | webapp/utils/requireAuth.jsx | import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
export default function(ComposedComponent) {
class Authenticate extends React.Component {
static propTypes = {isAuthenticated: PropTypes.bool};
static contextTypes = {router: PropTypes.object.isRequired};
componentWillMount() {
if (this.props.isAuthenticated === false) {
this.context.router.push({
pathname: '/login',
query: {next: this.buildUrl()}
});
}
}
componentWillUpdate(nextProps) {
if (this.props.isAuthenticated && !nextProps.isAuthenticated) {
this.context.router.push({
pathname: '/login',
query: {next: this.buildUrl()}
});
}
}
buildUrl() {
let {location} = this.props;
return `${location.pathname}${location.search || ''}`;
}
render() {
return <ComposedComponent {...this.props} />;
}
}
return connect(
state => ({
isAuthenticated: state.auth.isAuthenticated
}),
{}
)(Authenticate);
}
| import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
export default function(ComposedComponent) {
class Authenticate extends React.Component {
static propTypes = {isAuthenticated: PropTypes.bool};
static contextTypes = {router: PropTypes.object.isRequired};
componentWillMount() {
if (this.props.isAuthenticated === false) {
this.context.router.push({
pathname: '/login',
query: {next: this.buildUrl()}
});
}
}
componentWillUpdate(nextProps) {
if (nextProps.isAuthenticated === false) {
this.context.router.push({
pathname: '/login',
query: {next: this.buildUrl()}
});
}
}
buildUrl() {
let {location} = this.props;
return `${location.pathname}${location.search || ''}`;
}
render() {
return <ComposedComponent {...this.props} />;
}
}
return connect(
state => ({
isAuthenticated: state.auth.isAuthenticated
}),
{}
)(Authenticate);
}
| Handle state transition correctly for logout | Handle state transition correctly for logout
| JSX | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | ---
+++
@@ -18,7 +18,7 @@
}
componentWillUpdate(nextProps) {
- if (this.props.isAuthenticated && !nextProps.isAuthenticated) {
+ if (nextProps.isAuthenticated === false) {
this.context.router.push({
pathname: '/login',
query: {next: this.buildUrl()} |
cde969ebb36e2baaa39d213edca4d2d56a9e57ae | test/katex-a11y-test.jsx | test/katex-a11y-test.jsx | /* TODO(emily): fix these lint errors (http://eslint.org/docs/rules): */
/* eslint-disable eol-last, no-unused-vars, no-var, semi, space-after-keywords */
/* To fix, remove an entry above, run ka-lint, and fix errors. */
var fs = require("fs");
var assert = require("assert");
var katexA11y = require("../js/katex-a11y");
describe("a11y math", function() {
var data;
before(function() {
var testFile = __dirname + "/katex-a11y-math.txt";
data = fs.readFileSync(testFile, {encoding: "utf8"}).split("\n");
});
it("parses all math", function() {
data.forEach(function(math) {
try {
katexA11y.renderString(math);
// Successfully rendered a string
assert(true, math);
} catch(e) {
// Hit something that was unknown - this is bad!
assert(false, math + " " + e)
}
});
});
});
describe("a11y tex", function() {
var tests;
before(function() {
tests = require("./katex-a11y-tex.json");
});
it("generates the correct strings", function() {
var results = [];
tests.forEach(function(math) {
var output = katexA11y.renderString(math.input);
assert.equal(output, math.output, "Parsing " + math.input);
});
});
}); | /* TODO(emily): fix these lint errors (http://eslint.org/docs/rules): */
/* eslint-disable eol-last, no-unused-vars, no-var, semi, space-after-keywords */
/* To fix, remove an entry above, run ka-lint, and fix errors. */
var fs = require("fs");
var assert = require("assert");
var katexA11y = require("../js/katex-a11y");
describe("a11y math", function() {
var data;
before(function() {
var testFile = __dirname + "/katex-a11y-math.txt";
data = fs.readFileSync(testFile, {encoding: "utf8"}).split("\n");
});
it("parses all math", function() {
data.forEach(function(math) {
try {
katexA11y.renderString(math);
// Successfully rendered a string
assert(true, math);
} catch (e) {
// Hit something that was unknown - this is bad!
assert(false, math + " " + e)
}
});
});
});
describe("a11y tex", function() {
var tests;
before(function() {
tests = require("./katex-a11y-tex.json");
});
it("generates the correct strings", function() {
var results = [];
tests.forEach(function(math) {
var output = katexA11y.renderString(math.input);
assert.equal(output, math.output, "Parsing " + math.input);
});
});
}); | Fix lint after updating khan-linter to use eslint 3.x | Fix lint after updating khan-linter to use eslint 3.x
Test Plan: - run ka-lint from perseus (with react-components as a submodule)
Reviewers: john
Reviewed By: john
Differential Revision: https://phabricator.khanacademy.org/D32197
| JSX | mit | Khan/react-components,Khan/react-components,Khan/react-components | ---
+++
@@ -22,7 +22,7 @@
// Successfully rendered a string
assert(true, math);
- } catch(e) {
+ } catch (e) {
// Hit something that was unknown - this is bad!
assert(false, math + " " + e)
} |
a447ec0201a26d3040bc8daf2ed81a5139165643 | app/routes/archive/containers/SubmissionArchivePanelList.jsx | app/routes/archive/containers/SubmissionArchivePanelList.jsx | import { connect } from "react-redux"
import ItemArchivePanelList from "../components/ItemArchivePanelList"
const mapStateToProps = (state) => {
return {
submissions: state.submissions
}
}
export default connect(mapStateToProps, null)(ItemArchivePanelList)
| import { connect } from "react-redux"
import ItemArchivePanelList from "../components/ItemArchivePanelList"
const mapStateToProps = (state) => {
return {
submissions: state.submissions.filter(each => each.selected)
}
}
export default connect(mapStateToProps, null)(ItemArchivePanelList)
| Remove nonselected items from the archive page | Remove nonselected items from the archive page
| JSX | mit | education/classroom-desktop,education/classroom-desktop,education/classroom-desktop,education/classroom-desktop | ---
+++
@@ -3,7 +3,7 @@
const mapStateToProps = (state) => {
return {
- submissions: state.submissions
+ submissions: state.submissions.filter(each => each.selected)
}
}
|
dd836fc40b96afc3a53682b7fdc4ad799dcbc0ab | src/components/FeedFallback.jsx | src/components/FeedFallback.jsx | 'use strict';
const React = require('react');
const FeedItem = function () {
return (
<section className='wk-feed__item'>
<p>
Couldn't load the latest news!
But there's more, <a title='Follow us on twitter' href='https://twitter.com/thenativeweb'>follow us on Twitter</a> or <a title='Visit the official website' href='https://www.wolkenkit.io/'>visit wolkenkit.io</a> to stay up to date.
</p>
</section>
);
};
module.exports = FeedItem;
| 'use strict';
const React = require('react');
const FeedItem = function () {
return (
<section className='wk-feed__item'>
<h2 className='wk-feed__item__title'>Failed to load the latest news 😢</h2>
<p>
Unfortunately, there went something wrong while loading the news.
Please <a href='mailto:hello@thenativeweb.io'>contact us</a> if this
problem persists.
</p>
<p>
Meanwhile, you may <a href='https://twitter.com/thenativeweb'>follow us
on Twitter</a> or visit the <a href='https://www.wolkenkit.io/'>wolkenkit
website</a>.
</p>
</section>
);
};
module.exports = FeedItem;
| Update fallback message for news feed. | Update fallback message for news feed.
| JSX | agpl-3.0 | thenativeweb/wolkenkit-documentation,thenativeweb/wolkenkit-documentation | ---
+++
@@ -5,9 +5,16 @@
const FeedItem = function () {
return (
<section className='wk-feed__item'>
+ <h2 className='wk-feed__item__title'>Failed to load the latest news 😢</h2>
<p>
- Couldn't load the latest news!
- But there's more, <a title='Follow us on twitter' href='https://twitter.com/thenativeweb'>follow us on Twitter</a> or <a title='Visit the official website' href='https://www.wolkenkit.io/'>visit wolkenkit.io</a> to stay up to date.
+ Unfortunately, there went something wrong while loading the news.
+ Please <a href='mailto:hello@thenativeweb.io'>contact us</a> if this
+ problem persists.
+ </p>
+ <p>
+ Meanwhile, you may <a href='https://twitter.com/thenativeweb'>follow us
+ on Twitter</a> or visit the <a href='https://www.wolkenkit.io/'>wolkenkit
+ website</a>.
</p>
</section>
); |
ec90315a7e17cbcc2519851d60c9f4ef0d730cad | pages/cv/lastUpdate.jsx | pages/cv/lastUpdate.jsx | import React, {Fragment} from 'react'
import {format} from 'date-fns'
import {Section, P, Button} from '../../components'
const printHandler = ev => {
ev.preventDefault()
window && window.print()
}
const LastUpdate = ({timestamp}) => {
const DATE_FORMAT = 'LLLL io, YYYY'
const date = format(new Date(timestamp), DATE_FORMAT)
return (
<Section
customCss={{
color: '#bdc3c7',
margin: '1.5rem 0',
display: 'flex',
justifyContent: 'space-between'
}}
>
<P customCss={{margin: 0, '@media print': {marginTop: '.75rem'}}}>
Last update: {date}
</P>
<Button
name="print"
onClick={printHandler}
customCss={{
border: 'none',
cursor: 'pointer',
padding: 0,
fontSize: 'inherit',
color: 'inherit',
textDecoration: 'underline',
'@media print': {
display: 'none'
}
}}
>
Print (to pdf)
</Button>
</Section>
)
}
export default LastUpdate
| import React, {Fragment} from 'react'
import {format} from 'date-fns'
import {Section, P, Button} from '../../components'
const printHandler = ev => {
ev.preventDefault()
window && window.print()
}
const LastUpdate = ({timestamp}) => {
const DATE_FORMAT = 'LLLL io, YYYY'
const date = format(new Date(timestamp), DATE_FORMAT)
return (
<Section
customCss={{
color: '#bdc3c7',
margin: '1.5rem 0',
display: 'flex',
justifyContent: 'space-between'
}}
>
<P customCss={{margin: 0, '@media print': {marginTop: '.75rem'}}}>
Last update: {date}
</P>
<Button
name="print"
onClick={printHandler}
customCss={{
background: 'none',
border: 'none',
cursor: 'pointer',
padding: 0,
fontSize: 'inherit',
color: 'inherit',
textDecoration: 'underline',
'@media print': {
display: 'none'
}
}}
>
Print (to pdf)
</Button>
</Section>
)
}
export default LastUpdate
| Update background none button for safari. | Update background none button for safari.
| JSX | mit | andreiconstantinescu/constantinescu.io | ---
+++
@@ -27,6 +27,7 @@
name="print"
onClick={printHandler}
customCss={{
+ background: 'none',
border: 'none',
cursor: 'pointer',
padding: 0, |
dcb5654b0ce027d3fa1442097883b3759a055727 | client-js/Requests.jsx | client-js/Requests.jsx | import React from 'react';
import {errorHandler, jsonOnSuccess, renderUpdateTime, getUserInfo} from './common.jsx';
export class RequestList extends React.Component {
};
export class Request extends React.Component {
};
export class RequestInfo extends React.Component {
constructor(props) {
super(props);
this.state = { }
};
render() {
return (
<div className="request-entry list-row row">
<div className="request-entry-info col-md-4">
<strong>{this.props.model.item}</strong>
</div>
<div className="request-entry-info col-md-1">
{this.props.model.count}
</div>
<div className="request-entry-info col-md-1">
{this.props.model.status}
</div>
<div className="request-entry-info col-md-3">
{this.props.model.requester}
</div>
<div className="request-entry-info col-md-3">
{this.props.model.eta}
</div>
</div>
);
}
};
export class RequestEditor extends React.Component {
};
| Add basic requests frontend code | Add basic requests frontend code
| JSX | mit | dragonrobotics/PartTracker,stmobo/PartTracker,stmobo/PartTracker,stmobo/PartTracker,dragonrobotics/PartTracker,dragonrobotics/PartTracker | ---
+++
@@ -0,0 +1,44 @@
+import React from 'react';
+import {errorHandler, jsonOnSuccess, renderUpdateTime, getUserInfo} from './common.jsx';
+
+export class RequestList extends React.Component {
+
+};
+
+export class Request extends React.Component {
+
+};
+
+export class RequestInfo extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = { }
+ };
+
+ render() {
+ return (
+ <div className="request-entry list-row row">
+ <div className="request-entry-info col-md-4">
+ <strong>{this.props.model.item}</strong>
+ </div>
+ <div className="request-entry-info col-md-1">
+ {this.props.model.count}
+ </div>
+ <div className="request-entry-info col-md-1">
+ {this.props.model.status}
+ </div>
+ <div className="request-entry-info col-md-3">
+ {this.props.model.requester}
+ </div>
+ <div className="request-entry-info col-md-3">
+ {this.props.model.eta}
+ </div>
+ </div>
+ );
+ }
+};
+
+export class RequestEditor extends React.Component {
+
+}; |
|
669e5a11d82f7d08b172c587004aafee1617059d | SingularityUI/app/components/taskDetail/TaskEnvVars.jsx | SingularityUI/app/components/taskDetail/TaskEnvVars.jsx | import React, { PropTypes } from 'react';
import { InfoBox } from '../common/statelessComponents';
import CollapsableSection from '../common/CollapsableSection';
function TaskEnvVars (props) {
if (!props.executor) return null;
let vars = [];
for (const variable of props.executor.command.environment.variables) {
vars.push(<InfoBox key={variable.name} copyableClassName="info-copyable" name={variable.name} value={variable.value} />);
}
return (
<CollapsableSection title="Environment variables">
<div className="row">
<ul className="list-unstyled horizontal-description-list">
{vars}
</ul>
</div>
</CollapsableSection>
);
}
TaskEnvVars.propTypes = {
executor: PropTypes.shape({
command: PropTypes.shape({
environment: PropTypes.shape({
variables: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
value: PropTypes.string
}))
}).isRequired
}).isRequired
})
};
export default TaskEnvVars;
| import React, { PropTypes } from 'react';
import { InfoBox } from '../common/statelessComponents';
import CollapsableSection from '../common/CollapsableSection';
function TaskEnvVars (props) {
if (!props.executor) return null;
let vars = [];
for (const variable of _.sortBy(props.executor.command.environment.variables, 'name')) {
vars.push(<InfoBox key={variable.name} copyableClassName="info-copyable" name={variable.name} value={variable.value} />);
}
return (
<CollapsableSection title="Environment variables">
<div className="row">
<ul className="list-unstyled horizontal-description-list">
{vars}
</ul>
</div>
</CollapsableSection>
);
}
TaskEnvVars.propTypes = {
executor: PropTypes.shape({
command: PropTypes.shape({
environment: PropTypes.shape({
variables: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
value: PropTypes.string
}))
}).isRequired
}).isRequired
})
};
export default TaskEnvVars;
| Sort environment variables on task detail page alphabetically | Sort environment variables on task detail page alphabetically
| JSX | apache-2.0 | andrhamm/Singularity,HubSpot/Singularity,andrhamm/Singularity,HubSpot/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,andrhamm/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity | ---
+++
@@ -6,7 +6,7 @@
function TaskEnvVars (props) {
if (!props.executor) return null;
let vars = [];
- for (const variable of props.executor.command.environment.variables) {
+ for (const variable of _.sortBy(props.executor.command.environment.variables, 'name')) {
vars.push(<InfoBox key={variable.name} copyableClassName="info-copyable" name={variable.name} value={variable.value} />);
}
|
2a12e86b3565166e9b927b42e0a6fe2c2e0324eb | js/components/Screen.jsx | js/components/Screen.jsx | import * as EmuActions from '../actions/EmuActions.js';
class Screen extends React.Component {
componentDidMount() {
// Since we currently only support one device at a time, assume the last
// Screen is the one the device should render to. May never change, as
// multiple devices should just be multiple browser tabs.
window.setTimeout(EmuActions.receiveCanvas.bind(this, React.findDOMNode(this)), 0);
}
render() {
return (
<canvas className="screen" />
);
}
}
export default Screen;
| Build a canvas to pass into the emu | Build a canvas to pass into the emu
| JSX | mit | jkoudys/remu,jkoudys/remu | ---
+++
@@ -0,0 +1,18 @@
+import * as EmuActions from '../actions/EmuActions.js';
+
+class Screen extends React.Component {
+ componentDidMount() {
+ // Since we currently only support one device at a time, assume the last
+ // Screen is the one the device should render to. May never change, as
+ // multiple devices should just be multiple browser tabs.
+ window.setTimeout(EmuActions.receiveCanvas.bind(this, React.findDOMNode(this)), 0);
+ }
+
+ render() {
+ return (
+ <canvas className="screen" />
+ );
+ }
+}
+
+export default Screen; |
|
51e754c09b89e1ddea98f4aaa97d776dc212f105 | src/Slide.jsx | src/Slide.jsx | import React, { Component, PropTypes } from 'react'
const styles = {
root: {
color: 'white'
},
header: {
height: 'calc(100% - 230px)',
textAlign: 'center'
},
headerItem: {
position: 'relative',
top: '50%',
transform: 'translateY(-50%)'
},
text: {
textAlign: 'center'
}
}
export class Slide extends Component {
constructor(props) {
super(props)
}
render() {
const { backgroundColor, header, headerStyle, headline, subhead } = this.props
return (
<div style={{ ...styles.root, backgroundColor, height: '100%' }}>
<div style={{ ...styles.header, ...headerStyle }}>
<div style={styles.headerItem}>{header}</div>
</div>
<div style={styles.text}>
<h1>
{headline}
</h1>
<p>
{subhead}
</p>
</div>
</div>
)
}
}
Slide.propTypes = {
header: PropTypes.object.isRequired,
headerStyle: PropTypes.object.isRequired,
backgroundColor: PropTypes.string.isRequired,
headline: PropTypes.string.isRequired,
subhead: PropTypes.string.isRequired
}
| Add slide component for content presentation. | Add slide component for content presentation.
| JSX | mit | TeamWertarbyte/material-auto-rotating-carousel | ---
+++
@@ -0,0 +1,52 @@
+import React, { Component, PropTypes } from 'react'
+
+const styles = {
+ root: {
+ color: 'white'
+ },
+ header: {
+ height: 'calc(100% - 230px)',
+ textAlign: 'center'
+ },
+ headerItem: {
+ position: 'relative',
+ top: '50%',
+ transform: 'translateY(-50%)'
+ },
+ text: {
+ textAlign: 'center'
+ }
+}
+
+export class Slide extends Component {
+ constructor(props) {
+ super(props)
+ }
+
+ render() {
+ const { backgroundColor, header, headerStyle, headline, subhead } = this.props
+ return (
+ <div style={{ ...styles.root, backgroundColor, height: '100%' }}>
+ <div style={{ ...styles.header, ...headerStyle }}>
+ <div style={styles.headerItem}>{header}</div>
+ </div>
+ <div style={styles.text}>
+ <h1>
+ {headline}
+ </h1>
+ <p>
+ {subhead}
+ </p>
+ </div>
+ </div>
+ )
+ }
+}
+
+Slide.propTypes = {
+ header: PropTypes.object.isRequired,
+ headerStyle: PropTypes.object.isRequired,
+ backgroundColor: PropTypes.string.isRequired,
+ headline: PropTypes.string.isRequired,
+ subhead: PropTypes.string.isRequired
+} |
|
af7f85adf08b2c9ddf1c953fd98ac0048ec2d5b3 | app/Resources/client/jsx/project/helpers/removeTraitFromProject.jsx | app/Resources/client/jsx/project/helpers/removeTraitFromProject.jsx | function removeTraitFromProject(traitName, biom, dbVersion,internalProjectId, action) {
for(let row of biom.rows){
if(row.metadata != null){
delete row.metadata[traitName]
if(row.metadata.trait_citations != null){
delete row.metadata.trait_citations[traitName]
}
}
}
let webserviceUrl = Routing.generate('api', {'namespace': 'edit', 'classname': 'updateProject'});
$.ajax(webserviceUrl, {
data: {
"dbversion": dbVersion,
"project_id": internalProjectId,
"biom": biom.toString()
},
method: "POST",
success: action,
error: (error) => showMessageDialog(error, 'danger')
});
} | Add new function for removing traits from biom | Add new function for removing traits from biom
| JSX | mit | molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec | ---
+++
@@ -0,0 +1,21 @@
+function removeTraitFromProject(traitName, biom, dbVersion,internalProjectId, action) {
+ for(let row of biom.rows){
+ if(row.metadata != null){
+ delete row.metadata[traitName]
+ if(row.metadata.trait_citations != null){
+ delete row.metadata.trait_citations[traitName]
+ }
+ }
+ }
+ let webserviceUrl = Routing.generate('api', {'namespace': 'edit', 'classname': 'updateProject'});
+ $.ajax(webserviceUrl, {
+ data: {
+ "dbversion": dbVersion,
+ "project_id": internalProjectId,
+ "biom": biom.toString()
+ },
+ method: "POST",
+ success: action,
+ error: (error) => showMessageDialog(error, 'danger')
+ });
+} |
|
6f6f1e6ee9ec87cfbd014e22dd7736678e11c870 | client/source/components/User/FollowingListEntry.jsx | client/source/components/User/FollowingListEntry.jsx | import React, {Component} from 'react';
import { Image, Grid, Row, Col, Form, FormGroup, Badge, ProgressBar, FormControl, Button, Container, ControlLabel, DropdownButton, MenuItem, Nav, NavItem } from 'react-bootstrap';
export default ({user, handleUserClick}) => {
return (
<Row height={50}>
<Col xs={6} md={6}>
<h2 id={user.username} onClick={handleUserClick.bind(this)}> {user.username} </h2>
<h4 id={user.recipes}> this user has {user.recipes} recipes </h4>
</Col>
<Col xs={4} md={4} style={{marginTop: 20}}>
<h4> skilletHub skill level: </h4>
<ProgressBar bsStyle={'success'} now={user.skillLevel} label={`${user.skillLevel}%`}/>
</Col>
<Col xs={2} md={2} style={{marginTop: 20}}>
<h4> forks </h4>
<Badge>{user.totalForks}</Badge>
</Col>
</Row>
)
}
| Add component to render the list of users a specific user is following. | Add component to render the list of users a specific user is following.
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -0,0 +1,22 @@
+import React, {Component} from 'react';
+import { Image, Grid, Row, Col, Form, FormGroup, Badge, ProgressBar, FormControl, Button, Container, ControlLabel, DropdownButton, MenuItem, Nav, NavItem } from 'react-bootstrap';
+
+export default ({user, handleUserClick}) => {
+
+ return (
+ <Row height={50}>
+ <Col xs={6} md={6}>
+ <h2 id={user.username} onClick={handleUserClick.bind(this)}> {user.username} </h2>
+ <h4 id={user.recipes}> this user has {user.recipes} recipes </h4>
+ </Col>
+ <Col xs={4} md={4} style={{marginTop: 20}}>
+ <h4> skilletHub skill level: </h4>
+ <ProgressBar bsStyle={'success'} now={user.skillLevel} label={`${user.skillLevel}%`}/>
+ </Col>
+ <Col xs={2} md={2} style={{marginTop: 20}}>
+ <h4> forks </h4>
+ <Badge>{user.totalForks}</Badge>
+ </Col>
+ </Row>
+ )
+} |
|
b02b4744fdeea3007373e05fb36f30bd67a5d294 | blueprints/component/files/app/tests/components/__name__.jsx | blueprints/component/files/app/tests/components/__name__.jsx | 'use strict';
var React = require('react'),
TestUtils = require('react-addons-test-utils'),
expect = require('chai').expect,
__name__ = require('../../components/__name__').default;
describe('__name__', function() {
describe('#render()', function() {
it('should succeed', function() {
let component = TestUtils.renderIntoDocument(
<__name__ />
);
expect(component).to.not.be.undefined;
});
});
}); | Add tests for the component generation blueprint | Add tests for the component generation blueprint
| JSX | mit | reactcli/react-cli,reactcli/react-cli | ---
+++
@@ -0,0 +1,18 @@
+'use strict';
+
+var React = require('react'),
+ TestUtils = require('react-addons-test-utils'),
+ expect = require('chai').expect,
+ __name__ = require('../../components/__name__').default;
+
+describe('__name__', function() {
+ describe('#render()', function() {
+ it('should succeed', function() {
+ let component = TestUtils.renderIntoDocument(
+ <__name__ />
+ );
+
+ expect(component).to.not.be.undefined;
+ });
+ });
+}); |
|
64aadf84ef87b48c6e48bbd99aec5597787a9a68 | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/dropdown-viewer.jsx | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/dropdown-viewer.jsx | import React from "react";
import "~/style/_dropdown-viewer.scss";
import PropTypes from "prop-types";
export default class WonDropdownViewer extends React.Component {
render() {
const icon = this.props.detail.icon && (
<svg className="dropdownv__header__icon">
<use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
</svg>
);
const label = this.props.detail.icon && (
<span className="dropdownv__header__label">
{this.props.detail.label}
</span>
);
return (
<won-dropdown-viewer>
<div className="dropdownv__header">
{icon}
{label}
</div>
<div className="dropdownv__content">{this.props.content}</div>
</won-dropdown-viewer>
);
}
}
WonDropdownViewer.propTypes = {
detail: PropTypes.object,
content: PropTypes.object,
};
| Implement dropdownviewer as react components | Implement dropdownviewer as react components
| JSX | apache-2.0 | researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds | ---
+++
@@ -0,0 +1,34 @@
+import React from "react";
+
+import "~/style/_dropdown-viewer.scss";
+import PropTypes from "prop-types";
+
+export default class WonDropdownViewer extends React.Component {
+ render() {
+ const icon = this.props.detail.icon && (
+ <svg className="dropdownv__header__icon">
+ <use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
+ </svg>
+ );
+
+ const label = this.props.detail.icon && (
+ <span className="dropdownv__header__label">
+ {this.props.detail.label}
+ </span>
+ );
+
+ return (
+ <won-dropdown-viewer>
+ <div className="dropdownv__header">
+ {icon}
+ {label}
+ </div>
+ <div className="dropdownv__content">{this.props.content}</div>
+ </won-dropdown-viewer>
+ );
+ }
+}
+WonDropdownViewer.propTypes = {
+ detail: PropTypes.object,
+ content: PropTypes.object,
+}; |
|
cbf1e8d6a863122396bdbcb4b8d36c4bc19ed722 | src/AutoRotatingCarousel.jsx | src/AutoRotatingCarousel.jsx | import React, { Component, PropTypes } from 'react'
import { RaisedButton } from 'material-ui'
import autoPlay from 'react-swipeable-views/lib/autoPlay'
import SwipeableViews from 'react-swipeable-views'
import { Dots } from './Dots'
const AutoPlaySwipeableViews = autoPlay(SwipeableViews)
const styles = {
root: {
height: '100%',
width: 0,
position: 'fixed',
zIndex: 1100,
left: 0,
top: 0
},
footer: {
marginTop: -100,
width: '100%',
position: 'relative',
textAlign: 'center'
}
}
export class AutoRotatingCarousel extends Component {
constructor(props) {
super(props)
this.state = {
slideIndex: 0
}
}
handleChange(value) {
this.setState({
slideIndex: value
})
}
render() {
return (
<div style={{ ...styles.root, width: this.props.open ? '100%' : 0 }}>
{this.props.open ?
<div>
<AutoPlaySwipeableViews
index={this.state.slideIndex}
onChangeIndex={(value) => this.handleChange(value)}
slideStyle={{ width: '100%', height: '100vh' }}
>
{this.props.children}
</AutoPlaySwipeableViews>
<div style={styles.footer}>
<RaisedButton
label={this.props.label}
onTouchTap={this.props.onStart}
/>
<Dots
count={this.props.children.length}
index={this.state.slideIndex}
style={{ paddingTop: 24, margin: '0 auto' }}
/>
</div>
</div>
: <div /> }
</div>
)
}
}
AutoRotatingCarousel.propTypes = {
open: PropTypes.bool.isRequired,
label: PropTypes.string.isRequired,
onStart: PropTypes.func.isRequired
}
| Add root component to display slides in a beautiful manner. | Add root component to display slides in a beautiful manner.
| JSX | mit | TeamWertarbyte/material-auto-rotating-carousel | ---
+++
@@ -0,0 +1,73 @@
+import React, { Component, PropTypes } from 'react'
+import { RaisedButton } from 'material-ui'
+import autoPlay from 'react-swipeable-views/lib/autoPlay'
+import SwipeableViews from 'react-swipeable-views'
+import { Dots } from './Dots'
+
+const AutoPlaySwipeableViews = autoPlay(SwipeableViews)
+const styles = {
+ root: {
+ height: '100%',
+ width: 0,
+ position: 'fixed',
+ zIndex: 1100,
+ left: 0,
+ top: 0
+ },
+ footer: {
+ marginTop: -100,
+ width: '100%',
+ position: 'relative',
+ textAlign: 'center'
+ }
+}
+
+export class AutoRotatingCarousel extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ slideIndex: 0
+ }
+ }
+
+ handleChange(value) {
+ this.setState({
+ slideIndex: value
+ })
+ }
+
+ render() {
+ return (
+ <div style={{ ...styles.root, width: this.props.open ? '100%' : 0 }}>
+ {this.props.open ?
+ <div>
+ <AutoPlaySwipeableViews
+ index={this.state.slideIndex}
+ onChangeIndex={(value) => this.handleChange(value)}
+ slideStyle={{ width: '100%', height: '100vh' }}
+ >
+ {this.props.children}
+ </AutoPlaySwipeableViews>
+ <div style={styles.footer}>
+ <RaisedButton
+ label={this.props.label}
+ onTouchTap={this.props.onStart}
+ />
+ <Dots
+ count={this.props.children.length}
+ index={this.state.slideIndex}
+ style={{ paddingTop: 24, margin: '0 auto' }}
+ />
+ </div>
+ </div>
+ : <div /> }
+ </div>
+ )
+ }
+}
+
+AutoRotatingCarousel.propTypes = {
+ open: PropTypes.bool.isRequired,
+ label: PropTypes.string.isRequired,
+ onStart: PropTypes.func.isRequired
+} |
|
bc217196183c27d3e37fd7f594825d8b2a3f1a25 | src/app/components/Input.jsx | src/app/components/Input.jsx | import React, {Component} from 'react';
import PropTypes from 'prop-types';
const propTypes = {
id: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
type: PropTypes.string,
onChange: PropTypes.func
};
const defaultProps = {
type: "text"
};
export default class Input extends Component {
constructor(props) {
super(props);
this.state = {
type: this.props.type,
displayShowHide: this.props.type === "password"
};
this.showHide = this.showHide.bind(this);
}
showHide(e) {
e.preventDefault();
e.stopPropagation();
this.setState({
type: this.state.type === 'input' ? 'password' : 'input'
})
}
render() {
return (
<div className={"form__input" + (this.props.error ? " form__input--error" : "")}>
<label className="form__label" htmlFor={this.props.id}>{this.props.label}: </label>
{
this.props.error ?
<div className="error-msg">{this.props.error}</div>
:
""
}
<input id={this.props.id} type={this.state.type} className="input input__text" name={this.props.id} onChange={this.props.onChange}/>
{
this.state.displayShowHide ?
<button className="btn btn--password" onClick={this.showHide}>{this.state.type === 'input' ? 'Hide' : 'Show'}</button>
:
""
}
</div>
)
}
}
Input.propTypes = propTypes;
Input.defaultProps = defaultProps; | Add input class for input fields and show/hide for type=password | Add input class for input fields and show/hide for type=password
Former-commit-id: 451303c4cd6b859dd49970da527e4d39a2a8d831
Former-commit-id: 52fc737a7cb3fbaf24af13eb27a045f664972bbb
Former-commit-id: c26da866ea8d11a2ff21b8d250dc8bc56ce35ac3 | JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -0,0 +1,58 @@
+import React, {Component} from 'react';
+import PropTypes from 'prop-types';
+
+const propTypes = {
+ id: PropTypes.string.isRequired,
+ label: PropTypes.string.isRequired,
+ type: PropTypes.string,
+ onChange: PropTypes.func
+};
+
+const defaultProps = {
+ type: "text"
+};
+
+export default class Input extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ type: this.props.type,
+ displayShowHide: this.props.type === "password"
+ };
+
+ this.showHide = this.showHide.bind(this);
+ }
+
+ showHide(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ this.setState({
+ type: this.state.type === 'input' ? 'password' : 'input'
+ })
+ }
+
+ render() {
+ return (
+ <div className={"form__input" + (this.props.error ? " form__input--error" : "")}>
+ <label className="form__label" htmlFor={this.props.id}>{this.props.label}: </label>
+ {
+ this.props.error ?
+ <div className="error-msg">{this.props.error}</div>
+ :
+ ""
+ }
+ <input id={this.props.id} type={this.state.type} className="input input__text" name={this.props.id} onChange={this.props.onChange}/>
+ {
+ this.state.displayShowHide ?
+ <button className="btn btn--password" onClick={this.showHide}>{this.state.type === 'input' ? 'Hide' : 'Show'}</button>
+ :
+ ""
+ }
+ </div>
+ )
+ }
+}
+
+Input.propTypes = propTypes;
+Input.defaultProps = defaultProps; |
|
59939a2eca9c05f0a4e6f0b886b668d128f482a2 | app/assets/javascripts/components/developers/imports/data.es6.jsx | app/assets/javascripts/components/developers/imports/data.es6.jsx | // Modules
import React from 'react';
import Relay from 'react-relay';
import { ListItem } from 'material-ui/List';
import FontIcon from 'material-ui/FontIcon';
import Checkbox from 'material-ui/Checkbox';
// Stylesheet
import '../../styles/pins.sass';
const Data = (props) => {
const { connectionData, selectItem, disabled } = props;
return (
<ListItem
className={`list-item ${connectionData.pinned ? 'pinned' : ''}`}
leftCheckbox={
<Checkbox
style={{ top: 'calc(100% / 3)' }}
onCheck={event => selectItem(event, connectionData)}
/>
}
rightIcon={
<div
style={{
right: 20,
top: 20,
display: 'flex',
lineHeight: '30px',
justifyContent: 'space-between',
color: '#777',
}}
>
{connectionData.stars}
<FontIcon
color="#777"
className="material-icons"
style={{
marginLeft: 5,
}}
>
star
</FontIcon>
</div>
}
primaryText={connectionData.title}
secondaryText={
<span
className="description"
style={{ maxWidth: '70%' }}
>
{connectionData.description}
</span>
}
secondaryTextLines={2}
/>
);
};
Data.propTypes = {
connectionData: React.PropTypes.object,
selectItem: React.PropTypes.func,
};
const DataContainer = Relay.createContainer(Data, {
fragments: {
connectionData: () => Relay.QL`
fragment on ConnectionData {
id
title
description
stars
pinned
}
`,
},
});
export default DataContainer;
| Add a data component to show connection data | Add a data component to show connection data
| JSX | artistic-2.0 | gauravtiwari/techhire,gauravtiwari/hireables,gauravtiwari/hireables,gauravtiwari/techhire,Hireables/hireables,gauravtiwari/techhire,Hireables/hireables,gauravtiwari/hireables,Hireables/hireables | ---
+++
@@ -0,0 +1,79 @@
+// Modules
+import React from 'react';
+import Relay from 'react-relay';
+import { ListItem } from 'material-ui/List';
+import FontIcon from 'material-ui/FontIcon';
+import Checkbox from 'material-ui/Checkbox';
+
+// Stylesheet
+import '../../styles/pins.sass';
+
+const Data = (props) => {
+ const { connectionData, selectItem, disabled } = props;
+ return (
+ <ListItem
+ className={`list-item ${connectionData.pinned ? 'pinned' : ''}`}
+ leftCheckbox={
+ <Checkbox
+ style={{ top: 'calc(100% / 3)' }}
+ onCheck={event => selectItem(event, connectionData)}
+ />
+ }
+ rightIcon={
+ <div
+ style={{
+ right: 20,
+ top: 20,
+ display: 'flex',
+ lineHeight: '30px',
+ justifyContent: 'space-between',
+ color: '#777',
+ }}
+ >
+ {connectionData.stars}
+ <FontIcon
+ color="#777"
+ className="material-icons"
+ style={{
+ marginLeft: 5,
+ }}
+ >
+ star
+ </FontIcon>
+ </div>
+ }
+
+ primaryText={connectionData.title}
+ secondaryText={
+ <span
+ className="description"
+ style={{ maxWidth: '70%' }}
+ >
+ {connectionData.description}
+ </span>
+ }
+ secondaryTextLines={2}
+ />
+ );
+};
+
+Data.propTypes = {
+ connectionData: React.PropTypes.object,
+ selectItem: React.PropTypes.func,
+};
+
+const DataContainer = Relay.createContainer(Data, {
+ fragments: {
+ connectionData: () => Relay.QL`
+ fragment on ConnectionData {
+ id
+ title
+ description
+ stars
+ pinned
+ }
+ `,
+ },
+});
+
+export default DataContainer; |
|
da6c202dea9706efaab0fb9da286f83be875e966 | public/components/MultipleGlasses.jsx | public/components/MultipleGlasses.jsx | import React from 'react';
import glassDetails from './../../glassDetails.js';
import beerPair from './../../pairList.js';
class MultipleGlasses extends React.Component {
constructor(props){
super(props);
this.handleGlassUpdate = this.handleGlassUpdate.bind(this);
}
handleGlassUpdate(e) {
e.preventDefault();
this.props.updateGlass(e.target.innerHTML);
}
render(){
let temp = this.props.glasses.slice();
temp.splice(temp.indexOf(this.props.currentGlass), 1);
const list = temp.map((glass, i) => {
return <li key={i} onClick={this.handleGlassUpdate}>{glass}</li>
});
return(
<div>
<p>You can also use a: </p>
<ul>
{list}
</ul>
</div>
)
}
}
export default MultipleGlasses; | Add component to display multiple glasses. can update display info on click of glass name | Add component to display multiple glasses. can update display info on click of glass name
| JSX | mit | joeylaguna/tankard.io,joeylaguna/tankard.io | ---
+++
@@ -0,0 +1,35 @@
+import React from 'react';
+import glassDetails from './../../glassDetails.js';
+import beerPair from './../../pairList.js';
+
+class MultipleGlasses extends React.Component {
+ constructor(props){
+ super(props);
+ this.handleGlassUpdate = this.handleGlassUpdate.bind(this);
+ }
+
+ handleGlassUpdate(e) {
+ e.preventDefault();
+ this.props.updateGlass(e.target.innerHTML);
+ }
+
+ render(){
+ let temp = this.props.glasses.slice();
+ temp.splice(temp.indexOf(this.props.currentGlass), 1);
+ const list = temp.map((glass, i) => {
+ return <li key={i} onClick={this.handleGlassUpdate}>{glass}</li>
+ });
+
+ return(
+ <div>
+ <p>You can also use a: </p>
+ <ul>
+ {list}
+ </ul>
+ </div>
+ )
+ }
+}
+
+
+export default MultipleGlasses; |
|
04365e0448f849acfe2e7c2ec86eefd280a08d17 | frontend/src/components/OfferFilter.react.jsx | frontend/src/components/OfferFilter.react.jsx | import React from 'react';
import {TextInput} from 'belle';
import _ from 'lodash';
export default class OfferFilter extends React.Component {
static propTypes = {
onFilterUpdate: React.PropTypes.func.isRequired
}
updateFilter({value}) {
_.debounce(() => {
this.props.onFilterUpdate(value);
}, 500)();
}
render() {
return (
<TextInput
onUpdate={::this.updateFilter}
placeholder="Filtrez par le contenu du tweet"
/>
);
}
}
| Add the Offer filter component | Add the Offer filter component
| JSX | agpl-3.0 | jilljenn/voyageavecmoi,jilljenn/voyageavecmoi,jilljenn/voyageavecmoi | ---
+++
@@ -0,0 +1,25 @@
+import React from 'react';
+
+import {TextInput} from 'belle';
+import _ from 'lodash';
+
+export default class OfferFilter extends React.Component {
+ static propTypes = {
+ onFilterUpdate: React.PropTypes.func.isRequired
+ }
+
+ updateFilter({value}) {
+ _.debounce(() => {
+ this.props.onFilterUpdate(value);
+ }, 500)();
+ }
+
+ render() {
+ return (
+ <TextInput
+ onUpdate={::this.updateFilter}
+ placeholder="Filtrez par le contenu du tweet"
+ />
+ );
+ }
+} |
|
b8d5bcc19f2c88eff6cf3f3442b65c5024d0cfe7 | src/js/components/header/header-spec.jsx | src/js/components/header/header-spec.jsx | var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
describe('Header', function() {
var Header = require('./header.jsx');
var header;
beforeEach(function() {
header = TestUtils.renderIntoDocument(
<Header />
);
});
it('renders', function() {
var component = TestUtils.findRenderedDOMComponentWithClass(
header, 'header'
);
expect(component).to.exist();
});
}); | Add tests to Header component | Add tests to Header component
| JSX | mit | haner199401/React-Node-Project-Seed,haner199401/React-Node-Project-Seed,mattpetrie/React-Node-Project-Seed,mattpetrie/React-Node-Project-Seed | ---
+++
@@ -0,0 +1,21 @@
+var React = require('react/addons');
+var TestUtils = React.addons.TestUtils;
+
+describe('Header', function() {
+ var Header = require('./header.jsx');
+ var header;
+
+ beforeEach(function() {
+ header = TestUtils.renderIntoDocument(
+ <Header />
+ );
+ });
+
+ it('renders', function() {
+ var component = TestUtils.findRenderedDOMComponentWithClass(
+ header, 'header'
+ );
+
+ expect(component).to.exist();
+ });
+}); |
|
fb6deb6bddf597ad1c6d894f6b270fab6ddb3ec5 | app/app/components/navbar/Nav.jsx | app/app/components/navbar/Nav.jsx | import React from 'react';
import {Link, hashHistory} from 'react-router'
import NavLinks from './NavLinks.jsx'
export default class Nav extends React.Component {
render(){
return (
<nav className="navbar navbar-inverse">
<div className="container">
<div className="navbar-header">
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
<Link to="/" className="navbar-brand">MicroSerfs</Link>
</div>
<div id="navbar" className="collapse navbar-collapse">
<ul className="nav navbar-nav">
<NavLinks />
</ul>
</div>
</div>
</nav>
)
}
} | Refactor navbar into multiple components | Refactor navbar into multiple components
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | ---
+++
@@ -0,0 +1,29 @@
+import React from 'react';
+import {Link, hashHistory} from 'react-router'
+import NavLinks from './NavLinks.jsx'
+
+export default class Nav extends React.Component {
+
+ render(){
+ return (
+ <nav className="navbar navbar-inverse">
+ <div className="container">
+ <div className="navbar-header">
+ <button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
+ <span className="sr-only">Toggle navigation</span>
+ <span className="icon-bar"></span>
+ <span className="icon-bar"></span>
+ <span className="icon-bar"></span>
+ </button>
+ <Link to="/" className="navbar-brand">MicroSerfs</Link>
+ </div>
+ <div id="navbar" className="collapse navbar-collapse">
+ <ul className="nav navbar-nav">
+ <NavLinks />
+ </ul>
+ </div>
+ </div>
+ </nav>
+ )
+ }
+} |
|
b2c1c8b79a20e5bfe6c57318a2fdbd5f4d00dc7f | src/client/public/components/home/Home.jsx | src/client/public/components/home/Home.jsx | var React = require('react');
var Flux = require('react-flux');
var Router = require('react-router');
var {Route, RouteHandler, Link } = Router;
var Home = React.createClass({
render: function () {
return (
<div>
<h3>Welcome home!</h3>
<RouteHandler/>
</div>
);
}
});
module.exports = Home;
| Create initial home page component | Create initial home page component
| JSX | apache-2.0 | andrewfhart/coinbox,andrewfhart/coinbox | ---
+++
@@ -0,0 +1,18 @@
+var React = require('react');
+var Flux = require('react-flux');
+var Router = require('react-router');
+var {Route, RouteHandler, Link } = Router;
+
+
+var Home = React.createClass({
+ render: function () {
+ return (
+ <div>
+ <h3>Welcome home!</h3>
+ <RouteHandler/>
+ </div>
+ );
+ }
+});
+
+module.exports = Home; |
|
1f189011e9c4ee05e2aa85127659c62870e177b5 | frontend/app/components/lists.jsx | frontend/app/components/lists.jsx | import React from 'react';
import BaseComponent from './base';
import { Grid, Cell } from 'rgx';
import styles from '../styles/lists';
import { IconButton, List, ListItem, ListDivider, Paper, Checkbox, FontIcon, Styles } from 'material-ui';
const Colors = Styles.Colors;
export default class Lists extends BaseComponent {
render() {
const cell = (
<Cell min={384}>
<Paper zDepth={0} style={styles.list}>
<List>
<ListItem style={styles.listitem} rightIcon={<IconButton iconClassName="material-icons">expand_more</IconButton>}>Первая задачка</ListItem>
<ListItem style={styles.listitem}>Second item</ListItem>
</List>
</Paper>
</Cell>
);
return (
<div style={styles.content}>
<Grid gutter={16}>
{ cell }
{ cell }
</Grid>
<Grid gutter={16}>
{ cell }
<Cell min={384}/>
</Grid>
<br />
<List subheader="Hangout notifications">
<ListItem
leftCheckbox={<Checkbox />} >
Notifications
</ListItem>
<ListItem
leftCheckbox={<Checkbox />}
secondaryText="Hangouts message">
Sounds
</ListItem>
<ListItem
leftCheckbox={<Checkbox />}
secondaryText="Hangouts video call">
Video sounds
</ListItem>
</List>
</div>
);
}
}
| import React from 'react';
import BaseComponent from './base';
import { Grid, Cell } from 'rgx';
import styles from '../styles/lists';
import { IconButton, List, ListItem, ListDivider, Paper, Checkbox, FontIcon, Styles } from 'material-ui';
import ActionCheckCircle from 'material-ui/lib/svg-icons/action/check-circle';
const Colors = Styles.Colors;
export default class Lists extends BaseComponent {
constructor() {
super();
}
render() {
const cell = (
<Cell min={384}>
<Paper zDepth={0} style={styles.list}>
<List>
<ListItem style={styles.listitem} rightIcon={<IconButton iconClassName="material-icons">expand_more</IconButton>}>Первая задачка</ListItem>
<ListItem style={styles.listitem}>Second item</ListItem>
</List>
</Paper>
</Cell>
);
return (
<div style={styles.content}>
<Grid gutter={16}>
{ cell }
{ cell }
</Grid>
<Grid gutter={16}>
{ cell }
<Cell min={384}/>
</Grid>
<br />
<List subheader="Hangout notifications">
<ListItem
leftCheckbox={<Checkbox unCheckedIcon={<ActionCheckCircle />}/>} >
Notifications
</ListItem>
<ListItem
leftCheckbox={<Checkbox />}
secondaryText="Hangouts message">
Sounds
</ListItem>
<ListItem
leftCheckbox={<Checkbox />}
secondaryText="Hangouts video call">
Video sounds
</ListItem>
</List>
</div>
);
}
}
| Set ActionCheckCircle icon for Checkbox | Set ActionCheckCircle icon for Checkbox
| JSX | mit | liof-io/liof,liof-io/liof,vitalyp/liof,feoktistov95/liof,vitalyp/liof,feoktistov95/liof,feoktistov95/liof,liof-io/liof,vitalyp/liof | ---
+++
@@ -3,9 +3,14 @@
import { Grid, Cell } from 'rgx';
import styles from '../styles/lists';
import { IconButton, List, ListItem, ListDivider, Paper, Checkbox, FontIcon, Styles } from 'material-ui';
+import ActionCheckCircle from 'material-ui/lib/svg-icons/action/check-circle';
const Colors = Styles.Colors;
export default class Lists extends BaseComponent {
+
+ constructor() {
+ super();
+ }
render() {
const cell = (
@@ -34,7 +39,7 @@
<br />
<List subheader="Hangout notifications">
<ListItem
- leftCheckbox={<Checkbox />} >
+ leftCheckbox={<Checkbox unCheckedIcon={<ActionCheckCircle />}/>} >
Notifications
</ListItem>
<ListItem |
f5a25051379e26a0bfbeccdc07774abd8d04d9ca | web/src/components/common/Backend.jsx | web/src/components/common/Backend.jsx | import React, {Component} from 'react';
import 'babel-polyfill';
import 'isomorphic-fetch';
const BACKEND_URL = 'http://localhost:5000'
export function fetchJson(path) {
// use this function to make a GET request.
const url = `${BACKEND_URL}${path}`
return fetch(url).then(response => response.json()).catch(ex => {
console.error('parsing failes', ex);
});
}
export function sendJson(method, path, payload) {
//use this function to make a POST requst
const url = `${BACKEND_URL}${path}`
return fetch(url, {
method: method,
body: JSON.stringify(payload),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(response => response.json())
// .then(json => console.dir(json))
.catch(ex => {
console.error('parsing failed', ex)
});
}
#TODO(gitmirgut): remove later
export default class BackendTest extends Component {
//This Component is just for testing
constructor(props) {
super(props);
this.state = {
state: null
};
}
render() {
// fetchJson('/api/projects/dummyadd'),
sendJson('POST', '/api/projects/search', {
"query": {
"match_all": {}
}
}),
sendJson('POST', '/api/projects/search', {
"query": {
"query_string": {
"default_field": "tags",
"query": "project"
}
}
})
// .then(json => console.log(json))
return (
<div></div>
);
}
}
| Add files for communication with backend api | Add files for communication with backend api
| JSX | mit | Drakulix/knex,Drakulix/knex,Drakulix/knex,Drakulix/knex | ---
+++
@@ -0,0 +1,66 @@
+import React, {Component} from 'react';
+import 'babel-polyfill';
+import 'isomorphic-fetch';
+const BACKEND_URL = 'http://localhost:5000'
+
+ export function fetchJson(path) {
+ // use this function to make a GET request.
+ const url = `${BACKEND_URL}${path}`
+
+ return fetch(url).then(response => response.json()).catch(ex => {
+ console.error('parsing failes', ex);
+ });
+
+ }
+
+ export function sendJson(method, path, payload) {
+ //use this function to make a POST requst
+ const url = `${BACKEND_URL}${path}`
+
+ return fetch(url, {
+ method: method,
+ body: JSON.stringify(payload),
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ }
+ }).then(response => response.json())
+ // .then(json => console.dir(json))
+ .catch(ex => {
+ console.error('parsing failed', ex)
+ });
+ }
+
+ #TODO(gitmirgut): remove later
+ export default class BackendTest extends Component {
+ //This Component is just for testing
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ state: null
+ };
+ }
+
+ render() {
+ // fetchJson('/api/projects/dummyadd'),
+ sendJson('POST', '/api/projects/search', {
+ "query": {
+ "match_all": {}
+ }
+ }),
+ sendJson('POST', '/api/projects/search', {
+ "query": {
+ "query_string": {
+ "default_field": "tags",
+ "query": "project"
+ }
+ }
+ })
+ // .then(json => console.log(json))
+
+ return (
+ <div></div>
+ );
+ }
+} |
|
5fe5e33b8db0b1c3ea6717283cb43c57a9cfa872 | src/sentry/static/sentry/app/components/projects/bookmarkToggle.jsx | src/sentry/static/sentry/app/components/projects/bookmarkToggle.jsx | import React from 'react';
import ApiMixin from '../../mixins/apimixin';
import {update as projectUpdate} from '../../actionCreators/projects';
const BookmarkToggle = React.createClass({
propTypes: {
orgId: React.PropTypes.string.isRequired,
project: React.PropTypes.object.isRequired,
},
mixins: [
ApiMixin
],
handleBookmarkClick() {
let {project} = this.props;
projectUpdate(this.api, {
orgId: this.props.orgId,
projectId: project.slug,
data: {
isBookmarked: !project.isBookmarked
}
});
},
render() {
return (
<div onClick={this.handleBookmarkClick}>
{this.props.children}
</div>
);
}
});
export default BookmarkToggle;
| import React from 'react';
import ApiMixin from '../../mixins/apiMixin';
import {update as projectUpdate} from '../../actionCreators/projects';
const BookmarkToggle = React.createClass({
propTypes: {
orgId: React.PropTypes.string.isRequired,
project: React.PropTypes.object.isRequired,
},
mixins: [
ApiMixin
],
handleBookmarkClick() {
let {project} = this.props;
projectUpdate(this.api, {
orgId: this.props.orgId,
projectId: project.slug,
data: {
isBookmarked: !project.isBookmarked
}
});
},
render() {
return (
<div onClick={this.handleBookmarkClick}>
{this.props.children}
</div>
);
}
});
export default BookmarkToggle;
| Fix bad case on import statement | Fix bad case on import statement
| JSX | bsd-3-clause | mvaled/sentry,zenefits/sentry,looker/sentry,JamesMura/sentry,gencer/sentry,gencer/sentry,alexm92/sentry,mvaled/sentry,zenefits/sentry,mvaled/sentry,BuildingLink/sentry,JamesMura/sentry,alexm92/sentry,beeftornado/sentry,mvaled/sentry,BuildingLink/sentry,mvaled/sentry,zenefits/sentry,gencer/sentry,ifduyue/sentry,jean/sentry,beeftornado/sentry,ifduyue/sentry,ifduyue/sentry,looker/sentry,zenefits/sentry,JamesMura/sentry,JamesMura/sentry,looker/sentry,ifduyue/sentry,looker/sentry,jean/sentry,zenefits/sentry,mvaled/sentry,jean/sentry,beeftornado/sentry,BuildingLink/sentry,JackDanger/sentry,jean/sentry,BuildingLink/sentry,jean/sentry,BuildingLink/sentry,alexm92/sentry,gencer/sentry,looker/sentry,JamesMura/sentry,ifduyue/sentry,JackDanger/sentry,JackDanger/sentry,gencer/sentry | ---
+++
@@ -1,6 +1,6 @@
import React from 'react';
-import ApiMixin from '../../mixins/apimixin';
+import ApiMixin from '../../mixins/apiMixin';
import {update as projectUpdate} from '../../actionCreators/projects';
|
b8ad5418e050a4456b35400a5f5a693f05c5d8c4 | src/DataTable.test.jsx | src/DataTable.test.jsx | import React from 'react';
import { shallow } from 'enzyme';
import { Pagination } from 'react-bootstrap';
import DataTable from './DataTable';
test('calls onPageClick', () => {
let called = false;
const wrapper = shallow(<DataTable
pageSize={10}
totalItems={10}
onPageClick={() => { called = true; }}
/>);
wrapper.find(Pagination).simulate('select');
expect(called).toEqual(true);
});
| Test DataTable handles page click | Test DataTable handles page click
| JSX | mit | react-admin-lte/react-admin-lte,jonmpqts/reactjs-admin-lte,react-admin-lte/react-admin-lte | ---
+++
@@ -0,0 +1,15 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import { Pagination } from 'react-bootstrap';
+import DataTable from './DataTable';
+
+test('calls onPageClick', () => {
+ let called = false;
+ const wrapper = shallow(<DataTable
+ pageSize={10}
+ totalItems={10}
+ onPageClick={() => { called = true; }}
+ />);
+ wrapper.find(Pagination).simulate('select');
+ expect(called).toEqual(true);
+}); |
|
221f809cd8f4dfa3d0c974bb6514fafc7f6c601e | woodstock/src/components/UnitItem.jsx | woodstock/src/components/UnitItem.jsx | import React, {Component} from 'react';
import PropTypes from 'prop-types';
export default class UnitItem extends Component {
static propTypes = {
todo: PropTypes.object.isRequired
};
render() {
const {todo} = this.props;
const element = (
<label>
{todo.text}
</label>
);
return (
<li>
{element}
</li>
)
}
}
| Create unit item react item | Create unit item react item
| JSX | apache-2.0 | solairerove/woodstock,solairerove/woodstock,solairerove/woodstock | ---
+++
@@ -0,0 +1,24 @@
+import React, {Component} from 'react';
+import PropTypes from 'prop-types';
+
+export default class UnitItem extends Component {
+ static propTypes = {
+ todo: PropTypes.object.isRequired
+ };
+
+ render() {
+ const {todo} = this.props;
+
+ const element = (
+ <label>
+ {todo.text}
+ </label>
+ );
+
+ return (
+ <li>
+ {element}
+ </li>
+ )
+ }
+} |
|
125b6924909ffef4c9edf7953c1e8c5e6ed67630 | app/components/elements/Reputation.jsx | app/components/elements/Reputation.jsx | import React from 'react';
export default ({value}) => {
if (!value) return null;
return <span className="Reputation" title="Reputation">{value}</span>;
}
| import React from 'react';
export default ({value}) => {
if (isNaN(value)) {
console.log("Unexpected rep value:", value);
return null;
}
return <span className="Reputation" title="Reputation">{value}</span>;
}
| Fix - showing rep of 0 | Fix - showing rep of 0
| JSX | mit | GolosChain/tolstoy,TimCliff/steemit.com,TimCliff/steemit.com,GolosChain/tolstoy,enisey14/platform,TimCliff/steemit.com,GolosChain/tolstoy,enisey14/platform,steemit/steemit.com,steemit-intl/steemit.com,steemit/steemit.com,steemit/steemit.com,steemit-intl/steemit.com | ---
+++
@@ -1,6 +1,9 @@
import React from 'react';
export default ({value}) => {
- if (!value) return null;
+ if (isNaN(value)) {
+ console.log("Unexpected rep value:", value);
+ return null;
+ }
return <span className="Reputation" title="Reputation">{value}</span>;
} |
177a33b118b572a7d9d012c9f29fb2e068ebc907 | app/app/components/tasks/TaskForm.jsx | app/app/components/tasks/TaskForm.jsx | import React from 'react'
export default class TaskForm extends React.Component {
handleClick(){
let data = {
name: this.refs.name.value,
price: this.refs.price.value,
description: this.refs.description.value
}
axios.post('users/' + this.props.params.id + '/tasks', data).then(() => {
hashHistory.push('/users/' + this.props.params.id + '/tasks/new/search')
})
}
render(){
return (
<div>
<div className="form-group">
<label for="exampleInputName2">Task Name</label>
<input type="text" className="form-control" ref="name" placeholder="Pick up my laundry"/>
</div>
<div className="form-group">
<label for="exampleInputEmail2">Description</label>
<textarea className="form-control" ref="description" placeholder="Description" />
</div>
<div className="form-group">
<label for="exampleInputEmail2">Price</label>
<input type="number" className="form-control col-sm-2" ref="price" placeholder="Price($)" />
</div>
<button onClick={this.handleClick.bind(this)} className="btn btn-primary">Call A Serf</button><br /><br />
</div>
)
}
}
| Refactor out form for creating a new task | Refactor out form for creating a new task
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | ---
+++
@@ -0,0 +1,33 @@
+import React from 'react'
+
+export default class TaskForm extends React.Component {
+ handleClick(){
+ let data = {
+ name: this.refs.name.value,
+ price: this.refs.price.value,
+ description: this.refs.description.value
+ }
+ axios.post('users/' + this.props.params.id + '/tasks', data).then(() => {
+ hashHistory.push('/users/' + this.props.params.id + '/tasks/new/search')
+ })
+ }
+ render(){
+ return (
+ <div>
+ <div className="form-group">
+ <label for="exampleInputName2">Task Name</label>
+ <input type="text" className="form-control" ref="name" placeholder="Pick up my laundry"/>
+ </div>
+ <div className="form-group">
+ <label for="exampleInputEmail2">Description</label>
+ <textarea className="form-control" ref="description" placeholder="Description" />
+ </div>
+ <div className="form-group">
+ <label for="exampleInputEmail2">Price</label>
+ <input type="number" className="form-control col-sm-2" ref="price" placeholder="Price($)" />
+ </div>
+ <button onClick={this.handleClick.bind(this)} className="btn btn-primary">Call A Serf</button><br /><br />
+ </div>
+ )
+ }
+} |
|
bb11e88a8e10dffea9276a99701f96c4e4e26654 | src/app/views/content/CreateContent.jsx | src/app/views/content/CreateContent.jsx | import React, { Component } from "react";
import { push } from "react-router-redux";
import PropTypes from "prop-types";
import url from "../../utilities/url";
import SimpleSelectableList from "../../components/simple-selectable-list/SimpleSelectableList";
import Input from "../../components/Input";
const propTypes = {
dispatch: PropTypes.func.isRequired,
location: PropTypes.shape({
pathname: PropTypes.string.isRequired
}).isRequired
};
export class CreateContent extends Component {
constructor(props) {
super(props);
this.state = {
contentTypes: [
{
title: "Old workspace",
id: "workspace",
details: ["Create/edit content via the old workspace"],
url: `${url.resolve("../../../")}/workspace?collection=${this.props.params.collectionID}`,
externalLink: true
},
{
title: "Filterable dataset",
id: "cmd-filterable-datasets",
details: ["Create/edit datasets and/or versions for filterable (CMD) datasets"],
url: url.resolve("../") + "/datasets"
},
{
title: "Homepage",
id: "homepage",
url: url.resolve("../") + "/homepage"
}
],
filteredContentTypes: [],
searchTerm: ""
};
}
handleBackButton = () => {
const previousUrl = url.resolve("../");
this.props.dispatch(push(previousUrl));
};
handleSearchInput = event => {
const searchTerm = event.target.value.toLowerCase();
const filteredContentTypes = this.state.contentTypes.filter(
contentType => contentType.title.toLowerCase().search(searchTerm) !== -1 || contentType.id.toLowerCase().search(searchTerm) !== -1
);
this.setState({
filteredContentTypes,
searchTerm
});
};
render() {
return (
<div className="grid grid--justify-center">
<div className="grid__col-9">
<div className="margin-top--2">
◀{" "}
<button type="button" className="btn btn--link" onClick={this.handleBackButton}>
Back
</button>
</div>
<h1 className="margin-top--1 margin-bottom--1">Select a content type to create/edit</h1>
<Input id="search-content-types" placeholder="Search by name" onChange={this.handleSearchInput} />
<SimpleSelectableList rows={this.state.filteredContentTypes.length ? this.state.filteredContentTypes : this.state.contentTypes} />
</div>
</div>
);
}
}
CreateContent.propTypes = propTypes;
export default CreateContent;
| Add create/edit content selection page | Add create/edit content selection page
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -0,0 +1,84 @@
+import React, { Component } from "react";
+import { push } from "react-router-redux";
+import PropTypes from "prop-types";
+
+import url from "../../utilities/url";
+
+import SimpleSelectableList from "../../components/simple-selectable-list/SimpleSelectableList";
+import Input from "../../components/Input";
+
+const propTypes = {
+ dispatch: PropTypes.func.isRequired,
+ location: PropTypes.shape({
+ pathname: PropTypes.string.isRequired
+ }).isRequired
+};
+
+export class CreateContent extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ contentTypes: [
+ {
+ title: "Old workspace",
+ id: "workspace",
+ details: ["Create/edit content via the old workspace"],
+ url: `${url.resolve("../../../")}/workspace?collection=${this.props.params.collectionID}`,
+ externalLink: true
+ },
+ {
+ title: "Filterable dataset",
+ id: "cmd-filterable-datasets",
+ details: ["Create/edit datasets and/or versions for filterable (CMD) datasets"],
+ url: url.resolve("../") + "/datasets"
+ },
+ {
+ title: "Homepage",
+ id: "homepage",
+ url: url.resolve("../") + "/homepage"
+ }
+ ],
+ filteredContentTypes: [],
+ searchTerm: ""
+ };
+ }
+
+ handleBackButton = () => {
+ const previousUrl = url.resolve("../");
+ this.props.dispatch(push(previousUrl));
+ };
+
+ handleSearchInput = event => {
+ const searchTerm = event.target.value.toLowerCase();
+ const filteredContentTypes = this.state.contentTypes.filter(
+ contentType => contentType.title.toLowerCase().search(searchTerm) !== -1 || contentType.id.toLowerCase().search(searchTerm) !== -1
+ );
+ this.setState({
+ filteredContentTypes,
+ searchTerm
+ });
+ };
+
+ render() {
+ return (
+ <div className="grid grid--justify-center">
+ <div className="grid__col-9">
+ <div className="margin-top--2">
+ ◀{" "}
+ <button type="button" className="btn btn--link" onClick={this.handleBackButton}>
+ Back
+ </button>
+ </div>
+ <h1 className="margin-top--1 margin-bottom--1">Select a content type to create/edit</h1>
+ <Input id="search-content-types" placeholder="Search by name" onChange={this.handleSearchInput} />
+ <SimpleSelectableList rows={this.state.filteredContentTypes.length ? this.state.filteredContentTypes : this.state.contentTypes} />
+ </div>
+ </div>
+ );
+ }
+}
+
+CreateContent.propTypes = propTypes;
+
+export default CreateContent; |
|
9d7424b55856db660f1546069730fd7a82c1efd7 | BlazarUI/app/scripts/components/shared/CommitMessage.jsx | BlazarUI/app/scripts/components/shared/CommitMessage.jsx | import React, {Component, PropTypes} from 'react';
import {truncate as Truncate} from '../Helpers';
class CommitMessage extends Component {
render() {
const {
message,
truncate,
truncateLen,
truncateEllipsis
} = this.props;
return (
<span className='pre-text' title={this.props.message}>
{truncate ? Truncate(message, truncateLen, truncateEllipsis) : message}
</span>
);
}
}
CommitMessage.defaultProps = {
truncate: true,
truncateLen: 40,
truncateEllipsis: true
};
CommitMessage.propTypes = {
message: PropTypes.string.isRequired,
truncate: PropTypes.bool,
truncateLen: PropTypes.number,
truncateEllipsis: PropTypes.bool
};
export default CommitMessage;
| Create commit message component for table rows | Create commit message component for table rows
| JSX | apache-2.0 | HubSpot/Blazar,HubSpot/Blazar,HubSpot/Blazar,HubSpot/Blazar | ---
+++
@@ -0,0 +1,37 @@
+import React, {Component, PropTypes} from 'react';
+import {truncate as Truncate} from '../Helpers';
+
+class CommitMessage extends Component {
+
+ render() {
+
+ const {
+ message,
+ truncate,
+ truncateLen,
+ truncateEllipsis
+ } = this.props;
+
+ return (
+ <span className='pre-text' title={this.props.message}>
+ {truncate ? Truncate(message, truncateLen, truncateEllipsis) : message}
+ </span>
+ );
+ }
+
+}
+
+CommitMessage.defaultProps = {
+ truncate: true,
+ truncateLen: 40,
+ truncateEllipsis: true
+};
+
+CommitMessage.propTypes = {
+ message: PropTypes.string.isRequired,
+ truncate: PropTypes.bool,
+ truncateLen: PropTypes.number,
+ truncateEllipsis: PropTypes.bool
+};
+
+export default CommitMessage; |
|
9df65873b83c11d3aeb8e3f586b0fa1b0d76e1a0 | test/components/overview/available_actions.spec.jsx | test/components/overview/available_actions.spec.jsx | import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import '../../testHelper';
import AvailableActions from '../../../app/assets/javascripts/components/overview/available_actions.jsx';
describe('AvailableActions', () => {
it('Displays no actions for ended course', () => {
const TestAvailableActions = ReactTestUtils.renderIntoDocument(
<AvailableActions
current_user={{}}
/>
);
TestAvailableActions.setState({
course: {
ended: true
}
})
const p = ReactTestUtils.findRenderedDOMComponentWithTag(TestAvailableActions, 'p');
expect(p.textContent).to.eq('No available actions');
});
});
| Add test for available actions component | Add test for available actions component
| JSX | mit | sejalkhatri/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,majakomel/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard,alpha721/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,majakomel/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEduDashboard,KarmaHater/WikiEduDashboard,majakomel/WikiEduDashboard,alpha721/WikiEduDashboard | ---
+++
@@ -0,0 +1,21 @@
+import React from 'react';
+import ReactTestUtils from 'react-addons-test-utils';
+import '../../testHelper';
+import AvailableActions from '../../../app/assets/javascripts/components/overview/available_actions.jsx';
+
+describe('AvailableActions', () => {
+ it('Displays no actions for ended course', () => {
+ const TestAvailableActions = ReactTestUtils.renderIntoDocument(
+ <AvailableActions
+ current_user={{}}
+ />
+ );
+ TestAvailableActions.setState({
+ course: {
+ ended: true
+ }
+ })
+ const p = ReactTestUtils.findRenderedDOMComponentWithTag(TestAvailableActions, 'p');
+ expect(p.textContent).to.eq('No available actions');
+ });
+}); |
|
2ea37882240fa0e6e46e65bf00e1f457a22df1ae | webapp/utils/__tests__/duration.spec.jsx | webapp/utils/__tests__/duration.spec.jsx | import {getDuration} from '../duration';
describe('getDuration', () => {
it('handles weeks', () => {
expect(getDuration(604800090)).toBe('1 week');
expect(getDuration(604800090, true)).toBe('1w');
expect(getDuration(1204800090)).toBe('2 weeks');
expect(getDuration(1204800090, true)).toBe('2w');
});
it('handles days', () => {
expect(getDuration(172800000)).toBe('2 days');
expect(getDuration(172800000, true)).toBe('2d');
});
it('handles hours', () => {
expect(getDuration(7200000)).toBe('2 hours');
expect(getDuration(7200000, true)).toBe('2h');
});
it('handles minutes', () => {
expect(getDuration(120000)).toBe('2 minutes');
expect(getDuration(120000, true)).toBe('2m');
});
it('handles seconds', () => {
expect(getDuration(1000)).toBe('1 second');
expect(getDuration(1000, true)).toBe('1s');
expect(getDuration(2000)).toBe('2 seconds');
expect(getDuration(2000, true)).toBe('2s');
});
it('handles milliseconds', () => {
expect(getDuration(50)).toBe('0.05 seconds');
expect(getDuration(50, true)).toBe('0.05s');
});
});
| Add coverage for duration utils | test: Add coverage for duration utils
| JSX | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | ---
+++
@@ -0,0 +1,37 @@
+import {getDuration} from '../duration';
+
+describe('getDuration', () => {
+ it('handles weeks', () => {
+ expect(getDuration(604800090)).toBe('1 week');
+ expect(getDuration(604800090, true)).toBe('1w');
+ expect(getDuration(1204800090)).toBe('2 weeks');
+ expect(getDuration(1204800090, true)).toBe('2w');
+ });
+
+ it('handles days', () => {
+ expect(getDuration(172800000)).toBe('2 days');
+ expect(getDuration(172800000, true)).toBe('2d');
+ });
+
+ it('handles hours', () => {
+ expect(getDuration(7200000)).toBe('2 hours');
+ expect(getDuration(7200000, true)).toBe('2h');
+ });
+
+ it('handles minutes', () => {
+ expect(getDuration(120000)).toBe('2 minutes');
+ expect(getDuration(120000, true)).toBe('2m');
+ });
+
+ it('handles seconds', () => {
+ expect(getDuration(1000)).toBe('1 second');
+ expect(getDuration(1000, true)).toBe('1s');
+ expect(getDuration(2000)).toBe('2 seconds');
+ expect(getDuration(2000, true)).toBe('2s');
+ });
+
+ it('handles milliseconds', () => {
+ expect(getDuration(50)).toBe('0.05 seconds');
+ expect(getDuration(50, true)).toBe('0.05s');
+ });
+}); |
|
791213b49c00b17dd95afb3cdd60d5035a26eb38 | src/components/views/statistic/__tests__/value-test.jsx | src/components/views/statistic/__tests__/value-test.jsx | import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import { itShouldConsumeOwnAndPassCustomProps } from '../../../test-utils';
import Value from '../value';
describe('Value', () => {
it('Should be rendered as <div> by default', () => {
let wrapper = shallow(<Value />);
expect(wrapper).to.have.tagName('div');
expect(wrapper).to.have.className('value');
});
it('Should be rendered as custom component', () => {
let wrapper = shallow(<Value component="a"/>);
expect(wrapper).to.have.tagName('a');
expect(wrapper).to.have.className('value');
});
it('Could be text', () => {
let wrapper = shallow(<Value text />);
expect(wrapper).to.have.className('text');
});
});
| Add unit test for Value | Add unit test for Value
| JSX | mit | ngsru/semantic-react,aphofstede/semantic-react,hallister/semantic-react,ngsru/semantic-react,aphofstede/semantic-react,hallister/semantic-react | ---
+++
@@ -0,0 +1,24 @@
+import React from 'react';
+import { expect } from 'chai';
+import { shallow } from 'enzyme';
+import { itShouldConsumeOwnAndPassCustomProps } from '../../../test-utils';
+import Value from '../value';
+
+describe('Value', () => {
+ it('Should be rendered as <div> by default', () => {
+ let wrapper = shallow(<Value />);
+ expect(wrapper).to.have.tagName('div');
+ expect(wrapper).to.have.className('value');
+ });
+
+ it('Should be rendered as custom component', () => {
+ let wrapper = shallow(<Value component="a"/>);
+ expect(wrapper).to.have.tagName('a');
+ expect(wrapper).to.have.className('value');
+ });
+
+ it('Could be text', () => {
+ let wrapper = shallow(<Value text />);
+ expect(wrapper).to.have.className('text');
+ });
+}); |
|
3e24961905582b20ce7dc0d9c296ba9cfd43e373 | app/Resources/client/jsx/trait/search/quickSearch.jsx | app/Resources/client/jsx/trait/search/quickSearch.jsx | $(document).ready(function(){
//autocomplete for trait search
$("#search_trait").autocomplete({
position: {
my: "right top", at: "right bottom"
},
source: function (request, response) {
var search = request.term;
$.ajax({
url: "{{ path('api', {'namespace': 'listing', 'classname': type~'s'}) }}",
data: {term: request.term, limit: 500, search: search, dbversion: '{{ dbversion }}'},
dataType: "json",
success: function (data) {
response(data);
}
});
},
minLength: 3
});
$("#search_trait").data("ui-autocomplete")._renderItem = function (ul, item) {
var details = Routing.generate('{{ type }}_details', {'dbversion': '{{ dbversion }}', 'trait_type_id': item.trait_type_id});
var link = "<a href='"+details+"'><span style='display:inline-block; width: 100%; font-style: italic;'>" + item.name + "</span></a>";
var li = $("<li>")
.append(link)
.appendTo(ul);
return li;
};
$("#btn_search_trait").click(function(){
var searchTerm = $("#search_trait").val();
var resultPage = Routing.generate('{{ type }}_result', {'dbversion': '{{ dbversion }}', 'limit': 500, 'search': searchTerm});
window.location.href = resultPage;
});
}); | Add quick search jsx template for trait page | Add quick search jsx template for trait page
| JSX | mit | molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec | ---
+++
@@ -0,0 +1,35 @@
+$(document).ready(function(){
+ //autocomplete for trait search
+ $("#search_trait").autocomplete({
+ position: {
+ my: "right top", at: "right bottom"
+ },
+ source: function (request, response) {
+ var search = request.term;
+ $.ajax({
+ url: "{{ path('api', {'namespace': 'listing', 'classname': type~'s'}) }}",
+ data: {term: request.term, limit: 500, search: search, dbversion: '{{ dbversion }}'},
+ dataType: "json",
+ success: function (data) {
+ response(data);
+ }
+ });
+ },
+ minLength: 3
+ });
+
+ $("#search_trait").data("ui-autocomplete")._renderItem = function (ul, item) {
+ var details = Routing.generate('{{ type }}_details', {'dbversion': '{{ dbversion }}', 'trait_type_id': item.trait_type_id});
+ var link = "<a href='"+details+"'><span style='display:inline-block; width: 100%; font-style: italic;'>" + item.name + "</span></a>";
+ var li = $("<li>")
+ .append(link)
+ .appendTo(ul);
+ return li;
+ };
+
+ $("#btn_search_trait").click(function(){
+ var searchTerm = $("#search_trait").val();
+ var resultPage = Routing.generate('{{ type }}_result', {'dbversion': '{{ dbversion }}', 'limit': 500, 'search': searchTerm});
+ window.location.href = resultPage;
+ });
+}); |
|
480cf5566392974a5533026c76dd1dc98da402a3 | components/SiteNav/index.jsx | components/SiteNav/index.jsx | import React from 'react'
import { RouteHandler, Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers'
import './style.css'
class SiteNav extends React.Component {
render() {
const {location} = this.props
return (
<nav className='blog-nav'>
<ul>
<li>
<Link to="/" className={ location.pathname === prefixLink('/') ? "current" : null }> Articles
</Link>
</li>
<li>
<Link to="/about" className={ location.pathname === prefixLink('/about') ? "current" : null }> About me
</Link>
</li>
<li>
<Link to="/contact" className={ location.pathname === prefixLink('/contact') ? "current" : null }> Contact me
</Link>
</li>
</ul>
</nav>
);
}
}
SiteNav.propTypes = {
location: React.PropTypes.object,
}
export default SiteNav | import React from 'react'
import { RouteHandler, Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers'
import './style.css'
class SiteNav extends React.Component {
render() {
const {location} = this.props
return (
<nav className='blog-nav'>
<ul>
<li>
<Link to="/" className={ location.pathname === prefixLink('/') ? "current" : null }> Articles
</Link>
</li>
<li>
<Link to="/about/" className={ location.pathname === prefixLink('/about/') ? "current" : null }> About me
</Link>
</li>
<li>
<Link to="/contact/" className={ location.pathname === prefixLink('/contact/') ? "current" : null }> Contact me
</Link>
</li>
</ul>
</nav>
);
}
}
SiteNav.propTypes = {
location: React.PropTypes.object,
}
export default SiteNav | Add trailing slashes to nav links | Add trailing slashes to nav links
gatsby@0.12.5 enforces trailing slashes
https://github.com/gatsbyjs/gatsby/pull/378
| JSX | mit | ochaloup/blog.chalda.cz,YoruNoHikage/blog,YoruNoHikage/yorunohikage.github.io,alxshelepenok/gatsby-starter-lumen,maxgrok/maxgrok.github.io,hb-gatsby/gatsby-starter-lumen,renegens/blog,maxgrok/maxgrok.github.io,ochaloup/blog.chalda.cz,abisz/piedcode,YoruNoHikage/yorunohikage.github.io,renegens/blog,Chogyuwon/chogyuwon.github.io,nicklanasa/nicklanasa.github.io,Chogyuwon/chogyuwon.github.io,nicklanasa/nicklanasa.github.io,wpioneer/gatsby-starter-lumen,alxshelepenok/gatsby-starter-lumen | ---
+++
@@ -14,11 +14,11 @@
</Link>
</li>
<li>
- <Link to="/about" className={ location.pathname === prefixLink('/about') ? "current" : null }> About me
+ <Link to="/about/" className={ location.pathname === prefixLink('/about/') ? "current" : null }> About me
</Link>
</li>
<li>
- <Link to="/contact" className={ location.pathname === prefixLink('/contact') ? "current" : null }> Contact me
+ <Link to="/contact/" className={ location.pathname === prefixLink('/contact/') ? "current" : null }> Contact me
</Link>
</li>
</ul> |
65278e325958ec93866d9a35dc785946ea896a62 | src/js/components/__tests__/date-picker.spec.jsx | src/js/components/__tests__/date-picker.spec.jsx | import React from 'react';
import { shallow } from 'enzyme';
import { DatePicker } from '../';
describe('DatePicker', () => {
const
shallowRender = props => shallow(<DatePicker {...props} />);
let globalProps,
SELECT_FULL_DATE;
beforeEach(() => {
SELECT_FULL_DATE = jest.fn();
globalProps = {
year: 2017,
month: 2,
date: 24,
SELECT_FULL_DATE
};
});
describe('Component Lifecycle', () => {
it('should set the heading ref to null', () => {
const component = shallowRender(globalProps);
expect(component.instance().heading).toEqual(null);
});
it('should call focus when componentDidMount is called', () => {
const
component = shallowRender(globalProps),
instance = component.instance(),
focus = jest.fn();
instance.heading = { focus };
instance.componentDidMount();
expect(focus).toHaveBeenCalled();
});
it('should set the state when componentWillReceiveProps is called', () => {
const
component = shallowRender(globalProps),
instance = component.instance(),
setState = jest.fn();
instance.setState = setState;
instance.componentWillReceiveProps({});
expect(setState).toHaveBeenCalled();
});
});
describe('Events', () => {
it('should call SELECT_FULL_DATE onBlur', () => {
const
component = shallowRender(globalProps),
input = component.find('input').at(0),
event = {
target: { value: '2017-03-27' }
};
input.simulate('blur', event);
expect(SELECT_FULL_DATE).toHaveBeenCalled();
});
});
describe('Custom Functions', () => {
it('should set the heading ref to passed in element when refHandler is called', () => {
const
component = shallowRender(globalProps),
instance = component.instance(),
fakeElement = 'TEST';
instance.refHandler(fakeElement);
expect(instance.heading).toEqual(fakeElement);
});
});
describe('Render Functions', () => {
it('should render without throwing an error', () => {
const component = shallowRender(globalProps);
expect(component.find('.datepicker').length).toEqual(1);
});
});
});
| Test coverage for DatePicker component | Test coverage for DatePicker component
| JSX | mit | CarlaCrandall/React-Calendar,CarlaCrandall/React-Calendar | ---
+++
@@ -0,0 +1,90 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import { DatePicker } from '../';
+
+describe('DatePicker', () => {
+ const
+ shallowRender = props => shallow(<DatePicker {...props} />);
+
+ let globalProps,
+ SELECT_FULL_DATE;
+
+ beforeEach(() => {
+ SELECT_FULL_DATE = jest.fn();
+
+ globalProps = {
+ year: 2017,
+ month: 2,
+ date: 24,
+ SELECT_FULL_DATE
+ };
+ });
+
+ describe('Component Lifecycle', () => {
+ it('should set the heading ref to null', () => {
+ const component = shallowRender(globalProps);
+ expect(component.instance().heading).toEqual(null);
+ });
+
+ it('should call focus when componentDidMount is called', () => {
+ const
+ component = shallowRender(globalProps),
+ instance = component.instance(),
+ focus = jest.fn();
+
+ instance.heading = { focus };
+ instance.componentDidMount();
+
+ expect(focus).toHaveBeenCalled();
+ });
+
+ it('should set the state when componentWillReceiveProps is called', () => {
+ const
+ component = shallowRender(globalProps),
+ instance = component.instance(),
+ setState = jest.fn();
+
+ instance.setState = setState;
+ instance.componentWillReceiveProps({});
+
+ expect(setState).toHaveBeenCalled();
+ });
+ });
+
+
+ describe('Events', () => {
+ it('should call SELECT_FULL_DATE onBlur', () => {
+ const
+ component = shallowRender(globalProps),
+ input = component.find('input').at(0),
+ event = {
+ target: { value: '2017-03-27' }
+ };
+
+ input.simulate('blur', event);
+
+ expect(SELECT_FULL_DATE).toHaveBeenCalled();
+ });
+ });
+
+
+ describe('Custom Functions', () => {
+ it('should set the heading ref to passed in element when refHandler is called', () => {
+ const
+ component = shallowRender(globalProps),
+ instance = component.instance(),
+ fakeElement = 'TEST';
+
+ instance.refHandler(fakeElement);
+ expect(instance.heading).toEqual(fakeElement);
+ });
+ });
+
+
+ describe('Render Functions', () => {
+ it('should render without throwing an error', () => {
+ const component = shallowRender(globalProps);
+ expect(component.find('.datepicker').length).toEqual(1);
+ });
+ });
+}); |
|
b8f5764c4aaa8a6e9d7ccbd82ef74e99a3684ff9 | app/assets/javascripts/components/typeahead.js.jsx | app/assets/javascripts/components/typeahead.js.jsx | /** @jsx React.DOM */
var CONSTANTS = require('../constants');
(function() {
var TC = CONSTANTS.TYPEAHEAD;
var Typeahead = React.createClass({
mixins: [React.addons.LinkedStateMixin],
getInitialState: function() {
return { inputValue: '', transform: (this.props.transform || this.transform) };
},
render: function() {
return (
<div role="form" className="form-inline">
<div className="form-group">
<label className="sr-only">{this.props.label}</label>
<input type="text"
className={"form-control input-" + this.size()}
valueLink={this.linkState('inputValue')}
style={{width: this.props.width, 'padding-left': '5px'}}
/>
</div>
<button type="button"
className={"btn btn-default btn-" + this.size() + ' ' + this.active()}
onClick={this.handleClick}>
{this.props.prompt}
</button>
</div>
);
},
size: function(prefix) {
switch (this.props.size) {
case 'small':
return 'sm';
case 'medium':
return 'md';
case 'large':
return 'lg';
}
},
active: function() {
return this.state.inputValue.length >= 2 ? '' : 'disabled';
},
componentDidMount: function() {
Dispatcher.dispatch({
action: TC.ACTIONS.SETUP,
data: this.getDOMNode(),
event: TC.EVENTS.DID_MOUNT
});
},
handleClick: function(e) {
Dispatcher.dispatch({
action: TC.ACTIONS.ADD_TAG,
data: { tag: this.state.transform(this.state.inputValue), url: this.props.url },
event: TC.EVENTS.TAG_ADDED + '-true'
});
this.setState({
inputValue: ''
});
},
transform: function(text) {
return text.replace(/[^\w-]+/g, '-').toLowerCase()
}
});
if (typeof module !== 'undefined') {
module.exports = Typeahead;
}
window.Typeahead = Typeahead;
})();
| Rename TextComplete component to Typeahead so as not to conflict with global TextComplete | Rename TextComplete component to Typeahead so as not to conflict
with global TextComplete
| JSX | agpl-3.0 | lachlanjc/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,assemblymade/meta,lachlanjc/meta,assemblymade/meta,lachlanjc/meta | ---
+++
@@ -0,0 +1,80 @@
+/** @jsx React.DOM */
+
+var CONSTANTS = require('../constants');
+
+(function() {
+ var TC = CONSTANTS.TYPEAHEAD;
+
+ var Typeahead = React.createClass({
+ mixins: [React.addons.LinkedStateMixin],
+
+ getInitialState: function() {
+ return { inputValue: '', transform: (this.props.transform || this.transform) };
+ },
+
+ render: function() {
+ return (
+ <div role="form" className="form-inline">
+ <div className="form-group">
+ <label className="sr-only">{this.props.label}</label>
+ <input type="text"
+ className={"form-control input-" + this.size()}
+ valueLink={this.linkState('inputValue')}
+ style={{width: this.props.width, 'padding-left': '5px'}}
+ />
+ </div>
+ <button type="button"
+ className={"btn btn-default btn-" + this.size() + ' ' + this.active()}
+ onClick={this.handleClick}>
+ {this.props.prompt}
+ </button>
+ </div>
+ );
+ },
+
+ size: function(prefix) {
+ switch (this.props.size) {
+ case 'small':
+ return 'sm';
+ case 'medium':
+ return 'md';
+ case 'large':
+ return 'lg';
+ }
+ },
+
+ active: function() {
+ return this.state.inputValue.length >= 2 ? '' : 'disabled';
+ },
+
+ componentDidMount: function() {
+ Dispatcher.dispatch({
+ action: TC.ACTIONS.SETUP,
+ data: this.getDOMNode(),
+ event: TC.EVENTS.DID_MOUNT
+ });
+ },
+
+ handleClick: function(e) {
+ Dispatcher.dispatch({
+ action: TC.ACTIONS.ADD_TAG,
+ data: { tag: this.state.transform(this.state.inputValue), url: this.props.url },
+ event: TC.EVENTS.TAG_ADDED + '-true'
+ });
+
+ this.setState({
+ inputValue: ''
+ });
+ },
+
+ transform: function(text) {
+ return text.replace(/[^\w-]+/g, '-').toLowerCase()
+ }
+ });
+
+ if (typeof module !== 'undefined') {
+ module.exports = Typeahead;
+ }
+
+ window.Typeahead = Typeahead;
+})(); |
|
bf9e8b5c2afbab974712970d75ef33093e52e17c | src/app/views/workflow-preview/WorkflowPreview.jsx | src/app/views/workflow-preview/WorkflowPreview.jsx | import React, { Component } from "react";
import { push } from "react-router-redux";
import { Link } from "react-router";
import PropTypes from "prop-types";
import url from "../../utilities/url";
import notifications from "../../utilities/notifications";
import Iframe from "../../components/iframe/Iframe";
const propTypes = {
location: PropTypes.PropTypes.shape({
pathname: PropTypes.string
}),
params: PropTypes.shape({
collectionID: PropTypes.string.isRequired
}),
dispatch: PropTypes.func.isRequired
};
export class WorkflowPreview extends Component {
constructor(props) {
super(props);
}
handleBackButton = () => {
const previousUrl = url.resolve("../");
this.props.dispatch(push(previousUrl));
};
// getPreviewIframeURL returns the url for the content to be reviewed when the url is
// in the format: /florence/collections/collection-id/{content/to/preview/url}/preview
// returns '/' incase the url is '/homepage' or errors
getPreviewIframeURL = path => {
try {
const regex = /(?:\/[^\/]+){3}(?<contentURL>.+)\/preview/;
const regexResult = regex.exec(path);
const contentURL = regexResult.groups.contentURL;
if (contentURL === "/homepage") {
return "/";
}
return contentURL;
} catch (error) {
notifications.add({
type: "warning",
message:
"There was an error previewing this content so you've bene directed to the homepage. You can navigate to the content or refresh Florence.",
isDismissable: true
});
return "/";
}
};
render() {
this.getPreviewIframeURL(this.props.location.pathname);
return (
<div>
<div className="grid grid--justify-center">
<div className="grid__col-6 margin-bottom--1">
<div className="margin-top--2">
◀{" "}
<button type="button" className="btn btn--link" onClick={this.handleBackButton}>
Back
</button>
</div>
<h1 className="margin-top--1 margin-bottom--1">Preview</h1>
</div>
</div>
<div className="preview--half preview--borders">
<Iframe path={this.getPreviewIframeURL(this.props.location.pathname)} />
</div>
<div className="grid grid--justify-center">
<div className="grid__col-6">
<div className="margin-top--1 margin-bottom--1">
<Link
className="btn btn--positive margin-right--1"
to={window.location.origin + "/florence/collections/" + this.props.params.collectionID}
>
Continue
</Link>
</div>
</div>
</div>
</div>
);
}
}
WorkflowPreview.propTypes = propTypes;
export default WorkflowPreview;
| Add wrokflow preview component that can be used by any content type | Add wrokflow preview component that can be used by any content type
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -0,0 +1,91 @@
+import React, { Component } from "react";
+import { push } from "react-router-redux";
+import { Link } from "react-router";
+import PropTypes from "prop-types";
+
+import url from "../../utilities/url";
+import notifications from "../../utilities/notifications";
+
+import Iframe from "../../components/iframe/Iframe";
+
+const propTypes = {
+ location: PropTypes.PropTypes.shape({
+ pathname: PropTypes.string
+ }),
+ params: PropTypes.shape({
+ collectionID: PropTypes.string.isRequired
+ }),
+ dispatch: PropTypes.func.isRequired
+};
+
+export class WorkflowPreview extends Component {
+ constructor(props) {
+ super(props);
+ }
+
+ handleBackButton = () => {
+ const previousUrl = url.resolve("../");
+ this.props.dispatch(push(previousUrl));
+ };
+
+ // getPreviewIframeURL returns the url for the content to be reviewed when the url is
+ // in the format: /florence/collections/collection-id/{content/to/preview/url}/preview
+ // returns '/' incase the url is '/homepage' or errors
+ getPreviewIframeURL = path => {
+ try {
+ const regex = /(?:\/[^\/]+){3}(?<contentURL>.+)\/preview/;
+ const regexResult = regex.exec(path);
+ const contentURL = regexResult.groups.contentURL;
+ if (contentURL === "/homepage") {
+ return "/";
+ }
+ return contentURL;
+ } catch (error) {
+ notifications.add({
+ type: "warning",
+ message:
+ "There was an error previewing this content so you've bene directed to the homepage. You can navigate to the content or refresh Florence.",
+ isDismissable: true
+ });
+ return "/";
+ }
+ };
+
+ render() {
+ this.getPreviewIframeURL(this.props.location.pathname);
+ return (
+ <div>
+ <div className="grid grid--justify-center">
+ <div className="grid__col-6 margin-bottom--1">
+ <div className="margin-top--2">
+ ◀{" "}
+ <button type="button" className="btn btn--link" onClick={this.handleBackButton}>
+ Back
+ </button>
+ </div>
+ <h1 className="margin-top--1 margin-bottom--1">Preview</h1>
+ </div>
+ </div>
+ <div className="preview--half preview--borders">
+ <Iframe path={this.getPreviewIframeURL(this.props.location.pathname)} />
+ </div>
+ <div className="grid grid--justify-center">
+ <div className="grid__col-6">
+ <div className="margin-top--1 margin-bottom--1">
+ <Link
+ className="btn btn--positive margin-right--1"
+ to={window.location.origin + "/florence/collections/" + this.props.params.collectionID}
+ >
+ Continue
+ </Link>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+ }
+}
+
+WorkflowPreview.propTypes = propTypes;
+
+export default WorkflowPreview; |
|
b444848ad5caab1d8004a8b732e933e3c4deddbd | app/scripts/shared/components/nav-links/nav-links.jsx | app/scripts/shared/components/nav-links/nav-links.jsx | var React = require('react');
var Link = require('react-router').Link;
var NavLinks = React.createClass({
propTypes: {
links: React.PropTypes.array
},
//<ul className="nav navbar-nav navbar-right">
getDefaultProps: function() {
return {className: "nav navbar-nav"};
},
getLinks: function(links) {
var items = links.map(function(link, i) {
return(
<li key={i++}>
<Link to={link.href}>
{link.text}
</Link>
</li>
);
});
return items;
},
render: function() {
var links = this.getLinks(this.props.links);
return (
<ul className={this.props.className}>
{links}
</ul>
);
}
});
module.exports = NavLinks;
| Add nav links component to programmatically create navbar links | [TASK] Add nav links component to programmatically create navbar links
| JSX | isc | dabibbit/gatewayd-quoting-app,AiNoKame/gatewayd-basic-admin-phase-1,dabibbit/gatewayd-banking-app,cryptospora/gatewayd-basic-app,hserang/gatewayd-admin-seeds,n0rmz/gatewayd-client,dabibbit/gatewayd-banking-app,AiNoKame/gatewayd-basic-admin-dec,n0rmz/gatewayd-client,dabibbit/gatewayd-quoting-app | ---
+++
@@ -0,0 +1,39 @@
+var React = require('react');
+var Link = require('react-router').Link;
+
+var NavLinks = React.createClass({
+ propTypes: {
+ links: React.PropTypes.array
+ },
+
+ //<ul className="nav navbar-nav navbar-right">
+ getDefaultProps: function() {
+ return {className: "nav navbar-nav"};
+ },
+
+ getLinks: function(links) {
+ var items = links.map(function(link, i) {
+ return(
+ <li key={i++}>
+ <Link to={link.href}>
+ {link.text}
+ </Link>
+ </li>
+ );
+ });
+
+ return items;
+ },
+
+ render: function() {
+ var links = this.getLinks(this.props.links);
+
+ return (
+ <ul className={this.props.className}>
+ {links}
+ </ul>
+ );
+ }
+});
+
+module.exports = NavLinks; |
|
65a0c2af2934ad3cf7f8dc81e94e6d0f2ec50207 | src/public/views/components/header/alertBanner.jsx | src/public/views/components/header/alertBanner.jsx | 'use strict';
import React from 'react';
import {Link} from 'react-router';
import { strings } from '../../../lib/i18n';
class AlertBanner extends React.Component {
render() {
if (!this.props.message) {
return null
} else {
return (
<div className='alert__banner p3 center'>
<div className='section__container center'>
<div className='inline bold underline'>ALERT:</div>
{this.props.message}
</div>
</div>
)
}
}
}
export default AlertBanner
| Add ne alert banner component | Add ne alert banner component
| JSX | mit | BitcoinUnlimited/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,gandrewstone/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,gandrewstone/BitcoinUnlimitedWeb | ---
+++
@@ -0,0 +1,26 @@
+'use strict';
+
+import React from 'react';
+import {Link} from 'react-router';
+import { strings } from '../../../lib/i18n';
+
+class AlertBanner extends React.Component {
+
+ render() {
+ if (!this.props.message) {
+ return null
+ } else {
+ return (
+ <div className='alert__banner p3 center'>
+ <div className='section__container center'>
+ <div className='inline bold underline'>ALERT:</div>
+
+ {this.props.message}
+ </div>
+ </div>
+ )
+ }
+ }
+}
+
+export default AlertBanner |
|
a42d2da60e6e4c8173e60999ba168b25ea40a5c5 | src/app/components/form-error-summary/FormErrorSummary.jsx | src/app/components/form-error-summary/FormErrorSummary.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
const propTypes = {
errors: PropTypes.arrayOf(PropTypes.string)
}
class FormErrorSummary extends Component {
constructor(props) {
super(props);
}
render() {
if (!this.props.errors.length) {
return null;
}
return (
<div className="error-summary" role="alert" aria-labelledby="error-summary-heading">
<h2 id="error-summary-heading">
Errors
</h2>
<p>Before saving please correct the following</p>
<ul className="error-summary__list">
{this.props.errors.map((error, index) => {
return <li key={index} className="error-summary__list-item">{error}</li>
})}
</ul>
</div>
)
}
}
FormErrorSummary.propTypes = propTypes;
export default FormErrorSummary; | Add form error sumamry componeent that lists all errors on a form | Add form error sumamry componeent that lists all errors on a form
Former-commit-id: 491d442f3e3ba44980e24bea6b2efd4015ce7d7f
Former-commit-id: 64fdfa3ec46582c7713cb0d57cf7355de7b337ee
Former-commit-id: 3843129e557828bcfdecf91ca41e7af3fce16c18 | JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+
+const propTypes = {
+ errors: PropTypes.arrayOf(PropTypes.string)
+}
+
+class FormErrorSummary extends Component {
+ constructor(props) {
+ super(props);
+ }
+ render() {
+ if (!this.props.errors.length) {
+ return null;
+ }
+ return (
+ <div className="error-summary" role="alert" aria-labelledby="error-summary-heading">
+ <h2 id="error-summary-heading">
+ Errors
+ </h2>
+ <p>Before saving please correct the following</p>
+ <ul className="error-summary__list">
+ {this.props.errors.map((error, index) => {
+ return <li key={index} className="error-summary__list-item">{error}</li>
+ })}
+ </ul>
+ </div>
+ )
+ }
+}
+
+FormErrorSummary.propTypes = propTypes;
+export default FormErrorSummary; |
|
91420c40da61dc46b3b3761fd404068fb70845ba | ui/src/message_popup/playtest/insubordination_scenarios_test.jsx | ui/src/message_popup/playtest/insubordination_scenarios_test.jsx | /* @flow weak */
import {expect} from 'chai';
import {InsubordinationScenarios} from './insubordination_scenarios.js';
describe('InsubordinationScenarios', () => {
it('#cohortKey', () => {
expect(InsubordinationScenarios.cohortKey('krob@mit.edu')).to.equal(2);
expect(InsubordinationScenarios.cohortKey('sfd')).to.equal(1);
});
it('#data', () => {
const {conditions, questionTemplates} = InsubordinationScenarios.data();
expect(conditions.length).to.equal(4);
expect(questionTemplates.length).to.equal(5);
});
});
| Add minimal tests to insubordination scenarios | Add minimal tests to insubordination scenarios
| JSX | mit | mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows | ---
+++
@@ -0,0 +1,18 @@
+/* @flow weak */
+import {expect} from 'chai';
+
+import {InsubordinationScenarios} from './insubordination_scenarios.js';
+
+
+describe('InsubordinationScenarios', () => {
+ it('#cohortKey', () => {
+ expect(InsubordinationScenarios.cohortKey('krob@mit.edu')).to.equal(2);
+ expect(InsubordinationScenarios.cohortKey('sfd')).to.equal(1);
+ });
+
+ it('#data', () => {
+ const {conditions, questionTemplates} = InsubordinationScenarios.data();
+ expect(conditions.length).to.equal(4);
+ expect(questionTemplates.length).to.equal(5);
+ });
+}); |
|
b1ffa9d0e359cfe3fef8d837fc9e9de70e1de563 | client/app/bundles/course/survey/components/LoadingIndicator.jsx | client/app/bundles/course/survey/components/LoadingIndicator.jsx | import React from 'react';
import RefreshIndicator from 'material-ui/RefreshIndicator';
const styles = {
loading: {
display: 'flex',
justifyContent: 'center',
width: '100%',
},
loadingInnerDiv: {
position: 'relative',
},
};
const LoadingIndicator = () => (
<div style={styles.loading}>
<div style={styles.loadingInnerDiv}>
<RefreshIndicator top={50} left={0} size={60} status="loading" />
</div>
</div>
);
export default LoadingIndicator;
| Add standard loading indicator for survey pages | Add standard loading indicator for survey pages
| JSX | mit | cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2 | ---
+++
@@ -0,0 +1,23 @@
+import React from 'react';
+import RefreshIndicator from 'material-ui/RefreshIndicator';
+
+const styles = {
+ loading: {
+ display: 'flex',
+ justifyContent: 'center',
+ width: '100%',
+ },
+ loadingInnerDiv: {
+ position: 'relative',
+ },
+};
+
+const LoadingIndicator = () => (
+ <div style={styles.loading}>
+ <div style={styles.loadingInnerDiv}>
+ <RefreshIndicator top={50} left={0} size={60} status="loading" />
+ </div>
+ </div>
+);
+
+export default LoadingIndicator; |
|
b5de9efce84b5c0ce33b570e958238ae29c9186a | src/js/components/PagedContentComponent.jsx | src/js/components/PagedContentComponent.jsx | var React = require("react/addons");
module.exports = React.createClass({
displayName: "PagedContentComponent",
propTypes: {
className: React.PropTypes.string,
currentPage: React.PropTypes.number.isRequired,
itemsPerPage: React.PropTypes.number,
tag: React.PropTypes.string
},
getDefaultProps: function () {
return {
itemsPerPage: 20,
tag: "div"
};
},
isHidden: function (child) {
return child != null &&
child.props != null &&
child.props.className != null &&
child.props.className.split(" ").indexOf("hidden") > -1;
},
getVisibleChildren: function (children) {
return children.filter(function (child) {
return !this.isHidden(child);
}.bind(this));
},
getPageNodes: function () {
var children = this.props.children;
var begin = this.props.currentPage * this.props.itemsPerPage;
var end = begin + this.props.itemsPerPage;
var visibleChildren = this.getVisibleChildren(children);
return React.Children.map(visibleChildren, function (child, i) {
if (i >= begin && i < end) {
return React.cloneElement(child, {key: i});
}
});
},
render: function () {
return (
React.createElement(
this.props.tag,
{className: this.props.className},
this.getPageNodes()
)
);
}
});
| var React = require("react/addons");
module.exports = React.createClass({
displayName: "PagedContentComponent",
propTypes: {
children: React.PropTypes.node,
className: React.PropTypes.string,
currentPage: React.PropTypes.number.isRequired,
itemsPerPage: React.PropTypes.number,
tag: React.PropTypes.string
},
getDefaultProps: function () {
return {
itemsPerPage: 20,
tag: "div"
};
},
isHidden: function (child) {
return child != null &&
child.props != null &&
child.props.className != null &&
child.props.className.split(" ").indexOf("hidden") > -1;
},
getVisibleChildren: function (children) {
return children.filter(function (child) {
return !this.isHidden(child);
}.bind(this));
},
getPageNodes: function () {
var children = this.props.children;
var begin = this.props.currentPage * this.props.itemsPerPage;
var end = begin + this.props.itemsPerPage;
var visibleChildren = this.getVisibleChildren(children);
return React.Children.map(visibleChildren, function (child, i) {
if (i >= begin && i < end) {
return React.cloneElement(child, {key: i});
}
});
},
render: function () {
return (
React.createElement(
this.props.tag,
{className: this.props.className},
this.getPageNodes()
)
);
}
});
| Declare propTypes for children prop | Declare propTypes for children prop
This removes the eslint warning due to the missing propType declaration.
For info see:
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
| JSX | apache-2.0 | watonyweng/marathon-ui,mesosphere/marathon-ui,quamilek/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui,cribalik/marathon-ui,yp-engineering/marathon-ui,yp-engineering/marathon-ui,Kosta-Github/marathon-ui,janisz/marathon-ui,Kosta-Github/marathon-ui,quamilek/marathon-ui,Raffo/marathon-ui,janisz/marathon-ui,watonyweng/marathon-ui,Raffo/marathon-ui | ---
+++
@@ -4,6 +4,7 @@
displayName: "PagedContentComponent",
propTypes: {
+ children: React.PropTypes.node,
className: React.PropTypes.string,
currentPage: React.PropTypes.number.isRequired,
itemsPerPage: React.PropTypes.number, |
39c7a5c23ddcab9f5dba7918a49cda80c7b665d2 | src/apps/investments/client/opportunities/OpportunitySummary.jsx | src/apps/investments/client/opportunities/OpportunitySummary.jsx | import React from 'react'
import SummaryTable from '../../../../client/components/SummaryTable'
import Tag from '../../../../client/components/Tag'
import { currencyGBP } from '../../../../client/utils/number-utils'
import Link from '@govuk-react/link'
import styled from 'styled-components'
const StyledTag = styled(Tag)`
float: right;
`
const TextRow = ({ data }) => (
<SummaryTable.Row heading={data.label}>
{data.value ? data.value : <StyledTag>incomplete</StyledTag>}
</SummaryTable.Row>
)
const CurrencyRow = ({ data }) => (
<SummaryTable.Row heading={data.label}>
{data.value ? currencyGBP(data.value) : <StyledTag>incomplete</StyledTag>}
</SummaryTable.Row>
)
const ListRow = ({ data }) => (
<SummaryTable.Row heading={data.label}>
{data.value.length ? (
<ul>
{data.value.map((v) => (
<li>{v}</li>
))}
</ul>
) : (
<StyledTag>incomplete</StyledTag>
)}
</SummaryTable.Row>
)
export const OpportunityDetails = ({ details }) => {
const {
name,
description,
ukRegions,
promoters,
requiredChecks,
leadRelationshipManager,
assetClasses,
value,
constructionRisks,
} = details
return (
<>
<TextRow data={name} />
<TextRow data={description} />
<ListRow data={ukRegions} />
<SummaryTable.Row heading={promoters.label}>
{promoters.value.length ? (
<ul>
{promoters.value.map((v) => (
<li>
<Link href={`/companies/${v.id}`}>{v.name}</Link>
</li>
))}
</ul>
) : (
<StyledTag>incomplete</StyledTag>
)}
</SummaryTable.Row>
<TextRow data={requiredChecks} />
<TextRow data={leadRelationshipManager} />
<ListRow data={assetClasses} />
<CurrencyRow data={value} />
<ListRow data={constructionRisks} />
</>
)
}
| Add Task logic for investment opportunities | Add Task logic for investment opportunities
| JSX | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -0,0 +1,79 @@
+import React from 'react'
+
+import SummaryTable from '../../../../client/components/SummaryTable'
+import Tag from '../../../../client/components/Tag'
+
+import { currencyGBP } from '../../../../client/utils/number-utils'
+
+import Link from '@govuk-react/link'
+import styled from 'styled-components'
+
+const StyledTag = styled(Tag)`
+ float: right;
+`
+
+const TextRow = ({ data }) => (
+ <SummaryTable.Row heading={data.label}>
+ {data.value ? data.value : <StyledTag>incomplete</StyledTag>}
+ </SummaryTable.Row>
+)
+
+const CurrencyRow = ({ data }) => (
+ <SummaryTable.Row heading={data.label}>
+ {data.value ? currencyGBP(data.value) : <StyledTag>incomplete</StyledTag>}
+ </SummaryTable.Row>
+)
+
+const ListRow = ({ data }) => (
+ <SummaryTable.Row heading={data.label}>
+ {data.value.length ? (
+ <ul>
+ {data.value.map((v) => (
+ <li>{v}</li>
+ ))}
+ </ul>
+ ) : (
+ <StyledTag>incomplete</StyledTag>
+ )}
+ </SummaryTable.Row>
+)
+
+export const OpportunityDetails = ({ details }) => {
+ const {
+ name,
+ description,
+ ukRegions,
+ promoters,
+ requiredChecks,
+ leadRelationshipManager,
+ assetClasses,
+ value,
+ constructionRisks,
+ } = details
+
+ return (
+ <>
+ <TextRow data={name} />
+ <TextRow data={description} />
+ <ListRow data={ukRegions} />
+ <SummaryTable.Row heading={promoters.label}>
+ {promoters.value.length ? (
+ <ul>
+ {promoters.value.map((v) => (
+ <li>
+ <Link href={`/companies/${v.id}`}>{v.name}</Link>
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <StyledTag>incomplete</StyledTag>
+ )}
+ </SummaryTable.Row>
+ <TextRow data={requiredChecks} />
+ <TextRow data={leadRelationshipManager} />
+ <ListRow data={assetClasses} />
+ <CurrencyRow data={value} />
+ <ListRow data={constructionRisks} />
+ </>
+ )
+} |
|
d52a99e35ababfbe929388a636de63a81166d4ef | features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/admin_new/source/src/app/components/APICategories/DeleteAPICategory.jsx | features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/admin_new/source/src/app/components/APICategories/DeleteAPICategory.jsx | /*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import API from 'AppData/api';
import PropTypes from 'prop-types';
import DialogContentText from '@material-ui/core/DialogContentText';
import DeleteForeverIcon from '@material-ui/icons/DeleteForever';
import FormDialogBase from 'AppComponents/AdminPages/Addons/FormDialogBase';
/**
* API call to delete api category with uuid: id
* @param {number} id uuid of the api category to delete.
* @returns {Promise}.
*/
function apiCall(id) {
const restApi = new API();
return restApi.deleteAPICategory(id);
}
/**
* Render delete dialog box.
* @param {JSON} props component props.
* @returns {JSX} Loading animation.
*/
function Delete({ updateList, dataRow }) {
const { id } = dataRow;
const formSaveCallback = () => {
const promiseAPICall = apiCall(id);
promiseAPICall
.then((data) => {
updateList();
return data;
})
.catch((e) => {
return e;
});
return promiseAPICall;
};
return (
<FormDialogBase
title='Delete API category?'
saveButtonText='Delete'
icon={<DeleteForeverIcon />}
formSaveCallback={formSaveCallback}
>
<DialogContentText>
Are you sure you want to delete this API Category?
</DialogContentText>
</FormDialogBase>
);
}
Delete.propTypes = {
updateList: PropTypes.number.isRequired,
dataRow: PropTypes.shape({
id: PropTypes.number.isRequired,
}).isRequired,
};
export default Delete;
| Apply new theme for API Category delete | Apply new theme for API Category delete
| JSX | apache-2.0 | prasa7/carbon-apimgt,chamindias/carbon-apimgt,chamindias/carbon-apimgt,Rajith90/carbon-apimgt,chamilaadhi/carbon-apimgt,isharac/carbon-apimgt,jaadds/carbon-apimgt,malinthaprasan/carbon-apimgt,malinthaprasan/carbon-apimgt,tharikaGitHub/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,chamindias/carbon-apimgt,wso2/carbon-apimgt,tharindu1st/carbon-apimgt,ruks/carbon-apimgt,nuwand/carbon-apimgt,bhathiya/carbon-apimgt,prasa7/carbon-apimgt,malinthaprasan/carbon-apimgt,nuwand/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,wso2/carbon-apimgt,tharindu1st/carbon-apimgt,ruks/carbon-apimgt,tharindu1st/carbon-apimgt,chamindias/carbon-apimgt,tharikaGitHub/carbon-apimgt,Rajith90/carbon-apimgt,tharindu1st/carbon-apimgt,bhathiya/carbon-apimgt,nuwand/carbon-apimgt,fazlan-nazeem/carbon-apimgt,uvindra/carbon-apimgt,ruks/carbon-apimgt,tharikaGitHub/carbon-apimgt,fazlan-nazeem/carbon-apimgt,Rajith90/carbon-apimgt,chamilaadhi/carbon-apimgt,fazlan-nazeem/carbon-apimgt,chamilaadhi/carbon-apimgt,fazlan-nazeem/carbon-apimgt,tharikaGitHub/carbon-apimgt,praminda/carbon-apimgt,uvindra/carbon-apimgt,nuwand/carbon-apimgt,isharac/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,jaadds/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,jaadds/carbon-apimgt,ruks/carbon-apimgt,jaadds/carbon-apimgt,bhathiya/carbon-apimgt,praminda/carbon-apimgt,Rajith90/carbon-apimgt,bhathiya/carbon-apimgt,wso2/carbon-apimgt,chamilaadhi/carbon-apimgt,isharac/carbon-apimgt,prasa7/carbon-apimgt,wso2/carbon-apimgt,praminda/carbon-apimgt,uvindra/carbon-apimgt,isharac/carbon-apimgt,malinthaprasan/carbon-apimgt,uvindra/carbon-apimgt,prasa7/carbon-apimgt | ---
+++
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import React from 'react';
+import API from 'AppData/api';
+import PropTypes from 'prop-types';
+import DialogContentText from '@material-ui/core/DialogContentText';
+import DeleteForeverIcon from '@material-ui/icons/DeleteForever';
+import FormDialogBase from 'AppComponents/AdminPages/Addons/FormDialogBase';
+
+/**
+ * API call to delete api category with uuid: id
+ * @param {number} id uuid of the api category to delete.
+ * @returns {Promise}.
+ */
+function apiCall(id) {
+ const restApi = new API();
+ return restApi.deleteAPICategory(id);
+}
+
+/**
+ * Render delete dialog box.
+ * @param {JSON} props component props.
+ * @returns {JSX} Loading animation.
+ */
+function Delete({ updateList, dataRow }) {
+ const { id } = dataRow;
+
+ const formSaveCallback = () => {
+ const promiseAPICall = apiCall(id);
+
+ promiseAPICall
+ .then((data) => {
+ updateList();
+ return data;
+ })
+ .catch((e) => {
+ return e;
+ });
+ return promiseAPICall;
+ };
+
+ return (
+ <FormDialogBase
+ title='Delete API category?'
+ saveButtonText='Delete'
+ icon={<DeleteForeverIcon />}
+ formSaveCallback={formSaveCallback}
+ >
+ <DialogContentText>
+ Are you sure you want to delete this API Category?
+ </DialogContentText>
+ </FormDialogBase>
+ );
+}
+Delete.propTypes = {
+ updateList: PropTypes.number.isRequired,
+ dataRow: PropTypes.shape({
+ id: PropTypes.number.isRequired,
+ }).isRequired,
+};
+export default Delete; |
|
ad72f483a56aee6a49a0ea721905879f44c58110 | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/file-viewer.jsx | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/file-viewer.jsx | import React from "react";
import { get } from "../../../utils.js";
import "~/style/_file-viewer.scss";
import PropTypes from "prop-types";
export default class WonFileViewer extends React.Component {
render() {
const icon = this.props.detail.icon && (
<svg className="titlev__header__icon">
<use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
</svg>
);
const label = this.props.detail.icon && (
<span className="titlev__header__label">{this.props.detail.label}</span>
);
const filesArray = this.props.content && this.props.content.toArray();
const files =
filesArray &&
filesArray.map((file, index) => {
return (
<div className="filev__content__item" key={index}>
this.isImage(file) ? (
<a
className="filev__content__item__inner"
href={
"data:" + get(file, "type") + ";base64," + get(file, "data")
}
download={get(file, "name")}
>
<svg className="filev__content__item__inner__typeicon">
<use
xlinkHref="#ico36_uc_transport_demand"
href="#ico36_uc_transport_demand"
/>
</svg>
<div className="filev__content__item__inner__label">
{get(file, "name")}
</div>
</a>
) :(
<a
className="filev__content__item__inner"
onClick={() => this.openImageInNewTab(file)}
>
<img
className="filev__content__item__inner__image"
alt={get(file, "name")}
src={
"data:" + get(file, "type") + ";base64," + get(file, "data")
}
/>
<div className="filev__content__item__inner__label">
{get(file, "name")}
</div>
</a>
)
</div>
);
});
return (
<won-file-viewer>
<div className="titlev__header">
{icon}
{label}
</div>
<div className="titlev__content">{files}</div>
</won-file-viewer>
);
}
openImageInNewTab(file) {
if (file) {
let image = new Image();
image.src = "data:" + get(file, "type") + ";base64," + get(file, "data");
let w = window.open("");
w.document.write(image.outerHTML);
}
}
}
WonFileViewer.propTypes = {
detail: PropTypes.object,
content: PropTypes.object,
};
| Implement fileviewer as react components | Implement fileviewer as react components
| JSX | apache-2.0 | researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds | ---
+++
@@ -0,0 +1,89 @@
+import React from "react";
+
+import { get } from "../../../utils.js";
+import "~/style/_file-viewer.scss";
+import PropTypes from "prop-types";
+
+export default class WonFileViewer extends React.Component {
+ render() {
+ const icon = this.props.detail.icon && (
+ <svg className="titlev__header__icon">
+ <use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
+ </svg>
+ );
+
+ const label = this.props.detail.icon && (
+ <span className="titlev__header__label">{this.props.detail.label}</span>
+ );
+
+ const filesArray = this.props.content && this.props.content.toArray();
+
+ const files =
+ filesArray &&
+ filesArray.map((file, index) => {
+ return (
+ <div className="filev__content__item" key={index}>
+ this.isImage(file) ? (
+ <a
+ className="filev__content__item__inner"
+ href={
+ "data:" + get(file, "type") + ";base64," + get(file, "data")
+ }
+ download={get(file, "name")}
+ >
+ <svg className="filev__content__item__inner__typeicon">
+ <use
+ xlinkHref="#ico36_uc_transport_demand"
+ href="#ico36_uc_transport_demand"
+ />
+ </svg>
+ <div className="filev__content__item__inner__label">
+ {get(file, "name")}
+ </div>
+ </a>
+ ) :(
+ <a
+ className="filev__content__item__inner"
+ onClick={() => this.openImageInNewTab(file)}
+ >
+ <img
+ className="filev__content__item__inner__image"
+ alt={get(file, "name")}
+ src={
+ "data:" + get(file, "type") + ";base64," + get(file, "data")
+ }
+ />
+ <div className="filev__content__item__inner__label">
+ {get(file, "name")}
+ </div>
+ </a>
+ )
+ </div>
+ );
+ });
+
+ return (
+ <won-file-viewer>
+ <div className="titlev__header">
+ {icon}
+ {label}
+ </div>
+ <div className="titlev__content">{files}</div>
+ </won-file-viewer>
+ );
+ }
+
+ openImageInNewTab(file) {
+ if (file) {
+ let image = new Image();
+ image.src = "data:" + get(file, "type") + ";base64," + get(file, "data");
+
+ let w = window.open("");
+ w.document.write(image.outerHTML);
+ }
+ }
+}
+WonFileViewer.propTypes = {
+ detail: PropTypes.object,
+ content: PropTypes.object,
+}; |
|
694ae633643bba9166cf509540f14b46f2ee7085 | client/src/components/customer/RestaurantCard.jsx | client/src/components/customer/RestaurantCard.jsx | import React from 'react';
class RestaurantCard extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
render() {
return (
<div class="row">
<div class="col s12 m7">
<div class="card">
<div class="card-image">
<img src="images/sample-1.jpg"/>
<span class="card-title">Card Title</span>
</div>
<div class="card-content">
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div class="card-action">
<a href="#">This is a link</a>
</div>
</div>
</div>
</div>
)
}
};
export default RestaurantCard; | Add header to select group sizes | Add header to select group sizes
| JSX | mit | Pegaiur/q-dot,Lynne-Daniels/q-dot,q-dot/q-dot,nehacp/q-dot | ---
+++
@@ -0,0 +1,34 @@
+import React from 'react';
+
+class RestaurantCard extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+
+ }
+ }
+
+ render() {
+ return (
+ <div class="row">
+ <div class="col s12 m7">
+ <div class="card">
+ <div class="card-image">
+ <img src="images/sample-1.jpg"/>
+ <span class="card-title">Card Title</span>
+ </div>
+ <div class="card-content">
+ <p>I am a very simple card. I am good at containing small bits of information.
+ I am convenient because I require little markup to use effectively.</p>
+ </div>
+ <div class="card-action">
+ <a href="#">This is a link</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+ }
+};
+
+export default RestaurantCard; |
|
7213896d61b49ab51c890a6c6fbd7aa54ea11bc1 | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/description-viewer.jsx | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/description-viewer.jsx | import React from "react";
import "~/style/_description-viewer.scss";
import PropTypes from "prop-types";
import ReactMarkdown from "react-markdown";
export default class WonDescriptionViewer extends React.Component {
render() {
const icon = this.props.detail.icon && (
<svg className="dv__header__icon">
<use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
</svg>
);
const label = this.props.detail.icon && (
<span className="dv__header__label">{this.props.detail.label}</span>
);
return (
<won-description-viewer>
<div className="dv__header">
{icon}
{label}
</div>
<ReactMarkdown className="markdown" source={this.props.content} />
</won-description-viewer>
);
}
}
WonDescriptionViewer.propTypes = {
detail: PropTypes.object,
content: PropTypes.object,
};
| Implement description as react components | Implement description as react components
| JSX | apache-2.0 | researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds | ---
+++
@@ -0,0 +1,33 @@
+import React from "react";
+
+import "~/style/_description-viewer.scss";
+import PropTypes from "prop-types";
+import ReactMarkdown from "react-markdown";
+
+export default class WonDescriptionViewer extends React.Component {
+ render() {
+ const icon = this.props.detail.icon && (
+ <svg className="dv__header__icon">
+ <use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
+ </svg>
+ );
+
+ const label = this.props.detail.icon && (
+ <span className="dv__header__label">{this.props.detail.label}</span>
+ );
+
+ return (
+ <won-description-viewer>
+ <div className="dv__header">
+ {icon}
+ {label}
+ </div>
+ <ReactMarkdown className="markdown" source={this.props.content} />
+ </won-description-viewer>
+ );
+ }
+}
+WonDescriptionViewer.propTypes = {
+ detail: PropTypes.object,
+ content: PropTypes.object,
+}; |
|
69f105e00dab21a0b52042cb68c60b9b339bb2de | t/run/076.statement-head-of-func-expr.todo.jsx | t/run/076.statement-head-of-func-expr.todo.jsx | /*EXPECTED
foo
bar
*/
class Test {
static function run() : void {
(function() : void { log "foo"; }());
(function() : void { log "bar"; })();
}
}
| Add TODO tests to make sure the statement head of function exprs is allowed | Add TODO tests to make sure the statement head of function exprs is allowed
| JSX | mit | jsx/JSX,jsx/JSX,jsx/JSX,dj31416/JSX,mattn/JSX,dj31416/JSX,dj31416/JSX,mattn/JSX,jsx/JSX,jsx/JSX,dj31416/JSX,dj31416/JSX | ---
+++
@@ -0,0 +1,11 @@
+/*EXPECTED
+foo
+bar
+*/
+
+class Test {
+ static function run() : void {
+ (function() : void { log "foo"; }());
+ (function() : void { log "bar"; })();
+ }
+} |
|
3b365cadae8bcd0a9aa9d416967ffaccb4835b65 | imports/ui/components/publicRoute.jsx | imports/ui/components/publicRoute.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { Route, Redirect } from 'react-router-dom';
const PublicRoute = ({ loggingIn, authenticated, component, ...rest }) => (
<Route
{...rest}
render={(props) => {
if (loggingIn) return <div />;
return !authenticated ?
(React.createElement(component, { ...props, loggingIn, authenticated })) :
(<Redirect to="/" />);
}}
/>
);
PublicRoute.propTypes = {
loggingIn: PropTypes.bool.isRequired,
authenticated: PropTypes.bool.isRequired,
component: PropTypes.func.isRequired,
};
export default PublicRoute;
| Add new UI component PublicRoute for redirect user authenticated to home | Add new UI component PublicRoute for redirect user authenticated to home
| JSX | mit | ggallon/rock,ggallon/rock | ---
+++
@@ -0,0 +1,23 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { Route, Redirect } from 'react-router-dom';
+
+const PublicRoute = ({ loggingIn, authenticated, component, ...rest }) => (
+ <Route
+ {...rest}
+ render={(props) => {
+ if (loggingIn) return <div />;
+ return !authenticated ?
+ (React.createElement(component, { ...props, loggingIn, authenticated })) :
+ (<Redirect to="/" />);
+ }}
+ />
+);
+
+PublicRoute.propTypes = {
+ loggingIn: PropTypes.bool.isRequired,
+ authenticated: PropTypes.bool.isRequired,
+ component: PropTypes.func.isRequired,
+};
+
+export default PublicRoute; |
|
30ffdb9a7788c76be4af149d5257eb409cde07a3 | src/BoxCollapsedToggleButton.test.jsx | src/BoxCollapsedToggleButton.test.jsx | import React from 'react';
import { mount } from 'enzyme';
import Box from './Box';
import BoxCollapsedToggleButton from './BoxCollapsedToggleButton';
test('Box notified when clicked', () => {
let received = false;
class BoxFake extends React.Component {
static childContextTypes = Box.childContextTypes;
getChildContext() {
return {
$adminlte_box: {
onCollapseToggle: () => { received = true; },
},
};
}
render() {
return (
<div>
<BoxCollapsedToggleButton />
</div>
);
}
}
const wrapper = mount(<BoxFake />);
wrapper.find(BoxCollapsedToggleButton).simulate('click');
expect(received).toEqual(true);
});
| Test BoxCollapsedToggleButton click works properly | Test BoxCollapsedToggleButton click works properly
| JSX | mit | jonmpqts/reactjs-admin-lte,react-admin-lte/react-admin-lte,react-admin-lte/react-admin-lte | ---
+++
@@ -0,0 +1,33 @@
+import React from 'react';
+import { mount } from 'enzyme';
+import Box from './Box';
+import BoxCollapsedToggleButton from './BoxCollapsedToggleButton';
+
+test('Box notified when clicked', () => {
+ let received = false;
+
+ class BoxFake extends React.Component {
+ static childContextTypes = Box.childContextTypes;
+
+ getChildContext() {
+ return {
+ $adminlte_box: {
+ onCollapseToggle: () => { received = true; },
+ },
+ };
+ }
+
+ render() {
+ return (
+ <div>
+ <BoxCollapsedToggleButton />
+ </div>
+ );
+ }
+ }
+
+ const wrapper = mount(<BoxFake />);
+
+ wrapper.find(BoxCollapsedToggleButton).simulate('click');
+ expect(received).toEqual(true);
+}); |
|
64fe024b9e11f23b9c5db676ef1ea934fabd5004 | generate.jsx | generate.jsx | // (c) Copyright 2007 Adobe Systems, Inc. All rights reserved.
// Written by Ed Rose
// based on the ADM Mode Change by Joe Ault from 1998
/*
@@@BUILDINFO@@@ Generate.jsx 1.0.0.0
*/
/* Special properties for a JavaScript to enable it to behave like an automation plug-in, the variable name must be exactly
as the following example and the variables must be defined in the top 10000 characters of the file,
// BEGIN__HARVEST_EXCEPTION_ZSTRING
<javascriptresource>
<name>$$$/JavaScripts/Generate/Name=Web Assets</name>
<menu>generate</menu>
<enableinfo>true</enableinfo>
<eventid>CA37AEAF-6272-41F7-8258-F272711964E2</eventid>
<about>Floop</about>
</javascriptresource>
// END__HARVEST_EXCEPTION_ZSTRING
The item tagged "name" specifies the localized name or ZString that will be displayed in the menu
The item tagged "menu" specifies the menu in which the command will appear: generate, automate, scripts, or filter
The item tagged "enableinfo" specifies the conditions under which the command will be enabled. Too complex to describe here; see plugin sdk. Should usually just be "true", and your command should report a user-comprehensible error when it can't handle things. The problem with disabling the command when it's unsuitable is that there's no hint to the user as to why a command is disabled.
The item tagged "about" specifies the localized text or ZString to be displayed in the about box for the plugin. Optional.
The item tagged "eventid" needs to be a guaranteed unique string for your plugin. Usually generated with a UUID generator like uuidgen on MacOS
You also need to set the value of the pluginName variable below to match the name of your plugin as the Generator process knows it.
Do not change the values "name", or "generateAssets" in the code below.
*/
var pluginName = "assets";
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
$.level = 0;
//debugger; // launch debugger on next line
// on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
$.localize = true;
var gScriptResult;
// the main routine
try {
var generatorDesc = new ActionDescriptor();
generatorDesc.putString (app.stringIDToTypeID ("name"), pluginName);
var returnDesc = executeAction( app.stringIDToTypeID ("generateAssets"), generatorDesc, DialogModes.NO );
}
// In case anything goes wrong.
catch( e ) {
gScriptResult = 'cancel';
}
| Add .jsx file to bootstrap menu | Add .jsx file to bootstrap menu
| JSX | mit | PaladinStudiosBVs/generator-assets,PaladinStudiosBVs/generator-assets,jimulabs/generator-assets,adobe-photoshop/generator-assets,adobe-photoshop/generator-assets | ---
+++
@@ -0,0 +1,60 @@
+// (c) Copyright 2007 Adobe Systems, Inc. All rights reserved.
+// Written by Ed Rose
+// based on the ADM Mode Change by Joe Ault from 1998
+
+/*
+@@@BUILDINFO@@@ Generate.jsx 1.0.0.0
+*/
+
+/* Special properties for a JavaScript to enable it to behave like an automation plug-in, the variable name must be exactly
+ as the following example and the variables must be defined in the top 10000 characters of the file,
+
+// BEGIN__HARVEST_EXCEPTION_ZSTRING
+
+<javascriptresource>
+<name>$$$/JavaScripts/Generate/Name=Web Assets</name>
+<menu>generate</menu>
+<enableinfo>true</enableinfo>
+<eventid>CA37AEAF-6272-41F7-8258-F272711964E2</eventid>
+<about>Floop</about>
+</javascriptresource>
+
+// END__HARVEST_EXCEPTION_ZSTRING
+
+ The item tagged "name" specifies the localized name or ZString that will be displayed in the menu
+ The item tagged "menu" specifies the menu in which the command will appear: generate, automate, scripts, or filter
+ The item tagged "enableinfo" specifies the conditions under which the command will be enabled. Too complex to describe here; see plugin sdk. Should usually just be "true", and your command should report a user-comprehensible error when it can't handle things. The problem with disabling the command when it's unsuitable is that there's no hint to the user as to why a command is disabled.
+ The item tagged "about" specifies the localized text or ZString to be displayed in the about box for the plugin. Optional.
+ The item tagged "eventid" needs to be a guaranteed unique string for your plugin. Usually generated with a UUID generator like uuidgen on MacOS
+
+ You also need to set the value of the pluginName variable below to match the name of your plugin as the Generator process knows it.
+
+ Do not change the values "name", or "generateAssets" in the code below.
+
+*/
+
+var pluginName = "assets";
+
+// enable double clicking from the Macintosh Finder or the Windows Explorer
+#target photoshop
+
+// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
+$.level = 0;
+//debugger; // launch debugger on next line
+
+// on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
+$.localize = true;
+
+var gScriptResult;
+
+// the main routine
+try {
+ var generatorDesc = new ActionDescriptor();
+ generatorDesc.putString (app.stringIDToTypeID ("name"), pluginName);
+ var returnDesc = executeAction( app.stringIDToTypeID ("generateAssets"), generatorDesc, DialogModes.NO );
+}
+// In case anything goes wrong.
+catch( e ) {
+ gScriptResult = 'cancel';
+}
+ |
|
4e48abd505fc78a9109065d60b09d892c90a9775 | app/scripts/components/nav-secondary.jsx | app/scripts/components/nav-secondary.jsx | "use strict";
var React = require('react');
var Navigation = require('react-router').Navigation;
var session = require('../modules/session/models/session');
var sessionActions = require('../modules/session/actions');
var NavLinks = require('../shared/components/nav-links/nav-links.jsx');
var NavSecondary = React.createClass({
getDefaultProps: function() {
return {
links: [{
text: "Received",
href: "/payments/incoming"
},
{
text: "Sent",
href: "/payments/outgoing"
}],
wrapperClassName:"foo",
className: "nav-secondary"
};
},
render: function() {
return (
<div className={this.props.wrapperClassName}>
<NavLinks
links={this.props.links}
className={this.props.className}/>
</div>
);
}
});
module.exports = NavSecondary;
| Add nav secondary component to navigate between sent/received payments | [TASK] Add nav secondary component to navigate between sent/received payments
| JSX | isc | dabibbit/gatewayd-banking-app,dabibbit/gatewayd-quoting-app,hserang/gatewayd-admin-seeds,cryptospora/gatewayd-basic-app,AiNoKame/gatewayd-basic-admin-phase-1,dabibbit/gatewayd-quoting-app,n0rmz/gatewayd-client,dabibbit/gatewayd-banking-app,n0rmz/gatewayd-client,AiNoKame/gatewayd-basic-admin-dec | ---
+++
@@ -0,0 +1,39 @@
+"use strict";
+
+var React = require('react');
+var Navigation = require('react-router').Navigation;
+
+var session = require('../modules/session/models/session');
+var sessionActions = require('../modules/session/actions');
+
+var NavLinks = require('../shared/components/nav-links/nav-links.jsx');
+
+var NavSecondary = React.createClass({
+
+ getDefaultProps: function() {
+ return {
+ links: [{
+ text: "Received",
+ href: "/payments/incoming"
+ },
+ {
+ text: "Sent",
+ href: "/payments/outgoing"
+ }],
+ wrapperClassName:"foo",
+ className: "nav-secondary"
+ };
+ },
+
+ render: function() {
+ return (
+ <div className={this.props.wrapperClassName}>
+ <NavLinks
+ links={this.props.links}
+ className={this.props.className}/>
+ </div>
+ );
+ }
+});
+
+module.exports = NavSecondary; |
|
3b6fe552b79d376529239641171e5ae23a9bd314 | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/paypal-payment-viewer.jsx | webofneeds/won-owner-webapp/src/main/webapp/app/components/details/react-viewer/paypal-payment-viewer.jsx | import React from "react";
import { get } from "../../../utils.js";
import "~/style/_paypalpayment-viewer.scss";
import PropTypes from "prop-types";
export default class WonPaypalPaymentViewer extends React.Component {
render() {
const icon = this.props.detail.icon && (
<svg className="paypalpaymentv__header__icon">
<use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
</svg>
);
const label = this.props.detail.icon && (
<span className="paypalpaymentv__header__label">
{this.props.detail.label}
</span>
);
return (
<won-paypal-payment-viewer>
<div className="paypalpaymentv__header">
{icon}
{label}
</div>
<div className="paypalpaymentv__content">
<div className="paypalpaymentv__content__label">
{self.props.detail.amountLabel}
</div>
<div className="paypalpaymentv__content__price">
{this.getPriceWithCurrency()}
</div>
<div className="paypalpaymentv__content__label">
{this.props.detail.receiverLabel}
</div>
<div className="paypalpaymentv__content__receiver">
{get(this.props.content, "receiver")}
</div>
</div>
</won-paypal-payment-viewer>
);
}
getPriceWithCurrency() {
if (this.props.content && this.props.detail) {
let currencyLabel = undefined;
this.props.detail.currency &&
this.props.detail.currency.forEach(curr => {
if (curr.value === get(this.props.content, "currency")) {
currencyLabel = curr.label;
}
});
currencyLabel = currencyLabel || this.content.get("currency");
return get(this.props.content, "amount") + currencyLabel;
}
return undefined;
}
}
WonPaypalPaymentViewer.propTypes = {
detail: PropTypes.object,
content: PropTypes.object,
};
| Implement paypal payment as react components | Implement paypal payment as react components
| JSX | apache-2.0 | researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds | ---
+++
@@ -0,0 +1,65 @@
+import React from "react";
+import { get } from "../../../utils.js";
+
+import "~/style/_paypalpayment-viewer.scss";
+import PropTypes from "prop-types";
+
+export default class WonPaypalPaymentViewer extends React.Component {
+ render() {
+ const icon = this.props.detail.icon && (
+ <svg className="paypalpaymentv__header__icon">
+ <use xlinkHref={this.props.detail.icon} href={this.props.detail.icon} />
+ </svg>
+ );
+
+ const label = this.props.detail.icon && (
+ <span className="paypalpaymentv__header__label">
+ {this.props.detail.label}
+ </span>
+ );
+
+ return (
+ <won-paypal-payment-viewer>
+ <div className="paypalpaymentv__header">
+ {icon}
+ {label}
+ </div>
+ <div className="paypalpaymentv__content">
+ <div className="paypalpaymentv__content__label">
+ {self.props.detail.amountLabel}
+ </div>
+ <div className="paypalpaymentv__content__price">
+ {this.getPriceWithCurrency()}
+ </div>
+ <div className="paypalpaymentv__content__label">
+ {this.props.detail.receiverLabel}
+ </div>
+ <div className="paypalpaymentv__content__receiver">
+ {get(this.props.content, "receiver")}
+ </div>
+ </div>
+ </won-paypal-payment-viewer>
+ );
+ }
+
+ getPriceWithCurrency() {
+ if (this.props.content && this.props.detail) {
+ let currencyLabel = undefined;
+
+ this.props.detail.currency &&
+ this.props.detail.currency.forEach(curr => {
+ if (curr.value === get(this.props.content, "currency")) {
+ currencyLabel = curr.label;
+ }
+ });
+ currencyLabel = currencyLabel || this.content.get("currency");
+
+ return get(this.props.content, "amount") + currencyLabel;
+ }
+ return undefined;
+ }
+}
+WonPaypalPaymentViewer.propTypes = {
+ detail: PropTypes.object,
+ content: PropTypes.object,
+}; |
|
9527ef74c5aecf149cfd98c841d00f6a2af16334 | imports/ui/ContactRequests.jsx | imports/ui/ContactRequests.jsx | import React from 'react'
import {Container, Jumbotron} from 'reactstrap'
import Spinner from 'react-spinkit'
const ContactRequests = ({loading, requests}) => {
if (loading) {
return <Spinner name='double-bounce' />
}
return (
<Container fluid>
<Jumbotron>
<h1 className='display-3'> Your contact requests</h1>
<p className='lead'>
Here you can cryptographically confirm your contact requests
</p>
</Jumbotron>
<ul>
{requests.map(({_id, senderDid}) => <li key={_id}> {senderDid} </li>)}
</ul>
</Container>
)
}
export default ContactRequests
| Add a component showing contact requests | Add a component showing contact requests
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -0,0 +1,24 @@
+import React from 'react'
+import {Container, Jumbotron} from 'reactstrap'
+import Spinner from 'react-spinkit'
+
+const ContactRequests = ({loading, requests}) => {
+ if (loading) {
+ return <Spinner name='double-bounce' />
+ }
+ return (
+ <Container fluid>
+ <Jumbotron>
+ <h1 className='display-3'> Your contact requests</h1>
+ <p className='lead'>
+ Here you can cryptographically confirm your contact requests
+ </p>
+ </Jumbotron>
+ <ul>
+ {requests.map(({_id, senderDid}) => <li key={_id}> {senderDid} </li>)}
+ </ul>
+ </Container>
+ )
+}
+
+export default ContactRequests |
|
f9e1de201ff43a75beadea2b6323a6c1037bac42 | client/source/components/EditRecipe/invalidStepsModal.jsx | client/source/components/EditRecipe/invalidStepsModal.jsx | import React from 'react';
//Bootstrap
import { Modal, Button, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap';
class InvalidStepsModal extends React.Component {
constructor(props) {
super(props);
}
close(event) {
// this.setState({showModal: false});
console.log('CLOSING MODAL!');
this.props.closeModal();
}
render () {
return (
<div className="static-modal">
<Modal.Dialog>
<Modal.Header>
<Modal.Title> Merge Conflict!</Modal.Title>
</Modal.Header>
<Modal.Body>
<h4> Invalid Step Description </h4>
<p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
<p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
<p> Steps: {this.props.invalidSteps.join(', ')} </p>
</Modal.Body>
<Modal.Footer>
<Button onClick={this.close.bind(this)}>Close</Button>
</Modal.Footer>
</Modal.Dialog>
</div>
)
}
}
export default InvalidStepsModal;
// <div>
// <Modal show={true} onHide={this.close.bind(this)}>
// <Modal.Dialog>
// <Modal.Header closeButton>
// <Modal.Title> Merge Conflict!</Modal.Title>
// </Modal.Header>
// <Modal.Body>
// <h4> Invalid Step Description </h4>
// <p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
// <p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
// <p> Steps: {this.props.invalidSteps.join(', ')} </p>
// </Modal.Body>
// <Modal.Footer>
// <Button bsStyle="primary" onClick={this.close.bind(this)}>Close</Button>
// </Modal.Footer>
// </Modal.Dialog>
// </Modal>
// </div> | Implement modal to be displayed when user is attempting to submit recipe with invalid steps (steps contain deleted ingredients) | Implement modal to be displayed when user is attempting to submit recipe with invalid steps (steps contain deleted ingredients)
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -0,0 +1,66 @@
+import React from 'react';
+
+//Bootstrap
+import { Modal, Button, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap';
+
+class InvalidStepsModal extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ close(event) {
+ // this.setState({showModal: false});
+ console.log('CLOSING MODAL!');
+ this.props.closeModal();
+ }
+
+ render () {
+ return (
+ <div className="static-modal">
+ <Modal.Dialog>
+ <Modal.Header>
+ <Modal.Title> Merge Conflict!</Modal.Title>
+ </Modal.Header>
+
+ <Modal.Body>
+ <h4> Invalid Step Description </h4>
+ <p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
+ <p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
+ <p> Steps: {this.props.invalidSteps.join(', ')} </p>
+ </Modal.Body>
+
+ <Modal.Footer>
+ <Button onClick={this.close.bind(this)}>Close</Button>
+ </Modal.Footer>
+
+ </Modal.Dialog>
+ </div>
+ )
+ }
+}
+
+export default InvalidStepsModal;
+
+
+
+ // <div>
+ // <Modal show={true} onHide={this.close.bind(this)}>
+ // <Modal.Dialog>
+ // <Modal.Header closeButton>
+ // <Modal.Title> Merge Conflict!</Modal.Title>
+ // </Modal.Header>
+
+ // <Modal.Body>
+ // <h4> Invalid Step Description </h4>
+ // <p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
+ // <p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
+ // <p> Steps: {this.props.invalidSteps.join(', ')} </p>
+ // </Modal.Body>
+
+ // <Modal.Footer>
+ // <Button bsStyle="primary" onClick={this.close.bind(this)}>Close</Button>
+ // </Modal.Footer>
+
+ // </Modal.Dialog>
+ // </Modal>
+ // </div> |
|
dcafc76631b14bcf31ac491052bc6074cb680497 | src/main/webapp/resources/js/pages/projects/share/ShareButton.jsx | src/main/webapp/resources/js/pages/projects/share/ShareButton.jsx | import { Dropdown, Menu } from "antd";
import React from "react";
import { useSelector } from "react-redux";
export function ShareButton() {
const { samples, owner, projectId } = useSelector(
(state) => state.shareReducer
);
const shareSamples = (type) => {
console.log({ type, samples, owner, projectId });
};
const disabled = samples.length === 0 || typeof projectId === "undefined";
return (
<div style={{ display: "flex", flexDirection: "row-reverse" }}>
<Dropdown.Button
disabled={disabled}
onClick={() => shareSamples("copy")}
overlay={
<Menu onClick={(e) => shareSamples(e.key)}>
<Menu.Item key="move">Move Samples</Menu.Item>
</Menu>
}
>
Copy Samples
</Dropdown.Button>
</div>
);
}
| Disable copy button if not ready to copy | Disable copy button if not ready to copy
| JSX | apache-2.0 | phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida | ---
+++
@@ -0,0 +1,31 @@
+import { Dropdown, Menu } from "antd";
+import React from "react";
+import { useSelector } from "react-redux";
+
+export function ShareButton() {
+ const { samples, owner, projectId } = useSelector(
+ (state) => state.shareReducer
+ );
+
+ const shareSamples = (type) => {
+ console.log({ type, samples, owner, projectId });
+ };
+
+ const disabled = samples.length === 0 || typeof projectId === "undefined";
+
+ return (
+ <div style={{ display: "flex", flexDirection: "row-reverse" }}>
+ <Dropdown.Button
+ disabled={disabled}
+ onClick={() => shareSamples("copy")}
+ overlay={
+ <Menu onClick={(e) => shareSamples(e.key)}>
+ <Menu.Item key="move">Move Samples</Menu.Item>
+ </Menu>
+ }
+ >
+ Copy Samples
+ </Dropdown.Button>
+ </div>
+ );
+} |
|
877e016d52e3b81860f77266efd0cd4dcca5aaa5 | app/src/script/component/EmbeddedPage.jsx | app/src/script/component/EmbeddedPage.jsx | var React = require('react');
var PropTypes = React.PropTypes;
var Footer = require('./Footer');
var EmbeddedPage = React.createClass({
render: function() {
return (
<div>
{this.props.children || <div/>}
<Footer/>
</div>
);
}
});
module.exports = EmbeddedPage;
| Add a new component to wrap embedded pages. | Add a new component to wrap embedded pages.
| JSX | mit | promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico | ---
+++
@@ -0,0 +1,19 @@
+var React = require('react');
+var PropTypes = React.PropTypes;
+
+var Footer = require('./Footer');
+
+var EmbeddedPage = React.createClass({
+
+ render: function() {
+ return (
+ <div>
+ {this.props.children || <div/>}
+ <Footer/>
+ </div>
+ );
+ }
+
+});
+
+module.exports = EmbeddedPage; |
|
5fbe67b9acbadbdcd40c530a9142f4f008735736 | components/dialog/index.jsx | components/dialog/index.jsx | import React from 'react';
import Button from '../button';
import Overlay from '../overlay';
import style from './style';
const Dialog = (props) => {
const actions = props.actions.map((action, idx) => {
let className = style.button;
if (action.className) className += ` ${action.className}`;
return <Button key={idx} {...action} className={className} />;
});
let className = `${style.root} ${style[props.type]}`;
if (props.active) className += ` ${style.active}`;
if (props.className) className += ` ${props.className}`;
return (
<Overlay active={props.active} onClick={props.onOverlayClick}>
<div className={className}>
<section role='body' className={style.body}>
{ props.title ? <h6 className={style.title}>{props.title}</h6> : null }
{ props.children }
</section>
<nav role='navigation' className={style.navigation}>
{ actions }
</nav>
</div>
</Overlay>
);
};
Dialog.propTypes = {
actions: React.PropTypes.array,
active: React.PropTypes.bool,
className: React.PropTypes.string,
onOverlayClick: React.PropTypes.func,
title: React.PropTypes.string,
type: React.PropTypes.string
};
Dialog.defaultProps = {
actions: [],
active: false,
type: 'normal'
};
export default Dialog;
| import React from 'react';
import Button from '../button';
import Overlay from '../overlay';
import style from './style';
const Dialog = (props) => {
const actions = props.actions.map((action, idx) => {
let className = style.button;
if (action.className) className += ` ${action.className}`;
return <Button key={idx} {...action} className={className} />;
});
let className = `${style.root} ${style[props.type]}`;
if (props.active) className += ` ${style.active}`;
if (props.className) className += ` ${props.className}`;
return (
<Overlay active={props.active} onClick={props.onOverlayClick}>
<div data-react-toolbox='dialog' className={className}>
<section role='body' className={style.body}>
{ props.title ? <h6 className={style.title}>{props.title}</h6> : null }
{ props.children }
</section>
<nav role='navigation' className={style.navigation}>
{ actions }
</nav>
</div>
</Overlay>
);
};
Dialog.propTypes = {
actions: React.PropTypes.array,
active: React.PropTypes.bool,
className: React.PropTypes.string,
onOverlayClick: React.PropTypes.func,
title: React.PropTypes.string,
type: React.PropTypes.string
};
Dialog.defaultProps = {
actions: [],
active: false,
type: 'normal'
};
export default Dialog;
| Add react-toolbox attribute to dialog | Add react-toolbox attribute to dialog
| JSX | mit | KerenChandran/react-toolbox,KerenChandran/react-toolbox,rubenmoya/react-toolbox,react-toolbox/react-toolbox,showings/react-toolbox,soyjavi/react-toolbox,rubenmoya/react-toolbox,jasonleibowitz/react-toolbox,react-toolbox/react-toolbox,rubenmoya/react-toolbox,soyjavi/react-toolbox,react-toolbox/react-toolbox,showings/react-toolbox,jasonleibowitz/react-toolbox,Magneticmagnum/react-atlas,DigitalRiver/react-atlas | ---
+++
@@ -16,7 +16,7 @@
return (
<Overlay active={props.active} onClick={props.onOverlayClick}>
- <div className={className}>
+ <div data-react-toolbox='dialog' className={className}>
<section role='body' className={style.body}>
{ props.title ? <h6 className={style.title}>{props.title}</h6> : null }
{ props.children } |
25bf5fbc9aadb9c943f5c30abf872ed0deb802ed | src/ui/components/nav_bar.jsx | src/ui/components/nav_bar.jsx | import React from 'react';
import { Link } from 'react-router-dom';
import { Container, Row, Navbar, Nav, NavItem } from 'reactstrap';
const NavBar = () => (
<Navbar color="faded" light>
<Container>
<Row className="align-items-center">
<Link to="/" className="navbar-brand">Apollo Starter Kit</Link>
<Nav>
<NavItem>
<Link to="/posts" className="nav-link">Posts</Link>
</NavItem>
</Nav>
<Nav className="ml-auto" navbar>
<NavItem>
<a href="/graphiql">GraphiQL</a>
</NavItem>
</Nav>
</Row>
</Container>
</Navbar>
);
export default NavBar;
| import React from 'react';
import { Link } from 'react-router-dom';
import { Container, Row, Navbar, Nav, NavItem } from 'reactstrap';
import { app as settings } from '../../../package.json';
const NavBar = () => (
<Navbar color="faded" light>
<Container>
<Row className="align-items-center">
<Link to="/" className="navbar-brand">Apollo Starter Kit</Link>
<Nav>
<NavItem>
<Link to="/posts" className="nav-link">Posts</Link>
</NavItem>
</Nav>
{(!settings.persistGraphQL || __DEV__) && <Nav className="ml-auto" navbar>
<NavItem>
<a href="/graphiql">GraphiQL</a>
</NavItem>
</Nav>}
</Row>
</Container>
</Navbar>
);
export default NavBar;
| Disable GraphiQL link in prod mode when persistGraphQL is on | Disable GraphiQL link in prod mode when persistGraphQL is on
Ref: #117
| JSX | mit | sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,josephdburdick/apollo-fullstack-starter-kit,sysgears/apollo-fullstack-starter-kit,sysgears/apollo-universal-starter-kit | ---
+++
@@ -1,6 +1,8 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Container, Row, Navbar, Nav, NavItem } from 'reactstrap';
+
+import { app as settings } from '../../../package.json';
const NavBar = () => (
<Navbar color="faded" light>
@@ -12,11 +14,11 @@
<Link to="/posts" className="nav-link">Posts</Link>
</NavItem>
</Nav>
- <Nav className="ml-auto" navbar>
+ {(!settings.persistGraphQL || __DEV__) && <Nav className="ml-auto" navbar>
<NavItem>
<a href="/graphiql">GraphiQL</a>
</NavItem>
- </Nav>
+ </Nav>}
</Row>
</Container>
</Navbar> |
3e397d05d3aed9525017350e9491406b2985c78e | app/src/script/component/AuthenticationError.jsx | app/src/script/component/AuthenticationError.jsx | var React = require('react');
var ReactBootstrap = require('react-bootstrap');
var PropTypes = React.PropTypes;
var Hint = require('./Hint');
var Grid = ReactBootstrap.Grid,
Row = ReactBootstrap.Row,
Col = ReactBootstrap.Col;
var AuthenticationError = React.createClass({
render: function() {
return (
<Grid>
<Hint style="danger">
<h3>Ohoo... :(</h3>
<p>Impossible de vous authentifier.</p>
</Hint>
</Grid>
);
}
});
module.exports = AuthenticationError;
| Add a new reusable component to display authentication errors. | Add a new reusable component to display authentication errors.
| JSX | mit | promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico | ---
+++
@@ -0,0 +1,27 @@
+var React = require('react');
+var ReactBootstrap = require('react-bootstrap');
+
+var PropTypes = React.PropTypes;
+
+var Hint = require('./Hint');
+
+var Grid = ReactBootstrap.Grid,
+ Row = ReactBootstrap.Row,
+ Col = ReactBootstrap.Col;
+
+var AuthenticationError = React.createClass({
+
+ render: function() {
+ return (
+ <Grid>
+ <Hint style="danger">
+ <h3>Ohoo... :(</h3>
+ <p>Impossible de vous authentifier.</p>
+ </Hint>
+ </Grid>
+ );
+ }
+
+});
+
+module.exports = AuthenticationError; |
|
9c46a0f98819ed1d6687d91520383aec1cb64527 | app/ui/browser/views/navbar/vertical-separator.jsx | app/ui/browser/views/navbar/vertical-separator.jsx | /*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
import React from 'react';
import Style from '../../browser-style';
const VERTICAL_SEPARATOR_STYLE = Style.registerStyle({
alignSelf: 'stretch',
width: '1px',
margin: '4px 10px',
background: '#d6d6d6',
});
const VerticalSeparator = () =>
<div className={VERTICAL_SEPARATOR_STYLE} />;
export default VerticalSeparator;
| Create a vertical separator component | Create a vertical separator component
Signed-off-by: Victor Porof <7d8eebacd0931807085fa6b9af29638ed74e0886@mozilla.com>
| JSX | apache-2.0 | bgrins/tofino,bgrins/tofino,mozilla/tofino,mozilla/tofino,jsantell/tofino,bgrins/tofino,bgrins/tofino,mozilla/tofino,victorporof/tofino,victorporof/tofino,jsantell/tofino,jsantell/tofino,mozilla/tofino,jsantell/tofino | ---
+++
@@ -0,0 +1,27 @@
+/*
+Copyright 2016 Mozilla
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+*/
+
+import React from 'react';
+
+import Style from '../../browser-style';
+
+const VERTICAL_SEPARATOR_STYLE = Style.registerStyle({
+ alignSelf: 'stretch',
+ width: '1px',
+ margin: '4px 10px',
+ background: '#d6d6d6',
+});
+
+const VerticalSeparator = () =>
+ <div className={VERTICAL_SEPARATOR_STYLE} />;
+
+export default VerticalSeparator; |
|
71ea740c5c53395abaebcfc0e4ed9cbbf01c4725 | client/source/components/User/FollowingListEntry.jsx | client/source/components/User/FollowingListEntry.jsx | import React, {Component} from 'react';
import { Image, Grid, Row, Col, Form, FormGroup, Badge, ProgressBar, FormControl, Button, Container, ControlLabel, DropdownButton, MenuItem, Nav, NavItem } from 'react-bootstrap';
export default ({user, handleUserClick}) => {
return (
<Row height={50}>
<Col xs={6} md={6}>
<h2 id={user.username} onClick={handleUserClick.bind(this)}> {user.username} </h2>
<h4 id={user.recipes}> this user has {user.recipes} recipes </h4>
</Col>
<Col xs={4} md={4} style={{marginTop: 20}}>
<h4> skilletHub skill level: </h4>
<ProgressBar bsStyle={'success'} now={user.skillLevel} label={`${user.skillLevel}%`}/>
</Col>
<Col xs={2} md={2} style={{marginTop: 20}}>
<h4> forks </h4>
<Badge>{user.totalForks}</Badge>
</Col>
</Row>
)
}
| Add component to render the list of users a specific user is following. | Add component to render the list of users a specific user is following.
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -0,0 +1,22 @@
+import React, {Component} from 'react';
+import { Image, Grid, Row, Col, Form, FormGroup, Badge, ProgressBar, FormControl, Button, Container, ControlLabel, DropdownButton, MenuItem, Nav, NavItem } from 'react-bootstrap';
+
+export default ({user, handleUserClick}) => {
+
+ return (
+ <Row height={50}>
+ <Col xs={6} md={6}>
+ <h2 id={user.username} onClick={handleUserClick.bind(this)}> {user.username} </h2>
+ <h4 id={user.recipes}> this user has {user.recipes} recipes </h4>
+ </Col>
+ <Col xs={4} md={4} style={{marginTop: 20}}>
+ <h4> skilletHub skill level: </h4>
+ <ProgressBar bsStyle={'success'} now={user.skillLevel} label={`${user.skillLevel}%`}/>
+ </Col>
+ <Col xs={2} md={2} style={{marginTop: 20}}>
+ <h4> forks </h4>
+ <Badge>{user.totalForks}</Badge>
+ </Col>
+ </Row>
+ )
+} |
|
d4645a37293a7b89db0d59303654f6ba6f3ecde9 | src/components/FootballField/Grid/PlayerDragLayer/index.jsx | src/components/FootballField/Grid/PlayerDragLayer/index.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { DragLayer } from 'react-dnd';
const layerStyles = {
position: 'fixed',
pointerEvents: 'none',
zIndex: 100,
left: 0,
top: 0,
width: '100%',
height: '100%',
};
const getItemStyles = (props) => {
const { currentOffset } = props;
if (!currentOffset) {
return {
display: 'none',
};
}
const { x, y } = currentOffset;
const transform = `translate(${x + 25}px, ${y + 25}px)`;
return {
transform,
WebkitTransform: transform,
};
};
class PlayerDragLayer extends Component {
renderItem(type, item) {
return (
<div>player</div>
);
}
render() {
const { item, itemType, isDragging } = this.props;
if (!isDragging) {
return null;
}
return (
<div style={layerStyles}>
<div style={getItemStyles(this.props)}>
{this.renderItem(itemType, item)}
</div>
</div>
);
}
}
PlayerDragLayer.propTypes = {
item: PropTypes.object,
itemType: PropTypes.string,
currentOffset: PropTypes.shape({
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
}),
isDragging: PropTypes.bool.isRequired,
};
const collect = monitor => ({
item: monitor.getItem(),
itemType: monitor.getItemType(),
currentOffset: monitor.getSourceClientOffset(),
isDragging: monitor.isDragging(),
});
export default DragLayer(collect)(PlayerDragLayer);
| Add a custom DragLayer for react-dnd | Add a custom DragLayer for react-dnd
| JSX | mit | m-mik/tactic-editor,m-mik/tactic-editor | ---
+++
@@ -0,0 +1,71 @@
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import { DragLayer } from 'react-dnd';
+
+const layerStyles = {
+ position: 'fixed',
+ pointerEvents: 'none',
+ zIndex: 100,
+ left: 0,
+ top: 0,
+ width: '100%',
+ height: '100%',
+};
+
+const getItemStyles = (props) => {
+ const { currentOffset } = props;
+ if (!currentOffset) {
+ return {
+ display: 'none',
+ };
+ }
+
+ const { x, y } = currentOffset;
+ const transform = `translate(${x + 25}px, ${y + 25}px)`;
+ return {
+ transform,
+ WebkitTransform: transform,
+ };
+};
+
+class PlayerDragLayer extends Component {
+ renderItem(type, item) {
+ return (
+ <div>player</div>
+ );
+ }
+
+ render() {
+ const { item, itemType, isDragging } = this.props;
+ if (!isDragging) {
+ return null;
+ }
+
+ return (
+ <div style={layerStyles}>
+ <div style={getItemStyles(this.props)}>
+ {this.renderItem(itemType, item)}
+ </div>
+ </div>
+ );
+ }
+}
+
+PlayerDragLayer.propTypes = {
+ item: PropTypes.object,
+ itemType: PropTypes.string,
+ currentOffset: PropTypes.shape({
+ x: PropTypes.number.isRequired,
+ y: PropTypes.number.isRequired,
+ }),
+ isDragging: PropTypes.bool.isRequired,
+};
+
+const collect = monitor => ({
+ item: monitor.getItem(),
+ itemType: monitor.getItemType(),
+ currentOffset: monitor.getSourceClientOffset(),
+ isDragging: monitor.isDragging(),
+});
+
+export default DragLayer(collect)(PlayerDragLayer); |
|
f4a2cade05281f432313a306aaa2be12c3f05ae1 | src/app/components/Input.jsx | src/app/components/Input.jsx | import React, {Component} from 'react';
import PropTypes from 'prop-types';
const propTypes = {
id: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
type: PropTypes.string,
onChange: PropTypes.func
};
const defaultProps = {
type: "text"
};
export default class Input extends Component {
constructor(props) {
super(props);
this.state = {
type: this.props.type,
displayShowHide: this.props.type === "password"
};
this.showHide = this.showHide.bind(this);
}
showHide(e) {
e.preventDefault();
e.stopPropagation();
this.setState({
type: this.state.type === 'input' ? 'password' : 'input'
})
}
render() {
return (
<div className={"form__input" + (this.props.error ? " form__input--error" : "")}>
<label className="form__label" htmlFor={this.props.id}>{this.props.label}: </label>
{
this.props.error ?
<div className="error-msg">{this.props.error}</div>
:
""
}
<input id={this.props.id} type={this.state.type} className="input input__text" name={this.props.id} onChange={this.props.onChange}/>
{
this.state.displayShowHide ?
<button className="btn btn--password" onClick={this.showHide}>{this.state.type === 'input' ? 'Hide' : 'Show'}</button>
:
""
}
</div>
)
}
}
Input.propTypes = propTypes;
Input.defaultProps = defaultProps; | Add input class for input fields and show/hide for type=password | Add input class for input fields and show/hide for type=password
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -0,0 +1,58 @@
+import React, {Component} from 'react';
+import PropTypes from 'prop-types';
+
+const propTypes = {
+ id: PropTypes.string.isRequired,
+ label: PropTypes.string.isRequired,
+ type: PropTypes.string,
+ onChange: PropTypes.func
+};
+
+const defaultProps = {
+ type: "text"
+};
+
+export default class Input extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ type: this.props.type,
+ displayShowHide: this.props.type === "password"
+ };
+
+ this.showHide = this.showHide.bind(this);
+ }
+
+ showHide(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ this.setState({
+ type: this.state.type === 'input' ? 'password' : 'input'
+ })
+ }
+
+ render() {
+ return (
+ <div className={"form__input" + (this.props.error ? " form__input--error" : "")}>
+ <label className="form__label" htmlFor={this.props.id}>{this.props.label}: </label>
+ {
+ this.props.error ?
+ <div className="error-msg">{this.props.error}</div>
+ :
+ ""
+ }
+ <input id={this.props.id} type={this.state.type} className="input input__text" name={this.props.id} onChange={this.props.onChange}/>
+ {
+ this.state.displayShowHide ?
+ <button className="btn btn--password" onClick={this.showHide}>{this.state.type === 'input' ? 'Hide' : 'Show'}</button>
+ :
+ ""
+ }
+ </div>
+ )
+ }
+}
+
+Input.propTypes = propTypes;
+Input.defaultProps = defaultProps; |
|
bf2921cf953f8d29738b319c7780266af7ca7ae0 | src/common/components/addons/RoutingWrapper/index.jsx | src/common/components/addons/RoutingWrapper/index.jsx | import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {Switch, Redirect} from 'react-router-dom'
import {LazyLoad} from 'components/addons'
/**
* Returns application routing with protected by AuthCheck func routes
* @desc This function returns JSX, so we can think about it as "stateless component"
* @param {Function} authCheck checks is user logged in
*/
export default class RoutingWrapper extends Component {
static propTypes = {
routes: PropTypes.array,
authCheck: PropTypes.func
}
render () {
const {routes} = this.props
const onlyRoutes = routes.filter(
a => a.tag || a.component || a.lazy || !a.external
)
// render components that are inside Switch (main view)
const routesRendered = onlyRoutes.map((a, i) => {
// get tag for Route.
// is it "RouteAuth" `protected route` or "Route"?
const Tag = a.tag
const {path, exact, strict, component, lazy} = a
// can visitor access this route?
// this function determinates is user allowed to visit route
const canAccess = this.props.authCheck
// select only props that we need
const b = {path, exact, strict, canAccess}
if (lazy) {
const routeToRenderLazy = (
<Tag {...b} key={i}>
<LazyLoad component={component} />
</Tag>
)
return routeToRenderLazy
}
// it can be Route or RouteAuth
return <Tag key={i} {...b} component={component} />
})
return (
<Switch>
{routesRendered}
<Redirect to="/" />
</Switch>
)
}
}
| Implement RoutingWrapper component that renders routes | feat(src/common/components/addons/RoutingWrapper): Implement RoutingWrapper component that renders routes
| JSX | apache-2.0 | billymcintosh/react-semantic.ui-starter,Metnew/react-semantic.ui-starter,versi786/parts-checkout,billymcintosh/react-semantic.ui-starter,versi786/parts-checkout | ---
+++
@@ -0,0 +1,54 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import {Switch, Redirect} from 'react-router-dom'
+import {LazyLoad} from 'components/addons'
+
+/**
+ * Returns application routing with protected by AuthCheck func routes
+ * @desc This function returns JSX, so we can think about it as "stateless component"
+ * @param {Function} authCheck checks is user logged in
+ */
+export default class RoutingWrapper extends Component {
+ static propTypes = {
+ routes: PropTypes.array,
+ authCheck: PropTypes.func
+ }
+
+ render () {
+ const {routes} = this.props
+ const onlyRoutes = routes.filter(
+ a => a.tag || a.component || a.lazy || !a.external
+ )
+ // render components that are inside Switch (main view)
+ const routesRendered = onlyRoutes.map((a, i) => {
+ // get tag for Route.
+ // is it "RouteAuth" `protected route` or "Route"?
+ const Tag = a.tag
+ const {path, exact, strict, component, lazy} = a
+ // can visitor access this route?
+ // this function determinates is user allowed to visit route
+ const canAccess = this.props.authCheck
+ // select only props that we need
+ const b = {path, exact, strict, canAccess}
+
+ if (lazy) {
+ const routeToRenderLazy = (
+ <Tag {...b} key={i}>
+ <LazyLoad component={component} />
+ </Tag>
+ )
+ return routeToRenderLazy
+ }
+
+ // it can be Route or RouteAuth
+ return <Tag key={i} {...b} component={component} />
+ })
+
+ return (
+ <Switch>
+ {routesRendered}
+ <Redirect to="/" />
+ </Switch>
+ )
+ }
+} |
|
6dd3366c8678f92437c77e6010f769afabc01860 | src/BoxRemoveButton.test.jsx | src/BoxRemoveButton.test.jsx | import React from 'react';
import { mount } from 'enzyme';
import Box from './Box';
import BoxRemoveButton from './BoxRemoveButton';
test('Box notified when clicked', () => {
let received = false;
class BoxFake extends React.Component {
static childContextTypes = Box.childContextTypes;
getChildContext() {
return {
$adminlte_box: {
onRemove: () => { received = true; },
},
};
}
render() {
return (
<div>
<BoxRemoveButton />
</div>
);
}
}
const wrapper = mount(<BoxFake />);
wrapper.find(BoxRemoveButton).simulate('click');
expect(received).toEqual(true);
});
| Test BoxRemoveButton click works properly | Test BoxRemoveButton click works properly
| JSX | mit | jonmpqts/reactjs-admin-lte,react-admin-lte/react-admin-lte,react-admin-lte/react-admin-lte | ---
+++
@@ -0,0 +1,33 @@
+import React from 'react';
+import { mount } from 'enzyme';
+import Box from './Box';
+import BoxRemoveButton from './BoxRemoveButton';
+
+test('Box notified when clicked', () => {
+ let received = false;
+
+ class BoxFake extends React.Component {
+ static childContextTypes = Box.childContextTypes;
+
+ getChildContext() {
+ return {
+ $adminlte_box: {
+ onRemove: () => { received = true; },
+ },
+ };
+ }
+
+ render() {
+ return (
+ <div>
+ <BoxRemoveButton />
+ </div>
+ );
+ }
+ }
+
+ const wrapper = mount(<BoxFake />);
+
+ wrapper.find(BoxRemoveButton).simulate('click');
+ expect(received).toEqual(true);
+}); |
|
7c9870504621a5778a3c408a4054f499d04ecc8b | src/Image.jsx | src/Image.jsx | import React from 'react';
require('./../www/main.css');
class Image extends React.Component {
constructor() {
super();
this.state = {
};
}
render() {
return (
<div>
<p>Image is here</p>
<img src="https://upload.wikimedia.org/wikipedia/en/d/df/Franklin_turtle.jpg" />
</div>
);
}
}
export default Image;
| Create and add images to the page | Create and add images to the page
| JSX | mit | OrderlyPhoenix/OrderlyPhoenix,OrderlyPhoenix/OrderlyPhoenix | ---
+++
@@ -0,0 +1,21 @@
+import React from 'react';
+require('./../www/main.css');
+
+class Image extends React.Component {
+ constructor() {
+ super();
+ this.state = {
+ };
+ }
+
+ render() {
+ return (
+ <div>
+ <p>Image is here</p>
+ <img src="https://upload.wikimedia.org/wikipedia/en/d/df/Franklin_turtle.jpg" />
+ </div>
+ );
+ }
+}
+
+export default Image; |
|
c23945cb52d8a8f4cdae481ae12dade1cbff6405 | jsx/test/upload-test.jsx | jsx/test/upload-test.jsx | import { describe, it } from 'mocha';
import React from 'react';
import chai from 'chai'
import { expect } from 'chai';
import chaiEnzyme from 'chai-enzyme';
import { shallow } from 'enzyme';
import { UploadFile } from '../upload';
chai.use(chaiEnzyme());
describe('<UploadFile />', () => {
it('renders a form', () => {
const wrapper = shallow(<UploadFile />);
const instance = wrapper.instance();
const form = wrapper.find('form');
expect(form).to.have.length(1);
expect(form).to.have.prop('encType').equal('multipart/form-data');
});
it('renders a file selection input', () => {
const wrapper = shallow(<UploadFile />);
const instance = wrapper.instance();
const form = wrapper.find('input[type="file"]');
expect(form).to.have.length(1);
});
it('renders a submit button', () => {
const wrapper = shallow(<UploadFile />);
const instance = wrapper.instance();
const form = wrapper.find('input[type="submit"]');
expect(form).to.have.length(1);
});
});
| Add some tests for the UploadFile | Add some tests for the UploadFile
| JSX | bsd-3-clause | tealeg/helloxl,tealeg/helloxl | ---
+++
@@ -0,0 +1,38 @@
+import { describe, it } from 'mocha';
+
+import React from 'react';
+import chai from 'chai'
+import { expect } from 'chai';
+import chaiEnzyme from 'chai-enzyme';
+import { shallow } from 'enzyme';
+
+
+import { UploadFile } from '../upload';
+
+chai.use(chaiEnzyme());
+
+describe('<UploadFile />', () => {
+
+ it('renders a form', () => {
+ const wrapper = shallow(<UploadFile />);
+ const instance = wrapper.instance();
+ const form = wrapper.find('form');
+ expect(form).to.have.length(1);
+ expect(form).to.have.prop('encType').equal('multipart/form-data');
+ });
+
+ it('renders a file selection input', () => {
+ const wrapper = shallow(<UploadFile />);
+ const instance = wrapper.instance();
+ const form = wrapper.find('input[type="file"]');
+ expect(form).to.have.length(1);
+ });
+
+ it('renders a submit button', () => {
+ const wrapper = shallow(<UploadFile />);
+ const instance = wrapper.instance();
+ const form = wrapper.find('input[type="submit"]');
+ expect(form).to.have.length(1);
+ });
+
+}); |
|
4a0e34b9d7343576d41e8ff8acba94ff758934bc | docs/src/app/components/pages/components/sliders.jsx | docs/src/app/components/pages/components/sliders.jsx | /**
* @jsx React.DOM
*/
var React = require('react'),
mui = require('mui');
var SlidersPage = React.createClass({
render: function() {
return (
<div>
<h2 className="mui-font-style-headline">Sliders</h2>
<mui.Slider name="slider1" />
<mui.Slider name="slider2" value={0.5} />
<mui.Slider name="slider3" value={1} />
<mui.Slider name="slider1" disabled={true} />
<mui.Slider name="slider2" disabled={true} value={0.5} />
<mui.Slider name="slider3" disabled={true} value={1} />
</div>
);
}
});
module.exports = SlidersPage;
| /**
* @jsx React.DOM
*/
var React = require('react'),
mui = require('mui'),
Slider = mui.Slider,
CodeExample = require('../../code-example/code-example.jsx');
var SlidersPage = React.createClass({
render: function() {
var code =
'// Default\n' +
'<Slider name="slider1" />\n\n' +
'// With value\n' +
'<Slider name="slider2" value={0.5} />\n' +
'<Slider name="slider3" value={1} />\n\n' +
'// Disabled\n' +
'<Slider name="slider1" disabled={true} />\n' +
'<Slider name="slider2" disabled={true} value={0.5} />\n' +
'<Slider name="slider3" disabled={true} value={1} />';
return (
<div>
<h2 className="mui-font-style-headline">Sliders</h2>
<CodeExample code={code}>
<Slider name="slider1" />
<Slider name="slider2" value={0.5} />
<Slider name="slider3" value={1} />
<Slider name="slider1" disabled={true} />
<Slider name="slider2" disabled={true} value={0.5} />
<Slider name="slider3" disabled={true} value={1} />
</CodeExample>
</div>
);
}
});
module.exports = SlidersPage;
| Update example page for Slider | Update example page for Slider
| JSX | mit | tirams/material-ui,arkxu/material-ui,matthewoates/material-ui,insionng/material-ui,subjectix/material-ui,rhaedes/material-ui,chirilo/material-ui,marwein/material-ui,dsslimshaddy/material-ui,marnusw/material-ui,agnivade/material-ui,salamer/material-ui,domagojk/material-ui,bright-sparks/material-ui,Qix-/material-ui,wunderlink/material-ui,Jandersolutions/material-ui,kybarg/material-ui,kabaka/material-ui,gsls1817/material-ui,mit-cml/iot-website-source,grovelabs/material-ui,ababol/material-ui,mbrookes/material-ui,pancho111203/material-ui,yulric/material-ui,tomrosier/material-ui,manchesergit/material-ui,vaiRk/material-ui,inoc603/material-ui,hwo411/material-ui,owencm/material-ui,mayblue9/material-ui,cloudseven/material-ui,RickyDan/material-ui,VirtueMe/material-ui,mtnk/material-ui,AndriusBil/material-ui,kasra-co/material-ui,marcelmokos/material-ui,b4456609/pet-new,creatorkuang/mui-react,kybarg/material-ui,bratva/material-ui,Iamronan/material-ui,inoc603/material-ui,janmarsicek/material-ui,ludiculous/material-ui,ruifortes/material-ui,developer-prosenjit/material-ui,w01fgang/material-ui,CumpsD/material-ui,myfintech/material-ui,ghondar/material-ui,jkruder/material-ui,AndriusBil/material-ui,cjhveal/material-ui,gsls1817/material-ui,skyflux/material-ui,ruifortes/material-ui,tingi/material-ui,wustxing/material-ui,btmills/material-ui,ahlee2326/material-ui,frnk94/material-ui,salamer/material-ui,2390183798/material-ui,pschlette/material-ui-with-sass,bdsabian/material-ui-old,ziad-saab/material-ui,bgribben/material-ui,hellokitty111/material-ui,udhayam/material-ui,Kagami/material-ui,2390183798/material-ui,kybarg/material-ui,nik4152/material-ui,keokilee/material-ui,gaowenbin/material-ui,CumpsD/material-ui,juhaelee/material-ui-io,hophacker/material-ui,und3fined/material-ui,mtsandeep/material-ui,Saworieza/material-ui,JAStanton/material-ui,zenlambda/material-ui,Zadielerick/material-ui,motiz88/material-ui,MrOrz/material-ui,sanemat/material-ui,patelh18/material-ui,pschlette/material-ui-with-sass,manchesergit/material-ui,yongxu/material-ui,insionng/material-ui,yhikishima/material-ui,mbrookes/material-ui,mui-org/material-ui,yinickzhou/material-ui,allanalexandre/material-ui,nik4152/material-ui,oliviertassinari/material-ui,izziaraffaele/material-ui,nahue/material-ui,und3fined/material-ui,isakib/material-ui,ButuzGOL/material-ui,ziad-saab/material-ui,freeslugs/material-ui,RickyDan/material-ui,freedomson/material-ui,zulfatilyasov/material-ui-yearpicker,cjhveal/material-ui,NogsMPLS/material-ui,ArcanisCz/material-ui,developer-prosenjit/material-ui,freedomson/material-ui,Joker666/material-ui,hybrisCole/material-ui,CyberSpace7/material-ui,janmarsicek/material-ui,Zeboch/material-ui,sarink/material-ui-with-sass,JAStanton/material-ui,juhaelee/material-ui-io,juhaelee/material-ui,2947721120/material-ui,zuren/material-ui,milworm/material-ui,MrLeebo/material-ui,freeslugs/material-ui,mmrtnz/material-ui,mbrookes/material-ui,kittyjumbalaya/material-components-web,XiaonuoGantan/material-ui,ProductiveMobile/material-ui,verdan/material-ui,dsslimshaddy/material-ui,Jonekee/material-ui,mulesoft/material-ui,WolfspiritM/material-ui,trendchaser4u/material-ui,patelh18/material-ui,WolfspiritM/material-ui,nathanmarks/material-ui,andrejunges/material-ui,Kagami/material-ui,deerawan/material-ui,juhaelee/material-ui,bORm/material-ui,barakmitz/material-ui,Lottid/material-ui,kybarg/material-ui,Cerebri/material-ui,drojas/material-ui,lgollut/material-ui,DenisPostu/material-ui,lucy-orbach/material-ui,mikedklein/material-ui,maoziliang/material-ui,roderickwang/material-ui,bright-sparks/material-ui,arkxu/material-ui,Josh-a-e/material-ui,shadowhunter2/material-ui,Syncano/material-ui,yh453926638/material-ui,Tionx/material-ui,AndriusBil/material-ui,ianwcarlson/material-ui,lawrence-yu/material-ui,pospisil1/material-ui,KevinMcIntyre/material-ui,callemall/material-ui,tastyeggs/material-ui,cgestes/material-ui,pancho111203/material-ui,Kagami/material-ui,mikey2XU/material-ui,cherniavskii/material-ui,kwangkim/course-react,ArcanisCz/material-ui,demoalex/material-ui,janmarsicek/material-ui,isakib/material-ui,hai-cea/material-ui,rodolfo2488/material-ui,lastjune/material-ui,kasra-co/material-ui,AndriusBil/material-ui,hiddentao/material-ui,Unforgiven-wanda/learning-react,oliviertassinari/material-ui,ask-izzy/material-ui,lionkeng/material-ui,hai-cea/material-ui,callemall/material-ui,mtsandeep/material-ui,gsklee/material-ui,louy/material-ui,buttercloud/material-ui,ahmedshuhel/material-ui,ashfaqueahmadbari/material-ui,ashfaqueahmadbari/material-ui,skarnecki/material-ui,JsonChiu/material-ui,Josh-a-e/material-ui,ludiculous/material-ui,xmityaz/material-ui,gitmithy/material-ui,zulfatilyasov/material-ui-yearpicker,br0r/material-ui,jmknoll/material-ui,oToUC/material-ui,121nexus/material-ui,JAStanton/material-ui-io,lionkeng/material-ui,mobilelife/material-ui,b4456609/pet-new,zuren/material-ui,vmaudgalya/material-ui,gaowenbin/material-ui,cpojer/material-ui,NatalieT/material-ui,VirtueMe/material-ui,mui-org/material-ui,mjhasbach/material-ui,checkraiser/material-ui,ddebowczyk/material-ui,Shiiir/learning-reactjs-first-demo,gsklee/material-ui,adamlee/material-ui,xiaoking/material-ui,hjmoss/material-ui,tastyeggs/material-ui,jacobrosenthal/material-ui,whatupdave/material-ui,ButuzGOL/material-ui,staticinstance/material-ui,Tionx/material-ui,yhikishima/material-ui,conundrumer/material-ui,dsslimshaddy/material-ui,oliverfencott/material-ui,nevir/material-ui,rodolfo2488/material-ui,elwebdeveloper/material-ui,jtollerene/material-ui,maoziliang/material-ui,kebot/material-ui,owencm/material-ui,oliverfencott/material-ui,chrxn/material-ui,yinickzhou/material-ui,Qix-/material-ui,jeroencoumans/material-ui,Iamronan/material-ui,safareli/material-ui,mogii/material-ui,b4456609/pet-new,br0r/material-ui,pomerantsev/material-ui,frnk94/material-ui,mit-cml/iot-website-source,ahmedshuhel/material-ui,haf/material-ui,esleducation/material-ui,christopherL91/material-ui,bratva/material-ui,rolandpoulter/material-ui,igorbt/material-ui,JsonChiu/material-ui,buttercloud/material-ui,unageanu/material-ui,und3fined/material-ui,ntgn81/material-ui,marwein/material-ui,ProductiveMobile/material-ui,trendchaser4u/material-ui,kittyjumbalaya/material-components-web,lunohq/material-ui,cherniavskii/material-ui,mgibeau/material-ui,hellokitty111/material-ui,azazdeaz/material-ui,alitaheri/material-ui,nevir/material-ui,ilear/material-ui,andrejunges/material-ui,felipeptcho/material-ui,hesling/material-ui,Joker666/material-ui,grovelabs/material-ui,rscnt/material-ui,hiddentao/material-ui,enriqueojedalara/material-ui,safareli/material-ui,meimz/material-ui,pospisil1/material-ui,sarink/material-ui-with-sass,janmarsicek/material-ui,pradel/material-ui,timuric/material-ui,callemall/material-ui,mubassirhayat/material-ui,rscnt/material-ui,felipethome/material-ui,mogii/material-ui,chrismcv/material-ui,CalebEverett/material-ui,EllieAdam/material-ui,bokzor/material-ui,glabcn/material-ui,spiermar/material-ui,verdan/material-ui,woanversace/material-ui,mulesoft-labs/material-ui,chirilo/material-ui,suvjunmd/material-ui,agnivade/material-ui,mui-org/material-ui,igorbt/material-ui,ronlobo/material-ui,Videri/material-ui,rscnt/material-ui,dsslimshaddy/material-ui,gobadiah/material-ui,mit-cml/iot-website-source,Dolmio/material-ui,zhengjunwei/material-ui,ilovezy/material-ui,Yepstr/material-ui,pomerantsev/material-ui,MrOrz/material-ui,jarno-steeman/material-ui,bdsabian/material-ui-old,AllenSH12/material-ui,ilovezy/material-ui,w01fgang/material-ui,matthewoates/material-ui,suvjunmd/material-ui,ichiohta/material-ui,tungmv7/material-ui,Saworieza/material-ui,cherniavskii/material-ui,loaf/material-ui,mjhasbach/material-ui,tyfoo/material-ui,lawrence-yu/material-ui,callemall/material-ui,tungmv7/material-ui,cherniavskii/material-ui,tingi/material-ui,milworm/material-ui,ababol/material-ui,checkraiser/material-ui,whatupdave/material-ui,jeroencoumans/material-ui,Hamstr/material-ui,xiaoking/material-ui,hwo411/material-ui,ichiohta/material-ui,bjfletcher/material-ui,wunderlink/material-ui,shaurya947/material-ui,tan-jerene/material-ui,hybrisCole/material-ui,garth/material-ui,tan-jerene/material-ui,JAStanton/material-ui-io,domagojk/material-ui,oliviertassinari/material-ui,JohnnyRockenstein/material-ui,alex-dixon/material-ui,glabcn/material-ui,Kagami/material-ui,EcutDavid/material-ui,ngbrown/material-ui,tomgco/material-ui,Shiiir/learning-reactjs-first-demo,Jandersolutions/material-ui,jkruder/material-ui,tribecube/material-ui,JonatanGarciaClavo/material-ui,motiz88/material-ui,ddebowczyk/material-ui,mmrtnz/material-ui,ahlee2326/material-ui,lightning18/material-ui | ---
+++
@@ -3,20 +3,35 @@
*/
var React = require('react'),
- mui = require('mui');
+ mui = require('mui'),
+ Slider = mui.Slider,
+ CodeExample = require('../../code-example/code-example.jsx');
var SlidersPage = React.createClass({
render: function() {
+ var code =
+ '// Default\n' +
+ '<Slider name="slider1" />\n\n' +
+ '// With value\n' +
+ '<Slider name="slider2" value={0.5} />\n' +
+ '<Slider name="slider3" value={1} />\n\n' +
+ '// Disabled\n' +
+ '<Slider name="slider1" disabled={true} />\n' +
+ '<Slider name="slider2" disabled={true} value={0.5} />\n' +
+ '<Slider name="slider3" disabled={true} value={1} />';
+
return (
<div>
<h2 className="mui-font-style-headline">Sliders</h2>
- <mui.Slider name="slider1" />
- <mui.Slider name="slider2" value={0.5} />
- <mui.Slider name="slider3" value={1} />
- <mui.Slider name="slider1" disabled={true} />
- <mui.Slider name="slider2" disabled={true} value={0.5} />
- <mui.Slider name="slider3" disabled={true} value={1} />
+ <CodeExample code={code}>
+ <Slider name="slider1" />
+ <Slider name="slider2" value={0.5} />
+ <Slider name="slider3" value={1} />
+ <Slider name="slider1" disabled={true} />
+ <Slider name="slider2" disabled={true} value={0.5} />
+ <Slider name="slider3" disabled={true} value={1} />
+ </CodeExample>
</div>
);
} |
92abdef2ecbd7bda886e6ef62be9983b9b20afb4 | src/client/public/components/home/Splash.jsx | src/client/public/components/home/Splash.jsx | 'use strict';
var React = require('react');
var Flux = require('react-flux');
var Router = require('react-router');
var {Route, RouteHandler, Link } = Router;
var Login = require('../Login.jsx');
var Register = require('../Register.jsx');
var userStore = require('../../flux/stores/user');
var Splash = React.createClass({
mixins: [
userStore.mixin()
],
getStateFromStores: function(){
console.log("App.getStateFromStores");
return {
user: userStore.state
};
},
render: function () {
return (
<div>
<Login/>
<Register/>
<RouteHandler/>
</div>
);
}
});
module.exports = Splash;
| Add splash page with login and registration forms | Add splash page with login and registration forms
| JSX | apache-2.0 | andrewfhart/coinbox,andrewfhart/coinbox | ---
+++
@@ -0,0 +1,38 @@
+'use strict';
+
+var React = require('react');
+var Flux = require('react-flux');
+var Router = require('react-router');
+var {Route, RouteHandler, Link } = Router;
+
+var Login = require('../Login.jsx');
+var Register = require('../Register.jsx');
+
+var userStore = require('../../flux/stores/user');
+
+
+var Splash = React.createClass({
+
+ mixins: [
+ userStore.mixin()
+ ],
+
+ getStateFromStores: function(){
+ console.log("App.getStateFromStores");
+ return {
+ user: userStore.state
+ };
+ },
+
+ render: function () {
+ return (
+ <div>
+ <Login/>
+ <Register/>
+ <RouteHandler/>
+ </div>
+ );
+ }
+});
+
+module.exports = Splash; |
|
312d693396f44c317049cb812069e7be9767cc91 | src/components/readme/edit_link.jsx | src/components/readme/edit_link.jsx | /**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// MODULES //
import React from 'react';
import EditIcon from '@material-ui/icons/Edit';
import config from './../../config.js';
// MAIN //
/**
* Component for rendering a link to edit a README on GitHub.
*
* @private
* @param {Object} props - component properties
* @param {string} props.pkg - package name (e.g., `math/base/special/sin`)
* @returns {ReactElement} React element
*/
function EditLink( props ) {
return (
<a
className="readme-edit-link"
href={ config.repository + '/edit/develop/lib/node_modules/@stdlib/' + props.pkg + '/README.md' }
>
<EditIcon fontSize="inherit" /> Edit on GitHub
</a>
);
}
// EXPORTS //
export default EditLink;
| Add component for rendering a README edit link | Add component for rendering a README edit link
| JSX | apache-2.0 | stdlib-js/www,stdlib-js/www,stdlib-js/www | ---
+++
@@ -0,0 +1,50 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2019 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// MODULES //
+
+import React from 'react';
+import EditIcon from '@material-ui/icons/Edit';
+import config from './../../config.js';
+
+
+// MAIN //
+
+/**
+* Component for rendering a link to edit a README on GitHub.
+*
+* @private
+* @param {Object} props - component properties
+* @param {string} props.pkg - package name (e.g., `math/base/special/sin`)
+* @returns {ReactElement} React element
+*/
+function EditLink( props ) {
+ return (
+ <a
+ className="readme-edit-link"
+ href={ config.repository + '/edit/develop/lib/node_modules/@stdlib/' + props.pkg + '/README.md' }
+ >
+ <EditIcon fontSize="inherit" /> Edit on GitHub
+ </a>
+ );
+}
+
+
+// EXPORTS //
+
+export default EditLink; |
|
4fceaedc92f357d6584f1c14d978c5941b496068 | src/client/components/DocumentsSection/index.jsx | src/client/components/DocumentsSection/index.jsx | import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { SPACING } from '@govuk-react/constants'
import { typography } from '@govuk-react/lib'
import NewWindowLink from '../NewWindowLink'
const StyledSectionHeader = styled('div')`
${typography.font({ size: 24, weight: 'bold' })};
margin-bottom: ${SPACING.SCALE_4};
`
const DocumentsSection = ({ fileBrowserRoot, documentPath }) => {
return (
<>
<StyledSectionHeader data-test="document-heading">
Documents
</StyledSectionHeader>
{documentPath ? (
<NewWindowLink
href={fileBrowserRoot + documentPath}
data-test="document-link"
>
View files and documents
</NewWindowLink>
) : (
<p data-test="no-documents-message">There are no files or documents</p>
)}
</>
)
}
DocumentsSection.propTypes = {
fileBrowserRoot: PropTypes.string.isRequired,
documentPath: PropTypes.string.isRequired,
}
export default DocumentsSection
| Create reusable component for document link | Create reusable component for document link
| JSX | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -0,0 +1,39 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import styled from 'styled-components'
+import { SPACING } from '@govuk-react/constants'
+import { typography } from '@govuk-react/lib'
+
+import NewWindowLink from '../NewWindowLink'
+
+const StyledSectionHeader = styled('div')`
+ ${typography.font({ size: 24, weight: 'bold' })};
+ margin-bottom: ${SPACING.SCALE_4};
+`
+
+const DocumentsSection = ({ fileBrowserRoot, documentPath }) => {
+ return (
+ <>
+ <StyledSectionHeader data-test="document-heading">
+ Documents
+ </StyledSectionHeader>
+ {documentPath ? (
+ <NewWindowLink
+ href={fileBrowserRoot + documentPath}
+ data-test="document-link"
+ >
+ View files and documents
+ </NewWindowLink>
+ ) : (
+ <p data-test="no-documents-message">There are no files or documents</p>
+ )}
+ </>
+ )
+}
+
+DocumentsSection.propTypes = {
+ fileBrowserRoot: PropTypes.string.isRequired,
+ documentPath: PropTypes.string.isRequired,
+}
+
+export default DocumentsSection |
|
04f5722f817d863808e7947ef73f9a5034e8075b | indico/web/client/js/react/IButton.jsx | indico/web/client/js/react/IButton.jsx | /* This file is part of Indico.
* Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN).
*
* Indico is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Indico is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Indico; if not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react';
export default class IButton extends React.Component {
render() {
return (
<a id={this.props.id} className={`i-button ${this.props.classes || ''}`}
href={this.props.href} title={this.props.title}>
{this.props.name}{this.props.children}
</a>
);
}
}
| Add basic implementation of i-button component | Add basic implementation of i-button component
| JSX | mit | ThiefMaster/indico,ThiefMaster/indico,DirkHoffmann/indico,ThiefMaster/indico,OmeGak/indico,pferreir/indico,mvidalgarcia/indico,mic4ael/indico,mvidalgarcia/indico,ThiefMaster/indico,mvidalgarcia/indico,OmeGak/indico,mic4ael/indico,indico/indico,DirkHoffmann/indico,pferreir/indico,mvidalgarcia/indico,indico/indico,pferreir/indico,DirkHoffmann/indico,mic4ael/indico,OmeGak/indico,DirkHoffmann/indico,indico/indico,OmeGak/indico,mic4ael/indico,indico/indico,pferreir/indico | ---
+++
@@ -0,0 +1,29 @@
+/* This file is part of Indico.
+ * Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN).
+ *
+ * Indico is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Indico is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Indico; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+import React from 'react';
+
+export default class IButton extends React.Component {
+ render() {
+ return (
+ <a id={this.props.id} className={`i-button ${this.props.classes || ''}`}
+ href={this.props.href} title={this.props.title}>
+ {this.props.name}{this.props.children}
+ </a>
+ );
+ }
+} |
|
d1f80e2a9e1fd4f4d54a3de61d3cf23c17582eb8 | app/js/common/components/FormikSelect.jsx | app/js/common/components/FormikSelect.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Select from 'react-select';
import 'react-select/dist/react-select.css';
// See: https://github.com/jaredpalmer/formik#why-use-setfieldvalue-instead-of-handlechange
class FormikSelect extends Component {
static propTypes = {
field: PropTypes.string.isRequired,
input: PropTypes.shape({
value: PropTypes.oneOfType([
PropTypes.node, // {value, label}
PropTypes.array, // If 'multi' select
]),
onChange: PropTypes.func, // setFieldValue
onBlur: PropTypes.func, // setFieldTouched
}).isRequired,
options: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
};
handleChange = (value) => {
this.props.input.onChange(this.props.field, value);
};
handleBlur = () => {
this.props.input.onBlur(this.props.field, true);
};
render() {
return (
<Select
{...this.props}
options={this.props.options}
onChange={this.handleChange}
onBlur={this.handleBlur}
value={this.props.input.value}
/>
);
}
}
export default FormikSelect;
| Add Select Component Compatible w/ Formik | Add Select Component Compatible w/ Formik
| JSX | mit | rit-sse/OneRepoToRuleThemAll | ---
+++
@@ -0,0 +1,43 @@
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import Select from 'react-select';
+
+import 'react-select/dist/react-select.css';
+
+// See: https://github.com/jaredpalmer/formik#why-use-setfieldvalue-instead-of-handlechange
+class FormikSelect extends Component {
+ static propTypes = {
+ field: PropTypes.string.isRequired,
+ input: PropTypes.shape({
+ value: PropTypes.oneOfType([
+ PropTypes.node, // {value, label}
+ PropTypes.array, // If 'multi' select
+ ]),
+ onChange: PropTypes.func, // setFieldValue
+ onBlur: PropTypes.func, // setFieldTouched
+ }).isRequired,
+ options: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
+ };
+
+ handleChange = (value) => {
+ this.props.input.onChange(this.props.field, value);
+ };
+
+ handleBlur = () => {
+ this.props.input.onBlur(this.props.field, true);
+ };
+
+ render() {
+ return (
+ <Select
+ {...this.props}
+ options={this.props.options}
+ onChange={this.handleChange}
+ onBlur={this.handleBlur}
+ value={this.props.input.value}
+ />
+ );
+ }
+}
+
+export default FormikSelect; |
|
6862cd90e76223601b074b7d4d5bd53d3b7f8abf | webofneeds/won-owner-webapp/src/main/webapp/app/components/atom-card-grid.jsx | webofneeds/won-owner-webapp/src/main/webapp/app/components/atom-card-grid.jsx | /**
* Created by fsuda on 21.08.2017.
*/
import React from "react";
import WonAtomCard from "./atom-card.jsx";
export default class WonAtomCardGrid extends React.Component {
render() {
if(this.props && this.props.atomUris && this.props.atomUris.length > 0) {
const atomUris = this.props.atomUris;
const showPersona = this.props.showPersona;
const showSuggestions = this.props.showSuggestions;
const currentLocation = this.props.currentLocation;
const disableDefaultAtomInteraction = this.props.disableDefaultAtomInteraction;
const ngRedux = this.props && this.props.ngRedux;
console.debug("atomUris: ", atomUris);
console.debug("showPersona: ", showPersona);
console.debug("showSuggestions: ", showSuggestions);
console.debug("currentLocation: ", currentLocation);
console.debug("disableDefaultAtomInteraction: ", disableDefaultAtomInteraction);
console.debug("ngRedux: ", ngRedux);
return atomUris.map(atomUri => {
return (
<WonAtomCard key={atomUri} atomUri={atomUri} showPersona={showPersona} showSuggestions={showSuggestions} currentLocation={currentLocation} disableDefaultAtomInteraction={disableDefaultAtomInteraction} ngRedux={ngRedux} />
);
});
}
return undefined;
}
} | Create simple ng-repeat replacing react atomCardGrid | Create simple ng-repeat replacing react atomCardGrid
| JSX | apache-2.0 | researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds,researchstudio-sat/webofneeds | ---
+++
@@ -0,0 +1,34 @@
+/**
+ * Created by fsuda on 21.08.2017.
+ */
+
+import React from "react";
+import WonAtomCard from "./atom-card.jsx";
+
+export default class WonAtomCardGrid extends React.Component {
+
+ render() {
+ if(this.props && this.props.atomUris && this.props.atomUris.length > 0) {
+ const atomUris = this.props.atomUris;
+ const showPersona = this.props.showPersona;
+ const showSuggestions = this.props.showSuggestions;
+ const currentLocation = this.props.currentLocation;
+ const disableDefaultAtomInteraction = this.props.disableDefaultAtomInteraction;
+ const ngRedux = this.props && this.props.ngRedux;
+
+ console.debug("atomUris: ", atomUris);
+ console.debug("showPersona: ", showPersona);
+ console.debug("showSuggestions: ", showSuggestions);
+ console.debug("currentLocation: ", currentLocation);
+ console.debug("disableDefaultAtomInteraction: ", disableDefaultAtomInteraction);
+ console.debug("ngRedux: ", ngRedux);
+
+ return atomUris.map(atomUri => {
+ return (
+ <WonAtomCard key={atomUri} atomUri={atomUri} showPersona={showPersona} showSuggestions={showSuggestions} currentLocation={currentLocation} disableDefaultAtomInteraction={disableDefaultAtomInteraction} ngRedux={ngRedux} />
+ );
+ });
+ }
+ return undefined;
+ }
+} |
|
a3b6c77ca69fe54b9a61b7c28a29a0a3c2eb716a | client/source/Index.jsx | client/source/Index.jsx | // React + React-Router Dependencies
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Router, IndexRoute, Route, browserHistory } from 'react-router';
// Importing the React components from components folder
import App from './components/App';
import LandingPage from './components/LandingPage';
render((
<Router history={browserHistory}>
<Route path="/" component={App} >
<IndexRoute component={LandingPage} />
</Route>
</Router>
), document.getElementById('app')); | Implement basic Router for application | Implement basic Router for application
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -0,0 +1,16 @@
+// React + React-Router Dependencies
+import React, { Component } from 'react';
+import { render } from 'react-dom';
+import { Router, IndexRoute, Route, browserHistory } from 'react-router';
+
+// Importing the React components from components folder
+import App from './components/App';
+import LandingPage from './components/LandingPage';
+
+render((
+ <Router history={browserHistory}>
+ <Route path="/" component={App} >
+ <IndexRoute component={LandingPage} />
+ </Route>
+ </Router>
+), document.getElementById('app')); |
|
414c76f9dc0f8ea42049eb985e128057cd36160c | src/app/containers/Post/PostForm.jsx | src/app/containers/Post/PostForm.jsx | import React, { Component } from 'react'
// import Recaptcha from 'react-recaptcha'
import {
TextField,
Icon,
IconCircle,
FileInput
} from '~/components';
const i = window.appSettings.icons;
class PostForm extends Component {
constructor(props) {
super(props)
this.state = {
name: '',
options: '',
comment: ''
}
}
handleInputChange = (e) => {
this.setState({
[e.target.name]: e.target.value
})
}
handleSubmit = (e) => {
e.preventDefault()
if (!this.isFormValid()) {
this.invalidateForm()
return
}
const { name, options, comment } = this.state;
this.props.onSubmit({
name: name.trim(),
options: options.trim(),
comment: comment.trim()
});
this.setState({name: '', text: ''})
}
setNameRef = (ref) => this._inputName = ref
setOptionsRef = (ref) => this._inputOptions = ref
setCommentRef = (ref) => this._inputComment = ref
appendToComment = ( text ) => {
console.log(this._inputComment);
}
render() {
const { className, close, header, theme } = this.props
return (
<form className={className} onSubmit={this.handleSubmit}>
<div className="post-header">
{header}
<IconCircle className="post-close" name={i.postClose} onClick={close}/>
</div>
<TextField
theme={theme}
className="post-name"
label="Name"
name="name"
placeholder="Anonymous"
onChange={this.handleInputChange}
ref={this.setNameRef}
/>
<TextField
theme={theme}
className="post-options"
label="Options"
name="options"
ref={this.setOptionsRef}
onChange={this.handleInputChange}/>
<textarea
className="post-comment"
name="comment"
ref={this.setCommentRef}
onChange={this.handleInputChange}
/>
{/* <Recaptcha
ref={e => this._recaptcha = e}
sitekey={sitekey}
size="compact"
render="explicit"
verifyCallback={verifyCallback}
onloadCallback={callback}
expiredCallback={expiredCallback}
/>*/}
<FileInput className="post-file-wrapper"/>
<div className="post-submit-wrapper">
<Icon name={i.postSubmit}/>
</div>
</form>
)
}
isFormValid() {
// Needs access to the max chars and timeout
// for now
return true
}
invalidateForm() {
// For now
return
this.setState({ showInvalidationMessage: true });
setTimeout(() =>
this.setState({
showInvalidationMessage: false
}),
config.invalidationMessageDuration)
}
}
export default PostForm
| Add post form for submitting posts | feat(Post): Add post form for submitting posts
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -0,0 +1,125 @@
+import React, { Component } from 'react'
+// import Recaptcha from 'react-recaptcha'
+import {
+ TextField,
+ Icon,
+ IconCircle,
+ FileInput
+} from '~/components';
+
+const i = window.appSettings.icons;
+
+class PostForm extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ name: '',
+ options: '',
+ comment: ''
+ }
+ }
+
+ handleInputChange = (e) => {
+ this.setState({
+ [e.target.name]: e.target.value
+ })
+ }
+
+ handleSubmit = (e) => {
+ e.preventDefault()
+
+ if (!this.isFormValid()) {
+ this.invalidateForm()
+ return
+ }
+
+ const { name, options, comment } = this.state;
+
+ this.props.onSubmit({
+ name: name.trim(),
+ options: options.trim(),
+ comment: comment.trim()
+ });
+
+ this.setState({name: '', text: ''})
+ }
+
+ setNameRef = (ref) => this._inputName = ref
+ setOptionsRef = (ref) => this._inputOptions = ref
+ setCommentRef = (ref) => this._inputComment = ref
+
+ appendToComment = ( text ) => {
+ console.log(this._inputComment);
+ }
+
+ render() {
+ const { className, close, header, theme } = this.props
+
+ return (
+ <form className={className} onSubmit={this.handleSubmit}>
+ <div className="post-header">
+ {header}
+ <IconCircle className="post-close" name={i.postClose} onClick={close}/>
+ </div>
+ <TextField
+ theme={theme}
+ className="post-name"
+ label="Name"
+ name="name"
+ placeholder="Anonymous"
+ onChange={this.handleInputChange}
+ ref={this.setNameRef}
+ />
+ <TextField
+ theme={theme}
+ className="post-options"
+ label="Options"
+ name="options"
+ ref={this.setOptionsRef}
+ onChange={this.handleInputChange}/>
+ <textarea
+ className="post-comment"
+ name="comment"
+ ref={this.setCommentRef}
+ onChange={this.handleInputChange}
+ />
+ {/* <Recaptcha
+ ref={e => this._recaptcha = e}
+ sitekey={sitekey}
+ size="compact"
+ render="explicit"
+ verifyCallback={verifyCallback}
+ onloadCallback={callback}
+ expiredCallback={expiredCallback}
+ />*/}
+ <FileInput className="post-file-wrapper"/>
+ <div className="post-submit-wrapper">
+ <Icon name={i.postSubmit}/>
+ </div>
+ </form>
+ )
+ }
+
+ isFormValid() {
+ // Needs access to the max chars and timeout
+
+ // for now
+ return true
+ }
+
+ invalidateForm() {
+ // For now
+ return
+
+ this.setState({ showInvalidationMessage: true });
+
+ setTimeout(() =>
+ this.setState({
+ showInvalidationMessage: false
+ }),
+ config.invalidationMessageDuration)
+
+ }
+}
+
+export default PostForm |
|
e8107ba8aa2ae98fa5d9f0131c40fbcedb9dac9e | lib/main.jsx | lib/main.jsx | var React = require('react');
var Router = require('react-router');
var config = require('./config');
var routes = require('./routes.jsx');
function startRunningSite() {
var url = document.querySelector('meta[name=url]').getAttribute('value');
var pageHolder = document.getElementById('page-holder');
if (config.ENABLE_PUSHSTATE) {
routes.run(Router.HistoryLocation, pageHolder);
} else {
if (!window.location.hash.slice(1))
window.location.hash = '#' + url;
routes.run(Router.HashLocation, pageHolder);
}
}
if (config.IN_STATIC_SITE) {
startRunningSite();
}
| var React = require('react');
var Router = require('react-router');
var config = require('./config');
var routes = require('./routes.jsx');
function startRunningSite() {
var url = document.querySelector('meta[name=url]').getAttribute('value');
var pageHolder = document.getElementById('page-holder');
if (config.ENABLE_PUSHSTATE) {
routes.run(Router.HistoryLocation, pageHolder);
} else {
routes.run(Router.RefreshLocation, pageHolder);
}
}
if (config.IN_STATIC_SITE) {
startRunningSite();
}
| Use Router.RefreshLocation instead of Router.HashLocation. | Use Router.RefreshLocation instead of Router.HashLocation.
This fixes #232. I also know that we could just pass
Router.HistoryLocation to react-router and let it gracefully degrade
to Router.RefreshLocation on its own, but that would make it harder
for us to manually test.
| JSX | mpl-2.0 | mozilla/teach.webmaker.org,mozilla/teach.mozilla.org,Pomax/teach.mozilla.org,asdofindia/teach.webmaker.org,mmmavis/teach.mozilla.org,Pomax/teach.webmaker.org,Pomax/teach.webmaker.org,fredericksilva/teach.webmaker.org,AnthonyBobsin/teach.webmaker.org,mmmavis/teach.webmaker.org,Pomax/teach.mozilla.org,mozilla/teach.webmaker.org,alicoding/teach.webmaker.org,emmairwin/teach.webmaker.org,mmmavis/teach.mozilla.org,mrinaljain/teach.webmaker.org,mozilla/teach.mozilla.org,mozilla/learning.mozilla.org,cadecairos/teach.mozilla.org,alicoding/teach.webmaker.org,AnthonyBobsin/teach.webmaker.org,alicoding/teach.mozilla.org,asdofindia/teach.webmaker.org,fredericksilva/teach.webmaker.org,toolness/teach.webmaker.org,PaulaPaul/teach.mozilla.org,mrinaljain/teach.webmaker.org,PaulaPaul/teach.mozilla.org,cadecairos/teach.mozilla.org,toolness/teach.webmaker.org,emmairwin/teach.webmaker.org,alicoding/teach.mozilla.org,mmmavis/teach.webmaker.org | ---
+++
@@ -11,9 +11,7 @@
if (config.ENABLE_PUSHSTATE) {
routes.run(Router.HistoryLocation, pageHolder);
} else {
- if (!window.location.hash.slice(1))
- window.location.hash = '#' + url;
- routes.run(Router.HashLocation, pageHolder);
+ routes.run(Router.RefreshLocation, pageHolder);
}
}
|
a14ba8a7bf1abffe2787bbbef05ba39e9d9da2f8 | client/src/components/layout/LoadedQueryNotFoundMessage.jsx | client/src/components/layout/LoadedQueryNotFoundMessage.jsx | import React from 'react';
import { InfoMessage } from './../../assets/styled/UI';
import BaseLayoutLoader from './BaseLayoutLoader';
export default ({ query, message }) => {
if (query && (query.loading && !query.error)) {
return <BaseLayoutLoader />;
}
else {
return <InfoMessage visible content={message} />;
}
}; | Add loading query when finished loading and nothing found show message | Add loading query when finished loading and nothing found show message
| JSX | bsd-2-clause | Lochmann85/shout-out-loud-dev,Lochmann85/shout-out-loud-dev,Lochmann85/shout-out-loud-dev | ---
+++
@@ -0,0 +1,14 @@
+import React from 'react';
+
+import { InfoMessage } from './../../assets/styled/UI';
+
+import BaseLayoutLoader from './BaseLayoutLoader';
+
+export default ({ query, message }) => {
+ if (query && (query.loading && !query.error)) {
+ return <BaseLayoutLoader />;
+ }
+ else {
+ return <InfoMessage visible content={message} />;
+ }
+}; |
|
26411b316c52aa6b6e85b75d34b1398952eb2ed5 | 12/create-textframe-align-contents-center.jsx | 12/create-textframe-align-contents-center.jsx | //
// textFrame style customization example.
//
var createDocument = function(params){
params.documentPreferences = {
pageWidth : params.pageWidth+"mm",
pageHeight : params.pageHeight+"mm",
facingPages : false};
var doc = app.documents.add(params);
var page = doc.pages.item(0);
page.marginPreferences.properties = {
top : params.marginTop+"mm",
left : params.marginLeft+"mm",
bottom : params.marginBottom+"mm",
right : params.marginRight+"mm"};
return doc;
};
var createTextFrame = function(parent,params){
return parent.textFrames.add({
geometricBounds:[
params.top+"mm",
params.left+"mm",
params.bottom+"mm",
params.right+"mm"] });
};
// ----
// main
// ----
var pageParams = {
pageWidth : 297,
pageHeight : 210,
marginTop : 10,
marginLeft : 10,
marginBottom: 10,
marginRight : 10};
var doc = createDocument( pageParams );
var page = doc.pages.item(0);
var textFrameParams = {
top : pageParams.marginTop,
left : pageParams.marginLeft,
bottom : (pageParams.marginTop+40),
right : (pageParams.marginLeft+40) };
var textFrame = createTextFrame(page, textFrameParams);
// contents
textFrame.contents = 'Hello!';
// vertical align center
textFrame.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
// horizontal align center
var textStyleRanges = textFrame.textStyleRanges;
var pstyle = textStyleRanges[0].appliedParagraphStyle;
pstyle.justification = Justification.CENTER_ALIGN;
| Add textFrame contents alignment example. | Add textFrame contents alignment example.
| JSX | mit | mindboard/indesign-extendscript,mindboard/indesign-extendscript | ---
+++
@@ -0,0 +1,65 @@
+//
+// textFrame style customization example.
+//
+
+var createDocument = function(params){
+ params.documentPreferences = {
+ pageWidth : params.pageWidth+"mm",
+ pageHeight : params.pageHeight+"mm",
+ facingPages : false};
+
+ var doc = app.documents.add(params);
+
+ var page = doc.pages.item(0);
+ page.marginPreferences.properties = {
+ top : params.marginTop+"mm",
+ left : params.marginLeft+"mm",
+ bottom : params.marginBottom+"mm",
+ right : params.marginRight+"mm"};
+
+ return doc;
+};
+
+var createTextFrame = function(parent,params){
+ return parent.textFrames.add({
+ geometricBounds:[
+ params.top+"mm",
+ params.left+"mm",
+ params.bottom+"mm",
+ params.right+"mm"] });
+};
+
+// ----
+// main
+// ----
+
+var pageParams = {
+ pageWidth : 297,
+ pageHeight : 210,
+ marginTop : 10,
+ marginLeft : 10,
+ marginBottom: 10,
+ marginRight : 10};
+
+var doc = createDocument( pageParams );
+var page = doc.pages.item(0);
+
+var textFrameParams = {
+ top : pageParams.marginTop,
+ left : pageParams.marginLeft,
+ bottom : (pageParams.marginTop+40),
+ right : (pageParams.marginLeft+40) };
+
+var textFrame = createTextFrame(page, textFrameParams);
+
+// contents
+textFrame.contents = 'Hello!';
+
+// vertical align center
+textFrame.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
+
+// horizontal align center
+var textStyleRanges = textFrame.textStyleRanges;
+var pstyle = textStyleRanges[0].appliedParagraphStyle;
+pstyle.justification = Justification.CENTER_ALIGN;
+ |
|
1b3f6c918f961b1d5a6bd45264e321e807868782 | client/source/components/EditRecipe/invalidStepsModal.jsx | client/source/components/EditRecipe/invalidStepsModal.jsx | import React from 'react';
//Bootstrap
import { Modal, Button, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap';
class InvalidStepsModal extends React.Component {
constructor(props) {
super(props);
}
close(event) {
// this.setState({showModal: false});
console.log('CLOSING MODAL!');
this.props.closeModal();
}
render () {
return (
<div className="static-modal">
<Modal.Dialog>
<Modal.Header>
<Modal.Title> Merge Conflict!</Modal.Title>
</Modal.Header>
<Modal.Body>
<h4> Invalid Step Description </h4>
<p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
<p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
<p> Steps: {this.props.invalidSteps.join(', ')} </p>
</Modal.Body>
<Modal.Footer>
<Button onClick={this.close.bind(this)}>Close</Button>
</Modal.Footer>
</Modal.Dialog>
</div>
)
}
}
export default InvalidStepsModal;
// <div>
// <Modal show={true} onHide={this.close.bind(this)}>
// <Modal.Dialog>
// <Modal.Header closeButton>
// <Modal.Title> Merge Conflict!</Modal.Title>
// </Modal.Header>
// <Modal.Body>
// <h4> Invalid Step Description </h4>
// <p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
// <p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
// <p> Steps: {this.props.invalidSteps.join(', ')} </p>
// </Modal.Body>
// <Modal.Footer>
// <Button bsStyle="primary" onClick={this.close.bind(this)}>Close</Button>
// </Modal.Footer>
// </Modal.Dialog>
// </Modal>
// </div> | Implement modal to be displayed when user is attempting to submit recipe with invalid steps (steps contain deleted ingredients) | Implement modal to be displayed when user is attempting to submit recipe with invalid steps (steps contain deleted ingredients)
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -0,0 +1,66 @@
+import React from 'react';
+
+//Bootstrap
+import { Modal, Button, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap';
+
+class InvalidStepsModal extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ close(event) {
+ // this.setState({showModal: false});
+ console.log('CLOSING MODAL!');
+ this.props.closeModal();
+ }
+
+ render () {
+ return (
+ <div className="static-modal">
+ <Modal.Dialog>
+ <Modal.Header>
+ <Modal.Title> Merge Conflict!</Modal.Title>
+ </Modal.Header>
+
+ <Modal.Body>
+ <h4> Invalid Step Description </h4>
+ <p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
+ <p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
+ <p> Steps: {this.props.invalidSteps.join(', ')} </p>
+ </Modal.Body>
+
+ <Modal.Footer>
+ <Button onClick={this.close.bind(this)}>Close</Button>
+ </Modal.Footer>
+
+ </Modal.Dialog>
+ </div>
+ )
+ }
+}
+
+export default InvalidStepsModal;
+
+
+
+ // <div>
+ // <Modal show={true} onHide={this.close.bind(this)}>
+ // <Modal.Dialog>
+ // <Modal.Header closeButton>
+ // <Modal.Title> Merge Conflict!</Modal.Title>
+ // </Modal.Header>
+
+ // <Modal.Body>
+ // <h4> Invalid Step Description </h4>
+ // <p> There are steps in this recipe that include ingredients that you have uninstalled. </p>
+ // <p> Please run 'npm-install-ingredients' to add these ingredients back or modify the following steps </p>
+ // <p> Steps: {this.props.invalidSteps.join(', ')} </p>
+ // </Modal.Body>
+
+ // <Modal.Footer>
+ // <Button bsStyle="primary" onClick={this.close.bind(this)}>Close</Button>
+ // </Modal.Footer>
+
+ // </Modal.Dialog>
+ // </Modal>
+ // </div> |
|
bd803637a827afbc00e3e98962dd9ad5e6d054ec | src/components/Stats.jsx | src/components/Stats.jsx | var React = require('react');
var _ = require('lodash');
var Stats = React.createClass({
propTypes: {
playerInstances: React.PropTypes.array.isRequired,
playerStates: React.PropTypes.array.isRequired,
winners: React.PropTypes.array.isRequired
},
render() {
var {playerInstances, playerStates, winners} = this.props;
return (
<table className='stats'>
<thead>
<td>
<b>Results:</b>
</td>
</thead>
<tbody>
{_.map(playerInstances, (el, index) => {
var playerInfo = el.getInfo();
var playerState = playerStates[index];
return (
<tr key={index} style={{
textDecoration: playerState.isAlive ? 'none' : 'line-through',
color: playerState.isAlive ? '#FFF' : '#A00'
}}>
<td>
{playerInfo.name}
</td>
<td className='stats-results'>
{winners[index]}
</td>
</tr>
);
})}
</tbody>
</table>
);
}
});
module.exports = Stats;
| var React = require('react');
var _ = require('lodash');
var Stats = React.createClass({
propTypes: {
playerInstances: React.PropTypes.array.isRequired,
playerStates: React.PropTypes.array.isRequired,
winners: React.PropTypes.array.isRequired
},
render() {
var {playerInstances, playerStates, winners} = this.props;
var stats = _.map(playerInstances, (el, index) => ({
wins: winners[index],
rate: winners[index] ? Math.round(winners[index] / (winners.reduce((prev, cur) => prev + cur))) : 0
})
);
return (
<table className='stats'>
<thead>
<td>
<b>Results:</b>
</td>
</thead>
<tbody>
{_.map(playerInstances, (el, index) => {
var playerInfo = el.getInfo();
var playerState = playerStates[index];
return (
<tr key={index} style={{
textDecoration: playerState.isAlive ? 'none' : 'line-through',
color: playerState.isAlive ? '#FFF' : '#A00'
}}>
<td>
{playerInfo.name}
</td>
<td className='stats-results'>
{stats[index].wins} ({stats[index].rate * 100} %)
</td>
</tr>
);
})}
</tbody>
</table>
);
}
});
module.exports = Stats;
| Include a winrate in stats | Include a winrate in stats
| JSX | bsd-3-clause | Ripjaw415/clashjs,qizhiyu/clashjs,manlito/clashjs,javierbyte/clashjs,jladuval/clashjs,mediasuitenz/clashjs,kiwiandroiddev/clashjs,mediasuitenz/clashjs,pandaman4125/clashjs,Ripjaw415/clashjs,DanielOram/clashjs,Wingie/clashjs,Wingie/clashjs,codingpains/clashjs,qizhiyu/clashjs,Lerc/clashjs,DanielOram/clashjs,javierbyte/clashjs,codingpains/clashjs,Lerc/clashjs,kiwiandroiddev/clashjs,pandaman4125/clashjs,manlito/clashjs,jladuval/clashjs | ---
+++
@@ -11,6 +11,11 @@
render() {
var {playerInstances, playerStates, winners} = this.props;
+ var stats = _.map(playerInstances, (el, index) => ({
+ wins: winners[index],
+ rate: winners[index] ? Math.round(winners[index] / (winners.reduce((prev, cur) => prev + cur))) : 0
+ })
+ );
return (
<table className='stats'>
@@ -33,7 +38,7 @@
{playerInfo.name}
</td>
<td className='stats-results'>
- {winners[index]}
+ {stats[index].wins} ({stats[index].rate * 100} %)
</td>
</tr>
); |
98d22beffbf0cc6827dcb58ae7c76b6b49a7fe3a | imports/ui/ShowTruncatedText.jsx | imports/ui/ShowTruncatedText.jsx | import React from 'react'
import CopyToClipboard from 'react-copy-to-clipboard'
import {Button} from 'reactstrap'
const ShowTruncatedText = ({text}) => {
const truncateWithEllipsis = {
'width': '270px',
'white-space': 'nowrap',
'overflow': 'hidden',
'text-overflow': 'ellipsis'
}
return <p style={truncateWithEllipsis}>
<CopyToClipboard text={text}>
<Button className='fa fa-copy' />
</CopyToClipboard>
{text} </p>
}
export default ShowTruncatedText
| Write a component that shows long strings truncated and a clipboard icon | Write a component that shows long strings truncated and a clipboard icon
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -0,0 +1,19 @@
+import React from 'react'
+import CopyToClipboard from 'react-copy-to-clipboard'
+import {Button} from 'reactstrap'
+
+const ShowTruncatedText = ({text}) => {
+ const truncateWithEllipsis = {
+ 'width': '270px',
+ 'white-space': 'nowrap',
+ 'overflow': 'hidden',
+ 'text-overflow': 'ellipsis'
+ }
+ return <p style={truncateWithEllipsis}>
+ <CopyToClipboard text={text}>
+ <Button className='fa fa-copy' />
+ </CopyToClipboard>
+ {text} </p>
+}
+
+export default ShowTruncatedText |
|
828f621e13d04c0d77bb2ff669e82d000aede32a | client/app/bundles/course/video/videos.jsx | client/app/bundles/course/video/videos.jsx | import React from 'react';
import { render } from 'react-dom';
import ProviderWrapper from 'lib/components/ProviderWrapper';
import HeatMap from './submission/containers/Charts/HeatMap';
$(document).ready(() => {
const mountNode = document.getElementById('video-overall-stats');
if (!mountNode) { return; }
const submissionData = mountNode.getAttribute('data');
const initialState = JSON.parse(submissionData);
render(
<ProviderWrapper>
<HeatMap {...initialState} />
</ProviderWrapper>
, mountNode
);
});
| Add frontend for video overall stats | Add frontend for video overall stats
Signed-off-by: Shen Yichen <be3bb257ef8d73236feaba36cd3e5ee9095e6819@gmail.com>
| JSX | mit | Coursemology/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2 | ---
+++
@@ -0,0 +1,20 @@
+import React from 'react';
+import { render } from 'react-dom';
+import ProviderWrapper from 'lib/components/ProviderWrapper';
+import HeatMap from './submission/containers/Charts/HeatMap';
+
+$(document).ready(() => {
+ const mountNode = document.getElementById('video-overall-stats');
+
+ if (!mountNode) { return; }
+
+ const submissionData = mountNode.getAttribute('data');
+ const initialState = JSON.parse(submissionData);
+
+ render(
+ <ProviderWrapper>
+ <HeatMap {...initialState} />
+ </ProviderWrapper>
+ , mountNode
+ );
+}); |
|
a1871d419580d710d14bfb2a1882c523c00987d7 | newControlNull.jsx | newControlNull.jsx | /*
newControlNull
Author: Yahor Hayeuski
Script for ft-Toolbar
Create new small(50x50) null layer in top right corner in active comp with orange label,
and name it "controller". The source item always stays the same, so there is no mess
in project panel with many items like: "Null 1", "Null 2", etc.
*/
(function () {
// Check if two 2D arrays are equal
function equalArrs( arr1, arr2 ) {
if (arr1.length != arr2.length) {
return false;
}
for (var i = 0, l = arr1.length; i < l; i++) {
if (arr1[i] != arr2[i]) {
// Don't work with complex types (like objects and arrays)
return false;
}
}
return true;
}
var scriptName = 'newNull';
var name = 'null';
var label = 12; // Brown label
// Check for selected comp
var curComp = app.project.activeItem;
if ((curComp == null) || !(curComp instanceof CompItem)) {
alert('There is no active comp.');
return;
}
// Find id of source null, if there is one
var id;
var item;
for (var i = 1, l = app.project.numItems; i <= l; i++) {
item = app.project.item(i);
if ((item.name == name) &&
(item.label == label) &&
(item instanceof FootageItem) &&
(item.mainSource instanceof SolidSource) &&
equalArrs( item.mainSource.color, [1,1,1] ) &&
equalArrs( [item.width,item.height], [100,100] )) {
id = i;
break;
}
}
app.beginUndoGroup('ft-Toolbar - ' + scriptName);
// Creating
var newNull;
if (id) {
// if there is source null in project
newNull = curComp.layers.add( app.project.item(id) );
newNull.property("ADBE Transform Group").property("ADBE Opacity").setValue(0);
newNull.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([0,0]);
} else {
// if there is no null, create new one
newNull = curComp.layers.addNull();
newNull.source.name = name;
newNull.source.label = label;
newNull.label = label;
}
app.endUndoGroup();
})(); // End | Create new file from newNull, and change description | Create new file from newNull, and change description
| JSX | mit | di23/scripts_ft-Toolbar | ---
+++
@@ -0,0 +1,75 @@
+/*
+ newControlNull
+ Author: Yahor Hayeuski
+ Script for ft-Toolbar
+
+ Create new small(50x50) null layer in top right corner in active comp with orange label,
+ and name it "controller". The source item always stays the same, so there is no mess
+ in project panel with many items like: "Null 1", "Null 2", etc.
+*/
+
+(function () {
+
+// Check if two 2D arrays are equal
+function equalArrs( arr1, arr2 ) {
+ if (arr1.length != arr2.length) {
+ return false;
+ }
+ for (var i = 0, l = arr1.length; i < l; i++) {
+ if (arr1[i] != arr2[i]) {
+ // Don't work with complex types (like objects and arrays)
+ return false;
+ }
+ }
+ return true;
+}
+
+var scriptName = 'newNull';
+
+var name = 'null';
+var label = 12; // Brown label
+
+// Check for selected comp
+var curComp = app.project.activeItem;
+if ((curComp == null) || !(curComp instanceof CompItem)) {
+ alert('There is no active comp.');
+ return;
+}
+
+// Find id of source null, if there is one
+var id;
+var item;
+for (var i = 1, l = app.project.numItems; i <= l; i++) {
+ item = app.project.item(i);
+ if ((item.name == name) &&
+ (item.label == label) &&
+ (item instanceof FootageItem) &&
+ (item.mainSource instanceof SolidSource) &&
+ equalArrs( item.mainSource.color, [1,1,1] ) &&
+ equalArrs( [item.width,item.height], [100,100] )) {
+
+ id = i;
+ break;
+ }
+}
+
+app.beginUndoGroup('ft-Toolbar - ' + scriptName);
+
+// Creating
+var newNull;
+if (id) {
+ // if there is source null in project
+ newNull = curComp.layers.add( app.project.item(id) );
+ newNull.property("ADBE Transform Group").property("ADBE Opacity").setValue(0);
+ newNull.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([0,0]);
+} else {
+ // if there is no null, create new one
+ newNull = curComp.layers.addNull();
+ newNull.source.name = name;
+ newNull.source.label = label;
+ newNull.label = label;
+}
+
+app.endUndoGroup();
+
+})(); // End |
|
54eb6c38881f626216af6762dca5efa3c4b819d4 | ui/src/auth_container_test.jsx | ui/src/auth_container_test.jsx | /* @flow weak */
import React from 'react';
import {shallow} from 'enzyme';
import {expect} from 'chai';
import AuthContainer from './auth_container.jsx';
describe('<AuthContainer />', () => {
// Mock localStorage
beforeEach(() => {
window.localStorage = { getItem(key) { return null; } };
});
it('validateEmail', () => {
const wrapper = shallow(<AuthContainer><div /></AuthContainer>);
expect(wrapper.instance().validateEmail('krob@mit.edu')).to.equal(true);
expect(wrapper.instance().validateEmail('krob@@@xyz')).to.equal(false);
});
});
| Add example of testing a method in a component in isolation | Add example of testing a method in a component in isolation
| JSX | mit | kesiena115/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows | ---
+++
@@ -0,0 +1,20 @@
+/* @flow weak */
+import React from 'react';
+
+import {shallow} from 'enzyme';
+import {expect} from 'chai';
+
+import AuthContainer from './auth_container.jsx';
+
+describe('<AuthContainer />', () => {
+ // Mock localStorage
+ beforeEach(() => {
+ window.localStorage = { getItem(key) { return null; } };
+ });
+
+ it('validateEmail', () => {
+ const wrapper = shallow(<AuthContainer><div /></AuthContainer>);
+ expect(wrapper.instance().validateEmail('krob@mit.edu')).to.equal(true);
+ expect(wrapper.instance().validateEmail('krob@@@xyz')).to.equal(false);
+ });
+}); |