path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
src/parser/monk/brewmaster/modules/spells/GiftOfTheOx.js | fyruna/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import { formatNumber } from 'common/format';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import StatisticBox from 'interface/others/StatisticBox';
import StatTracker from 'parser/shared/modules/StatTracker';
import { calculatePrimaryStat } from 'common/stats';
import { BASE_AGI, GIFT_OF_THE_OX_SPELLS } from '../../constants';
import { GOTOX_GENERATED_EVENT } from '../../normalizers/GiftOfTheOx';
const WDPS_BASE_ILVL = 310;
const WDPS_310_AGI_POLEARM = 122.8;
/**
* Gift of the Ox
*
* Generated healing spheres when struck, which heal for 1.5x AP when
* consumed by walking over, expiration, overcapping, or casting
* Expel Harm.
*
* See peak for a breakdown of how it works and all its quirks:
* https://www.peakofserenity.com/2018/10/06/gift-of-the-ox/
*/
export default class GiftOfTheOx extends Analyzer {
static dependencies = {
stats: StatTracker,
}
totalHealing = 0;
agiBonusHealing = 0;
wdpsBonusHealing = 0;
_baseAgiHealing = 0;
masteryBonusHealing = 0;
_wdps = 0;
orbsGenerated = 0;
orbsConsumed = 0;
expelHarmCasts = 0;
expelHarmOrbsConsumed = 0;
expelHarmOverhealing = 0;
_lastEHTimestamp = null;
constructor(...args) {
super(...args);
this.addEventListener(GOTOX_GENERATED_EVENT, this._orbGenerated);
this.addEventListener(Events.cast.by(SELECTED_PLAYER).spell(SPELLS.EXPEL_HARM), this._expelCast);
this.addEventListener(Events.heal.by(SELECTED_PLAYER).spell(GIFT_OF_THE_OX_SPELLS), this._gotoxHeal);
this._wdps = calculatePrimaryStat(WDPS_BASE_ILVL, WDPS_310_AGI_POLEARM, this.selectedCombatant.mainHand.itemLevel);
}
_orbGenerated(event) {
this.orbsGenerated += 1;
}
_expelCast(event) {
this.expelHarmCasts += 1;
this._lastEHTimestamp = event.timestamp;
}
_gotoxHeal(event) {
this.orbsConsumed += 1;
const amount = event.amount + (event.absorbed || 0);
this.totalHealing += amount;
// so the formula for the healing is
//
// Heal = 1.5 * (6 * WDPS + BonusAgi + BaseAgi) * Mastery * Vers
//
// With BaseAgi known, we get:
//
// BonusHeal = 1.5 * (6 * WDPS + BonusAgi + BaseAgi) * Mastery * Vers - 1.5 * (6 * WDPS + BaseAgi) * Mastery * Vers
// = Heal * (1 - (6 WDPS + BaseAgi) / (6 WDPS + BonusAgi + BaseAgi))
// = Heal * (BonusAgi / (6 WDPS + BonusAgi + BaseAgi))
//
// and similar for bonus WDPS healing and base agi healing
const denom = (6 * this._wdps + this.stats.currentAgilityRating);
this.agiBonusHealing += amount * (this.stats.currentAgilityRating - BASE_AGI) / denom;
this.wdpsBonusHealing += amount * 6 * this._wdps / denom;
this._baseAgiHealing += amount * BASE_AGI / denom;
// MasteryBonusHeal = 1.5 * AP * (1 + BonusMastery + BaseMastery) * Vers - 1.5 * AP * (1 + BaseMastery) * Vers
// = Heal * (1 - (1 + BaseMastery) / (1 + BonusMastery + BaseMastery))
// = Heal * BonusMastery / (1 + BonusMastery + BaseMastery)
this.masteryBonusHealing += amount * (this.stats.currentMasteryPercentage - this.stats.masteryPercentage(0, true)) / (1 + this.stats.currentMasteryPercentage);
if(event.timestamp === this._lastEHTimestamp) {
this.expelHarmOrbsConsumed += 1;
this.expelHarmOverhealing += event.overheal || 0;
}
}
statistic() {
return (
<StatisticBox
icon={<SpellIcon id={GIFT_OF_THE_OX_SPELLS[0].id} />}
label={"Gift of the Ox Healing"}
value={`${formatNumber(this.totalHealing / (this.owner.fightDuration / 1000))} HPS`}
tooltip={(
<>
You generated {formatNumber(this.orbsGenerated)} healing spheres and consumed {formatNumber(this.orbsConsumed)} of them, healing for <b>{formatNumber(this.totalHealing)}</b>.
{formatNumber(this.expelHarmOrbsConsumed)} of these were consumed with Expel Harm over {formatNumber(this.expelHarmCasts)} casts.
</>
)}
/>
);
}
}
|
src/html/tags/HtmlTagImg.js | saketkumar95/zulip-mobile | /* @flow */
import React from 'react';
import { Image, StyleSheet, TouchableWithoutFeedback } from 'react-native';
import { getResource, isEmojiUrl } from '../../utils/url';
import { Auth, Message, PushRouteAction, StyleObj } from '../../types';
import { Touchable } from '../../common';
const styles = StyleSheet.create({
img: {
width: 260,
height: 100,
},
});
export default class HtmlTagImg extends React.PureComponent {
props: {
src: { uri: string, },
auth: Auth,
message: Message,
pushRoute: PushRouteAction,
style: StyleObj,
};
handlePress = (resource: string) => {
const { src, auth, message, pushRoute } = this.props;
if (!isEmojiUrl(src, auth.realm)) {
pushRoute('light-box', { src: resource, message, auth });
}
};
render() {
const { src, style, auth } = this.props;
const resource = getResource(src, auth);
const ContainerComponent = isEmojiUrl ? TouchableWithoutFeedback : Touchable;
return (
<ContainerComponent onPress={() => this.handlePress(resource)}>
<Image source={resource} resizeMode="contain" style={[styles.img, style]} />
</ContainerComponent>
);
}
}
|
packages/ui/lib/components/LibraryListTypeToggle/index.js | nukeop/nuclear | import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'semantic-ui-react';
import { withHandlers } from 'recompose';
import styles from './styles.scss';
export const LIST_TYPE = Object.freeze({
SIMPLE_LIST: 'simple-list',
ALBUM_GRID: 'album-grid',
ALBUM_LIST: 'album-list',
FOLDER_TREE: 'folder-tree'
});
const LibraryListTypeToggle = ({
toggleSimpleList,
toggleAlbumGrid,
// toggleAlbumList,
toggleFolderTree,
listType
}) => (
<Button.Group className={styles.library_list_type_toggle}>
<Button
data-testid='library-list-type-toggle-simple-list'
inverted
icon='unordered list'
onClick={toggleSimpleList}
active={listType === LIST_TYPE.SIMPLE_LIST}
/>
<Button
data-testid='library-list-type-toggle-album-grid'
inverted
icon='th'
onClick={toggleAlbumGrid}
active={listType === LIST_TYPE.ALBUM_GRID}
/>
{
// TODO: To be developed and re-enabled later
// <Button
// inverted icon='bars' onClick={toggleAlbumList}
// active={listType === LIST_TYPE.ALBUM_LIST}
//
// />
}
<Button
data-testid='library-list-type-toggle-folder-tree'
inverted
icon='folder'
onClick={toggleFolderTree}
active={listType === LIST_TYPE.FOLDER_TREE}
/>
</Button.Group>
);
LibraryListTypeToggle.propTypes = {
// eslint-disable-next-line react/no-unused-prop-types
toggleListType: PropTypes.func,
listType: PropTypes.string
};
export default withHandlers({
toggleSimpleList: ({ toggleListType }) => () => toggleListType(LIST_TYPE.SIMPLE_LIST),
toggleAlbumGrid: ({ toggleListType }) => () => toggleListType(LIST_TYPE.ALBUM_GRID),
toggleAlbumList: ({ toggleListType }) => () => toggleListType(LIST_TYPE.ALBUM_LIST),
toggleFolderTree: ({ toggleListType }) => () => toggleListType(LIST_TYPE.FOLDER_TREE)
})(LibraryListTypeToggle);
|
app/components/magnetopause/MagnetopauseSettings.js | sheldhur/Vector | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Modal, Icon, Button, Input, Select, Form } from 'antd';
import * as mainActions from './../../actions/main';
import * as magnetopauseActions from './../../actions/magnetopause';
class MagnetopauseSettings extends Component {
state = {
modalVisible: this.props.modalVisible
};
// componentWillReceiveProps = (nextProps) => {
// if (nextProps.hasOwnProperty('modalVisible')) {
// this.setState({modalVisible: nextProps.modalVisible});
// }
// };
handlerModalOpen = () => {
this.setState({ modalVisible: true });
};
handlerModalClose = (callback) => {
this.setState({ modalVisible: false }, callback);
};
handlerReset = (e) => {
this.handlerModalClose(() => {
this.props.form.resetFields();
});
};
handlerSave = (e) => {
e.preventDefault();
const values = this.props.form.getFieldsValue();
for (const field in values) {
values[field] = values[field] ? parseInt(values[field]) : null;
}
this.props.mainActions.saveSettings({ projectMagnetopause: values }).then(() => {
this.handlerModalClose(() => {
this.props.magnetopauseActions.calculateMagnetopause();
});
});
};
getValidationRules = () => {
const { magnetopause } = this.props;
const { setFieldsValue } = this.props.form;
return {
b: {
initialValue: magnetopause.b ? magnetopause.b.toString() : magnetopause.b,
rules: [{
transform: (value) => {
setFieldsValue({
b: value === undefined ? null : value
});
}
}]
},
bz: {
initialValue: magnetopause.bz ? magnetopause.bz.toString() : magnetopause.bz,
rules: [{
transform: (value) => {
setFieldsValue({
bz: value === undefined ? null : value
});
}
}]
},
pressureSolar: {
initialValue: magnetopause.pressureSolar ? magnetopause.pressureSolar.toString() : magnetopause.pressureSolar,
rules: [{
transform: (value) => {
setFieldsValue({
pressureSolar: value === undefined ? null : value
});
}
}]
},
};
};
render = () => {
const { getFieldError, getFieldValue, setFieldsValue } = this.props.form;
const { settings, dataSets } = this.props;
let rules = {};
if (this.state.modalVisible) {
rules = this.getValidationRules();
}
const wrappedField = (name) => this.props.form.getFieldDecorator(name, rules[name]);
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 14 },
},
};
const DataSetSelector = (props) => (
<Form.Item {...formItemLayout} label={props.label}>
{wrappedField(props.name)(<Select size={this.props.size} allowClear>
{dataSets.map((item) => (
<Select.Option value={item.id.toString()} key={item.id} title={item.name}>
{item.name} ({item.si})
</Select.Option>
))}
</Select>)}
</Form.Item>
);
return (
<Input.Group size={this.props.size} compact>
<Button icon="setting" size={this.props.size} onClick={this.handlerModalOpen} />
<Modal
wrapClassName="main-page-settings magnetopause-view-settings"
width={460}
title={(<span><Icon type="setting" /> Magnetopause settings</span>)}
onCancel={this.handlerReset}
onOk={this.handlerSave}
visible={this.state.modalVisible}
>
<Form>
{DataSetSelector({ name: 'b', label: 'B (nT), GSM' })}
{DataSetSelector({ name: 'bz', label: (<span>B<sub>z</sub> (nT), GSM</span>) })}
{DataSetSelector({ name: 'pressureSolar', label: 'Solar pressure (nPa)' })}
</Form>
</Modal>
</Input.Group>
);
}
}
MagnetopauseSettings.propTypes = {
modalVisible: PropTypes.bool,
};
MagnetopauseSettings.defaultProps = {
modalVisible: false
};
function mapStateToProps(state) {
return {
magnetopause: state.main.settings.projectMagnetopause,
dataSets: Object.values(state.dataSet.dataSets),
};
}
function mapDispatchToProps(dispatch) {
return {
mainActions: bindActionCreators(mainActions, dispatch),
magnetopauseActions: bindActionCreators(magnetopauseActions, dispatch),
};
}
const WrappedSettingsForm = Form.create({
// onFieldsChange: (props, fields) => {
// console.log('onFieldsChange', {props, fields});
// },
})(MagnetopauseSettings);
export default connect(mapStateToProps, mapDispatchToProps)(WrappedSettingsForm);
|
src/components/ContainerDetailsSubheader.react.js | lzbgt/kitematic | import _ from 'underscore';
import React from 'react';
import shell from 'shell';
import metrics from '../utils/MetricsUtil';
import ContainerUtil from '../utils/ContainerUtil';
import classNames from 'classnames';
import containerActions from '../actions/ContainerActions';
import dockerMachineUtil from '../utils/DockerMachineUtil';
var ContainerDetailsSubheader = React.createClass({
contextTypes: {
router: React.PropTypes.func
},
disableRun: function () {
if (!this.props.container) {
return false;
}
return (!this.props.container.State.Running || !this.props.defaultPort || this.props.container.State.Updating);
},
disableRestart: function () {
if (!this.props.container) {
return false;
}
return (this.props.container.State.Downloading || this.props.container.State.Restarting || this.props.container.State.Updating);
},
disableStop: function () {
if (!this.props.container) {
return false;
}
return (this.props.container.State.Downloading || this.props.container.State.ExitCode || !this.props.container.State.Running || this.props.container.State.Updating);
},
disableStart: function () {
if (!this.props.container) {
return false;
}
return (this.props.container.State.Downloading || this.props.container.State.Running || this.props.container.State.Updating);
},
disableTerminal: function () {
if (!this.props.container) {
return false;
}
return (!this.props.container.State.Running || this.props.container.State.Updating);
},
disableTab: function () {
if (!this.props.container) {
return false;
}
return (this.props.container.State.Downloading);
},
showHome: function () {
if (!this.disableTab()) {
metrics.track('Viewed Home', {
from: 'header'
});
this.context.router.transitionTo('containerHome', {name: this.context.router.getCurrentParams().name});
}
},
showSettings: function () {
if (!this.disableTab()) {
metrics.track('Viewed Settings');
this.context.router.transitionTo('containerSettings', {name: this.context.router.getCurrentParams().name});
}
},
handleRun: function () {
if (this.props.defaultPort && !this.disableRun()) {
metrics.track('Opened In Browser', {
from: 'header'
});
shell.openExternal(this.props.ports[this.props.defaultPort].url);
}
},
handleRestart: function () {
if (!this.disableRestart()) {
metrics.track('Restarted Container');
containerActions.restart(this.props.container.Name);
}
},
handleStop: function () {
if (!this.disableStop()) {
metrics.track('Stopped Container');
containerActions.stop(this.props.container.Name);
}
},
handleStart: function () {
if (!this.disableStart()) {
metrics.track('Started Container');
containerActions.start(this.props.container.Name);
}
},
handleDocs: function () {
let repoUri = 'https://hub.docker.com/r/';
let imageName = this.props.container.Config.Image.split(':')[0];
if (imageName.indexOf('/') === -1) {
repoUri = repoUri + 'library/' + imageName;
} else {
repoUri = repoUri + imageName;
}
shell.openExternal(repoUri);
},
handleTerminal: function () {
if (!this.disableTerminal()) {
metrics.track('Terminaled Into Container');
var container = this.props.container;
var shell = ContainerUtil.env(container).reduce((envs, env) => {
envs[env[0]] = env[1];
return envs;
}, {}).SHELL;
if(!shell) {
shell = 'sh';
}
dockerMachineUtil.dockerTerminal(`docker exec -it ${this.props.container.Name} ${shell}`);
}
},
render: function () {
var restartActionClass = classNames({
action: true,
disabled: this.disableRestart()
});
var stopActionClass = classNames({
action: true,
disabled: this.disableStop()
});
var startActionClass = classNames({
action: true,
disabled: this.disableStart()
});
var terminalActionClass = classNames({
action: true,
disabled: this.disableTerminal()
});
var docsActionClass = classNames({
action: true,
disabled: false
});
var currentRoutes = _.map(this.context.router.getCurrentRoutes(), r => r.name);
var currentRoute = _.last(currentRoutes);
var tabHomeClasses = classNames({
'details-tab': true,
'active': currentRoute === 'containerHome',
disabled: this.disableTab()
});
var tabSettingsClasses = classNames({
'details-tab': true,
'active': currentRoutes && (currentRoutes.indexOf('containerSettings') >= 0),
disabled: this.disableTab()
});
var startStopToggle;
if (this.disableStop()) {
startStopToggle = (
<div className={startActionClass}>
<div className="action-icon start" onClick={this.handleStart}><span className="icon icon-start"></span></div>
<div className="btn-label">START</div>
</div>
);
} else {
startStopToggle = (
<div className={stopActionClass}>
<div className="action-icon stop" onClick={this.handleStop}><span className="icon icon-stop"></span></div>
<div className="btn-label">STOP</div>
</div>
);
}
return (
<div className="details-subheader">
<div className="details-header-actions">
{startStopToggle}
<div className={restartActionClass}>
<div className="action-icon" onClick={this.handleRestart}><span className="icon icon-restart"></span></div>
<div className="btn-label">RESTART</div>
</div>
<div className={terminalActionClass}>
<div className="action-icon" onClick={this.handleTerminal}><span className="icon icon-docker-exec"></span></div>
<div className="btn-label">EXEC</div>
</div>
<div className={docsActionClass}>
<div className="action-icon" onClick={this.handleDocs}><span className="icon icon-open-external"></span></div>
<div className="btn-label">DOCS</div>
</div>
</div>
<div className="details-subheader-tabs">
<span className={tabHomeClasses} onClick={this.showHome}>Home</span>
<span className={tabSettingsClasses} onClick={this.showSettings}>Settings</span>
</div>
</div>
);
}
});
module.exports = ContainerDetailsSubheader;
|
src/components/RestaurantViewDetails.js | soyguijarro/lunchroulette | import React from 'react';
import PropTypes from 'prop-types';
import Icon from './Icon';
const RestaurantViewDetails = ({
address, phone, websiteUrl, googlePageUrl, distanceInTime, distanceInSpace
}) => (
<div
className="restaurant__details"
>
<div
className="restaurant__details--top"
>
<div
className="restaurant__details__item"
>
<Icon
className="restaurant__details__item__icon"
name="location_on"
/>
<div
className="restaurant__details__item__text"
>
{address}
</div>
</div>
{ phone &&
<div
className="restaurant__details__item"
>
<Icon
className="restaurant__details__item__icon"
name="phone"
/>
<a
className="restaurant__details__item__text"
href={`tel:${phone.replace(/ /g,'')}`}
>
{phone}
</a>
</div>
}
{ websiteUrl &&
<div
className="restaurant__details__item"
>
<Icon
className="restaurant__details__item__icon"
name="link"
/>
<a
className="restaurant__details__item__text"
href={websiteUrl}
>
{websiteUrl}
</a>
</div>
}
</div>
{ distanceInTime && distanceInSpace &&
<a
className="restaurant__details--bottom"
href={googlePageUrl}
>
<div
className="restaurant__details__item"
>
<Icon
className="restaurant__details__item__icon"
name="directions_walk"
/>
<div
className="restaurant__details__item__text"
>
{distanceInTime} ({distanceInSpace})
</div>
</div>
</a>
}
</div>
);
RestaurantViewDetails.propTypes = {
address: PropTypes.string.isRequired,
phone: PropTypes.string,
websiteUrl: PropTypes.string,
googlePageUrl: PropTypes.string.isRequired,
distanceInTime: PropTypes.string,
distanceInSpace: PropTypes.string
}
export default RestaurantViewDetails;
|
app/components/Progress.js | surrealroad/electron-react-boilerplate | // @flow
import React, { Component } from 'react';
import { ProgressCircle } from 'react-desktop/macOs';
export default class Progress extends Component {
props: {
size: 25,
hidden: boolean
};
render() {
return (
<ProgressCircle size={this.props.size} hidden={this.props.hidden} />
);
}
}
|
app/javascript/mastodon/features/compose/containers/sensitive_button_container.js | ebihara99999/mastodon | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import TextIconButton from '../components/text_icon_button';
import { changeComposeSensitivity } from '../../../actions/compose';
import Motion from 'react-motion/lib/Motion';
import spring from 'react-motion/lib/spring';
import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({
title: { id: 'compose_form.sensitive', defaultMessage: 'Mark media as sensitive' },
});
const mapStateToProps = state => ({
visible: state.getIn(['compose', 'media_attachments']).size > 0,
active: state.getIn(['compose', 'sensitive']),
});
const mapDispatchToProps = dispatch => ({
onClick () {
dispatch(changeComposeSensitivity());
},
});
class SensitiveButton extends React.PureComponent {
static propTypes = {
visible: PropTypes.bool,
active: PropTypes.bool,
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
render () {
const { visible, active, onClick, intl } = this.props;
return (
<Motion defaultStyle={{ scale: 0.87 }} style={{ scale: spring(visible ? 1 : 0.87, { stiffness: 200, damping: 3 }) }}>
{({ scale }) =>
<div style={{ display: visible ? 'block' : 'none', transform: `translateZ(0) scale(${scale})` }}>
<TextIconButton onClick={onClick} label='NSFW' title={intl.formatMessage(messages.title)} active={active} />
</div>
}
</Motion>
);
}
}
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(SensitiveButton));
|
node_modules/react-bootstrap/es/NavItem.js | soniacq/LearningReact | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import SafeAnchor from './SafeAnchor';
import createChainedFunction from './utils/createChainedFunction';
var propTypes = {
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
role: React.PropTypes.string,
href: React.PropTypes.string,
onClick: React.PropTypes.func,
onSelect: React.PropTypes.func,
eventKey: React.PropTypes.any
};
var defaultProps = {
active: false,
disabled: false
};
var NavItem = function (_React$Component) {
_inherits(NavItem, _React$Component);
function NavItem(props, context) {
_classCallCheck(this, NavItem);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.handleClick = _this.handleClick.bind(_this);
return _this;
}
NavItem.prototype.handleClick = function handleClick(e) {
if (this.props.onSelect) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, e);
}
}
};
NavItem.prototype.render = function render() {
var _props = this.props,
active = _props.active,
disabled = _props.disabled,
onClick = _props.onClick,
className = _props.className,
style = _props.style,
props = _objectWithoutProperties(_props, ['active', 'disabled', 'onClick', 'className', 'style']);
delete props.onSelect;
delete props.eventKey;
// These are injected down by `<Nav>` for building `<SubNav>`s.
delete props.activeKey;
delete props.activeHref;
if (!props.role) {
if (props.href === '#') {
props.role = 'button';
}
} else if (props.role === 'tab') {
props['aria-selected'] = active;
}
return React.createElement(
'li',
{
role: 'presentation',
className: classNames(className, { active: active, disabled: disabled }),
style: style
},
React.createElement(SafeAnchor, _extends({}, props, {
disabled: disabled,
onClick: createChainedFunction(onClick, this.handleClick)
}))
);
};
return NavItem;
}(React.Component);
NavItem.propTypes = propTypes;
NavItem.defaultProps = defaultProps;
export default NavItem; |
fields/types/number/NumberColumn.js | nickhsine/keystone | import React from 'react';
import numeral from 'numeral';
import ItemsTableCell from '../../../admin/client/components/ItemsTableCell';
import ItemsTableValue from '../../../admin/client/components/ItemsTableValue';
var NumberColumn = React.createClass({
displayName: 'NumberColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
},
renderValue () {
let value = this.props.data.fields[this.props.col.path];
if (!value || isNaN(value)) return null;
let formattedValue = (this.props.col.path === 'money') ? numeral(value).format('$0,0.00') : value;
return formattedValue;
},
render () {
return (
<ItemsTableCell>
<ItemsTableValue field={this.props.col.type}>
{this.renderValue()}
</ItemsTableValue>
</ItemsTableCell>
);
},
});
module.exports = NumberColumn;
|
react/features/deep-linking/components/NoMobileApp.web.js | gpolitis/jitsi-meet | /* @flow */
import React, { Component } from 'react';
import { createDeepLinkingPageEvent, sendAnalytics } from '../../analytics';
declare var interfaceConfig: Object;
/**
* React component representing no mobile app page.
*
* @class NoMobileApp
*/
export default class NoMobileApp extends Component<*> {
/**
* Implements the Component's componentDidMount method.
*
* @inheritdoc
*/
componentDidMount() {
sendAnalytics(
createDeepLinkingPageEvent(
'displayed', 'noMobileApp', { isMobileBrowser: true }));
}
/**
* Renders the component.
*
* @returns {ReactElement}
*/
render() {
const ns = 'no-mobile-app';
return (
<div className = { ns }>
<h2 className = { `${ns}__title` }>
Video chat isn't available on mobile.
</h2>
<p className = { `${ns}__description` }>
Please use { interfaceConfig.NATIVE_APP_NAME } on desktop to
join calls.
</p>
</div>
);
}
}
|
src/components/Title/Title.story.js | OSBI/saiku-react-starter | /**
* Copyright 2017 OSBI Ltd
*
* 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 { storiesOf } from '@kadira/storybook';
import React from 'react';
import Title from './Title';
const stories = storiesOf('Title', module);
stories.add('without props', () => (
<Title>Main title</Title>
));
|
actor-apps/app-web/src/app/components/modals/MyProfile.react.js | berserkertdl/actor-platform | import React from 'react';
import { KeyCodes } from 'constants/ActorAppConstants';
import MyProfileActions from 'actions/MyProfileActionCreators';
import MyProfileStore from 'stores/MyProfileStore';
import AvatarItem from 'components/common/AvatarItem.react';
import Modal from 'react-modal';
import { Styles, TextField, FlatButton } from 'material-ui';
import ActorTheme from 'constants/ActorTheme';
const ThemeManager = new Styles.ThemeManager();
const getStateFromStores = () => {
return {
profile: MyProfileStore.getProfile(),
name: MyProfileStore.getName(),
nick: MyProfileStore.getNick(),
isOpen: MyProfileStore.isModalOpen()
};
};
class MyProfile extends React.Component {
static childContextTypes = {
muiTheme: React.PropTypes.object
};
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
constructor(props) {
super(props);
this.state = getStateFromStores();
ThemeManager.setTheme(ActorTheme);
ThemeManager.setComponentThemes({
button: {
minWidth: 60
},
textField: {
textColor: 'rgba(0,0,0,.87)',
focusColor: '#68a3e7',
backgroundColor: 'transparent',
borderColor: '#68a3e7',
disabledTextColor: 'rgba(0,0,0,.4)'
}
});
MyProfileStore.addChangeListener(this.onChange);
document.addEventListener('keydown', this.onKeyDown, false);
}
componentWillUnmount() {
MyProfileStore.removeChangeListener(this.onChange);
document.removeEventListener('keydown', this.onKeyDown, false);
}
onClose = () => {
MyProfileActions.hide();
};
onKeyDown = event => {
if (event.keyCode === KeyCodes.ESC) {
event.preventDefault();
this.onClose();
}
};
onChange = () => {
this.setState(getStateFromStores());
};
onNameChange = event => {
this.setState({name: event.target.value});
};
onNicknameChange = event => {
this.setState({nick: event.target.value});
};
onSave = () => {
const { nick, name } = this.state;
MyProfileActions.saveName(name);
MyProfileActions.saveNickname(nick);
this.onClose();
};
render() {
const { isOpen, profile, nick, name } = this.state;
if (profile !== null && isOpen === true) {
return (
<Modal className="modal-new modal-new--profile"
closeTimeoutMS={150}
isOpen={isOpen}
style={{width: 340}}>
<header className="modal-new__header">
<a className="modal-new__header__icon material-icons">person</a>
<h4 className="modal-new__header__title">Profile</h4>
<div className="pull-right">
<FlatButton hoverColor="rgba(74,144,226,.12)"
label="Done"
labelStyle={{padding: '0 8px'}}
onClick={this.onSave}
secondary={true}
style={{marginTop: -6}}/>
</div>
</header>
<div className="modal-new__body row">
<AvatarItem image={profile.bigAvatar}
placeholder={profile.placeholder}
size="big"
title={profile.name}/>
<div className="col-xs">
<div className="name">
<TextField className="login__form__input"
floatingLabelText="Full name"
fullWidth
onChange={this.onNameChange}
type="text"
value={name}/>
</div>
<div className="nick">
<TextField className="login__form__input"
floatingLabelText="Nickname"
fullWidth
onChange={this.onNicknameChange}
type="text"
value={nick}/>
</div>
<div className="phone">
<TextField className="login__form__input"
disabled
floatingLabelText="Phone number"
fullWidth
type="tel"
value={profile.phones[0].number}/>
</div>
</div>
</div>
</Modal>
);
} else {
return null;
}
}
}
export default MyProfile;
|
components/webrtc/SpeechRecognition.js | slidewiki/slidewiki-platform | import PropTypes from 'prop-types';
import React from 'react';
import { Input, Button, Label } from 'semantic-ui-react';
import ISO6391 from 'iso-639-1';
class SpeechRecognition extends React.Component {
/*
Props:
isInitiator - var
sendRTCMessage - func
showInviteModal - func
subtitle - var
*/
constructor(props) {
super(props);
this.state={
speechRecognitionDisabled: false,
subtitle: ''
};
this.recognition = undefined;
}
getSubtitle() {
return this.state.subtitle;
}
componentDidUpdate() {
$('#input_subtitle').animate({
scrollLeft: $('#input_subtitle')[0].scrollLeft+1000
}, 1000);
}
componentWillReceiveProps(nextProps) {
if(this.state.subtitle !== nextProps.subtitle && nextProps.subtitle !== '')
this.setState({subtitle: nextProps.subtitle});
}
activateSpeechRecognition() {
console.log('Activating Speech Recognition...');
let that = this;
let final_transcript = '';
let first_char = /\S/;
function capitalize(s) {
return s.replace(first_char, (m) => {
return m.toUpperCase();
});
}
if (window.hasOwnProperty('webkitSpeechRecognition')) {
that.recognition = new webkitSpeechRecognition();
} else if (window.hasOwnProperty('SpeechRecognition')) {
that.recognition = new SpeechRecognition();
}
if (that.recognition) {
that.recognition.continuous = true;
that.recognition.interimResults = true;
that.recognition.lang = navigator.language || navigator.userLanguage;
that.recognition.maxAlternatives = 0;
that.recognition.start();
that.recognition.onresult = function (event) {
let interim_transcript = '';
if (typeof (event.results) == 'undefined') {
that.recognition.onend = null;
that.recognition.stop();
console.warn('error:', e);
swal({
titleText: 'Speech recognition disabled',
text: 'There was an error with the speech recognition API. This should be an edge case. You may restart it.',
type: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Enable again',
cancelButtonText: 'Keep it disabled',
allowOutsideClick: false,
allowEscapeKey: false,
}).then(() => {}, (dismiss) => {
if (dismiss === 'cancel') {
that.recognition.start();
}
}).then(() => {
});
return;
}
for (let i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
final_transcript += event.results[i][0].transcript;
} else {
interim_transcript += event.results[i][0].transcript;
}
}
final_transcript = capitalize(final_transcript);
// console.log('Final text: ', final_transcript);
// console.log('Interim text: ', interim_transcript);
let m = (final_transcript || interim_transcript);
let tosend = m.substr((m.length-300) > 0 ? m.length-300 : 0, 300);
that.props.sendRTCMessage('subtitle', tosend);
that.setState({subtitle: tosend});
};
that.recognition.onerror = function (e) {
if(e.type === 'error' && e.error !== 'no-speech'){
console.log('SpeechRecognition error: ', e);
that.disableSpeechRecognition(that);
swal({
titleText: 'Speech recognition disabled',
text: 'An error occured and we had to disable speech recognition. We are sorry about it, but speech recognition is a highly experimental feature. Your listeners will not recieve any transcript anymore.',
type: 'error',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Okay',
allowOutsideClick: false,
allowEscapeKey: false
});
} else
that.recognition.stop();
};
that.recognition.onend = function (e) {
if(!that.state.speechRecognitionDisabled){
console.warn('Recognition ended itself - stupid thing! Restarting ....', e);
that.recognition.start();
} else {
//TODO in StatusObjekt packen
}
};
let tmp = {};
ISO6391.getAllCodes().forEach((code) => {
tmp[''+code] = ISO6391.getName(code);
});
swal({
titleText: 'Speech recognition enabled',
html: '<p>Speech recognition is an experimental feature. If enabled, your voice will be automatically transcribed and displayed at all participants as a transcript.</p><p>Please select the language in which you will talk or disable the feature.</p>',
type: 'info',
input: 'select',
inputValue: that.recognition.lang,
inputOptions: tmp,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Okay',
cancelButtonText: 'Disable',
allowOutsideClick: false,
allowEscapeKey: false,
preConfirm: function (lang) {
return new Promise((resolve, reject) => {
that.recognition.lang = lang;
resolve();
});
}
}).then(() => {}, (dismiss) => {
if (dismiss === 'cancel') {
that.disableSpeechRecognition(that);
console.log('Recognition disabled');
}
}).then(() => {
that.props.showInviteModal();
});
} else {
swal({
titleText: 'Speech recognition disabled',
text: 'Your browser isn\'t able to transcribe speech to text. Thus, your participants will not recieve a transcript. Google Chrome is currently the only browser that supports speech recognition.',
type: 'error',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Okay',
allowOutsideClick: false,
allowEscapeKey: false
}).then(() => {
that.disableSpeechRecognition(that);
that.props.showInviteModal();
});
}
}
showStopSpeechRecognitionModal() {
swal({
titleText: 'Disable Speech Recognition',
text: 'You will deactivate speech recognition for this presentation. You will not be able to turn it back on.',
type: 'warning',
confirmButtonColor: '#3085d6',
confirmButtonText: 'Disable',
showCancelButton: true,
cancelButtonColor: '#d33',
allowOutsideClick: false,
allowEscapeKey: false
}).then(() => {
this.disableSpeechRecognition(this);
}, () => {});
}
disableSpeechRecognition(context) {
context.setState({speechRecognitionDisabled: true});
if(context.recognition)
context.recognition.stop();
context.setState((prevState) => {
return {subtitle: prevState.subtitle + '...Speechrecognition has been disabled'};
});
context.props.sendRTCMessage('subtitle', this.state.subtitle);
}
render() {
return (
<div>
<Label pointing='below'>Automatically generated transcript</Label>
<Input labelPosition='left' type='text' fluid>
<Label>Transcript:</Label>
<input id="input_subtitle" disabled style={{opacity: 1}} placeholder='...' value={this.state.subtitle}/>
{this.props.isInitiator ? (<Button color='red' icon='stop' disabled={this.state.speechRecognitionDisabled ? true : false} onClick={this.showStopSpeechRecognitionModal.bind(this)}/>) : ('')}
</Input>
</div>
);
}
}
SpeechRecognition.contextTypes = {
executeAction: PropTypes.func.isRequired
};
export default SpeechRecognition;
|
Libraries/Components/TextInput/InputAccessoryView.js | exponent/react-native | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
const Platform = require('../../Utilities/Platform');
const React = require('react');
const StyleSheet = require('../../StyleSheet/StyleSheet');
import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
/**
* Note: iOS only
*
* A component which enables customization of the keyboard input accessory view.
* The input accessory view is displayed above the keyboard whenever a TextInput
* has focus. This component can be used to create custom toolbars.
*
* To use this component wrap your custom toolbar with the
* InputAccessoryView component, and set a nativeID. Then, pass that nativeID
* as the inputAccessoryViewID of whatever TextInput you desire. A simple
* example:
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react';
* import { AppRegistry, TextInput, InputAccessoryView, Button } from 'react-native';
*
* export default class UselessTextInput extends Component {
* constructor(props) {
* super(props);
* this.state = {text: 'Placeholder Text'};
* }
*
* render() {
* const inputAccessoryViewID = "uniqueID";
* return (
* <View>
* <ScrollView keyboardDismissMode="interactive">
* <TextInput
* style={{
* padding: 10,
* paddingTop: 50,
* }}
* inputAccessoryViewID=inputAccessoryViewID
* onChangeText={text => this.setState({text})}
* value={this.state.text}
* />
* </ScrollView>
* <InputAccessoryView nativeID=inputAccessoryViewID>
* <Button
* onPress={() => this.setState({text: 'Placeholder Text'})}
* title="Reset Text"
* />
* </InputAccessoryView>
* </View>
* );
* }
* }
*
* // skip this line if using Create React Native App
* AppRegistry.registerComponent('AwesomeProject', () => UselessTextInput);
* ```
*
* This component can also be used to create sticky text inputs (text inputs
* which are anchored to the top of the keyboard). To do this, wrap a
* TextInput with the InputAccessoryView component, and don't set a nativeID.
* For an example, look at InputAccessoryViewExample.js in RNTester.
*/
type Props = $ReadOnly<{|
+children: React.Node,
/**
* An ID which is used to associate this `InputAccessoryView` to
* specified TextInput(s).
*/
nativeID?: ?string,
style?: ?ViewStyleProp,
backgroundColor?: ?ColorValue,
|}>;
class InputAccessoryView extends React.Component<Props> {
render(): React.Node {
if (Platform.OS !== 'ios') {
console.warn('<InputAccessoryView> is only supported on iOS.');
}
if (React.Children.count(this.props.children) === 0) {
return null;
}
return (
<RCTInputAccessoryViewNativeComponent
style={[this.props.style, styles.container]}
nativeID={this.props.nativeID}
backgroundColor={this.props.backgroundColor}>
{this.props.children}
</RCTInputAccessoryViewNativeComponent>
);
}
}
const styles = StyleSheet.create({
container: {
position: 'absolute',
},
});
module.exports = InputAccessoryView;
|
react-router-tutorial/lessons/05-active-links/modules/Repos.js | zerotung/practices-and-notes | import React from 'react'
export default React.createClass({
render() {
return <div>Repos</div>
}
})
|
index.js | zuhairp/LearningSpace | import React from 'react';
import ReactDOM from 'react-dom';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import OptionsScreen from './scenes/OptionsScreen';
import VRScene from './scenes/VRScene';
import getFlashcards from './utils/flashcards';
class Application extends React.Component {
constructor(props){
super(props);
this.state = {terms: [], page: 'options'};
}
optionsChanged(options){
console.log(options);
this.setState({index: options.selected_scene_index});
getFlashcards(options.quizlet_set.value)
.then(response => {
console.log("RESPONSE");
console.log(response);
this.setState({terms: response, page: 'vr'});
})
}
render () {
if (this.state.page === 'options'){
return <OptionsScreen optionsChanged={this.optionsChanged.bind(this)} />
}
else if (this.state.page === 'vr'){
return (
<VRScene sceneIndex={this.state.index} />
);
}
}
}
const App = () => (
<MuiThemeProvider>
<Application />
</MuiThemeProvider>
)
ReactDOM.render(<App />, document.querySelector('.scene-container'));
|
src/widgets/modalChildren/BreachDisplay.js | sussol/mobile | /* eslint-disable react/forbid-prop-types */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2020
*/
import React from 'react';
import { connect } from 'react-redux';
import { View, FlatList, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
import { getPageInfoColumns } from '../../pages/dataTableUtilities';
import { BreachChart } from '../BreachChart';
import { PageInfo } from '../PageInfo/PageInfo';
import { WHITE } from '../../globalStyles';
const Breach = ({ breach, getInfoColumns }) => {
const { temperatureLogs } = breach;
const lineData = temperatureLogs.map(log => {
const { timestamp, temperature } = log;
return { timestamp, temperature };
});
return (
<View style={localStyles.container}>
<PageInfo columns={getInfoColumns(breach)} />
<BreachChart breach={breach} lineData={lineData} />
</View>
);
};
Breach.propTypes = {
breach: PropTypes.object.isRequired,
getInfoColumns: PropTypes.func.isRequired,
};
const mapStateToProps = state => {
const { breach } = state;
const { breaches } = breach;
return { breaches };
};
const BreachDisplayComponent = ({ breaches }) => {
const getBreachPageInfoColumns = React.useMemo(() => getPageInfoColumns('breach'), []);
const renderItem = React.useCallback(
({ item }) => <Breach getInfoColumns={getBreachPageInfoColumns} breach={item} />,
[breaches]
);
return <FlatList data={breaches} renderItem={renderItem} />;
};
BreachDisplayComponent.propTypes = {
breaches: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
};
export const BreachDisplay = connect(mapStateToProps)(BreachDisplayComponent);
const localStyles = StyleSheet.create({
container: {
height: 400,
elevation: 3,
borderRadius: 5,
marginHorizontal: 20,
marginVertical: 20,
backgroundColor: WHITE,
padding: 10,
},
});
|
src/pages/writing.js | mattmischuk/m1x | // @flow
import React from 'react'
import { UnstyledList } from '../components/typography'
import { PostTitle, PostGroup, PostLink } from '../scenes/feed'
type Props = {
data: Object,
}
const WritingIndex = ({ data }: Props) => {
const { allMarkdownRemark } = data
const { edges } = allMarkdownRemark
const Posts = edges
.filter(edge => !!edge.node.frontmatter.date)
.map(edge => (
<PostLink
key={edge.node.id}
to={edge.node.frontmatter.path}
title={edge.node.frontmatter.title}
date={edge.node.frontmatter.date}
/>
))
return (
<PostGroup>
<PostTitle>Writing</PostTitle>
<UnstyledList>{Posts}</UnstyledList>
</PostGroup>
)
}
export default WritingIndex
// $FlowFixMe
export const pageQuery = graphql`
query WritingIndex {
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {
edges {
node {
id
frontmatter {
date(formatString: "MMMM YYYY")
path
title
}
}
}
}
}
`
|
src/js/playground/QuickStart.js | ludonow/ludo-beta-react | import React from 'react';
import { Link } from "react-router";
import styled from 'styled-components';
import { baseUrl } from '../baseurl-config';
import createIcon from '../../images/create.png';
const StyledLink = styled(Link)`
color: black;
text-decoration: none;
`;
const QuickStartCard = styled.div`
background-color: white;
box-shadow: 0px, 1px, 2px, 0px, rgba(0, 0, 0, 0.2);
height: 60%;
padding: 5px 0;
width: 200px;
&:hover {
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.19);
transition-duration: 0.3s;
}
`;
const QuickStartImageWrapper = styled.div`
align-items: center;
background: #fff;
border-radius: 50%;
box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.8);
color: black;
display: flex;
height: 50px;
justify-content: center;
line-height: 50px;
margin: 0 auto;
text-align: center;
width: 50px;
`;
/* components/_card.scss */
const QuickStart = () => (
<div className="grid-item">
<StyledLink to={`${baseUrl}/create`}>
<QuickStartCard className="card--playground">
<QuickStartImageWrapper>
<img src={createIcon} />
</QuickStartImageWrapper>
</QuickStartCard>
</StyledLink>
</div>
);
export default QuickStart;
|
example-slack-message/src/SlackBubble.js | atFriendly/react-native-friendly-chat | /* eslint-disable no-underscore-dangle, no-use-before-define */
import React from 'react';
import {
Text,
Clipboard,
StyleSheet,
TouchableOpacity,
View,
ViewPropTypes,
Platform,
} from 'react-native';
import { MessageText, MessageImage, Time, utils } from 'react-native-gifted-chat';
const { isSameUser, isSameDay } = utils;
export default class Bubble extends React.Component {
constructor(props) {
super(props);
this.onLongPress = this.onLongPress.bind(this);
}
onLongPress() {
if (this.props.onLongPress) {
this.props.onLongPress(this.context);
} else if (this.props.currentMessage.text) {
const options = [
'Copy Text',
'Cancel',
];
const cancelButtonIndex = options.length - 1;
this.context.actionSheet().showActionSheetWithOptions(
{ options, cancelButtonIndex },
(buttonIndex) => {
if (buttonIndex === 0) {
Clipboard.setString(this.props.currentMessage.text);
}
});
}
}
renderMessageText() {
if (this.props.currentMessage.text) {
const { containerStyle, wrapperStyle, messageTextStyle, ...messageTextProps } = this.props;
if (this.props.renderMessageText) {
return this.props.renderMessageText(messageTextProps);
}
return (
<MessageText
{...messageTextProps}
textStyle={{
left: [styles.standardFont, styles.slackMessageText, messageTextProps.textStyle, messageTextStyle],
}}
/>
);
}
return null;
}
renderMessageImage() {
if (this.props.currentMessage.image) {
const { containerStyle, wrapperStyle, ...messageImageProps } = this.props;
if (this.props.renderMessageImage) {
return this.props.renderMessageImage(messageImageProps);
}
return <MessageImage {...messageImageProps} imageStyle={[styles.slackImage, messageImageProps.imageStyle]} />;
}
return null;
}
renderTicks() {
const { currentMessage } = this.props;
if (this.props.renderTicks) {
return this.props.renderTicks(currentMessage);
}
if (currentMessage.user._id !== this.props.user._id) {
return null;
}
if (currentMessage.sent || currentMessage.received) {
return (
<View style={[styles.headerItem, styles.tickView]}>
{currentMessage.sent && <Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>}
{currentMessage.received && <Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>}
</View>
);
}
return null;
}
renderUsername() {
const username = this.props.currentMessage.user.name;
if (username) {
const { containerStyle, wrapperStyle, ...usernameProps } = this.props;
if (this.props.renderUsername) {
return this.props.renderUsername(usernameProps);
}
return (
<Text style={[styles.standardFont, styles.headerItem, styles.username, this.props.usernameStyle]}>
{username}
</Text>
);
}
return null;
}
renderTime() {
if (this.props.currentMessage.createdAt) {
const { containerStyle, wrapperStyle, ...timeProps } = this.props;
if (this.props.renderTime) {
return this.props.renderTime(timeProps);
}
return (
<Time
{...timeProps}
containerStyle={{ left: [styles.timeContainer] }}
textStyle={{ left: [styles.standardFont, styles.headerItem, styles.time, timeProps.textStyle] }}
/>
);
}
return null;
}
renderCustomView() {
if (this.props.renderCustomView) {
return this.props.renderCustomView(this.props);
}
return null;
}
render() {
const isSameThread = isSameUser(this.props.currentMessage, this.props.previousMessage)
&& isSameDay(this.props.currentMessage, this.props.previousMessage);
const messageHeader = isSameThread ? null : (
<View style={styles.headerView}>
{this.renderUsername()}
{this.renderTime()}
{this.renderTicks()}
</View>
);
return (
<View style={[styles.container, this.props.containerStyle]}>
<TouchableOpacity
onLongPress={this.onLongPress}
accessibilityTraits="text"
{...this.props.touchableProps}
>
<View
style={[
styles.wrapper,
this.props.wrapperStyle,
]}
>
<View>
{this.renderCustomView()}
{messageHeader}
{this.renderMessageImage()}
{this.renderMessageText()}
</View>
</View>
</TouchableOpacity>
</View>
);
}
}
// Note: Everything is forced to be "left" positioned with this component.
// The "right" position is only used in the default Bubble.
const styles = StyleSheet.create({
standardFont: {
fontSize: 15,
},
slackMessageText: {
marginLeft: 0,
marginRight: 0,
},
container: {
flex: 1,
alignItems: 'flex-start',
},
wrapper: {
marginRight: 60,
minHeight: 20,
justifyContent: 'flex-end',
},
username: {
fontWeight: 'bold',
},
time: {
textAlign: 'left',
fontSize: 12,
},
timeContainer: {
marginLeft: 0,
marginRight: 0,
marginBottom: 0,
},
headerItem: {
marginRight: 10,
},
headerView: {
// Try to align it better with the avatar on Android.
marginTop: Platform.OS === 'android' ? -2 : 0,
flexDirection: 'row',
alignItems: 'baseline',
},
/* eslint-disable react-native/no-color-literals */
tick: {
backgroundColor: 'transparent',
color: 'white',
},
/* eslint-enable react-native/no-color-literals */
tickView: {
flexDirection: 'row',
},
slackImage: {
borderRadius: 3,
marginLeft: 0,
marginRight: 0,
},
});
Bubble.contextTypes = {
actionSheet: React.PropTypes.func,
};
Bubble.defaultProps = {
touchableProps: {},
onLongPress: null,
renderMessageImage: null,
renderMessageText: null,
renderCustomView: null,
renderTime: null,
currentMessage: {
text: null,
createdAt: null,
image: null,
},
nextMessage: {},
previousMessage: {},
containerStyle: {},
wrapperStyle: {},
tickStyle: {},
containerToNextStyle: {},
containerToPreviousStyle: {},
};
Bubble.propTypes = {
touchableProps: React.PropTypes.object,
onLongPress: React.PropTypes.func,
renderMessageImage: React.PropTypes.func,
renderMessageText: React.PropTypes.func,
renderCustomView: React.PropTypes.func,
renderUsername: React.PropTypes.func,
renderTime: React.PropTypes.func,
renderTicks: React.PropTypes.func,
currentMessage: React.PropTypes.object,
nextMessage: React.PropTypes.object,
previousMessage: React.PropTypes.object,
user: React.PropTypes.object,
containerStyle: React.PropTypes.shape({
left: ViewPropTypes.style,
right: ViewPropTypes.style,
}),
wrapperStyle: React.PropTypes.shape({
left: ViewPropTypes.style,
right: ViewPropTypes.style,
}),
messageTextStyle: Text.propTypes.style,
usernameStyle: Text.propTypes.style,
tickStyle: Text.propTypes.style,
containerToNextStyle: React.PropTypes.shape({
left: ViewPropTypes.style,
right: ViewPropTypes.style,
}),
containerToPreviousStyle: React.PropTypes.shape({
left: ViewPropTypes.style,
right: ViewPropTypes.style,
}),
};
|
Libraries/Components/WebView/WebView.ios.js | tadeuzagallo/react-native | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule WebView
* @noflow
*/
'use strict';
var ActivityIndicator = require('ActivityIndicator');
var EdgeInsetsPropType = require('EdgeInsetsPropType');
var React = require('React');
var ReactNative = require('ReactNative');
var StyleSheet = require('StyleSheet');
var Text = require('Text');
var UIManager = require('UIManager');
var View = require('View');
var ScrollView = require('ScrollView');
var deprecatedPropType = require('deprecatedPropType');
var invariant = require('fbjs/lib/invariant');
var keyMirror = require('fbjs/lib/keyMirror');
var processDecelerationRate = require('processDecelerationRate');
var requireNativeComponent = require('requireNativeComponent');
var resolveAssetSource = require('resolveAssetSource');
var PropTypes = React.PropTypes;
var RCTWebViewManager = require('NativeModules').WebViewManager;
var BGWASH = 'rgba(255,255,255,0.8)';
var RCT_WEBVIEW_REF = 'webview';
var WebViewState = keyMirror({
IDLE: null,
LOADING: null,
ERROR: null,
});
const NavigationType = keyMirror({
click: true,
formsubmit: true,
backforward: true,
reload: true,
formresubmit: true,
other: true,
});
const JSNavigationScheme = 'react-js-navigation';
type ErrorEvent = {
domain: any,
code: any,
description: any,
}
type Event = Object;
const DataDetectorTypes = [
'phoneNumber',
'link',
'address',
'calendarEvent',
'none',
'all',
];
var defaultRenderLoading = () => (
<View style={styles.loadingView}>
<ActivityIndicator />
</View>
);
var defaultRenderError = (errorDomain, errorCode, errorDesc) => (
<View style={styles.errorContainer}>
<Text style={styles.errorTextTitle}>
Error loading page
</Text>
<Text style={styles.errorText}>
{'Domain: ' + errorDomain}
</Text>
<Text style={styles.errorText}>
{'Error Code: ' + errorCode}
</Text>
<Text style={styles.errorText}>
{'Description: ' + errorDesc}
</Text>
</View>
);
/**
* `WebView` renders web content in a native view.
*
*```
* import React, { Component } from 'react';
* import { WebView } from 'react-native';
*
* class MyWeb extends Component {
* render() {
* return (
* <WebView
* source={{uri: 'https://github.com/facebook/react-native'}}
* style={{marginTop: 20}}
* />
* );
* }
* }
*```
*
* You can use this component to navigate back and forth in the web view's
* history and configure various properties for the web content.
*/
class WebView extends React.Component {
static JSNavigationScheme = JSNavigationScheme;
static NavigationType = NavigationType;
static propTypes = {
...View.propTypes,
html: deprecatedPropType(
PropTypes.string,
'Use the `source` prop instead.'
),
url: deprecatedPropType(
PropTypes.string,
'Use the `source` prop instead.'
),
/**
* Loads static html or a uri (with optional headers) in the WebView.
*/
source: PropTypes.oneOfType([
PropTypes.shape({
/*
* The URI to load in the `WebView`. Can be a local or remote file.
*/
uri: PropTypes.string,
/*
* The HTTP Method to use. Defaults to GET if not specified.
* NOTE: On Android, only GET and POST are supported.
*/
method: PropTypes.string,
/*
* Additional HTTP headers to send with the request.
* NOTE: On Android, this can only be used with GET requests.
*/
headers: PropTypes.object,
/*
* The HTTP body to send with the request. This must be a valid
* UTF-8 string, and will be sent exactly as specified, with no
* additional encoding (e.g. URL-escaping or base64) applied.
* NOTE: On Android, this can only be used with POST requests.
*/
body: PropTypes.string,
}),
PropTypes.shape({
/*
* A static HTML page to display in the WebView.
*/
html: PropTypes.string,
/*
* The base URL to be used for any relative links in the HTML.
*/
baseUrl: PropTypes.string,
}),
/*
* Used internally by packager.
*/
PropTypes.number,
]),
/**
* Function that returns a view to show if there's an error.
*/
renderError: PropTypes.func, // view to show if there's an error
/**
* Function that returns a loading indicator.
*/
renderLoading: PropTypes.func,
/**
* Function that is invoked when the `WebView` has finished loading.
*/
onLoad: PropTypes.func,
/**
* Function that is invoked when the `WebView` load succeeds or fails.
*/
onLoadEnd: PropTypes.func,
/**
* Function that is invoked when the `WebView` starts loading.
*/
onLoadStart: PropTypes.func,
/**
* Function that is invoked when the `WebView` load fails.
*/
onError: PropTypes.func,
/**
* Boolean value that determines whether the web view bounces
* when it reaches the edge of the content. The default value is `true`.
* @platform ios
*/
bounces: PropTypes.bool,
/**
* A floating-point number that determines how quickly the scroll view
* decelerates after the user lifts their finger. You may also use the
* string shortcuts `"normal"` and `"fast"` which match the underlying iOS
* settings for `UIScrollViewDecelerationRateNormal` and
* `UIScrollViewDecelerationRateFast` respectively:
*
* - normal: 0.998
* - fast: 0.99 (the default for iOS web view)
* @platform ios
*/
decelerationRate: ScrollView.propTypes.decelerationRate,
/**
* Boolean value that determines whether scrolling is enabled in the
* `WebView`. The default value is `true`.
* @platform ios
*/
scrollEnabled: PropTypes.bool,
/**
* Controls whether to adjust the content inset for web views that are
* placed behind a navigation bar, tab bar, or toolbar. The default value
* is `true`.
*/
automaticallyAdjustContentInsets: PropTypes.bool,
/**
* The amount by which the web view content is inset from the edges of
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
*/
contentInset: EdgeInsetsPropType,
/**
* Function that is invoked when the `WebView` loading starts or ends.
*/
onNavigationStateChange: PropTypes.func,
/**
* A function that is invoked when the webview calls `window.postMessage`.
* Setting this property will inject a `postMessage` global into your
* webview, but will still call pre-existing values of `postMessage`.
*
* `window.postMessage` accepts one argument, `data`, which will be
* available on the event object, `event.nativeEvent.data`. `data`
* must be a string.
*/
onMessage: PropTypes.func,
/**
* Boolean value that forces the `WebView` to show the loading view
* on the first load.
*/
startInLoadingState: PropTypes.bool,
/**
* The style to apply to the `WebView`.
*/
style: View.propTypes.style,
/**
* Determines the types of data converted to clickable URLs in the web view’s content.
* By default only phone numbers are detected.
*
* You can provide one type or an array of many types.
*
* Possible values for `dataDetectorTypes` are:
*
* - `'phoneNumber'`
* - `'link'`
* - `'address'`
* - `'calendarEvent'`
* - `'none'`
* - `'all'`
*
* @platform ios
*/
dataDetectorTypes: PropTypes.oneOfType([
PropTypes.oneOf(DataDetectorTypes),
PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)),
]),
/**
* Boolean value to enable JavaScript in the `WebView`. Used on Android only
* as JavaScript is enabled by default on iOS. The default value is `true`.
* @platform android
*/
javaScriptEnabled: PropTypes.bool,
/**
* Boolean value to control whether DOM Storage is enabled. Used only in
* Android.
* @platform android
*/
domStorageEnabled: PropTypes.bool,
/**
* Set this to provide JavaScript that will be injected into the web page
* when the view loads.
*/
injectedJavaScript: PropTypes.string,
/**
* Sets the user-agent for the `WebView`.
* @platform android
*/
userAgent: PropTypes.string,
/**
* Boolean that controls whether the web content is scaled to fit
* the view and enables the user to change the scale. The default value
* is `true`.
*/
scalesPageToFit: PropTypes.bool,
/**
* Function that allows custom handling of any web view requests. Return
* `true` from the function to continue loading the request and `false`
* to stop loading.
* @platform ios
*/
onShouldStartLoadWithRequest: PropTypes.func,
/**
* Boolean that determines whether HTML5 videos play inline or use the
* native full-screen controller. The default value is `false`.
*
* **NOTE** : In order for video to play inline, not only does this
* property need to be set to `true`, but the video element in the HTML
* document must also include the `webkit-playsinline` attribute.
* @platform ios
*/
allowsInlineMediaPlayback: PropTypes.bool,
/**
* Boolean that determines whether HTML5 audio and video requires the user
* to tap them before they start playing. The default value is `true`.
*/
mediaPlaybackRequiresUserAction: PropTypes.bool,
};
state = {
viewState: WebViewState.IDLE,
lastErrorEvent: (null: ?ErrorEvent),
startInLoadingState: true,
};
componentWillMount() {
if (this.props.startInLoadingState) {
this.setState({viewState: WebViewState.LOADING});
}
}
render() {
var otherView = null;
if (this.state.viewState === WebViewState.LOADING) {
otherView = (this.props.renderLoading || defaultRenderLoading)();
} else if (this.state.viewState === WebViewState.ERROR) {
var errorEvent = this.state.lastErrorEvent;
invariant(
errorEvent != null,
'lastErrorEvent expected to be non-null'
);
otherView = (this.props.renderError || defaultRenderError)(
errorEvent.domain,
errorEvent.code,
errorEvent.description
);
} else if (this.state.viewState !== WebViewState.IDLE) {
console.error(
'RCTWebView invalid state encountered: ' + this.state.loading
);
}
var webViewStyles = [styles.container, styles.webView, this.props.style];
if (this.state.viewState === WebViewState.LOADING ||
this.state.viewState === WebViewState.ERROR) {
// if we're in either LOADING or ERROR states, don't show the webView
webViewStyles.push(styles.hidden);
}
var onShouldStartLoadWithRequest = this.props.onShouldStartLoadWithRequest && ((event: Event) => {
var shouldStart = this.props.onShouldStartLoadWithRequest &&
this.props.onShouldStartLoadWithRequest(event.nativeEvent);
RCTWebViewManager.startLoadWithResult(!!shouldStart, event.nativeEvent.lockIdentifier);
});
var decelerationRate = processDecelerationRate(this.props.decelerationRate);
var source = this.props.source || {};
if (this.props.html) {
source.html = this.props.html;
} else if (this.props.url) {
source.uri = this.props.url;
}
const messagingEnabled = typeof this.props.onMessage === 'function';
var webView =
<RCTWebView
ref={RCT_WEBVIEW_REF}
key="webViewKey"
style={webViewStyles}
source={resolveAssetSource(source)}
injectedJavaScript={this.props.injectedJavaScript}
bounces={this.props.bounces}
scrollEnabled={this.props.scrollEnabled}
decelerationRate={decelerationRate}
contentInset={this.props.contentInset}
automaticallyAdjustContentInsets={this.props.automaticallyAdjustContentInsets}
onLoadingStart={this._onLoadingStart}
onLoadingFinish={this._onLoadingFinish}
onLoadingError={this._onLoadingError}
messagingEnabled={messagingEnabled}
onMessage={this._onMessage}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
scalesPageToFit={this.props.scalesPageToFit}
allowsInlineMediaPlayback={this.props.allowsInlineMediaPlayback}
mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction}
dataDetectorTypes={this.props.dataDetectorTypes}
/>;
return (
<View style={styles.container}>
{webView}
{otherView}
</View>
);
}
/**
* Go forward one page in the web view's history.
*/
goForward = () => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.goForward,
null
);
};
/**
* Go back one page in the web view's history.
*/
goBack = () => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.goBack,
null
);
};
/**
* Reloads the current page.
*/
reload = () => {
this.setState({viewState: WebViewState.LOADING});
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.reload,
null
);
};
/**
* Stop loading the current page.
*/
stopLoading = () => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.stopLoading,
null
);
};
/**
* Posts a message to the web view, which will emit a `message` event.
* Accepts one argument, `data`, which must be a string.
*
* In your webview, you'll need to something like the following.
*
* ```js
* document.addEventListener('message', e => { document.title = e.data; });
* ```
*/
postMessage = (data) => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.postMessage,
[String(data)]
);
};
/**
* Injects a javascript string into the referenced WebView. Deliberately does not
* return a response because using eval() to return a response breaks this method
* on pages with a Content Security Policy that disallows eval(). If you need that
* functionality, look into postMessage/onMessage.
*/
injectJavaScript = (data) => {
UIManager.dispatchViewManagerCommand(
this.getWebViewHandle(),
UIManager.RCTWebView.Commands.injectJavaScript,
[data]
);
};
/**
* We return an event with a bunch of fields including:
* url, title, loading, canGoBack, canGoForward
*/
_updateNavigationState = (event: Event) => {
if (this.props.onNavigationStateChange) {
this.props.onNavigationStateChange(event.nativeEvent);
}
};
/**
* Returns the native `WebView` node.
*/
getWebViewHandle = (): any => {
return ReactNative.findNodeHandle(this.refs[RCT_WEBVIEW_REF]);
};
_onLoadingStart = (event: Event) => {
var onLoadStart = this.props.onLoadStart;
onLoadStart && onLoadStart(event);
this._updateNavigationState(event);
};
_onLoadingError = (event: Event) => {
event.persist(); // persist this event because we need to store it
var {onError, onLoadEnd} = this.props;
onError && onError(event);
onLoadEnd && onLoadEnd(event);
console.warn('Encountered an error loading page', event.nativeEvent);
this.setState({
lastErrorEvent: event.nativeEvent,
viewState: WebViewState.ERROR
});
};
_onLoadingFinish = (event: Event) => {
var {onLoad, onLoadEnd} = this.props;
onLoad && onLoad(event);
onLoadEnd && onLoadEnd(event);
this.setState({
viewState: WebViewState.IDLE,
});
this._updateNavigationState(event);
};
_onMessage = (event: Event) => {
var {onMessage} = this.props;
onMessage && onMessage(event);
}
}
var RCTWebView = requireNativeComponent('RCTWebView', WebView, {
nativeOnly: {
onLoadingStart: true,
onLoadingError: true,
onLoadingFinish: true,
onMessage: true,
messagingEnabled: PropTypes.bool,
},
});
var styles = StyleSheet.create({
container: {
flex: 1,
},
errorContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: BGWASH,
},
errorText: {
fontSize: 14,
textAlign: 'center',
marginBottom: 2,
},
errorTextTitle: {
fontSize: 15,
fontWeight: '500',
marginBottom: 10,
},
hidden: {
height: 0,
flex: 0, // disable 'flex:1' when hiding a View
},
loadingView: {
backgroundColor: BGWASH,
flex: 1,
justifyContent: 'center',
alignItems: 'center',
height: 100,
},
webView: {
backgroundColor: '#ffffff',
}
});
module.exports = WebView;
|
src/decorators/withViewport.js | vbdoug/ISOReStack | /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React, { Component } from 'react'; // eslint-disable-line no-unused-vars
import EventEmitter from 'eventemitter3';
import { canUseDOM } from '../../node_modules/react/lib/ExecutionEnvironment';
let EE;
let viewport = {width: 1366, height: 768}; // Default size for server-side rendering
const RESIZE_EVENT = 'resize';
function handleWindowResize() {
if (viewport.width !== window.innerWidth || viewport.height !== window.innerHeight) {
viewport = {width: window.innerWidth, height: window.innerHeight};
EE.emit(RESIZE_EVENT, viewport);
}
}
function withViewport(ComposedComponent) {
return class WithViewport extends Component {
constructor() {
super();
this.state = {
viewport: canUseDOM ? {width: window.innerWidth, height: window.innerHeight} : viewport
};
}
componentDidMount() {
if (!EE) {
EE = new EventEmitter();
window.addEventListener('resize', handleWindowResize);
window.addEventListener('orientationchange', handleWindowResize);
}
EE.on('resize', this.handleResize, this);
}
componentWillUnmount() {
EE.removeListener(RESIZE_EVENT, this.handleResize, this);
if (!EE.listeners(RESIZE_EVENT, true)) {
window.removeEventListener('resize', handleWindowResize);
window.removeEventListener('orientationchange', handleWindowResize);
EE = null;
}
}
render() {
return <ComposedComponent {...this.props} viewport={this.state.viewport}/>;
}
handleResize(value) {
this.setState({viewport: value});
}
};
}
export default withViewport;
|
src/routes/contact/index.js | malinowsky/dataroot_03 | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '../../components/Layout';
import ContactUs from './Contact';
export default {
path: '/contact',
action() {
return {
component: <Layout><ContactUs /></Layout>,
};
},
};
|
src/components/svg/Horse.js | JoeTheDave/onitama | import PropTypes from 'prop-types';
import React from 'react';
export const Horse = ({ fillColor }) => (
<svg width="110px" height="130px" viewBox="0 0 180 220" preserveAspectRatio="xMidYMid meet">
<g transform="translate(0, 220) scale(0.1, -0.1)" fill={fillColor} stroke="none">
<path d="M1040 2156 c-59 -32 -270 -109 -334 -122 l-69 -15 -74 37 c-62 32
-83 38 -140 38 -62 1 -68 -1 -82 -25 -13 -24 -12 -28 10 -58 32 -43 37 -116
38 -526 2 -354 8 -418 51 -544 17 -47 39 -117 51 -155 11 -38 35 -103 54 -143
40 -87 56 -92 109 -33 27 30 36 49 36 76 0 46 -12 69 -67 126 l-46 46 69 20
c132 38 114 50 158 -106 21 -75 43 -143 48 -149 27 -33 102 1 128 58 23 53 12
100 -46 186 -48 72 -54 66 71 82 79 10 85 8 85 -21 0 -38 61 -283 77 -307 21
-32 68 -22 110 24 26 27 33 44 33 74 0 51 -48 143 -107 203 l-45 46 86 7 c120
10 120 10 113 -130 -6 -146 -55 -324 -110 -407 -28 -40 -54 -44 -185 -28 -52
6 -96 9 -99 7 -13 -14 13 -45 62 -75 33 -20 72 -55 95 -86 28 -39 47 -55 71
-60 56 -11 87 -6 116 17 15 13 46 34 69 46 25 14 55 44 77 78 72 108 167 397
167 506 0 31 8 66 21 93 19 38 20 46 9 74 -19 45 -66 76 -166 112 -88 30 -91
31 -224 24 -74 -3 -150 -9 -167 -12 l-33 -6 0 65 0 65 38 12 c110 36 130 50
147 101 9 27 15 58 13 70 -5 33 -49 61 -104 66 -90 8 -94 10 -94 47 0 34 1 35
54 46 62 13 81 30 91 85 4 22 9 53 12 68 9 46 -19 67 -89 67 l-59 0 3 32 c3
28 9 34 43 46 87 30 102 40 129 87 36 66 34 87 -16 129 -62 53 -136 70 -188
42z m-320 -309 c14 -10 44 -17 72 -17 46 0 48 -1 48 -29 0 -16 2 -35 5 -43 3
-8 -23 -27 -78 -55 -45 -22 -90 -44 -99 -47 -38 -12 -10 -78 52 -121 30 -21
52 -28 84 -28 l43 1 -5 -46 c-2 -26 -7 -50 -11 -53 -3 -4 -39 -19 -79 -33 -39
-14 -83 -33 -97 -42 l-25 -16 0 213 c1 118 4 251 7 297 l5 83 27 -24 c14 -13
37 -31 51 -40z m21 -653 c16 -8 42 -14 59 -14 29 0 30 -2 30 -45 0 -41 -2 -45
-27 -51 -16 -3 -59 -14 -98 -24 -101 -27 -101 -28 -79 187 l5 51 42 -45 c22
-24 53 -51 68 -59z"
/>
<path d="M137 803 c-3 -54 -13 -130 -22 -169 -10 -41 -15 -83 -11 -98 8 -33
82 -115 114 -127 32 -12 72 10 107 61 27 38 29 50 33 154 7 193 -28 248 -174
271 l-41 6 -6 -98z"
/>
</g>
</svg>
);
Horse.propTypes = {
fillColor: PropTypes.string.isRequired,
};
export default Horse;
|
stories/Avatar.stories.js | tidepool-org/blip | import React from 'react';
import { withDesign } from 'storybook-addon-designs';
import { ThemeProvider } from 'styled-components';
import baseTheme from '../app/themes/baseTheme';
import Avatar from '../app/components/elements/Avatar';
const withTheme = Story => (
<ThemeProvider theme={baseTheme}>
<Story />
</ThemeProvider>
);
export default {
title: 'Avatar',
decorators: [withDesign, withTheme],
};
export const AvatarStory = () => (
<React.Fragment>
<Avatar initials="JJ" my={2} />
<Avatar initials="PP" my={2} variant="inverse" />
<Avatar initials="OO" my={2} backgroundColor="oranges.2" />
</React.Fragment>
);
AvatarStory.story = {
name: 'Basic Avatar',
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/iuXkrpuLTXExSnuPJE3Jtn/Tidepool-Design-System---Sprint-1?node-id=9%3A0',
},
},
};
|
components/test/Nav.js | kimeva/zerofallgravity | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link';
import find from 'lodash/find';
import { topNavigationLinks } from '../../helpers/util';
import {
Nav,
NavContainer,
Brand,
NavBar,
NavMobile,
NavItems,
NavItem,
ItemText,
ActiveItemText,
Hamburger,
HamburgerIcon
} from '../styled/Nav'
export default class Navigation extends Component {
constructor(props) {
super(props);
this.state = {
isToggled: false
};
}
onHamburgerClick = () => {
this.setState({
isToggled: !this.state.isToggled
});
}
render() {
const activeLink = this.props.active ? this.props.active : '';
return (
<Nav>
<NavContainer>
<Brand>
</Brand>
<NavMobile onClick={() => this.onHamburgerClick()}>
<Hamburger>
<HamburgerIcon isToggled={this.state.isToggled}></HamburgerIcon>
</Hamburger>
</NavMobile>
<NavBar isVisible={this.state.isToggled}>
<NavItems isVisible={this.state.isToggled}>
{topNavigationLinks.map((navItem, idx) => (
<Link prefetch key={idx} href={navItem.path}>
<NavItem key={idx}>
{navItem.title.toLowerCase() === activeLink.toLowerCase() ?
(
<ActiveItemText>
{navItem.title}
</ActiveItemText>
) : (
<ItemText>
{navItem.title}
</ItemText>
)
}
</NavItem>
</Link>
))}
</NavItems>
</NavBar>
</NavContainer>
</Nav>
);
}
}
Navigation.propTypes = {
active: PropTypes.string
};
|
internals/templates/homePage.js | nimzco/takemyidea-ui | /*
* HomePage
*
* This is the first thing users see of our App, at the '/' route
*/
import React from 'react';
export function HomePage() {
return (
<h1>This is the Homepage!</h1>
);
}
export default HomePage;
|
client/room.js | ben-pr-p/assemble | import React from 'react'
import { render } from 'react-dom'
import { LocaleProvider } from 'antd'
import enUS from 'antd/lib/locale-provider/en_US'
import Main from './room/main'
window.onload = () => {
render(
<LocaleProvider locale={enUS}>
<Main />
</LocaleProvider>,
document.querySelector('#reactAppContainer')
)
}
|
client/src/components/generic/edit-form.js | commoncode/ontap | /**
* EditForm
* Extendable class that provides some help for editing forms.
*/
import React from 'react';
import reactPropTypes from 'prop-types';
import autobind from 'autobind-decorator';
@autobind
class EditForm extends React.Component {
static propTypes = {
model: reactPropTypes.object, // eslint-disable-line react/forbid-prop-types
}
constructor(props) {
super(props);
this.state = {
showDelete: false,
model: {
...props.model,
},
};
}
toggleDelete() {
this.setState({
showDelete: !this.state.showDelete,
});
}
// handle change to an input, textarea
inputChangeHandler(evt) {
this.setState({
model: Object.assign(this.state.model, {
[evt.target.name]: evt.target.value,
}),
});
}
// handle checkbox change
checkboxChangeHandler(evt) {
this.setState({
model: Object.assign(this.state.model, {
[evt.target.name]: evt.target.checked,
}),
});
}
// debugging
logState() {
console.log(this.state); // eslint-disable-line no-console
}
}
export default EditForm;
|
test/e2e/redux-zone/redux-zone.js | opbeat/opbeat-react | import '../opbeat-e2e'
import 'babel-polyfill'
import { createOpbeatMiddleware } from '../../../dist/opbeat-react/redux'
import { push } from 'react-router-redux'
import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, applyMiddleware } from 'redux'
import { Router, Route, IndexRedirect } from 'react-router'
import { wrapRouter } from '../../../dist/opbeat-react'
const OpbeatRouter = wrapRouter(Router)
var store = window.store = createStore(
applyMiddleware(
createOpbeatMiddleware()
)
)
function authLogin () {
var asyncDispatch = dispatch => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
})
}).then(() => {
dispatch(push('/'))
})
}
return dispatch => {
dispatch(push('/'))
}
}
class Login extends React.Component {
login () {
Promise.resolve().then(resp => {
console.log(window.Zone.current.name)
})
store.dispatch(push('/'))
}
render () {
return (
<div>
<button className='login' onClick={this.login}>
Login
</button>
</div>
)
}
}
function render () {
var state = store.getState()
ReactDOM.render((<Login/>),
document.getElementById('reactMount')
)
}
render()
|
src/MediaHeading.js | apkiernan/react-bootstrap | import classNames from 'classnames';
import React from 'react';
import elementType from 'react-prop-types/lib/elementType';
import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
const propTypes = {
componentClass: elementType,
};
const defaultProps = {
componentClass: 'h4',
};
class MediaHeading extends React.Component {
render() {
const { componentClass: Component, className, ...props } = this.props;
const [bsProps, elementProps] = splitBsProps(props);
const classes = getClassSet(bsProps);
return (
<Component
{...elementProps}
className={classNames(className, classes)}
/>
);
}
}
MediaHeading.propTypes = propTypes;
MediaHeading.defaultProps = defaultProps;
export default bsClass('media-heading', MediaHeading);
|
blueprints/smart/files/__root__/containers/__name__/__name__.js | nicolas-amabile/counter | import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
type Props = {
}
export class <%= pascalEntityName %> extends React.Component {
props: Props;
render () {
return (
<div></div>
)
}
}
const mapStateToProps = (state) => {
return {}
}
const mapDispatchToProps = (dispatch) => {
return {}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(<%= pascalEntityName %>)
|
MovieApp/app/index.js | Ronny25/Ronny25.github.io | //Libraries
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router, hashHistory } from 'react-router';
//Routes
import { routes } from './routes';
//Store
import configureStore from './redux/store/configureStore';
const store = configureStore();
render(
<Provider store={store}>
<Router history={hashHistory} routes={routes} />
</Provider>,
document.getElementById('app')
);
|
src/scripts/views/comments.js | sharnee/instaClone | import React from 'react'
import CommentSubmit from './commentSubmit'
var Comments = React.createClass({
_listComments: function(commentsArray) {
var commentArr = []
for ( var i = 0; i < commentsArray.length; i++) {
commentArr.push( <li><strong> {commentsArray[i].byUser} </strong> {commentsArray[i].message} </li> )
}
return commentArr
},
render: function() {
var detailData = this.props.model
return (
<section className="comments">
<ul>
{this._listComments(detailData.get('comments'))}
</ul>
{/* <CommentSubmit /> */}
</section>
)
}
})
export default Comments |
tests/components/SVGIcon-test.js | abzfarah/Pearson.NAPLAN.GnomeH | import {test} from 'tape';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import SVGIcon from '../../src/components/SVGIcon';
import CSSClassnames from '../../src/components/utils/CSSClassnames';
const CONTROL_ICON = CSSClassnames.CONTROL_ICON;
test('loads a default SVGIcon', (t) => {
t.plan(1);
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(React.createElement(SVGIcon));
const iconElement = shallowRenderer.getRenderOutput();
if (iconElement.props.className.indexOf(CONTROL_ICON) > -1) {
t.pass('Icon has control icon class');
} else {
t.fail('Icon does not have control icon class');
}
});
|
app/screens/Favourites/FavouritesScreenView.js | JSSolutions/Perfi | import React from 'react';
import T from 'prop-types';
import { View } from 'react-native';
import {
Subtitle,
DateFilter,
FlatList,
Separator,
TransactionItem,
} from '../../components';
import s from './styles';
const Favourites = ({
concatenatedData,
onDeleteFromFavourites,
onGoToDetail,
dateForFiltering,
setDateForFiltering,
setListRef,
}) => (
<View style={s.root}>
<DateFilter
dateForFiltering={dateForFiltering}
setDateForFiltering={setDateForFiltering}
/>
<Subtitle
style={s.subtitle}
leftText="Favourites"
/>
<Separator withShadow />
<FlatList
isSimpleEmptyText={!!concatenatedData.length}
data={concatenatedData}
renderItem={({ item }) =>
<TransactionItem
entity={item}
onDelete={() => onDeleteFromFavourites({ id: item.id, isTransaction: !!item.account })}
onPress={() => onGoToDetail({ id: item.id, isTransaction: !!item.account })}
/>
}
listEmptyText="You don't have any favourites"
flatListRef={setListRef}
/>
</View>
);
Favourites.propTypes = {
concatenatedData: T.array,
onDeleteFromFavourites: T.func,
onGoToDetail: T.func,
setDateForFiltering: T.func,
dateForFiltering: T.object,
setListRef: T.func,
};
export default Favourites;
|
src/components/hahoo/Toast/Toast.js | hahoocn/hahoo-admin | import React from 'react';
import styles from './Toast.css';
import Loading from '../Loading/Loading';
import dhIcon from '../../../assets/icons/hahoo-ui/dui.svg';
import warnIcon from '../../../assets/icons/hahoo-ui/warn.svg';
import wrongIcon from '../../../assets/icons/hahoo-ui/wrong.svg';
class Toast extends React.Component {
static propTypes = {
title: React.PropTypes.string,
type: React.PropTypes.string,
isAutoClose: React.PropTypes.bool,
isBlock: React.PropTypes.bool,
onClose: React.PropTypes.func,
closeSpeed: React.PropTypes.number
};
static defaultProps = {
type: 'success',
isBlock: false,
isAutoClose: true,
closeSpeed: 1000
};
state = {
isClose: false,
};
componentDidMount() {
if (this.props.type !== 'loading' && this.props.isAutoClose) {
this.closeTimeout = setTimeout(this.handleClose.bind(this), this.props.closeSpeed);
}
}
componentWillUnmount() {
if (this.props.isAutoClose && !this.state.isClose && this.closeTimeout) {
clearTimeout(this.closeTimeout);
this.closeTimeout = false;
}
}
handleClose() {
this.setState({ isClose: true });
if (this.props.onClose) {
this.props.onClose();
}
}
render() {
let icon;
switch (this.props.type) {
case 'success':
icon = dhIcon;
break;
case 'warn':
icon = warnIcon;
break;
case 'wrong':
icon = wrongIcon;
break;
case 'loading':
icon = <Loading className={styles.toastLoading} />;
break;
default:
icon = dhIcon;
break;
}
let iconbox;
if (this.props.type === 'loading') {
iconbox = icon;
} else {
iconbox = (<div className={styles.iconToast}>
<img src={icon} role="presentation" />
</div>);
}
let toast;
if (!this.state.isClose) {
toast = (<div>
{this.props.isBlock ? <div className={styles.mask} /> : null}
<div className={styles.toast}>
{iconbox}
<div className={styles.title}>{this.props.title}</div>
</div>
</div>);
}
return (
<div>
{toast && toast}
</div>
);
}
}
export default Toast;
|
packages/ringcentral-widgets-docs/src/app/pages/Components/ActiveCallActionMenu/Demo.js | ringcentral/ringcentral-js-widget | import React from 'react';
// eslint-disable-next-line
import ActiveCallActionMenu from 'ringcentral-widgets/components/ActiveCallActionMenu';
/**
* A example of `ActiveCallActionMenu`
*/
const ActiveCallActionMenuDemo = () => (
<ActiveCallActionMenu
currentLocale="en-US"
disableLinks={false}
hasEntity
phoneNumber="12345678"
onViewEntity={() => console.log("click 'onViewEntity'")}
onClickToDial={() => console.log("click 'onClickToDial'")}
onClickToSms={() => console.log("click 'onClickToSms'")}
onLog={() => console.log("click 'onLog'")}
extended
/>
);
export default ActiveCallActionMenuDemo;
|
addons/themes/read-only/layouts/Blog.js | rendact/rendact | import $ from 'jquery'
import React from 'react';
import gql from 'graphql-tag';
import {graphql} from 'react-apollo';
import moment from 'moment';
import {Link} from 'react-router';
import scrollToElement from 'scroll-to-element';
import NavPanel from '../includes/NavPanel';
let Blog = React.createClass({
componentDidMount(){
require('../assets/css/main.css')
},
render(){
let { theConfig, latestPosts: data, thePagination, loadDone } = this.props;
return (
<div>
<div>
<section id="header">
<header>
<span className="image avatar">
<Link to="/">
<img src={ require('images/logo-128.png') } alt="" />
</Link>
</span>
<h1 id="logo">MENU</h1>
</header>
<nav id="nav">
{this.props.theMenu()}
</nav>
<footer>
<ul className="icons">
<li><a href="#" className="icon fa-twitter"><span className="label">Twitter</span></a></li>
<li><a href="#" className="icon fa-facebook"><span className="label">Facebook</span></a></li>
<li><a href="#" className="icon fa-instagram"><span className="label">Instagram</span></a></li>
<li><a href="#" className="icon fa-github"><span className="label">Github</span></a></li>
<li><a href="#" className="icon fa-envelope"><span className="label">Email</span></a></li>
</ul>
</footer>
</section>
<div id="wrapper">
<div id="main">
<section id="one">
<div className="container">
<header className="major">
<h2>{theConfig?theConfig.name:"Rendact"}</h2>
</header>
<div className="features">
{data && data.map((post, index) => (
<article>
<Link to={"/post/" + post.id} className="image">
<img src={post.imageFeatured ? post.imageFeatured.blobUrl: require('images/logo-128.png') } alt="" />
</Link>
<div className="inner">
<h4><Link to={"/post/" + post.id}>{post.title && post.title}</Link></h4>
<p dangerouslySetInnerHTML={{__html: post.content ? post.content.slice(0, 100):""}} />
<Link className="button" to={"/post/" + post.id}>Learn More</Link>
</div>
</article>
))}
</div>
</div>
</section>
{this.props.footerWidgets &&
this.props.footerWidgets.map((fw, idx) =>
<section><div className="container">{fw}</div></section>)}
</div>
<section id="footer">
<div className="container">
<ul className="copyright">
<li>© Rendact Team. All rights reserved.</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</div>
</section>
</div>
</div>
<NavPanel {...this.props}/>
</div>
)
}
});
export default Blog; |
example/app.js | n7best/react-weui | import React from 'react';
import ReactDOM from 'react-dom';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
import {
Switch,
HashRouter as Router,
Route,
IndexRoute,
Link
} from 'react-router-dom';
import FastClick from 'fastclick';
import Pages from './index';
import './style.less';
import 'weui';
import '../build/packages/react-weui.css';
import 'babel-polyfill';
const { Home, Button, List, Input, Toast, Dialog, Progress, Msg, Article,
ActionSheet, Icons, Panel, NavBar, NavBar2, TabBar, TabBar2, SearchBar, Gallery,
Uploader, Flex, Footer, Grid, LoadMore, Preview, MsgDemo, MsgSuccess, MsgFail, TopTips,
Popup, Picker, Slider, Badge, PTR, Infinite, Swiper, Page
} = Pages;
window.addEventListener('load', () => {
FastClick.attach(document.body);
});
const routes = [
{ path: '/', component: Home, exact: true },
{ path: '/button', component: Button },
{ path: '/list', component: List },
{ path: '/input', component: Input },
{ path: '/toast', component: Toast },
{ path: '/dialog', component: Dialog },
{ path: '/progress', component: Progress },
{ path: '/msg', component: MsgDemo },
{ path: '/msg/success', component: MsgSuccess },
{ path: '/msg/fail', component: MsgFail },
{ path: '/article', component: Article },
{ path: '/actionsheet', component: ActionSheet },
{ path: '/icons', component: Icons },
{ path: '/panel', component: Panel },
{ path: '/navbar', component: NavBar },
{ path: '/navbar2', component: NavBar2 },
{ path: '/tabbar', component: TabBar },
{ path: '/tabbar2', component: TabBar2 },
{ path: '/searchbar', component: SearchBar },
{ path: '/gallery', component: Gallery },
{ path: '/uploader', component: Uploader },
{ path: '/flex', component: Flex },
{ path: '/footer', component: Footer },
{ path: '/grid', component: Grid },
{ path: '/loadmore', component: LoadMore },
{ path: '/preview', component: Preview },
{ path: '/toptips', component: TopTips },
{ path: '/popup', component: Popup },
{ path: '/picker', component: Picker },
{ path: '/slider', component: Slider },
{ path: '/badge', component: Badge },
{ path: '/ptr', component: PTR },
{ path: '/infinite', component: Infinite },
{ path: '/swiper', component: Swiper },
{ path: '/page', component: Page }
];
const App = (props, context) =>
(
<Router>
<Switch>
{
routes.map( route=> (
<Route key={route.path} path={route.path} exact={route.exact} component={route.component}/>
))
}
</Switch>
</Router>
);
ReactDOM.render(<App/>, document.getElementById('container'));
|
app/containers/HomePage/index.js | bsr203/react-boilerplate | /*
* HomePage
*
* This is the first thing users see of our App, at the '/' route
*/
import React from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import shouldPureComponentUpdate from 'react-pure-render/function';
import { createSelector } from 'reselect';
import {
selectRepos,
selectLoading,
selectError,
} from 'containers/App/selectors';
import {
selectUsername,
} from './selectors';
import { changeUsername } from './actions';
import { loadRepos } from '../App/actions';
import RepoListItem from 'containers/RepoListItem';
import Button from 'components/Button';
import H2 from 'components/H2';
import List from 'components/List';
import ListItem from 'components/ListItem';
import LoadingIndicator from 'components/LoadingIndicator';
import styles from './styles.css';
export class HomePage extends React.Component {
shouldComponentUpdate = shouldPureComponentUpdate;
/**
* Changes the route
*
* @param {string} route The route we want to go to
*/
openRoute = (route) => {
this.props.changeRoute(route);
};
/**
* Changed route to '/features'
*/
openFeaturesPage = () => {
this.openRoute('/features');
};
render() {
let mainContent = null;
// Show a loading indicator when we're loading
if (this.props.loading) {
mainContent = (<List component={LoadingIndicator} />);
// Show an error if there is one
} else if (this.props.error !== false) {
const ErrorComponent = () => (
<ListItem content={'Something went wrong, please try again!'} />
);
mainContent = (<List component={ErrorComponent} />);
// If we're not loading, don't have an error and there are repos, show the repos
} else if (this.props.repos !== false) {
mainContent = (<List items={this.props.repos} component={RepoListItem} />);
}
return (
<article>
<div>
<section className={`${styles.textSection} ${styles.centered}`}>
<H2>Start your next react project in seconds</H2>
<p>A highly scalable, offline-first foundation with the best DX and a focus on performance and best practices</p>
</section>
<section className={styles.textSection}>
<H2>Try me!</H2>
<form className={styles.usernameForm} onSubmit={this.props.onSubmitForm}>
<label htmlFor="username">Show Github repositories by
<span className={styles.atPrefix}>@</span>
<input
id="username"
className={styles.input}
type="text"
placeholder="mxstbr"
value={this.props.username}
onChange={this.props.onChangeUsername}
/>
</label>
</form>
{mainContent}
</section>
<Button handleRoute={this.openFeaturesPage}>Features</Button>
</div>
</article>
);
}
}
HomePage.propTypes = {
changeRoute: React.PropTypes.func,
loading: React.PropTypes.bool,
error: React.PropTypes.oneOfType([
React.PropTypes.object,
React.PropTypes.bool,
]),
repos: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.bool,
]),
onSubmitForm: React.PropTypes.func,
username: React.PropTypes.string,
onChangeUsername: React.PropTypes.func,
};
function mapDispatchToProps(dispatch) {
return {
onChangeUsername: (evt) => dispatch(changeUsername(evt.target.value)),
changeRoute: (url) => dispatch(push(url)),
onSubmitForm: (evt) => {
evt.preventDefault();
dispatch(loadRepos());
},
dispatch,
};
}
// Wrap the component to inject dispatch and state into it
export default connect(createSelector(
selectRepos(),
selectUsername(),
selectLoading(),
selectError(),
(repos, username, loading, error) => ({ repos, username, loading, error })
), mapDispatchToProps)(HomePage);
|
docs/src/app/components/pages/components/RaisedButton/Page.js | hwo411/material-ui | import React from 'react';
import Title from 'react-title-component';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';
import raisedButtonReadmeText from './README';
import raisedButtonExampleSimpleCode from '!raw!./ExampleSimple';
import RaisedButtonExampleSimple from './ExampleSimple';
import raisedButtonExampleComplexCode from '!raw!./ExampleComplex';
import RaisedButtonExampleComplex from './ExampleComplex';
import raisedButtonExampleIconCode from '!raw!./ExampleIcon';
import RaisedButtonExampleIcon from './ExampleIcon';
import raisedButtonCode from '!raw!material-ui/RaisedButton/RaisedButton';
const descriptions = {
simple: '`RaisedButton` with default color, `primary`, `secondary` and and `disabled` props applied.',
complex: 'The first example uses an `input` as a child component. ' +
'The second example has an [SVG Icon](/#/components/svg-icon), with the label positioned after. ' +
'The final example uses a [Font Icon](/#/components/font-icon), and is wrapped in an anchor tag.',
icon: 'Examples of Raised Buttons using an icon without a label. The first example uses an' +
' [SVG Icon](/#/components/svg-icon), and has the default color. The second example shows' +
' how the icon and background color can be changed. The final example uses a' +
' [Font Icon](/#/components/font-icon), and is wrapped in an anchor tag.',
};
const RaisedButtonPage = () => (
<div>
<Title render={(previousTitle) => `Raised Button - ${previousTitle}`} />
<MarkdownElement text={raisedButtonReadmeText} />
<CodeExample
title="Simple examples"
description={descriptions.simple}
code={raisedButtonExampleSimpleCode}
>
<RaisedButtonExampleSimple />
</CodeExample>
<CodeExample
title="Complex examples"
description={descriptions.complex}
code={raisedButtonExampleComplexCode}
>
<RaisedButtonExampleComplex />
</CodeExample>
<CodeExample
title="Icon examples"
description={descriptions.icon}
code={raisedButtonExampleIconCode}
>
<RaisedButtonExampleIcon />
</CodeExample>
<PropTypeDescription code={raisedButtonCode} />
</div>
);
export default RaisedButtonPage;
|
src/components/app.js | tedjames/reduxAuth | import React, { Component } from 'react';
import Header from './header'
export default class App extends Component {
render() {
return (
<div>
<Header />
{this.props.children}
</div>
);
}
}
|
public/app/src/components/Button.js | wjwu/blog | import React from 'react';
import PropTypes from 'prop-types';
const Button = props => {
const cls = `btn btn-${props.type} btn-${props.size}`;
return (
<button type='button' className={ cls } onClick={props.click}>
{ props.children }
</button>);
};
Button.defaultProps = {
type: 'default',
size: 'md'
};
Button.propTypes = {
type: PropTypes.string,
size:PropTypes.string,
click:PropTypes.func,
};
export default Button; |
V2-Node/esquenta.v2/UI/src/views/Icons/Flags/Flags.js | leandrocristovao/esquenta | import React, { Component } from 'react';
import { Card, CardBody, CardHeader, Col, Row } from 'reactstrap';
class Flags extends Component {
render() {
return (
<div className="animated fadeIn">
<Card>
<CardHeader>
<i className="fa fa-font-awesome"></i> Flags
</CardHeader>
<CardBody>
<Row className="text-center">
<Col className="mb-5 text-left" xs="12">
For using the flags inline with text add the classes <code>.flag-icon</code> and <code>.flag-icon-xx</code> (where xx is the ISO 3166-1-alpha-2
code of a country) to an empty span. If you want to have a squared version flag then add the class flag-icon-squared as well.
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ad h1" title="ad" id="ad"></i>
<div>flag-icon-ad</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ae h1" title="ae" id="ae"></i>
<div>flag-icon-ae</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-af h1" title="af" id="af"></i>
<div>flag-icon-af</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ag h1" title="ag" id="ag"></i>
<div>flag-icon-ag</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ai h1" title="ai" id="ai"></i>
<div>flag-icon-ai</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-al h1" title="al" id="al"></i>
<div>flag-icon-al</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-am h1" title="am" id="am"></i>
<div>flag-icon-am</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ao h1" title="ao" id="ao"></i>
<div>flag-icon-ao</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-aq h1" title="aq" id="aq"></i>
<div>flag-icon-aq</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ar h1" title="ar" id="ar"></i>
<div>flag-icon-ar</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-as h1" title="as" id="as"></i>
<div>flag-icon-as</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-at h1" title="at" id="at"></i>
<div>flag-icon-at</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-au h1" title="au" id="au"></i>
<div>flag-icon-au</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-aw h1" title="aw" id="aw"></i>
<div>flag-icon-aw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ax h1" title="ax" id="ax"></i>
<div>flag-icon-ax</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-az h1" title="az" id="az"></i>
<div>flag-icon-az</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ba h1" title="ba" id="ba"></i>
<div>flag-icon-ba</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bb h1" title="bb" id="bb"></i>
<div>flag-icon-bb</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bd h1" title="bd" id="bd"></i>
<div>flag-icon-bd</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-be h1" title="be" id="be"></i>
<div>flag-icon-be</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bf h1" title="bf" id="bf"></i>
<div>flag-icon-bf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bg h1" title="bg" id="bg"></i>
<div>flag-icon-bg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bh h1" title="bh" id="bh"></i>
<div>flag-icon-bh</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bi h1" title="bi" id="bi"></i>
<div>flag-icon-bi</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bj h1" title="bj" id="bj"></i>
<div>flag-icon-bj</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bl h1" title="bl" id="bl"></i>
<div>flag-icon-bl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bm h1" title="bm" id="bm"></i>
<div>flag-icon-bm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bn h1" title="bn" id="bn"></i>
<div>flag-icon-bn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bo h1" title="bo" id="bo"></i>
<div>flag-icon-bo</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bq h1" title="bq" id="bq"></i>
<div>flag-icon-bq</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-br h1" title="br" id="br"></i>
<div>flag-icon-br</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bs h1" title="bs" id="bs"></i>
<div>flag-icon-bs</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bt h1" title="bt" id="bt"></i>
<div>flag-icon-bt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bv h1" title="bv" id="bv"></i>
<div>flag-icon-bv</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bw h1" title="bw" id="bw"></i>
<div>flag-icon-bw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-by h1" title="by" id="by"></i>
<div>flag-icon-by</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-bz h1" title="bz" id="bz"></i>
<div>flag-icon-bz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ca h1" title="ca" id="ca"></i>
<div>flag-icon-ca</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cc h1" title="cc" id="cc"></i>
<div>flag-icon-cc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cd h1" title="cd" id="cd"></i>
<div>flag-icon-cd</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cf h1" title="cf" id="cf"></i>
<div>flag-icon-cf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cg h1" title="cg" id="cg"></i>
<div>flag-icon-cg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ch h1" title="ch" id="ch"></i>
<div>flag-icon-ch</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ci h1" title="ci" id="ci"></i>
<div>flag-icon-ci</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ck h1" title="ck" id="ck"></i>
<div>flag-icon-ck</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cl h1" title="cl" id="cl"></i>
<div>flag-icon-cl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cm h1" title="cm" id="cm"></i>
<div>flag-icon-cm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cn h1" title="cn" id="cn"></i>
<div>flag-icon-cn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-co h1" title="co" id="co"></i>
<div>flag-icon-co</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cr h1" title="cr" id="cr"></i>
<div>flag-icon-cr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cu h1" title="cu" id="cu"></i>
<div>flag-icon-cu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cv h1" title="cv" id="cv"></i>
<div>flag-icon-cv</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cw h1" title="cw" id="cw"></i>
<div>flag-icon-cw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cx h1" title="cx" id="cx"></i>
<div>flag-icon-cx</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cy h1" title="cy" id="cy"></i>
<div>flag-icon-cy</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-cz h1" title="cz" id="cz"></i>
<div>flag-icon-cz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-de h1" title="de" id="de"></i>
<div>flag-icon-de</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-dj h1" title="dj" id="dj"></i>
<div>flag-icon-dj</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-dk h1" title="dk" id="dk"></i>
<div>flag-icon-dk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-dm h1" title="dm" id="dm"></i>
<div>flag-icon-dm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-do h1" title="do" id="do"></i>
<div>flag-icon-do</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-dz h1" title="dz" id="dz"></i>
<div>flag-icon-dz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ec h1" title="ec" id="ec"></i>
<div>flag-icon-ec</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ee h1" title="ee" id="ee"></i>
<div>flag-icon-ee</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-eg h1" title="eg" id="eg"></i>
<div>flag-icon-eg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-eh h1" title="eh" id="eh"></i>
<div>flag-icon-eh</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-er h1" title="er" id="er"></i>
<div>flag-icon-er</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-es h1" title="es" id="es"></i>
<div>flag-icon-es</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-et h1" title="et" id="et"></i>
<div>flag-icon-et</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-fi h1" title="fi" id="fi"></i>
<div>flag-icon-fi</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-fj h1" title="fj" id="fj"></i>
<div>flag-icon-fj</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-fk h1" title="fk" id="fk"></i>
<div>flag-icon-fk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-fm h1" title="fm" id="fm"></i>
<div>flag-icon-fm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-fo h1" title="fo" id="fo"></i>
<div>flag-icon-fo</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-fr h1" title="fr" id="fr"></i>
<div>flag-icon-fr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ga h1" title="ga" id="ga"></i>
<div>flag-icon-ga</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gb h1" title="gb" id="gb"></i>
<div>flag-icon-gb</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gd h1" title="gd" id="gd"></i>
<div>flag-icon-gd</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ge h1" title="ge" id="ge"></i>
<div>flag-icon-ge</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gf h1" title="gf" id="gf"></i>
<div>flag-icon-gf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gg h1" title="gg" id="gg"></i>
<div>flag-icon-gg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gh h1" title="gh" id="gh"></i>
<div>flag-icon-gh</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gi h1" title="gi" id="gi"></i>
<div>flag-icon-gi</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gl h1" title="gl" id="gl"></i>
<div>flag-icon-gl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gm h1" title="gm" id="gm"></i>
<div>flag-icon-gm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gn h1" title="gn" id="gn"></i>
<div>flag-icon-gn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gp h1" title="gp" id="gp"></i>
<div>flag-icon-gp</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gq h1" title="gq" id="gq"></i>
<div>flag-icon-gq</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gr h1" title="gr" id="gr"></i>
<div>flag-icon-gr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gs h1" title="gs" id="gs"></i>
<div>flag-icon-gs</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gt h1" title="gt" id="gt"></i>
<div>flag-icon-gt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gu h1" title="gu" id="gu"></i>
<div>flag-icon-gu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gw h1" title="gw" id="gw"></i>
<div>flag-icon-gw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-gy h1" title="gy" id="gy"></i>
<div>flag-icon-gy</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-hk h1" title="hk" id="hk"></i>
<div>flag-icon-hk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-hm h1" title="hm" id="hm"></i>
<div>flag-icon-hm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-hn h1" title="hn" id="hn"></i>
<div>flag-icon-hn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-hr h1" title="hr" id="hr"></i>
<div>flag-icon-hr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ht h1" title="ht" id="ht"></i>
<div>flag-icon-ht</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-hu h1" title="hu" id="hu"></i>
<div>flag-icon-hu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-id h1" title="id" id="id"></i>
<div>flag-icon-id</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ie h1" title="ie" id="ie"></i>
<div>flag-icon-ie</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-il h1" title="il" id="il"></i>
<div>flag-icon-il</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-im h1" title="im" id="im"></i>
<div>flag-icon-im</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-in h1" title="in" id="in"></i>
<div>flag-icon-in</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-io h1" title="io" id="io"></i>
<div>flag-icon-io</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-iq h1" title="iq" id="iq"></i>
<div>flag-icon-iq</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ir h1" title="ir" id="ir"></i>
<div>flag-icon-ir</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-is h1" title="is" id="is"></i>
<div>flag-icon-is</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-it h1" title="it" id="it"></i>
<div>flag-icon-it</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-je h1" title="je" id="je"></i>
<div>flag-icon-je</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-jm h1" title="jm" id="jm"></i>
<div>flag-icon-jm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-jo h1" title="jo" id="jo"></i>
<div>flag-icon-jo</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-jp h1" title="jp" id="jp"></i>
<div>flag-icon-jp</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ke h1" title="ke" id="ke"></i>
<div>flag-icon-ke</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kg h1" title="kg" id="kg"></i>
<div>flag-icon-kg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kh h1" title="kh" id="kh"></i>
<div>flag-icon-kh</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ki h1" title="ki" id="ki"></i>
<div>flag-icon-ki</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-km h1" title="km" id="km"></i>
<div>flag-icon-km</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kn h1" title="kn" id="kn"></i>
<div>flag-icon-kn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kp h1" title="kp" id="kp"></i>
<div>flag-icon-kp</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kr h1" title="kr" id="kr"></i>
<div>flag-icon-kr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kw h1" title="kw" id="kw"></i>
<div>flag-icon-kw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ky h1" title="ky" id="ky"></i>
<div>flag-icon-ky</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-kz h1" title="kz" id="kz"></i>
<div>flag-icon-kz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-la h1" title="la" id="la"></i>
<div>flag-icon-la</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lb h1" title="lb" id="lb"></i>
<div>flag-icon-lb</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lc h1" title="lc" id="lc"></i>
<div>flag-icon-lc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-li h1" title="li" id="li"></i>
<div>flag-icon-li</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lk h1" title="lk" id="lk"></i>
<div>flag-icon-lk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lr h1" title="lr" id="lr"></i>
<div>flag-icon-lr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ls h1" title="ls" id="ls"></i>
<div>flag-icon-ls</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lt h1" title="lt" id="lt"></i>
<div>flag-icon-lt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lu h1" title="lu" id="lu"></i>
<div>flag-icon-lu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-lv h1" title="lv" id="lv"></i>
<div>flag-icon-lv</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ly h1" title="ly" id="ly"></i>
<div>flag-icon-ly</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ma h1" title="ma" id="ma"></i>
<div>flag-icon-ma</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mc h1" title="mc" id="mc"></i>
<div>flag-icon-mc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-md h1" title="md" id="md"></i>
<div>flag-icon-md</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-me h1" title="me" id="me"></i>
<div>flag-icon-me</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mf h1" title="mf" id="mf"></i>
<div>flag-icon-mf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mg h1" title="mg" id="mg"></i>
<div>flag-icon-mg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mh h1" title="mh" id="mh"></i>
<div>flag-icon-mh</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mk h1" title="mk" id="mk"></i>
<div>flag-icon-mk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ml h1" title="ml" id="ml"></i>
<div>flag-icon-ml</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mm h1" title="mm" id="mm"></i>
<div>flag-icon-mm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mn h1" title="mn" id="mn"></i>
<div>flag-icon-mn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mo h1" title="mo" id="mo"></i>
<div>flag-icon-mo</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mp h1" title="mp" id="mp"></i>
<div>flag-icon-mp</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mq h1" title="mq" id="mq"></i>
<div>flag-icon-mq</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mr h1" title="mr" id="mr"></i>
<div>flag-icon-mr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ms h1" title="ms" id="ms"></i>
<div>flag-icon-ms</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mt h1" title="mt" id="mt"></i>
<div>flag-icon-mt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mu h1" title="mu" id="mu"></i>
<div>flag-icon-mu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mv h1" title="mv" id="mv"></i>
<div>flag-icon-mv</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mw h1" title="mw" id="mw"></i>
<div>flag-icon-mw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mx h1" title="mx" id="mx"></i>
<div>flag-icon-mx</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-my h1" title="my" id="my"></i>
<div>flag-icon-my</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-mz h1" title="mz" id="mz"></i>
<div>flag-icon-mz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-na h1" title="na" id="na"></i>
<div>flag-icon-na</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-nc h1" title="nc" id="nc"></i>
<div>flag-icon-nc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ne h1" title="ne" id="ne"></i>
<div>flag-icon-ne</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-nf h1" title="nf" id="nf"></i>
<div>flag-icon-nf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ng h1" title="ng" id="ng"></i>
<div>flag-icon-ng</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ni h1" title="ni" id="ni"></i>
<div>flag-icon-ni</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-nl h1" title="nl" id="nl"></i>
<div>flag-icon-nl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-no h1" title="no" id="no"></i>
<div>flag-icon-no</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-np h1" title="np" id="np"></i>
<div>flag-icon-np</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-nr h1" title="nr" id="nr"></i>
<div>flag-icon-nr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-nu h1" title="nu" id="nu"></i>
<div>flag-icon-nu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-nz h1" title="nz" id="nz"></i>
<div>flag-icon-nz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-om h1" title="om" id="om"></i>
<div>flag-icon-om</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pa h1" title="pa" id="pa"></i>
<div>flag-icon-pa</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pe h1" title="pe" id="pe"></i>
<div>flag-icon-pe</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pf h1" title="pf" id="pf"></i>
<div>flag-icon-pf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pg h1" title="pg" id="pg"></i>
<div>flag-icon-pg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ph h1" title="ph" id="ph"></i>
<div>flag-icon-ph</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pk h1" title="pk" id="pk"></i>
<div>flag-icon-pk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pl h1" title="pl" id="pl"></i>
<div>flag-icon-pl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pm h1" title="pm" id="pm"></i>
<div>flag-icon-pm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pn h1" title="pn" id="pn"></i>
<div>flag-icon-pn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pr h1" title="pr" id="pr"></i>
<div>flag-icon-pr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ps h1" title="ps" id="ps"></i>
<div>flag-icon-ps</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pt h1" title="pt" id="pt"></i>
<div>flag-icon-pt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-pw h1" title="pw" id="pw"></i>
<div>flag-icon-pw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-py h1" title="py" id="py"></i>
<div>flag-icon-py</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-qa h1" title="qa" id="qa"></i>
<div>flag-icon-qa</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-re h1" title="re" id="re"></i>
<div>flag-icon-re</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ro h1" title="ro" id="ro"></i>
<div>flag-icon-ro</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-rs h1" title="rs" id="rs"></i>
<div>flag-icon-rs</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ru h1" title="ru" id="ru"></i>
<div>flag-icon-ru</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-rw h1" title="rw" id="rw"></i>
<div>flag-icon-rw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sa h1" title="sa" id="sa"></i>
<div>flag-icon-sa</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sb h1" title="sb" id="sb"></i>
<div>flag-icon-sb</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sc h1" title="sc" id="sc"></i>
<div>flag-icon-sc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sd h1" title="sd" id="sd"></i>
<div>flag-icon-sd</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-se h1" title="se" id="se"></i>
<div>flag-icon-se</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sg h1" title="sg" id="sg"></i>
<div>flag-icon-sg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sh h1" title="sh" id="sh"></i>
<div>flag-icon-sh</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-si h1" title="si" id="si"></i>
<div>flag-icon-si</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sj h1" title="sj" id="sj"></i>
<div>flag-icon-sj</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sk h1" title="sk" id="sk"></i>
<div>flag-icon-sk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sl h1" title="sl" id="sl"></i>
<div>flag-icon-sl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sm h1" title="sm" id="sm"></i>
<div>flag-icon-sm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sn h1" title="sn" id="sn"></i>
<div>flag-icon-sn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-so h1" title="so" id="so"></i>
<div>flag-icon-so</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sr h1" title="sr" id="sr"></i>
<div>flag-icon-sr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ss h1" title="ss" id="ss"></i>
<div>flag-icon-ss</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-st h1" title="st" id="st"></i>
<div>flag-icon-st</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sv h1" title="sv" id="sv"></i>
<div>flag-icon-sv</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sx h1" title="sx" id="sx"></i>
<div>flag-icon-sx</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sy h1" title="sy" id="sy"></i>
<div>flag-icon-sy</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-sz h1" title="sz" id="sz"></i>
<div>flag-icon-sz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tc h1" title="tc" id="tc"></i>
<div>flag-icon-tc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-td h1" title="td" id="td"></i>
<div>flag-icon-td</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tf h1" title="tf" id="tf"></i>
<div>flag-icon-tf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tg h1" title="tg" id="tg"></i>
<div>flag-icon-tg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-th h1" title="th" id="th"></i>
<div>flag-icon-th</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tj h1" title="tj" id="tj"></i>
<div>flag-icon-tj</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tk h1" title="tk" id="tk"></i>
<div>flag-icon-tk</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tl h1" title="tl" id="tl"></i>
<div>flag-icon-tl</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tm h1" title="tm" id="tm"></i>
<div>flag-icon-tm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tn h1" title="tn" id="tn"></i>
<div>flag-icon-tn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-to h1" title="to" id="to"></i>
<div>flag-icon-to</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tr h1" title="tr" id="tr"></i>
<div>flag-icon-tr</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tt h1" title="tt" id="tt"></i>
<div>flag-icon-tt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tv h1" title="tv" id="tv"></i>
<div>flag-icon-tv</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tw h1" title="tw" id="tw"></i>
<div>flag-icon-tw</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-tz h1" title="tz" id="tz"></i>
<div>flag-icon-tz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ua h1" title="ua" id="ua"></i>
<div>flag-icon-ua</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ug h1" title="ug" id="ug"></i>
<div>flag-icon-ug</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-um h1" title="um" id="um"></i>
<div>flag-icon-um</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-us h1" title="us" id="us"></i>
<div>flag-icon-us</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-uy h1" title="uy" id="uy"></i>
<div>flag-icon-uy</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-uz h1" title="uz" id="uz"></i>
<div>flag-icon-uz</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-va h1" title="va" id="va"></i>
<div>flag-icon-va</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-vc h1" title="vc" id="vc"></i>
<div>flag-icon-vc</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ve h1" title="ve" id="ve"></i>
<div>flag-icon-ve</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-vg h1" title="vg" id="vg"></i>
<div>flag-icon-vg</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-vi h1" title="vi" id="vi"></i>
<div>flag-icon-vi</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-vn h1" title="vn" id="vn"></i>
<div>flag-icon-vn</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-vu h1" title="vu" id="vu"></i>
<div>flag-icon-vu</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-wf h1" title="wf" id="wf"></i>
<div>flag-icon-wf</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ws h1" title="ws" id="ws"></i>
<div>flag-icon-ws</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-ye h1" title="ye" id="ye"></i>
<div>flag-icon-ye</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-yt h1" title="yt" id="yt"></i>
<div>flag-icon-yt</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-za h1" title="za" id="za"></i>
<div>flag-icon-za</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-zm h1" title="zm" id="zm"></i>
<div>flag-icon-zm</div>
</Col>
<Col className="mb-5" xs="3" sm="2">
<i className="flag-icon flag-icon-zw h1" title="zw" id="zw"></i>
<div>flag-icon-zw</div>
</Col>
</Row>
</CardBody>
</Card>
</div>
);
}
}
export default Flags;
|
app/components/movies/Movies.js | CodeRowerSoftware/react-native-starter-app | /**
* Created by garima.kaila on 2017-04-14.
*/
import React, { Component } from 'react';
import {
ScrollView,
View,
Text
} from 'react-native';
var MovieItem = require('./MovieItem');
class Movies extends React.Component {
constructor(props) {
super(props);
this.state = {
movies: []
};
}
componentWillReceiveProps(props) {
console.log('props', props)
this.setState({
movies: props.movies
});
}
render() {
console.log('this.state', this.state)
movies = (<View><Text>No Movie Found</Text></View>);
if(this.state.movies.length>0) {
movies = this.state.movies.map((movie, index) => {
return (<MovieItem title={movie.Title} year={movie.Year} poster={movie.Poster} type={movie.Type}
key={index}/>);
});
}
return (
<ScrollView>
{movies}
</ScrollView>
);
}
}
module.exports = Movies;
|
app/src/index.js | udacityalumni/alumni-client | /* eslint-disable */ // React must be in scope here
import React from 'react';
/* eslint-enable */
import { render } from 'react-dom';
import { match } from 'react-router';
import { history } from './store';
import RouterApp, { routes } from './routes';
import { install } from 'offline-plugin/runtime';
import '../styles/styles.scss';
const isProduction = process.env.NODE_ENV === 'production';
match({ history, routes },
(error, redirectLocation, renderProps) => { // eslint-disable-line
if (error) {
return console.error('Require.ensure error'); // eslint-disable-line
}
render(<RouterApp {...renderProps} />, document.getElementById('app'));
});
if (isProduction) {
install();
} else {
if (module.hot) {
module.hot.accept('./routes', () => {
const NewRouterApp = require('./routes').default;
render(<NewRouterApp />, document.getElementById('app'));
});
}
}
|
src/parser/deathknight/frost/modules/features/AlwaysBeCasting.js | ronaldpereira/WoWAnalyzer | import React from 'react';
import CoreAlwaysBeCasting from 'parser/shared/modules/AlwaysBeCasting';
import SPELLS from 'common/SPELLS';
import { formatPercentage } from 'common/format';
import SpellLink from 'common/SpellLink';
class AlwaysBeCasting extends CoreAlwaysBeCasting {
get downtimeSuggestionThresholds() {
return {
actual: this.downtimePercentage,
isGreaterThan: {
minor: 0.30,
average: 0.35,
major: .45,
},
style: 'percentage',
};
}
suggestions(when) {
when(this.downtimeSuggestionThresholds)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<>Your downtime can be improved. Try to Always Be Casting (ABC), reducing time away from the boss unless due to mechanics. If you do have to move, try casting filler spells, such as <SpellLink id={SPELLS.HOWLING_BLAST.id} /> or <SpellLink id={SPELLS.REMORSELESS_WINTER.id} />.</>)
.icon('spell_mage_altertime')
.actual(`${formatPercentage(actual)}% downtime`)
.recommended(`<${formatPercentage(recommended)}% is recommended`);
});
}
}
export default AlwaysBeCasting;
|
src/components/moment/moment.js | ogoss/react-contacts-demo | import React from 'react';
import ApiList from '../../apiList';
import { Card, CardMedia, CardTitle } from 'material-ui/Card';
const cardStyle = {
'marginBottom': '10px'
};
const cardTitleStyle = {
'padding': '8px 14px'
};
const titleStyle = {
'fontSize': '14px',
'lineHeight': '18px',
'marginBottom': '4px'
};
const subtitleStyle = {
fontSize: '12px'
};
/**
* 获取首页数据列表 APIStore
* @method GET
*/
function fetchWxResult(num = 10, page = 1) {
const input = `${ApiList.getHomeList}?num=${num}&page=${page}`,
init = {
method: 'GET',
headers: {
apikey: '9befa2c15677e6aba17ebfb2f6ad7e4f'
}
};
fetch(input, init)
.then((res) => {
if (res.ok) {
res.json().then((data) => {
if (!data.errNum) {
this.setState({
wxResult: data.newslist
});
}
});
}
});
}
export default class Moment extends React.Component {
constructor(props) {
super(props);
this.state = {
wxResult: []
};
fetchWxResult.call(this);
}
static defaultProps = {
cardStyle: cardStyle,
cardTitleStyle: cardTitleStyle,
titleStyle: titleStyle,
subtitleStyle: subtitleStyle
}
render() {
return (
<section className="container">
{this.state.wxResult.map((data, index) => (
<a href={data.url} key={index} >
<Card style={this.props.cardStyle}>
<CardMedia
overlay={
<CardTitle
style={this.props.cardTitleStyle}
titleStyle={this.props.titleStyle}
subtitleStyle={this.props.subtitleStyle}
title={data.title}
subtitle={data.ctime} />} >
<img src={data.picUrl} />
</CardMedia>
</Card>
</a>
))}
</section>
);
}
}
|
src/app/components/Home.js | akzuki/BoardgameAPI | import React from 'react';
import { Header } from './Header';
import { ProductGridView } from './ProductGridView';
import { Footer } from './Footer';
import FacebookLogin from 'react-facebook-login';
export class Home extends React.Component {
render() {
return (
<div>
<Header/>
<div className="content">
{this.props.children}
</div>
<Footer/>
</div>
);
}
}
|
pages/demos/avatars.js | AndriusBil/material-ui | // @flow
import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from 'docs/src/pages/demos/avatars/avatars.md';
function Page() {
return (
<MarkdownDocs
markdown={markdown}
demos={{
'pages/demos/avatars/ImageAvatars.js': {
js: require('docs/src/pages/demos/avatars/ImageAvatars').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/avatars/ImageAvatars'), 'utf8')
`,
},
'pages/demos/avatars/IconAvatars.js': {
js: require('docs/src/pages/demos/avatars/IconAvatars').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/avatars/IconAvatars'), 'utf8')
`,
},
'pages/demos/avatars/LetterAvatars.js': {
js: require('docs/src/pages/demos/avatars/LetterAvatars').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/demos/avatars/LetterAvatars'), 'utf8')
`,
},
}}
/>
);
}
export default withRoot(Page);
|
src/browser/todos/Todos.js | chad099/react-native-boilerplate | // @flow
import React from 'react';
import todosMessages from '../../common/todos/todosMessages';
import type { State, Todo } from '../../common/types';
import { Box, Button, Text } from '../../common/components';
import { compose, isEmpty, prop, reverse, sortBy, values } from 'ramda';
import { connect } from 'react-redux';
import { deleteTodo, toggleTodoCompleted } from '../../common/todos/actions';
import { injectIntl } from 'react-intl';
const TodosItem = (
{
deleteTodo,
todo,
toggleTodoCompleted,
},
) => (
<Box flexDirection="row" marginHorizontal={-0.25}>
<Button
decoration={todo.completed ? 'line-through' : 'none'}
marginHorizontal={0.25}
onClick={() => toggleTodoCompleted(todo)}
>
{todo.title}
</Button>
<Button bold marginHorizontal={0.25} onClick={() => deleteTodo(todo.id)}>
×
</Button>
</Box>
);
type TodosProps = {
deleteTodo: typeof deleteTodo,
intl: $IntlShape,
todos: Object,
toggleTodoCompleted: typeof toggleTodoCompleted,
};
const Todos = (
{
deleteTodo,
intl,
todos,
toggleTodoCompleted,
}: TodosProps,
) => {
if (isEmpty(todos)) {
return (
<Text>
{intl.formatMessage(todosMessages.empty)}
</Text>
);
}
// It's ok and recommended to sort things in view, but for the bigger data
// leverage reactjs/reselect or bvaughn/react-virtualized.
const sortedTodos: Array<Todo> = compose(
reverse,
sortBy(prop('createdAt')),
values,
)(todos);
return (
<Box>
{sortedTodos.map(todo => (
<TodosItem
key={todo.id}
deleteTodo={deleteTodo}
todo={todo}
toggleTodoCompleted={toggleTodoCompleted}
/>
))}
</Box>
);
};
export default compose(
connect(
(state: State) => ({
todos: state.todos.all,
}),
{ deleteTodo, toggleTodoCompleted },
),
injectIntl,
)(Todos);
|
src/core/DefaultDropzoneRenderer/index.js | dlennox24/ricro-app-template | import Paper from '@material-ui/core/Paper';
import withStyles from '@material-ui/core/styles/withStyles';
import Typography from '@material-ui/core/Typography';
import PropTypes from 'prop-types';
import React from 'react';
import FileDropzoneList from '../../component/FileDropzoneList';
import DDZAppbar from './DDZAppbar';
const styles = () => ({
helperText: { textAlign: 'center' },
paper: {
maxHeight: 350,
overflowY: 'auto',
padding: '1.5rem',
},
});
const DefaultDropzoneRenderer = props => {
const { classes, helperText, files, onRemoveFile } = props;
const passableProps = { ...props };
passableProps.classes = null;
return (
<Paper>
<DDZAppbar {...passableProps} />
<div className={classes.paper}>
{helperText && (
<Typography className={classes.helperText} paragraph variant="body2">
{helperText}
</Typography>
)}
<FileDropzoneList files={files} onRemoveFile={onRemoveFile} />
</div>
</Paper>
);
};
DefaultDropzoneRenderer.propTypes = {
classes: PropTypes.object.isRequired, // MUI withStyles()
files: PropTypes.array,
helperText: PropTypes.node,
onRemoveFile: PropTypes.func,
};
export default withStyles(styles)(DefaultDropzoneRenderer);
|
client/modules/users/components/.stories/logout.js | kaibagoh/PitchSpot | import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { setComposerStub } from 'react-komposer';
import Logout from '../logout.jsx';
storiesOf('users.Logout', module)
.add('default view', () => {
return (
<Logout />
);
})
|
client/src/components/Page.js | rantav/reversim-summit-2017 | import React, { Component } from 'react';
import Navbar from './Navbar';
import Footer from "./Footer";
class Page extends Component {
componentDidMount() {
document.title = this.props.title || "Reversim Summit 2017";
}
render() {
const { children, isHome, user, isSmallScreen, onLogout } = this.props;
return (
<div style={isHome ? {} : { paddingTop: 77 }}>
<Navbar isHome={isHome} user={user} isSmallScreen={isSmallScreen} onLogout={onLogout}/>
{children}
<Footer />
</div>
);
}
}
export default Page; |
node_modules/react-bootstrap/es/Checkbox.js | superKaigon/TheCave | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import warning from 'warning';
import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
var propTypes = {
inline: PropTypes.bool,
disabled: PropTypes.bool,
title: PropTypes.string,
/**
* Only valid if `inline` is not set.
*/
validationState: PropTypes.oneOf(['success', 'warning', 'error', null]),
/**
* Attaches a ref to the `<input>` element. Only functions can be used here.
*
* ```js
* <Checkbox inputRef={ref => { this.input = ref; }} />
* ```
*/
inputRef: PropTypes.func
};
var defaultProps = {
inline: false,
disabled: false,
title: ''
};
var Checkbox = function (_React$Component) {
_inherits(Checkbox, _React$Component);
function Checkbox() {
_classCallCheck(this, Checkbox);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Checkbox.prototype.render = function render() {
var _props = this.props,
inline = _props.inline,
disabled = _props.disabled,
validationState = _props.validationState,
inputRef = _props.inputRef,
className = _props.className,
style = _props.style,
title = _props.title,
children = _props.children,
props = _objectWithoutProperties(_props, ['inline', 'disabled', 'validationState', 'inputRef', 'className', 'style', 'title', 'children']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var input = React.createElement('input', _extends({}, elementProps, {
ref: inputRef,
type: 'checkbox',
disabled: disabled
}));
if (inline) {
var _classes2;
var _classes = (_classes2 = {}, _classes2[prefix(bsProps, 'inline')] = true, _classes2.disabled = disabled, _classes2);
// Use a warning here instead of in propTypes to get better-looking
// generated documentation.
process.env.NODE_ENV !== 'production' ? warning(!validationState, '`validationState` is ignored on `<Checkbox inline>`. To display ' + 'validation state on an inline checkbox, set `validationState` on a ' + 'parent `<FormGroup>` or other element instead.') : void 0;
return React.createElement(
'label',
{ className: classNames(className, _classes), style: style, title: title },
input,
children
);
}
var classes = _extends({}, getClassSet(bsProps), {
disabled: disabled
});
if (validationState) {
classes['has-' + validationState] = true;
}
return React.createElement(
'div',
{ className: classNames(className, classes), style: style },
React.createElement(
'label',
{ title: title },
input,
children
)
);
};
return Checkbox;
}(React.Component);
Checkbox.propTypes = propTypes;
Checkbox.defaultProps = defaultProps;
export default bsClass('checkbox', Checkbox); |
docs/src/Routes.js | westonplatter/react-bootstrap | import React from 'react';
import Root from './Root';
import HomePage from './HomePage';
import IntroductionPage from './IntroductionPage';
import GettingStartedPage from './GettingStartedPage';
import ComponentsPage from './ComponentsPage';
import SupportPage from './SupportPage';
import NotFoundPage from './NotFoundPage';
import {Route, DefaultRoute, NotFoundRoute} from 'react-router';
export default (
<Route name="home" path="/" handler={Root}>
<DefaultRoute handler={HomePage}/>
<NotFoundRoute handler={NotFoundPage} />
<Route name="introduction" path="introduction.html" handler={IntroductionPage} />
<Route name="getting-started" path="getting-started.html" handler={GettingStartedPage} />
<Route name="components" path="components.html" handler={ComponentsPage} />
<Route name="support" path="support.html" handler={SupportPage} />
</Route>
);
|
packages/material-ui-icons/src/Replay10.js | AndriusBil/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let Replay10 = props =>
<SvgIcon {...props}>
<path d="M12 5V1L7 6l5 5V7c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6H4c0 4.4 3.6 8 8 8s8-3.6 8-8-3.6-8-8-8zm-1.1 11H10v-3.3L9 13v-.7l1.8-.6h.1V16zm4.3-1.8c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1c.2.1.3.2.5.3s.2.3.3.6.1.5.1.8v.7zm-.9-.8v-.5s-.1-.2-.1-.3-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5z" />
</SvgIcon>;
Replay10 = pure(Replay10);
Replay10.muiName = 'SvgIcon';
export default Replay10;
|
src/KeyboardAwareTabBarComponent.js | ardaogulcan/react-native-keyboard-accessory | import React from 'react'
import PropTypes from 'prop-types';
import { Keyboard, Platform } from 'react-native'
export default class KeyboardAwareTabBarComponent extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
isVisible: true
}
}
componentWillMount() {
const keyboardShowEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
const keyboardHideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
this.keyboardWillShowSub = Keyboard.addListener(keyboardShowEvent, this.keyboardWillShow);
this.keyboardWillHideSub = Keyboard.addListener(keyboardHideEvent, this.keyboardWillHide);
}
componentWillUnmount() {
this.keyboardWillShowSub.remove();
this.keyboardWillHideSub.remove();
}
keyboardWillShow = (event) => {
this.setState({
isVisible: false
})
}
keyboardWillHide = (event) => {
this.setState({
isVisible: true
})
}
render() {
const { TabBarComponent, ...componentProps } = this.props;
const { isVisible } = this.state;
return isVisible
? <TabBarComponent {...componentProps} />
: null
}
}
KeyboardAwareTabBarComponent.propTypes = {
TabBarComponent: PropTypes.oneOfType([ PropTypes.node, PropTypes.func ]).isRequired,
};
|
examples/huge-apps/routes/Course/components/Course.js | cojennin/react-router | import React from 'react';
import Dashboard from './Dashboard';
import Nav from './Nav';
var styles = {};
styles.sidebar = {
float: 'left',
width: 200,
padding: 20,
borderRight: '1px solid #aaa',
marginRight: 20
};
class Course extends React.Component {
render () {
let { children, params } = this.props;
let course = COURSES[params.courseId];
return (
<div>
<h2>{course.name}</h2>
<Nav course={course} />
{children && children.sidebar && children.main ? (
<div>
<div className="Sidebar" style={styles.sidebar}>
{children.sidebar}
</div>
<div className="Main" style={{padding: 20}}>
{children.main}
</div>
</div>
) : (
<Dashboard />
)}
</div>
);
}
}
export default Course;
|
node_modules/react-router/es6/RouteUtils.js | thuannh1027/react-todo-app | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import React from 'react';
function isValidChild(object) {
return object == null || React.isValidElement(object);
}
export function isReactChildren(object) {
return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
}
function createRoute(defaultProps, props) {
return _extends({}, defaultProps, props);
}
export function createRouteFromReactElement(element) {
var type = element.type;
var route = createRoute(type.defaultProps, element.props);
if (route.children) {
var childRoutes = createRoutesFromReactChildren(route.children, route);
if (childRoutes.length) route.childRoutes = childRoutes;
delete route.children;
}
return route;
}
/**
* Creates and returns a routes object from the given ReactChildren. JSX
* provides a convenient way to visualize how routes in the hierarchy are
* nested.
*
* import { Route, createRoutesFromReactChildren } from 'react-router'
*
* const routes = createRoutesFromReactChildren(
* <Route component={App}>
* <Route path="home" component={Dashboard}/>
* <Route path="news" component={NewsFeed}/>
* </Route>
* )
*
* Note: This method is automatically used when you provide <Route> children
* to a <Router> component.
*/
export function createRoutesFromReactChildren(children, parentRoute) {
var routes = [];
React.Children.forEach(children, function (element) {
if (React.isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
var route = element.type.createRouteFromReactElement(element, parentRoute);
if (route) routes.push(route);
} else {
routes.push(createRouteFromReactElement(element));
}
}
});
return routes;
}
/**
* Creates and returns an array of routes from the given object which
* may be a JSX route, a plain object route, or an array of either.
*/
export function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes);
} else if (routes && !Array.isArray(routes)) {
routes = [routes];
}
return routes;
} |
app/client/src/routes/welcome/index.js | uprisecampaigns/uprise-app | import React from 'react';
import Layout from 'components/Layout';
import Welcome from 'scenes/Welcome';
export default {
path: '/welcome',
action(context) {
return {
title: 'Welcome to UpRise',
component: <Layout><Welcome /></Layout>,
};
},
};
|
complete-example/client/src/components/presentation/headers/heading.js | jpaulptr/ecom-react | import React from 'react';
import PropTypes from 'prop-types';
const Heading = ({ level, children }) => {
switch (level) {
case 1:
return (<h1>{children}</h1>);
case 2:
return (<h2>{children}</h2>);
case 3:
return (<h3>{children}</h3>);
default:
return (<div>{children}</div>);
}
}
Heading.propTypes = {
level: PropTypes.number.isRequired,
children: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
}
export default Heading;
|
components/Deck/ContentPanel/AttachQuestions/AttachSlideWiki.js | slidewiki/slidewiki-platform | import React from 'react';
import {connectToStores} from 'fluxible-addons-react';
import UserProfileStore from '../../../../stores/UserProfileStore';
import AttachSubdeckModalStore from '../../../../stores/AttachSubdeckModalStore';
import AttachQuestionsModalStore from '../../../../stores/AttachQuestionsModalStore';
import AttachDeckList from './AttachDeckList';
import { Segment, Loader,Label, Image,Dimmer, Header} from 'semantic-ui-react';
class AttachSlideWiki extends React.Component{
constructor(props){
super(props);
this.state = {
recentDecks:this.props.AttachSubdeckModalStore.recentDecks,
searchDecks:this.props.AttachSubdeckModalStore.searchDecks,
selectedDeckTitle: this.props.AttachQuestionsModalStore.selectedDeckTitle,
selectedDeckId: this.props.AttachQuestionsModalStore.selectedDeckId
};
}
componentWillReceiveProps(nextProps){
this.setState({
recentDecks: nextProps.AttachSubdeckModalStore.recentDecks,
selectedDeckId: nextProps.AttachQuestionsModalStore.selectedDeckId,
selectedDeckTitle:nextProps.AttachQuestionsModalStore.selectedDeckTitle,
searchDecks: nextProps.AttachSubdeckModalStore.searchDecks,
showSearchResults: nextProps.AttachSubdeckModalStore.showSearchResults,
});
}
render(){
let slideWikiContent;
let userInfo ={
userId: this.props.UserProfileStore.userid,
username: this.props.UserProfileStore.username
};
if(this.state.recentDecks.length === 0){
slideWikiContent = <Segment id="panelMyDecksContent">
<Dimmer active inverted>
<Loader inverted>Loading</Loader>
</Dimmer>
<Image src="http://semantic-ui.com/images/wireframe/paragraph.png" />
</Segment>;
}else{
let slides_to_show;
let fromDecksTitle;
if(!this.state.showSearchResults){
slides_to_show=this.state.recentDecks;
fromDecksTitle='Recent decks';
}else{
slides_to_show=this.state.searchDecks;
fromDecksTitle=slides_to_show.length>0 ? 'Found decks' : 'No results found';
}
slideWikiContent = <Segment id="panelMyDecksContent">
<Header as="h3">{fromDecksTitle}</Header>
<Label htmlFor="selectedDeckTitleId" as="label" color="blue" pointing="right">Selected Deck</Label>
<Label id="selectedDeckTitleId" content={this.state.selectedDeckTitle} role='alert' aria-live='polite' basic/>
<AttachDeckList user={userInfo} decks={slides_to_show} selectedDeckId={this.state.selectedDeckId} destinationDeckId={this.props.destinationDeckId} actionButtonId={this.props.actionButtonId} maxHeight='320px'/>
</Segment>;
}
return slideWikiContent;
}
}
AttachSlideWiki = connectToStores(AttachSlideWiki,[UserProfileStore,AttachSubdeckModalStore,AttachQuestionsModalStore],(context,props) => {
return {
UserProfileStore: context.getStore(UserProfileStore).getState(),
AttachSubdeckModalStore: context.getStore(AttachSubdeckModalStore).getState(),
AttachQuestionsModalStore: context.getStore(AttachQuestionsModalStore).getState()
};
});
export default AttachSlideWiki;
|
fields/types/code/CodeField.js | dvdcastro/keystone | import _ from 'lodash';
import CodeMirror from 'codemirror';
import Field from '../Field';
import React from 'react';
import { findDOMNode } from 'react-dom';
import { FormInput } from 'elemental';
import classnames from 'classnames';
/**
* TODO:
* - Remove dependency on underscore
*/
// See CodeMirror docs for API:
// http://codemirror.net/doc/manual.html
module.exports = Field.create({
displayName: 'CodeField',
statics: {
type: 'Code',
},
getInitialState () {
return {
isFocused: false,
};
},
componentDidMount () {
if (!this.refs.codemirror) {
return;
}
var options = _.defaults({}, this.props.editor, {
lineNumbers: true,
readOnly: this.shouldRenderField() ? false : true,
});
this.codeMirror = CodeMirror.fromTextArea(findDOMNode(this.refs.codemirror), options);
this.codeMirror.setSize(null, this.props.height);
this.codeMirror.on('change', this.codemirrorValueChanged);
this.codeMirror.on('focus', this.focusChanged.bind(this, true));
this.codeMirror.on('blur', this.focusChanged.bind(this, false));
this._currentCodemirrorValue = this.props.value;
},
componentWillUnmount () {
// todo: is there a lighter-weight way to remove the cm instance?
if (this.codeMirror) {
this.codeMirror.toTextArea();
}
},
componentWillReceiveProps (nextProps) {
if (this.codeMirror && this._currentCodemirrorValue !== nextProps.value) {
this.codeMirror.setValue(nextProps.value);
}
},
focus () {
if (this.codeMirror) {
this.codeMirror.focus();
}
},
focusChanged (focused) {
this.setState({
isFocused: focused,
});
},
codemirrorValueChanged (doc, change) {
var newValue = doc.getValue();
this._currentCodemirrorValue = newValue;
this.props.onChange({
path: this.props.path,
value: newValue,
});
},
renderCodemirror () {
const className = classnames('CodeMirror-container', {
'is-focused': this.state.isFocused && this.shouldRenderField(),
});
return (
<div className={className}>
<FormInput
autoComplete="off"
multiline
name={this.getInputName(this.props.path)}
onChange={this.valueChanged}
ref="codemirror"
value={this.props.value}
/>
</div>
);
},
renderValue () {
return this.renderCodemirror();
},
renderField () {
return this.renderCodemirror();
},
});
|
containers/meta/DevTools.js | caTUstrophy/frontend | import React from 'react'
import { createDevTools } from 'redux-devtools'
import DockMonitor from 'redux-devtools-dock-monitor'
import SliderMonitor from 'redux-slider-monitor'
import Inspector from 'redux-devtools-inspector'
import ChartMonitor from 'redux-devtools-chart-monitor'
export default createDevTools(
<DockMonitor toggleVisibilityKey="ctrl-h"
changePositionKey="ctrl-m"
changeMonitorKey="ctrl-shift-m"
defaultIsVisible={false}>
<Inspector />
<SliderMonitor keyboardEnabled />
<ChartMonitor />
</DockMonitor>
)
|
examples/huge-apps/routes/Course/routes/Assignments/components/Assignments.js | carlosmontes/react-router | import React from 'react';
class Assignments extends React.Component {
render () {
return (
<div>
<h3>Assignments</h3>
{this.props.children || <p>Choose an assignment from the sidebar.</p>}
</div>
);
}
}
export default Assignments;
|
examples/src/components/RemoteSelectField.js | silppuri/react-select | import React from 'react';
import Select from 'react-select';
var RemoteSelectField = React.createClass({
displayName: 'RemoteSelectField',
propTypes: {
hint: React.PropTypes.string,
label: React.PropTypes.string,
},
loadOptions (input, callback) {
input = input.toLowerCase();
var rtn = {
options: [
{ label: 'One', value: 'one' },
{ label: 'Two', value: 'two' },
{ label: 'Three', value: 'three' }
],
complete: true
};
if (input.slice(0, 1) === 'a') {
if (input.slice(0, 2) === 'ab') {
rtn = {
options: [
{ label: 'AB', value: 'ab' },
{ label: 'ABC', value: 'abc' },
{ label: 'ABCD', value: 'abcd' }
],
complete: true
};
} else {
rtn = {
options: [
{ label: 'A', value: 'a' },
{ label: 'AA', value: 'aa' },
{ label: 'AB', value: 'ab' }
],
complete: false
};
}
} else if (!input.length) {
rtn.complete = false;
}
setTimeout(function() {
callback(null, rtn);
}, 500);
},
renderHint () {
if (!this.props.hint) return null;
return (
<div className="hint">{this.props.hint}</div>
);
},
render () {
return (
<div className="section">
<h3 className="section-heading">{this.props.label}</h3>
<Select asyncOptions={this.loadOptions} className="remote-example" />
{this.renderHint()}
</div>
);
}
});
module.exports = RemoteSelectField;
|
src/routes/admin/index.js | bobbybeckner/ha-catalyst-test | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '../../components/Layout';
import Admin from './Admin';
const title = 'Admin Page';
const isAdmin = false;
function action() {
if (!isAdmin) {
return { redirect: '/login' };
}
return {
chunks: ['admin'],
title,
component: (
<Layout>
<Admin title={title} />
</Layout>
),
};
}
export default action;
|
src/components/common/icons/Checked.js | WendellLiu/GoodJobShare | import React from 'react';
/* eslint-disable */
const Checked = (props) => (
<svg {...props} width="148" height="148" viewBox="0 0 148 148">
<g fillRule="evenodd">
<path d="M106.432812,41.823875 L55.7566875,97.8349375 L39.7773125,80.174375 C38.0660625,78.278125 35.1384375,78.1370625 33.2468125,79.846 C31.3551875,81.5595625 31.204875,84.484875 32.92075,86.3788125 L51.53175,106.946188 C52.38275,108.185688 53.7956875,108.911813 55.2941875,108.911813 C55.463,108.911813 55.6318125,108.842438 55.8029375,108.821625 C55.920875,108.830875 56.0341875,108.895625 56.1498125,108.895625 C57.5188125,108.895625 58.8461875,108.2805 59.74575,107.219063 L113.289375,48.030625 C115.00525,46.134375 114.85725,43.2090625 112.963312,41.4955 C111.071687,39.7819375 108.146375,39.923 106.432812,41.823875 L106.432812,41.823875 Z"/>
<path d="M73.995375,0 C33.193625,0 0,33.1959375 0,74 C0,114.804062 33.193625,148 73.995375,148 C114.804063,148 148,114.804063 148,74 C148,33.1959375 114.804063,0 73.995375,0 L73.995375,0 Z M73.995375,138.75 C38.2973125,138.75 9.25,109.702688 9.25,74 C9.25,38.2973125 38.2973125,9.25 73.995375,9.25 C109.700375,9.25 138.75,38.2973125 138.75,74 C138.75,109.702688 109.700375,138.75 73.995375,138.75 L73.995375,138.75 Z"/>
</g>
</svg>
);
/* eslint-enable */
export default Checked;
|
src/main/resources/static/bower_components/jqwidgets/jqwidgets-react/react_jqxtogglebutton.js | dhawal9035/WebPLP | /*
jQWidgets v4.5.0 (2017-Jan)
Copyright (c) 2011-2017 jQWidgets.
License: http://jqwidgets.com/license/
*/
import React from 'react';
let jqxToggleButton = React.createClass ({
getInitialState: function () {
return { value: '' };
},
componentDidMount: function () {
let options = this.manageAttributes();
this.createComponent(options);
},
manageAttributes: function () {
let properties = ['delay','disabled','height','imgSrc','imgWidth','imgHeight','imgPosition','roundedCorners','rtl','textPosition','textImageRelation','theme','template','toggled','width','value'];
let options = {};
for(let item in this.props) {
if(item === 'settings') {
for(let itemTwo in this.props[item]) {
options[itemTwo] = this.props[item][itemTwo];
}
} else {
if(properties.indexOf(item) !== -1) {
options[item] = this.props[item];
}
}
}
return options;
},
createComponent : function (options) {
if(!this.style) {
for (let style in this.props.style) {
$('#' +this.componentSelector).css(style, this.props.style[style]);
}
}
if(this.props.className !== undefined) {
let classes = this.props.className.split(' ');
for (let i = 0; i < classes.length; i++ ) {
$('#' +this.componentSelector).addClass(classes[i]);
}
}
if(!this.template) {
$('#' +this.componentSelector).html(this.props.template);
}
$('#' +this.componentSelector).jqxToggleButton(options);
},
generateID : function () {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
},
setOptions: function (options) {
$('#' +this.componentSelector).jqxToggleButton('setOptions', options);
},
getOptions: function () {
if(arguments.length === 0) {
throw Error('At least one argument expected in getOptions()!');
}
let resultToReturn = {};
for(let i = 0; i < arguments.length; i++) {
resultToReturn[arguments[i]] = $('#' +this.componentSelector).jqxToggleButton(arguments[i]);
}
return resultToReturn;
},
on: function (name,callbackFn) {
$('#' +this.componentSelector).on(name,callbackFn);
},
off: function (name) {
$('#' +this.componentSelector).off(name);
},
delay: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("delay", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("delay");
}
},
disabled: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("disabled", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("disabled");
}
},
height: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("height", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("height");
}
},
imgSrc: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("imgSrc", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("imgSrc");
}
},
imgWidth: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("imgWidth", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("imgWidth");
}
},
imgHeight: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("imgHeight", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("imgHeight");
}
},
imgPosition: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("imgPosition", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("imgPosition");
}
},
roundedCorners: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("roundedCorners", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("roundedCorners");
}
},
rtl: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("rtl", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("rtl");
}
},
textPosition: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("textPosition", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("textPosition");
}
},
textImageRelation: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("textImageRelation", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("textImageRelation");
}
},
theme: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("theme", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("theme");
}
},
template: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("template", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("template");
}
},
toggled: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("toggled", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("toggled");
}
},
width: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("width", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("width");
}
},
value: function (arg) {
if (arg !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("value", arg)
} else {
return $("#" +this.componentSelector).jqxToggleButton("value");
}
},
check: function () {
$("#" +this.componentSelector).jqxToggleButton("check");
},
destroy: function () {
$("#" +this.componentSelector).jqxToggleButton("destroy");
},
focus: function () {
$("#" +this.componentSelector).jqxToggleButton("focus");
},
performRender: function () {
$("#" +this.componentSelector).jqxToggleButton("render");
},
toggle: function () {
$("#" +this.componentSelector).jqxToggleButton("toggle");
},
unCheck: function () {
$("#" +this.componentSelector).jqxToggleButton("unCheck");
},
val: function (value) {
if (value !== undefined) {
$("#" +this.componentSelector).jqxToggleButton("val", value)
} else {
return $("#" +this.componentSelector).jqxToggleButton("val");
}
},
render: function () {
let id = 'jqxToggleButton' + this.generateID() + this.generateID();
this.componentSelector = id; return (
<div id={id}>{this.value ? null : this.props.value}{this.props.children}</div>
)
}
});
module.exports = jqxToggleButton;
|
packages/react-ui-components/src/_lib/testUtils.js | mstruebing/PackageFactory.Guevara | import React from 'react';
/**
* A function which returns a simple React element which can be
* used as a test stub for cross component dependencies.
*/
export const createStubComponent = componentName => props => <div data-component-name={componentName} {...props} style={{}}/>;
|
docs/app/Examples/elements/Image/Variations/ImageFluidExample.js | jamiehill/stardust | import React from 'react'
import { Image } from 'stardust'
const src = 'http://semantic-ui.com/images/wireframe/image.png'
const ImageFluidExample = () => (
<Image src={src} fluid />
)
export default ImageFluidExample
|
src/components/atoms/Tooltip/index.js | DimensionLab/narc | import React from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
import { font } from 'styled-theme'
import { ifProp } from 'styled-tools'
const opposites = {
top: 'bottom',
right: 'left',
bottom: 'top',
left: 'right',
}
export const opposite = ({ position }) => opposites[position]
export const perpendicular = ({ position }) =>
position === 'left' || position === 'right' ? 'top' : 'left'
export const perpendicularOpposite = props => opposites[perpendicular(props)]
export const perpendicularAxis = ({ position }) =>
position === 'left' || position === 'right' ? 'Y' : 'X'
const backgroundColor = ifProp('reverse', 'rgba(255, 255, 255, 0.85)', 'rgba(0, 0, 0, 0.85)')
const styles = css`
position: relative;
&:before,
&:after {
position: absolute;
pointer-events: none;
display: block;
opacity: 0;
transition: opacity 100ms ease-in-out, ${opposite} 100ms ease-in-out;
will-change: ${opposite};
}
&:hover:before,
&:focus:before {
opacity: 1;
${opposite}: calc(100% + 1rem);
}
&:hover:after,
&:focus:after {
opacity: 1;
${opposite}: 100%;
}
&:before {
content: attr(data-title);
font-family: ${font('primary')};
white-space: nowrap;
text-transform: none;
font-size: 0.8125rem;
line-height: 1.5;
text-align: center;
color: ${ifProp('reverse', 'black', 'white')};
background-color: ${backgroundColor};
border-radius: 0.15384em;
padding: 0.75em 1em;
${opposite}: calc(100% + 2rem);
${({ align }) => {
switch (align) {
case 'start': return css`
${perpendicular}: 0;
`
case 'center': return css`
${perpendicular}: 50%;
transform: translate${perpendicularAxis}(-50%);
`
default: return css`
${perpendicularOpposite}: 0;
`
}
}}
}
&:after {
${opposite}: calc(100% + 1rem);
${perpendicular}: 50%;
border: solid transparent;
content: '';
height: 0;
width: 0;
border-${({ position }) => position}-color: ${backgroundColor};
border-width: 0.5rem;
margin-${perpendicular}: -0.5rem;
}
`
const Tooltip = styled(({
position, align, reverse, children, theme, ...props
}) => React.cloneElement(children, props))`${styles}`
Tooltip.propTypes = {
position: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
align: PropTypes.oneOf(['start', 'center', 'end']),
reverse: PropTypes.bool,
'data-title': PropTypes.string.isRequired,
children: PropTypes.element.isRequired,
}
Tooltip.defaultProps = {
position: 'top',
align: 'center',
tabIndex: 0,
}
export default Tooltip
|
app/components/analytics/analytics.js | imankit/dashboard-ui | /**
* Created by Darkstar on 11/29/2016.
*/
import React from 'react';
import {connect} from 'react-redux';
import Toolbar from '../toolbar/toolbar.js';
import FlatButton from 'material-ui/FlatButton';
import StorageIcon from 'material-ui/svg-icons/device/sd-storage';
import APIIcon from 'material-ui/svg-icons/action/compare-arrows';
import Footer from '../footer/footer.jsx'
import {fetchAnalyticsAPI, resetAnalytics, fetchAnalyticsStorage} from '../../actions';
import APIAnalytics from './apiAnalytics'
import StorageAnalytics from './storageAnalytics'
import RefreshIndicator from 'material-ui/RefreshIndicator';
export class Analytics extends React.Component {
constructor(props) {
super(props)
this.state = {}
}
static get contextTypes() {
return {router: React.PropTypes.object.isRequired}
}
componentWillMount() {
// redirect if active app not found
if (!this.props.appData.viewActive) {
this.context.router.push('/')
} else {
this.props.fetchAnalyticsAPI(this.props.appData.appId)
this.props.fetchAnalyticsStorage(this.props.appData.appId)
}
}
componentWillUnmount() {
this.props.resetAnalytics()
}
render() {
return (
<div id="" style={{
backgroundColor: '#FFF'
}}>
<div className="cache">
<div className="chartcontainer">
<APIAnalytics analyticsApi={this.props.analyticsApi}/>
<StorageAnalytics analyticsStorage={this.props.analyticsStorage}/>
</div>
</div>
</div>
);
}
}
const mapStateToProps = (state) => {
return {appData: state.manageApp, analyticsApi: state.analytics.analyticsApi, analyticsStorage: state.analytics.analyticsStorage};
};
const mapDispatchToProps = (dispatch) => {
return {
fetchAnalyticsAPI: (appId) => dispatch(fetchAnalyticsAPI(appId)),
fetchAnalyticsStorage: (appId) => dispatch(fetchAnalyticsStorage(appId)),
resetAnalytics: () => dispatch(resetAnalytics())
}
};
export default connect(mapStateToProps, mapDispatchToProps)(Analytics);
|
src/components/Home.js | danielemery/natural-goodness | import React, { Component } from 'react';
import { Jumbotron } from 'reactstrap';
class Home extends Component {
render() {
return (
<div>
<Jumbotron>
<h1>Coming Soon</h1>
<p className="lead">A new way of managing the Natural Goodness Co-Op orders is currently in development. This will vastly simplify making your co-op order and increase visibility of filling orders etc.</p>
</Jumbotron>
</div>
);
}
}
export default Home;
|
node_modules/react-native-svg/elements/Circle.js | Helena-High/school-app | import React from 'react';
import createReactNativeComponentClass from 'react/lib/createReactNativeComponentClass';
import Shape from './Shape';
import {CircleAttributes} from '../lib/attributes';
import {pathProps, numberProp} from '../lib/props';
class Circle extends Shape {
static displayName = 'Circle';
static propTypes = {
...pathProps,
cx: numberProp.isRequired,
cy: numberProp.isRequired,
r: numberProp.isRequired
};
static defaultProps = {
cx: 0,
cy: 0,
r: 0
};
setNativeProps = (...args) => {
this.root.setNativeProps(...args);
};
render() {
let props = this.props;
return <RNSVGCircle
ref={ele => {this.root = ele;}}
{...this.extractProps(props)}
cx={props.cx.toString()}
cy={props.cy.toString()}
r={props.r.toString()}
/>;
}
}
const RNSVGCircle = createReactNativeComponentClass({
validAttributes: CircleAttributes,
uiViewClassName: 'RNSVGCircle'
});
export default Circle;
|
templates/rubix/demo/src/routes/Datatablesjs.js | jeffthemaximum/jeffline | import React from 'react';
import ReactDOM from 'react-dom';
import {
Row,
Col,
Grid,
Panel,
Table,
PanelBody,
PanelHeader,
FormControl,
PanelContainer,
} from '@sketchpixy/rubix';
class DatatableComponent extends React.Component {
componentDidMount() {
$(ReactDOM.findDOMNode(this.example))
.addClass('nowrap')
.dataTable({
responsive: true,
columnDefs: [
{ targets: [-1, -3], className: 'dt-body-right' }
]
});
}
render() {
return (
<Table ref={(c) => this.example = c} className='display' cellSpacing='0' width='100%'>
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<tr>
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</td>
</tr>
<tr>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
</tr>
<tr>
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
</tr>
<tr>
<td>Tatyana Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$385,750</td>
</tr>
<tr>
<td>Michael Silva</td>
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$198,500</td>
</tr>
<tr>
<td>Paul Byrd</td>
<td>Chief Financial Officer (CFO)</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$725,000</td>
</tr>
<tr>
<td>Gloria Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$237,500</td>
</tr>
<tr>
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$132,000</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$217,500</td>
</tr>
<tr>
<td>Jenette Caldwell</td>
<td>Development Lead</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$345,000</td>
</tr>
<tr>
<td>Yuri Berry</td>
<td>Chief Marketing Officer (CMO)</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$675,000</td>
</tr>
<tr>
<td>Caesar Vance</td>
<td>Pre-Sales Support</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$106,450</td>
</tr>
<tr>
<td>Doris Wilder</td>
<td>Sales Assistant</td>
<td>Sidney</td>
<td>23</td>
<td>2010/09/20</td>
<td>$85,600</td>
</tr>
<tr>
<td>Angelica Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>2009/10/09</td>
<td>$1,200,000</td>
</tr>
<tr>
<td>Gavin Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>2010/12/22</td>
<td>$92,575</td>
</tr>
<tr>
<td>Jennifer Chang</td>
<td>Regional Director</td>
<td>Singapore</td>
<td>28</td>
<td>2010/11/14</td>
<td>$357,650</td>
</tr>
<tr>
<td>Brenden Wagner</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>28</td>
<td>2011/06/07</td>
<td>$206,850</td>
</tr>
<tr>
<td>Fiona Green</td>
<td>Chief Operating Officer (COO)</td>
<td>San Francisco</td>
<td>48</td>
<td>2010/03/11</td>
<td>$850,000</td>
</tr>
<tr>
<td>Shou Itou</td>
<td>Regional Marketing</td>
<td>Tokyo</td>
<td>20</td>
<td>2011/08/14</td>
<td>$163,000</td>
</tr>
<tr>
<td>Michelle House</td>
<td>Integration Specialist</td>
<td>Sidney</td>
<td>37</td>
<td>2011/06/02</td>
<td>$95,400</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Developer</td>
<td>London</td>
<td>53</td>
<td>2009/10/22</td>
<td>$114,500</td>
</tr>
<tr>
<td>Prescott Bartlett</td>
<td>Technical Author</td>
<td>London</td>
<td>27</td>
<td>2011/05/07</td>
<td>$145,000</td>
</tr>
<tr>
<td>Gavin Cortez</td>
<td>Team Leader</td>
<td>San Francisco</td>
<td>22</td>
<td>2008/10/26</td>
<td>$235,500</td>
</tr>
<tr>
<td>Martena Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>2011/03/09</td>
<td>$324,050</td>
</tr>
<tr>
<td>Unity Butler</td>
<td>Marketing Designer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/12/09</td>
<td>$85,675</td>
</tr>
<tr>
<td>Howard Hatfield</td>
<td>Office Manager</td>
<td>San Francisco</td>
<td>51</td>
<td>2008/12/16</td>
<td>$164,500</td>
</tr>
<tr>
<td>Hope Fuentes</td>
<td>Secretary</td>
<td>San Francisco</td>
<td>41</td>
<td>2010/02/12</td>
<td>$109,850</td>
</tr>
<tr>
<td>Vivian Harrell</td>
<td>Financial Controller</td>
<td>San Francisco</td>
<td>62</td>
<td>2009/02/14</td>
<td>$452,500</td>
</tr>
<tr>
<td>Timothy Mooney</td>
<td>Office Manager</td>
<td>London</td>
<td>37</td>
<td>2008/12/11</td>
<td>$136,200</td>
</tr>
<tr>
<td>Jackson Bradshaw</td>
<td>Director</td>
<td>New York</td>
<td>65</td>
<td>2008/09/26</td>
<td>$645,750</td>
</tr>
<tr>
<td>Olivia Liang</td>
<td>Support Engineer</td>
<td>Singapore</td>
<td>64</td>
<td>2011/02/03</td>
<td>$234,500</td>
</tr>
<tr>
<td>Bruno Nash</td>
<td>Software Engineer</td>
<td>London</td>
<td>38</td>
<td>2011/05/03</td>
<td>$163,500</td>
</tr>
<tr>
<td>Sakura Yamamoto</td>
<td>Support Engineer</td>
<td>Tokyo</td>
<td>37</td>
<td>2009/08/19</td>
<td>$139,575</td>
</tr>
<tr>
<td>Thor Walton</td>
<td>Developer</td>
<td>New York</td>
<td>61</td>
<td>2013/08/11</td>
<td>$98,540</td>
</tr>
<tr>
<td>Finn Camacho</td>
<td>Support Engineer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/07/07</td>
<td>$87,500</td>
</tr>
<tr>
<td>Serge Baldwin</td>
<td>Data Coordinator</td>
<td>Singapore</td>
<td>64</td>
<td>2012/04/09</td>
<td>$138,575</td>
</tr>
<tr>
<td>Zenaida Frank</td>
<td>Software Engineer</td>
<td>New York</td>
<td>63</td>
<td>2010/01/04</td>
<td>$125,250</td>
</tr>
<tr>
<td>Zorita Serrano</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>56</td>
<td>2012/06/01</td>
<td>$115,000</td>
</tr>
<tr>
<td>Jennifer Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>2013/02/01</td>
<td>$75,650</td>
</tr>
<tr>
<td>Cara Stevens</td>
<td>Sales Assistant</td>
<td>New York</td>
<td>46</td>
<td>2011/12/06</td>
<td>$145,600</td>
</tr>
<tr>
<td>Hermione Butler</td>
<td>Regional Director</td>
<td>London</td>
<td>47</td>
<td>2011/03/21</td>
<td>$356,250</td>
</tr>
<tr>
<td>Lael Greer</td>
<td>Systems Administrator</td>
<td>London</td>
<td>21</td>
<td>2009/02/27</td>
<td>$103,500</td>
</tr>
<tr>
<td>Jonas Alexander</td>
<td>Developer</td>
<td>San Francisco</td>
<td>30</td>
<td>2010/07/14</td>
<td>$86,500</td>
</tr>
<tr>
<td>Shad Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>2008/11/13</td>
<td>$183,000</td>
</tr>
<tr>
<td>Michael Bruce</td>
<td>Javascript Developer</td>
<td>Singapore</td>
<td>29</td>
<td>2011/06/27</td>
<td>$183,000</td>
</tr>
<tr>
<td>Donna Snider</td>
<td>Customer Support</td>
<td>New York</td>
<td>27</td>
<td>2011/01/25</td>
<td>$112,000</td>
</tr>
</tbody>
</Table>
);
}
}
export default class Datatablesjs extends React.Component {
render() {
return (
<Row>
<Col xs={12}>
<PanelContainer>
<Panel>
<PanelBody>
<Grid>
<Row>
<Col xs={12}>
<DatatableComponent />
<br/>
</Col>
</Row>
</Grid>
</PanelBody>
</Panel>
</PanelContainer>
</Col>
</Row>
);
}
}
|
lib/MenuSection/stories/MenuSection.stories.js | folio-org/stripes-components | import React from 'react';
import { storiesOf } from '@storybook/react';
import withReadme from 'storybook-readme/with-readme';
import readme from '../readme.md';
import BasicUsage from './BasicUsage';
import DropdownExample from './DropdownExample';
storiesOf('MenuSection', module)
.addDecorator(withReadme(readme))
.add('Basic Usage', BasicUsage)
.add('Inside Dropdown', () => <DropdownExample />);
|
src/App.js | manovotny/client-side-render-and-seo | import React from 'react';
import logo from './logo.svg';
import './App.css';
const App = () =>
<section>
<header className="header">
<img src={logo} className="logo" alt="logo"/>
<h1>Welcome to a client side rendered React site! Let's see how seo does...</h1>
</header>
<nav className="nav">
<a href={`${process.env.PUBLIC_URL}/`} title="Home">Home</a>
<a href={`${process.env.PUBLIC_URL}/about.html`} title="About">About</a>
<a href={`${process.env.PUBLIC_URL}/contact.html`} title="Contact">Contact</a>
<a href="https://google.com" title="Google">Google</a>
</nav>
<main className="main">
<p className="intro">
Dummy text powered by <a href="https://startupsum.com/" title="Startupsum">Startupsum</a>.
</p>
<p className="intro">
Angel investor social media startup alpha disruptive. Entrepreneur gen-z assets infrastructure
startup accelerator. IPad first mover advantage low hanging fruit prototype. Product management
bootstrapping direct mailing. Long tail twitter monetization mass market burn rate iPhone startup
innovator business-to-consumer learning curve crowdsource. Learning curve series A financing
customer business-to-business success agile development. Partner network pitch traction low hanging
fruit beta focus product management handshake virality interaction design seed money conversion
paradigm shift. Non-disclosure agreement facebook vesting period paradigm shift creative virality
lean startup advisor social proof rockstar social media partnership business-to-business. Ownership
ramen pivot low hanging fruit user experience iteration responsive web design churn rate. IPad
business plan interaction design niche market customer bootstrapping venture social proof alpha
equity user experience scrum project.
</p>
<p className="intro">
Facebook user experience social proof supply chain product management infrastructure conversion
responsive web design scrum project ramen social media disruptive success. Metrics sales android
channels responsive web design business model canvas. Infographic user experience series A financing
niche market direct mailing accelerator first mover advantage seed round. Handshake technology
market paradigm shift analytics incubator network effects bandwidth virality rockstar early
adopters. Bootstrapping social media alpha funding leverage beta metrics bandwidth non-disclosure
agreement early adopters ownership network effects channels. Branding vesting period crowdsource
twitter infographic customer social media churn rate beta low hanging fruit non-disclosure agreement
learning curve venture backing. Ecosystem seed round value proposition equity. Crowdsource
disruptive termsheet low hanging fruit monetization venture deployment prototype accelerator angel
investor traction. Handshake founders direct mailing user experience series A financing ecosystem
traction freemium. Monetization network effects strategy.
</p>
<p className="intro">
Freemium release founders entrepreneur social proof MVP research & development influencer assets.
Pivot vesting period virality agile development client responsive web design facebook A/B testing.
Social proof focus twitter bandwidth channels creative vesting period handshake launch party
bootstrapping. Bandwidth business-to-business release mass market advisor. Termsheet infographic
paradigm shift. Assets venture learning curve funding business-to-consumer growth hacking angel
investor deployment. Non-disclosure agreement technology gamification influencer startup marketing
deployment. Leverage sales infographic freemium social proof supply chain network effects creative.
Market deployment angel investor non-disclosure agreement twitter early adopters gen-z ecosystem.
Conversion disruptive seed round low hanging fruit channels monetization investor product management
strategy angel investor virality hackathon.
</p>
<p className="intro">
Startup entrepreneur user experience burn rate interaction design backing. Partnership pivot funding
client startup. Early adopters direct mailing burn rate user experience advisor pivot gen-z sales
technology conversion facebook validation. Business-to-consumer return on investment focus client.
Mass market business-to-business stock venture iPhone A/B testing. Advisor social media paradigm
shift agile development. Strategy investor mass market backing alpha value proposition. Stealth
influencer android supply chain. Partner network return on investment freemium. A/B testing series A
financing angel investor partnership traction stealth iteration social media MVP assets launch party
metrics paradigm shift.
</p>
<p className="intro">
Metrics lean startup non-disclosure agreement hackathon client return on investment value
proposition investor infographic business-to-consumer paradigm shift learning curve growth hacking
churn rate. Handshake equity accelerator agile development low hanging fruit traction funding
incubator A/B testing beta. Sales marketing customer disruptive analytics market partnership
ownership growth hacking. Business-to-consumer freemium startup launch party user experience value
proposition partnership. Release social proof early adopters stock. Handshake disruptive holy grail
interaction design MVP ownership mass market value proposition. Paradigm shift disruptive channels
assets user experience research & development entrepreneur seed round bandwidth backing stealth
marketing. Low hanging fruit backing paradigm shift hackathon. Business-to-business paradigm shift
growth hacking market traction. Infrastructure entrepreneur iteration.
</p>
</main>
</section>;
export default App;
|
lib/components/modifications-map/reroute-layer.js | conveyal/analysis-ui | import lineSlice from '@turf/line-slice'
import {point} from '@turf/helpers'
import get from 'lodash/get'
import dynamic from 'next/dynamic'
import React from 'react'
import colors from 'lib/constants/colors'
import useModificationPatterns from 'lib/hooks/use-modification-patterns'
import Pane from '../map/pane'
const DirectionalMarkers = dynamic(() => import('../directional-markers'))
const GeoJSON = dynamic(() => import('../map/geojson'))
const PatternGeometry = dynamic(() => import('../map/geojson-patterns'))
const LINE_WEIGHT = 3
/**
* A layer showing a reroute modification
*/
export default function RerouteLayer({
dim = false,
feed,
isEditing,
modification
}) {
// dim, feed, modification
const patterns = useModificationPatterns({dim, feed, modification})
if (!patterns || !feed) return null
return (
<>
<Pane zIndex={500}>
<PatternGeometry
color={colors.NEUTRAL_LIGHT}
dim={dim}
patterns={patterns}
/>
<DirectionalMarkers
color={colors.NEUTRAL_LIGHT}
dim={dim}
patterns={patterns}
/>
</Pane>
{!isEditing &&
get(modification, 'segments[0].geometry.type') === 'LineString' && (
<Pane zIndex={501}>
<GeoJSON
data={getRemovedSegments(feed, modification, patterns)}
color={colors.REMOVED}
opacity={dim ? 0.5 : 1}
weight={LINE_WEIGHT}
/>
<GeoJSON
data={getAddedSegments(modification)}
color={colors.ADDED}
opacity={dim ? 0.5 : 1}
weight={LINE_WEIGHT}
/>
</Pane>
)}
</>
)
}
// Convert added segments into GeoJSON
function getAddedSegments(modification) {
return {
type: 'FeatureCollection',
features: modification.segments.map((segment) => {
return {
type: 'Feature',
geometry: segment.geometry,
properties: {}
}
})
}
}
function getRemovedSegments(feed, modification, patterns) {
const removedSegments = (patterns || [])
.map((pattern) => {
// make sure the modification applies to this pattern. If the modification
// doesn't have a start or end stop, just use the first/last stop as this is
// just for display and we can't highlight past the stops anyhow
const fromStopIndex =
modification.fromStop != null
? pattern.stops.findIndex((s) => s.stop_id === modification.fromStop)
: 0
// make sure to find a toStopIndex _after_ the fromStopIndex (helps with loop routes also)
const toStopIndex =
modification.toStop != null
? pattern.stops.findIndex(
(s, i) => i > fromStopIndex && s.stop_id === modification.toStop
)
: pattern.stops.length - 1
const modificationAppliesToThisPattern =
fromStopIndex !== -1 && toStopIndex !== -1
if (modificationAppliesToThisPattern) {
// NB using indices here so we get an object even if fromStop or toStop
// is null stops in pattern are in fact objects but they only have stop ID.
const fromStop = feed.stopsById[pattern.stops[fromStopIndex].stop_id]
const toStop = feed.stopsById[pattern.stops[toStopIndex].stop_id]
return lineSlice(
point([fromStop.stop_lon, fromStop.stop_lat]),
point([toStop.stop_lon, toStop.stop_lat]),
{
type: 'Feature',
geometry: pattern.geometry,
properties: {}
}
)
}
})
.filter((segment) => !!segment)
return {
type: 'FeatureCollection',
features: removedSegments
}
}
|
docs/src/app/components/pages/components/List/ExampleFolders.js | tan-jerene/material-ui | import React from 'react';
import MobileTearSheet from '../../../MobileTearSheet';
import {List, ListItem} from 'material-ui/List';
import ActionInfo from 'material-ui/svg-icons/action/info';
import Divider from 'material-ui/Divider';
import Subheader from 'material-ui/Subheader';
import Avatar from 'material-ui/Avatar';
import FileFolder from 'material-ui/svg-icons/file/folder';
import ActionAssignment from 'material-ui/svg-icons/action/assignment';
import {blue500, yellow600} from 'material-ui/styles/colors';
import EditorInsertChart from 'material-ui/svg-icons/editor/insert-chart';
const ListExampleFolder = () => (
<MobileTearSheet>
<List>
<Subheader inset={true}>Folders</Subheader>
<ListItem
leftAvatar={<Avatar icon={<FileFolder />} />}
rightIcon={<ActionInfo />}
primaryText="Photos"
secondaryText="Jan 9, 2014"
/>
<ListItem
leftAvatar={<Avatar icon={<FileFolder />} />}
rightIcon={<ActionInfo />}
primaryText="Recipes"
secondaryText="Jan 17, 2014"
/>
<ListItem
leftAvatar={<Avatar icon={<FileFolder />} />}
rightIcon={<ActionInfo />}
primaryText="Work"
secondaryText="Jan 28, 2014"
/>
</List>
<Divider inset={true} />
<List>
<Subheader inset={true}>Files</Subheader>
<ListItem
leftAvatar={<Avatar icon={<ActionAssignment />} backgroundColor={blue500} />}
rightIcon={<ActionInfo />}
primaryText="Vacation itinerary"
secondaryText="Jan 20, 2014"
/>
<ListItem
leftAvatar={<Avatar icon={<EditorInsertChart />} backgroundColor={yellow600} />}
rightIcon={<ActionInfo />}
primaryText="Kitchen remodel"
secondaryText="Jan 10, 2014"
/>
</List>
</MobileTearSheet>
);
export default ListExampleFolder;
|
src/components/TelegramLoginWidget.js | kpi-ua/ecampus.kpi.ua | import React from 'react';
import PropTypes from 'prop-types';
class TelegramLoginWidget extends React.Component {
componentDidMount() {
const {
botName,
size,
requestAccess,
showUserPic,
callbackOnAuth,
} = this.props;
window.TelegramLoginWidget = {
callbackOnAuth: (user) => callbackOnAuth(user),
};
const script = document.createElement('script');
script.src = 'https://telegram.org/js/telegram-widget.js?5';
script.setAttribute('data-telegram-login', botName || 'samplebot');
script.setAttribute('data-size', size || 'medium');
script.setAttribute('data-radius', '0');
script.setAttribute('data-request-access', requestAccess || 'write');
script.setAttribute('data-userpic', !showUserPic);
script.setAttribute(
'data-onauth',
'TelegramLoginWidget.callbackOnAuth(user)',
);
script.async = true;
this.instance.appendChild(script);
}
render() {
return (
<div ref={(component) => (this.instance = component)}>
{this.props.children}
</div>
);
}
}
TelegramLoginWidget.propTypes = {
callbackOnAuth: PropTypes.func.isRequired,
botName: PropTypes.string.isRequired,
size: PropTypes.oneOf(['small', 'medium', 'large']),
requestAccess: PropTypes.oneOf(['write']),
showUserPic: PropTypes.bool,
};
export default TelegramLoginWidget;
|
src/App.js | thadiggitystank/react-hot-boilerplate | import React, { Component } from 'react';
export default class App extends Component {
render() {
return (
<h1>Hello, world.</h1>
);
}
}
|
examples/react-todomvc/components/Header.js | lahmatiy/component-inspector | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import TodoTextInput from './TodoTextInput';
export default class Header extends Component {
static propTypes = {
addTodo: PropTypes.func.isRequired
};
handleSave(text) {
if (text.length !== 0) {
this.props.addTodo(text);
}
}
render() {
return (
<header className='header'>
<h1>todos</h1>
<TodoTextInput newTodo={true}
onSave={::this.handleSave}
placeholder='What needs to be done?' />
</header>
);
}
}
|
src/client/StoryList.js | JiLiZART/tmfeed-menu | import React from 'react'
import Story from './Story.js'
import _ from 'lodash'
export default class StoryList extends React.Component {
render () {
var onUrlClick = this.props.onUrlClick;
var onMarkAsRead = this.props.onMarkAsRead;
var storyNodes = _.map(this.props.stories, function (story, index) {
return (
<div key={index} className='story-list__item'>
<Story story={story} onUrlClick={onUrlClick} onMarkAsRead={onMarkAsRead}/>
</div>
)
});
return (
<div className='story-list'>
{storyNodes}
</div>
)
}
}
StoryList.propTypes = {
onUrlClick: React.PropTypes.func.isRequired,
onMarkAsRead: React.PropTypes.func.isRequired,
stories: React.PropTypes.array.isRequired
};
|
packages/mineral-ui-icons/src/IconThumbsUpDown.js | mineral-ui/mineral-ui | /* @flow */
import React from 'react';
import Icon from 'mineral-ui/Icon';
import type { IconProps } from 'mineral-ui/Icon/types';
/* eslint-disable prettier/prettier */
export default function IconThumbsUpDown(props: IconProps) {
const iconProps = {
rtl: false,
...props
};
return (
<Icon {...iconProps}>
<g>
<path d="M12 6c0-.55-.45-1-1-1H5.82l.66-3.18.02-.23c0-.31-.13-.59-.33-.8L5.38 0 .44 4.94C.17 5.21 0 5.59 0 6v6.5c0 .83.67 1.5 1.5 1.5h6.75c.62 0 1.15-.38 1.38-.91l2.26-5.29c.07-.17.11-.36.11-.55V6zm10.5 4h-6.75c-.62 0-1.15.38-1.38.91l-2.26 5.29c-.07.17-.11.36-.11.55V18c0 .55.45 1 1 1h5.18l-.66 3.18-.02.24c0 .31.13.59.33.8l.79.78 4.94-4.94c.27-.27.44-.65.44-1.06v-6.5c0-.83-.67-1.5-1.5-1.5z"/>
</g>
</Icon>
);
}
IconThumbsUpDown.displayName = 'IconThumbsUpDown';
IconThumbsUpDown.category = 'action';
|
src/components/TicketList/Ticket/Details/index.js | sdwvit/coding-challenge-frontend-b | import React from 'react';
import { string, number, object, func } from 'prop-types';
import { Action } from '../../../';
import getGmapsUrl from '../../../../actions/getGmapsUrl';
import './style.scss';
function Details({ t, origin, destination, duration, transfers, review }) {
const transferStr = (
<strong>{
transfers
? `${transfers} ${t('ticketDetailStops')}`
: t('ticketDetailNonStop')
}</strong>
);
const durationStr = (<strong>
{parseInt(duration / 60, 10)} {t('hours')} {duration % 60} {t('minutes')}
</strong>);
const spacedArrow = ' → ';
return (
<section className="details">
<p>
<Action classnames="link" onClick={getGmapsUrl(origin.name)}>{origin.name}</Action>
{spacedArrow}
<Action classnames="link" onClick={getGmapsUrl(destination.name)}>
{destination.name}
</Action>
</p>
<p>{transferStr} {t('ticketTravelWillTake')} {durationStr}</p>
<p>{t('ticketReviews')}: {t(review)}</p>
</section>
);
}
Details.propTypes = {
duration: number,
transfers: number,
review: string,
origin: object,
destination: object,
t: func,
};
export default Details;
|
src/Breadcrumb.js | dozoisch/react-bootstrap | import classNames from 'classnames';
import React from 'react';
import BreadcrumbItem from './BreadcrumbItem';
import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
class Breadcrumb extends React.Component {
render() {
const { className, ...props } = this.props;
const [bsProps, elementProps] = splitBsProps(props);
const classes = getClassSet(bsProps);
return (
<ol
{...elementProps}
role="navigation"
aria-label="breadcrumbs"
className={classNames(className, classes)}
/>
);
}
}
Breadcrumb.Item = BreadcrumbItem;
export default bsClass('breadcrumb', Breadcrumb);
|
docs/app/Examples/elements/List/ContentVariations/ListExampleFloated.js | ben174/Semantic-UI-React | import React from 'react'
import { Button, Image, List } from 'semantic-ui-react'
const ListExampleFloated = () => (
<List divided verticalAlign='middle'>
<List.Item>
<List.Content floated='right'>
<Button>Add</Button>
</List.Content>
<Image avatar src='http://semantic-ui.com/images/avatar2/small/lena.png' />
<List.Content>
Lena
</List.Content>
</List.Item>
<List.Item>
<List.Content floated='right'>
<Button>Add</Button>
</List.Content>
<Image avatar src='http://semantic-ui.com/images/avatar2/small/lindsay.png' />
<List.Content>
Lindsay
</List.Content>
</List.Item>
<List.Item>
<List.Content floated='right'>
<Button>Add</Button>
</List.Content>
<Image avatar src='http://semantic-ui.com/images/avatar2/small/mark.png' />
<List.Content>
Mark
</List.Content>
</List.Item>
<List.Item>
<List.Content floated='right'>
<Button>Add</Button>
</List.Content>
<Image avatar src='http://semantic-ui.com/images/avatar2/small/molly.png' />
<List.Content>
Molly
</List.Content>
</List.Item>
</List>
)
export default ListExampleFloated
|
src/components/Loader/Loader.js | City-of-Helsinki/helerm-ui | import React from 'react';
import PropTypes from 'prop-types';
import './Loader.scss';
const Loader = ({ show }) => (
show
? (<div className='loader-container'>
<span className='fa fa-2x fa-spinner fa-spin loader'/>
</div>)
: null
);
Loader.propTypes = {
show: PropTypes.bool.isRequired
};
export default Loader;
|
examples/huge-apps/app.js | CivBase/react-router | import React from 'react';
import { Router } from 'react-router';
import stubbedCourses from './stubs/COURSES';
var rootRoute = {
component: 'div',
childRoutes: [{
path: '/',
component: require('./components/App'),
childRoutes: [
require('./routes/Calendar'),
require('./routes/Course'),
require('./routes/Grades'),
require('./routes/Messages'),
require('./routes/Profile'),
]
}]
};
React.render(
<Router routes={rootRoute} />,
document.getElementById('example')
);
// I've unrolled the recursive directory loop that is happening above to get a
// better idea of just what this huge-apps Router looks like
//
// import { Route } from 'react-router'
// import App from './components/App';
// import Course from './routes/Course/components/Course';
// import AnnouncementsSidebar from './routes/Course/routes/Announcements/components/Sidebar';
// import Announcements from './routes/Course/routes/Announcements/components/Announcements';
// import Announcement from './routes/Course/routes/Announcements/routes/Announcement/components/Announcement';
// import AssignmentsSidebar from './routes/Course/routes/Assignments/components/Sidebar';
// import Assignments from './routes/Course/routes/Assignments/components/Assignments';
// import Assignment from './routes/Course/routes/Assignments/routes/Assignment/components/Assignment';
// import CourseGrades from './routes/Course/routes/Grades/components/Grades';
// import Calendar from './routes/Calendar/components/Calendar';
// import Grades from './routes/Grades/components/Grades';
// import Messages from './routes/Messages/components/Messages';
// React.render(
// <Router>
// <Route path="/" component={App}>
// <Route path="calendar" component={Calendar} />
// <Route path="course/:courseId" component={Course}>
// <Route path="announcements" components={{
// sidebar: AnnouncementsSidebar,
// main: Announcements
// }}>
// <Route path=":announcementId" component={Announcement} />
// </Route>
// <Route path="assignments" components={{
// sidebar: AssignmentsSidebar,
// main: Assignments
// }}>
// <Route path=":assignmentId" component={Assignment} />
// </Route>
// <Route path="grades" component={CourseGrades} />
// </Route>
// <Route path="grades" component={Grades} />
// <Route path="messages" component={Messages} />
// <Route path="profile" component={Calendar} />
// </Route>
// </Router>,
// document.getElementById('example')
// );
|
webpack/move_to_foreman/components/common/table/formatters/collapseableAndSelectionCellFormatter.js | ares/katello | import React from 'react';
import selectionCellFormatter from './selectionCellFormatter';
import CollapseSubscriptionGroupButton from '../components/CollapseSubscriptionGroupButton';
export default (collapseableController, selectionController, additionalData) => {
const shouldShowCollapseButton = collapseableController.isCollapseable(additionalData);
return selectionCellFormatter(
selectionController,
additionalData,
shouldShowCollapseButton && (
<CollapseSubscriptionGroupButton
collapsed={collapseableController.isCollapsed(additionalData)}
onClick={() => collapseableController.toggle(additionalData)}
/>
),
);
};
|
.storybook/preview.js | LN-Zap/zap-desktop | import React from 'react'
import { addParameters, addDecorator, configure, setAddon } from '@storybook/react'
import { withThemes } from 'storybook-styled-components'
import { withTheme } from 'styled-components'
import chaptersAddon, { setDefaults } from 'react-storybook-addon-chapters'
import { withKnobs } from '@storybook/addon-knobs'
import { linkTo } from '@storybook/addon-links'
import { setIntlConfig, withIntl } from 'storybook-addon-intl'
import StoryRouter from 'storybook-react-router'
import { dark, light } from 'themes'
import { getDefaultLocale, locales } from '@zap/i18n'
import { BackgroundPrimary, GlobalStyle } from 'components/UI'
import '@storybook/addon-console'
// Get translations.
import translations from '@zap/i18n/translation'
const BackgroundPrimaryWithTheme = withTheme(({ theme, ...rest }) => (
<BackgroundPrimary
className={theme.name}
height="100vh"
p={3}
sx={{
overflowY: 'auto !important',
}}
{...rest}
/>
))
// Set intl configuration
setIntlConfig({
locales,
defaultLocale: getDefaultLocale(),
getMessages: locale => translations[locale],
})
// Intl
addDecorator(withIntl)
// Router
addDecorator(StoryRouter({}))
// Knobs
addDecorator(withKnobs)
// Zap Global style.
addDecorator(story => (
<>
<GlobalStyle />
<BackgroundPrimaryWithTheme>{story()}</BackgroundPrimaryWithTheme>
</>
))
// Zap Themes.
addDecorator(withThemes({ Dark: dark, Light: light }))
// Chapters
setAddon(chaptersAddon)
setDefaults({
sectionOptions: {
showSource: false,
allowSourceToggling: false,
showPropTables: false,
allowPropTablesToggling: true,
},
})
|
assets/jqwidgets/demos/react/app/datetimeinput/righttoleftlayout/app.js | juannelisalde/holter | import React from 'react';
import ReactDOM from 'react-dom';
import JqxDateTimeInput from '../../../jqwidgets-react/react_jqxdatetimeinput.js';
class App extends React.Component {
render() {
return (
<JqxDateTimeInput
width={250} height={25}
culture={'he-IL'} rtl={true}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
docs/src/app/AppRoutes.js | manchesergit/material-ui | import React from 'react';
import {
Route,
Redirect,
IndexRoute,
} from 'react-router';
// Here we define all our material-ui ReactComponents.
import Master from './components/Master';
import Home from './components/pages/Home';
import RequiredKnowledge from './components/pages/get-started/RequiredKnowledge';
import Installation from './components/pages/get-started/Installation';
import Usage from './components/pages/get-started/Usage';
import Examples from './components/pages/get-started/Examples';
import ServerRendering from './components/pages/get-started/ServerRendering';
import Colors from './components/pages/customization/Colors';
import Themes from './components/pages/customization/Themes';
import Styles from './components/pages/customization/Styles';
import AppBarPage from './components/pages/components/AppBar/Page';
import AutoCompletePage from './components/pages/components/AutoComplete/Page';
import AvatarPage from './components/pages/components/Avatar/Page';
import BadgePage from './components/pages/components/Badge/Page';
import BottomNavigationPage from './components/pages/components/BottomNavigation/Page';
import CardPage from './components/pages/components/Card/Page';
import ChipPage from './components/pages/components/Chip/Page';
import CircularProgressPage from './components/pages/components/CircularProgress/Page';
import CheckboxPage from './components/pages/components/Checkbox/Page';
import DatePicker from './components/pages/components/DatePicker/Page';
import DialogPage from './components/pages/components/Dialog/Page';
import DividerPage from './components/pages/components/Divider/Page';
import DrawerPage from './components/pages/components/Drawer/Page';
import DropDownMenuPage from './components/pages/components/DropDownMenu/Page';
import FlatButtonPage from './components/pages/components/FlatButton/Page';
import FloatingActionButtonPage from './components/pages/components/FloatingActionButton/Page';
import FontIconPage from './components/pages/components/FontIcon/Page';
import GridListPage from './components/pages/components/GridList/Page';
import IconButtonPage from './components/pages/components/IconButton/Page';
import IconMenuPage from './components/pages/components/IconMenu/Page';
import ListPage from './components/pages/components/List/Page';
import LinearProgressPage from './components/pages/components/LinearProgress/Page';
import PaperPage from './components/pages/components/Paper/Page';
import MenuPage from './components/pages/components/Menu/Page';
import PopoverPage from './components/pages/components/Popover/Page';
import RaisedButtonPage from './components/pages/components/RaisedButton/Page';
import RefreshIndicatorPage from './components/pages/components/RefreshIndicator/Page';
import RadioButtonPage from './components/pages/components/RadioButton/Page';
import SelectField from './components/pages/components/SelectField/Page';
import SliderPage from './components/pages/components/Slider/Page';
import SnackbarPage from './components/pages/components/Snackbar/Page';
import SvgIconPage from './components/pages/components/SvgIcon/Page';
import SubheaderPage from './components/pages/components/Subheader/Page';
import TablePage from './components/pages/components/Table/Page';
import TabsPage from './components/pages/components/Tabs/Page';
import TextFieldPage from './components/pages/components/TextField/Page';
import TimePickerPage from './components/pages/components/TimePicker/Page';
import TogglePage from './components/pages/components/Toggle/Page';
import ToolbarPage from './components/pages/components/Toolbar/Page';
import Community from './components/pages/discover-more/Community';
import Contributing from './components/pages/discover-more/Contributing';
import Showcase from './components/pages/discover-more/Showcase';
import RelatedProjects from './components/pages/discover-more/RelatedProjects';
import StepperPage from './components/pages/components/Stepper/Page';
/**
* Routes: https://github.com/reactjs/react-router/blob/master/docs/API.md#route
*
* Routes are used to declare your view hierarchy.
*
* Say you go to http://material-ui.com/#/components/paper
* The react router will search for a route named 'paper' and will recursively render its
* handler and its parent handler like so: Paper > Components > Master
*/
const AppRoutes = (
<Route path="/" component={Master}>
<IndexRoute component={Home} />
<Route path="home" component={Home} />
<Redirect from="get-started" to="/get-started/required-knowledge" />
<Route path="get-started">
<Route path="required-knowledge" component={RequiredKnowledge} />
<Route path="installation" component={Installation} />
<Route path="usage" component={Usage} />
<Route path="examples" component={Examples} />
<Route path="server-rendering" component={ServerRendering} />
</Route>
<Redirect from="customization" to="/customization/themes" />
<Route path="customization">
<Route path="colors" component={Colors} />
<Route path="themes" component={Themes} />
<Route path="styles" component={Styles} />
</Route>
<Redirect from="components" to="/components/app-bar" />
<Route path="components">
<Route path="app-bar" component={AppBarPage} />
<Route path="auto-complete" component={AutoCompletePage} />
<Route path="avatar" component={AvatarPage} />
<Route path="bottom-navigation" component={BottomNavigationPage} />
<Route path="badge" component={BadgePage} />
<Route path="card" component={CardPage} />
<Route path="chip" component={ChipPage} />
<Route path="circular-progress" component={CircularProgressPage} />
<Route path="checkbox" component={CheckboxPage} />
<Route path="date-picker" component={DatePicker} />
<Route path="dialog" component={DialogPage} />
<Route path="divider" component={DividerPage} />
<Route path="drawer" component={DrawerPage} />
<Route path="dropdown-menu" component={DropDownMenuPage} />
<Route path="font-icon" component={FontIconPage} />
<Route path="flat-button" component={FlatButtonPage} />
<Route path="floating-action-button" component={FloatingActionButtonPage} />
<Route path="grid-list" component={GridListPage} />
<Route path="icon-button" component={IconButtonPage} />
<Route path="icon-menu" component={IconMenuPage} />
<Route path="list" component={ListPage} />
<Route path="linear-progress" component={LinearProgressPage} />
<Route path="paper" component={PaperPage} />
<Route path="menu" component={MenuPage} />
<Route path="popover" component={PopoverPage} />
<Route path="refresh-indicator" component={RefreshIndicatorPage} />
<Route path="radio-button" component={RadioButtonPage} />
<Route path="raised-button" component={RaisedButtonPage} />
<Route path="select-field" component={SelectField} />
<Route path="svg-icon" component={SvgIconPage} />
<Route path="slider" component={SliderPage} />
<Route path="snackbar" component={SnackbarPage} />
<Route path="stepper" component={StepperPage} />
<Route path="subheader" component={SubheaderPage} />
<Route path="table" component={TablePage} />
<Route path="tabs" component={TabsPage} />
<Route path="text-field" component={TextFieldPage} />
<Route path="time-picker" component={TimePickerPage} />
<Route path="toggle" component={TogglePage} />
<Route path="toolbar" component={ToolbarPage} />
</Route>
<Redirect from="discover-more" to="/discover-more/community" />
<Route path="discover-more">
<Route path="community" component={Community} />
<Route path="contributing" component={Contributing} />
<Route path="showcase" component={Showcase} />
<Route path="related-projects" component={RelatedProjects} />
</Route>
</Route>
);
export default AppRoutes;
|
examples/files/react/reactDom.js | dabbott/react-express | import React from 'react'
import { render } from 'react-dom'
// Create a React element
const element = <button>Hello, world!</button>
// Render it into the DOM
render(element, document.querySelector('#app'))
|
src/components/tables/RankingsTable.js | availabs/kauffman-atlas | /* @flow */
import React from 'react'
import { connect } from 'react-redux'
import CategoryNames from 'components/misc/categoryNames'
import classes from 'styles/sitewide/index.scss'
var roundFormat = d3.format(".2f")
import d3 from 'd3'
let categories = {
combined: ['combinedcomposite', 'densitycomposite', 'fluiditycomposite', 'diversitycomposite'],
density: ['densitycomposite','densitynewfirms', 'densityshareofemploymentinnewfirms','densityshareEmpNoAccRet','densityshareEmpHighTech'],
diversity: ['diversitycomposite','diversityincomebasedonchildhood','diversitypercentageofforeignbornpopulation','diversityemploymentlocationquotientvariance'],
fluidity: ['fluiditycomposite','fluidityhighgrowthfirms','fluiditynetmigration','fluiditytotalmigration','fluidityannualchurn'],
qwiDensity: ['qwiDensityshareEmpAll','qwiDensityshareEmpInfo','qwiDensityshareEmpPro']
}
export class RankingsTable extends React.Component<void, Props, void> {
constructor () {
super()
this.state = {
sortDirection:"nat",
sortColumn:null
}
this._sortTableChange = this._sortTableChange.bind(this)
this._renderTable = this._renderTable.bind(this)
}
_sortTableChange (columnNameInput,e){
d3.selectAll(".caret").style('visibility','visible')
d3.selectAll("."+classes["upCaret"]).style('visibility','visible')
var columnName = columnNameInput == "rank" ? this.props.active : columnNameInput
d3.selectAll("."+classes['rankingsTableHeader']).style("font-weight","400")
d3.select("#"+columnNameInput).style("font-weight","900")
if(this.state.sortColumn == columnName){
this.state.sortDirection == "nat" ? d3.select("#"+columnName).select("span").select(".caret").style('visibility','hidden') : d3.select("#"+columnName).select("span").select("."+classes["upCaret"]).style('visibility','hidden')
this.setState({sortDirection:this.state.sortDirection == "nat" ? "rev" : "nat"})
}
else{
d3.select("#"+columnName).select("span").select("."+classes["upCaret"]).style('visibility','hidden')
this.setState({sortColumn:columnName,sortDirection:"nat"})
}
}
componentWillMount(){
this.setState({sortColumn:this.props.active})
}
checkMetroBuckets(thisMetros,nextMetros){
if(thisMetros.length == nextMetros.length){
//Check to see if they are the same
for(var i=0; i<thisMetros.length; i++){
if(thisMetros[i] != nextMetros[i]){
return true;
}
}
//If we never find a mismatch, the list of metros is the same, we don't need to redraw anything.
return false;
}
return true;
}
shouldComponentUpdate(nextProps,nextState){
if(this.props.active != nextProps.active ||
this.state.sortColumn != nextState.sortColumn ||
this.state.sortDirection != nextState.sortDirection ||
this.props.year != nextProps.year ||
this.checkMetroBuckets(this.props.metrosInBucket,nextProps.metrosInBucket)){
return true
}
else{
return false
}
}
componentWillReceiveProps(nextProps){
if(!this.state.sortColumn || this.props.active != nextProps.active){
this._sortTableChange(nextProps.active)
this.setState({sortColumn:nextProps.active})
}
}
_renderTable(data){
function _sortValues(year){
return (a,b) => {
var aValue = null,
bValue = null;
a.values.forEach(yearValues => {
if(yearValues.x == year){
aValue = yearValues.y;
}
})
b.values.forEach(yearValues => {
if(yearValues.x == year){
bValue = yearValues.y;
}
})
if(aValue >= bValue){
return -1;
}
if(bValue > aValue){
return 1;
}
}
}
function _sortProp(prop){
return (a,b) => {
var aValue,
bValue;
aValue = a[prop];
bValue = b[prop];
if(aValue >= bValue){
return 1;
}
if(bValue > aValue){
return -1
}
}
}
if(!this.state.sortColumn){
return <span>Loading...</span>
}
//If sort column == name, then use active to draw table
//Otherwise, use the desired metric
var indexingColumn = this.state.sortColumn == "Name" ? this.props.active : this.state.sortColumn
if(this.props.metrosInBucket){
Object.keys(data).forEach(catName => {
data[catName] = data[catName].filter(d => {
var inBucket = false;
this.props.metrosInBucket.forEach(msaId => {
if(d.key == msaId){
inBucket = true;
}
})
return inBucket;
})
})
}
//Sort by desired metric OR name
if(this.state.sortColumn == "Name"){
data[indexingColumn].sort(_sortProp("name"))
}
else{
if(this.state.sortColumn == "diversityincomebasedonchildhood" && this.props.active != "diversityincomebasedonchildhood"){
data[indexingColumn].sort(_sortValues("combined"))
}
else if(this.state.sortColumn != "diversityincomebasedonchildhood" && this.props.active == "diversityincomebasedonchildhood"){
data[indexingColumn].sort(_sortValues(2013))
}
else{
data[indexingColumn].sort(_sortValues(this.props.year))
}
}
this.state.sortDirection == "rev" ? data[indexingColumn].reverse() : null
return (
<table id="rankingsTable" className={'table ' + classes['table-hover']}>
<thead>
<tr>
<td id="rank" className={classes['rankingsTableHeader'] + " col-md-1"}>
<a
onClick={this._sortTableChange.bind(null,"rank")}>
Rank
</a>
</td>
<td id="Name" className={classes['rankingsTableHeader'] + " col-md-4"}>
<a
onClick={this._sortTableChange.bind(null,"Name")}>
Name
</a>
</td>
{
Object.keys(data).map(cat => {
var colWidth = Math.floor((Object.keys(data).length)/8)
return (
<td id={cat} className={classes['rankingsTableHeader'] + " col-md-"+colWidth}>
<a
onClick={this._sortTableChange.bind(null,cat)}>
{CategoryNames[cat]}
</a>
</td>
)
})
}
</tr>
</thead>
<tbody>
{
//Make a row for each metro, order determined by sort column
data[indexingColumn].map(metro => {
//Go through each metric in the dataset.
var metroCells = Object.keys(data).map(catName => {
if(catName == "diversityincomebasedonchildhood" && this.props.active != "diversityincomebasedonchildhood"){
var singleMetroYearValue = data[catName].filter(d => d.key == metro.key)[0] ? data[catName].filter(d => d.key == metro.key)[0].values.filter(d => d.x == "combined")[0] : null
}
else{
if(catName !== "diversityincomebasedonchildhood" && typeof this.props.year != "number"){
var singleMetroYearValue = data[catName].filter(d => d.key == metro.key)[0] ? data[catName].filter(d => d.key == metro.key)[0].values.filter(d => d.x == 2013)[0] : null
}
else{
var singleMetroYearValue = data[catName].filter(d => d.key == metro.key)[0] ? data[catName].filter(d => d.key == metro.key)[0].values.filter(d => d.x == this.props.year)[0] : null
}
}
return (<td>{singleMetroYearValue ? roundFormat(singleMetroYearValue.y) : ""}</td>)
})
if(this.state.sortColumn == "diversityincomebasedonchildhood" && this.props.active != "diversityincomebasedonchildhood"){
var rankCellData = data[this.props.active].filter(d => d.key == metro.key)[0] ? data[this.props.active].filter(d => d.key == metro.key)[0].values.filter(d => d.x == "combined")[0] : null
}
else{
var rankCellData = data[this.props.active].filter(d => d.key == metro.key)[0] ? data[this.props.active].filter(d => d.key == metro.key)[0].values.filter(d => d.x == this.props.year)[0] : null
var rankCellDataPrior = data[this.props.active].filter(d => d.key == metro.key)[0] ? data[this.props.active].filter(d => d.key == metro.key)[0].values.filter(d => d.x == (this.props.year-1))[0] : null
}
if(rankCellData && rankCellDataPrior){
var rankDelta = rankCellDataPrior.rank - rankCellData.rank;
}
else{
rankDelta = null;
}
if(rankDelta>0){
var deltaCell = (
<span>
<div style={{float:"right",paddingLeft:"3px"}}>
{rankDelta}
</div>
<span className={classes['rankingsCaret']}>
<span style={{color:'green'}} className={classes['upCaret']} />
</span>
</span>
)
}
else if(rankDelta<0){
var deltaCell = (
<span>
<div style={{float:"right",paddingLeft:"3px"}}>
{rankDelta}
</div>
<span className={classes['rankingsCaret']}>
<span style={{color:'red'}} className="caret"></span>
</span>
</span>
)
}
else{
var deltaCell = (
<span>
<div style={{float:"right",paddingLeft:"3px"}}>
{rankDelta}
</div>
</span>
)
}
var rankCellData = data[this.props.active].filter(d => d.key == metro.key)[0] ? data[this.props.active].filter(d => d.key == metro.key)[0].values.filter(d => d.x == this.props.year)[0] : null
var rankCell = (<td>{rankCellData ? rankCellData.rank : ""}{deltaCell}</td>)
return (
<tr id={metro.key} onClick={this.props.onClick.bind(null,metro.key)} onMouseOver={this.props.onHover.bind(null,metro.key)}>
{rankCell}
<td>{metro.name}</td>
{metroCells}
</tr>
)
})
}
</tbody>
</table>
)
}
render() {
console.log(this.props)
return (
<div>
{this._renderTable(this.props.data2)}
</div>
)
}
}
const mapStateToProps = (state) => ({
metros : state.metros
})
export default connect((mapStateToProps), {
})(RankingsTable)
|
packages/shared/ReactGlobalSharedState.js | apaatsio/react | /**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
const ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
export const ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
export const ReactDebugCurrentFrame = __DEV__
? ReactInternals.ReactDebugCurrentFrame
: null;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.