path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
src/components/misc/notifications.js | scholtzm/arnold | import React, { Component } from 'react';
import NotificationSystem from 'react-notification-system';
import NotificationStore from '../../stores/notification-store.js';
class Notifications extends Component {
constructor(...args) {
super(...args);
this._onChange = this._onChange.bind(this);
}
_onChange() {
const lastNotification = NotificationStore.getLast();
this.refs.notificationSystem.addNotification(lastNotification);
}
componentDidMount() {
NotificationStore.addChangeListener(this._onChange);
}
componentWillUnmount() {
NotificationStore.removeChangeListener(this._onChange);
}
render() {
return (
<NotificationSystem ref='notificationSystem' />
);
}
}
export default Notifications;
|
src/containers/Coba/Coba.js | hirzanalhakim/testKumparan | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { DecrementButton } from 'components';
import { set } from 'redux/modules/name';
@connect(
state => ({ counter: state.counter, name: state.name.name }),
{ setName: set }
)
export default class Coba extends Component {
constructor(props) {
super(props);
this.state = {
name: ''
}
}
handleClick = () => {
// console.log(this.refs.input.value);
this.props.setName(this.state.name);
}
handleChange = (event) => {
this.setState({ name: event.target.value })
}
render() {
const { name } = this.state;
return (
<div>
<br/>Hallo, {this.props.name}<br />
Counter 1: {this.props.counter.counter1.count}
<DecrementButton multireducerKey="counter1" />
{/*<input type="text" ref="input"/>*/}
<input type="text" value={name} onChange={this.handleChange} />
<button onClick={this.handleClick}>input</button>
</div>
);
}
} |
src/pwa.js | Nuriddinkhuja/photoshare | import React from 'react';
import ReactDOM from 'react-dom/server';
import Html from './helpers/Html';
export default function () {
return `<!doctype html>${ReactDOM.renderToStaticMarkup(<Html />)}`;
}
|
test/integration/error-in-error/pages/_error.js | BlancheXu/test | import React from 'react'
class Error extends React.Component {
static async getInitialProps ({ res, err }) {
await Promise.reject(new Error('an error in error'))
const statusCode = res ? res.statusCode : err ? err.statusCode : null
return { statusCode }
}
render () {
return (
<p>
{this.props.statusCode
? `An error ${this.props.statusCode} occurred on server`
: 'An error occurred on client'}
</p>
)
}
}
export default Error
|
analysis/warlockaffliction/src/modules/features/Checklist/Component.js | yajinni/WoWAnalyzer | import React from 'react';
import PropTypes from 'prop-types';
import { SpellLink } from 'interface';
import SPELLS from 'common/SPELLS';
import COVENANTS from 'game/shadowlands/COVENANTS';
import Checklist from 'parser/shared/modules/features/Checklist';
import Rule from 'parser/shared/modules/features/Checklist/Rule';
import Requirement from 'parser/shared/modules/features/Checklist/Requirement';
import PreparationRule from 'parser/shared/modules/features/Checklist/PreparationRule';
import GenericCastEfficiencyRequirement from 'parser/shared/modules/features/Checklist/GenericCastEfficiencyRequirement';
const AfflictionWarlockChecklist = ({ combatant, castEfficiency, thresholds, shardTracker }) => {
const DotUptime = props => (
<Requirement
name={(
<>
<SpellLink id={props.id} icon /> uptime
</>
)}
thresholds={props.thresholds}
/>
);
DotUptime.propTypes = {
id: PropTypes.number.isRequired,
};
const AbilityRequirement = props => (
<GenericCastEfficiencyRequirement
castEfficiency={castEfficiency.getCastEfficiencyForSpellId(props.spell)}
{...props}
/>
);
AbilityRequirement.propTypes = {
spell: PropTypes.number.isRequired,
};
return (
<Checklist>
<Rule
name="Maintain your DoTs and debuffs on the boss"
description="Affliction Warlocks rely on DoTs and debuffs as means of dealing damage to the target. You should try to keep as highest uptime on them as possible."
>
<DotUptime id={SPELLS.AGONY.id} thresholds={thresholds.agony} />
<DotUptime id={SPELLS.CORRUPTION_CAST.id} thresholds={thresholds.corruption} />
<DotUptime id={SPELLS.UNSTABLE_AFFLICTION.id} thresholds={thresholds.unstableAffliction} />
<DotUptime id={SPELLS.SHADOW_EMBRACE.id} thresholds={thresholds.shadowEmbrace} />
{combatant.hasTalent(SPELLS.SIPHON_LIFE_TALENT.id) && <DotUptime id={SPELLS.SIPHON_LIFE_TALENT.id} thresholds={thresholds.siphonLife} />}
{combatant.hasTalent(SPELLS.HAUNT_TALENT.id) && <DotUptime id={SPELLS.HAUNT_TALENT.id} thresholds={thresholds.haunt} />}
{combatant.hasCovenant(COVENANTS.KYRIAN.id) && <DotUptime id={SPELLS.SCOURING_TITHE.id} thresholds={thresholds.scouringTithe} />}
</Rule>
<Rule
name="Don't cap your Soul Shards"
description="Soul Shards are your main and most important resource and since their generation is random as Affliction, it's very important not to let them cap."
>
<Requirement
name="Wasted shards per minute"
thresholds={thresholds.soulShards}
valueTooltip={`You wasted ${shardTracker.wasted} shards.`}
/>
</Rule>
<Rule
name="Use your cooldowns"
description="Be mindful of your cooldowns if you are specced into them and use them when it's appropriate. It's okay to hold a cooldown for a little bit when the encounter requires it (burn phases), but generally speaking you should use them as much as you can."
>
<AbilityRequirement spell={SPELLS.SUMMON_DARKGLARE.id} />
{combatant.hasTalent(SPELLS.DARK_SOUL_MISERY_TALENT.id) && <AbilityRequirement spell={SPELLS.DARK_SOUL_MISERY_TALENT.id} />}
{combatant.hasTalent(SPELLS.VILE_TAINT_TALENT.id) && <AbilityRequirement spell={SPELLS.VILE_TAINT_TALENT.id} />}
{combatant.hasTalent(SPELLS.PHANTOM_SINGULARITY_TALENT.id) && <AbilityRequirement spell={SPELLS.PHANTOM_SINGULARITY_TALENT.id} />}
{combatant.hasCovenant(COVENANTS.NIGHT_FAE.id) && <AbilityRequirement spell={SPELLS.SOUL_ROT.id} />}
{combatant.hasCovenant(COVENANTS.NECROLORD.id) && <AbilityRequirement spell={SPELLS.DECIMATING_BOLT.id} />}
{combatant.hasCovenant(COVENANTS.VENTHYR.id) && <AbilityRequirement spell={SPELLS.IMPENDING_CATASTROPHE_CAST.id} />}
</Rule>
<Rule
name="Use your utility and defensive spells"
description={(
<>
Use other spells in your toolkit to your advantage. For example, you can try to minimize necessary movement by using <SpellLink id={SPELLS.DEMONIC_GATEWAY_CAST.id} icon />, <SpellLink id={SPELLS.DEMONIC_CIRCLE.id} icon />, <SpellLink id={SPELLS.BURNING_RUSH_TALENT.id} icon /> or mitigate incoming damage with <SpellLink id={SPELLS.UNENDING_RESOLVE.id} icon />/<SpellLink id={SPELLS.DARK_PACT_TALENT.id} icon />.<br />
While you shouldn't cast these defensives on cooldown, be aware of them and use them whenever effective. Not using them at all indicates you might not be aware of them or not using them optimally.
</>
)}
>
<AbilityRequirement spell={SPELLS.DEMONIC_CIRCLE_TELEPORT.id} />
{combatant.hasTalent(SPELLS.DARK_PACT_TALENT.id) && <AbilityRequirement spell={SPELLS.DARK_PACT_TALENT.id} />}
<AbilityRequirement spell={SPELLS.UNENDING_RESOLVE.id} />
{combatant.hasCovenant(COVENANTS.NIGHT_FAE.id) && <AbilityRequirement spell={SPELLS.SOULSHAPE.id} />}
</Rule>
<Rule
name="Always be casting"
description={(
<>
You should try to avoid doing nothing during the fight. When you're out of Soul Shards, cast <SpellLink id={SPELLS.SHADOW_BOLT_AFFLI.id} icon />/<SpellLink id={SPELLS.DRAIN_SOUL_TALENT.id} icon />, refresh your DoTs etc. When you have to move, use your instant abilities or try to utilize <SpellLink id={SPELLS.DEMONIC_CIRCLE.id} icon>Teleport</SpellLink> or <SpellLink id={SPELLS.DEMONIC_GATEWAY_CAST.id} icon>Gateway</SpellLink> to reduce the movement even further.
</>
)}
>
<Requirement name="Downtime" thresholds={thresholds.downtime} />
</Rule>
<PreparationRule thresholds={thresholds} />
</Checklist>
);
};
AfflictionWarlockChecklist.propTypes = {
castEfficiency: PropTypes.object.isRequired,
combatant: PropTypes.shape({
hasTalent: PropTypes.func.isRequired,
hasCovenant: PropTypes.func.isRequired,
}).isRequired,
thresholds: PropTypes.object.isRequired,
shardTracker: PropTypes.object.isRequired,
};
export default AfflictionWarlockChecklist;
|
server/sonar-web/src/main/js/apps/overview/gate/gate-conditions.js | joansmith/sonarqube | /*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
import GateCondition from './gate-condition';
export default React.createClass({
propTypes: {
gate: React.PropTypes.object.isRequired,
component: React.PropTypes.object.isRequired
},
render() {
let conditions = this.props.gate.conditions
.filter(c => c.level !== 'OK')
.map(c => <GateCondition key={c.metric.name} condition={c} component={this.props.component}/>);
return <ul className="overview-gate-conditions-list">{conditions}</ul>;
}
});
|
app/javascript/mastodon/features/notifications/components/notification.js | pixiv/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import StatusContainer from '../../../containers/status_container';
import AccountContainer from '../../../containers/account_container';
import { FormattedMessage } from 'react-intl';
import Permalink from '../../../components/permalink';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { HotKeys } from 'react-hotkeys';
export default class Notification extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
pawooPushHistory: PropTypes.func,
};
static propTypes = {
notification: ImmutablePropTypes.map.isRequired,
hidden: PropTypes.bool,
onMoveUp: PropTypes.func.isRequired,
onMoveDown: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
};
handleMoveUp = () => {
const { notification, onMoveUp } = this.props;
onMoveUp(notification.get('id'));
}
handleMoveDown = () => {
const { notification, onMoveDown } = this.props;
onMoveDown(notification.get('id'));
}
handleOpen = () => {
const { notification } = this.props;
if (notification.get('status')) {
this.context.pawooPushHistory(`/statuses/${notification.get('status')}`);
} else {
this.handleOpenProfile();
}
}
handleOpenProfile = () => {
const { notification } = this.props;
this.context.pawooPushHistory(`/accounts/${notification.getIn(['account', 'id'])}`);
}
handleMention = e => {
e.preventDefault();
const { notification, onMention } = this.props;
onMention(notification.get('account'), this.context.router.history);
}
getHandlers () {
return {
moveUp: this.handleMoveUp,
moveDown: this.handleMoveDown,
open: this.handleOpen,
openProfile: this.handleOpenProfile,
mention: this.handleMention,
reply: this.handleMention,
};
}
renderFollow (account, link) {
return (
<HotKeys handlers={this.getHandlers()}>
<div className='notification notification-follow focusable' tabIndex='0'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-user-plus' />
</div>
<FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} />
</div>
<AccountContainer id={account.get('id')} withNote={false} hidden={this.props.hidden} />
</div>
</HotKeys>
);
}
renderMention (notification) {
return (
<StatusContainer
id={notification.get('status')}
withDismiss
hidden={this.props.hidden}
onMoveDown={this.handleMoveDown}
onMoveUp={this.handleMoveUp}
/>
);
}
renderFavourite (notification, link) {
return (
<HotKeys handlers={this.getHandlers()}>
<div className='notification notification-favourite focusable' tabIndex='0'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-star star-icon' />
</div>
<FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} />
</div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={!!this.props.hidden} />
</div>
</HotKeys>
);
}
renderReblog (notification, link) {
return (
<HotKeys handlers={this.getHandlers()}>
<div className='notification notification-reblog focusable' tabIndex='0'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-retweet' />
</div>
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
</div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={this.props.hidden} />
</div>
</HotKeys>
);
}
render () {
const { notification } = this.props;
const account = notification.get('account');
const displayNameHtml = { __html: account.get('display_name_html') };
const link = <bdi><Permalink className='notification__display-name' href={account.get('url')} title={account.get('acct')} to={`/accounts/${account.get('id')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
switch(notification.get('type')) {
case 'follow':
return this.renderFollow(account, link);
case 'mention':
return this.renderMention(notification);
case 'favourite':
return this.renderFavourite(notification, link);
case 'reblog':
return this.renderReblog(notification, link);
}
return null;
}
}
|
src/svg-icons/maps/directions-walk.js | matthewoates/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsDirectionsWalk = (props) => (
<SvgIcon {...props}>
<path d="M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"/>
</SvgIcon>
);
MapsDirectionsWalk = pure(MapsDirectionsWalk);
MapsDirectionsWalk.displayName = 'MapsDirectionsWalk';
MapsDirectionsWalk.muiName = 'SvgIcon';
export default MapsDirectionsWalk;
|
reflux-app/components/Collector/PassiveCollector.js | Orientsoft/conalog-front | import React from 'react'
import { FormattedMessage } from 'react-intl';
let message = require('antd/lib/message')
let Checkbox = require('antd/lib/checkbox')
let Modal = require('antd/lib/modal')
let Form = require('antd/lib/form')
let Tooltip = require('antd/lib/tooltip')
let Input = require('antd/lib/input')
let Button = require('antd/lib/button')
let Select = require('antd/lib/select')
let Icon = require('antd/lib/icon')
import AppActions from '../../actions/AppActions'
import AppStore from '../../stores/AppStore'
import _ from 'lodash'
import { Row, Col } from 'antd';
import classNames from 'classnames';
const confirm = Modal.confirm;
const InputGroup = Input.Group;
const Option = Select.Option;
const FormItem = Form.Item;
const createForm = Form.create;
class PassiveCollector extends React.Component {
constructor(props) {
super(props)
this.state = {
passiveCollectorFlag: false,
passiveCollector: { type: 'LongScript' },
passiveCollectorAdd:{
name:'',
host:'',
cmd:'',
type: 'LongScript',
param:'',
encoding:'UTF-8',
channel:'Redis PubSub',
desc:''
},
passiveCollectorList: [],
passiveCollectorChecklist: [],
certList: [],
selectContent:'name',
searchContent:'',
passiveCollectorListAll:[],
passiveCollectorEditModal: false,
passiveCollectorAddModal:false,
passiveCollectorDeleteModal: false,
delete:"",
delmsg:""
}
}
componentDidMount() {
this.unsubscribe = AppStore.listen(function(state) {
this.setState(state)
}.bind(this))
// get passive collector & cert list
AppActions.getPassiveCollectorList()
AppActions.listCert.triggerAsync()
.then(() => {
const cert = this.state.certList[0]
this.setState({
passiveCollectorAdd: Object.assign(this.state.passiveCollectorAdd, {
// host: cert ? cert.host : ''
host:''
})
})
})
}
componentWillUnmount() {
if (_.isFunction(this.unsubscribe))
this.unsubscribe();
}
showEditConfirm() {
let that = this
confirm({
title: 'Comfirm Update',
content: 'Are you sure to update ' + that.state.passiveCollector.name + ' passive collector?',
onOk() {
// console.log('saveActiveCollector', this.state.activeCollectorTime)
// there might be some fields not set during update
// we'd better read parameters from refs now
that.state.passiveCollector = {
name: that.refs.nameInput.value.trim(),
type: that.refs.typeInput.value.trim(),
cmd: that.refs.cmdInput.value.trim(),
param: that.refs.paramInput.value.trim(),
host: that.refs.hostInput.value.trim(),
encoding: that.refs.encodingInput.value.trim(),
channel: that.refs.channelInput.value.trim(),
desc: that.refs.descInput.value.trim()
}
// ok, save
AppActions.updatePassiveCollector(that.state.passiveCollector)
},
onCancel() {
// do nothing
}
})
}
onItemAdd(){
this.setState({
passiveCollectorAddModal:true
})
}
addPassiveCollectorType(e){
this.setState({
passiveCollectorAdd: Object.assign(this.state.passiveCollectorAdd, {
"type":e})
})
}
addPassiveCollectorHost(e){
this.setState({
passiveCollectorAdd: Object.assign(this.state.passiveCollectorAdd, {
"host":e})
})
}
addPassiveCollectorEncoding(e){
this.setState({
passiveCollectorAdd: Object.assign(this.state.passiveCollectorAdd, {
"encoding":e})
})
}
addPassiveCollectorChannel(e){
this.setState({
passiveCollectorAdd: Object.assign(this.state.passiveCollectorAdd, {
"channel":e})
})
}
addPassiveCollector(e) {
// console.log(e.target.dataset.field,e.target.value)
this.setState({
passiveCollectorAdd: Object.assign(this.state.passiveCollectorAdd, {
[e.target.dataset.field]: e.target.value
})
})
}
savePassiveCollector(e) {
// AppActions.setPassiveCollectorFlag(true)
// check name
let checkResults = this.state.passiveCollectorList.map(collector => {
if (collector.name == this.state.passiveCollectorAdd.name)
return true
else
return false
})
let checkResult = checkResults.reduce((prev, curr, idx) => {
if (curr == true || prev == true)
return true
else
return false
}, false)
if (checkResult == true) {
// check failed - there's already a collector that has this name
message.error('This name is existed!')
return
}
//check passiveCollectorAdd (name,param,host,command,desc can not be empty)
var checkName = false;
var validates = {
name: {
msg: 'name can\'t be empty',
status: false
},
host: {
msg: 'host can\'t be empty',
status: false
},
command: {
msg: 'command can\'t be empty',
status: false
},
param: {
msg: 'parameter can\'t be empty',
status: false
},
desc: {
msg: 'description can\'t be empty',
status: false
}
}
if(this.state.passiveCollectorAdd.name !== ''){
validates.name.status = true
}
if(this.state.passiveCollectorAdd.host !== ''){
validates.host.status = true
}
if(this.state.passiveCollectorAdd.type =="LongScript" && this.state.passiveCollectorAdd.cmd !== ''){
validates.command.status = true
}
if(this.state.passiveCollectorAdd.type =="FileTail"){
validates.command.status = true
}
if(this.state.passiveCollectorAdd.param !== ''){
validates.param.status = true
}
if(this.state.passiveCollectorAdd.desc !== ''){
validates.desc.status = true
}
var result = Object.keys(validates).filter(field => validates[field].status === false)
let reg= /^[A-Za-z]+$/
if(reg.test(this.state.passiveCollectorAdd.name.substring(0,1))){
checkName = true
}
if(!result.length && checkName){
this.setState({
passiveCollectorAdd: this.state.passiveCollectorAdd
}, () => {
// ok, save
AppActions.savePassiveCollector(this.state.passiveCollectorAdd)
this.clearPassiveCollector()
})
}
if(this.state.passiveCollectorAdd.name && !checkName){
message.error('Name of collector should begin with a letter!')
}
if(result.length){
var tip = ''
result.forEach(field => tip += validates[field].msg + ' \n ')
message.error(tip)
}
}
clearPassiveCollector() {
this.setState({
passiveCollectorAddModal:false
})
var that = this
that.setState({
passiveCollectorAdd: {
name:'',
cmd:'',
type:'LongScript',
// host:this.state.certList[0].host,
host: '',
param:'',
encoding:'UTF-8',
channel:'Redis PubSub',
desc:''
}},() => {console.log('clear:'+ this.state.passiveCollectorAdd)})
}
updatePassiveCollector(e) {
e.preventDefault()
AppActions.setPassiveCollector(e.target.dataset.field, e.target.value)
}
updatePassiveCollectorType (e){
AppActions.setPassiveCollector('type',e)
if(this.state.passiveCollector.type == "FileTail"){
AppActions.setPassiveCollector('cmd',"")
}
}
updatePassiveCollectorEncoding (e){
AppActions.setPassiveCollector('encoding',e)
}
updatePassiveCollectorHost (e){
AppActions.setPassiveCollector('host',e)
}
updatePassiveCollectorChannel (e){
AppActions.setPassiveCollector('channel',e)
}
updatePassiveCollectorChecklist() {
let id = this["data-id"]
let idx = _.indexOf(this.that.state.passiveCollectorChecklist, id)
// console.log('updateActiveCollectorChecklist', id, idx)
let checklist = this.that.state.passiveCollectorChecklist
if (idx == -1)
checklist.push(id)
else
_.remove(checklist, (value, checklistIndex) => {
if (idx == checklistIndex)
return true
})
AppActions.setPassiveCollectorChecklist(checklist)
}
handleSelect (e) {
this.setState({
selectContent: e
})
}
handleFilterChange (e) {
this.state.searchContent = e.target.value
this.state.passiveCollectorList = this.state.passiveCollectorListAll
}
handleSearch () {
if(this.state.searchContent == ""){
AppActions.getPassiveCollectorList(
function (state) {
state.passiveCollectorListAll = state.passiveCollectorList
}
);
}else {
var replaceList = this.state.passiveCollectorListAll;
var searchContent = [];
if(this.state.selectContent == "name"){
for( var i = 0; i<replaceList.length; i++) {
if (replaceList[i].name.indexOf(this.state.searchContent) !== -1) {
searchContent.push(replaceList[i])
}
}
}else{
for( var i = 0; i<replaceList.length; i++) {
if (replaceList[i].param.indexOf(this.state.searchContent) !== -1) {
searchContent.push(replaceList[i])
}
}
}
this.setState({
passiveCollectorList: searchContent
})
}
}
onItemEdit(e) {
var t = e.target
if (t.tagName.toLowerCase() == 'span') {
t = t.parentElement
}
this.setState({
passiveCollectorEditModal:true
})
let id = t.getAttribute("data-id")
let idx = _.indexOf(this.state.passiveCollectorChecklist, id)
let checklist = this.state.passiveCollectorChecklist
if (idx == -1) {
checklist.unshift(id)
}else{
checklist = [];
checklist.unshift(id)
}
console.log('checklist',checklist)
AppActions.setPassiveCollectorChecklist(checklist)
AppActions.editPassiveCollector()
}
onItemDelete(e) {
var t = e.target
if (t.tagName.toLowerCase() == 'span') {
t = t.parentElement
}
let id = t.getAttribute("data-id")
let idx = _.indexOf(this.state.passiveCollectorChecklist, id)
let checklist = this.state.passiveCollectorChecklist
if (idx == -1) {
checklist = [];
checklist.unshift(id)
}else{
checklist = [];
checklist.unshift(id)
}
console.log(checklist)
// console.log('updateActiveCollectorChecklist', checklist)
var name = '';
for(var i =0;i<this.state.passiveCollectorListAll.length;i++){
if(this.state.passiveCollectorListAll[i]._id == id){
name = this.state.passiveCollectorListAll[i].name
}
}
confirm({
title: this.state.delete,
content: this.state.delmsg + name + ' ?',
onOk() {
AppActions.setPassiveCollectorChecklist(checklist)
AppActions.deletePassiveCollector()
},
onCancel() {
// do nothing
},
})
}
onEditOk(e) {
AppActions.updatePassiveCollector(this.state.passiveCollector)
this.setState({
passiveCollectorEditModal:false
})
}
onEditCancel() {
this.setState({
passiveCollectorEditModal:false
})
}
render() {
let a = <FormattedMessage id = 'home'/>
let name = a._owner._context.intl.messages.name
let type = a._owner._context.intl.messages.types
let host = a._owner._context.intl.messages.host
let command = a._owner._context.intl.messages.command
let trigger = a._owner._context.intl.messages.trigger
let parameter = a._owner._context.intl.messages.para
let encod = a._owner._context.intl.messages.encod
let channel = a._owner._context.intl.messages.channel
let description = a._owner._context.intl.messages.des
let add = a._owner._context.intl.messages.adding
let edit = a._owner._context.intl.messages.edit
this.state.delete = a._owner._context.intl.messages.comfirmDel
this.state.delmsg = a._owner._context.intl.messages.delMessage
let createHostOptions = () => {
// console.log('createHostOptions', this.state)
return this.state.certList.map(item => {
return <option key={item._id.toString()} value={item._id.toString()}>{item.user+"@"+item.host+":"+item.port}</option>
})
}
let hostOptions = createHostOptions()
let createPassiveCollector = (line, index) => {
let date = new Date(line.ts)
date = date.toLocaleString()
let idx = _.indexOf(this.state.passiveCollectorChecklist, line._id)
// console.log('createPassiveCollector', this.state.passiveCollectorChecklist, line._id, idx)
let passiveCollector
if (idx == -1)
passiveCollector = <tr key={ line._id }>
<td>{ line.name }</td>
<td>{ date }</td>
<td>{ line.type }</td>
<td>{ (line.cmd == '') ? 'N/A' : line.cmd }</td>
<td>{ line.param }</td>
<td>{ line.host }</td>
<td>{ line.encoding }</td>
<td>{ line.channel }</td>
<td>
<span>
<a href="#" data-id={ line._id } that={ this } onClick={this.onItemEdit.bind(this)} ><FormattedMessage id="edit"/></a>
<span className="ant-divider"></span>
<a href="#" data-id={ line._id } that={ this } onClick={this.onItemDelete.bind(this)}><FormattedMessage id="del"/></a>
</span>
</td>
</tr>
else
passiveCollector = <tr key={ line._id }>
<td>{ line.name }</td>
<td>{ date }</td>
<td>{ line.type }</td>
<td>{ (line.cmd == '') ? 'N/A' : line.cmd }</td>
<td>{ line.param }</td>
<td>{ line.host }</td>
<td>{ line.encoding }</td>
<td>{ line.channel }</td>
<td>
<span>
<a href="#" data-id={ line._id } that={ this } onClick={this.onItemEdit.bind(this)}><FormattedMessage id="edit"/></a>
<span className="ant-divider"></span>
<a href="#" data-id={ line._id } that={ this } onClick={this.onItemDelete.bind(this)}><FormattedMessage id="del"/></a>
</span>
</td>
</tr>
return passiveCollector
}
let passiveCollectorTable = this.state.passiveCollectorList.map(createPassiveCollector.bind(this))
const formItemLayout = {
labelCol: {span: 6},
wrapperCol: {span: 18}
}
const formItemLayoutSelect = {
labelCol: {span: 9},
wrapperCol: {span: 15}
}
const buttonClass = classNames({
'ant-search-btn': true,
// 'ant-search-btn-noempty': !!this.state.historyEventIdFilter.trim()
})
const searchClass = classNames({
'ant-search-input': true,
// 'ant-search-input-focus': this.state.historyEventIdFilterFocus
})
//add passiveCollector
let antdFormAdd = <Form horizonal >
<FormItem {...formItemLayout} label = {name} required>
<Tooltip title="Output Redis channel defaults to pc_[COLLECTOR_NAME]">
<Input type = "text" autoComplete = "off"
data-field="name"
ref="nameInput"
value={this.state.passiveCollectorAdd.name}
onChange={this.addPassiveCollector.bind(this)}
/>
</Tooltip>
</FormItem>
<FormItem {...formItemLayout} label = {type} required >
<Select data-field="type"
ref="typeInput"
value={this.state.passiveCollectorAdd.type}
onChange={this.addPassiveCollectorType.bind(this)}>
<Option value="LongScript">LongScript</Option>
<Option value="FileTail">FileTail</Option>
</Select>
</FormItem>
<FormItem {...formItemLayout} label = {host} required>
<Select data-field="host"
ref="hostInput"
value={this.state.passiveCollectorAdd.host}
onChange={this.addPassiveCollectorHost.bind(this)}>
{hostOptions}
</Select>
</FormItem>
<FormItem {...formItemLayout} label = {command} required>
<Input type = "text" autoComplete = "off"
data-field="cmd"
ref="cmdInput"
disabled={(this.state.passiveCollectorAdd.type == "LongScript") ? false : true}
value={(this.state.passiveCollectorAdd.type == "LongScript") ? this.state.passiveCollectorAdd.cmd : ""}
onChange={this.addPassiveCollector.bind(this)}
/>
</FormItem>
<FormItem {...formItemLayout} label = {parameter} required>
<Input type = "text" autoComplete = "off"
data-field="param"
ref="paramInput"
value={this.state.passiveCollectorAdd.param}
onChange={this.addPassiveCollector.bind(this)}
/>
</FormItem>
<Row>
<Col span = "11" offset = "2" >
<FormItem {...formItemLayoutSelect} label = {encod} className = "selectEncoding" required>
<Select
data-field="encoding"
ref="encodingInput"
value={this.state.passiveCollectorAdd.encoding}
onChange={this.addPassiveCollectorEncoding.bind(this)}>
<Option key="UTF-8" value="UTF-8">UTF-8</Option>
<Option key="ASCII" value="ASCII">ASCII</Option>
<Option key="GB2312" value="GB2312">GB2312</Option>
<Option key="GBK" value="GBK">GBK</Option>
<Option key="GB18030" value="GB18030">GB18030</Option>
<Option key="Big5" value="Big5">Big5</Option>
<Option key="Big5-HKSCS" value="Big5-HKSCS">Big5-HKSCS</Option>
<Option key="Shift_JIS" value="Shift_JIS">Shift_JIS</Option>
<Option key="EUC-JP" value="EUC-JP">EUC-JP</Option>
<Option key="UTF-16LE" value="UTF-16LE">UTF-16LE</Option>
<Option key="UTF-16BE" value="UTF-16BE">UTF-16BE</Option>
<Option key="binary" value="binary">binary</Option>
<Option key="base64" value="base64">base64</Option>
<Option key="hex" value="hex">hex</Option>
</Select>
</FormItem>
</Col>
<Col span = "11">
<FormItem {...formItemLayoutSelect} label = {channel} required>
<Select
data-field="channel"
ref="channelInput"
value={this.state.passiveCollectorAdd.channel}
onChange={this.addPassiveCollectorChannel.bind(this)}>
<Option key="Redis PubSub" value = "Redis PubSub" > Redis PubSub </Option>
<Option key="Nsq Queue" value = "Nsq Queue" > Nsq Queue </Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem {...formItemLayout} label = {description} required>
<Input type = "textarea" rows = "3" autoComplete = "off"
data-field="desc"
ref="descInput"
value={this.state.passiveCollectorAdd.desc}
onChange={this.addPassiveCollector.bind(this)}/>
</FormItem>
</Form>
//edit passiveCollector
let antdFormEdit = <Form horizonal className = "editPassiveCollector">
<FormItem {...formItemLayout} label = {name} >
<span>
{this.state.passiveCollector.name}
</span>
</FormItem>
<FormItem {...formItemLayout} label = {type} className = "selectEncoding">
<Select data-field="type"
ref="typeInput"
value={this.state.passiveCollector.type}
onChange={this.updatePassiveCollectorType.bind(this)}>
<Option value="LongScript">LongScript</Option>
<Option value="FileTail">FileTail</Option>
</Select>
</FormItem>
<FormItem {...formItemLayout} label = {host} className = "selectEncoding">
<Select data-field="host"
ref="hostInput"
value={this.state.passiveCollector.host}
onChange={this.updatePassiveCollectorHost.bind(this)}>
{hostOptions}
</Select>
</FormItem>
<FormItem {...formItemLayout} label = {command}>
<Input type = "text" autoComplete = "off"
data-field="cmd"
ref="cmdInput"
disabled={(this.state.passiveCollector.type == "LongScript") ? false : true}
value={(this.state.passiveCollector.type == "LongScript") ? this.state.passiveCollector.cmd : ""}
onChange={this.updatePassiveCollector.bind(this)}
/>
</FormItem>
<FormItem {...formItemLayout} label = {parameter} >
<Input type = "text" autoComplete = "off"
data-field="param"
ref="paramInput"
value={this.state.passiveCollector.param}
onChange={this.updatePassiveCollector.bind(this)}
/>
</FormItem>
<Row>
<Col span = "11" offset = "2" >
<FormItem {...formItemLayoutSelect} label = {encod} className = "selectEncoding">
<Select
data-field="encoding"
ref="encodingInput"
value={this.state.passiveCollector.encoding}
onChange={this.updatePassiveCollectorEncoding.bind(this)}>
<Option key="UTF-8" value="UTF-8">UTF-8</Option>
<Option key="ASCII" value="ASCII">ASCII</Option>
<Option key="GB2312" value="GB2312">GB2312</Option>
<Option key="GBK" value="GBK">GBK</Option>
<Option key="GB18030" value="GB18030">GB18030</Option>
<Option key="Big5" value="Big5">Big5</Option>
<Option key="Big5-HKSCS" value="Big5-HKSCS">Big5-HKSCS</Option>
<Option key="Shift_JIS" value="Shift_JIS">Shift_JIS</Option>
<Option key="EUC-JP" value="EUC-JP">EUC-JP</Option>
<Option key="UTF-16LE" value="UTF-16LE">UTF-16LE</Option>
<Option key="UTF-16BE" value="UTF-16BE">UTF-16BE</Option>
<Option key="binary" value="binary">binary</Option>
<Option key="base64" value="base64">base64</Option>
<Option key="hex" value="hex">hex</Option>
</Select>
</FormItem>
</Col>
<Col span = "11">
<FormItem {...formItemLayoutSelect} label = {channel}>
<Select
data-field="channel"
ref="channelInput"
value={this.state.passiveCollector.channel}
onChange={this.updatePassiveCollectorChannel.bind(this)}>
<Option key="Redis PubSub" value = "Redis PubSub" > Redis PubSub </Option>
<Option key="Nsq Queue" value = "Nsq Queue" > Nsq Queue </Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem {...formItemLayout} label = {description} >
<Input type = "textarea" rows = "3" autoComplete = "off"
data-field="desc"
ref="descInput"
value={this.state.passiveCollector.desc}
onChange={this.updatePassiveCollector.bind(this)}/>
</FormItem>
</Form>
return (
<div>
<div className = "row clbody addActiveCollector">
<div className = "ant-col-sm24 p-t-10 ">
<Button type = "primary" icon="anticon anticon-plus" onClick = {this.onItemAdd.bind(this)}/>
</div>
</div>
<Modal
title = {add}
visible = {this.state.passiveCollectorAddModal}
onOk = {this.savePassiveCollector.bind(this)}
onCancel = {this.clearPassiveCollector.bind(this)}
className = "antdFormAdd"
>
{antdFormAdd}
</Modal>
<div className="row clbody">
<div className="ant-col-sm-4 p-t-10 p-b-10 pull-right CollectorSelect">
<div className="ant-search-input-wrapper">
<div className="selectDiv">
<Select className="searchSelect" placeholder={name} onChange={this.handleSelect.bind(this)}>
<Option value="name" selected> {name} </Option>
<Option value="parameter"> {parameter} </Option>
</Select>
</div>
<InputGroup className={searchClass}>
<Input data-name="name" onChange={this.handleFilterChange.bind(this)} onPressEnter={this.handleSearch.bind(this)}/>
<div className="ant-input-group-wrap">
<Button icon="anticon anticon-search" data-name="name" className={buttonClass} onClick={this.handleSearch.bind(this)} />
</div>
</InputGroup>
</div>
</div>
<div className=" p-b-10 p-t-60">
<Modal
title = {edit}
visible = {this.state.passiveCollectorEditModal}
onOk = {this.onEditOk.bind(this)}
onCancel = {this.onEditCancel.bind(this)}
className = "antdFormEdit"
>
{antdFormEdit}
</Modal>
<table id="demo-custom-toolbar" data-toggle="table"
data-toolbar="#demo-delete-row"
data-search="true"
data-show-refresh="true"
data-show-toggle="true"
data-show-columns="true"
data-sort-name="id"
data-page-list="[5, 10, 20]"
data-page-size="5"
data-pagination="true" data-show-pagination-switch="true" className="table table-bordered table-hover">
<thead>
<tr>
{/*<th data-field="state" data-checkbox="true"></th>*/}
<th data-field="name" data-sortable="true"><FormattedMessage id="name"/></th>
<th data-field="date" data-sortable="true" data-formatter="dateFormatter"><FormattedMessage id="date"/></th>
<th data-field="amount" data-align="center" data-sortable="true" data-sorter=""><FormattedMessage id="types"/></th>
<th data-field="cmd" data-align="center" data-sortable="true" data-sorter=""><FormattedMessage id="command"/></th>
<th data-field="parameter" data-align="center" data-sortable="true" data-sorter=""><FormattedMessage id="para"/></th>
<th data-field="host" data-align="center" data-sortable="true" data-sorter=""><FormattedMessage id="host"/></th>
<th data-field="encoding" data-align="center" data-sortable="true" data-sorter=""><FormattedMessage id="encod"/></th>
<th data-field="channel" data-align="center" data-sortable="true" data-sorter=""><FormattedMessage id="channel"/></th>
<th data-field="channel" data-align="center" className="operation"><FormattedMessage id="operation"/></th>
</tr>
</thead>
<tbody>
{ passiveCollectorTable }
</tbody>
</table>
</div>
</div>
</div>
)
}
}
PassiveCollector.propTypes = {
}
PassiveCollector.defaultProps = {
}
export default PassiveCollector
|
src/components/elements/Download.js | apburnes/allpointsburnes | import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import Icon from '../graphics/Icon'
const Comp = ({ className, text = 'Download', url = '/' }) => (
<div className={className}>
<a href={url} rel="noopener noreferrer" target="_blank" download>
<div>
{text}
<Icon type="download" />
</div>
</a>
</div>
)
const Download = styled(Comp)`
margin-top: 2em;
padding: 1em;
float: right;
div & a {
font-family: Source Sans Pro, sans-serif;
text-transform: uppercase;
font-weight: 200;
font-size: 0.8em;
color: black;
&:hover {
text-decoration: none;
}
& div:hover {
border-bottom: 1px solid rgb(150, 150, 150);
}
& div img {
position: relative;
top: 2px;
padding-left: 5px;
}
}
`
Download.propTypes = {
className: PropTypes.string,
text: PropTypes.string,
url: PropTypes.string,
}
export default Download
|
src/ui/auth/ForgotUsernameScreen.js | exponentjs/xde | /**
* @flow
*/
import React from 'react';
import { Link } from 'react-router';
import { StyleSheet, css } from 'aphrodite/no-important';
import Button from 'xde/ui/components/Button';
import TextInput from 'xde/ui/components/TextInput';
import StyleConstants from 'xde/ui/StyleConstants';
import * as IdentifierRules from 'xde/utils/IdentifierRules';
export default class ForgotUsernameScreen extends React.Component {
render() {
return (
<form name="login" className={css(styles.form)} onSubmit={this._onSubmit}>
<div className={css(styles.innerForm)}>
<div className={css(styles.fieldContainer)}>
<h3 className={css(styles.title)}>Find your username</h3>
<p className={css(styles.smallText, styles.gray)}>
Enter your e-mail address below and we will e-mail you your username
</p>
<TextInput
ref="username"
autoFocus
styles={styles.input}
type="text"
placeholder="E-mail address"
valueTransformer={IdentifierRules.normalizeWhileTyping}
/>
<Button
styles={styles.button}
type="submit"
disabled={this.props.isLoggingIn}
isLoading={this.props.isLoggingIn}
renderRightIcon={() => (
<img key="right" src="./arrow.svg" style={{ width: 15, height: 15 }} />
)}>
Send instructions
</Button>
<p className={css(styles.smallText, styles.black)}>
<Link to="/auth/forgot-password">Forgot your password?</Link>
</p>
<p className={css(styles.smallText, styles.black)}>
Already have a username/password?{' '}
<Link to="/auth/login" style={{ color: StyleConstants.colorText }}>
Login
</Link>
</p>
</div>
</div>
</form>
);
}
_onSubmit = (e: any) => {
e.preventDefault();
};
}
const styles = StyleSheet.create({
form: {
fontFamily: 'Verdana',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
},
innerForm: {
width: 550,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
},
fieldContainer: {
display: 'flex',
flexDirection: 'column',
flex: 1,
alignItems: 'center',
width: 270,
},
button: {
marginBottom: 20,
},
title: {
fontSize: 20,
marginBottom: 20,
},
input: {
width: '100%',
marginBottom: 20,
},
smallText: {
textAlign: 'center',
fontSize: 12,
marginBottom: 20,
},
black: { color: 'rgb(89, 92, 104)' },
gray: { color: '#aaaaaa' },
});
|
app/javascript/mastodon/features/notifications/components/filter_bar.js | lynlynlynx/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import Icon from 'mastodon/components/icon';
const tooltips = defineMessages({
mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favourites' },
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Boosts' },
polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' },
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
statuses: { id: 'notifications.filter.statuses', defaultMessage: 'Updates from people you follow' },
});
export default @injectIntl
class FilterBar extends React.PureComponent {
static propTypes = {
selectFilter: PropTypes.func.isRequired,
selectedFilter: PropTypes.string.isRequired,
advancedMode: PropTypes.bool.isRequired,
intl: PropTypes.object.isRequired,
};
onClick (notificationType) {
return () => this.props.selectFilter(notificationType);
}
render () {
const { selectedFilter, advancedMode, intl } = this.props;
const renderedElement = !advancedMode ? (
<div className='notification__filter-bar'>
<button
className={selectedFilter === 'all' ? 'active' : ''}
onClick={this.onClick('all')}
>
<FormattedMessage
id='notifications.filter.all'
defaultMessage='All'
/>
</button>
<button
className={selectedFilter === 'mention' ? 'active' : ''}
onClick={this.onClick('mention')}
>
<FormattedMessage
id='notifications.filter.mentions'
defaultMessage='Mentions'
/>
</button>
</div>
) : (
<div className='notification__filter-bar'>
<button
className={selectedFilter === 'all' ? 'active' : ''}
onClick={this.onClick('all')}
>
<FormattedMessage
id='notifications.filter.all'
defaultMessage='All'
/>
</button>
<button
className={selectedFilter === 'mention' ? 'active' : ''}
onClick={this.onClick('mention')}
title={intl.formatMessage(tooltips.mentions)}
>
<Icon id='reply-all' fixedWidth />
</button>
<button
className={selectedFilter === 'favourite' ? 'active' : ''}
onClick={this.onClick('favourite')}
title={intl.formatMessage(tooltips.favourites)}
>
<Icon id='star' fixedWidth />
</button>
<button
className={selectedFilter === 'reblog' ? 'active' : ''}
onClick={this.onClick('reblog')}
title={intl.formatMessage(tooltips.boosts)}
>
<Icon id='retweet' fixedWidth />
</button>
<button
className={selectedFilter === 'poll' ? 'active' : ''}
onClick={this.onClick('poll')}
title={intl.formatMessage(tooltips.polls)}
>
<Icon id='tasks' fixedWidth />
</button>
<button
className={selectedFilter === 'status' ? 'active' : ''}
onClick={this.onClick('status')}
title={intl.formatMessage(tooltips.statuses)}
>
<Icon id='home' fixedWidth />
</button>
<button
className={selectedFilter === 'follow' ? 'active' : ''}
onClick={this.onClick('follow')}
title={intl.formatMessage(tooltips.follows)}
>
<Icon id='user-plus' fixedWidth />
</button>
</div>
);
return renderedElement;
}
}
|
src/js/components/gsbpm/details/sub.js | UNECE/Model-Explorer | import React from 'react'
import { sparqlConnect } from 'sparql-connect'
import ServicesByGSBPMSubProcess from './services-by-sub'
/**
* Builds the query that retrieves the details for a GSBPM sub process
*/
const queryBuilder = GSBPMSub => `
SELECT ?label ?code ?definition
WHERE {
<${GSBPMSub}> skos:prefLabel ?label ;
skos:notation ?code ;
skos:definition ?definition
}
`
const connector = sparqlConnect(queryBuilder, {
queryName: 'GSBPMSubDetails',
params: ['GSBPMSub'],
singleResult: true
})
// GSBPMSub comes from `connectFromRoute` (it's then passed to the sparql
// connected component, which keeps it in its own props)
function GSBPMSubDetails({ GSBPMSub, label, code, definition }) {
return (
<div>
<dl className="dl-horizontal">
<dt>Label</dt>
<dd>{label}</dd>
<dt>Definition</dt>
<dd>{definition}</dd>
<dt>Code</dt>
<dd>{code}</dd>
<dt>Services</dt>
<dd>
<ServicesByGSBPMSubProcess GSBPMSub={GSBPMSub} />
</dd>
</dl>
</div>
)
}
export default connector(GSBPMSubDetails)
|
client/src/modules/userNotes.js | cashyu/reactNode | 'use strict'
import React from 'react'
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { browserHistory } from 'react-router'
import Notes_item from '../components/note_item'
import * as actions from '../action/note'
class UserNotes extends React.Component{
constructor(props) {
super(props)
}
componentDidMount() {
const userInfo = this.props.loginInfo ? this.props.loginInfo : JSON.parse(localStorage.getItem('userInfo'))
this.props.actions.findUserNotes(userInfo.userid, userInfo.token);
}
onDeleteNote (noteid) {
const userInfo = this.props.loginInfo ? this.props.loginInfo : JSON.parse(localStorage.getItem('userInfo'))
let data = {noteid, userid: userInfo.userid}
this.props.actions.deleteNote(data, userInfo.token)
const path = '/user/notes'
browserHistory.push(path)
}
render() {
let notes = this.props.userNotes
const userInfo = this.props.loginInfo ? this.props.loginInfo : JSON.parse(localStorage.getItem('userInfo'))
return (
<ul className="notes_list">
{
notes.map((note, index) => {
note.userid = this.props.userid
note.isLogin = true
return <Notes_item note={ note } onDeleteNote={ this.onDeleteNote.bind(this) }/>
})
}
</ul>
)
}
}
const mapStateToProps = (state) => {
return {
userNotes: state.userNotes,
loginInfo: state.loginInfo
}
}
const mapDispatchToProps = (dispatch) => {
return {
actions: bindActionCreators(actions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(UserNotes)
|
src/Grid/components/Row.js | jmcriffey/react-ui | import React from 'react';
import Cell from './Cell';
import {getClassName} from '../../utils';
class Row extends React.Component {
constructor(...args) {
super(...args);
this.state = {numClicks: 0};
this.onClick = this.onClick.bind(this);
}
render() {
return (
<tr
className={this.getClassName()}
onClick={this.onClick}>
{this.renderCells()}
</tr>
);
}
renderCells() {
return this.props.columns.map((column, i) => (
<Cell
{...this.props}
column={column}
columnIndex={i}
key={i}
rowIndex={this.props.rowIndex} />
));
}
onClick(evt) {
this.props.onRowClick(
evt,
undefined,
undefined,
this.props.rowIndex,
undefined,
this.state.numClicks + 1
);
this.setState({numClicks: this.state.numClicks + 1});
}
getClassName() {
return getClassName(
'react-ui-grid-row',
this.props.headerClassName,
this.getIsActive() ? getClassName(
'react-ui-grid-row-active',
this.props.activeRowClassName
) : null
);
}
getIsActive() {
return this.props.rowIndex === this.props.activeRow;
}
}
export default Row;
|
aaf-enrollment/src/ux/Accordion.js | MicroFocus/CX | import React from 'react';
import PropTypes from 'prop-types';
import t from '../i18n/locale-keys';
export default class Accordion extends React.PureComponent {
state = {
open: this.props.startOpen || false
};
toggleState = () => {
this.setState({
open: !this.state.open
});
};
render() {
const iconName = this.state.open ? 'up_thin' : 'down_thin';
const {title} = this.props;
let accordionClass = 'ias-accordion';
if (this.state.open) {
accordionClass += ' ias-open';
}
return (
<div className="ias-accordion-group">
<div className={accordionClass}>
<div className="ias-accordion-header" onClick={this.toggleState} title={t.openClose()}>
<div className="ias-accordion-title">{title}</div>
<span className="ias-fill" />
<i className={`ias-icon ias-icon-${iconName} ias-accordion-icon-toggle`} />
</div>
<div className="ias-accordion-content">
{this.props.children}
</div>
</div>
</div>
);
}
}
Accordion.defaultProps = {
startOpen: false
};
Accordion.propTypes = {
startOpen: PropTypes.bool,
title: PropTypes.string.isRequired
};
|
src/parser/warlock/destruction/modules/talents/InternalCombustion.js | ronaldpereira/WoWAnalyzer | import React from 'react';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import SPELLS from 'common/SPELLS';
import { formatThousands, formatNumber, formatPercentage } from 'common/format';
import Statistic from 'interface/statistics/Statistic';
import BoringSpellValueText from 'interface/statistics/components/BoringSpellValueText';
import STATISTIC_ORDER from 'interface/others/STATISTIC_ORDER';
/*
Internal Combustion (Tier 30 Destruction talent):
Chaos Bolt consumes up to 5 sec of Immolate's damage over time effect on your target, instantly dealing that much damage.
*/
class InternalCombustion extends Analyzer {
damage = 0;
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTalent(SPELLS.INTERNAL_COMBUSTION_TALENT.id);
this.addEventListener(Events.damage.by(SELECTED_PLAYER).spell(SPELLS.INTERNAL_COMBUSTION_DAMAGE), this.onInternalCombustionDamage);
}
onInternalCombustionDamage(event) {
this.damage += (event.amount || 0) + (event.absorbed || 0);
}
get dps() {
return this.damage / this.owner.fightDuration * 1000;
}
statistic() {
return (
<Statistic
position={STATISTIC_ORDER.OPTIONAL(2)}
size="small"
tooltip={`${formatThousands(this.damage)} damage`}
>
<BoringSpellValueText spell={SPELLS.INTERNAL_COMBUSTION_TALENT}>
{formatNumber(this.dps)} DPS <small>{formatPercentage(this.owner.getPercentageOfTotalDamageDone(this.damage))} % of total</small>
</BoringSpellValueText>
</Statistic>
);
}
}
export default InternalCombustion;
|
src/Components/Form/checkbox.js | gabriel-lopez-lopez/gll-billin-code-challenge | /**
* Componente para customizar los horrorosos checkboxes de toda la vida
* :) Este componente me encanta
*
*/
import React, { Component } from 'react';
import { PropTypes } from 'prop-types';
class Checkbox extends Component {
constructor(props) {
super(props);
}
render () {
let cursor = {
cursor: this.props.cursor || 'auto'
}
let style = {
show: {
visibility: 'visible',
cursor
},
hidden: {
visibility: 'hidden',
cursor
}
};
return (
<span className="c-checkbox" style={cursor}>
<i className="glyphicon glyphicon-ok" style={(this.props.value) ? style.show : style.hidden}></i>
</span>
);
}
}
Checkbox.propTypes = {
value: PropTypes.bool.isRequired
};
export default Checkbox; |
dialogflow-messenger/src/index.js | GoogleCloudPlatform/dialogflow-integrations | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
let interval = setInterval(() => {
const messengerDivs = document.querySelectorAll('df-messenger')
if (messengerDivs.length) clearInterval(interval);
messengerDivs.forEach(Div => {
ReactDOM.render(
<React.StrictMode>
<App domElement={Div} />
</React.StrictMode>,
Div
);
})
}, 100); // check every 100ms
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
|
src/client/index.js | tarkalabs/material-todo-jsc2016 | import React from 'react';
import injectTapEventPlugin from 'react-tap-event-plugin';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import Router from 'react-router/lib/Router';
import browserHistory from 'react-router/lib/browserHistory';
import match from 'react-router/lib/match';
import routes from '../shared/routes';
import appState from '../shared/stores/app_state';
injectTapEventPlugin();
// Get the DOM Element that will host our React application.
const container = document.getElementById('app');
function renderApp() {
// As we are using dynamic react-router routes we have to use the following
// asynchronous routing mechanism supported by the `match` function.
// @see https://github.com/reactjs/react-router/blob/master/docs/guides/ServerRendering.md
match({ history: browserHistory, routes }, (error, redirectLocation, renderProps) => {
if (error) {
// TODO: Error handling.
console.log('==> 😭 React Router match failed.'); // eslint-disable-line no-console
}
render(
<AppContainer>
{/*
We need to explicly render the Router component here instead of have
this embedded within a shared App type of component as we use different
router base components for client vs server rendering.
*/}
<Router {...renderProps} />
</AppContainer>,
container
);
});
}
// The following is needed so that we can hot reload our App.
if (process.env.NODE_ENV === 'development' && module.hot) {
// Accept changes to this file for hot reloading.
module.hot.accept();
// Any changes to our routes will cause a hotload re-render.
module.hot.accept('../shared/routes', renderApp);
}
renderApp();
appState.on('swap', () => {
const path = appState.cursor(['state', 'path']).deref();
if (path && path !== location.pathname) {
browserHistory.push(path);
} else {
renderApp();
}
});
|
app/pages/Options.js | jmsstudio/CurrencyConverter | import React from 'react';
import PropTypes from 'prop-types';
import { ScrollView, StatusBar, Platform, Linking } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { ListItem, Separator } from '../components/List';
import { connectAlert } from '../components/Alert';
const ICON_PREFIX = Platform.OS == 'ios' ? 'ios' : 'md';
const ICON_COLOR = '#868686';
const ICON_SIZE = 23;
class Options extends React.Component {
constructor(props) {
super(props);
this.handleThemesPress = this.handleThemesPress.bind(this);
this.handleApiPress = this.handleApiPress.bind(this);
}
handleThemesPress() {
this.props.navigation.navigate('Themes');
}
handleApiPress() {
Linking.openURL('http://fixer.io').catch(() =>
this.props.alertWithType('error', 'Error', 'Site cannot be opened')
);
}
render() {
return (
<ScrollView>
<StatusBar translucent={false} barStyle="default" />
<ListItem
text="Themes"
onPress={this.handleThemesPress}
customIcon={
<Ionicons
name={`${ICON_PREFIX}-arrow-forward`}
color={ICON_COLOR}
size={ICON_SIZE}
/>
}
/>
<Separator />
<ListItem
text="Api (fixer.io)"
onPress={this.handleApiPress}
customIcon={
<Ionicons
name={`${ICON_PREFIX}-link`}
color={ICON_COLOR}
size={ICON_SIZE}
/>
}
/>
<Separator />
</ScrollView>
);
}
}
Options.propTypes = {
navigation: PropTypes.object,
alertWithType: PropTypes.func,
};
export default connectAlert(Options);
|
src/components/DeveloperMenu.android.js | mandlamag/ESXApp | import React from 'react';
import * as snapshot from '../utils/snapshot';
import * as auth0 from '../services/auth0';
import {
View,
Text,
TouchableOpacity,
StyleSheet
} from 'react-native';
/**
* Simple developer menu, which allows e.g. to clear the app state.
* It can be accessed through a tiny button in the bottom right corner of the screen.
* ONLY FOR DEVELOPMENT MODE!
*/
const DeveloperMenu = React.createClass({
displayName: 'DeveloperMenu',
getInitialState() {
return {visible: false};
},
showDeveloperMenu() {
this.setState({isVisible: true});
},
async clearState() {
await snapshot.clearSnapshot();
console.warn('(╯°□°)╯︵ ┻━┻ \nState cleared, Cmd+R to reload the application now');
this.closeMenu();
},
async showLogin() {
await auth0.showLogin();
console.log('Show auth0 login screen');
this.closeMenu();
},
closeMenu() {
this.setState({isVisible: false});
},
renderMenuItem(text, onPress) {
return (
<TouchableOpacity
key={text}
onPress={onPress}
style={styles.menuItem}
>
<Text style={styles.menuItemText}>{text}</Text>
</TouchableOpacity>
);
},
render() {
if (!__DEV__) {
return null;
}
if (!this.state.isVisible) {
return (
<TouchableOpacity
style={styles.circle}
onPress={this.showDeveloperMenu}
/>
);
}
const buttons = [
this.renderMenuItem('Clear state', this.clearState),
this.renderMenuItem('Show login', this.showLogin),
this.renderMenuItem('Cancel', this.closeMenu)
];
return (
<View style={styles.menu}>
{buttons}
</View>
);
}
});
const styles = StyleSheet.create({
circle: {
position: 'absolute',
bottom: 5,
right: 5,
width: 10,
height: 10,
borderRadius: 5,
backgroundColor: '#fff'
},
menu: {
backgroundColor: 'white',
position: 'absolute',
left: 0,
right: 0,
bottom: 0
},
menuItem: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
borderTopWidth: 1,
borderTopColor: '#eee',
padding: 10,
height: 60
},
menuItemText: {
fontSize: 20
}
});
export default DeveloperMenu; |
src/templates/news.js | handwhittled/timothymcallister.com | import { Caption, Heading, Paragraph } from '../components/typography'
import { Container, Page, Section, Wrapper } from '../components/layout'
import Article from '../components/article'
import Helmet from 'react-helmet'
import Link from 'gatsby-link'
import React from 'react'
export default (props) => {
const node = props.data.contentfulNews
return (
<Page>
<Helmet>
<title>{node.title}</title>
</Helmet>
<Wrapper style={{ zIndex: 0 }}>
<Section centerContent padding theme="light">
<Article content={node.content.content} date={node.date} title={node.title} />
</Section>
)
})}
</Wrapper>
</Page>
)
}
export const query = graphql`
query NewsItemQuery($slug: String!) {
contentfulNews(fields: { slug: { eq: $slug } }) {
id
title
date
content {
id
content
}
fields {
slug
}
}
}
`
|
app/javascript/mastodon/features/directory/index.js | d6rkaiz/mastodon | import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl } from 'react-intl';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Column from 'mastodon/components/column';
import ColumnHeader from 'mastodon/components/column_header';
import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'mastodon/actions/columns';
import { fetchDirectory, expandDirectory } from 'mastodon/actions/directory';
import { List as ImmutableList } from 'immutable';
import AccountCard from './components/account_card';
import RadioButton from 'mastodon/components/radio_button';
import classNames from 'classnames';
import LoadMore from 'mastodon/components/load_more';
import { ScrollContainer } from 'react-router-scroll-4';
const messages = defineMessages({
title: { id: 'column.directory', defaultMessage: 'Browse profiles' },
recentlyActive: { id: 'directory.recently_active', defaultMessage: 'Recently active' },
newArrivals: { id: 'directory.new_arrivals', defaultMessage: 'New arrivals' },
local: { id: 'directory.local', defaultMessage: 'From {domain} only' },
federated: { id: 'directory.federated', defaultMessage: 'From known fediverse' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'directory', 'items'], ImmutableList()),
isLoading: state.getIn(['user_lists', 'directory', 'isLoading'], true),
domain: state.getIn(['meta', 'domain']),
});
export default @connect(mapStateToProps)
@injectIntl
class Directory extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
isLoading: PropTypes.bool,
accountIds: ImmutablePropTypes.list.isRequired,
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
columnId: PropTypes.string,
intl: PropTypes.object.isRequired,
multiColumn: PropTypes.bool,
domain: PropTypes.string.isRequired,
params: PropTypes.shape({
order: PropTypes.string,
local: PropTypes.bool,
}),
};
state = {
order: null,
local: null,
};
handlePin = () => {
const { columnId, dispatch } = this.props;
if (columnId) {
dispatch(removeColumn(columnId));
} else {
dispatch(addColumn('DIRECTORY', this.getParams(this.props, this.state)));
}
}
getParams = (props, state) => ({
order: state.order === null ? (props.params.order || 'active') : state.order,
local: state.local === null ? (props.params.local || false) : state.local,
});
handleMove = dir => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
handleHeaderClick = () => {
this.column.scrollTop();
}
componentDidMount () {
const { dispatch } = this.props;
dispatch(fetchDirectory(this.getParams(this.props, this.state)));
}
componentDidUpdate (prevProps, prevState) {
const { dispatch } = this.props;
const paramsOld = this.getParams(prevProps, prevState);
const paramsNew = this.getParams(this.props, this.state);
if (paramsOld.order !== paramsNew.order || paramsOld.local !== paramsNew.local) {
dispatch(fetchDirectory(paramsNew));
}
}
setRef = c => {
this.column = c;
}
handleChangeOrder = e => {
const { dispatch, columnId } = this.props;
if (columnId) {
dispatch(changeColumnParams(columnId, ['order'], e.target.value));
} else {
this.setState({ order: e.target.value });
}
}
handleChangeLocal = e => {
const { dispatch, columnId } = this.props;
if (columnId) {
dispatch(changeColumnParams(columnId, ['local'], e.target.value === '1'));
} else {
this.setState({ local: e.target.value === '1' });
}
}
handleLoadMore = () => {
const { dispatch } = this.props;
dispatch(expandDirectory(this.getParams(this.props, this.state)));
}
render () {
const { isLoading, accountIds, intl, columnId, multiColumn, domain, shouldUpdateScroll } = this.props;
const { order, local } = this.getParams(this.props, this.state);
const pinned = !!columnId;
const scrollableArea = (
<div className='scrollable' style={{ background: 'transparent' }}>
<div className='filter-form'>
<div className='filter-form__column' role='group'>
<RadioButton name='order' value='active' label={intl.formatMessage(messages.recentlyActive)} checked={order === 'active'} onChange={this.handleChangeOrder} />
<RadioButton name='order' value='new' label={intl.formatMessage(messages.newArrivals)} checked={order === 'new'} onChange={this.handleChangeOrder} />
</div>
<div className='filter-form__column' role='group'>
<RadioButton name='local' value='1' label={intl.formatMessage(messages.local, { domain })} checked={local} onChange={this.handleChangeLocal} />
<RadioButton name='local' value='0' label={intl.formatMessage(messages.federated)} checked={!local} onChange={this.handleChangeLocal} />
</div>
</div>
<div className={classNames('directory__list', { loading: isLoading })}>
{accountIds.map(accountId => <AccountCard id={accountId} key={accountId} />)}
</div>
<LoadMore onClick={this.handleLoadMore} visible={!isLoading} />
</div>
);
return (
<Column bindToDocument={!multiColumn} ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader
icon='address-book-o'
title={intl.formatMessage(messages.title)}
onPin={this.handlePin}
onMove={this.handleMove}
onClick={this.handleHeaderClick}
pinned={pinned}
multiColumn={multiColumn}
/>
{multiColumn && !pinned ? <ScrollContainer scrollKey='directory' shouldUpdateScroll={shouldUpdateScroll}>{scrollableArea}</ScrollContainer> : scrollableArea}
</Column>
);
}
}
|
src/svg-icons/image/panorama-horizontal.js | hwo411/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImagePanoramaHorizontal = (props) => (
<SvgIcon {...props}>
<path d="M20 6.54v10.91c-2.6-.77-5.28-1.16-8-1.16-2.72 0-5.4.39-8 1.16V6.54c2.6.77 5.28 1.16 8 1.16 2.72.01 5.4-.38 8-1.16M21.43 4c-.1 0-.2.02-.31.06C18.18 5.16 15.09 5.7 12 5.7c-3.09 0-6.18-.55-9.12-1.64-.11-.04-.22-.06-.31-.06-.34 0-.57.23-.57.63v14.75c0 .39.23.62.57.62.1 0 .2-.02.31-.06 2.94-1.1 6.03-1.64 9.12-1.64 3.09 0 6.18.55 9.12 1.64.11.04.21.06.31.06.33 0 .57-.23.57-.63V4.63c0-.4-.24-.63-.57-.63z"/>
</SvgIcon>
);
ImagePanoramaHorizontal = pure(ImagePanoramaHorizontal);
ImagePanoramaHorizontal.displayName = 'ImagePanoramaHorizontal';
ImagePanoramaHorizontal.muiName = 'SvgIcon';
export default ImagePanoramaHorizontal;
|
src/components/Page/DragAndDrop/DragAndDrop.stories.js | auth0-extensions/auth0-extension-ui | import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import DragAndDrop from './';
storiesOf('DragAndDrop', module)
.add('default view', () => (<DragAndDrop onDrop={action('onDrop')} />));
|
src/components/views/settings/DevicesPanelEntry.js | aperezdc/matrix-react-sdk | /*
Copyright 2016 OpenMarket 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 React from 'react';
import PropTypes from 'prop-types';
import sdk from '../../../index';
import { _t } from '../../../languageHandler';
import MatrixClientPeg from '../../../MatrixClientPeg';
import {formatDate} from '../../../DateUtils';
export default class DevicesPanelEntry extends React.Component {
constructor(props, context) {
super(props, context);
this._unmounted = false;
this.onDeviceToggled = this.onDeviceToggled.bind(this);
this._onDisplayNameChanged = this._onDisplayNameChanged.bind(this);
}
componentWillUnmount() {
this._unmounted = true;
}
_onDisplayNameChanged(value) {
const device = this.props.device;
return MatrixClientPeg.get().setDeviceDetails(device.device_id, {
display_name: value,
}).catch((e) => {
console.error("Error setting device display name", e);
throw new Error(_t("Failed to set display name"));
});
}
onDeviceToggled() {
this.props.onDeviceToggled(this.props.device);
}
render() {
const EditableTextContainer = sdk.getComponent('elements.EditableTextContainer');
const device = this.props.device;
let lastSeen = "";
if (device.last_seen_ts) {
const lastSeenDate = formatDate(new Date(device.last_seen_ts));
lastSeen = device.last_seen_ip + " @ " +
lastSeenDate.toLocaleString();
}
let myDeviceClass = '';
if (device.device_id === MatrixClientPeg.get().getDeviceId()) {
myDeviceClass = " mx_DevicesPanel_myDevice";
}
return (
<div className={"mx_DevicesPanel_device" + myDeviceClass}>
<div className="mx_DevicesPanel_deviceId">
{ device.device_id }
</div>
<div className="mx_DevicesPanel_deviceName">
<EditableTextContainer initialValue={device.display_name}
onSubmit={this._onDisplayNameChanged}
placeholder={device.device_id}
/>
</div>
<div className="mx_DevicesPanel_lastSeen">
{ lastSeen }
</div>
<div className="mx_DevicesPanel_deviceButtons">
<input type="checkbox" onClick={this.onDeviceToggled} checked={this.props.selected} />
</div>
</div>
);
}
}
DevicesPanelEntry.propTypes = {
device: PropTypes.object.isRequired,
onDeviceToggled: PropTypes.func,
};
DevicesPanelEntry.defaultProps = {
onDeviceToggled: function() {},
};
|
src/components/music/clefs/TrebleClef.js | Tomczik76/gradus-ad-parnassum-front-end | import React, { Component } from 'react';
export default class App extends Component {
render() {
return (<path transform="scale(3.5) translate(2)" d="m12.049 3.5296c0.305 3.1263-2.019 5.6563-4.0772 7.7014-0.9349 0.897-0.155 0.148-0.6437 0.594-0.1022-0.479-0.2986-1.731-0.2802-2.11 0.1304-2.6939 2.3198-6.5875 4.2381-8.0236 0.309 0.5767 0.563 0.6231 0.763 1.8382zm0.651 16.142c-1.232-0.906-2.85-1.144-4.3336-0.885-0.1913-1.255-0.3827-2.51-0.574-3.764 2.3506-2.329 4.9066-5.0322 5.0406-8.5394 0.059-2.232-0.276-4.6714-1.678-6.4836-1.7004 0.12823-2.8995 2.156-3.8019 3.4165-1.4889 2.6705-1.1414 5.9169-0.57 8.7965-0.8094 0.952-1.9296 1.743-2.7274 2.734-2.3561 2.308-4.4085 5.43-4.0046 8.878 0.18332 3.334 2.5894 6.434 5.8702 7.227 1.2457 0.315 2.5639 0.346 3.8241 0.099 0.2199 2.25 1.0266 4.629 0.0925 6.813-0.7007 1.598-2.7875 3.004-4.3325 2.192-0.5994-0.316-0.1137-0.051-0.478-0.252 1.0698-0.257 1.9996-1.036 2.26-1.565 0.8378-1.464-0.3998-3.639-2.1554-3.358-2.262 0.046-3.1904 3.14-1.7356 4.685 1.3468 1.52 3.833 1.312 5.4301 0.318 1.8125-1.18 2.0395-3.544 1.8325-5.562-0.07-0.678-0.403-2.67-0.444-3.387 0.697-0.249 0.209-0.059 1.193-0.449 2.66-1.053 4.357-4.259 3.594-7.122-0.318-1.469-1.044-2.914-2.302-3.792zm0.561 5.757c0.214 1.991-1.053 4.321-3.079 4.96-0.136-0.795-0.172-1.011-0.2626-1.475-0.4822-2.46-0.744-4.987-1.116-7.481 1.6246-0.168 3.4576 0.543 4.0226 2.184 0.244 0.577 0.343 1.197 0.435 1.812zm-5.1486 5.196c-2.5441 0.141-4.9995-1.595-5.6343-4.081-0.749-2.153-0.5283-4.63 0.8207-6.504 1.1151-1.702 2.6065-3.105 4.0286-4.543 0.183 1.127 0.366 2.254 0.549 3.382-2.9906 0.782-5.0046 4.725-3.215 7.451 0.5324 0.764 1.9765 2.223 2.7655 1.634-1.102-0.683-2.0033-1.859-1.8095-3.227-0.0821-1.282 1.3699-2.911 2.6513-3.198 0.4384 2.869 0.9413 6.073 1.3797 8.943-0.5054 0.1-1.0211 0.143-1.536 0.143z"/>
);
}
}
|
client/omnichannel/realTimeMonitoring/overviews/ConversationOverview.js | iiet/iiet-chat | import React from 'react';
import { useEndpointDataExperimental } from '../../../hooks/useEndpointDataExperimental';
import CounterContainer from '../counter/CounterContainer';
const overviewInitalValue = {
title: '',
value: 0,
};
const initialData = [
overviewInitalValue,
overviewInitalValue,
overviewInitalValue,
overviewInitalValue,
];
const ConversationOverview = ({ params, reloadRef, ...props }) => {
const { data, state, reload } = useEndpointDataExperimental(
'livechat/analytics/dashboards/conversation-totalizers',
params,
);
reloadRef.current.conversationOverview = reload;
return <CounterContainer state={state} data={data} initialData={initialData} {...props}/>;
};
export default ConversationOverview;
|
components/Deck/DeckStats.js | slidewiki/slidewiki-platform | import React from 'react';
import {Grid} from 'semantic-ui-react';
import updateDeckActivityTimelineFilters from '../../actions/stats/updateDeckActivityTimelineFilters';
import updateDeckUserStatsFilters from '../../actions/stats/updateDeckUserStatsFilters';
import {defineMessages} from 'react-intl';
import ActivityTimeline from '../../components/Stats/ActivityTimeline';
import UserBarChart from '../../components/Stats/UserBarChart';
import PropTypes from 'prop-types';
class DeckStats extends React.Component {
constructor(props) {
super(props);
this.messages = this.getIntlMessages();
}
getIntlMessages() {
return defineMessages({
deckUserStatsTitle: {
id: 'Stats.deckUserStatsTitle',
defaultMessage: 'User Activity'
},
});
}
handleTimelinePeriodChange(event, {value}) {
this.context.executeAction(updateDeckActivityTimelineFilters, {
datePeriod: value,
deckId: this.props.deckId,
});
}
handleTimelineActivityChange(event, {value}) {
this.context.executeAction(updateDeckActivityTimelineFilters, {
activityType: value,
deckId: this.props.deckId,
});
}
handleDeckUserStatsPeriodChange(event, {value}) {
this.context.executeAction(updateDeckUserStatsFilters, {
datePeriod: value,
deckId: this.props.deckId,
});
}
handleDeckUserStatsActivityChange(event, {value}) {
this.context.executeAction(updateDeckUserStatsFilters, {
activityType: value,
deckId: this.props.deckId,
});
}
render() {
return (
<Grid relaxed>
<Grid.Row columns={1}>
<Grid.Column>
<ActivityTimeline statsByTime={this.props.deckStats.statsByTime}
loading={this.props.deckStats.statsByTimeLoading}
activityType={this.props.deckStats.timelineFilters.activityType}
datePeriod={this.props.deckStats.timelineFilters.datePeriod}
handleActivityTypeChange={this.handleTimelineActivityChange.bind(this)}
handleDatePeriodChange={this.handleTimelinePeriodChange.bind(this)} />
</Grid.Column>
</Grid.Row>
<Grid.Row columns={1}>
<Grid.Column>
<UserBarChart title={this.context.intl.formatMessage(this.messages.deckUserStatsTitle)} data={this.props.deckStats.deckUserStats}
loading={this.props.deckStats.deckUserStatsLoading}
activityType={this.props.deckStats.deckUserStatsFilters.activityType}
datePeriod={this.props.deckStats.deckUserStatsFilters.datePeriod}
handleActivityTypeChange={this.handleDeckUserStatsActivityChange.bind(this)}
handleDatePeriodChange={this.handleDeckUserStatsPeriodChange.bind(this)} />
</Grid.Column>
</Grid.Row>
</Grid>
);
}
}
DeckStats.contextTypes = {
executeAction: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
};
export default DeckStats;
|
static/node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js | juanpflores94/Hodor | import React from 'react';
// It's important to not define HelloWorld component right in this file
// because in that case it will do full page reload on change
import HelloWorld from './HelloWorld.jsx';
React.render(<HelloWorld />, document.getElementById('react-root'));
|
srcjs/components/Select.js | spapas/react-tutorial | import React from 'react'
import { danger } from '../util/colors'
export default ({field, label, options, ...props}) => <div>
<label forHtml={field.name}>{label}</label>
<select type='text' className="u-full-width" {...field} {...props} >
<option></option>
{options.map(c => <option value={c.id} key={c.id} >{c.name}</option>)}
</select>
{field.touched && field.error && <div style={{color: 'white', backgroundColor: danger}}>{field.error}</div>}
</div>
|
docs/src/pages/demos/app-bar/SimpleAppBar.js | cherniavskii/material-ui | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import AppBar from 'material-ui/AppBar';
import Toolbar from 'material-ui/Toolbar';
import Typography from 'material-ui/Typography';
const styles = {
root: {
flexGrow: 1,
},
};
function SimpleAppBar(props) {
const { classes } = props;
return (
<div className={classes.root}>
<AppBar position="static" color="default">
<Toolbar>
<Typography variant="title" color="inherit">
Title
</Typography>
</Toolbar>
</AppBar>
</div>
);
}
SimpleAppBar.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(SimpleAppBar);
|
src/components/elements/info_plane.js | PolideaPlayground/WebVRExperience | import {Entity} from "aframe-react";
import React from 'react';
import ReactGA from 'react-ga';
export default class Info extends React.Component {
constructor(props) {
super(props);
this.state = {
buttonVisible: true,
infoVisible: false
}
}
onPolideaClicked() {
ReactGA.event({
category: 'Navigation',
action: 'Show About Polidea',
});
this.setState({
buttonVisible: false,
infoVisible: true
});
}
onXClicked() {
this.setState({
buttonVisible: true,
infoVisible: false
});
}
render() {
return (
<Entity {...this.props}
id="info"
shadow="receive: false; cast: true">
<Entity
id="polidea"
hovered_menu_item={{
position_down: {x: 0, y: 0, z: 0},
position_up: {x: 0, y: 0, z: 0.1},
}}
visible={this.state.buttonVisible}
position={{x: 0, y: 0, z: 0.1}}
className={"intersectable"}
geometry={{primitive: 'plane', width: 1.1, height: 0.45}}
material={{shader: "flat", color: 'white', opacity: 1.0}}
text={{
align: "center",
baseline: "center",
width: 2.4,
wrapCount: 28,
lineHeight: 60,
height: "auto",
color: "#595959",
value: "About us"
}}
events={{
click: (evt) => {
this.onPolideaClicked();
}
}}
/>
<Entity
id="text"
visible={this.state.infoVisible}
geometry={{primitive: 'plane', width: 3, height: 3}}
material={{shader: "flat", color: 'white', opacity: 1.0}}
position={{x: 1, y: 0, z: 0.1}}
scale={{x: 1, y: 1}}
>
<Entity
position={{x: 1.25, y: 1.85, z: 0}}
scale={{x: 1, y: 1}}
hovered_menu_item={{
position_down: {x: 1.25, y: 1.85, z: -0.1},
position_up: {x: 1.25, y: 1.85, z: 0},
}}
className={"intersectable"}
geometry={{primitive: 'plane', width: 0.5, height: 0.5}}
material={{shader: "flat", color: 'white', opacity: 1.0}}
events={{
click: (evt) => {
this.onXClicked();
}
}}>
<Entity
primitive={"a-image"}
src="#closeImage"
scale={{x: 0.3, y: 0.3}}
position={{x: 0, y: 0, z: 0.01}}
/>
</Entity>
<Entity
primitive={"a-image"}
position={{x: 0, y: 1.0, z: 0.05}}
scale={{x: 0.75, y: 0.75, z: 1}}
geometry={{primitive: 'plane', width: 1.82, height: 0.5}}
src="#polideaImage"
/>
<Entity
position={{x: 0, y: 0.5, z: 0.05}}
text={{
align: "left",
baseline: "top",
width: 2.4,
wrapCount: 32,
lineHeight: 60,
height: "auto",
color: "#484848",
value: "We think that sometimes small things can make your day. That's why we created this experiment, which runs on any mobile and desktop device."
}}
/>
<Entity
position={{x: 0, y: -0.5, z: 0.05}}
text={{
align: "left",
baseline: "top",
width: 2.4,
wrapCount: 32,
lineHeight: 60,
height: "auto",
color: "#484848",
value: "Designed and developed by VR team at Polidea."
}}
/>
<Entity
position={{x: 0, y: -1.1, z: 0.05}}
className={"intersectable link"}
text={{
align: "center",
baseline: "top",
width: 2.4,
wrapCount: 28,
lineHeight: 60,
height: "auto",
color: "#484848",
value: "www.polidea.com"
}}
/>
</Entity>
</Entity>
);
}
} |
index.android.js | monkingxue/pure-book | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class purebook extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('purebook', () => purebook);
|
src/types/bounds.js | dantman/react-leaflet | import React from 'react';
import Leaflet from 'leaflet';
import latlngList from './latlngList';
export default React.PropTypes.oneOfType([
React.PropTypes.instanceOf(Leaflet.LatLngBounds),
latlngList
]);
|
src/icons/LoopIcon.js | kiloe/ui | import React from 'react';
import Icon from '../Icon';
export default class LoopIcon extends Icon {
getSVG(){return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M24 8V2l-8 8 8 8v-6c6.63 0 12 5.37 12 12 0 2.03-.51 3.93-1.39 5.61l2.92 2.92C39.08 30.05 40 27.14 40 24c0-8.84-7.16-16-16-16zm0 28c-6.63 0-12-5.37-12-12 0-2.03.51-3.93 1.39-5.61l-2.92-2.92C8.92 17.95 8 20.86 8 24c0 8.84 7.16 16 16 16v6l8-8-8-8v6z"/></svg>;}
}; |
app/components/svgs/SignalQualityIndicatorSVG.js | openexp/OpenEXP | import React from 'react';
const SvgComponent = props => (
<svg
id="SignalQualityIndicator"
data-name="SignalQualityIndicator"
style={{ minHeight: 250, minWidth: 250 }}
viewBox="0 0 674.44 610.29"
{...props}
>
<title>Signal Quality Indicator</title>
<g id="Head_Plot" data-name="Head Plot">
<circle
cx={336.54}
cy={334.96}
r={212.53}
fillOpacity="0.0"
stroke="#000"
strokeLinecap="round"
strokeMiterlimit={10}
strokeWidth={2}
strokeDasharray="16.064828872680664,22.089139938354492"
/>
<path
stroke="#000"
strokeLinecap="round"
strokeMiterlimit={10}
strokeWidth={2}
d="M68.73 334h8"
/>
<path
stroke="#000"
strokeLinecap="round"
strokeMiterlimit={10}
strokeWidth={2}
strokeDasharray="16.026018142700195,22.035776138305664"
d="M98.76 334h483.79"
/>
<path
stroke="#000"
strokeLinecap="round"
strokeMiterlimit={10}
strokeWidth={2}
d="M593.57 334h8M335.68 600.42v-8"
/>
<path
fillOpacity="0.0"
stroke="#000"
strokeLinecap="round"
strokeMiterlimit={10}
strokeWidth={2}
strokeDasharray="16.026018142700195,22.035776138305664"
d="M335.68 570.39V86.6"
/>
<path
fillOpacity="0.0"
stroke="#000"
strokeLinecap="round"
strokeMiterlimit={10}
strokeWidth={2}
d="M335.68 75.58v-8"
/>
<path
d="M282.85 72.63s24.95-42.38 51.95-42.38 51.95 42.38 51.95 42.38"
fillOpacity="0.0"
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<circle
cx={335.15}
cy={334}
r={266.42}
fillOpacity="0.0"
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<path
d="M73.11 288.57s-30 1.44-30 42.92S72.1 373 72.1 373M598 288.57s30 1.44 30 42.92S599 373 599 373"
fillOpacity="0.0"
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
</g>
<g id="T7" visibility="hidden">
<circle
cx={124.37}
cy={333.72}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(111.44 341.22)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
T7
</text>
</g>
<g id="FC5" visibility="hidden">
<circle
cx={178.58}
cy={259.29}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(158.65 266.78)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
FC5
</text>
</g>
<g id="FC6" visibility="hidden">
<circle
cx={495.58}
cy={259.29}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(475.65 266.78)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
FC6
</text>
</g>
<g id="F3" visibility="hidden">
<circle
cx={240.35}
cy={241.01}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(227.8 248.5)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
F3
</text>
</g>
<g id="F4" visibility="hidden">
<circle
cx={434.23}
cy={241.01}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(421.68 248.5)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
F4
</text>
</g>
<g id="AF3" visibility="hidden">
<circle
cx={269.35}
cy={185.69}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(248.99 193.18)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
AF3
</text>
</g>
<g id="AF4" visibility="hidden">
<circle
cx={406.36}
cy={185.69}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(385.99 193.18)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
AF4
</text>
</g>
<g id="M1" visibility="hidden">
<circle
cx={78.53}
cy={401.34}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(61.92 408.83)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
M1
</text>
</g>
<g id="P7" visibility="hidden">
<circle
cx={178.58}
cy={475.91}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(165.33 483.4)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
P7
</text>
</g>
<g id="O1" visibility="hidden">
<circle
cx={255.35}
cy={531.29}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(240.18 538.79)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
O1
</text>
</g>
<g id="O2" visibility="hidden">
<circle
cx={420.11}
cy={531.29}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(404.94 538.79)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
O2
</text>
</g>
<g id="P8" visibility="hidden">
<circle
cx={494.77}
cy={475.91}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(481.51 483.4)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
P8
</text>
</g>
<g id="T8" visibility="hidden">
<circle
cx={548.92}
cy={333.72}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(535.99 341.22)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
T8
</text>
</g>
<g id="M2" visibility="hidden">
<circle
cx={592.53}
cy={400.89}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(575.92 408.38)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
M2
</text>
</g>
<g id="TP10" visibility="hidden">
<circle
cx={571.87}
cy={455.81}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(550.45 463.3)"
fontSize={18}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
TP10
</text>
</g>
<g id="Fpz" visibility="hidden">
<circle
cx={335.79}
cy={121.75}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(318.56 129.24)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
<tspan letterSpacing="-.03em">F</tspan>
<tspan x={11.69} y={0}>
pz
</tspan>
</text>
</g>
<g id="TP9" visibility="hidden">
<circle
cx={98.87}
cy={455.81}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(79.07 463.3)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
TP9
</text>
</g>
<g id="AF7" visibility="hidden">
<circle
cx={208.33}
cy={166.08}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(187.97 173.57)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
AF7
</text>
</g>
<g id="AF8" visibility="hidden">
<circle
cx={467.66}
cy={166.08}
r={30}
stroke="#000"
strokeMiterlimit={10}
strokeWidth={2}
/>
<text
transform="translate(447.3 173.57)"
fontSize={22}
fontFamily="Lato-Bold,Lato"
fontWeight={700}
fill="#000"
>
AF8
</text>
</g>
</svg>
);
export default SvgComponent;
|
app/javascript/mastodon/features/follow_requests/index.js | rutan/mastodon | import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import AccountAuthorizeContainer from './containers/account_authorize_container';
import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts';
import ScrollableList from '../../components/scrollable_list';
const messages = defineMessages({
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
});
@connect(mapStateToProps)
@injectIntl
export default class FollowRequests extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
};
componentWillMount () {
this.props.dispatch(fetchFollowRequests());
}
handleLoadMore = debounce(() => {
this.props.dispatch(expandFollowRequests());
}, 300, { leading: true });
render () {
const { intl, shouldUpdateScroll, accountIds } = this.props;
if (!accountIds) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
return (
<Column icon='users' heading={intl.formatMessage(messages.heading)}>
<ColumnBackButtonSlim />
<ScrollableList
scrollKey='follow_requests'
onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll}
emptyMessage={emptyMessage}
>
{accountIds.map(id =>
<AccountAuthorizeContainer key={id} id={id} />
)}
</ScrollableList>
</Column>
);
}
}
|
components/SearchSpinner.js | nattatorn-dev/expo-with-realworld | import React from 'react'
import { ActivityIndicator, View, Dimensions } from 'react-native'
import { createConnector } from 'react-instantsearch'
const { width, height } = Dimensions.get( 'window' )
export default createConnector( {
displayName: 'ConditionalQuery',
getProvidedProps( props, searchState, results ) {
return {
loading: results.searching || results.searchingForFacetValues,
left: props.left ? props.left : 0,
bottom: props.bottom ? props.bottom : height - 10,
}
},
} )( ( { loading, left, bottom } ) => (
<View
style={{
position: 'absolute',
left: width - left,
bottom: height - bottom,
zIndex: 2,
}}
>
<ActivityIndicator animating={loading} />
</View>
) )
|
client/extensions/woocommerce/components/bulk-select/index.js | Automattic/woocommerce-connect-client | /** @format */
/**
* External dependencies
*/
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Gridicon from 'gridicons';
const BulkSelect = ( {
className,
disabled,
id,
onToggle,
readOnly,
selectedElements,
totalElements,
} ) => {
const hasAllElementsSelected = selectedElements && selectedElements === totalElements;
const hasSomeElementsSelected = selectedElements && selectedElements < totalElements;
const inputClasses = classNames( 'bulk-select__box', { 'is-checked': hasAllElementsSelected } );
const iconClasses = classNames( 'bulk-select__some-checked-icon', { 'is-disabled': disabled } );
const containerClasses = classNames( 'bulk-select', className );
const handleToggle = event => {
if ( readOnly ) {
return;
}
const newCheckedState = ! ( hasSomeElementsSelected || hasAllElementsSelected );
onToggle( newCheckedState, event );
};
return (
<span className={ containerClasses }>
<span className="bulk-select__container">
<input
id={ id }
type="checkbox"
className={ inputClasses }
onChange={ handleToggle }
checked={ hasAllElementsSelected }
disabled={ disabled }
/>
{ hasSomeElementsSelected ? (
<Gridicon className={ iconClasses } icon="minus-small" size={ 18 } />
) : null }
</span>
</span>
);
};
BulkSelect.propTypes = {
totalElements: PropTypes.number.isRequired,
selectedElements: PropTypes.number.isRequired,
onToggle: PropTypes.func,
readOnly: PropTypes.bool,
className: PropTypes.string,
disabled: PropTypes.bool,
};
export default BulkSelect;
|
src/svg-icons/action/lock.js | barakmitz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionLock = (props) => (
<SvgIcon {...props}>
<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>
</SvgIcon>
);
ActionLock = pure(ActionLock);
ActionLock.displayName = 'ActionLock';
ActionLock.muiName = 'SvgIcon';
export default ActionLock;
|
src/svg-icons/image/wb-incandescent.js | skarnecki/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageWbIncandescent = (props) => (
<SvgIcon {...props}>
<path d="M3.55 18.54l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8zM11 22.45h2V19.5h-2v2.95zM4 10.5H1v2h3v-2zm11-4.19V1.5H9v4.81C7.21 7.35 6 9.28 6 11.5c0 3.31 2.69 6 6 6s6-2.69 6-6c0-2.22-1.21-4.15-3-5.19zm5 4.19v2h3v-2h-3zm-2.76 7.66l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4z"/>
</SvgIcon>
);
ImageWbIncandescent = pure(ImageWbIncandescent);
ImageWbIncandescent.displayName = 'ImageWbIncandescent';
export default ImageWbIncandescent;
|
examples/UnigridExample1.js | yoonka/unigrid | /*
Copyright (c) 2018, Grzegorz Junka
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import React from 'react';
// import tableData from './json/tableResp1.json!';
import {
Unigrid,
UnigridEmptyCell,
UnigridTextCell,
isDefined,
idMaker
} from 'src/index';
export class UnigridExample1 extends React.Component {
handleClick() {
console.log(this.props.item);
}
showFun(props) {
return props.item.hCategory;
}
showFun2() {
return 'testValue';
}
render() {
const idCounter = idMaker();
const mkKey = () => idCounter.next().value;
const props = {
data: tableData,
table: {
className: 'unigrid-main-class',
$do: [
{
section: 'header',
className: 'unigrid-header',
$do: [
{
cells: [
{show: 'hAgent', as: UnigridTextCell},
'hDate',
'hStreet',
{show: 'hName', as: 'string', className: 'name-header-cell'},
'hNumber'
],
rowAs: 'header'
}
]
},
{
select: 'all',
$do: [
{
section: 'body',
className: 'unigrid-segment',
$do: [
{
condition: {ifDoes: 'exist', property: 'list'},
fromProperty: 'list',
select: 0,
$do: [
{
cells: [
'hCategory',
{as: 'empty', colSpan: 1},
{show: this.showFun},
this.showFun2,
'hNumber'],
rowAs: 'header'
}
]
},
{
condition: {ifDoes: 'exist', property: 'list'},
fromProperty: 'list',
$do: [
{
cells: [
{cell: 'category2'},
{as: 'empty', colSpan: 3},
'hNumber'],
rowAs: 'header'
}
]
},
{
className: 'some-row-class',
cells: [
'agent', 'date', 'street', 'name',
{show: 'number',
as: 'string',
className: 'number-cell',
onClick: this.handleClick,
bindToCell: 'onClick'
}]
},
{
condition: {ifDoes: 'exist', property: 'list'},
fromProperty: 'list',
select: 'all',
$do: [
{
cells: [{as: 'empty', colSpan: 3}, 'name', 'number'],
mixIn: {
onClick: this.handleClick,
bindToCell: 'onClick'
}
}
]
}
]
}
]
},
{
section: 'footer',
className: 'unigrid-footer',
$do: [
{
select: 0,
$do: [
{cells: [null, null, null, 'fSum', 'fTotal']},
{cells: [null, null, null, 'sum', 'total']}
]
}
]
}
]
},
cellTypes: {
empty: UnigridEmptyCell,
string: UnigridTextCell
}
};
return (
<div>
<p>Example 1 : Multitable (no JSX)</p>
<Unigrid {...props} />
</div>
);
}
}
|
src/index.js | marksantoso/starwars_search | import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers/index';
import {BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom';
import About from './components/sections/about';
import Main from './components/sections/main';
const store = createStore(rootReducer, applyMiddleware(thunk));
ReactDOM.render(
<Provider store={store}>
<Router>
<div>
<Switch>
<Route path="/about" component={About} />
<Route path="/" component={Main} />
</Switch>
</div>
</Router>
</Provider>, document.querySelector('.container'));
|
src/js/components/icons/base/Gamepad.js | odedre/grommet-final | /**
* @description Gamepad SVG Icon.
* @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon.
* @property {string} colorIndex - The color identifier to use for the stroke color.
* If not specified, this component will default to muiTheme.palette.textColor.
* @property {xsmall|small|medium|large|xlarge|huge} size - The icon size. Defaults to small.
* @property {boolean} responsive - Allows you to redefine what the coordinates.
* @example
* <svg width="24" height="24" ><path d="M12,16 C11,16 10.0029053,16.9956421 9,18 C8.00290526,18.9985389 7.99709474,19.0029053 7,20 C4,23 1,21 1,18 C1,15 1.00000002,13.969213 1,11 C0.999999979,8.03078698 3,6 6,6 C8.00000008,6 12,6 12,6 C12,6 15.9999999,6 18,6 C21,6 23,8.03078698 23,11 C23,13.969213 23,15 23,18 C23,21 20,23 17,20 C16.0029053,19.0029053 15.9970947,18.9985389 15,18 C13.9970947,16.9956421 13,16 12,16 Z M12,6 L12,2 M19,15 C19.5522847,15 20,14.5522847 20,14 C20,13.4477153 19.5522847,13 19,13 C18.4477153,13 18,13.4477153 18,14 C18,14.5522847 18.4477153,15 19,15 Z M15,12 C15.5522847,12 16,11.5522847 16,11 C16,10.4477153 15.5522847,10 15,10 C14.4477153,10 14,10.4477153 14,11 C14,11.5522847 14.4477153,12 15,12 Z M4,12 L10,12 M7,9 L7,15"/></svg>
*/
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import CSSClassnames from '../../../utils/CSSClassnames';
import Intl from '../../../utils/Intl';
import Props from '../../../utils/Props';
const CLASS_ROOT = CSSClassnames.CONTROL_ICON;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class Icon extends Component {
render () {
const { className, colorIndex } = this.props;
let { a11yTitle, size, responsive } = this.props;
let { intl } = this.context;
const classes = classnames(
CLASS_ROOT,
`${CLASS_ROOT}-gamepad`,
className,
{
[`${CLASS_ROOT}--${size}`]: size,
[`${CLASS_ROOT}--responsive`]: responsive,
[`${COLOR_INDEX}-${colorIndex}`]: colorIndex
}
);
a11yTitle = a11yTitle || Intl.getMessage(intl, 'gamepad');
const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));
return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M12,16 C11,16 10.0029053,16.9956421 9,18 C8.00290526,18.9985389 7.99709474,19.0029053 7,20 C4,23 1,21 1,18 C1,15 1.00000002,13.969213 1,11 C0.999999979,8.03078698 3,6 6,6 C8.00000008,6 12,6 12,6 C12,6 15.9999999,6 18,6 C21,6 23,8.03078698 23,11 C23,13.969213 23,15 23,18 C23,21 20,23 17,20 C16.0029053,19.0029053 15.9970947,18.9985389 15,18 C13.9970947,16.9956421 13,16 12,16 Z M12,6 L12,2 M19,15 C19.5522847,15 20,14.5522847 20,14 C20,13.4477153 19.5522847,13 19,13 C18.4477153,13 18,13.4477153 18,14 C18,14.5522847 18.4477153,15 19,15 Z M15,12 C15.5522847,12 16,11.5522847 16,11 C16,10.4477153 15.5522847,10 15,10 C14.4477153,10 14,10.4477153 14,11 C14,11.5522847 14.4477153,12 15,12 Z M4,12 L10,12 M7,9 L7,15"/></svg>;
}
};
Icon.contextTypes = {
intl: PropTypes.object
};
Icon.defaultProps = {
responsive: true
};
Icon.displayName = 'Gamepad';
Icon.icon = true;
Icon.propTypes = {
a11yTitle: PropTypes.string,
colorIndex: PropTypes.string,
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),
responsive: PropTypes.bool
};
|
src/svg-icons/action/note-add.js | rhaedes/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionNoteAdd = (props) => (
<SvgIcon {...props}>
<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"/>
</SvgIcon>
);
ActionNoteAdd = pure(ActionNoteAdd);
ActionNoteAdd.displayName = 'ActionNoteAdd';
export default ActionNoteAdd;
|
news/components/Nav/SmallNav.js | FreeCodeCampQuito/FreeCodeCamp | import React from 'react';
import Media from 'react-media';
import { Navbar, Row } from 'react-bootstrap';
import FCCSearchBar from 'react-freecodecamp-search';
import NavLogo from './components/NavLogo';
import NavLinks from './components/NavLinks';
import propTypes from './navPropTypes';
function SmallNav({ clickOnLogo }) {
return (
<Media
query='(max-width: 750px)'
>
{
matches => matches && typeof window !== 'undefined' && (
<div>
<Row>
<Navbar.Header className='small-nav'>
<div className='nav-component header'>
<Navbar.Toggle />
<NavLogo clickOnLogo={ clickOnLogo } />
</div>
<div className='nav-component bins'/>
</Navbar.Header>
</Row>
<Row className='collapse-row'>
<Navbar.Collapse>
<NavLinks>
<FCCSearchBar />
</NavLinks>
</Navbar.Collapse>
</Row>
</div>
)
}
</Media>
);
}
SmallNav.displayName = 'SmallNav';
SmallNav.propTypes = propTypes;
export default SmallNav;
|
examples/js/custom/search/default-custom-search-field.js | powerhome/react-bootstrap-table | /* eslint max-len: 0 */
/* eslint no-unused-vars: 0 */
/* eslint no-alert: 0 */
import React from 'react';
import { BootstrapTable, TableHeaderColumn, SearchField } from 'react-bootstrap-table';
const products = [];
function addProducts(quantity) {
const startId = products.length;
for (let i = 0; i < quantity; i++) {
const id = startId + i;
products.push({
id: id,
name: 'Item name ' + id,
price: 2100 + i
});
}
}
addProducts(5);
export default class DefaultCustomSearchFieldTable extends React.Component {
createCustomSearchField = (props) => {
return (
<SearchField
className='my-custom-class'
defaultValue={ props.defaultSearch }
placeholder={ props.searchPlaceholder }/>
);
}
render() {
const options = {
clearSearch: true,
searchField: this.createCustomSearchField
};
return (
<BootstrapTable data={ products } options={ options } search>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}
|
app/containers/SendPage.js | soosgit/vessel | // @flow
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { Redirect } from 'react-router';
import { connect } from 'react-redux';
import { Header, Segment } from 'semantic-ui-react';
import * as AccountActions from '../actions/account';
import * as KeysActions from '../actions/keys';
import * as ProcessingActions from '../actions/processing';
import Send from '../components/Send';
import MenuBar from './MenuBar';
import ContentBar from '../components/ContentBar';
class SendPage extends Component {
state = {
intervalId: 0
};
componentDidMount() {
// this.interval = setInterval(this.timer.bind(this), 10000);
// this.props.actions.refreshAccountData(this.props.keys.names);
}
componentWillUnmount() { clearInterval(this.interval); }
timer = () => { this.props.actions.refreshAccountData(this.props.keys.names); }
interval = 0;
render() {
if (!this.props.keys.isUser) {
return <Redirect to="/" />;
}
return (
<ContentBar>
<Segment attached secondary padded>
<Header
icon="send"
content="Send Funds"
subheader="Transfer STEEM or SBD from one of your accounts to another user or exchange."
/>
</Segment>
<Segment basic>
<Send {...this.props} />
</Segment>
<MenuBar />
</ContentBar>
);
}
}
function mapStateToProps(state) {
return {
account: state.account,
keys: state.keys,
preferences: state.preferences,
processing: state.processing
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
...AccountActions,
...KeysActions,
...ProcessingActions
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(SendPage);
|
src/components/Tagline.js | Harrison1/several-levels | import React from 'react';
const Tagline = () =>
<p className="tagline">
web and app development
</p>
export default Tagline;
|
src/svg-icons/hardware/laptop-chromebook.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let HardwareLaptopChromebook = (props) => (
<SvgIcon {...props}>
<path d="M22 18V3H2v15H0v2h24v-2h-2zm-8 0h-4v-1h4v1zm6-3H4V5h16v10z"/>
</SvgIcon>
);
HardwareLaptopChromebook = pure(HardwareLaptopChromebook);
HardwareLaptopChromebook.displayName = 'HardwareLaptopChromebook';
HardwareLaptopChromebook.muiName = 'SvgIcon';
export default HardwareLaptopChromebook;
|
www/components/TagPanel/TagPanel.js | DremyGit/dremy-blog | import React from 'react';
import styles from './TagPanel.scss';
import TagItem from './TagItem';
export default class TagPanel extends React.Component {
shouldComponentUpdate(nextProps) {
return nextProps.tags !== this.tags;
}
render() {
function calculateFontSize(tags, minSize, maxSize) {
const orderdTags = tags.sort((a, b) => {
if (a.get('count') < b.get('count')) return 1;
if (a.get('count') > b.get('count')) return -1;
return 0;
});
const max = orderdTags.first().get('count');
const min = orderdTags.last().get('count');
return tags.map(tag => tag.set('fontSize', minSize + Math.log(tag.get('count') - min + 1) / Math.log(max - min + 1) * (maxSize - minSize)));
}
const { tags } = this.props;
const ntags = calculateFontSize(tags, 12, 30);
return (
<div className={styles.container}>
{ntags.map(tag =>
<TagItem key={tag.get('code')} name={tag.get('name')} link={`/tag/${tag.get('code')}`} fontSize={tag.get('fontSize')} />,
).toArray()}
</div>
);
}
}
TagPanel.PropTypes = {
tags: React.PropTypes.object.isRequired,
};
|
src/Form/FormLabel.js | dsslimshaddy/material-ui | // @flow
import React from 'react';
import type { Element } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = (theme: Object) => {
const focusColor = theme.palette.primary[theme.palette.type === 'light' ? 'A700' : 'A200'];
return {
root: {
fontFamily: theme.typography.fontFamily,
color: theme.palette.input.labelText,
lineHeight: 1,
},
focused: {
color: focusColor,
},
error: {
color: theme.palette.error.A400,
},
disabled: {
color: theme.palette.input.disabled,
},
};
};
type DefaultProps = {
classes: Object,
component: string,
};
export type Props = {
/**
* The content of the component.
*/
children?: Element<*>,
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component?: string | Function,
/**
* If `true`, the label should be displayed in a disabled state.
*/
disabled?: boolean,
/**
* If `true`, the label should be displayed in an error state.
*/
error?: boolean,
/**
* If `true`, the input of this label is focused (used by `FormGroup` components).
*/
focused?: boolean,
/**
* If `true`, the label will indicate that the input is required.
*/
required?: boolean,
};
type AllProps = DefaultProps & Props;
function FormLabel(props: AllProps, context: { muiFormControl: Object }) {
const {
children,
classes,
className: classNameProp,
component: Component,
disabled: disabledProp,
error: errorProp,
focused: focusedProp,
required: requiredProp,
...other
} = props;
const { muiFormControl } = context;
let required = requiredProp;
let focused = focusedProp;
let disabled = disabledProp;
let error = errorProp;
if (muiFormControl) {
if (typeof required === 'undefined') {
required = muiFormControl.required;
}
if (typeof focused === 'undefined') {
focused = muiFormControl.focused;
}
if (typeof disabled === 'undefined') {
disabled = muiFormControl.disabled;
}
if (typeof error === 'undefined') {
error = muiFormControl.error;
}
}
const className = classNames(
classes.root,
{
[classes.focused]: focused,
[classes.disabled]: disabled,
[classes.error]: error,
},
classNameProp,
);
const asteriskClassName = classNames({
[classes.error]: error,
});
return (
<Component className={className} {...other}>
{children}
{required &&
<span className={asteriskClassName} data-mui-test="FormLabelAsterisk">
{'\u2009*'}
</span>}
</Component>
);
}
FormLabel.defaultProps = {
component: 'label',
};
FormLabel.contextTypes = {
muiFormControl: PropTypes.object,
};
export default withStyles(styles, { name: 'MuiFormLabel' })(FormLabel);
|
public/components/tehtPage/tabsComponents/reusables/templates/Basic.js | City-of-Vantaa-SmartLab/kupela | import React from 'react';
const Basic = (props) => (
<div className="component">
<p>{props.title}</p>
<img src={props.src} />
</div>
);
export default Basic; |
src/components/Grid.js | arjunsk/react-redux-audio-player | /*
Components are dumb
Containers are smart
~This is a container
*/
import React, { Component } from 'react';
import './Grid.css';
import {play_track, pause_track } from "../actions/actions_settings"
import {connect} from "react-redux"
class Grid extends Component {
constructor(props) {
super(props);
this.onItemClick= this.onItemClick.bind(this);
}
onItemClick(event) {
const {id} = event.target;
if(this.props.settingsObj.isPlaying) {
// === equal compares even the type
if(id == this.props.settingsObj.trackID) {
this.props.pause_track();
}else{
this.props.play_track(id);
}
}else{
this.props.play_track(id);
}
};
render() {
var track = this.props.track;
return (
<div className="card card-2">
<div className="container">
<img className="cover_image" alt="" src={track.artwork_url} style={{width: "100%" , height:"90%"}} />
<div className="middle">
<div className="text">
<i className={ (this.props.settingsObj.isPlaying && track.id==this.props.settingsObj.trackID) ? "fa fa-pause" : "fa fa-play" } id={track.id} onClick={this.onItemClick} ></i>
</div>
</div>
</div>
<div>
<div style={{float: "left"}} className="song-card-bottom-div">
<img className="avatar" alt="" src={track.user.avatar_url}/>
</div>
<div style={{margin:"2px"}} className="song-card-bottom-div">
<a className="song-card-title">
{track.title}
</a>
<a className="song-card-user-username">
{track.user.username}
</a>
</div>
</div>
</div>
);
}
}
function mapDispatchToProps(dispatch) {
return({
pause_track: () => {dispatch(pause_track())},
play_track: (id) => {dispatch(play_track(id))}
})
}
function mapStateToProps(store){
return {
settingsObj : store.settingsReducer
}
}
export default connect( mapStateToProps,mapDispatchToProps)(Grid);
|
actor-apps/app-web/src/app/components/SidebarSection.react.js | luwei2012/actor-platform | import React from 'react';
//import { Styles, Tabs, Tab } from 'material-ui';
//import ActorTheme from 'constants/ActorTheme';
import HeaderSection from 'components/sidebar/HeaderSection.react';
import RecentSection from 'components/sidebar/RecentSection.react';
//import ContactsSection from 'components/sidebar/ContactsSection.react';
//const ThemeManager = new Styles.ThemeManager();
class SidebarSection extends React.Component {
//static childContextTypes = {
// muiTheme: React.PropTypes.object
//};
//
//getChildContext() {
// return {
// muiTheme: ThemeManager.getCurrentTheme()
// };
//}
constructor(props) {
super(props);
//ThemeManager.setTheme(ActorTheme);
}
render() {
return (
<aside className="sidebar">
<HeaderSection/>
<RecentSection/>
{/*
<Tabs className="sidebar__tabs"
contentContainerClassName="sidebar__tabs__tab-content"
tabItemContainerClassName="sidebar__tabs__tab-items">
<Tab label="Recent">
<RecentSection/>
</Tab>
<Tab label="Contacts">
<ContactsSection/>
</Tab>
</Tabs>
*/}
</aside>
);
}
}
export default SidebarSection;
|
definitions/npm/react-dnd_v2.x.x/test_react-dnd-v2.js | echenley/flow-typed | /* @flow */
import React from 'react';
import ReactDOM from 'react-dom';
import { DragSource, DropTarget, DragLayer, DragDropContext } from 'react-dnd';
// Test Drag Source
// ----------------------------------------------------------------------
type KnightDefaultProps = {
color: string;
};
type KnightProps = KnightDefaultProps & {
title: string;
connectDragSource: (e: React$Element<*>) => ?React$Element<*>;
connectDragPreview: (e: Image) => ?Image;
isDragging: boolean;
};
const knightSource = {
beginDrag() {
return {};
}
};
function knightCollect(connect, monitor) {
return {
connectDragSource: connect.dragSource(),
connectDragPreview: connect.dragPreview(),
isDragging: monitor.isDragging()
};
}
class Knight extends React.Component {
props: KnightProps;
static defaultProps: KnightDefaultProps;
componentDidMount() {
const img = new Image();
img.onload = () => { this.props.connectDragPreview(img) };
}
foo(): string {
return 'foo';
}
render() {
const { color, title, connectDragSource, isDragging } = this.props;
return connectDragSource(
<div title={title} style={{
color,
fontSize: 40,
fontWeight: 'bold',
cursor: 'move',
opacity: isDragging ? 0.5 : 1
}}>
♘
</div>
);
}
}
Knight.defaultProps = {
color: 'blue'
};
const DndKnight = DragSource('knight', knightSource, knightCollect)(Knight);
(DndKnight: Class<DndComponent<Knight, *, *, void>>);
// $ExpectError
(DndKnight: number);
const x: DndKnight = ({}:any);
// $ExpectError
x.foo();
(x.getDecoratedComponentInstance().foo(): string);
// $ExpectError
(x.getDecoratedComponentInstance().foo(): number);
ReactDOM.render(<DndKnight title="foo" />, document.body);
// Test Drop Target
// ----------------------------------------------------------------------
function moveKnight(toX: number, toY: number) {
}
function canMoveKnight(toX: number, toY: number) {
return true;
}
type SquareProps = {
black: boolean
};
class Square extends React.Component {
props: SquareProps;
static defaultProps: SquareProps;
render() {
const { black } = this.props;
const fill = black ? 'black' : 'white';
return <div style={{ backgroundColor: fill }} />;
}
}
Square.defaultProps = {
black: true
};
type BoardSquareDefaultProps = {
x: number;
};
type BoardSquareProps = BoardSquareDefaultProps & {
y: number;
connectDropTarget: (e: React$Element<*>) => ?React$Element<*>;
isOver: boolean;
canDrop: boolean;
};
const boardSquareTarget = {
canDrop(props) {
return canMoveKnight(props.x, props.y);
},
drop(props) {
moveKnight(props.x, props.y);
}
};
function boardSquareCollect(connect, monitor) {
return {
connectDropTarget: connect.dropTarget(),
isOver: monitor.isOver(),
canDrop: monitor.canDrop()
};
}
class BoardSquare extends React.Component {
props: BoardSquareProps;
static defaultProps: BoardSquareDefaultProps;
renderOverlay(color: string) {
return (
<div style={{
position: 'absolute',
top: 0,
left: 0,
height: '100%',
width: '100%',
zIndex: 1,
opacity: 0.5,
backgroundColor: color,
}} />
);
}
render() {
const { x, y, connectDropTarget, isOver, canDrop } = this.props;
const black = (x + y) % 2 === 1;
return connectDropTarget(
<div style={{
position: 'relative',
width: '100%',
height: '100%'
}}>
<Square black={black} />
{isOver && !canDrop && this.renderOverlay('red')}
{!isOver && canDrop && this.renderOverlay('yellow')}
{isOver && canDrop && this.renderOverlay('green')}
</div>
);
}
}
BoardSquare.defaultProps = {
x: 0
};
const DndBoardSquare = DropTarget('boardsquare', boardSquareTarget, boardSquareCollect)(BoardSquare);
(DndBoardSquare: Class<DndComponent<BoardSquare, *, *, void>>);
// $ExpectError
(DndBoardSquare: string);
ReactDOM.render(<DndBoardSquare y={5} />, document.body);
// Test Custom Drag Layer
// ----------------------------------------------------------------------
type CustomDragLayerProps = {
isDragging: boolean;
title: string;
}
function dragLayerCollect(monitor) {
return {
isDragging: monitor.isDragging(),
item: monitor.getItem(),
};
}
class CustomDragLayer extends React.Component {
props: CustomDragLayerProps;
static defaultProps: CustomDragLayerProps;
render() {
const { title, isDragging } = this.props;
if (!isDragging) {
return null;
}
return (
<div>this.props.title</div>
);
}
}
CustomDragLayer.defaultProps = {
isDragging: false,
title: ''
};
const DndCustomDragLayer = DragLayer(dragLayerCollect)(CustomDragLayer);
(DndCustomDragLayer: Class<DndComponent<CustomDragLayer, *, *, void>>);
// $ExpectError
(DndCustomDragLayer: number);
// Test Drag Drop Context
// ----------------------------------------------------------------------
type BoardProps = {
width: number,
height: number
};
class Board extends React.Component {
props: BoardProps;
static defaultProps: BoardProps;
render() {
const styles = {
width: this.props.width,
height: this.props.height
}
return <div style={ styles } />;
}
}
Board.defaultProps = {
width: 400,
height: 400
};
const DndBoard = DragDropContext({})(Board);
(DndBoard: Class<ContextComponent<Board, BoardProps, BoardProps, void>>);
// $ExpectError
(DndBoard: string);
// Test Functional React Components
// ----------------------------------------------------------------------
type TestProps = {
connectDragSource: (e: React$Element<*>) => React$Element<*>,
isDragging: boolean
}
const testSource = {
beginDrag() {
return {};
}
};
function testCollect(connect, monitor) {
return {
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
};
}
const TestFuncComp = (props: TestProps) => {
const { connectDragSource, isDragging } = props;
return connectDragSource(
<div style={{
opacity: isDragging ? 0.5 : 1
}} />
);
}
const DndTestFuncComp = DragSource('test', testSource, testCollect)(TestFuncComp);
(DndTestFuncComp: Class<DndComponent<*, *, *, *>>);
|
fields/types/date/DateColumn.js | joerter/keystone | import React from 'react';
import moment from 'moment';
import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';
var DateColumn = React.createClass({
displayName: 'DateColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
},
renderValue () {
const value = this.props.data.fields[this.props.col.path];
if (!value) return null;
const format = (this.props.col.type === 'datetime') ? 'MMMM Do YYYY, h:mm:ss a' : 'MMMM Do YYYY';
const formattedValue = moment(value).format(format);
return (
<ItemsTableValue title={formattedValue} field={this.props.col.type}>
{formattedValue}
</ItemsTableValue>
);
},
render () {
return (
<ItemsTableCell>
{this.renderValue()}
</ItemsTableCell>
);
},
});
module.exports = DateColumn;
|
components/day/PostDay.js | headwinds/porthole |
/* eslint-disable */
import React from 'react';
export default class PostDay extends React.Component {
constructor(props){
super(props)
this.state = {
posts: [],
}
}
componentDidMount(){
}
render() {
return (
<div>
<p></p>
</div>
);
}
}
|
src/routes.js | Kelvinmijaya/reactlite-starter-kit | import React from 'react'
import { Route, IndexRoute } from 'react-router'
import CoreLayout from './layouts/CoreLayout/CoreLayout'
import { HomeView } from './module/home'
export default (store) => (
<Route path='/' component={CoreLayout}>
<IndexRoute component={HomeView} />
</Route>
)
|
lib/views/mounts-table.js | koding/kd-atom | 'use babel'
import React from 'react'
import TableView from './table-view'
import MountRow from './mount-row'
export default class MountsTable extends React.Component {
constructor(props) {
super(props)
this.state = { mountProgress: {} }
}
getHeadings() {
return [
{ label: 'Label', accessor: 'label' },
{ label: 'Local Path', accessor: 'mount.path' },
{ label: 'Remote Path', accessor: 'mount.remotePath' },
{ label: 'Copy id' },
{ label: 'Open' },
{ label: 'Unmount' },
]
}
setMountProgress(mount, state) {
this.setState({
mountProgress: {
...this.state.mountProgress,
[mount.id]: state,
},
})
}
onUnmount(mount, index) {
this.setMountProgress(mount, true)
this.props
.onUnmount(mount, index)
.then(() => this.setMountProgress(mount, false))
.catch(() => this.setMountProgress(mount, false))
}
renderRow(mount, index) {
return (
<MountRow
key={index}
mount={mount}
hasMountProgress={this.state.mountProgress[mount.id]}
index={index}
onOpen={this.props.onOpen}
onNewWindow={this.props.onNewWindow}
onUnmount={this.onUnmount.bind(this)}
onShowMachine={this.props.onShowMachine}
onCopyId={this.props.onCopyId}
/>
)
}
render() {
const { mounts, onClose, onReload } = this.props
return (
<TableView
title="Mounts"
headings={this.getHeadings()}
items={mounts}
onClose={onClose}
onReload={onReload}
renderRow={this.renderRow.bind(this)}
colCount={5}
noItem="No mount is found!"
/>
)
}
}
MountsTable.propTypes = {
mounts: React.PropTypes.array,
onClose: React.PropTypes.func,
onReload: React.PropTypes.func,
onOpen: React.PropTypes.func,
onNewWindow: React.PropTypes.func,
onUnmount: React.PropTypes.func,
onShowMachine: React.PropTypes.func,
onCopyId: React.PropTypes.func,
}
|
src/js/views/flows/Flows.js | mmagr/gui | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Link } from 'react-router'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
import AltContainer from 'alt-container';
import FlowStore from '../../stores/FlowStore';
import FlowActions from '../../actions/FlowActions';
import {PageHeader} from "../../containers/full/PageHeader";
import util from "../../comms/util/util";
function SummaryItem(props) {
return (
<div className={"lst-entry-wrapper z-depth-2 col s12"}>
<div className="lst-entry-title col s12">
<div className="app-icon img">
<i className="material-icons mi-device-hub shadow" />
</div>
<div className="user-label truncate">{props.flow.name}</div>
<div className="label">flow name</div>
<span className={"badge " + status}>{status}</span>
</div>
<div className="lst-entry-body col s12">
<div className="col s3 metric">
<div className="metric-value">{props.flow.flow.length - 1}</div>
<div className="metric-label">Nodes</div>
</div>
<div className="col s9 metric last">
<div className="metric-value">{util.printTime(props.flow.updated / 1000)}</div>
<div className="metric-label">Last update</div>
</div>
</div>
</div>
)
}
class ListRender extends Component {
constructor(props) {
super(props);
}
render () {
const flowList = this.props.flows;
if (Object.keys(flowList).length > 0) {
return (
<div className="row">
<div className="col s12 lst-wrapper">
{ Object.keys(flowList).map((flowid) =>
<Link to={"/flows/id/" + flowid} key={flowid} >
<div className="lst-entry col s12 m6 l4">
<SummaryItem flow={flowList[flowid]} />
</div>
</Link>
)}
</div>
</div>
)
} else {
return (
<div className="row full-height relative">
<div className="background-info valign-wrapper full-height">
<span className="horizontal-center">No configured flows</span>
</div>
</div>
)
}
}
}
class FlowList extends Component {
constructor(props) {
super(props);
this.state = {
filter: '',
};
this.handleViewChange = this.handleViewChange.bind(this);
this.applyFiltering = this.applyFiltering.bind(this);
this.detailedTemplate = this.detailedTemplate.bind(this);
this.editTemplate = this.editTemplate.bind(this);
}
handleViewChange(event) {
this.setState({isDisplayList: ! this.state.isDisplayList})
}
detailedTemplate(id) {
let temp = this.state;
if (this.state.detail && this.state.edit) {
if (id === undefined) {
temp.edit = undefined;
}
}
temp.detail = id;
this.setState(temp);
return true;
}
editTemplate(id) {
if (this.state.detail === id) {
let temp = this.state;
temp.edit = id;
this.setState(temp);
return true;
}
return false;
}
// handleSearchChange(event) {
// const filter = event.target.value;
// let state = this.state;
// state.filter = filter;
// state.detail = undefined;
// this.setState(state);
// }
applyFiltering(flowList) {
return flowList;
const filter = this.state.filter;
const idFilter = filter.match(/id:\W*([-a-fA-F0-9]+)\W?/);
return flowList.filter(function(e) {
let result = false;
if (idFilter && idFilter[1]) {
result = result || e.id.toUpperCase().includes(idFilter[1].toUpperCase());
}
return result || e.label.toUpperCase().includes(filter.toUpperCase());
});
}
render() {
const filteredList = this.applyFiltering(this.props.flows);
return (
<div className="col m10 s12 offset-m1 full-height relative" >
<ListRender flows={filteredList}
detail={this.state.detail}
detailedTemplate={this.detailedTemplate}
edit={this.state.edit}
editTemplate={this.editTemplate} />
{/* <!-- footer --> */}
<div className="col s12"></div>
<div className="col s12"> </div>
</div>
)
}
}
class Flows extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
FlowActions.fetch.defer();
}
render() {
return (
<ReactCSSTransitionGroup
transitionName="first"
transitionAppear={true} transitionAppearTimeout={500}
transitionEnterTimeout={500} transitionLeaveTimeout={500} >
<PageHeader title="data flows" subtitle="">
{/* <Filter onChange={this.filterChange} /> */}
<Link to="/flows/new" className="btn-item btn-floating waves-effect waves-light cyan darken-2" title="Create a new data flow">
<i className="fa fa-plus"/>
</Link>
</PageHeader>
<AltContainer store={FlowStore}>
<ListRender />
</AltContainer>
</ReactCSSTransitionGroup>
);
}
}
export { Flows };
|
packages/reactor-kitchensink/src/examples/Button/Button.js | sencha/extjs-reactor | import React, { Component } from 'react';
import { Spacer, ToggleField, Container, Panel, Button, Menu, MenuItem, MenuRadioItem } from '@extjs/ext-react';
export default class ButtonExample extends Component {
state = {
style: '',
type: 'text',
round: false
};
onStyleChange = (item) => this.setState({ style: item.value })
onTypeChange = (item) => this.setState({ type: item.value })
toggleRound = () => this.setState({ round: !this.state.round });
render() {
const { style, type, round } = this.state;
const iconCls = type.indexOf('icon') !== -1 ? 'x-fa fa-heart' : null;
const text = type.indexOf('text') !== -1;
let menu, ui;
if (style === 'menu') {
menu = (
<Menu indented={false}>
<MenuItem text="Item 1"/>
<MenuItem text="Item 2"/>
<MenuItem text="Item 3"/>
</Menu>
);
} else {
ui = style.toLowerCase();
}
if (round) {
ui += ' round';
}
return (
<Container padding="10">
<Container
layout={{ type: 'hbox', pack: Ext.os.is.Phone ? 'center' : 'left'}}
margin="0 0 10 0"
defaults={{ margin: "0 10 0 0" }}
width={Ext.isIE && 550}
>
<Button ui="action raised" text="Style">
<Menu defaults={{ handler: this.onStyleChange, group: 'buttonstyle' }}>
<MenuItem text="None" value="" iconCls={style === '' && 'x-font-icon md-icon-check'}/>
<MenuItem text="Action" value="action" iconCls={style === 'action' && 'x-font-icon md-icon-check'}/>
<MenuItem text="Decline" value="decline" iconCls={style === 'decline' && 'x-font-icon md-icon-check'}/>
<MenuItem text="Confirm" value="confirm" iconCls={style === 'confirm' && 'x-font-icon md-icon-check'}/>
<MenuItem text="Menu" value="menu" iconCls={style === 'menu' && 'x-font-icon md-icon-check'}/>
</Menu>
</Button>
<Button ui="action raised" text="Type">
<Menu defaults={{ handler: this.onTypeChange, group: 'buttontype' }}>
<MenuItem text="Text" value="text" iconCls={type === 'text' && 'x-font-icon md-icon-check'}/>
<MenuItem text="Icon" value="icon" iconCls={type === 'icon' && 'x-font-icon md-icon-check'}/>
<MenuItem text="Text & Icon" value="texticon" iconCls={type === 'texticon' && 'x-font-icon md-icon-check'}/>
</Menu>
</Button>
<Button ui="action raised" iconCls={round ? 'x-fa fa-check' : null} enableToggle text="Round" handler={this.toggleRound}/>
</Container>
<Panel { ...layoutProps }>
<Container>
<div {...groupLabelProps}>Default</div>
<Container className="button-group" {...buttonGroupProps}>
<Button text={ text && "Normal" } ui={ui} iconCls={iconCls} arrowAlign="bottom">{menu}</Button>
<Button text={ text && "Badge" } ui={ui} iconCls={iconCls} badgeText="2">{menu}</Button>
<Button text={ text && "Disabled" } ui={ui} iconCls={iconCls} disabled>{menu}</Button>
</Container>
</Container>
<Container>
<div {...groupLabelProps}>Alt</div>
<Container className="button-group button-group-alt" {...buttonGroupProps}>
<Button text={ text && "Normal" } ui={ui + ' alt'} iconCls={iconCls}>{menu}</Button>
<Button text={ text && "Badge" } ui={ui + ' alt'} iconCls={iconCls} badgeText="2">{menu}</Button>
<Button text={ text && "Disabled" } ui={ui + ' alt'} iconCls={iconCls} disabled>{menu}</Button>
</Container>
</Container>
<Container>
<div {...groupLabelProps}>Raised</div>
<Container className="button-group" {...buttonGroupProps}>
<Button text={ text && "Normal" } ui={ui + ' raised'} iconCls={iconCls}>{menu}</Button>
<Button text={ text && "Badge" } ui={ui + ' raised'} iconCls={iconCls} badgeText="2">{menu}</Button>
<Button text={ text && "Disabled" } ui={ui + ' raised'} iconCls={iconCls} disabled>{menu}</Button>
</Container>
</Container>
<Container>
<div {...groupLabelProps}>Alt Raised</div>
<Container className="button-group button-group-alt" {...buttonGroupProps}>
<Button text={ text && "Normal" } ui={ui + ' alt raised'} iconCls={iconCls}>{menu}</Button>
<Button text={ text && "Badge" } ui={ui + ' alt raised'} iconCls={iconCls} badgeText="2">{menu}</Button>
<Button text={ text && "Disabled" } ui={ui + ' alt raised'} iconCls={iconCls} disabled>{menu}</Button>
</Container>
</Container>
</Panel>
</Container>
)
}
}
const layoutProps = Ext.os.is.Phone ? {
height: '100%',
width: '100%',
className: 'demo-buttons',
defaults: {
margin: '20'
}
} : {
padding: 10,
shadow: true,
defaults: {
layout: 'hbox',
flex: 1,
margin: '10',
width: '100%'
}
}
const buttonGroupProps = Ext.os.is.Phone ? {
padding: '20 0 0 20',
defaults: {
margin: '0 20 20 0',
width: 'calc(50% - 20px)',
}
} : {
padding: '17 0 17 20',
layout: { type: 'hbox', align: 'middle', pack: 'space-around' },
flex: 1,
margin: '0 20 0 0',
width: 400,
defaults: {
margin: '0 20 0 0'
}
}
const groupLabelProps = Ext.os.is.Phone ? {
style: {
margin: '0 0 5px 0'
}
} : {
style: {
width: '70px',
textAlign: 'right',
margin: '24px 20px 0 0'
}
};
|
example/src/routing.js | mrblueblue/react-collider | import React from 'react'
import {default as Router, Route, DefaultRoute} from 'react-router'
import Html from './components/layout/html'
// Import your pages
import Home from './components/home/home'
import Video from './components/video/video'
// Declare your routes
var routes = (
<Route handler={Html} path="/">
<DefaultRoute handler={Home} />
<Route name="home" handler={Home} path="/" />
<Route name="video" handler={Video} path="/video/:id" />
</Route>
)
export default routes
|
tests/Rules-isAlpha-spec.js | meraki/mki-formsy-react | import React from 'react';
import TestUtils from 'react-dom/test-utils';
import Formsy from './..';
import { InputFactory } from './utils/TestInput';
const TestInput = InputFactory({
render() {
return <input value={this.getValue()} readOnly/>;
}
});
class TestForm extends React.Component {
render() {
return (
<Formsy.Form>
<TestInput name="foo" validations="isAlpha" value={this.props.inputValue}/>
</Formsy.Form>
);
}
}
export default {
'should pass with a default value': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with a string is only latin letters': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue="myValue"/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should fail with a string with numbers': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue="myValue42"/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), false);
test.done();
},
'should pass with an undefined': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={undefined}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with a null': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={null}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should pass with an empty string': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={''}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), true);
test.done();
},
'should fail with a number': function (test) {
const form = TestUtils.renderIntoDocument(<TestForm inputValue={42}/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.isValid(), false);
test.done();
}
};
|
src/utils/client.js | m4n3z40/founders-map-quest | import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {INITIAL_STATE_VARNAME, ROOT_ELEMENT_ID} from '../config/rendering';
import App from '../components/App';
export function getInitialState() {
return global[INITIAL_STATE_VARNAME] || {};
}
export function renderApp(props) {
render(
<Provider {...props}>
<App {...props} />
</Provider>,
document.getElementById(ROOT_ELEMENT_ID)
);
}
|
docs/app/Examples/modules/Popup/Usage/PopupExampleHover.js | clemensw/stardust | import React from 'react'
import { Button, Popup } from 'semantic-ui-react'
const PopupExampleHover = () => (
<Popup
trigger={<Button icon='add' content='Add a friend' />}
content='Sends an email invite to a friend.'
on='hover'
/>
)
export default PopupExampleHover
|
app/index.js | luisafvaca/bungee-books-web | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import createLogger from 'redux-logger';
import App from './components/App';
import bungeBooksReducer from './reducer/bungee-books-reducer';
const store = createStore(
bungeBooksReducer,
applyMiddleware(
createLogger()
)
);
ReactDOM.render(
<Provider store={store}>
<App saludo="Juan" >
<ul>
<li>Hola mundo</li>
<li>Hola feos</li>
</ul>
</App>
</Provider>, document.querySelector('#app'));
|
src/components/Posts.js | Iktwo/readable | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import * as Styles from "../utils/styles";
import * as API from "../utils/api";
import * as Actions from "../actions/index";
import { connect } from "react-redux";
import * as Constants from "../utils/constants";
import SortOptions from './SortOptions';
class Posts extends Component {
static filterPosts(posts, displayDeleted) {
if (!displayDeleted && posts) {
return posts.filter((post) => (!post.deleted));
} else {
return posts || [];
}
}
render() {
const {posts, displayDeleted, displayCategory, sortMode, sortPosts} = this.props;
return (
<div className="mt-2">
<SortOptions sortContent={(sortBy) => {
sortPosts(sortBy)
}}/>
<div className="list-group mt-2">
{
Posts.filterPosts(posts, displayDeleted || false).sort((p1, p2) => {
switch (sortMode) {
case Constants.SORT_BY_SCORE:
default:
return p1.voteScore < p2.voteScore ? 1 : -1;
case Constants.SORT_BY_NEWEST:
return p1.timestamp < p2.timestamp ? 1 : -1;
}
}).map((post) => (
<div key={post.id} className="list-group-item">
<div className="row valign-wrapper">
<div
className="col-sm-4 col-md-2 d-flex flex-column text-truncate">
<a style={{...Styles.mainText}} className="d-flex align-self-center"
href="#up"
onClick={
() => {
API.votePost(post.id, true).then((post) => {
this.props.votePost(post.id, post.voteScore);
});
return false
}
}
>
<i className="material-icons">keyboard_arrow_up</i>
</a>
<p className="mb-0 text-truncate"
style={{...Styles.mainText, ...Styles.centeredText}}>{post.voteScore}</p>
<a style={{...Styles.mainText}} className="d-flex align-self-center"
href="#down"
onClick={
() => {
API.votePost(post.id, false).then((post) => {
this.props.votePost(post.id, post.voteScore);
});
return false
}
}
>
<i className="material-icons">keyboard_arrow_down</i>
</a>
</div>
<div className="col" style={{...Styles.mainText}}>
<h5>
<a style={{...Styles.mainText}}
className={`row truncate left-align blue-grey-text text-lighten-1`}
href={`/${post.category}/${post.id}`}>
{post.title}
</a>
</h5>
<h6 className="row truncate left-align">
{
displayCategory ?
(<span>By<a href="#!">{` ${post.author} `}</a>at
<a href={`/${post.category}`}
style={{...Styles.capitalize}}>{` ${post.category}`}</a>
</span>) :
(<span>By
<a href="#!">{` ${post.author}`}</a>
</span>)
}
</h6>
<h6 className="row text-muted">{`${new Date(post.timestamp)}`}</h6>
</div>
</div>
</div>
))
}
</div>
</div>
);
}
}
Posts.propTypes = {
posts: PropTypes.array.isRequired,
displayDeleted: PropTypes.bool,
displayCategory: PropTypes.bool
};
function mapStateToProps({posts}) {
return {
sortMode: posts.sortMode
}
}
function mapDispatchToProps(dispatch) {
return {
votePost: (id, votes) => dispatch(Actions.votePost(id, votes)),
sortPosts: (sortMode) => dispatch(Actions.sortPosts(sortMode))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Posts);
|
app/javascript/mastodon/features/notifications/components/setting_toggle.js | dwango/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Toggle from 'react-toggle';
export default class SettingToggle extends React.PureComponent {
static propTypes = {
prefix: PropTypes.string,
settings: ImmutablePropTypes.map.isRequired,
settingPath: PropTypes.array.isRequired,
label: PropTypes.node.isRequired,
onChange: PropTypes.func.isRequired,
}
onChange = ({ target }) => {
this.props.onChange(this.props.settingPath, target.checked);
}
render () {
const { prefix, settings, settingPath, label } = this.props;
const id = ['setting-toggle', prefix, ...settingPath].filter(Boolean).join('-');
return (
<div className='setting-toggle'>
<Toggle id={id} checked={settings.getIn(settingPath)} onChange={this.onChange} onKeyDown={this.onKeyDown} />
<label htmlFor={id} className='setting-toggle__label'>{label}</label>
</div>
);
}
}
|
examples/Tab.js | chris-gooley/react-materialize | import React from 'react';
import Tabs from '../src/Tabs';
import Tab from '../src/Tab';
export default
<Tabs className='tab-demo z-depth-1'>
<Tab title="Test 1">Test 1</Tab>
<Tab title="Test 2" active>Test 2</Tab>
<Tab title="Test 3">Test 3</Tab>
<Tab title="Test 4">Test 4</Tab>
</Tabs>;
|
app/containers/NotFoundPage/index.js | keithalpichi/NobleNote | /**
* NotFoundPage
*
* This is the page we show when the user visits a url that doesn't have a route
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a necessity for you then you can refactor it and remove
* the linting exception.
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
export default class NotFound extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<h1>
<FormattedMessage {...messages.header} />
</h1>
);
}
}
|
actor-apps/app-web/src/app/components/Main.react.js | shaunstanislaus/actor-platform | import React from 'react';
import requireAuth from 'utils/require-auth';
import VisibilityActionCreators from 'actions/VisibilityActionCreators';
import ActivitySection from 'components/ActivitySection.react';
import SidebarSection from 'components/SidebarSection.react';
import ToolbarSection from 'components/ToolbarSection.react';
import DialogSection from 'components/DialogSection.react';
const visibilitychange = 'visibilitychange';
var onVisibilityChange = () => {
if (!document.hidden) {
VisibilityActionCreators.createAppVisible();
} else {
VisibilityActionCreators.createAppHidden();
}
};
class Main extends React.Component {
componentWillMount() {
document.addEventListener(visibilitychange, onVisibilityChange);
if (!document.hidden) {
VisibilityActionCreators.createAppVisible();
}
}
constructor() {
super();
}
render() {
return (
<div className="app row">
<SidebarSection/>
<section className="main col-xs">
<ToolbarSection/>
<DialogSection/>
</section>
<ActivitySection/>
</div>
);
}
}
export default requireAuth(Main);
|
resource/js/components/PageList/ListView.js | kyonmm/crowi | import React from 'react';
import Page from './Page';
export default class ListView extends React.Component {
render() {
const listView = this.props.pages.map((page) => {
return <Page page={page} />;
});
return (
<div className="page-list">
<ul className="page-list-ul">
{listView}
</ul>
</div>
);
}
}
ListView.propTypes = {
pages: React.PropTypes.array.isRequired,
};
ListView.defaultProps = {
pages: [],
};
|
admin/client/App/elemental/ScreenReaderOnly/index.js | ratecity/keystone | import React from 'react';
import { css } from 'glamor';
function ScreenReaderOnly ({ className, ...props }) {
props.className = css(classes.srOnly, className);
return <span {...props} />;
};
const classes = {
srOnly: {
border: 0,
clip: 'rect(0,0,0,0)',
height: 1,
margin: -1,
overflow: 'hidden',
padding: 0,
position: 'absolute',
width: 1,
},
};
module.exports = ScreenReaderOnly;
|
docs/src/app/components/pages/components/LinearProgress/ExampleSimple.js | matthewoates/material-ui | import React from 'react';
import LinearProgress from 'material-ui/LinearProgress';
const LinearProgressExampleSimple = () => (
<LinearProgress mode="indeterminate" />
);
export default LinearProgressExampleSimple;
|
public/src/components/jobs/JobTable.js | sio-iago/essential-plaform-back | // React
import React, { Component } from 'react';
// Data table
import { DataTable } from 'react-data-components';
// API Methods
const api = require('../../api/endpoints');
export class JobTable extends Component {
constructor(props) {
super(props);
this.state = { selected: '' };
}
selectRow = (row) => {
this.props.onClickRow(row);
}
buildRowOptions = (row) => {
return {
onClick: this.selectRow.bind(this, row),
className: this.state.selected === row.id ? 'active' : null
};
}
render() {
return (
<div>
<p>Click on a row to see the job details</p>
<br/>
<DataTable keys="id"
buildRowOptions={this.buildRowOptions}
columns={this.props.columns}
initialData={this.props.initialData}
initialPageLength={10}
initialSortBy={this.props.initialSortBy} />
</div>
);
}
} |
packages/react-vis/src/plot/series/mark-series.js | uber-common/react-vis | // Copyright (c) 2016 - 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import React from 'react';
import PropTypes from 'prop-types';
import Animation from 'animation';
import {ANIMATED_SERIES_PROPS} from 'utils/series-utils';
import {warning} from 'utils/react-utils';
import {getCombinedClassName} from 'utils/styling-utils';
import {DEFAULT_SIZE, DEFAULT_OPACITY} from 'theme';
import AbstractSeries from './abstract-series';
const predefinedClassName = 'rv-xy-plot__series rv-xy-plot__series--mark';
const DEFAULT_STROKE_WIDTH = 1;
class MarkSeries extends AbstractSeries {
_renderCircle(d, i, strokeWidth, style, scalingFunctions) {
const {fill, opacity, size, stroke, x, y} = scalingFunctions;
const attrs = {
r: size ? size(d) : DEFAULT_SIZE,
cx: x(d),
cy: y(d),
style: {
opacity: opacity ? opacity(d) : DEFAULT_OPACITY,
stroke: stroke && stroke(d),
fill: fill && fill(d),
strokeWidth: strokeWidth || DEFAULT_STROKE_WIDTH,
...style
},
key: i,
onClick: e => this._valueClickHandler(d, e),
onContextMenu: e => this._valueRightClickHandler(d, e),
onMouseOver: e => this._valueMouseOverHandler(d, e),
onMouseOut: e => this._valueMouseOutHandler(d, e)
};
return <circle {...attrs} />;
}
render() {
const {
animation,
className,
data,
marginLeft,
marginTop,
strokeWidth,
style
} = this.props;
if (this.props.nullAccessor) {
warning('nullAccessor has been renamed to getNull', true);
}
const getNull = this.props.nullAccessor || this.props.getNull;
if (!data) {
return null;
}
if (animation) {
return (
<Animation {...this.props} animatedProps={ANIMATED_SERIES_PROPS}>
<MarkSeries {...this.props} animation={null} />
</Animation>
);
}
const scalingFunctions = {
fill:
this._getAttributeFunctor('fill') || this._getAttributeFunctor('color'),
opacity: this._getAttributeFunctor('opacity'),
size: this._getAttributeFunctor('size'),
stroke:
this._getAttributeFunctor('stroke') ||
this._getAttributeFunctor('color'),
x: this._getAttributeFunctor('x'),
y: this._getAttributeFunctor('y')
};
return (
<g
className={getCombinedClassName(predefinedClassName, className)}
transform={`translate(${marginLeft},${marginTop})`}
>
{data.map((d, i) => {
return (
getNull(d) &&
this._renderCircle(d, i, strokeWidth, style, scalingFunctions)
);
})}
</g>
);
}
}
MarkSeries.displayName = 'MarkSeries';
MarkSeries.propTypes = {
...AbstractSeries.propTypes,
getNull: PropTypes.func,
strokeWidth: PropTypes.number
};
MarkSeries.defaultProps = {
getNull: () => true
};
export default MarkSeries;
|
src/components/FormButton/index.js | ortonomy/flingapp-frontend | // react
import React, { Component } from 'react';
//styles
import styles from './FormButton.module.css';
class FormButton extends Component {
constructor (props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick (e) {
this.props.submit();
}
render () {
const content = (<span><i className={[this.props.icon, 'fa'].join(' ')}></i> {this.props.text}</span>);
return (
<div onClick={this.handleClick} className={[styles.Button, this.props.disabled ? styles.disabled : ''].join(' ')}>{content}</div>
);
}
}
export default FormButton; |
src/components/confirm/index.js | KleeGroup/focus-components | import PropTypes from 'prop-types';
import React from 'react';
import isString from 'lodash/lang/isString';
import { builtInStore as applicationStore } from 'focus-core/application';
import { component as ConfirmationModal } from './popin';
import connect from '../../behaviours/store/connect';
const propTypes = {
isVisible: PropTypes.bool,
ConfirmContentComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
cancelHandler: PropTypes.func,
confirmHandler: PropTypes.func
};
const defaultProps = {
isVisible: false,
ConfirmContentComponent: null,
cancelHandler: null,
confirmHandler: null
};
const connector = connect(
[{
store: applicationStore,
properties: ['confirmConfig']
}],
() => {
const {
isVisible = false,
Content: ConfirmContentComponent = null,
handleCancel: cancelHandler,
handleConfirm: confirmHandler,
...contentProps
} = applicationStore.getConfirmConfig() || {};
return { isVisible, ConfirmContentComponent, cancelHandler, confirmHandler, contentProps };
}
)
const ConfirmWrapper = (props) => {
const { isVisible, ConfirmContentComponent, cancelHandler, confirmHandler, contentProps } = props;
const ConfirmContent = isString(ConfirmContentComponent)
? () => (<span>{ConfirmContentComponent}</span>)
: ConfirmContentComponent;
return isVisible ? (
<ConfirmationModal
open
cancelHandler={cancelHandler}
confirmHandler={confirmHandler}
{...contentProps}
>
{ConfirmContent ? (<ConfirmContent />) : null}
</ConfirmationModal>
) : null;
}
ConfirmWrapper.propTypes = propTypes;
ConfirmWrapper.defaultProps = defaultProps;
ConfirmWrapper.displayName = 'ConfirmWrapper';
export default connector(ConfirmWrapper); |
_gatsby/src/components/About/About.js | YannickDot/yannickdot.github.io | import React from 'react';
import { rhythm } from '../../utils/typography';
import { Container } from 'react-responsive-grid';
const emojiStyle = {};
const containerStyles = {
maxWidth: rhythm(24),
padding: `${rhythm(0.6)} ${rhythm(3 / 4)}`
};
const EmojiIsland = () => {
return (
<img
style={emojiStyle}
className="emoji"
src="https://twemoji.maxcdn.com/2/72x72/1f3dd.png"
alt="🏝"
/>
);
};
const EmojiFr = () => {
return (
<img
style={emojiStyle}
className="emoji"
src="https://twemoji.maxcdn.com/2/72x72/1f1eb-1f1f7.png"
alt="🇫🇷"
/>
);
};
class About extends React.Component {
render() {
return (
<div className="about">
<div className="personal-intro-content">
<p
className="first"
style={{
marginBottom: '3rem',
textAlign: 'justify'
}}>
<span className="big-sentence">Hello, I'm Yannick</span>
<br />
<span>
I'm a french <EmojiFr /> Front-end engineer from{' '}
<a href="https://www.lonelyplanet.com/martinique" target="_blank">
Martinique
</a>{' '}
<EmojiIsland />
</span>
<span>
<br className="hide-on-mobile" /> with a passion for web & mobile
apps, and functional programming.
</span>
</p>
<p className="first">
I'm currently Lead front-end engineer at{' '}
<a href="https://www.goteacup.com" target="_blank">
Teacup
</a>.
</p>
</div>
</div>
);
}
}
const NeedWork = () => (
<div>
<h2 id="hi-im-kwyn-meagher">Hi! I’m Kwyn Meagher</h2>
<p>
I’m a full-stack engineer with a passion for API design and developer
experience. I’m also a weekend warrior rock climber. 🧗♀️️ I’m looking
for my next thing! Maybe that’ll be with you.
</p>
<h3 id="what">What</h3>
<p>
I’m looking for a senior full-stack role on a product or developer tools
team.
</p>
<h4 id="ideally-you">Ideally you:</h4>
<ul>
<li>Have non-men and non-white folks in leadership roles.</li>
<li>Care about inclusivity as well as diversity in your organization</li>
<li>
Have great work/life balance, rarely work more than 40 hours a week
</li>{' '}
<li>Provide professional development opportunities</li>
<li>Have an HR department</li>
<li>
Don’t require writing code on whiteboards in your interview process
</li>{' '}
<li>Provide generous vacation, parental leave, and 401k matching</li>
<li>Are not an agency or contractor</li>
<li>Work in JavaScript, React, Go, Docker, and/or Kubernetes</li>
</ul>
<h3 id="when">When</h3>
<p>I’m available October 2018</p>
<h3 id="where">Where</h3>
<p>SF 🌁 or Oakland 🏗️. Open to full time remote positions.</p>
<h3 id="about-me">About me</h3>
<p>
I’m a senior full-stack engineer with experience from designing CSS
component systems to building and deploying docker containers. I’ve
previously lead a team on HealthCare.gov and I’ve worked at both large and
small companies on APIs and system integrations. I love writing functional
code but realize when mutability is a necessary tradeoff. I believe
software is inherently integrated with humans and that can’t be
overlooked. I’m most happy when my work makes other people’s–developers
and/or consumers–lives easier.
</p>
<p>
I have experience in Javascript, CSS, React, Redux, Flux, GraphQL, Node,
Docker, and various other technologies
</p>
<p>I’m just starting to ramp up on Go and I love it already.</p>
<p>
If you think I’d be a good fit for your team, please email me at
kwyn.meagher[at]gmail.com.
</p>
<p>
For more details about my past work, you can find my resume{' '}
<a href="http://kwyn.github.io/resume">here</a>
</p>
<h3 id="recommendations">Recommendations</h3>
<blockquote>
<p>
I worked as a cross-functional design collaborator with Kwyn on
HealthCare.gov. She lead technical efforts on the new version of the
eligibility application. We paired on development in the front-end. She
made sure I understood what I was coding by breaking down her
explanations of the complex code base. I also watched her support the
legacy application with ease. She has a great attitude and was a
pleasure to sit next to during the year we worked together
</p>
<p>
– <a href="http://bysusanlin.com">Susan Lin</a>, Product Design Lead
</p>
</blockquote>
<blockquote>
<p>
Kwyn served as the tech lead on our project team working to rebuild the
insurance application on HealthCare.gov, creating a mobile first, human
centered experience. My focus was on defining the project requirements
with our stakeholders and our roadmap internally and Kwyn’s input was
essential to our estimation, planning, and technical approach. She
consistently brought a voice of calm to an incredibly complex
environment, supporting teammates through technical decisions and
facilitating discussions to build consensus on a decision. She’s quick
to identify systemic problems impacting the work of the team and always
offers thoughtful suggestions for shifts in team structure/process.
</p>
<p>
Kwyn balanced completing work independently and efficiently, while
making herself available to pair with engineers, designers, and product
folks to work through implementation questions and defects. She excels
in strategic thinking, always pursuing the root cause of issues and
making recommendations that solve for the long term need successfully
balancing both the big picture and implementation details/constraints.
She has great instincts on managing personalities and teams, supporting
others to make them more successful. It was an absolute pleasure working
with her on this project!
</p>
<p>
– <a href="https://twitter.com/domenicfichera">Dom Fichera</a>, Business
Analyst
</p>
</blockquote>
<br />
<a
href="https://twitter.com/intent/tweet?text=https://blog.kwyn.io/hireme.html"
class="btn btn_twitter"
title="Share on Twitter">
<i class="fa fa-fw fa-twitter" aria-hidden="true" />
<span> Twitter</span>
</a>{' '}
<a
href="https://www.facebook.com/sharer/sharer.php?u=https://blog.kwyn.io/hireme.html"
class="btn btn_facebook"
title="Share on Facebook">
<i class="fa fa-fw fa-facebook" aria-hidden="true" />
<span> Facebook</span>
</a>
<a
href="https://plus.google.com/share?url=https://blog.kwyn.io/hireme.html"
class="btn btn_google-plus"
title="Share on Google Plus">
<i class="fa fa-fw fa-google-plus" aria-hidden="true" />
<span> Google+</span>
</a>{' '}
© 2018{' '}
<a href="https://plus.google.com/+KwynMeagher?rel=author">
{' '}
Kwyn Alice Meagher{' '}
</a>.
</div>
);
const AboutPage = () => (
<div class="about-info">
{' '}
<h1 id="about">About</h1> <p>Tell me what you care about.</p>{' '}
<h3 id="technical">Technical</h3>{' '}
<p>
- Full-stack Software Engineer.<br /> - Machine Learning Engineer.<br /> -
Distributed systems enthusiast.
</p>{' '}
<h3 id="you-can-hire-mehttpsblogkwyniohiremehtml">
<a href="https://blog.kwyn.io/hireme.html">You can hire me!</a>
</h3>{' '}
<p>
Read more
<a href="https://blog.kwyn.io/hireme.html">here</a>
</p>{' '}
<h3 id="personal">Personal</h3>{' '}
<p>
When I’m not tinkering with technology you’ll likely find me on top of a
rock some where, be it via hiking a trail or scaling the face of a cliff.
</p>{' '}
<p>
I have a passion for real food and Bio-hacking as well as the quantified
self movement. I want people to be more connected with their food and more
aware of the effects food has on the body. I believe there’s a lot wrong
with our current agriculture, food, and health care systems and I want to
actively work to change this.
</p>
</div>
);
const AboutPage2 = () => (
<div>
<p>
I'm an American living in Helsinki, Finland and I like PureScript and
Haskell.
</p>
<p>
Please message me on Twitter sometime if you'd like to get coffee or
beers. Please try not to e-mail me.
</p>
<p>
Generally, I am available to answer questions about my libraries and about
PureScript. Feel free to ping me on Twitter or FP slack.
</p>
<p>I am on...</p>
<ul>
<li>
Twitter: @<a href="https://twitter.com/jusrin00">jusrin00</a>
</li>
<li>
Github: <a href="https://github.com/justinwoo">justinwoo</a>
</li>
<li>
Speakerdeck (talks):{' '}
<a href="https://speakerdeck.com/justinwoo/">justinwoo</a>
</li>
<li>
Qiita (blog): <a href="http://qiita.com/kimagure">kimagure</a>
</li>
<li>
FP slack: <a href="https://fpchat-invite.herokuapp.com/">justinw</a>
</li>
</ul>
<p>I speak...</p>
<ul>
<li>English - as a "native" speaker</li>
<li>
Japanese - just okay, I have lived in Japan and have basic conversations
</li>
<li>Korean - only verbally and worse than Japanese</li>
</ul>
<h2 id="spam">Spam</h2>
<p>
I would like for Helsinki to have a Code & Coffee meetup. Please
contact me if you have any interest in providing space and co-hosting.
</p>
<p>A Code and Coffee meetup is...</p>
<ul>
<li>
A 9/10 - 12/1PM meetup meeting every 2/3 weeks on Saturday morning.
</li>
<li>
The organizers will gather people for the first ten minutes to present
themselves and what they will work on that day.
</li>
<li>Any company representatives will advertise their job openings.</li>
<li>
The rest of the session is free form, with mostly smaller groups working
on something.
</li>
</ul>
<p>
I have previously attended the{' '}
<a href="https://www.meetup.com/NoVA-Code-Coffee/">
NoVA Code & Coffee
</a>{' '}
meetup. I hope you'll consider hosting one in Helsinki or your own city.
</p>
<h2 id="small-notes">Small notes</h2>
<p>
I have a{' '}
<a href="https://github.com/justinwoo/my-blog-posts">repository</a> of my
blog posts, which are mostly posted on{' '}
<a href="http://qiita.com/kimagure">Qiita</a> and are almost exclusively
about PureScript and Haskell.
</p>
<h3 id="jul-2018">14 Jul 2018</h3>
<p>
I was invited to speak about PureScript at the Front-End x Design
Conference in Taipei, Taiwan:{' '}
<a href="http://2018.fedc.tw/" class="uri">
http://2018.fedc.tw/
</a>. I spoke about PureScript features that make it unique and some of
the ways people might readdress ways they think about modeling problems.
</p>
<p>
I have recorded a video where I go over my slides from the conference:{' '}
<a href="https://www.youtube.com/watch?v=iaQo_kGY-Lc" class="uri">
https://www.youtube.com/watch?v=iaQo_kGY-Lc
</a>
</p>
<h3 id="apr-2018">4 Apr 2018</h3>
<p>
I was a guest in April 2018 for the podcast CoRecursive with Adam Bell:{' '}
<a
href="https://corecursive.com/010-purescript-and-avocados-with-justin-woo"
class="uri">
https://corecursive.com/010-purescript-and-avocados-with-justin-woo
</a>.
</p>
<p>
In the episode, I talk about things that are good about PureScript, some
of the things I believe about writing programs, about avocadoes and
kabocha, and about the importance of culture in programming language
communities.
</p>
<h3 id="sep-2017">1 Sep 2017</h3>
<p>
I was a speaker at Small FP Conf:{' '}
<a href="http://clojutre.org/2017/#purescript" class="uri">
http://clojutre.org/2017/#purescript
</a>.
</p>
<p>
I talked about the RowList type-level structure using RowToList in
PureScript and its various applications. The video and slides are
available in the link, or via YouTube and Speakerdeck respectively.
</p>
<h3 id="mar-2017">28 Mar 2017</h3>
<p>
I was a guest in March 2017 for the podcast Functional Geekery:{' '}
<a
href="https://www.functionalgeekery.com/episode-88-justin-woo/"
class="uri">
https://www.functionalgeekery.com/episode-88-justin-woo/
</a>.
</p>
<p>
In the episode, I awkwardly talk about my background and how I got into
PureScript and evangelizing it.
</p>
<p>
In short, I went from writing Java to writing a small amount of
Clojure/Clojurescript, lots of Javascript, some Elm, and then started
using PureScript afterwards. I started using Haskell after I was already
using PureScript, strangely enough. I also talk about some of the things I
don't like about Elm, and why I switched over to using PureScript for my
compile-to-JS needs for both Node.js and browser code.
</p>
<h3 id="oct-2016">6 Oct 2016</h3>
<p>
In October 2016, I prepared a blog post for the Futurice blog here:{' '}
<a
href="http://futurice.com/blog/making-a-weather-telegram-bot-in-purescript"
class="uri">
http://futurice.com/blog/making-a-weather-telegram-bot-in-purescript
</a>
</p>
<p>
The contents are fairly out of date (even as of 7 May 2017), but hopefully
still somewhat interesting to read.
</p>
</div>
);
export default About;
|
examples/App.js | bluespore/react-big-calendar | import React from 'react';
import Api from './Api';
import Intro from './Intro.md';
import cn from 'classnames';
import { render } from 'react-dom';
import localizer from 'react-big-calendar/localizers/globalize';
import globalize from 'globalize';
localizer(globalize);
import 'react-big-calendar/less/styles.less';
import './styles.less';
import './prism.less';
let demoRoot = 'https://github.com/intljusticemission/react-big-calendar/tree/master/examples/demos'
const Example = React.createClass({
getInitialState(){
return {
selected: 'basic'
};
},
render() {
let selected = this.state.selected;
let Current = {
basic: require('./demos/basic'),
selectable: require('./demos/selectable'),
cultures: require('./demos/cultures'),
popup: require('./demos/popup'),
rendering: require('./demos/rendering'),
customView: require('./demos/customView'),
}[selected];
return (
<div className='app'>
<div className="jumbotron">
<div className="container">
<h1>Big Calendar <i className='fa fa-calendar'/></h1>
<p>such enterprise, very business.</p>
<p>
<a href="#intro">
<i className='fa fa-play'/> Getting started
</a>
{' | '}
<a href="#api">
<i className='fa fa-book'/> API documentation
</a>
{' | '}
<a target='_blank' href="https://github.com/intljusticemission/react-big-calendar">
<i className='fa fa-github'/> github
</a>
</p>
</div>
</div>
<div className='examples contain'>
<aside>
<ul className='nav nav-pills'>
<li className={cn({active: selected === 'basic' })}>
<a href='#' onClick={this.select.bind(null, 'basic')}>Basic</a>
</li>
<li className={cn({active: selected === 'selectable' })}>
<a href='#' onClick={this.select.bind(null, 'selectable')}>Selectable</a>
</li>
<li className={cn({active: selected === 'cultures' })}>
<a href='#' onClick={this.select.bind(null, 'cultures')}>I18n and Locales</a>
</li>
<li className={cn({active: selected === 'popup' })}>
<a href='#' onClick={this.select.bind(null, 'popup')}>Popup</a>
</li>
<li className={cn({active: selected === 'rendering' })}>
<a href='#' onClick={this.select.bind(null, 'rendering')}>Custom rendering</a>
</li>
{/* temporary hide link to documentation
<li className={cn({active: selected === 'customView' })}>
<a href='#' onClick={this.select.bind(null, 'customView')}>Custom View</a>
</li>
*/}
</ul>
</aside>
<div className='example'>
<div className='view-source'>
<a target='_blank' href={demoRoot + '/' + selected + '.js' }>
<strong><i className='fa fa-code'/>{' View example source code'}</strong>
</a>
</div>
<Current className='demo' />
</div>
</div>
<div className='docs'>
<Intro className='contain section'/>
<Api className='contain section' />
</div>
</div>
);
},
select(selected, e){
e.preventDefault();
this.setState({ selected })
}
});
render(<Example/>, document.getElementById('root'));
|
ui/src/containers/Visualisations/components/TrendLinesSwitch.js | LearningLocker/learninglocker | import React from 'react';
import PropTypes from 'prop-types';
import Switch from 'ui/components/Material/Switch';
/**
* @param {boolean} props.showTrendLines
* @param {(trendLines: boolean) => void} props.onChange
*/
const TrendLinesSwitch = ({
showTrendLines,
onChange,
}) => (
<div className="form-group">
<Switch
label="Trend Lines"
checked={showTrendLines}
onChange={onChange} />
</div>
);
TrendLinesSwitch.propTypes = {
showTrendLines: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
};
export default React.memo(TrendLinesSwitch);
|
src/index.js | agconti/tv | import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import './index.css'
ReactDOM.render(
<App />,
document.getElementById('root')
)
|
01-react-just-render/src/App.js | dtanzer/react-basic-examples | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
export default App;
|
vertigo-orchestra-demo/ui/app/initializer/after.js | KleeGroup/orchestra | ////////////////////////////////////////////////////////
/// SCRIPT EXECUTED AFTER DOM CONTENT LOADED
////////////////////////////////////////////////////////
import React from 'react';
import globalLinkInitializer from './scripts/global-link-initializer';
import storesInitializer from './scripts/stores-initializer';
import userInitializer from './scripts/user-initializer';
import layoutInitializer from './scripts/layout-initializer';
import headerInitializer from './scripts/header-initializer'
/**
* Launches initializers that has to be loaded after DOM content is loaded.
*/
export const initialize = () => {
console.info('[INITIALIZER - AFTER CONTENT LOADED]');
globalLinkInitializer();
storesInitializer();
userInitializer();
layoutInitializer();
headerInitializer();
};
|
new-lamassu-admin/src/pages/Triggers/CustomInfoRequests/Forms/ChooseType.js | lamassu/lamassu-server | import { Field } from 'formik'
import React from 'react'
import * as Yup from 'yup'
import ToggleButtonGroup from 'src/components/inputs/formik/ToggleButtonGroup'
import { H4 } from 'src/components/typography'
import { ReactComponent as Keyboard } from 'src/styling/icons/compliance/keyboard.svg'
import { ReactComponent as Keypad } from 'src/styling/icons/compliance/keypad.svg'
import { ReactComponent as List } from 'src/styling/icons/compliance/list.svg'
import { zircon } from 'src/styling/variables'
const MakeIcon = IconSvg => (
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: zircon,
borderRadius: 4,
maxWidth: 104,
maxHeight: 64,
minWidth: 104,
minHeight: 64
}}>
<IconSvg style={{ maxWidth: 80 }} />
</div>
)
const ChooseType = () => {
const options = [
{
value: 'numerical',
title: 'Numerical entry',
description:
'User will enter information with a keypad. Good for dates, ID numbers, etc.',
icon: () => MakeIcon(Keypad)
},
{
value: 'text',
title: 'Text entry',
description:
'User will entry information with a keyboard. Good for names, email, address, etc.',
icon: () => MakeIcon(Keyboard)
},
{
value: 'choiceList',
title: 'Choice list',
description: 'Gives user multiple options to choose from.',
icon: () => MakeIcon(List)
}
]
return (
<>
<H4>Choose the type of data entry</H4>
<Field
name="inputType"
component={ToggleButtonGroup}
orientation="vertical"
exclusive
options={options}
/>
</>
)
}
const validationSchema = Yup.object().shape({
inputType: Yup.string().required()
})
const defaultValues = {
inputType: ''
}
export default ChooseType
export { validationSchema, defaultValues }
|
src/Col.js | kwnccc/react-bootstrap | import React from 'react';
import classNames from 'classnames';
import styleMaps from './styleMaps';
import CustomPropTypes from './utils/CustomPropTypes';
const Col = React.createClass({
propTypes: {
/**
* The number of columns you wish to span
*
* for Extra small devices Phones (<768px)
*
* class-prefix `col-xs-`
*/
xs: React.PropTypes.number,
/**
* The number of columns you wish to span
*
* for Small devices Tablets (≥768px)
*
* class-prefix `col-sm-`
*/
sm: React.PropTypes.number,
/**
* The number of columns you wish to span
*
* for Medium devices Desktops (≥992px)
*
* class-prefix `col-md-`
*/
md: React.PropTypes.number,
/**
* The number of columns you wish to span
*
* for Large devices Desktops (≥1200px)
*
* class-prefix `col-lg-`
*/
lg: React.PropTypes.number,
/**
* Move columns to the right
*
* for Extra small devices Phones
*
* class-prefix `col-xs-offset-`
*/
xsOffset: React.PropTypes.number,
/**
* Move columns to the right
*
* for Small devices Tablets
*
* class-prefix `col-sm-offset-`
*/
smOffset: React.PropTypes.number,
/**
* Move columns to the right
*
* for Medium devices Desktops
*
* class-prefix `col-md-offset-`
*/
mdOffset: React.PropTypes.number,
/**
* Move columns to the right
*
* for Large devices Desktops
*
* class-prefix `col-lg-offset-`
*/
lgOffset: React.PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Extra small devices Phones
*
* class-prefix `col-xs-push-`
*/
xsPush: React.PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Small devices Tablets
*
* class-prefix `col-sm-push-`
*/
smPush: React.PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Medium devices Desktops
*
* class-prefix `col-md-push-`
*/
mdPush: React.PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Large devices Desktops
*
* class-prefix `col-lg-push-`
*/
lgPush: React.PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Extra small devices Phones
*
* class-prefix `col-xs-pull-`
*/
xsPull: React.PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Small devices Tablets
*
* class-prefix `col-sm-pull-`
*/
smPull: React.PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Medium devices Desktops
*
* class-prefix `col-md-pull-`
*/
mdPull: React.PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Large devices Desktops
*
* class-prefix `col-lg-pull-`
*/
lgPull: React.PropTypes.number,
/**
* You can use a custom element for this component
*/
componentClass: CustomPropTypes.elementType
},
getDefaultProps() {
return {
componentClass: 'div'
};
},
render() {
let ComponentClass = this.props.componentClass;
let classes = {};
Object.keys(styleMaps.SIZES).forEach(function (key) {
let size = styleMaps.SIZES[key];
let prop = size;
let classPart = size + '-';
if (this.props[prop]) {
classes['col-' + classPart + this.props[prop]] = true;
}
prop = size + 'Offset';
classPart = size + '-offset-';
if (this.props[prop] >= 0) {
classes['col-' + classPart + this.props[prop]] = true;
}
prop = size + 'Push';
classPart = size + '-push-';
if (this.props[prop] >= 0) {
classes['col-' + classPart + this.props[prop]] = true;
}
prop = size + 'Pull';
classPart = size + '-pull-';
if (this.props[prop] >= 0) {
classes['col-' + classPart + this.props[prop]] = true;
}
}, this);
return (
<ComponentClass {...this.props} className={classNames(this.props.className, classes)}>
{this.props.children}
</ComponentClass>
);
}
});
export default Col;
|
src/svg-icons/content/link.js | ruifortes/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ContentLink = (props) => (
<SvgIcon {...props}>
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
</SvgIcon>
);
ContentLink = pure(ContentLink);
ContentLink.displayName = 'ContentLink';
ContentLink.muiName = 'SvgIcon';
export default ContentLink;
|
client/ui/outlines/instaclone.story.js | LestaD/InstaClone | import React from 'react'
import { storiesOf } from '@storybook/react'
import Instaclone from './instaclone.svg'
storiesOf('ui/outlines', module)
.addWithJSX('instaclone', () => (
<Instaclone />
))
|
node_modules/react-select/examples/src/components/Virtualized.js | pris54/reactjs-simple-form | import React from 'react';
import VirtualizedSelect from 'react-virtualized-select';
const DATA = require('../data/cities');
var CitiesField = React.createClass({
displayName: 'CitiesField',
getInitialState () {
return {};
},
updateValue (newValue) {
this.setState({
selectValue: newValue
});
},
render () {
var options = DATA.CITIES;
return (
<div className="section">
<h3 className="section-heading">Cities (Large Dataset)</h3>
<VirtualizedSelect ref="citySelect"
options={options}
simpleValue
clearable
name="select-city"
value={this.state.selectValue}
onChange={this.updateValue}
searchable
labelKey="name"
valueKey="name"
/>
<div className="hint">
Uses <a href="https://github.com/bvaughn/react-virtualized">react-virtualized</a> and <a href="https://github.com/bvaughn/react-virtualized-select/">react-virtualized-select</a> to display a list of the world's 1,000 largest cities.
</div>
</div>
);
}
});
module.exports = CitiesField;
|
app/containers/NotFoundPage/index.js | KraigWalker/frontendfriday | /**
* NotFoundPage
*
* This is the page we show when the user visits a url that doesn't have a route
*/
import React from 'react';
import messages from './messages';
import { FormattedMessage } from 'react-intl';
import H1 from 'components/H1';
export default function NotFound() {
return (
<article>
<H1>
<FormattedMessage {...messages.header} />
</H1>
</article>
);
}
|
src/svg-icons/image/iso.js | frnk94/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageIso = (props) => (
<SvgIcon {...props}>
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5.5 7.5h2v-2H9v2h2V9H9v2H7.5V9h-2V7.5zM19 19H5L19 5v14zm-2-2v-1.5h-5V17h5z"/>
</SvgIcon>
);
ImageIso = pure(ImageIso);
ImageIso.displayName = 'ImageIso';
ImageIso.muiName = 'SvgIcon';
export default ImageIso;
|
src/svg-icons/action/invert-colors.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionInvertColors = (props) => (
<SvgIcon {...props}>
<path d="M17.66 7.93L12 2.27 6.34 7.93c-3.12 3.12-3.12 8.19 0 11.31C7.9 20.8 9.95 21.58 12 21.58c2.05 0 4.1-.78 5.66-2.34 3.12-3.12 3.12-8.19 0-11.31zM12 19.59c-1.6 0-3.11-.62-4.24-1.76C6.62 16.69 6 15.19 6 13.59s.62-3.11 1.76-4.24L12 5.1v14.49z"/>
</SvgIcon>
);
ActionInvertColors = pure(ActionInvertColors);
ActionInvertColors.displayName = 'ActionInvertColors';
ActionInvertColors.muiName = 'SvgIcon';
export default ActionInvertColors;
|
packages/material-ui/src/Table/TablePaginationActions.js | cherniavskii/material-ui | import React from 'react';
import PropTypes from 'prop-types';
import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
import withTheme from '../styles/withTheme';
import IconButton from '../IconButton';
/**
* @ignore - internal component.
*/
class TablePaginationActions extends React.Component {
handleBackButtonClick = event => {
this.props.onChangePage(event, this.props.page - 1);
};
handleNextButtonClick = event => {
this.props.onChangePage(event, this.props.page + 1);
};
render() {
const {
backIconButtonProps,
count,
nextIconButtonProps,
onChangePage,
page,
rowsPerPage,
theme,
...other
} = this.props;
return (
<div {...other}>
<IconButton
onClick={this.handleBackButtonClick}
disabled={page === 0}
{...backIconButtonProps}
>
{theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
</IconButton>
<IconButton
onClick={this.handleNextButtonClick}
disabled={page >= Math.ceil(count / rowsPerPage) - 1}
{...nextIconButtonProps}
>
{theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
</IconButton>
</div>
);
}
}
TablePaginationActions.propTypes = {
/**
* Properties applied to the back arrow `IconButton` element.
*/
backIconButtonProps: PropTypes.object,
/**
* The total number of rows.
*/
count: PropTypes.number.isRequired,
/**
* Properties applied to the next arrow `IconButton` element.
*/
nextIconButtonProps: PropTypes.object,
/**
* Callback fired when the page is changed.
*
* @param {object} event The event source of the callback
* @param {number} page The page selected
*/
onChangePage: PropTypes.func.isRequired,
/**
* The zero-based index of the current page.
*/
page: PropTypes.number.isRequired,
/**
* The number of rows per page.
*/
rowsPerPage: PropTypes.number.isRequired,
/**
* @ignore
*/
theme: PropTypes.object.isRequired,
};
export default withTheme()(TablePaginationActions);
|
client/src/components/Tile.js | ccwukong/lfcommerce-react | import React from 'react';
import PropTypes from 'prop-types';
import {
Card,
CardTitle,
} from 'reactstrap';
const Tile = props => {
const { tileStyle, titleStyle, textStyle, title, description } = props;
return (
<Card body style={tileStyle || {}}>
<CardTitle style={titleStyle || {}}>
{title}
</CardTitle>
<div style={textStyle || {}}>{description || ''}</div>
</Card>
);
};
Tile.propTypes = {
title: PropTypes.string.isRequired,
tileStyle: PropTypes.object,
titleStyle: PropTypes.object,
textStyle: PropTypes.object,
description: PropTypes.object,
};
export default Tile;
|
springboot/GReact/src/main/resources/static/app/routes/widgets/components/TabbedWidgetDemo.js | ezsimple/java | import React from 'react'
import {Tabs, Tab} from 'react-bootstrap'
import JarvisWidget from '../../../components/widgets/JarvisWidget'
export default class TabbedWidgetDemo extends React.Component {
constructor(props) {
super(props);
this.state = {
demoShowTabs: false
}
}
render() {
var bsStyle = !!this.state.demoShowTabs ? 'tabs' : 'pills';
return (
<JarvisWidget colorbutton={false}
editbutton={false} togglebutton={false}
deletebutton={false} fullscreenbutton={false}
custombutton={false}>
<header>
<h2><strong>Tabs / Pills</strong> <i>Widget</i></h2>
</header>
{/* widget div*/}
<div>
{/* widget content */}
<div className="widget-body no-padding">
<Tabs bsStyle={bsStyle} className="padding-10" activeKey={this.state.key} id="TabbedWidgetDemoTabs"
onSelect={this.handleSelect}>
<Tab eventKey={1} title="Tab 1">
<h4 className="alert alert-danger"> Insert tabs / pills to widget
header </h4>
I have six locks on my door all in a row. When I go out, I lock every
other one. I figure no matter how long somebody stands there picking the
locks, they are always locking three.
</Tab>
<Tab eventKey={2} title="Tab 2">
<h4 className="alert alert-warning"> Checkout the <a
href="general-elements.html">General Elements</a> page for more tab
options </h4>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla
single-origin coffee squid. Exercitation +1 labore velit, blog sartorial
PBR leggings next level wes anderson artisan four loko farm-to-table
craft beer twee.
</Tab>
</Tabs>
{/* widget body text*/}
{/* end widget body text*/}
{/* widget footer */}
<div className="widget-footer text-right">
<span className="onoffswitch-title">
<i className="fa fa-check"/> Show Tabs
</span>
<span className="onoffswitch">
<input type="checkbox" name="onoffswitch"
className="onoffswitch-checkbox" id="show-tabs"/>
<label className="onoffswitch-label" htmlFor="show-tabs">
<span className="onoffswitch-inner" data-swchon-text="True"
data-swchoff-text="NO"/>
<span className="onoffswitch-switch"/>
</label>
</span>
</div>
{/* end widget footer */}
</div>
{/* end widget content */}
</div>
{/* end widget div */}
</JarvisWidget>
)
}
}
|
src/entry/index.js | hutxs/iconfig-antd | import '../common/lib';
import App from '../containers/App';
import ReactDOM from 'react-dom';
import React from 'react';
ReactDOM.render(<App />, document.getElementById('root'));
|
packages/core/admin/admin/src/content-manager/components/InputJSON/FieldError.js | wistityhq/strapi | import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Typography } from '@strapi/design-system/Typography';
export const FieldError = ({ id, error, name }) => {
const { formatMessage } = useIntl();
const errorMessage = error ? formatMessage({ id: error, defaultMessage: error }) : '';
if (!error) {
return null;
}
return (
<Typography
as="p"
variant="pi"
id={`${id || name}-error`}
textColor="danger600"
data-strapi-field-error
>
{errorMessage}
</Typography>
);
};
FieldError.defaultProps = {
id: undefined,
error: undefined,
};
FieldError.propTypes = {
error: PropTypes.string,
id: PropTypes.string,
name: PropTypes.string.isRequired,
};
export default FieldError;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.