path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
src/components/App.js | joshsalom/quarrelofcuties | import React from 'react';
import Header from './Header';
import Main from './Main';
class App extends React.Component {
render() {
return (
<div>
<Header />
<div className="container">
<Main />
</div>
</div>
);
}
}
export default App; |
src/experiences.js | VoxelDavid/voxeldavid-website | // Contains data for past work experience
import React from 'react';
import { Link } from 'react-router-dom';
import Company from './Company';
import urls from './urls';
const novaly = new Company('Novaly Studios', urls.novaly);
const roblox = new Company('Roblox Corporation', urls.roblox);
// const bitsquid = new Company('Bitsquid Games', urls.bitsquid);
const experiences = [
{
job: 'Software Engineering Intern',
company: roblox,
description: 'Working remotely amindst the COVID-19 pandemic for 10 weeks to improve the Roblox platform.',
wasInHouse: true,
startDate: new Date(2020, 5),
endDate: new Date(2020, 7),
},
// {
// job: 'Frontend Programmer',
// company: bitsquid,
// description: 'All-purpose programmer primarily writing React style code for frontend UI.',
// wasInHouse: false,
// startDate: new Date(2020, 0),
// },
{
job: 'Level Designer',
company: novaly,
description: 'Currently crafting an immersive city and world for a new hit social racing game.',
wasInHouse: false,
startDate: new Date(2017, 5),
endDate: new Date(2020, 1),
},
{
job: 'Software Engineering Intern',
company: roblox,
description: '10 weeks of working in house at Roblox HQ on the application layer of the platform. Removed bloat, helped set best practices, and worked with full-time employees to make their existing workflows better.',
wasInHouse: true,
startDate: new Date(2019, 5),
endDate: new Date(2019, 7),
},
{
job: 'Programmer',
company: novaly,
description: <span>Squashed bugs and created the Robbery feature for <a href='https://www.roblox.com/games/2563455047/Bandit-Simulator'>Bandit Simulator</a>, introducing a brand new way to play the game.</span>,
wasInHouse: false,
startDate: new Date(2018, 10),
endDate: new Date(2019, 0),
},
{
job: 'Level Design contractor',
company: roblox,
description: <span>Worked for Roblox to create <Link to='/projects/aquaman'>Aquaman: City of Rolantis</Link> for a Warner Bros. sponsorship.</span>,
wasInHouse: false,
startDate: new Date(2018, 6),
endDate: new Date(2018, 10),
},
{
job: 'Accelerator Intern',
company: roblox,
description: '3 month sprint to create a game working in house at Roblox HQ.',
wasInHouse: true,
startDate: new Date(2018, 5),
endDate: new Date(2018, 7),
},
];
export default experiences;
|
src/components/productivity/boards/Show.js | dhruv-kumar-jha/productivity-frontend | 'use strict';
import React from 'react';
import translate from 'app/global/helper/translate';
import { browserHistory } from 'react-router';
import { Col, Spin } from 'antd';
const Board = (props) => {
const { data } = props;
const handleClick = () => {
browserHistory.push(`/boards/${ data.id }`);
}
// const styles = {};
// if ( data.meta.background ) { styles.backgroundColor = data.meta.background };
return (
<Col xs={24} sm={12} md={8} lg={6} className="board-container">
{ data.id === 'loading' || data.status === 10 ?
(
<Spin spinning={ true } tip={ data.id === 'loading' ? translate('messages.board.processing.adding') : translate('messages.board.processing.deleting') } size="large">
<div className="board">
<div className="title">{ data.title }</div>
{ data.description &&
<div className="description">{ data.description }</div>
}
</div>
</Spin>
) : (
<div className="board" onClick={ handleClick }>
<div className="title">{ data.title }</div>
{ data.description &&
<div className="description">{ data.description }</div>
}
</div>
)
}
</Col>
)
}
export default Board; |
src/components/PaymentReadonlyForm/index.js | bruceli1986/contract-react | import React from 'react'
import { Collapse } from 'react-bootstrap'
import { Link } from 'react-router'
import FileListItem from 'components/FileListItem'
import './style.scss'
/** 新版审批合同表单*/
class PaymentReadOnlyForm extends React.Component {
static propTypes = {
invoice: React.PropTypes.shape({
poNo: React.PropTypes.string,
invoiceNo: React.PropTypes.string,
bankAccountAddress: React.PropTypes.string
}),
system: React.PropTypes.shape({
id: React.PropTypes.string,
code: React.PropTypes.string
}),
opinions: React.PropTypes.arrayOf(
React.PropTypes.shape({
activityName: React.PropTypes.string,
taskOpinionItemList: React.PropTypes.arrayOf(
React.PropTypes.shape({
opinion: React.PropTypes.string,
processtime: React.PropTypes.string,
name: React.PropTypes.string
})
)
})
),
file: React.PropTypes.arrayOf(React.PropTypes.shape({
fileProgCode: React.PropTypes.string,
fileKey: React.PropTypes.string,
fileShowSize: React.PropTypes.string,
fileShowName: React.PropTypes.string,
uploadDate: React.PropTypes.num,
commonName: React.PropTypes.string,
remarkText: React.PropTypes.string
})),
onClickFileTitle: React.PropTypes.func
}
constructor (...args) {
super(...args)
this.state = {
open: false
}
}
toggleDetails () {
$(this.refs.table).find('tr.collapse').toggleClass('collapsing collapse')
setTimeout(function () {
$(this.refs.table).find('tr.collapsing').toggleClass('collapsing in collapse')
}.bind(this), 350)
}
openDetails = () => {
this.setState({ open: !this.state.open })
}
render () {
var component = this
return (
<div className='payment-readonly-form'>
<h3 style={{textAlign: 'center'}}>中国长江三峡集团公司合同支付申请单</h3>
<table ref='table' className='table table-bordered'>
<thead>
<tr>
<th colSpan='10'>工程名称:{this.props.invoice.projectDesc}</th>
</tr>
</thead>
<tbody>
<tr>
<td>合同代码</td>
<td><Link to={'/contract/details?poNo=' + this.props.invoice.poNo + '&id=' + this.props.system.id +
'&code=' + this.props.system.code} >{this.props.invoice.poNo}</Link></td>
<td>支付单号</td>
<td>{this.props.invoice.invoiceNo}</td>
<td>接收日期</td>
<td>{this.props.invoice.invoiceDate}</td>
<td>币种</td>
<td>{this.props.invoice.bz}</td>
<td>单位</td>
<td>{this.props.invoice.dw}</td>
</tr>
<tr>
<td>合同原编号</td>
<td colSpan='3'>{this.props.invoice.oriPoNo}</td>
<td>合同名称</td>
<td colSpan='5'>{this.props.invoice.poName}</td>
</tr>
<tr>
<td>合同原始总金额</td>
<td colSpan='2'>{this.props.invoice.oriTotalAmt}</td>
<td>合同当前总金额</td>
<td>{this.props.invoice.totalAmt}</td>
<td>本次申请拨款金额</td>
<td>{this.props.invoice.bcsqbkje}</td>
<td>累计发生金额</td>
<td colSpan='2'>{this.props.invoice.ljfsje}</td>
</tr>
<tr>
<td>本次申请支付内容</td>
<td colSpan='4'>{this.props.invoice.bcsqzfnr}</td>
<td>本次申请支付依据</td>
<td colSpan='4'>{this.props.invoice.bcsqzfyj}</td>
</tr>
<tr>
<td>收款单位名称</td>
<td colSpan='4'>{this.props.invoice.bankAccountName}</td>
<td>收款单位地址和邮编</td>
<td colSpan='4'>{this.props.invoice.bankAccountAddress}</td>
</tr>
<tr>
<td>收款单位开户行</td>
<td colSpan='4'>{this.props.invoice.bankName}</td>
<td>收款单位账号</td>
<td colSpan='4'>{this.props.invoice.bankAccountNo}</td>
</tr>
<tr>
<td>备注</td>
<td colSpan='9'>{this.props.invoice.remark}</td>
</tr>
<tr>
<td>附件</td>
<td colSpan='9'>
<ul>
{
this.props.file.map(function (x, i) {
return (
<li key={i}>
<FileListItem file={x} style={{color: 'black', textDecoration: 'underline'}}
onItemClick={component.props.onClickFileTitle} />
<a style={{paddingLeft: '5px'}} className='glyphicon glyphicon-download-alt' />
</li>
)
})
}
</ul>
</td>
</tr>
<tr>
<td colSpan='10'>
<a onClick={this.openDetails}>
展开扣款明细
<span className='caret' />
</a>
<Collapse in={this.state.open}>
<div>
<table className='table table-bordered'>
<tbody>
<tr>
<td colSpan='6' style={{textAlign: 'center'}}>本次结算扣款情况</td>
<td colSpan='2' rowSpan='2' style={{textAlign: 'center'}}>本次结算实际支付</td>
<td colSpan='2' rowSpan='2' style={{textAlign: 'center'}}>本次结算后预付款</td>
</tr>
<tr>
<td>扣款合计</td>
<td>预付工程款</td>
<td>保留金</td>
<td>材料款</td>
<td>代扣税金</td>
<td>其他扣款</td>
</tr>
<tr>
<td>{this.props.invoice.kkhj}</td>
<td>{this.props.invoice.yfgck}</td>
<td>{this.props.invoice.blj}</td>
<td>{this.props.invoice.clk}</td>
<td>{this.props.invoice.dksj}</td>
<td>{this.props.invoice.qtkk}</td>
<td colSpan='2'>{this.props.invoice.bcjssjzf}</td>
<td colSpan='2'>{this.props.invoice.bcjshyfk}</td>
</tr>
</tbody>
</table>
</div>
</Collapse>
</td>
</tr>
{
this.props.opinions.map((op, index) =>
(<tr key={index}>
<td colSpan={2}>{op.activityName}</td>
<td colSpan={8}>
<ul className='opinion-ul'>
{
op.taskOpinionItemList.map((item, i) =>
(<li key={i}>
<div>{item.opinion ? (<span>{item.opinion}</span>) : (<span>——</span>)}</div>
<small>{item.processtime} by {item.name}</small>
</li>))
}
</ul>
</td>
</tr>))
}
</tbody>
</table>
</div>
)
}
}
export default PaymentReadOnlyForm
|
lib/components/term.js | martinvd/hyper | /* global Blob,URL,requestAnimationFrame */
import React from 'react';
import Color from 'color';
import uuid from 'uuid';
import hterm from '../hterm';
import Component from '../component';
import getColorList from '../utils/colors';
import terms from '../terms';
import notify from '../utils/notify';
export default class Term extends Component {
constructor(props) {
super(props);
this.handleWheel = this.handleWheel.bind(this);
this.handleMouseDown = this.handleMouseDown.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this);
this.handleScrollEnter = this.handleScrollEnter.bind(this);
this.handleScrollLeave = this.handleScrollLeave.bind(this);
this.onHyperCaret = this.onHyperCaret.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
this.handleFocus = this.handleFocus.bind(this);
props.ref_(this);
}
componentDidMount() {
const {props} = this;
this.term = props.term || new hterm.Terminal(uuid.v4());
this.term.onHyperCaret(this.hyperCaret);
// the first term that's created has unknown size
// subsequent new tabs have size
if (props.cols && props.rows) {
this.term.realizeSize_(props.cols, props.rows);
}
const prefs = this.term.getPrefs();
prefs.set('font-family', props.fontFamily);
prefs.set('font-size', props.fontSize);
prefs.set('font-smoothing', props.fontSmoothing);
prefs.set('cursor-color', this.validateColor(props.cursorColor, 'rgba(255,255,255,0.5)'));
prefs.set('cursor-blink', props.cursorBlink);
prefs.set('enable-clipboard-notice', false);
prefs.set('foreground-color', props.foregroundColor);
// hterm.ScrollPort.prototype.setBackgroundColor is overriden
// to make hterm's background transparent. we still need to set
// background-color for proper text rendering
prefs.set('background-color', props.backgroundColor);
prefs.set('color-palette-overrides', getColorList(props.colors));
prefs.set('user-css', this.getStylesheet(props.customCSS));
prefs.set('scrollbar-visible', false);
prefs.set('receive-encoding', 'raw');
prefs.set('send-encoding', 'raw');
prefs.set('alt-sends-what', 'browser-key');
if (props.bell === 'SOUND') {
prefs.set('audible-bell-sound', this.props.bellSoundURL);
} else {
prefs.set('audible-bell-sound', '');
}
if (props.copyOnSelect) {
prefs.set('copy-on-select', true);
} else {
prefs.set('copy-on-select', false);
}
this.term.onTerminalReady = () => {
const io = this.term.io.push();
io.onVTKeystroke = io.sendString = props.onData;
io.onTerminalResize = (cols, rows) => {
if (cols !== this.props.cols || rows !== this.props.rows) {
props.onResize(cols, rows);
}
};
this.term.modifierKeys = props.modifierKeys;
// this.term.CursorNode_ is available at this point.
this.term.setCursorShape(props.cursorShape);
// required to be set for CursorBlink to work
this.term.setCursorVisible(true);
// emit onTitle event when hterm instance
// wants to set the title of its tab
this.term.setWindowTitle = props.onTitle;
this.term.focusHyperCaret();
};
this.term.decorate(this.termRef);
this.term.installKeyboard();
if (this.props.onTerminal) {
this.props.onTerminal(this.term);
}
const iframeWindow = this.getTermDocument().defaultView;
iframeWindow.addEventListener('wheel', this.handleWheel);
this.getScreenNode().addEventListener('mouseup', this.handleMouseUp);
this.getScreenNode().addEventListener('mousedown', this.handleMouseDown);
terms[this.props.uid] = this;
}
handleWheel(e) {
if (this.props.onWheel) {
this.props.onWheel(e);
}
const prefs = this.term.getPrefs();
prefs.set('scrollbar-visible', true);
clearTimeout(this.scrollbarsHideTimer);
if (!this.scrollMouseEnter) {
this.scrollbarsHideTimer = setTimeout(() => {
prefs.set('scrollbar-visible', false);
}, 1000);
}
}
handleScrollEnter() {
clearTimeout(this.scrollbarsHideTimer);
const prefs = this.term.getPrefs();
prefs.set('scrollbar-visible', true);
this.scrollMouseEnter = true;
}
handleScrollLeave() {
const prefs = this.term.getPrefs();
prefs.set('scrollbar-visible', false);
this.scrollMouseEnter = false;
}
handleMouseUp() {
this.props.onActive();
// this makes sure that we focus the hyper caret only
// if a click on the term does not result in a selection
// otherwise, if we focus without such check, it'd be
// impossible to select a piece of text
if (this.term.document_.getSelection().type !== 'Range') {
this.term.focusHyperCaret();
}
}
handleFocus() {
// This will in turn result in `this.focus()` being
// called, which is unecessary.
// Should investigate if it matters.
this.props.onActive();
}
handleKeyDown(e) {
if (e.ctrlKey && e.key === 'c') {
this.props.onURLAbort();
}
}
onHyperCaret(caret) {
this.hyperCaret = caret;
}
write(data) {
// sometimes the preference set above for
// `receive-encoding` is not known by the vt
// before we type to write (since the preference
// manager is asynchronous), so we force it to
// avoid buffering
// this fixes a race condition where sometimes
// opening new sessions results in broken
// output due to the term attempting to decode
// as `utf-8` instead of `raw`
if (this.term.vt.characterEncoding !== 'raw') {
this.term.vt.characterEncoding = 'raw';
}
this.term.io.writeUTF8(data);
}
focus() {
this.term.focusHyperCaret();
}
clear() {
this.term.clearPreserveCursorRow();
// If cursor is still not at the top, a command is probably
// running and we'd like to delete the whole screen.
// Move cursor to top
if (this.term.getCursorRow() !== 0) {
this.write('\x1B[0;0H\x1B[2J');
}
}
moveWordLeft() {
this.term.onVTKeystroke('\x1bb');
}
moveWordRight() {
this.term.onVTKeystroke('\x1bf');
}
deleteWordLeft() {
this.term.onVTKeystroke('\x1b\x7f');
}
deleteWordRight() {
this.term.onVTKeystroke('\x1bd');
}
deleteLine() {
this.term.onVTKeystroke('\x1bw');
}
moveToStart() {
this.term.onVTKeystroke('\x01');
}
moveToEnd() {
this.term.onVTKeystroke('\x05');
}
selectAll() {
this.term.selectAll();
}
getScreenNode() {
return this.term.scrollPort_.getScreenNode();
}
getTermDocument() {
return this.term.document_;
}
getStylesheet(css) {
const hyperCaret = `
.hyper-caret {
outline: none;
display: inline-block;
color: transparent;
text-shadow: 0 0 0 black;
font-family: ${this.props.fontFamily};
font-size: ${this.props.fontSize}px;
}
`;
const scrollBarCss = `
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: ${this.props.borderColor};
}
::-webkit-scrollbar-thumb:window-inactive {
background: ${this.props.borderColor};
}
`;
const selectCss = `
::selection {
background: ${Color(this.props.cursorColor).alpha(0.4).rgbString()};
}
`;
return URL.createObjectURL(new Blob([`
.cursor-node[focus="false"] {
border-width: 1px !important;
}
x-row {
line-height: 1.2em;
}
${hyperCaret}
${scrollBarCss}
${selectCss}
${css}
`], {type: 'text/css'}));
}
validateColor(color, alternative = 'rgb(255,255,255)') {
try {
return Color(color).rgbString();
} catch (err) {
notify(`color "${color}" is invalid`);
}
return alternative;
}
handleMouseDown(ev) {
// we prevent losing focus when clicking the boundary
// wrappers of the main terminal element
if (ev.target === this.termWrapperRef ||
ev.target === this.termRef) {
ev.preventDefault();
}
if (this.props.quickEdit) {
this.term.onMouseDown_(ev);
}
}
componentWillReceiveProps(nextProps) {
if (this.props.url !== nextProps.url) {
// when the url prop changes, we make sure
// the terminal starts or stops ignoring
// key input so that it doesn't conflict
// with the <webview>
if (nextProps.url) {
this.term.io.push();
window.addEventListener('keydown', this.handleKeyDown);
} else {
window.removeEventListener('keydown', this.handleKeyDown);
this.term.io.pop();
}
}
if (!this.props.cleared && nextProps.cleared) {
this.clear();
}
const prefs = this.term.getPrefs();
if (this.props.fontSize !== nextProps.fontSize) {
prefs.set('font-size', nextProps.fontSize);
this.hyperCaret.style.fontSize = nextProps.fontSize + 'px';
}
if (this.props.foregroundColor !== nextProps.foregroundColor) {
prefs.set('foreground-color', nextProps.foregroundColor);
}
if (this.props.fontFamily !== nextProps.fontFamily) {
prefs.set('font-family', nextProps.fontFamily);
this.hyperCaret.style.fontFamily = nextProps.fontFamily;
}
if (this.props.fontSmoothing !== nextProps.fontSmoothing) {
prefs.set('font-smoothing', nextProps.fontSmoothing);
}
if (this.props.cursorColor !== nextProps.cursorColor) {
prefs.set('cursor-color', this.validateColor(nextProps.cursorColor, 'rgba(255,255,255,0.5)'));
}
if (this.props.cursorShape !== nextProps.cursorShape) {
this.term.setCursorShape(nextProps.cursorShape);
}
if (this.props.cursorBlink !== nextProps.cursorBlink) {
prefs.set('cursor-blink', nextProps.cursorBlink);
}
if (this.props.colors !== nextProps.colors) {
prefs.set('color-palette-overrides', getColorList(nextProps.colors));
}
if (this.props.customCSS !== nextProps.customCSS) {
prefs.set('user-css', this.getStylesheet(nextProps.customCSS));
}
if (this.props.bell === 'SOUND') {
prefs.set('audible-bell-sound', this.props.bellSoundURL);
} else {
prefs.set('audible-bell-sound', '');
}
if (this.props.copyOnSelect) {
prefs.set('copy-on-select', true);
} else {
prefs.set('copy-on-select', false);
}
}
componentWillUnmount() {
terms[this.props.uid] = this;
// turn blinking off to prevent leaking a timeout when disposing terminal
const prefs = this.term.getPrefs();
prefs.set('cursor-blink', false);
clearTimeout(this.scrollbarsHideTimer);
this.props.ref_(null);
}
template(css) {
return (<div
ref={component => {
this.termWrapperRef = component;
}}
className={css('fit', this.props.isTermActive && 'active')}
onMouseDown={this.handleMouseDown}
style={{padding: this.props.padding}}
>
{ this.props.customChildrenBefore }
<div
ref={component => {
this.termRef = component;
}}
className={css('fit', 'term')}
/>
{ this.props.url ?
<webview
key="hyper-webview"
src={this.props.url}
onFocus={this.handleFocus}
style={{
background: '#fff',
position: 'absolute',
top: 0,
left: 0,
display: 'inline-flex',
width: '100%',
height: '100%'
}}
/> :
<div // eslint-disable-line react/jsx-indent
key="scrollbar"
className={css('scrollbarShim')}
onMouseEnter={this.handleScrollEnter}
onMouseLeave={this.handleScrollLeave}
/>
}
<div key="hyper-caret" contentEditable className="hyper-caret" ref={this.onHyperCaret}/>
{ this.props.customChildren }
</div>);
}
styles() {
return {
fit: {
display: 'block',
width: '100%',
height: '100%'
},
term: {
position: 'relative'
},
scrollbarShim: {
position: 'fixed',
right: 0,
width: '50px',
top: 0,
bottom: 0,
pointerEvents: 'none'
}
};
}
}
|
packages/core/src/icons/components/Printer.js | iCHEF/gypcrete | import React from 'react';
export default function SvgPrinter(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 32 32"
{...props}
>
<path fill="none" d="M0 0h32v32H0z" />
<path
d="M22 25H10a3 3 0 01-3-3v-9a3 3 0 013-3h1V6h10v4h1a3 3 0 013 3v9a3 3 0 01-3 3zM12 14h-.5a.5.5 0 000 1h.5v-1zm7-6h-6v7h6V8zm4 5a1 1 0 00-1-1h-2v1h1a1 1 0 011 1v1a1 1 0 01-1 1H11a1 1 0 01-1-1v-1a1 1 0 011-1h1v-1h-2a1 1 0 00-1 1v4h14v-4zm-3 1v1h.5a.5.5 0 000-1H20zm3 4H9v4a1 1 0 001 1h12a1 1 0 001-1v-4zm-5 1h4v1h-4v-1zm0-9h-4V9h4v1zm0 2h-4v-1h4v1zm-1 2h-3v-1h3v1z"
fillRule="evenodd"
/>
</svg>
);
}
|
src/utils/defaultClearRenderer.js | foxbroadcasting/react-select | import React from 'react';
export default function clearRenderer () {
return (
<span
className="Select-clear"
dangerouslySetInnerHTML={{ __html: '×' }}
/>
);
};
|
src/containers/ProtocolScreen.js | codaco/Network-Canvas | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { TransitionGroup } from 'react-transition-group';
import { get } from 'lodash';
import { Fade } from '@codaco/ui/lib/components/Transitions';
import { getCSSVariableAsNumber } from '@codaco/ui/lib/utils/CSSVariables';
import { Timeline } from '../components';
import { Stage as StageTransition } from '../components/Transition';
import Stage from './Stage';
import { getSessionProgress } from '../selectors/session';
import { isStageSkipped } from '../selectors/skip-logic';
import { getProtocolStages } from '../selectors/protocol';
import { actionCreators as navigateActions } from '../ducks/modules/navigate';
import { actionCreators as dialogActions } from '../ducks/modules/dialogs';
const initialState = {
pendingDirection: 1,
pendingStage: -1,
};
const childFactoryCreator = stageBackward =>
child =>
React.cloneElement(child, { stageBackward });
/**
* Check protocol is loaded, and render the stage
*/
class Protocol extends Component {
constructor(props) {
super(props);
this.interfaceRef = React.createRef();
this.state = {
...initialState,
};
this.beforeNext = {};
}
onComplete = () => {
const pendingDirection = this.state.pendingDirection;
const pendingStage = this.state.pendingStage;
const navigate = (pendingStage === -1) ?
() => this.props.goToNext(pendingDirection) :
() => this.goToStage(pendingStage);
this.setState(
{ ...initialState },
navigate,
);
};
registerBeforeNext = (beforeNext, stageId) => {
if (beforeNext === null) {
delete this.beforeNext[stageId];
return;
}
this.beforeNext[stageId] = beforeNext;
}
goToNext = (direction = 1) => {
const beforeNext = get(this.beforeNext, this.props.stage.id);
if (!beforeNext) {
this.props.goToNext(direction);
return;
}
this.setState(
{ pendingStage: -1, pendingDirection: direction },
() => beforeNext(direction),
);
};
goToStage = (index) => {
if (this.props.isSkipped(index)) {
this.props.openDialog({
type: 'Warning',
title: 'Show this stage?',
confirmLabel: 'Show Stage',
onConfirm: () => this.props.goToStage(index),
message: (
<p>
Your skip logic settings would normally prevent this stage from being shown in this
interview. Do you want to show it anyway?
</p>
),
});
} else {
this.props.goToStage(index);
}
}
handleClickNext = () =>
this.goToNext();
handleClickBack = () =>
this.goToNext(-1);
handleStageSelect = (index) => {
if (index === this.props.stageIndex) return;
const beforeNext = get(this.beforeNext, this.props.stage.id);
if (!beforeNext) {
this.goToStage(index);
return;
}
const direction = (this.props.stageIndex > index) ? -1 : 1;
this.setState(
{ pendingStage: index, pendingDirection: direction },
() => beforeNext(direction, index),
);
}
render() {
const {
isSessionLoaded,
pathPrefix,
percentProgress,
promptId,
stage,
stageBackward,
stageIndex,
} = this.props;
if (!isSessionLoaded) { return null; }
const duration = {
enter: getCSSVariableAsNumber('--animation-duration-slow-ms') * 2,
exit: getCSSVariableAsNumber('--animation-duration-slow-ms'),
};
return (
<div className="protocol">
<Fade in={isSessionLoaded} duration={duration}>
<Timeline
id="TIMELINE"
onClickBack={this.handleClickBack}
onClickNext={this.handleClickNext}
onStageSelect={this.handleStageSelect}
percentProgress={percentProgress}
/>
</Fade>
<TransitionGroup
className="protocol__content"
childFactory={childFactoryCreator(stageBackward)}
>
<StageTransition key={stage.id} stageBackward={stageBackward}>
<Stage
stage={stage}
promptId={promptId}
pathPrefix={pathPrefix}
stageIndex={stageIndex}
registerBeforeNext={this.registerBeforeNext}
onComplete={this.onComplete}
/>
</StageTransition>
</TransitionGroup>
</div>
);
}
}
Protocol.propTypes = {
isSessionLoaded: PropTypes.bool.isRequired,
pathPrefix: PropTypes.string,
percentProgress: PropTypes.number,
promptId: PropTypes.number,
stage: PropTypes.object.isRequired,
stageBackward: PropTypes.bool,
stageIndex: PropTypes.number,
goToNext: PropTypes.func.isRequired,
};
Protocol.defaultProps = {
pathPrefix: '',
percentProgress: 0,
promptId: 0,
stageBackward: false,
stageIndex: 0,
};
function mapStateToProps(state, ownProps) {
const sessionId = state.activeSessionId;
const stage = getProtocolStages(state)[ownProps.stageIndex] || {};
const stageIndex = Math.trunc(ownProps.stageIndex) || 0;
const { percentProgress, currentPrompt } = getSessionProgress(state);
return {
isSkipped: index => isStageSkipped(index)(state),
isSessionLoaded: !!state.activeSessionId,
pathPrefix: `/session/${sessionId}`,
percentProgress,
promptId: currentPrompt,
stage,
stageIndex,
};
}
const mapDispatchToProps = {
goToNext: navigateActions.goToNext,
goToStage: navigateActions.goToStage,
openDialog: dialogActions.openDialog,
};
const withStore = connect(mapStateToProps, mapDispatchToProps);
export default withStore(Protocol);
|
src/server.js | ames89/keystone-react-redux | import express from 'express';
import React from 'react';
import ReactDOM from 'react-dom/server';
import favicon from 'serve-favicon';
import compression from 'compression';
import cookieParser from 'cookie-parser';
import httpProxy from 'http-proxy';
import path from 'path';
import PrettyError from 'pretty-error';
import http from 'http';
import { match } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import { ReduxAsyncConnect, loadOnServer } from 'redux-connect';
import createHistory from 'react-router/lib/createMemoryHistory';
import { Provider } from 'react-redux';
import config from 'config';
import createStore from 'redux/create';
import ApiClient from 'helpers/ApiClient';
import Html from 'helpers/Html';
import getRoutes from 'routes';
import { exposeInitialRequest } from 'app';
const targetUrl = `http://${config.apiHost}:${config.apiPort}`;
const pretty = new PrettyError();
const app = express();
const server = new http.Server(app);
const proxy = httpProxy.createProxyServer({
target: targetUrl,
ws: true
});
app.use(cookieParser());
app.use(compression());
app.use(favicon(path.join(__dirname, '..', 'static', 'favicon.ico')));
app.get('/manifest.json', (req, res) => res.sendFile(path.join(__dirname, '..', 'static', 'manifest.json')));
app.use(express.static(path.join(__dirname, '..', 'static')));
app.use((req, res, next) => {
res.setHeader('Service-Worker-Allowed', '*');
res.setHeader('X-Forwarded-For', req.ip);
return next();
});
// Proxy to API server
app.use('/api', (req, res) => {
proxy.web(req, res, { target: targetUrl });
});
app.use('/ws', (req, res) => {
proxy.web(req, res, { target: `${targetUrl}/ws` });
});
server.on('upgrade', (req, socket, head) => {
proxy.ws(req, socket, head);
});
// added the error handling to avoid https://github.com/nodejitsu/node-http-proxy/issues/527
proxy.on('error', (error, req, res) => {
if (error.code !== 'ECONNRESET') {
console.error('proxy error', error);
}
if (!res.headersSent) {
res.writeHead(500, { 'content-type': 'application/json' });
}
const json = { error: 'proxy_error', reason: error.message };
res.end(JSON.stringify(json));
});
app.use((req, res) => {
if (__DEVELOPMENT__) {
// Do not cache webpack stats: the script file would change since
// hot module replacement is enabled in the development env
webpackIsomorphicTools.refresh();
}
const client = new ApiClient(req);
const memoryHistory = createHistory(req.originalUrl);
const store = createStore(memoryHistory, client);
const history = syncHistoryWithStore(memoryHistory, store);
function hydrateOnClient() {
res.send(`<!doctype html>
${ReactDOM.renderToString(<Html assets={webpackIsomorphicTools.assets()} store={store} />)}`);
}
if (__DISABLE_SSR__) {
return hydrateOnClient();
}
// Re-configure restApp for apply client cookies
exposeInitialRequest(req);
match({
history,
routes: getRoutes(store),
location: req.originalUrl
}, (error, redirectLocation, renderProps) => {
if (redirectLocation) {
res.redirect(redirectLocation.pathname + redirectLocation.search);
} else if (error) {
console.error('ROUTER ERROR:', pretty.render(error));
res.status(500);
hydrateOnClient();
} else if (renderProps) {
loadOnServer({ ...renderProps, store, helpers: { client } }).then(() => {
const component = (
<Provider store={store} key="provider">
<ReduxAsyncConnect {...renderProps} />
</Provider>
);
res.status(200);
global.navigator = { userAgent: req.headers['user-agent'] };
res.send(`<!doctype html>
${ReactDOM.renderToString(
<Html assets={webpackIsomorphicTools.assets()} component={component} store={store} />
)}`);
}).catch(mountError => {
console.error('MOUNT ERROR:', pretty.render(mountError));
res.status(500);
hydrateOnClient();
});
} else {
res.status(404).send('Not found');
}
});
});
if (config.port) {
server.listen(config.port, err => {
if (err) {
console.error(err);
}
console.info('----\n==> ✅ %s is running, talking to API server on %s.', config.app.title, config.apiPort);
console.info('==> 💻 Open http://%s:%s in a browser to view the app.', config.host, config.port);
});
} else {
console.error('==> ERROR: No PORT environment variable has been specified');
}
|
components/ui/settings/SettingsSwitch.js | Jack3113/edtBordeaux | import React, { Component } from 'react';
import { StyleSheet, Switch, Text, View, ViewPropTypes } from 'react-native';
import PropTypes from 'prop-types';
export default class SettingsSwitch extends Component {
constructor() {
super();
this.state = {
isInEditMode: false,
};
}
static props = {
container: PropTypes.object,
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
disabledOverlayStyle: PropTypes.object,
titleProps: PropTypes.object,
titleStyle: Text.propTypes.style,
title: PropTypes.string,
switchWrapperProps: PropTypes.object,
switchWrapperStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
value: PropTypes.bool.isRequired,
disabled: PropTypes.bool,
onSaveValue: PropTypes.func.isRequired,
thumbColor: PropTypes.string,
onTintColor: PropTypes.string,
switchProps: PropTypes.object,
};
static defaultProps = {
container: {},
containerStyle: {},
disabledOverlayStyle: {},
titleProps: {},
titleStyle: {},
switchWrapperProps: {},
switchWrapperStyle: {},
disabled: false,
switchProps: {},
};
render() {
const {
container,
containerStyle,
titleProps,
titleStyle,
title,
disabled,
switchProps,
disabledOverlayStyle,
switchWrapperProps,
switchWrapperStyle,
value,
thumbColor,
onTintColor,
onSaveValue,
} = this.props;
return (
<View {...container} style={[styles.defaultContainerStyle, containerStyle]}>
<View style={{ flex: 1, position: 'relative' }}>
<Text {...titleProps} style={[styles.defaultTitleStyle, titleStyle]}>
{title}
</Text>
{disabled ? (
<View
style={[
{ position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 },
styles.defaultDisabledOverlayStyle,
disabled ? disabledOverlayStyle : null,
]}
/>
) : null}
</View>
<View {...switchWrapperProps} style={[styles.defaultSwitchWrapperStyle, switchWrapperStyle]}>
<Switch
value={value}
thumbColor={thumbColor ? thumbColor : null}
onTintColor={onTintColor ? onTintColor : null}
onValueChange={(value) => {
onSaveValue(value);
}}
disabled={disabled}
{...switchProps}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
defaultContainerStyle: {
padding: 0,
height: 50,
backgroundColor: 'white',
alignItems: 'center',
flexDirection: 'row',
},
defaultTitleStyle: {
flex: 0,
paddingLeft: 16,
paddingRight: 8,
fontSize: 16,
},
defaultSwitchWrapperStyle: {
flex: 0,
flexDirection: 'row',
paddingLeft: 8,
paddingRight: 16,
},
defaultDisabledOverlayStyle: {
backgroundColor: 'rgba(255,255,255,0.6)',
},
});
|
src/interface/others/CooldownOverview.js | ronaldpereira/WoWAnalyzer | import React from 'react';
import PropTypes from 'prop-types';
import Cooldown from './Cooldown';
const CooldownOverview = ({ fightStart, fightEnd, cooldowns, applyTimeFilter }) => (
<ul className="list">
{cooldowns.map(cooldown => (
<li key={`${cooldown.spell.id}-${cooldown.start}`} className="item clearfix" style={{ padding: '10px 30px' }}>
<Cooldown cooldown={cooldown} fightStart={fightStart} fightEnd={fightEnd} applyTimeFilter={applyTimeFilter} />
</li>
))}
</ul>
);
CooldownOverview.propTypes = {
fightStart: PropTypes.number.isRequired,
fightEnd: PropTypes.number.isRequired,
cooldowns: PropTypes.arrayOf(PropTypes.shape({
ability: PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
icon: PropTypes.string.isRequired,
}),
start: PropTypes.number.isRequired,
end: PropTypes.number,
events: PropTypes.arrayOf(PropTypes.shape({
type: PropTypes.string.isRequired,
})).isRequired,
})).isRequired,
applyTimeFilter: PropTypes.func,
};
export default CooldownOverview;
|
client/ComponentLibrary.js | CGamesPlay/hterminal | import React from 'react';
import classnames from 'classnames';
import CSS from './ComponentLibrary.css';
function basicTag(name, attributes) {
var tag = { name: name };
if (attributes) {
tag.propTypes = attributes;
}
return tag;
}
var allowedTags = [
'div', 'span', 'strong', 'b', 'i', 'em', 'u', 'strike',
'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'table', 'thead', 'tfoot', 'tbody', 'tr', 'th', 'td', 'caption',
'ul', 'ol', 'li',
'pre', 'code',
].reduce((memo, tag) => { memo[tag] = basicTag(tag); return memo; }, {});
allowedTags['a'] = basicTag('a', { href: React.PropTypes.string });
allowedTags['img'] = basicTag('img', { src: React.PropTypes.string });
export class Icon extends React.Component {
render() {
return (
<i className={"fa fa-" + this.props.id} />
);
}
}
Icon.propTypes = {
id: React.PropTypes.string.isRequired,
};
export class MultiColumnList extends React.Component {
render() {
let items = React.Children.map(this.props.children, (c, i) =>
<li key={i}>{c}</li>
);
return <ul className="multi-column-list">{items}</ul>;
}
}
export class File extends React.Component {
render() {
let { path, ...other} = this.props;
return (
<a href={"cmd://open%20" + path} {...other}>
{this.props.children || path}
</a>
);
}
}
File.propTypes = {
path: React.PropTypes.string.isRequired,
mime: React.PropTypes.string,
};
export class FilePill extends React.Component {
render() {
let iconName, icon;
switch (this.props.mime) {
case "application/x-directory": iconName = "folder"; break;
case "application/x-shellscript": iconName = "terminal"; break;
default: iconName = "file"; break;
}
if (iconName) {
icon = <i className={"fa fa-fw fa-" + iconName} />;
}
return <File className="file-pill" {...this.props}>{icon} {this.props.path}</File>;
}
}
FilePill.propTypes = File.propTypes;
export class FramedImage extends React.Component {
render() {
let style = {
maxWidth: document.body.clientWidth * .8,
maxHeight: document.body.clientHeight * .8,
};
return <img className="framed-image" style={style} src={this.props.src} />;
}
}
FramedImage.propTypes = {
src: React.PropTypes.string
};
export default Object.assign({}, allowedTags, {
'icon': Icon,
'multi-column-list': MultiColumnList,
'file-pill': FilePill,
'framed-image': FramedImage,
});
|
public/js/pages/WorkshopSetsPage.js | JasonShin/HELP-yo | /**
* Created by Shin on 24/09/2016.
*/
import React from 'react';
import WorkshopSetsStore from '../stores/WorkshopSetsStore';
import WorkshopSetList from '../components/WorkshopSetList';
import config from '../../config/config';
const ReactCSSTransitionGroup = require('react-addons-css-transition-group');
export default class Home extends React.Component {
componentWillMount() {
document.title = `Workshop Sets${config.titleEnding}`;
}
render() {
console.log('workshop sets!');
return (
<ReactCSSTransitionGroup
transitionName="page-transition"
transitionAppear={true}
transitionAppearTimeout={800}
transitionEnterTimeout={800}>
<div id="PageContent">
<WorkshopSetList store={WorkshopSetsStore}/>
</div>
</ReactCSSTransitionGroup>
);
}
} |
src/components/Navbar.js | jamez14/jams-tweeter | import React, { Component } from 'react';
export class Navbar extends Component {
render() {
return (
<nav className="navbar navbar-fixed-top navbar-dark bg-primary">
<button className="navbar-toggler hidden-sm-up" type="button">
☰
</button>
<div className="collapse navbar-toggleable-xs">
<a className="navbar-brand" href="#">Jams Tweeter</a>
<ul className="nav navbar-nav">
<li className="nav-item active">
<a className="nav-link" href="#">Home <span className="sr-only">(current)</span></a>
</li>
<li className="nav-item">
<a className="nav-link" href="#">Notifications</a>
</li>
<li className="nav-item">
<a className="nav-link" href="#">Moments</a>
</li>
<li className="nav-item">
<a className="nav-link" href="#">Message</a>
</li>
</ul>
</div>
</nav>
);
}
} |
srcjs/main.js | wlainer/react-redux-tutorial | import React from 'react'
import { render } from 'react-dom'
import { Router, Route, IndexRoute, Link } from 'react-router'
import { Provider } from 'react-redux'
import store from './store'
import { history } from './store'
import App from './components/app';
import BookPanel from './components/BookPanel';
import AuthorPanel from './components/AuthorPanel';
import BookForm from './components/BookForm';
import AuthorForm from './components/AuthorForm';
import schedule from './scheduler';
const About = () => {
return <div>
<h2>About</h2>
<Link to="/">Home</Link>
</div>
}
const NoMatch = () => {
return <div>
<h2>No match</h2>
<Link to="/">Home</Link>
</div>
}
render((
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={BookPanel}/>
<Route path="/book_create/" component={BookForm} />
<Route path="/book_update/:id" component={BookForm} />
<Route path="/authors/" component={AuthorPanel} />
<Route path="/author_create/" component={AuthorForm} />
<Route path="/author_update/:id" component={AuthorForm} />
<Route path="/about" component={About}/>
<Route path="*" component={NoMatch}/>
</Route>
</Router>
</Provider>
), document.getElementById('content')
)
// schedule(); |
packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.js | amido/create-react-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(baseUser) {
return [
{ id: 1, name: '1', ...baseUser },
{ id: 2, name: '2', ...baseUser },
{ id: 3, name: '3', ...baseUser },
{ id: 4, name: '4', ...baseUser },
];
}
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load({ age: 42 });
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-object-spread">
{this.state.users.map(user => (
<div key={user.id}>
{user.name}: {user.age}
</div>
))}
</div>
);
}
}
|
app/js/components/loading/loading.component.js | milk-shake/electron-pokemon | import React from 'react';
import ReactDOM from 'react-dom';
export default class LoadingComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div class="loading">
<span class="ion ion-load-b"></span>
</div>
}
}
|
src/svg-icons/file/file-upload.js | kittyjumbalaya/material-components-web | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let FileFileUpload = (props) => (
<SvgIcon {...props}>
<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/>
</SvgIcon>
);
FileFileUpload = pure(FileFileUpload);
FileFileUpload.displayName = 'FileFileUpload';
FileFileUpload.muiName = 'SvgIcon';
export default FileFileUpload;
|
assets/js/app.js | ryo33/mytwitter | import "phoenix_html"
import socket from "./socket"
import React from 'react'
import { connect, Provider } from 'react-redux'
import { createReducer } from 'redux-act'
import { render } from 'react-dom'
import {
combineReducers, applyMiddleware, createStore
} from 'redux'
import logger from 'redux-logger'
import { Icon, Container, Header } from 'semantic-ui-react'
import Timeline from './Timeline'
import Error from './Error'
import {
addTweet, showError, clearError
} from './actions'
const tweets = createReducer({
[addTweet]: (list, tweet) => list.concat(tweet)
}, [])
const error = createReducer({
[showError]: (state, error) => error,
[clearError]: (state, payload) => null,
}, null)
const reducer = combineReducers({ tweets, error })
const store = createStore(
reducer,
applyMiddleware(logger)
)
const mapStateToProps = ({ tweets, error }) => {
return { tweets, error }
}
const mapDispatchToProps = {
clearError
}
const App = connect(mapStateToProps, mapDispatchToProps)(
({ tweets, error }) => (
<Container>
<Header as='h2'>
<a href="https://github.com/ryo33/mytwitter">
<Icon name="github" /> ryo33/mytwitter
</a>
</Header>
<Error error={error} clearError={() => clearError()} />
<Timeline tweets={tweets} />
</Container>
)
)
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)
let channel = socket.channel("timeline", {})
socket.onError(() => {
store.dispatch(showError("there was an error with the connection!"))
})
channel.join()
.receive("ok", resp => {
store.dispatch(clearError())
console.log("Joined successfully", resp)
})
.receive("error", resp => {
store.dispatch(showError("Unable to join"))
})
channel.on("tweet", tweet => {
store.dispatch(addTweet(tweet))
})
|
docs/src/app/components/pages/components/GridList/Page.js | ngbrown/material-ui | import React from 'react';
import Title from 'react-title-component';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';
import gridListReadmeText from './README';
import gridListExampleSimpleCode from '!raw!./ExampleSimple';
import GridListExampleSimple from './ExampleSimple';
import gridListExampleComplexCode from '!raw!./ExampleComplex';
import GridListExampleComplex from './ExampleComplex';
import gridListCode from '!raw!material-ui/GridList/GridList';
import gridTileCode from '!raw!material-ui/GridList/GridTile';
const descriptions = {
simple: 'A simple example of a scrollable `GridList` containing a [Subheader](/#/components/subheader).',
complex: 'This example demonstrates "featured" tiles, using the `rows` and `cols` props to adjust the size of the ' +
'tile. The tiles have a customised title, positioned at the top and with a custom gradient `titleBackground`.',
};
const GridListPage = () => (
<div>
<Title render={(previousTitle) => `Grid List - ${previousTitle}`} />
<MarkdownElement text={gridListReadmeText} />
<CodeExample
title="Simple example"
description={descriptions.simple}
code={gridListExampleSimpleCode}
>
<GridListExampleSimple />
</CodeExample>
<CodeExample
title="Complex example"
description={descriptions.complex}
code={gridListExampleComplexCode}
>
<GridListExampleComplex />
</CodeExample>
<PropTypeDescription header="### GridList Properties" code={gridListCode} />
<PropTypeDescription header="### GridTile Properties" code={gridTileCode} />
</div>
);
export default GridListPage;
|
src/svg-icons/editor/format-align-justify.js | hwo411/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorFormatAlignJustify = (props) => (
<SvgIcon {...props}>
<path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"/>
</SvgIcon>
);
EditorFormatAlignJustify = pure(EditorFormatAlignJustify);
EditorFormatAlignJustify.displayName = 'EditorFormatAlignJustify';
EditorFormatAlignJustify.muiName = 'SvgIcon';
export default EditorFormatAlignJustify;
|
src/svg-icons/image/leak-add.js | kasra-co/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageLeakAdd = (props) => (
<SvgIcon {...props}>
<path d="M6 3H3v3c1.66 0 3-1.34 3-3zm8 0h-2c0 4.97-4.03 9-9 9v2c6.08 0 11-4.93 11-11zm-4 0H8c0 2.76-2.24 5-5 5v2c3.87 0 7-3.13 7-7zm0 18h2c0-4.97 4.03-9 9-9v-2c-6.07 0-11 4.93-11 11zm8 0h3v-3c-1.66 0-3 1.34-3 3zm-4 0h2c0-2.76 2.24-5 5-5v-2c-3.87 0-7 3.13-7 7z"/>
</SvgIcon>
);
ImageLeakAdd = pure(ImageLeakAdd);
ImageLeakAdd.displayName = 'ImageLeakAdd';
ImageLeakAdd.muiName = 'SvgIcon';
export default ImageLeakAdd;
|
app/components/LocationSelector.js | Imaflora/atlasagropecuario | import React, { Component } from 'react';
import { connect } from 'react-redux';
import Select from './Select'
import Option from './Option'
class LocationSelector extends Component {
render() {
return (
<div id="location-selector" className="align-center row-fluid">
<select className="cool" is data-show-subtext="true" is data-live-search={true}>
<optgroup label="picnic">
<Option dataSubtext="Rep California">Tom Foolery</Option>
<Option dataSubtext="Sen California">Bill Gordon</Option>
</optgroup>
<Option dataSubtext="Sen Massacusetts">Elizabeth Warren</Option>
<Option dataSubtext="Rep Alabama">Mario Flores</Option>
<Option dataSubtext="Rep Alaska">Don Young</Option>
<Option dataSubtext="Rep California" disabled="disabled">Marvin Martinez</Option>
</select>
</div>
);
}
}
const mapStateToProps = (state, ownProps) => {
return {
}
}
const mapDispatchToProps = (dispatch, ownProps) => {
return {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(LocationSelector) |
src/index.js | FranckCo/Operation-Explorer | import React from 'react';
import ReactDOM from 'react-dom';
import Root from './components/root';
import registerServiceWorker from './registerServiceWorker';
import './css/style.css';
ReactDOM.render(<Root />, document.getElementById('base'));
registerServiceWorker();
|
index.ios.js | mikecousins/moviechoices-mobile | /* @flow */
import React from 'react';
import {
AppRegistry,
} from 'react-native';
import MovieScene from './src/scenes/MovieScene.react';
class MovieChoices extends React.Component {
render() {
return (
<MovieScene />
);
}
}
AppRegistry.registerComponent('moviechoices', () => MovieChoices);
export default MovieChoices;
|
test/fixtures/memo-function/expected.js | layershifter/babel-plugin-transform-react-handled-props | import PropTypes from 'prop-types';
import React from 'react';
const Example = React.memo(function Example() {
return <div />;
});
Example.handledProps = ["active", "children", "className"];
Example.defaultProps = {
active: true
};
Example.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
export default Example;
|
1m_Redux_Lynda/Ex_Files_Learning_Redux/Exercise Files/Ch05/05_01/start/src/index.js | yevheniyc/Autodidact | import C from './constants'
import React from 'react'
import { render } from 'react-dom'
import routes from './routes'
import sampleData from './initialState'
const initialState = (localStorage["redux-store"]) ?
JSON.parse(localStorage["redux-store"]) :
sampleData
const saveState = () =>
localStorage["redux-store"] = JSON.stringify(store.getState())
window.React = React
render(
routes,
document.getElementById('react-container')
)
|
packages/showcase/plot/width-height-margin.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 {XYPlot, XAxis, YAxis, VerticalGridLines, LineSeries} from 'react-vis';
export default function Example() {
return (
<XYPlot margin={50} width={200} height={200}>
<VerticalGridLines />
<XAxis />
<YAxis />
<LineSeries
data={[
{x: 1, y: 10},
{x: 2, y: 5},
{x: 3, y: 15}
]}
/>
</XYPlot>
);
}
|
src/components/Markdown/Quote.js | jonahjoughin/blog.jough.in | import React from 'react';
import addFirstLastProps from '../../utilities/addFirstLastProps';
import addBooleanProp from '../../utilities/addBooleanProp';
const Quote = ({children}) => (
<div className = {"pv4 mb5 br3-ns bg-near-white tracked lh-copy tl"}>
{addBooleanProp("inQuote",addFirstLastProps(children))}
</div>
);
export default Quote;
|
src/svg-icons/communication/invert-colors-off.js | pradel/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationInvertColorsOff = (props) => (
<SvgIcon {...props}>
<path d="M20.65 20.87l-2.35-2.35-6.3-6.29-3.56-3.57-1.42-1.41L4.27 4.5 3 5.77l2.78 2.78c-2.55 3.14-2.36 7.76.56 10.69C7.9 20.8 9.95 21.58 12 21.58c1.79 0 3.57-.59 5.03-1.78l2.7 2.7L21 21.23l-.35-.36zM12 19.59c-1.6 0-3.11-.62-4.24-1.76C6.62 16.69 6 15.19 6 13.59c0-1.32.43-2.57 1.21-3.6L12 14.77v4.82zM12 5.1v4.58l7.25 7.26c1.37-2.96.84-6.57-1.6-9.01L12 2.27l-3.7 3.7 1.41 1.41L12 5.1z"/>
</SvgIcon>
);
CommunicationInvertColorsOff = pure(CommunicationInvertColorsOff);
CommunicationInvertColorsOff.displayName = 'CommunicationInvertColorsOff';
export default CommunicationInvertColorsOff;
|
src/parser/warlock/demonology/modules/talents/DemonicCalling.js | FaideWW/WoWAnalyzer | import React from 'react';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import SpellUsable from 'parser/shared/modules/SpellUsable';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import { STATISTIC_ORDER } from 'interface/others/StatisticBox';
import StatisticListBoxItem from 'interface/others/StatisticListBoxItem';
const BUFF_DURATION = 20000;
const debug = false;
class DemonicCalling extends Analyzer {
static dependencies = {
spellUsable: SpellUsable,
};
wastedProcs = 0;
_expectedBuffEnd = null;
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTalent(SPELLS.DEMONIC_CALLING_TALENT.id);
this.addEventListener(Events.applybuff.to(SELECTED_PLAYER).spell(SPELLS.DEMONIC_CALLING_BUFF), this.applyDemonicCallingBuff);
this.addEventListener(Events.refreshbuff.to(SELECTED_PLAYER).spell(SPELLS.DEMONIC_CALLING_BUFF), this.refreshDemonicCallingBuff);
this.addEventListener(Events.removebuff.to(SELECTED_PLAYER).spell(SPELLS.DEMONIC_CALLING_BUFF), this.removeDemonicCallingBuff);
}
applyDemonicCallingBuff(event) {
debug && this.log('DC applied');
this._expectedBuffEnd = event.timestamp + BUFF_DURATION;
}
refreshDemonicCallingBuff(event) {
debug && this.log('DC refreshed');
if (this.spellUsable.isAvailable(SPELLS.CALL_DREADSTALKERS.id)) {
this.wastedProcs += 1;
debug && this.log('Dreadstalkers were available, wasted proc');
}
this._expectedBuffEnd = event.timestamp + BUFF_DURATION;
}
removeDemonicCallingBuff(event) {
if (event.timestamp >= this._expectedBuffEnd) {
// the buff fell off, another wasted instant
this.wastedProcs += 1;
debug && this.log('DC fell off, wasted proc');
}
}
get suggestionThresholds() {
const wastedPerMinute = this.wastedProcs / this.owner.fightDuration * 1000 * 60;
return {
actual: wastedPerMinute,
isGreaterThan: {
minor: 1,
average: 1.5,
major: 2,
},
style: 'number',
};
}
suggestions(when) {
when(this.suggestionThresholds)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<>You should try to use your cheaper <SpellLink id={SPELLS.CALL_DREADSTALKERS.id} /> as much as possible as Dreadstalkers make a great portion of your damage.<br /><br /><small>NOTE: Some wasted procs are probably unavoidable (e.g. <SpellLink id={SPELLS.CALL_DREADSTALKERS.id} /> on cooldown, proc waiting but gets overwritten by another)</small></>)
.icon(SPELLS.DEMONIC_CALLING_TALENT.icon)
.actual(`${actual.toFixed(2)} wasted procs per minute`)
.recommended(`< ${recommended} is recommended`);
});
}
subStatistic() {
return (
<StatisticListBoxItem
title={<>Wasted <SpellLink id={SPELLS.DEMONIC_CALLING_TALENT.id} /> procs</>}
value={this.wastedProcs}
/>
);
}
statisticOrder = STATISTIC_ORDER.OPTIONAL(0);
}
export default DemonicCalling;
|
app/javascript/mastodon/main.js | musashino205/mastodon | import * as registerPushNotifications from './actions/push_notifications';
import { setupBrowserNotifications } from './actions/notifications';
import { default as Mastodon, store } from './containers/mastodon';
import React from 'react';
import ReactDOM from 'react-dom';
import ready from './ready';
const perf = require('./performance');
function main() {
perf.start('main()');
if (window.history && history.replaceState) {
const { pathname, search, hash } = window.location;
const path = pathname + search + hash;
if (!(/^\/web($|\/)/).test(path)) {
history.replaceState(null, document.title, `/web${path}`);
}
}
ready(() => {
const mountNode = document.getElementById('mastodon');
const props = JSON.parse(mountNode.getAttribute('data-props'));
ReactDOM.render(<Mastodon {...props} />, mountNode);
store.dispatch(setupBrowserNotifications());
if (process.env.NODE_ENV === 'production') {
// avoid offline in dev mode because it's harder to debug
require('offline-plugin/runtime').install();
store.dispatch(registerPushNotifications.register());
}
perf.stop('main()');
});
}
export default main;
|
src/Components/NavBarDrawer.js | abhishekdhaduvai/readable_react | import React from 'react';
import PropTypes from 'prop-types';
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import NavBar from './Utils/NavBar';
import Divider from 'material-ui/Divider';
class NavBarDrawer extends React.Component {
PropTypes = {
categories: PropTypes.object.isRequired,
}
constructor(props) {
super(props);
this.state = {open: false};
}
handleToggle = () => {
this.setState({open: !this.state.open})
}
handleClose = () => this.setState({open: false});
render() {
const {categories} = this.props;
return (
<div>
<NavBar handleToggle={this.handleToggle}/>
<Drawer
docked={false}
width={250}
open={this.state.open}
onRequestChange={(open) => this.setState({open})}>
<div className="drawer-heading">
<h2>Categories</h2>
</div>
<Divider />
<MenuItem href="/">All</MenuItem>
<Divider />
{categories.map(category => (
<div key={category.path}>
<MenuItem href={`/${category.path}`}>{category.name}</MenuItem>
<Divider />
</div>
))}
</Drawer>
</div>
);
}
}
export default NavBarDrawer |
client2/src/components/Video/index.js | frolicking-ampersand/CodeOut | import _ from 'underscore';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import YTSearch from 'youtube-api-search';
import SearchBar from './components/search_bar';
import VideoList from './components/video_list';
import VideoDetail from './components/video_detail';
import Navbar from './components/video_navbar';
import auth from "./../auth/auth-helper";
import Login from "./../auth/login";
const API_KEY = 'AIzaSyACCRzAumvvEk2O2lCmS9CZTOVWfCJhaL0';
export default class Video extends Component {
constructor(props) {
super();
this.state = {
videos: [],
loggedIn: auth.loggedIn(),
selectedVideo: null
};
this.sendVideoSelectData.bind(this);
this.videoSearch('react tutorial')
}
componentDidMount () {
socket.on('getVid', function (data) {
this.setState({selectedVideo: data.selectedVideo.selectedVideo});
}.bind(this));
}
videoSearch(term){
YTSearch({key: API_KEY, term: term}, (videos) => {
this.setState({
videos: videos,
selectedVideo: videos[0]
});
});
}
sendVideoSelectData (vid) {
socket.emit('sendVideoSelect', { selectedVideo: vid});
this.setState({selectedVideo: vid})
}
render() {
const videoSearch = _.debounce((term) => { this.videoSearch(term) }, 500);
return (
<div>
{this.state.loggedIn ? (
<div className="animated fadeIn">
<Navbar />
<SearchBar onSearchTermChange={videoSearch} />
<VideoList onVideoSelect={
selectedVideo => this.setState({selectedVideo})}
videos={this.state.videos} />
<VideoDetail video={this.state.selectedVideo} />
</div>
) : (
<div>
<Login />
</div>
)}
</div>
)
}
}
|
modules/dreamview/frontend/src/components/PNCMonitor/PlanningMonitor.js | jinghaomiao/apollo | import React from 'react';
import { inject, observer } from 'mobx-react';
import _ from 'lodash';
import SETTING from 'store/config/PlanningGraph.yml';
import ScatterGraph, { generateScatterGraph } from 'components/PNCMonitor/ScatterGraph';
import PlanningScenarioTable from 'components/PNCMonitor/PlanningScenarioTable';
@inject('store') @observer
export default class PlanningMonitor extends React.Component {
generateGraphsFromDatasets(settingName, datasets) {
const setting = SETTING[settingName];
if (!setting) {
console.error('No such setting name found in PlanningGraph.yml:', settingName);
return null;
}
return _.get(setting, 'datasets', []).map(({ name, graphTitle }) => {
const graph = datasets[name];
const polygons = graph ? graph.obstaclesBoundary : [];
return (
<ScatterGraph
key={`${settingName}_${name}`}
title={graphTitle}
options={setting.options}
properties={setting.properties}
data={{ lines: graph, polygons }}
/>
);
});
}
render() {
const {
planningTimeSec, data, chartData, scenarioHistory,
} = this.props.store.planningData;
if (!planningTimeSec) {
return null;
}
const chartCount = {};
return (
<div>
<PlanningScenarioTable scenarios={scenarioHistory} />
{chartData.map((chart) => {
// Adding count to chart key to prevent duplicate chart title
if (!chartCount[chart.title]) {
chartCount[chart.title] = 1;
} else {
chartCount[chart.title] += 1;
}
return (
<ScatterGraph
key={`custom_${chart.title}_${chartCount[chart.title]}`}
title={chart.title}
options={chart.options}
properties={chart.properties}
data={chart.data}
/>
);
})}
{generateScatterGraph(SETTING.speedGraph, data.speedGraph)}
{generateScatterGraph(SETTING.accelerationGraph, data.accelerationGraph)}
{generateScatterGraph(SETTING.planningThetaGraph, data.thetaGraph)}
{generateScatterGraph(SETTING.planningKappaGraph, data.kappaGraph)}
{this.generateGraphsFromDatasets('stGraph', data.stGraph)}
{this.generateGraphsFromDatasets('stSpeedGraph', data.stSpeedGraph)}
{generateScatterGraph(SETTING.planningDkappaGraph, data.dkappaGraph)}
{generateScatterGraph(SETTING.referenceLineThetaGraph, data.thetaGraph)}
{generateScatterGraph(SETTING.referenceLineKappaGraph, data.kappaGraph)}
{generateScatterGraph(SETTING.referenceLineDkappaGraph, data.dkappaGraph)}
</div>
);
}
}
|
src/client.js | JRF-tw/law_in_social_movement | /**
* THIS IS THE ENTRY POINT FOR THE CLIENT, JUST LIKE server.js IS THE ENTRY POINT FOR THE SERVER.
*/
import 'babel/polyfill';
import React from 'react';
import BrowserHistory from 'react-router/lib/BrowserHistory';
import Location from 'react-router/lib/Location';
import queryString from 'query-string';
import createStore from './redux/create';
import universalRouter from './universalRouter';
import './views/css/main.css';
const history = new BrowserHistory();
const dest = document.getElementById('content');
const store = createStore();
const search = document.location.search;
const query = search && queryString.parse(search);
const location = new Location(document.location.pathname, query);
universalRouter(location, history, store)
.then(({component}) => {
if (__DEVTOOLS__) {
const { DevTools, DebugPanel, LogMonitor } = require('redux-devtools/lib/react');
console.info('You will see a "Warning: React attempted to reuse markup in a container but the checksum was' +
' invalid." message. That\'s because the redux-devtools are enabled.');
React.render(<div>
{component}
<DebugPanel top right bottom key="debugPanel">
<DevTools store={store} monitor={LogMonitor}/>
</DebugPanel>
</div>, dest);
} else {
React.render(component, dest);
}
}, (error) => {
console.error(error);
});
if (process.env.NODE_ENV !== 'production') {
window.React = React; // enable debugger
const reactRoot = window.document.getElementById('content');
if (!reactRoot || !reactRoot.firstChild || !reactRoot.firstChild.attributes || !reactRoot.firstChild.attributes['data-react-checksum']) {
console.error('Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.');
}
}
|
src/routes/login/index.js | ben-miller/adddr.io | /**
* adddr (https://www.adddr.io/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '../../components/Layout';
import Login from './Login';
const title = 'Log In';
function action() {
return {
chunks: ['login'],
title,
component: (
<Layout>
<Login title={title} />
</Layout>
),
};
}
export default action;
|
src/components/Navbar.js | byoigres/minutes | import React from 'react';
import { Link as A } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
import styled from 'styled-components';
const Navbar = styled.div`
position: fixed;
width: 100%;
box-shadow: 0 0.0625rem 1rem 0.25rem ${p => p.theme.minBlack}; /* var(--min-black) */
top: 0;
left: 0;
display: flex;
justify-content: center;
color: ${p => p.theme.fullWhite}; /* var(--full-white) */
background-color: ${p => p.isTransparent ? p.theme.middleWhite : p.theme.primaryColor1}; /* var(--primary-color-1); */
z-index: 4;
height: 4rem;
max-height: 8rem;
border-bottom: 0.0625rem solid ${p => p.theme.primaryColor2}; /* var(--primary-color-2) */
`;
const Container = styled.div`
display: flex;
justify-content: space-between;
max-width: 76rem;
width: 100%;
align-content: center;
@media only screen and (max-width: 79.999rem) { /* width < 80rem */
margin: 0 1rem;
}
`;
const Brand = styled.div`
flex: 1 0 auto;
display: flex;
align-items: center;
`;
const Link = styled(A)`
display: block;
font-weight: bold;
padding: 1.3rem 0.5rem;
padding-left: 0;
font-size: 1.2rem;
color: ${p => p.theme.fullWhite}; /* var(--full-white) */
transition: 0.5s color;
&:hover {
color: ${p => p.theme.darkWhite};/* var(--dark-white) */
text-decoration: none;
}
`;
const NavbarList = styled.div`
display: flex;
align-items: stretch;
`;
const NavbarItem = styled(Link)`
color: ${p => p.theme.fullWhite}; /* var(--full-white) */
font-size: 1rem;
padding: 1.35rem 0.5rem;
transition: 0.5s background-color;
&:hover {
background-color: ${p => p.theme.primaryColor2}; /* var(--primary-color-2) */
text-decoration: none;
}
`;
const Wrapper = ({ brandText, isTransparent }) => (
<Navbar isTransparent={isTransparent}>
<Container>
<Brand>
<Link to="/">{brandText}</Link>
</Brand>
<NavbarList>
<NavbarItem to="/what-is-this">
<FormattedMessage id="app.menu.what-is-this" />
</NavbarItem>
<NavbarItem to="/about">
<FormattedMessage id="app.menu.about" />
</NavbarItem>
</NavbarList>
</Container>
</Navbar>
);
Wrapper.displayName = 'Navbar';
export default Wrapper;
|
client/components/Main.js | escape-hatch/escapehatch | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { logout } from '../reducer/user';
import Navbar from './Navbar';
import Footer from './Footer';
import scssMain from './scss/Main.scss';
class Main extends React.Component {
constructor(props) {
super(props);
this.state = {
prevPath: {
pathname: '/home'
}
};
}
componentWillReceiveProps(nextProps) {
const routeChanged = nextProps.location !== this.props.location;
if (routeChanged) this.setState({ prevPath: this.props.location });
}
render() {
const { children, handleClick, loggedIn } = this.props;
return (
<div>
<Navbar handleClick={ handleClick } loggedIn={ loggedIn } />
{ React.cloneElement(children, { ...this.state }) }
<Footer />
</div>
);
}
}
Main.propTypes = {
children: PropTypes.object,
handleClick: PropTypes.func.isRequired,
loggedIn: PropTypes.bool.isRequired
};
// Container //
const mapState = ({ user }) => ({
loggedIn: !!user.id
});
const mapDispatch = dispatch => ({
handleClick () {
dispatch(logout());
}
});
export default connect(mapState, mapDispatch)(Main);
|
packages/ringcentral-widgets-docs/src/app/pages/Components/RegionSettingsPanel/Demo.js | ringcentral/ringcentral-js-widget | import React from 'react';
// eslint-disable-next-line
import RegionSettingsPanel from 'ringcentral-widgets/components/RegionSettingsPanel';
import styles from './styles.scss';
const props = {};
props.currentLocale = 'en-US';
props.availableCountries = [
{ id: '1', isoCode: 'US', callingCode: '1' },
{ id: '224', isoCode: 'GB', callingCode: '44' },
{ id: '39', isoCode: 'CA', callingCode: '1' },
{ id: '75', isoCode: 'FR', callingCode: '33' },
];
props.countryCode = 'US';
props.areaCode = '650';
/**
* A example of `RegionSettingsPanel`
*/
const RegionSettingsPanelDemo = () => (
<div
style={{
position: 'relative',
height: '500px',
width: '300px',
border: '1px solid #f3f3f3',
}}
>
<RegionSettingsPanel className={styles.root} {...props} />
</div>
);
export default RegionSettingsPanelDemo;
|
src/client/components/Posts/MarkdownEditor.js | josh--newman/blog | import React from 'react';
import marked from 'marked';
import Editor from 'react-codemirror';
import '!style-loader!css-loader!codemirror/lib/codemirror.css';
import '!style-loader!css-loader!codemirror/theme/3024-day.css';
import 'codemirror/mode/markdown/markdown';
import styles from './MarkdownEditor.css';
const options = {
lineNumbers: true,
mode: 'markdown',
lineWrapping: true,
theme: '3024-day'
};
class MarkdownEditor extends React.Component {
static propTypes = {
code: React.PropTypes.string,
onChange: React.PropTypes.func.isRequired
}
render() {
const { code, onChange } = this.props;
const preview = marked(code);
return (
<div className={styles.container}>
<div className={styles.editor}>
<Editor value={code} options={options} onChange={onChange} />
</div>
<div className={styles.previewContainer}>
<span>Preview</span>
<div className={styles.preview} dangerouslySetInnerHTML={{__html: preview}} />
</div>
</div>
);
}
}
export default MarkdownEditor;
|
actor-apps/app-web/src/app/components/modals/invite-user/InviteByLink.react.js | liuzwei/actor-platform | import React from 'react';
import Modal from 'react-modal';
import addons from 'react/addons';
import ReactMixin from 'react-mixin';
import { IntlMixin, FormattedMessage } from 'react-intl';
import { Styles, FlatButton, Snackbar } from 'material-ui';
import ReactZeroClipboard from 'react-zeroclipboard';
import { KeyCodes } from 'constants/ActorAppConstants';
import ActorTheme from 'constants/ActorTheme';
import InviteUserByLinkActions from 'actions/InviteUserByLinkActions';
import InviteUserActions from 'actions/InviteUserActions';
import InviteUserStore from 'stores/InviteUserStore';
const ThemeManager = new Styles.ThemeManager();
const appElement = document.getElementById('actor-web-app');
Modal.setAppElement(appElement);
const {addons: { PureRenderMixin }} = addons;
const getStateFromStores = () => {
return {
isShown: InviteUserStore.isInviteWithLinkModalOpen(),
group: InviteUserStore.getGroup(),
inviteUrl: InviteUserStore.getInviteUrl()
};
};
@ReactMixin.decorate(IntlMixin)
@ReactMixin.decorate(PureRenderMixin)
class InviteByLink extends React.Component {
static childContextTypes = {
muiTheme: React.PropTypes.object
};
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
constructor(props) {
super(props);
this.state = getStateFromStores();
ThemeManager.setTheme(ActorTheme);
ThemeManager.setComponentThemes({
button: {
minWidth: 60
}
});
InviteUserStore.addChangeListener(this.onChange);
document.addEventListener('keydown', this.onKeyDown, false);
}
componentWillUnmount() {
InviteUserStore.removeChangeListener(this.onChange);
document.removeEventListener('keydown', this.onKeyDown, false);
}
render() {
const group = this.state.group;
const inviteUrl = this.state.inviteUrl;
const isShown = this.state.isShown;
const snackbarStyles = ActorTheme.getSnackbarStyles();
let groupName;
if (group !== null) {
groupName = <b>{group.name}</b>;
}
return (
<Modal className="modal-new modal-new--invite-by-link"
closeTimeoutMS={150}
isOpen={isShown}
style={{width: 400}}>
<header className="modal-new__header">
<svg className="modal-new__header__icon icon icon--blue"
dangerouslySetInnerHTML={{__html: '<use xlink:href="assets/sprite/icons.svg#back"/>'}}
onClick={this.onBackClick}/>
<h3 className="modal-new__header__title">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalTitle')}/>
</h3>
<div className="pull-right">
<FlatButton hoverColor="rgba(81,145,219,.17)"
label="Done"
labelStyle={{padding: '0 8px'}}
onClick={this.onClose}
secondary={true}
style={{marginTop: -6}}/>
</div>
</header>
<div className="modal-new__body">
<FormattedMessage groupName={groupName} message={this.getIntlMessage('inviteByLinkModalDescription')}/>
<textarea className="invite-url" onClick={this.onInviteLinkClick} readOnly row="3" value={inviteUrl}/>
</div>
<footer className="modal-new__footer">
<button className="button button--light-blue pull-left hide">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalRevokeButton')}/>
</button>
<ReactZeroClipboard onCopy={this.onInviteLinkCopied} text={inviteUrl}>
<button className="button button--blue pull-right">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalCopyButton')}/>
</button>
</ReactZeroClipboard>
</footer>
<Snackbar autoHideDuration={3000}
message={this.getIntlMessage('integrationTokenCopied')}
ref="inviteLinkCopied"
style={snackbarStyles}/>
</Modal>
);
}
onClose = () => {
InviteUserByLinkActions.hide();
};
onBackClick = () => {
this.onClose();
InviteUserActions.show(this.state.group);
};
onInviteLinkClick = event => {
event.target.select();
};
onChange = () => {
this.setState(getStateFromStores());
};
onKeyDown = (event) => {
if (event.keyCode === KeyCodes.ESC) {
event.preventDefault();
this.onClose();
}
};
onInviteLinkCopied = () => {
this.refs.inviteLinkCopied.show();
};
}
export default InviteByLink;
|
app/views/SearchNavigatorView.js | hippothesis/Recipezy | /*
* Copyright 2017-present, Hippothesis, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
import React, { Component } from 'react';
import { Icon } from 'native-base';
import { StackNavigator } from 'react-navigation';
import RecipeSearchView from './RecipeSearchView';
import RecipeSearchResultView from './RecipeSearchResultView';
import RecipeView from './RecipeView';
import AdditionalFilterView from './AdditionalFilterView';
export default class SearchNavigatorView extends Component {
// Set up navigation options for the app navigator
static navigationOptions = {
drawer: {
label: 'Search',
icon: ({ focused, tintColor }) => {
if (focused) {
return <Icon name='ios-search' style={{color: tintColor}} />;
} else {
return <Icon name='ios-search-outline' />;
}
},
},
tabBarLabel: 'Search',
tabBarIcon: ({ focused, tintColor }) => {
if (focused) {
return <Icon name='ios-search' style={{color: tintColor}} />;
} else {
return <Icon name='ios-search-outline' />;
}
},
}
constructor(props) {
super(props);
// Set up route settings for the search navigator
this.routeSettings = {
recipeSearch : { screen: RecipeSearchView },
recipeSearchResult: { screen: RecipeSearchResultView },
recipe : { screen: RecipeView },
additionalFilter : { screen: AdditionalFilterView },
};
// Set up stack navigator settings for the search navigator
this.stackNavigatorSettings = {
initialRouteName: 'recipeSearch',
headerMode: 'none',
};
this.SearchNavigator = StackNavigator(
this.routeSettings,
this.stackNavigatorSettings,
);
}
render() {
const SearchNavigator = this.SearchNavigator;
return <SearchNavigator />;
}
}
|
friday-ui/src/Components/PipeLines/index.js | freekbrinkhuis/friday | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
class PipeLines extends Component {
state = {pipelines:[]};
componentDidMount(){
fetch('/api/pipelines')
.then(res => res.json())
.then(pipelines => this.setState({pipelines}))
}
render(){
return(
<div>
<h1>PipLines</h1>
<div className={'pipeline-menu'}>
<Link to={'/pipeline'}>New</Link>
</div>
<div>
{
this.state.pipelines.map(pipeline =>
<div key={pipeline.id}>{pipeline.name}</div>
)
}
</div>
</div>
)
}
}
export default PipeLines; |
react/CareerLevelIcon/CareerLevelIcon.js | seekinternational/seek-asia-style-guide | import svgMarkup from './CareerLevelIcon.svg';
import React from 'react';
import Icon from '../private/Icon/Icon';
export default function CareerLevelIcon(props) {
return <Icon markup={svgMarkup} {...props} />;
}
CareerLevelIcon.displayName = 'CareerLevelIcon';
|
src/components/typography/index.js | adrienlozano/stephaniewebsite | import React from 'react';
import { PropTypes } from 'react'
import styled, { css } from 'styled-components'
import { compose, setDisplayName, componentFromProp, defaultProps, mapProps } from 'recompose';
import withStyle from "~/enhancers/with-style";
import { space, color, fontSize, removeProps } from 'styled-system';
var transformCapitilize = css`
text-transform: capitalize;
`
const capitalize = ({capitalize}) => capitalize ? transformCapitilize : null;
var enhance = compose (
setDisplayName("Typography"),
defaultProps({ component: 'p', color: "dark" })
)
var Typography = componentFromProp('component');
var Wrapper = ({className, capitalize, children, component, ...rest}) => {
var next =removeProps(rest);
return (<Typography className={className} component={component} {...next}>{children}</Typography>)
}
var StyledTypography = styled(Wrapper)`
${ space };
${ color };
${ fontSize };
${ capitalize };
`;
export default enhance(StyledTypography); |
src/index.js | ezetreezy/reactTesting | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import App from './components/app';
import reducers from './reducers';
const createStoreWithMiddleware = applyMiddleware()(createStore);
ReactDOM.render(
<Provider store={createStoreWithMiddleware(reducers)}>
<App />
</Provider>
, document.querySelector('.container'));
|
app/App.js | mrtnzlml/native | // @flow
import React from 'react';
import { type DimensionType, Dimensions } from '@kiwicom/mobile-shared';
import Navigation from './core/src/navigation';
import HotelsContextForm from './core/src/screens/hotelsStack/HotelsFormContext';
type initialProps = {|
+dimensions: DimensionType,
|};
export default function App(props: initialProps) {
return (
<Dimensions.Provider dimensions={props.dimensions}>
<HotelsContextForm>
<Navigation />
</HotelsContextForm>
</Dimensions.Provider>
);
}
|
packages/material-ui-icons/legacy/BatteryCharging90TwoTone.js | lgollut/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V8h5.47L13 7v1h4V5.33C17 4.6 16.4 4 15.67 4z" /><path d="M13 12.5h2L11 20v-5.5H9L12.47 8H7v12.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V8h-4v4.5z" /></React.Fragment>
, 'BatteryCharging90TwoTone');
|
src/Table.js | erictherobot/react-bootstrap | import React from 'react';
import classNames from 'classnames';
const Table = React.createClass({
propTypes: {
striped: React.PropTypes.bool,
bordered: React.PropTypes.bool,
condensed: React.PropTypes.bool,
hover: React.PropTypes.bool,
responsive: React.PropTypes.bool
},
getDefaultProps() {
return {
bordered: false,
condensed: false,
hover: false,
responsive: false,
striped: false
};
},
render() {
let classes = {
'table': true,
'table-striped': this.props.striped,
'table-bordered': this.props.bordered,
'table-condensed': this.props.condensed,
'table-hover': this.props.hover
};
let table = (
<table {...this.props} className={classNames(this.props.className, classes)}>
{this.props.children}
</table>
);
return this.props.responsive ? (
<div className="table-responsive">
{table}
</div>
) : table;
}
});
export default Table;
|
public/node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js | gFelicio/agenda | import React from 'react';
import { render } from 'react-dom';
// 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';
render(<HelloWorld />, document.getElementById('react-root'));
|
integration/azure/authentication/ms-identity-v2/implicit-grant/ClientApp/src/components/NavMenu.js | advantys/workflowgen-templates | import React from 'react';
import { connect } from 'react-redux';
import {
Collapse,
Container,
Navbar,
NavbarBrand,
NavbarToggler,
NavItem,
NavLink,
Button
} from 'reactstrap';
import './NavMenu.css';
class NavMenu extends React.Component {
constructor (props) {
super(props);
this.toggle = this.toggle.bind(this);
this.handleLogout = this.handleLogout.bind(this);
this.state = {
isOpen: false
};
}
shouldComponentUpdate (nextProps, nextState) {
return this.props.userIsLoggedIn !== nextProps.userIsLoggedIn ||
this.state.isOpen !== nextState.isOpen;
}
toggle () {
this.setState({
isOpen: !this.state.isOpen
});
}
handleLogout () {
// TODO: handle logout
}
render () {
return (
<header>
<Navbar className='navbar-expand-sm navbar-toggleable-sm border-bottom box-shadow mb-3' light >
<Container>
<NavbarBrand href='/'>WorkflowGen Example</NavbarBrand>
<NavbarToggler onClick={this.toggle} className='mr-2' />
<Collapse className='d-sm-inline-flex flex-sm-row-reverse' isOpen={this.state.isOpen} navbar>
<ul className='navbar-nav flex-grow'>
<NavItem>
<NavLink className='text-dark' href='/'>Home</NavLink>
</NavItem>
{this.props.userIsLoggedIn && [
<NavItem key={0}>
<NavLink className='text-dark' href='/WorkflowGenProfile'>WorkflowGen Profile</NavLink>
</NavItem>,
<NavItem key={1}>
<Button color='danger' onClick={this.handleLogout}>Logout</Button>
</NavItem>
]}
</ul>
</Collapse>
</Container>
</Navbar>
</header>
);
}
}
export default connect(
store => ({
userIsLoggedIn: !!store.user,
config: store.config
})
)(NavMenu);
|
app/javascript/mastodon/features/account_gallery/index.js | pfm-eyesightjp/mastodon | import React from 'react';
import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { fetchAccount } from '../../actions/accounts';
import { refreshAccountMediaTimeline, expandAccountMediaTimeline } from '../../actions/timelines';
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';
import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { getAccountGallery } from '../../selectors';
import MediaItem from './components/media_item';
import HeaderContainer from '../account_timeline/containers/header_container';
import { FormattedMessage } from 'react-intl';
import { ScrollContainer } from 'react-router-scroll';
import LoadMore from '../../components/load_more';
const mapStateToProps = (state, props) => ({
medias: getAccountGallery(state, Number(props.params.accountId)),
isLoading: state.getIn(['timelines', `account:${Number(props.params.accountId)}:media`, 'isLoading']),
hasMore: !!state.getIn(['timelines', `account:${Number(props.params.accountId)}:media`, 'next']),
autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
});
@connect(mapStateToProps)
export default class AccountGallery extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
medias: ImmutablePropTypes.list.isRequired,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
autoPlayGif: PropTypes.bool,
};
componentDidMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(refreshAccountMediaTimeline(Number(this.props.params.accountId)));
}
componentWillReceiveProps (nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(refreshAccountMediaTimeline(Number(this.props.params.accountId)));
}
}
handleScrollToBottom = () => {
if (this.props.hasMore) {
this.props.dispatch(expandAccountMediaTimeline(Number(this.props.params.accountId)));
}
}
handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
const offset = scrollHeight - scrollTop - clientHeight;
if (150 > offset && !this.props.isLoading) {
this.handleScrollToBottom();
}
}
handleLoadMore = (e) => {
e.preventDefault();
this.handleScrollToBottom();
}
render () {
const { medias, autoPlayGif, isLoading, hasMore } = this.props;
let loadMore = null;
if (!medias && isLoading) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
if (!isLoading && medias.size > 0 && hasMore) {
loadMore = <LoadMore onClick={this.handleLoadMore} />;
}
return (
<Column>
<ColumnBackButton />
<ScrollContainer scrollKey='account_gallery'>
<div className='scrollable' onScroll={this.handleScroll}>
<HeaderContainer accountId={this.props.params.accountId} />
<div className='account-section-headline'>
<FormattedMessage id='account.media' defaultMessage='Media' />
</div>
<div className='account-gallery__container'>
{medias.map(media =>
<MediaItem
key={media.get('id')}
media={media}
autoPlayGif={autoPlayGif}
/>
)}
{loadMore}
</div>
</div>
</ScrollContainer>
</Column>
);
}
}
|
src/client/components/Base/VenueForm/index.js | mweslander/veery | // Imports
import React from 'react';
import PropTypes from 'prop-types';
// CSS
import './index.scss';
// Components
import LabelGroup from '../LabelGroup';
// PropTypes
const propTypes = {
handleChange: PropTypes.func,
venue: PropTypes.object
};
/*
VenueForm
<VenueForm/>
*/
function VenueForm({ handleChange, venue }) {
return (
<div className="c-venue-form">
<LabelGroup
name="name"
options={{
onChange: handleChange,
placeholder: 'IS JOHN CENA',
type: 'text',
value: venue.name
}}
/>
<LabelGroup
name="address"
options={{
onChange: handleChange,
placeholder: '316 Austin',
type: 'text',
value: venue.address
}}
/>
<div className="o-grid">
<LabelGroup
classes="o-grid__cell"
name="city"
options={{
onChange: handleChange,
placeholder: 'Where The Rock has come back to',
type: 'text',
value: venue.city
}}
/>
<LabelGroup
classes="o-grid__cell o-grid__cell--offset-10"
name="state"
options={{
onChange: handleChange,
placeholder: 'Solid',
type: 'text',
value: venue.state
}}
/>
</div>
<LabelGroup
name="zipCode"
options={{
onChange: handleChange,
placeholder: '23456',
type: 'number',
value: venue.zipCode
}}
/>
</div>
);
}
VenueForm.propTypes = propTypes;
export default VenueForm;
|
src/routes/error/index.js | tinwaisi/take-home | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import ErrorPage from './ErrorPage';
export default {
path: '/error',
action({ error }) {
return {
title: error.name,
description: error.message,
component: <ErrorPage error={error} />,
status: error.status || 500,
};
},
};
|
packages/react/src/components/TextArea/TextArea.js | carbon-design-system/carbon-components | /**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import { WarningFilled16 } from '@carbon/icons-react';
import { useFeatureFlag } from '../FeatureFlags';
import { usePrefix } from '../../internal/usePrefix';
const TextArea = React.forwardRef(function TextArea(
{
className,
id,
labelText,
hideLabel,
onChange,
onClick,
invalid,
invalidText,
helperText,
light,
placeholder,
...other
},
ref
) {
const prefix = usePrefix();
const enabled = useFeatureFlag('enable-v11-release');
const textareaProps = {
id,
onChange: (evt) => {
if (!other.disabled) {
onChange(evt);
}
},
onClick: (evt) => {
if (!other.disabled) {
onClick(evt);
}
},
ref,
};
const labelClasses = classNames(`${prefix}--label`, {
[`${prefix}--visually-hidden`]: hideLabel,
[`${prefix}--label--disabled`]: other.disabled,
});
const label = labelText ? (
<label htmlFor={id} className={labelClasses}>
{labelText}
</label>
) : null;
const helperTextClasses = classNames(`${prefix}--form__helper-text`, {
[`${prefix}--form__helper-text--disabled`]: other.disabled,
});
const helper = helperText ? (
<div className={helperTextClasses}>{helperText}</div>
) : null;
const errorId = id + '-error-msg';
const error = invalid ? (
<div role="alert" className={`${prefix}--form-requirement`} id={errorId}>
{invalidText}
</div>
) : null;
const textareaClasses = classNames(
`${prefix}--text-area`,
[enabled ? null : className],
{
[`${prefix}--text-area--light`]: light,
[`${prefix}--text-area--invalid`]: invalid,
}
);
const input = (
<textarea
{...other}
{...textareaProps}
placeholder={placeholder || null}
className={textareaClasses}
aria-invalid={invalid || null}
aria-describedby={invalid ? errorId : null}
disabled={other.disabled}
/>
);
return (
<div
className={
enabled
? classNames(`${prefix}--form-item`, className)
: `${prefix}--form-item`
}>
{label}
<div
className={`${prefix}--text-area__wrapper`}
data-invalid={invalid || null}>
{invalid && (
<WarningFilled16 className={`${prefix}--text-area__invalid-icon`} />
)}
{input}
</div>
{invalid ? error : helper}
</div>
);
});
TextArea.displayName = 'TextArea';
TextArea.propTypes = {
/**
* Provide a custom className that is applied directly to the underlying
* `<textarea>` node
*/
className: PropTypes.string,
/**
* Specify the `cols` attribute for the underlying `<textarea>` node
*/
cols: PropTypes.number,
/**
* Optionally provide the default value of the `<textarea>`
*/
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/**
* Specify whether the control is disabled
*/
disabled: PropTypes.bool,
/**
* Provide text that is used alongside the control label for additional help
*/
helperText: PropTypes.node,
/**
* Specify whether you want the underlying label to be visually hidden
*/
hideLabel: PropTypes.bool,
/**
* Provide a unique identifier for the control
*/
id: PropTypes.string,
/**
* Specify whether the control is currently invalid
*/
invalid: PropTypes.bool,
/**
* Provide the text that is displayed when the control is in an invalid state
*/
invalidText: PropTypes.node,
/**
* Provide the text that will be read by a screen reader when visiting this
* control
*/
labelText: PropTypes.node.isRequired,
/**
* Specify whether you want the light version of this control
*/
light: PropTypes.bool,
/**
* Optionally provide an `onChange` handler that is called whenever `<textarea>`
* is updated
*/
onChange: PropTypes.func,
/**
* Optionally provide an `onClick` handler that is called whenever the
* `<textarea>` is clicked
*/
onClick: PropTypes.func,
/**
* Specify the placeholder attribute for the `<textarea>`
*/
placeholder: PropTypes.string,
/**
* Specify the rows attribute for the `<textarea>`
*/
rows: PropTypes.number,
/**
* Provide the current value of the `<textarea>`
*/
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
TextArea.defaultProps = {
disabled: false,
onChange: () => {},
onClick: () => {},
placeholder: '',
rows: 4,
cols: 50,
invalid: false,
invalidText: '',
helperText: '',
light: false,
};
export default TextArea;
|
src/components/PhotoDetail.js | debiasej/react-native-learning | import React from 'react';
import { Text, View, Image } from 'react-native';
import Card from './Card';
import CardSection from './CardSection';
const PhotoDetail = ({ photo }) => {
const { title, author, thumbnail_image } = photo;
const { thumbnailStyle,
headerContentStyle,
thumbnailContainerStyle,
headerTextStyle
} = styles;
return (
<Card>
<CardSection>
<View style={thumbnailContainerStyle}>
<Image
style={thumbnailStyle}
source={{ uri: thumbnail_image }}
/>
</View>
<View style={headerContentStyle}>
<Text style={headerTextStyle}>{title}</Text>
<Text>{author}</Text>
</View>
</CardSection>
</Card>
);
};
const styles = {
headerContentStyle: {
flexDirection: 'column',
justifyContent: 'space-around',
},
headerTextStyle: {
fontSize: 18
},
thumbnailStyle: {
height: 50,
width: 50
},
thumbnailContainerStyle: {
justifyContent: 'center',
alignItems: 'center',
marginLeft: 10,
marginRight: 10
}
};
export default PhotoDetail;
|
docs/src/sections/FormSection.js | pombredanne/react-bootstrap | import React from 'react';
import Anchor from '../Anchor';
import PropTable from '../PropTable';
import ReactPlayground from '../ReactPlayground';
import Samples from '../Samples';
export default function FormSection() {
return (
<div className="bs-docs-section">
<h1 className="page-header">
<Anchor id="forms">Forms</Anchor> <small>Input, ButtonInput, FormControls</small>
</h1>
<p>The <code>{'<Input>'}</code> component renders an input in Bootstrap wrappers. Supports label, help, text input add-ons, validation and use as wrapper.
Use <code>getValue()</code> or <code>getChecked()</code> to get the current state.
The helper method <code>getInputDOMNode()</code> returns the internal input element. If you don't want the <code>form-group</code> class applied apply the prop named <code>standalone</code>.</p>
<ReactPlayground codeText={Samples.Input} />
<h3><Anchor id="input-types">Types</Anchor></h3>
<p>Supports <code>select</code>, <code>textarea</code>, as well as standard HTML input types. <code>getValue()</code> returns an array for multiple select.</p>
<ReactPlayground codeText={Samples.InputTypes} />
<h3><Anchor id="forms-controls-static">FormControls.Static</Anchor></h3>
<p>Static text can be added to your form controls through the use of the <code>FormControls.Static</code> component.</p>
<ReactPlayground codeText={Samples.StaticText} />
<h3><Anchor id="button-input-types">Button Input Types</Anchor></h3>
<p>Form buttons are encapsulated by <code>ButtonInput</code>. Pass in <code>type="reset"</code> or <code>type="submit"</code> to suit your needs. Styling is the same as <code>Button</code>.</p>
<ReactPlayground codeText={Samples.ButtonInput} />
<h3><Anchor id="input-addons">Add-ons</Anchor></h3>
<p>Use <code>addonBefore</code> and <code>addonAfter</code> for normal addons, <code>buttonBefore</code> and <code>buttonAfter</code> for button addons.
Exotic configurations may require some css on your side.</p>
<ReactPlayground codeText={Samples.InputAddons} />
<h3><Anchor id="input-sizes">Sizes</Anchor></h3>
<p>Use <code>bsSize</code> to change the size of inputs. It also works with addons and most other options.</p>
<ReactPlayground codeText={Samples.InputSizes} />
<h3><Anchor id="input-validation">Validation</Anchor></h3>
<p>Set <code>bsStyle</code> to one of <code>success</code>, <code>warning</code> or <code>error</code>.
Add <code>hasFeedback</code> to show glyphicon. Glyphicon may need additional styling if there is an add-on or no label.</p>
<ReactPlayground codeText={Samples.InputValidation} />
<h3><Anchor id="input-horizontal">Horizontal forms</Anchor></h3>
<p>Use <code>labelClassName</code> and <code>wrapperClassName</code> properties to add col classes manually.
<code>checkbox</code> and <code>radio</code> types need special treatment because label wraps input.</p>
<ReactPlayground codeText={Samples.InputHorizontal} />
<h3><Anchor id="input-wrapper">Use as a wrapper</Anchor></h3>
<p>If <code>type</code> is not set, child element(s) will be rendered instead of an input element.
<code>getValue()</code> will not work when used this way.</p>
<ReactPlayground codeText={Samples.InputWrapper} />
<h3><Anchor id="input-props">Props</Anchor></h3>
<PropTable component="InputBase"/>
</div>
);
}
|
pages/speakers.js | subvisual/2017.mirrorconf.com | import React from 'react';
import Footer from '../Components/Footer';
import SectionTitle from '../Components/SectionTitle';
import Section from '../Components/Section';
import SpeakerDetails from '../Components/SpeakerDetails';
import '../css/Components/SpeakersPage';
import SpeakerData from '../data/speakers';
const SpeakersPage = () => (
<div className="SpeakersPage">
<div className="SpeakersPage-content">
<Section>
<div className="SpeakersPage-title">
<SectionTitle>Speakers</SectionTitle>
</div>
{SpeakerData.map(speakerData =>
<div className="SpeakersPage-speaker">
<SpeakerDetails {...speakerData} />
</div>,
)}
</Section>
</div>
<Footer />
</div>
);
export default SpeakersPage;
|
examples/demos/dnd.js | elationemr/react-big-calendar | import React from 'react'
import events from '../events'
import HTML5Backend from 'react-dnd-html5-backend'
import { DragDropContext } from 'react-dnd'
import BigCalendar from 'react-big-calendar'
import withDragAndDrop from 'react-big-calendar/lib/addons/dragAndDrop';
import 'react-big-calendar/lib/addons/dragAndDrop/styles.less';
const DragAndDropCalendar = withDragAndDrop(BigCalendar);
class Dnd extends React.Component {
constructor (props) {
super(props)
this.state = {
events: events
}
this.moveEvent = this.moveEvent.bind(this)
}
moveEvent({ event, start, end }) {
const { events } = this.state;
const idx = events.indexOf(event);
const updatedEvent = { ...event, start, end };
const nextEvents = [...events]
nextEvents.splice(idx, 1, updatedEvent)
this.setState({
events: nextEvents
})
alert(`${event.title} was dropped onto ${event.start}`);
}
render(){
return (
<DragAndDropCalendar
selectable
events={this.state.events}
onEventDrop={this.moveEvent}
defaultView='week'
defaultDate={new Date(2015, 3, 12)}
/>
)
}
}
export default DragDropContext(HTML5Backend)(Dnd)
|
src/example/config.js | get-focus/focus-redux | import moment from 'moment';
import React from 'react';
import {loadCivility} from './services/load-civility';
const format = ['DD/MM/YYYY', 'DD-MM-YYYY', 'D MMM YYYY'];
//import AutoCompleteSelect from 'focus-components/components/input/autocomplete-select/field';
const _querySearcher = query => {
let data = [
{
key: 'JL',
label: 'Joh Lickeur'
},
{
key: 'GK',
label: 'Guénolé Kikabou'
},
{
key: 'YL',
label: 'Yannick Lounivis'
}
];
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
data,
totalCount: data.length
});
}, 500);
});
};
const keyResolver = key => {
return new Promise((resolve, reject) => {
setTimeout(resolve.bind(this, 'Resolved value'), 300);
});
}
const querySearcher = query => {
const data = [
{
key: 'NY',
label: 'New York'
},
{
key: 'PAR',
label: 'Paris'
},
{
key: 'TOY',
label: 'Tokyo'
},
{
key: 'BEI',
label: 'Pékin'
},
{
key: 'LON',
label: 'Londres'
},
{
key: 'BER',
label: 'Berlin'
}
].filter(({key, label}) => label.toLowerCase().indexOf(query.toLowerCase()) !== -1);
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
data,
totalCount: 40
});
}, 200);
});
}
export const definitions = {
user: {
information: {
uuid: { domain: 'DO_DON_DIEGO', isRequired: true},
firstName: { domain: 'DO_RODRIGO', isRequired: false},
lastName: { domain: 'DO_DON_DIEGO', isRequired: false},
date: { domain: 'DO_DATE', isRequired: false},
test: {domain: 'DO_EMAIL', isRequired:false},
civility: { domain: 'DO_CIVILITE', isRequired: false},
// TODO: ['childs'] ?
childs : {redirect: ['user.child']}
},
child : {
firstName : { domain: 'DO_RODRIGO', isRequired: false},
lastName : { domain: 'DO_RODRIGO', isRequired: false}
},
address: {
uuid: { domain: 'DO_RODRIGO', isRequired: false},
city: { domain: 'DO_DON_DIEGO', isRequired: false}
}
}
}
export const domains = {
DO_RODRIGO: {
type: 'text',
validators: [{
type: 'string'
}],
formatter: value => value + ' - formaté rodrigo',
},
DO_EMAIL: {
type: 'text',
validators: [{
type: 'email'
}]
},
DO_DON_DIEGO: {
type: 'text',
validators: [{
type: 'string',
options: {
maxLength: 10000
}
}],
},
DO_AUTOCOMPLETE: {
type: 'text',
validators: [{
type: 'string',
options: {
maxLength: 200
}
}],
formatter: value => value + ' - formaté',
//DisplayComponent: props => <div><AutoCompleteSelect isEdit={false} querySearcher={querySearcher} placeholder={'Your search...'} keyResolver={keyResolver} {...props} />{JSON.stringify(props)}</div>,
InputComponent: props => <div>
value: {props.value}
{/*<AutoCompleteSelect isEdit={true} querySearcher={querySearcher} placeholder={'Your search...'} keyResolver={keyResolver} {...props} />*/}
{JSON.stringify(props)}
</div>
},
DO_DATE : {
formatter: date => date ? moment(date, format).format('DD/MM/YYYY') : ''
},
DO_CIVILITE: {
type: 'text',
validators: [{
type: 'string',
options: {
maxLength: 200
}
}]
}
};
export const masterDataConfig = [{name: 'civility', service: loadCivility}];
|
src/modals/BhModal.js | emfmesquita/beyondhelp | import "./BhModal.scss";
import React, { Component } from 'react';
import { Modal } from 'react-bootstrap';
class BhModal extends Component {
renderFooter = () => {
return this.props.footer ? <Modal.Footer>{this.props.footer}</Modal.Footer> : null;
}
renderHeader = () => {
if (!this.props.title) return null;
return (
<Modal.Header closeButton>
<Modal.Title>{this.props.title}</Modal.Title>
</Modal.Header>
);
}
render() {
return (
<Modal className="BH-modal" show={this.props.show} onHide={this.props.onHide}>
{this.renderHeader()}
<Modal.Body className={this.props.addPadding && "BH-modal-padding"}>{this.props.body}</Modal.Body>
{this.renderFooter()}
</Modal>
);
}
}
export default BhModal; |
react/features/participants-pane/components/web/LobbyParticipantItems.js | gpolitis/jitsi-meet | // @flow
import React from 'react';
import { LobbyParticipantItem } from './LobbyParticipantItem';
type Props = {
/**
* Opens a drawer with actions for a knocking participant.
*/
openDrawerForParticipant: Function,
/**
* If a drawer with actions should be displayed.
*/
overflowDrawer: boolean,
/**
* List with the knocking participants.
*/
participants: Array<Object>
}
/**
* Component used to display a list of knocking participants.
*
* @param {Object} props - The props of the component.
* @returns {ReactNode}
*/
function LobbyParticipantItems({ openDrawerForParticipant, overflowDrawer, participants }: Props) {
return (
<div id = 'lobby-list'>
{participants.map(p => (
<LobbyParticipantItem
key = { p.id }
openDrawerForParticipant = { openDrawerForParticipant }
overflowDrawer = { overflowDrawer }
participant = { p } />)
)}
</div>
);
}
// Memoize the component in order to avoid rerender on drawer open/close.
export default React.memo<Props>(LobbyParticipantItems);
|
packages/web/examples/ssr/pages/dynamicrangeslider.js | appbaseio/reactivesearch | import React, { Component } from 'react';
import {
ReactiveBase,
DynamicRangeSlider,
SelectedFilters,
ReactiveList,
} from '@appbaseio/reactivesearch';
import PropTypes from 'prop-types';
import initReactivesearch from '@appbaseio/reactivesearch/lib/server';
import Layout from '../components/Layout';
import BookCard from '../components/BookCard';
const settings = {
app: 'good-books-ds',
url: 'https://a03a1cb71321:75b6603d-9456-4a5a-af6b-a487b309eb61@appbase-demo-ansible-abxiydt-arc.searchbase.io',
enableAppbase: true,
};
const dynamicRangeSliderProps = {
componentId: 'BookSensor',
dataField: 'ratings_count',
defaultValue: () => ({
start: 4000,
end: 8000,
}),
};
const reactiveListProps = {
componentId: 'SearchResult',
dataField: 'original_title',
from: 0,
size: 10,
renderItem: data => <BookCard key={data._id} data={data} />,
react: {
and: ['BookSensor'],
},
};
export default class Main extends Component {
static async getInitialProps() {
return {
store: await initReactivesearch(
[
{
...dynamicRangeSliderProps,
source: DynamicRangeSlider,
},
{
...reactiveListProps,
source: ReactiveList,
},
],
null,
settings,
),
};
}
render() {
return (
<Layout title="SSR | DynamicRangeSlider">
<ReactiveBase {...settings} initialState={this.props.store}>
<div className="row">
<div className="col">
<DynamicRangeSlider {...dynamicRangeSliderProps} />
</div>
<div className="col">
<SelectedFilters />
<ReactiveList {...reactiveListProps} />
</div>
</div>
</ReactiveBase>
</Layout>
);
}
}
Main.propTypes = {
// eslint-disable-next-line
store: PropTypes.object,
};
|
app/components/SearchHeader.js | EleTeam/Shop-React-Native | /**
* ShopReactNative
*
* @author Tony Wong
* @date 2016-08-13
* @email 908601756@qq.com
* @copyright Copyright © 2016 EleTeam
* @license The MIT License (MIT)
*/
import React from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Image,
} from 'react-native';
import Common from '../common/constants';
export default class SearchHeader extends React.Component {
render() {
return (
<View style={styles.headerWrap}>
<TouchableOpacity
activeOpacity={0.75}
style={styles.searchInput}
onPress={this.props.searchAction}
>
<Image
style={styles.searchIcon}
source={require('../images/ic_search.jpg')}
/>
<Text style={styles.searchPlaceholder}>请输入食物名称</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={0.75}
onPress={this.props.scanAction}
>
<Image
style={styles.scanIcon}
source={require('../images/ic_scan.jpg')}
/>
</TouchableOpacity>
</View>
)
}
}
const styles = StyleSheet.create({
headerWrap: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#ff7419',
borderBottomColor: '#ccc',
borderBottomWidth: 0.5,
height: 44,
},
searchInput: {
flexDirection: 'row',
alignItems: 'center',
height: 24,
width: Common.window.width - 30 - 6 * 3,
marginTop: 16,
backgroundColor: '#ff7419',
borderRadius: 2,
},
searchIcon: {
width: 20,
height: 20,
},
scanIcon: {
marginTop: 16,
width: 20,
height: 20,
},
searchPlaceholder: {
marginLeft: 10,
textAlign: 'center',
fontSize: 15,
color: 'gray'
}
}) |
source/demo/ContentBox.js | edulan/react-virtualized | import React from 'react'
import cn from 'classnames'
import styles from './ContentBox.css'
export function ContentBox ({ className, children, style }) {
return (
<div
className={cn(styles.ContentBox, className)}
style={style}
>
{children}
</div>
)
}
export function ContentBoxHeader ({ text, sourceLink, docsLink }) {
const links = []
if (sourceLink) {
links.push(
<a
className={styles.Link}
href={sourceLink}
key='sourceLink'
>
Source
</a>
)
}
if (sourceLink && docsLink) {
links.push(
<span key='separator'> | </span>
)
}
if (docsLink) {
links.push(
<a
className={styles.Link}
href={docsLink}
key='docsLink'
>
Docs
</a>
)
}
return (
<h1 className={styles.Header}>
{text}
{links.length > 0 && (
<small className={styles.Small}>
{links}
</small>
)}
</h1>
)
}
export function ContentBoxParagraph ({ children }) {
return (
<div className={styles.Paragraph}>
{children}
</div>
)
}
|
packages/material-ui-icons/src/ExitToApp.js | AndriusBil/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let ExitToApp = props =>
<SvgIcon {...props}>
<path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" />
</SvgIcon>;
ExitToApp = pure(ExitToApp);
ExitToApp.muiName = 'SvgIcon';
export default ExitToApp;
|
examples/basic/app.js | orokos/react-tabs | import React from 'react';
import { Tab, Tabs, TabList, TabPanel } from '../../lib/main';
const App = React.createClass({
render() {
return (
<div>
<p>
<em>Hint:</em>
<ul>
<li>use keyboard tab to focus tabs</li>
<li>use arrow keys to navigate focused tabs</li>
</ul>
</p>
<Tabs>
<TabList>
<Tab>React</Tab>
<Tab>Ember</Tab>
<Tab>Angular</Tab>
</TabList>
<TabPanel>
<h2>Just The UI</h2>
<p>Lots of people use React as the V in MVC. Since React makes no assumptions about the rest of your technology stack, it's easy to try it out on a small feature in an existing project.</p>
<h2>Virtual DOM</h2>
<p>React uses a virtual DOM diff implementation for ultra-high performance. It can also render on the server using Node.js — no heavy browser DOM required.</p>
<h2>Data Flow</h2>
<p>React implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding.</p>
<p>Source: <a href="http://facebook.github.io/react/" target="_blank">React</a></p>
</TabPanel>
<TabPanel>
<h2>Handlebars</h2>
<p>Write dramatically less code with Ember's Handlebars integrated templates that update automatically when the underlying data changes.</p>
<h2>Architecture</h2>
<p>Don't waste time making trivial choices. Ember.js incorporates common idioms so you can focus on what makes your app special, not reinventing the wheel.</p>
<h2>Productivity</h2>
<p>Ember.js is built for productivity. Designed with developer ergonomics in mind, its friendly APIs help you get your job done—fast.</p>
<p>Source: <a href="http://emberjs.com/" target="_blank">Ember</a></p>
</TabPanel>
<TabPanel>
<h2>Why AngularJS?</h2>
<p>HTML is great for declaring static documents, but it falters when we try to use it for declaring dynamic views in web-applications. AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop.</p>
<h2>Alternatives</h2>
<p>Other frameworks deal with HTML’s shortcomings by either abstracting away HTML, CSS, and/or JavaScript or by providing an imperative way for manipulating the DOM. Neither of these address the root problem that HTML was not designed for dynamic views.</p>
<h2>Extensibility</h2>
<p>AngularJS is a toolset for building the framework most suited to your application development. It is fully extensible and works well with other libraries. Every feature can be modified or replaced to suit your unique development workflow and feature needs. Read on to find out how.</p>
<p>Source: <a href="https://angularjs.org/" target="_blank">Angular</a></p>
</TabPanel>
</Tabs>
<Tabs>
<TabList>
<Tab>Mario</Tab>
<Tab disabled={true}>Luigi</Tab>
<Tab>Peach</Tab>
<Tab>Yoshi</Tab>
</TabList>
<TabPanel>
<p>Mario (Japanese: マリオ Hepburn: Mario?) is a fictional character in the Mario video game franchise by Nintendo, created by Japanese video game designer Shigeru Miyamoto. Serving as Nintendo's mascot and the eponymous protagonist of the series, he has a younger brother Luigi. Mario has appeared in over 200 video games since his creation. Depicted as a short, pudgy, Italian plumber who resides in the Mushroom Kingdom, he repeatedly rescues Princess Peach from the Koopa villain Bowser and stops his numerous plans to destroy him and take over the kingdom.</p>
<p>Source: <a href="http://en.wikipedia.org/wiki/Mario" target="_blank">Wikipedia</a></p>
</TabPanel>
<TabPanel>
<p>Luigi (Japanese: ルイージ Hepburn: Ruīji?) is a fictional character featured in video games and related media released by Nintendo. Created by prominent game designer Shigeru Miyamoto, Luigi is portrayed as the slightly younger but taller fraternal twin brother of Nintendo's mascot Mario, and appears in many games throughout the Mario franchise, frequently as a sidekick to his brother.</p>
<p>Source: <a href="http://en.wikipedia.org/wiki/Luigi" target="_blank">Wikipedia</a></p>
</TabPanel>
<TabPanel>
<p>Princess Peach (Japanese: ピーチ姫 Hepburn: Pīchi-hime?) is a character in Nintendo's Mario franchise. Originally created by Shigeru Miyamoto, Peach is the princess of the fictional Mushroom Kingdom, which is constantly under attack by Bowser. She often plays the damsel in distress role within the series and is the lead female.[1] She is often portrayed as Mario's love interest and has appeared in nearly all the Mario games to date with the notable exception of Super Princess Peach, where she is the main playable character.</p>
</TabPanel>
<TabPanel>
<p>Yoshi (ヨッシー Yosshī?) /ˈjoʊʃi/ or /ˈjɒʃi/, once romanized as Yossy, is a fictional anthropomorphic dinosaur (referred to as a dragon at times) who appears in video games published by Nintendo. He debuted in Super Mario World (1990) on the Super Nintendo Entertainment System as Mario and Luigi's sidekick (a role he has often reprised), and he later established his own series with several platform and puzzle games, including Super Mario World 2: Yoshi's Island. He has also appeared in many of the spin-off Mario games including the Mario Party, the Mario Kart, and the Super Smash Bros. series, as well as in other various Mario sports titles. Yoshi also appears in New Super Mario Bros. Wii (2009) as the characters' companion and steed, similar to his original debut role in Super Mario World. Yoshi belongs to the species of the same name which comes in various colors, with green being the most common.</p>
<p>Source: <a href="http://en.wikipedia.org/wiki/Yoshi" target="_blank">Wikipedia</a></p>
</TabPanel>
</Tabs>
</div>
);
}
});
React.render(<App/>, document.getElementById('example'));
|
app/javascript/mastodon/features/ui/components/list_panel.js | masto-donte-com-br/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { fetchLists } from 'mastodon/actions/lists';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { NavLink, withRouter } from 'react-router-dom';
import Icon from 'mastodon/components/icon';
const getOrderedLists = createSelector([state => state.get('lists')], lists => {
if (!lists) {
return lists;
}
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))).take(4);
});
const mapStateToProps = state => ({
lists: getOrderedLists(state),
});
export default @withRouter
@connect(mapStateToProps)
class ListPanel extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
lists: ImmutablePropTypes.list,
};
componentDidMount () {
const { dispatch } = this.props;
dispatch(fetchLists());
}
render () {
const { lists } = this.props;
if (!lists || lists.isEmpty()) {
return null;
}
return (
<div>
<hr />
{lists.map(list => (
<NavLink key={list.get('id')} className='column-link column-link--transparent' strict to={`/lists/${list.get('id')}`}><Icon className='column-link__icon' id='list-ul' fixedWidth />{list.get('title')}</NavLink>
))}
</div>
);
}
}
|
src/svg-icons/image/filter-vintage.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageFilterVintage = (props) => (
<SvgIcon {...props}>
<path d="M18.7 12.4c-.28-.16-.57-.29-.86-.4.29-.11.58-.24.86-.4 1.92-1.11 2.99-3.12 3-5.19-1.79-1.03-4.07-1.11-6 0-.28.16-.54.35-.78.54.05-.31.08-.63.08-.95 0-2.22-1.21-4.15-3-5.19C10.21 1.85 9 3.78 9 6c0 .32.03.64.08.95-.24-.2-.5-.39-.78-.55-1.92-1.11-4.2-1.03-6 0 0 2.07 1.07 4.08 3 5.19.28.16.57.29.86.4-.29.11-.58.24-.86.4-1.92 1.11-2.99 3.12-3 5.19 1.79 1.03 4.07 1.11 6 0 .28-.16.54-.35.78-.54-.05.32-.08.64-.08.96 0 2.22 1.21 4.15 3 5.19 1.79-1.04 3-2.97 3-5.19 0-.32-.03-.64-.08-.95.24.2.5.38.78.54 1.92 1.11 4.2 1.03 6 0-.01-2.07-1.08-4.08-3-5.19zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"/>
</SvgIcon>
);
ImageFilterVintage = pure(ImageFilterVintage);
ImageFilterVintage.displayName = 'ImageFilterVintage';
ImageFilterVintage.muiName = 'SvgIcon';
export default ImageFilterVintage;
|
app/components/LoadingIndicator/index.js | fascinating2000/productFrontend | import React from 'react';
import Circle from './Circle';
import Wrapper from './Wrapper';
const LoadingIndicator = () => (
<Wrapper>
<Circle />
<Circle rotate={30} delay={-1.1} />
<Circle rotate={60} delay={-1} />
<Circle rotate={90} delay={-0.9} />
<Circle rotate={120} delay={-0.8} />
<Circle rotate={150} delay={-0.7} />
<Circle rotate={180} delay={-0.6} />
<Circle rotate={210} delay={-0.5} />
<Circle rotate={240} delay={-0.4} />
<Circle rotate={270} delay={-0.3} />
<Circle rotate={300} delay={-0.2} />
<Circle rotate={330} delay={-0.1} />
</Wrapper>
);
export default LoadingIndicator;
|
src/components/DeviceAddButton.js | brnewby602/kinects-it | import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import { NavLink } from './NavLink';
export const DeviceAddButton = () => (
<div>
<NavLink to="/add-device">
<RaisedButton label="Add Device" />
</NavLink>
</div>
);
|
src/App.js | AlanMorel/aria | import React from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import Axios from 'axios';
import Config from './Config';
import About from './components/about/About';
import AdminPanel from './components/adminpanel/AdminPanel';
import Disclaimer from './components/disclaimer/Disclaimer';
import Footer from './components/footer/Footer';
import Home from './components/home/Home';
import Header from './components/navigation/header/Header';
import News from './components/news/News';
import Post from './components/post/Post';
import Rankings from './components/rankings/Rankings';
import Vote from './components/vote/Vote';
import './stylesheets/App.css';
class App extends React.Component {
constructor(props) {
super(props);
Axios.defaults.baseURL = Config.base_url;
this.setLogin = this.setLogin.bind(this);
this.state = {
logged_in: false,
username: "",
gm_level: 0
};
}
componentDidMount() {
Axios.get("").then(response => {
console.log(response.data);
this.setState(response.data);
});
}
setLogin(status) {
console.log("Setting new login status");
console.log(status);
this.setState(status);
}
render() {
var VotePage = (props) => {
return <Vote status={this.state}/>;
}
var AdminPanelPage = (props) => {
return <AdminPanel status={this.state}/>;
}
return (
<Router>
<div>
<Header status={this.state} setLogin={this.setLogin}/>
<Route exact path="/" component={Home}/>
<Route exact path="/about" component={About}/>
<Route exact path="/disclaimer" component={Disclaimer}/>
<Route exact path="/news" component={News}/>
<Route exact path="/news/:param1" component={News}/>
<Route exact path="/news/:param1/:param2" component={News}/>
<Route exact path="/post" component={Post}/>
<Route exact path="/post/:id" component={Post}/>
<Route exact path="/post/:id/:mode" component={Post}/>
<Route exact path="/rankings" component={Rankings}/>
<Route exact path="/rankings/:param1" component={Rankings}/>
<Route exact path="/rankings/:param1/:param2" component={Rankings}/>
<Route exact path="/rankings/:param1/:param2/:param3" component={Rankings}/>
<Route exact path="/vote" component={VotePage}/>
<Route exact path="/adminpanel" component={AdminPanelPage}/>
<Footer/>
</div>
</Router>
);
};
}
export default App
|
src/svg-icons/maps/local-taxi.js | mmrtnz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalTaxi = (props) => (
<SvgIcon {...props}>
<path d="M18.92 6.01C18.72 5.42 18.16 5 17.5 5H15V3H9v2H6.5c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"/>
</SvgIcon>
);
MapsLocalTaxi = pure(MapsLocalTaxi);
MapsLocalTaxi.displayName = 'MapsLocalTaxi';
MapsLocalTaxi.muiName = 'SvgIcon';
export default MapsLocalTaxi;
|
client/routes/routes.js | alexpalombaro/react-redux-starter-kit | import {Route} from 'react-router';
import React from 'react';
import {CoreLayout} from 'layouts';
import {HomeView, UserEditView, NotFoundView} from 'views';
export default (
<Route component={CoreLayout}>
<Route name='home' path='/' component={HomeView}/>
<Route path='edit' component={UserEditView}/>
<Route path='*' component={NotFoundView}/>
</Route>
);
|
src/routes/decisionDestroyer/MobileNav.js | goldylucks/adamgoldman.me | // @flow
import React from 'react'
import ClickOutside from 'react-click-outside'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import faBars from '@fortawesome/free-solid-svg-icons/faBars'
import cx from 'classnames'
import withStyles from 'isomorphic-style-loader/lib/withStyles'
import history from '../../history'
import './MobileNav.css'
type Props = {
items: [],
title: '',
onItemClick: Function,
}
type State = {
isOpen: boolean,
}
class MobileNav extends React.Component<Props, State> {
state = {
isOpen: false,
}
componentDidMount() {
history.listen(() => {
if (this.state.isOpen) {
this.close()
}
})
}
render() {
return (
<ClickOutside
onClickOutside={this.close}
className='clearfix d-sm-block d-lg-none'
>
<span style={{ cursor: 'pointer' }}>
<FontAwesomeIcon
icon={faBars}
style={{ marginRight: 10 }}
onClick={this.toggle}
/>
</span>
<div className={cx(s.mobileMenu, { [s.isOpen]: this.state.isOpen })}>
<nav>
<h3 className={s.mobileMenuHeadline} onClick={this.toggle}>
{this.props.title}
</h3>
<ul className='navbar-nav'>
{this.props.items.map(({ text, nodeId }) => (
<li className='nav-item' key={nodeId}>
<a
className='nav-link'
onClick={() => this.onItemClick(nodeId)}
>
{text}
</a>
</li>
))}
<li className='nav-item'>
<a
className='nav-link btn btn-primary btn-sm'
onClick={() => this.props.onItemClick('elBuyNow')}
>
Claim Access
</a>
</li>
</ul>
</nav>
</div>
</ClickOutside>
)
}
onItemClick(nodeId) {
this.close()
this.props.onItemClick(nodeId)
}
toggle = () => this.setState({ isOpen: !this.state.isOpen })
close = () => this.setState({ isOpen: false })
}
export default withStyles(s)(MobileNav)
|
stories/Pagination.stories.js | algolia/react-instantsearch | import React from 'react';
import { storiesOf } from '@storybook/react';
import { boolean, number } from '@storybook/addon-knobs';
import { Panel, Pagination, SearchBox } from 'react-instantsearch-dom';
import { WrapWithHits } from './util';
const stories = storiesOf('Pagination', module);
stories
.add('default', () => (
<WrapWithHits hasPlayground={true} linkedStoryGroup="Pagination.stories.js">
<Pagination />
</WrapWithHits>
))
.add('with all props', () => (
<WrapWithHits hasPlayground={true} linkedStoryGroup="Pagination.stories.js">
<Pagination
showFirst={true}
showLast={true}
showPrevious={true}
showNext={true}
padding={2}
totalPages={3}
/>
</WrapWithHits>
))
.add('playground', () => (
<WrapWithHits linkedStoryGroup="Pagination.stories.js">
<Pagination
showFirst={boolean('show First', true)}
showLast={boolean('show Last', true)}
showPrevious={boolean('show Previous', true)}
showNext={boolean('show Next', true)}
padding={number('pages Padding', 2)}
totalPages={number('max Pages', 3)}
/>
</WrapWithHits>
))
.add('with Panel', () => (
<WrapWithHits hasPlayground={true} linkedStoryGroup="Pagination.stories.js">
<Panel header="Pagination" footer="Footer">
<Pagination />
</Panel>
</WrapWithHits>
))
.add('with Panel but no refinement', () => (
<WrapWithHits
searchBox={false}
hasPlayground={true}
linkedStoryGroup="Pagination.stories.js"
>
<Panel header="Pagination" footer="Footer">
<Pagination header="Pagination" />
</Panel>
<div style={{ display: 'none' }}>
<SearchBox defaultRefinement="ds" />
</div>
</WrapWithHits>
));
|
src/components/shapes/index.js | cgrinker/Akkad | import React from 'react';
import ShapeFactory from './ShapeFactory';
// import Sphere from "./Sphere";
// import Box from "./Box";
// import Disc from "./Disc";
// import Ground from "./Ground";
// import GroundFromHeightMap from "./GroundFromHeightMap";
// import Cylinder from "./Cylinder";
// import Torus from "./Torus";
// import Lines from "./Lines";
// import DashedLines from "./DashedLines";
// export default {
// Sphere,
// Box,
// Disc,
// Ground,
// GroundFromHeightMap,
// Cylinder,
// Torus,
// Lines,
// DashedLines
// };
const shapes = [
'Box',
'Sphere',
'IcoSphere',
'Ribbon',
'Cylinder',
'Torus',
'TorusKnot',
'LineSystem',
'Lines',
'DashedLines',
'Lathe',
'Ground',
'TiledGround',
'Tube',
'Polyhedron',
'GroundFromHeightMap'
];
export default shapes.reduce((acc, shape) => {
acc[shape] = (props) => {return <ShapeFactory type={shape} {...props} />;};
return acc;
}, {});
/*
export default {
Box(props){return <ShapeFactory type={'Box'} {...props} />;},
Sphere(props){return <ShapeFactory type={'Sphere'} {...props} />;},
IcoSphere(props){return <ShapeFactory type={'IcoSphere'} {...props} />;},
Ribbon(props){return <ShapeFactory type={'Ribbon'} {...props} />;},
Cylinder(props){return <ShapeFactory type={'Cylinder'} {...props} />;},
Torus(props){return <ShapeFactory type={'Torus'} {...props} />;},
TorusKnot(props){return <ShapeFactory type={'TorusKnot'} {...props} />;},
LineSystem(props){return <ShapeFactory type={'LineSystem'} {...props} />;},
DashedLines(props){return <ShapeFactory type={'DashedLines'} {...props} />;},
Lines(props){return <ShapeFactory type={'Lines'} {...props} />;},
Lathe(props){return <ShapeFactory type={'Lathe'} {...props} />;},
Plane(props){return <ShapeFactory type={'Plane'} {...props} />;},
Ground(props){return <ShapeFactory type={'Ground'} {...props} />;},
TiledGround(props){return <ShapeFactory type={'TiledGround'} {...props} />;},
Tube(props){return <ShapeFactory type={'Tube'} {...props} />;},
Polyhedron(props){return <ShapeFactory type={'Polyhedron'} {...props} />;},
GroundFromHeightMap(props){return <ShapeFactory type={'GroundFromHeightMap'} {...props} />;}
};
*/
|
src/client/routes.js | MizzKii/redux-todo | import React from 'react'
import { Route, Redirect } from 'react-router'
import { App, TodoList, TodoForm } from './components'
export default (
<Route component={App} >
<Route path="/view" component={TodoList} />
<Route path="/add" component={TodoForm} />
<Route path="/edit/:id" component={TodoForm} />
<Redirect from="*" to="/view" />
</Route>
)
|
src/snack-overflow/emcit/client/desktop/src/components/views/analyze/ReportTablePage.js | civiclee/Hack4Cause2017 | import React from 'react'
import { connect } from 'react-redux'
import { Table, TableHead, TableRow, TableCell } from 'react-toolbox';
import { getReports } from 'api';
const ReportModel = {
date: { type: String },
location: { type: String },
room_number: { type: String }
}
class ReportTablePage extends React.Component {
componentWillMount() {
}
renderVehicle(vehicle) {
return (
<div>
<div>{vehicle.color} {vehicle.make} {vehicle.model}</div>
</div>
)
}
renderPerson({ sex, eye_color, hair_length, hair_color, weight }) {
const getEyes = () => eye_color ? eye_color.replace('_',' ') + ' eyes' : '';
const getHair = () => {
const color = hair_color ? hair_color.replace('_',' ') : null;
const vals = [hair_length, color].filter(v => !!v);
if (vals.length > 0)
return vals.join(' ') + ' hair'
return ''
}
return (
<div>
{sex} with {getEyes()} {getHair()} weighing {weight}lbs
</div>
)
}
render() {
return (
<Table selectable={false}>
<TableHead>
<TableCell>Created At</TableCell>
<TableCell>Vehicle(s)</TableCell>
<TableCell>Suspicious Person(s)</TableCell>
<TableCell>Victim(s)</TableCell>
<TableCell>Location</TableCell>
<TableCell>Room Number</TableCell>
</TableHead>
{this.props.list.map((report, idx) => (
<TableRow key={idx}>
<TableCell>{report.date}</TableCell>
<TableCell>{report.vehicles.map(this.renderVehicle)}</TableCell>
<TableCell>{report.people.filter(p => p.category === 'victim').map(this.renderPerson)}</TableCell>
<TableCell>{report.people.filter(p => p.category === 'suspicious_person' || p.category === 'buyer').map(this.renderPerson)}</TableCell>
<TableCell>{report.location}</TableCell>
<TableCell>{report.room_number}</TableCell>
</TableRow>
))}
</Table>
);
}
}
const mapStateToProps = ({ reports: { list } }) => ({ list });
export default connect(mapStateToProps, {
})(ReportTablePage);
|
components/StructuredList.js | hellobrian/carbon-components-react | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import uid from '../lib/uniqueId';
class StructuredListWrapper extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
border: PropTypes.bool,
selection: PropTypes.bool,
};
static defaultProps = {
border: false,
selection: false,
};
render() {
const { children, selection, className, border, ...other } = this.props;
const classes = classNames('bx--structured-list', className, {
'bx--structured-list--border': border,
'bx--structured-list--selection': selection,
});
return (
<section className={classes} {...other}>
{children}
</section>
);
}
}
class StructuredListHead extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
};
render() {
const { children, className, ...other } = this.props;
const classes = classNames('bx--structured-list-thead', className);
return (
<div className={classes} {...other}>
{children}
</div>
);
}
}
class StructuredListInput extends Component {
static propTypes = {
className: PropTypes.string,
id: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
name: PropTypes.string,
title: PropTypes.string,
defaultChecked: PropTypes.bool,
onChange: PropTypes.func,
};
static defaultProps = {
onChange: () => {},
value: 'value',
title: 'title',
};
componentWillMount() {
this.uid = this.props.id || uid();
}
render() {
const { className, value, name, title, ...other } = this.props;
const classes = classNames('bx--structured-list-input', className);
return (
<input
{...other}
type="radio"
tabIndex={-1}
id={this.uid}
className={classes}
value={value}
name={name}
title={title}
/>
);
}
}
class StructuredListRow extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
head: PropTypes.bool,
label: PropTypes.bool,
htmlFor: PropTypes.string,
tabIndex: PropTypes.number,
onKeyDown: PropTypes.func,
};
static defaultProps = {
htmlFor: 'unique id',
head: false,
label: false,
tabIndex: 0,
onKeyDown: () => {},
};
render() {
const {
onKeyDown,
tabIndex,
htmlFor,
children,
className,
head,
label,
...other
} = this.props;
const classes = classNames('bx--structured-list-row', className, {
'bx--structured-list-row--header-row': head,
});
return label ? (
<label
{...other}
tabIndex={tabIndex}
className={classes}
htmlFor={htmlFor}
onKeyDown={onKeyDown}>
{children}
</label>
) : (
<div {...other} className={classes}>
{children}
</div>
);
}
}
class StructuredListBody extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
head: PropTypes.bool,
onKeyDown: PropTypes.func,
};
static defaultProps = {
onKeyDown: () => {},
};
state = {
labelRows: null,
rowSelected: 0,
};
render() {
const { children, className, ...other } = this.props;
const classes = classNames('bx--structured-list-tbody', className);
return (
<div className={classes} {...other}>
{children}
</div>
);
}
}
class StructuredListCell extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
head: PropTypes.bool,
noWrap: PropTypes.bool,
};
static defaultProps = {
head: false,
noWrap: false,
};
render() {
const { children, className, head, noWrap, ...other } = this.props;
const classes = classNames(className, {
'bx--structured-list-th': head,
'bx--structured-list-td': !head,
'bx--structured-list-content--nowrap': noWrap,
});
return (
<div className={classes} {...other}>
{children}
</div>
);
}
}
export {
StructuredListWrapper,
StructuredListHead,
StructuredListBody,
StructuredListRow,
StructuredListInput,
StructuredListCell,
};
|
actor-apps/app-web/src/app/components/JoinGroup.react.js | way1989/actor-platform | import React from 'react';
import requireAuth from 'utils/require-auth';
import DialogActionCreators from 'actions/DialogActionCreators';
import JoinGroupActions from 'actions/JoinGroupActions';
import JoinGroupStore from 'stores/JoinGroupStore'; // eslint-disable-line
class JoinGroup extends React.Component {
static propTypes = {
params: React.PropTypes.object
};
static contextTypes = {
router: React.PropTypes.func
};
constructor(props) {
super(props);
JoinGroupActions.joinGroup(props.params.token)
.then((peer) => {
this.context.router.replaceWith('/');
DialogActionCreators.selectDialogPeer(peer);
}).catch((e) => {
console.warn(e, 'User is already a group member');
this.context.router.replaceWith('/');
});
}
render() {
return null;
}
}
export default requireAuth(JoinGroup);
|
extensions/chat/client.js | axax/lunuc | import React from 'react'
import Hook from 'util/hook'
import Async from 'client/components/Async'
import {CHAT_BASE_URL} from './constants'
const ChatContainer = (props) => <Async {...props} load={import(/* webpackChunkName: "admin" */ './containers/ChatContainer')} />
const ChatIcon = (props) => <Async {...props} expose="ChatIcon" load={import(/* webpackChunkName: "admin" */ '../../gensrc/ui/admin')} />
export default () => {
// add routes for this extension
Hook.on('Routes', ({routes}) => {
routes.push({exact: true, path: CHAT_BASE_URL + '/:id*', component: ChatContainer})
})
// add entry to main menu
Hook.on('MenuMenu', ({menuItems}) => {
menuItems.push({name: 'Chats', to: CHAT_BASE_URL, auth: true, icon: <ChatIcon />})
})
Hook.on('JsonDom', ({components}) => {
components['ChatContainer'] = ChatContainer
})
}
|
src/container/profilePopup.js | thipokKub/Clique-WebFront-Personnal | /* eslint-disable */
import React, { Component } from 'react';
import autoBind from '../hoc/autoBind';
class profilePopup extends Component {
// constructor(props) {
// super(props);
// }
onExit() {
this.props.toggle_pop_item();
}
render() {
return (
<div>
<div className="profile-popup">
<div>
<div>
<img src="../resource/images/dummyProfile.png" alt="profile-pic" />
</div>
<div className="profile-head" aria-hidden="true">
<h2 alt="profile-name">Mitsuha Atchula</h2>
<div><div alt="faculty-icon" /> <p>Faculty of Engineering</p></div>
</div>
</div>
<div className="profile-section">
<h4>YOUR UPCOMING EVENT</h4>
<div className="my-event1">
<div alt="event-icon" /> <p><strong>Event Name</strong> Tomorrow </p>
</div>
<div className="my-event2">
<div alt="event-icon" /> <p><strong>Event Name</strong> 1 Feb 2016 </p>
</div>
<div className="my-event3">
<div alt="event-icon" /> <p><strong>Event Name</strong> 5 May 2017 </p>
</div>
</div>
<div className="profile-section">
<h4>NOTIFICATION</h4>
<div className="my-noti">
<img src="../resource/images/dummyProfile.png" alt="noti-icon" />
<p><strong>Taki</strong> invite you to join <strong>"Event Name"</strong></p>
</div>
</div>
</div>
<p className="hr"></p>
<div className="btn-profile">
<button alt="btn-myevent">MY EVENT</button>
<button alt="btn-logout">LOG OUT</button>
</div>
</div>
);
}
}
export default autoBind(profilePopup);
|
src/components/StructuredList/StructuredList-story.js | joshblack/carbon-components-react | /**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import { storiesOf } from '@storybook/react';
import CheckmarkFilled16 from '@carbon/icons-react/lib/checkmark--filled/16';
import {
StructuredListWrapper,
StructuredListHead,
StructuredListBody,
StructuredListRow,
StructuredListInput,
StructuredListCell,
} from '../StructuredList';
import StructuredListSkeleton from '../StructuredList/StructuredList.Skeleton';
storiesOf('StructuredList', module)
.add(
'Simple',
() => (
<StructuredListWrapper>
<StructuredListHead>
<StructuredListRow head>
<StructuredListCell head>ColumnA</StructuredListCell>
<StructuredListCell head>ColumnB</StructuredListCell>
<StructuredListCell head>ColumnC</StructuredListCell>
</StructuredListRow>
</StructuredListHead>
<StructuredListBody>
<StructuredListRow>
<StructuredListCell noWrap>Row 1</StructuredListCell>
<StructuredListCell>Row 1</StructuredListCell>
<StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui
magna, finibus id tortor sed, aliquet bibendum augue. Aenean
posuere sem vel euismod dignissim. Nulla ut cursus dolor.
Pellentesque vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow>
<StructuredListRow>
<StructuredListCell noWrap>Row 2</StructuredListCell>
<StructuredListCell>Row 2</StructuredListCell>
<StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui
magna, finibus id tortor sed, aliquet bibendum augue. Aenean
posuere sem vel euismod dignissim. Nulla ut cursus dolor.
Pellentesque vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow>
</StructuredListBody>
</StructuredListWrapper>
),
{
info: {
text: `
Structured Lists group content that is similar or related, such as terms or definitions.
`,
},
}
)
.add(
'Selection',
() => {
const structuredListBodyRowGenerator = numRows => {
return Array.apply(null, Array(numRows)).map((n, i) => (
<StructuredListRow label key={`row-${i}`} htmlFor={`row-${i}`}>
<StructuredListCell>Row {i}</StructuredListCell>
<StructuredListCell>Row {i}</StructuredListCell>
<StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui
magna, finibus id tortor sed, aliquet bibendum augue. Aenean
posuere sem vel euismod dignissim. Nulla ut cursus dolor.
Pellentesque vulputate nisl a porttitor interdum.
</StructuredListCell>
<StructuredListInput
id={`row-${i}`}
value={`row-${i}`}
title={`row-${i}`}
name="row-0"
defaultChecked={!i || null}
/>
<StructuredListCell>
<CheckmarkFilled16
className="bx--structured-list-svg"
aria-label="select an option">
<title>select an option</title>
</CheckmarkFilled16>
</StructuredListCell>
</StructuredListRow>
));
};
return (
<StructuredListWrapper selection border>
<StructuredListHead>
<StructuredListRow head>
<StructuredListCell head>ColumnA</StructuredListCell>
<StructuredListCell head>ColumnB</StructuredListCell>
<StructuredListCell head>ColumnC</StructuredListCell>
<StructuredListCell head>{''}</StructuredListCell>
</StructuredListRow>
</StructuredListHead>
<StructuredListBody>
{structuredListBodyRowGenerator(4)}
</StructuredListBody>
</StructuredListWrapper>
);
},
{
info: {
text: `
Structured Lists with selection allow a row of list content to be selected.
`,
},
}
)
.add(
'skeleton',
() => (
<div style={{ width: '800px' }}>
<StructuredListSkeleton />
<StructuredListSkeleton border />
</div>
),
{
info: {
text: `
Placeholder skeleton state to use when content is loading.
`,
},
}
);
|
src/svg-icons/maps/place.js | spiermar/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsPlace = (props) => (
<SvgIcon {...props}>
<path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
</SvgIcon>
);
MapsPlace = pure(MapsPlace);
MapsPlace.displayName = 'MapsPlace';
MapsPlace.muiName = 'SvgIcon';
export default MapsPlace;
|
src/components/wrapper/index.js | chuckharmston/testpilot-contribute | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './index.css';
export class Wrapper extends Component {
static propTypes = {
extraClass: PropTypes.string.isRequired
};
render() {
const { children, extraClass, innerStyles } = this.props;
return (
<div className={`wrapper wrapper--${extraClass}`}>
<div className="wrapper--inner" style={innerStyles}>
{children}
</div>
</div>
);
}
}
export class Width extends Component {
static propTypes = {
minWidth: PropTypes.string,
width: PropTypes.string
};
getStyle() {
return ['minWidth', 'width'].reduce((accum, item) => {
if (this.props.hasOwnProperty(item)) {
accum[item] = this.props[item];
}
return accum;
}, {});
}
render() {
const { chidlren } = this.props;
return (
<div style={this.getStyle()}>
{children}
</div>
);
}
}
|
templates/frontOffice/modern/components/React/SubmitButton/index.js | Lucanis/thelia | import Loader from '../Loader';
import React from 'react';
export default function SubmitButton({
label,
isSubmitting,
onClick = () => {},
className,
...props
}) {
return (
<button
className={`btn relative ${className ? className : ''}`}
onClick={onClick}
type="button"
{...props}
>
{isSubmitting ? (
<div className="absolute inset-0 flex items-center justify-center">
<Loader size="w-6 h-6" color="text-white" />
</div>
) : null}
<div className={`${isSubmitting ? 'opacity-0' : ''}`}>{label}</div>
</button>
);
}
|
app/app.js | thecodingwhale/conduit-clone | /**
* app.js
*
* This is the entry file for the application, only setup and boilerplate
* code.
*/
// Needed for redux-saga es6 generator support
import 'babel-polyfill';
// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
import createHistory from 'history/createBrowserHistory';
import 'sanitize.css/sanitize.css';
import 'bootstrap/dist/css/bootstrap.css';
// Import root app
import App from 'containers/App';
// Import Language Provider
import LanguageProvider from 'containers/LanguageProvider';
// Load the favicon, the manifest.json file and the .htaccess file
/* eslint-disable import/no-unresolved, import/extensions */
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import '!file-loader?name=[name].[ext]!./images/icon-72x72.png';
import '!file-loader?name=[name].[ext]!./images/icon-96x96.png';
import '!file-loader?name=[name].[ext]!./images/icon-128x128.png';
import '!file-loader?name=[name].[ext]!./images/icon-144x144.png';
import '!file-loader?name=[name].[ext]!./images/icon-152x152.png';
import '!file-loader?name=[name].[ext]!./images/icon-192x192.png';
import '!file-loader?name=[name].[ext]!./images/icon-384x384.png';
import '!file-loader?name=[name].[ext]!./images/icon-512x512.png';
import '!file-loader?name=[name].[ext]!./manifest.json';
import 'file-loader?name=[name].[ext]!./.htaccess';
/* eslint-enable import/no-unresolved, import/extensions */
import configureStore from './configureStore';
// Import i18n messages
import { translationMessages } from './i18n';
// Import CSS reset and Global Styles
import './global-styles';
// Create redux store with history
const initialState = {};
const history = createHistory();
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');
const render = (messages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={messages}>
<ConnectedRouter history={history}>
<App />
</ConnectedRouter>
</LanguageProvider>
</Provider>,
MOUNT_NODE
);
};
if (module.hot) {
// Hot reloadable React components and translation json files
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept(['./i18n', 'containers/App'], () => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE);
render(translationMessages);
});
}
// Chunked polyfill for browsers without Intl support
if (!window.Intl) {
(new Promise((resolve) => {
resolve(import('intl'));
}))
.then(() => Promise.all([
import('intl/locale-data/jsonp/en.js'),
]))
.then(() => render(translationMessages))
.catch((err) => {
throw err;
});
} else {
render(translationMessages);
}
// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
if (process.env.NODE_ENV === 'production') {
require('offline-plugin/runtime').install(); // eslint-disable-line global-require
}
|
src/js/components/ui/reduxForm/Fieldset.js | knowncitizen/tripleo-ui | /**
* Copyright 2017 Red Hat Inc.
*
* 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 PropTypes from 'prop-types';
import React from 'react';
const Fieldset = ({ children, legend, ...other }) => (
<fieldset className="fields-section-pf" {...other}>
{legend && <legend className="fields-section-header-pf">{legend}</legend>}
{children}
</fieldset>
);
Fieldset.propTypes = {
children: PropTypes.node,
legend: PropTypes.node
};
export default Fieldset;
|
inc/option_fields/vendor/htmlburger/carbon-fields/assets/js/fields/components/radio/index.js | wpexpertsio/WP-Secure-Maintainance | /**
* The external dependencies.
*/
import React from 'react';
import PropTypes from 'prop-types';
import {
compose,
withHandlers,
branch,
renderComponent,
setStatic
} from 'recompose';
/**
* The internal dependencies.
*/
import Field from 'fields/components/field';
import NoOptions from 'fields/components/no-options';
import withStore from 'fields/decorators/with-store';
import withSetup from 'fields/decorators/with-setup';
import { TYPE_RADIO } from 'fields/constants';
/**
* Render a radio input field.
*
* @param {Object} props
* @param {String} props.name
* @param {Object} props.field
* @param {Function} props.handleChange
* @param {Function} props.isChecked
* @return {React.Element}
*/
export const RadioField = ({
name,
field,
handleChange,
isChecked
}) => {
return <Field field={field}>
<ul className="carbon-radio-list">
{
field.options.map((option, index) => (
<li key={index}>
<label>
<input
type="radio"
name={name}
value={option.value}
checked={isChecked(option)}
disabled={!field.ui.is_visible}
onChange={handleChange(option)}
{...field.attributes} />
{option.name}
</label>
</li>
))
}
</ul>
</Field>;
}
/**
* Validate the props.
*
* @type {Object}
*/
RadioField.propTypes = {
name: PropTypes.string,
field: PropTypes.shape({
attributes: PropTypes.object,
options: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
})),
}),
handleChange: PropTypes.func,
};
/**
* The enhancer.
*
* @type {Function}
*/
export const enhance = compose(
/**
* Connect to the Redux store.
*/
withStore(),
/**
* Render "No-Options" component when the field doesn't have options.
*/
branch(
/**
* Test to see if the "No-Options" should be rendered.
*/
({ field: { options } }) => options && options.length,
/**
* Render the actual field.
*/
compose(
/**
* Attach the setup hooks.
*/
withSetup(),
/**
* Pass some handlers to the component.
*/
withHandlers({
handleChange: ({ field, setFieldValue }) => ({ value }) => () => setFieldValue(field.id, value),
isChecked: ({ field }) => option => option.value === field.value,
})
),
/**
* Render the empty component.
*/
renderComponent(NoOptions)
)
);
export default setStatic('type', [
TYPE_RADIO,
])(enhance(RadioField));
|
src/TextField/TextFieldHint.js | IsenrichO/mui-with-arrows | import React from 'react';
import PropTypes from 'prop-types';
import transitions from '../styles/transitions';
function getStyles(props) {
const {
muiTheme: {
textField: {
hintColor,
},
},
show,
} = props;
return {
root: {
position: 'absolute',
opacity: show ? 1 : 0,
color: hintColor,
transition: transitions.easeOut(),
bottom: 12,
},
};
}
const TextFieldHint = (props) => {
const {
muiTheme: {
prepareStyles,
},
style,
text,
} = props;
const styles = getStyles(props);
return (
<div style={prepareStyles(Object.assign(styles.root, style))}>
{text}
</div>
);
};
TextFieldHint.propTypes = {
/**
* @ignore
* The material-ui theme applied to this component.
*/
muiTheme: PropTypes.object.isRequired,
/**
* True if the hint text should be visible.
*/
show: PropTypes.bool,
/**
* Override the inline-styles of the root element.
*/
style: PropTypes.object,
/**
* The hint text displayed.
*/
text: PropTypes.node,
};
TextFieldHint.defaultProps = {
show: true,
};
export default TextFieldHint;
|
demo/src/components/App/components/Examples/Examples.js | JacksonKearl/react-autosuggest-ie11-compatible | import styles from './Examples.less';
import React from 'react';
import Basic from 'Basic/Basic';
import MultipleSections from 'MultipleSections/MultipleSections';
import CustomRender from 'CustomRender/CustomRender';
import ScrollableContainer from 'ScrollableContainer/ScrollableContainer';
const Examples = () =>
<div className={styles.container}>
<h2 className={styles.header}>
Examples
</h2>
<Basic />
<MultipleSections />
<CustomRender />
<ScrollableContainer />
</div>;
export default Examples;
|
packages/mineral-ui-icons/src/IconLocalLibrary.js | mineral-ui/mineral-ui | /* @flow */
import React from 'react';
import Icon from 'mineral-ui/Icon';
import type { IconProps } from 'mineral-ui/Icon/types';
/* eslint-disable prettier/prettier */
export default function IconLocalLibrary(props: IconProps) {
const iconProps = {
rtl: false,
...props
};
return (
<Icon {...iconProps}>
<g>
<path d="M12 11.55C9.64 9.35 6.48 8 3 8v11c3.48 0 6.64 1.35 9 3.55 2.36-2.19 5.52-3.55 9-3.55V8c-3.48 0-6.64 1.35-9 3.55zM12 8c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z"/>
</g>
</Icon>
);
}
IconLocalLibrary.displayName = 'IconLocalLibrary';
IconLocalLibrary.category = 'maps';
|
src/main.js | LEINWAND/cordova-react-redux-app | /* @flow */
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { Router, Route, browserHistory, IndexRoute } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import configureStore from './store/configureStore'
import App from './containers/App'
import Home from './containers/Home'
import Login from './containers/Login'
import NoMatch from './containers/NoMatch'
const store = configureStore()
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store)
const AppRouter = () => {
return (
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
</Route>
<Route path="login" component={Login} />
<Route path="*" component={NoMatch} />
</Router>
)
}
// TODO: document this
if (module.hot) {
(module.hot: any).accept()
}
render(
<Provider store={store}>
<AppRouter />
</Provider>,
document.querySelector('#leinwand')
)
|
src/components/Navigation.js | Montana-Code-School/LifeCoach | import React from 'react';
import { Link } from 'react-router';
import { observer, inject } from 'mobx-react';
import { Navbar, Nav, NavItem, NavDropdown } from 'react-bootstrap';
import { NavbarHeader, NavbarToggle, NavbarCollapse, NavbarBrand } from 'react-bootstrap/lib/NavbarHeader';
import { LinkContainer } from 'react-router-bootstrap';
class Navigation extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="navigationBar">
<Navbar collapseOnSelect style={{backgroundColor:'white'}}>
<Navbar.Header>
<Navbar.Brand>
<Link to="/home" className="lifecoach-header" style={{color:'#F9A603'}}>Life Coach</Link>
</Navbar.Brand>
<Navbar.Toggle/>
</Navbar.Header>
<Navbar.Collapse>
<Nav>
<LinkContainer to={{pathname: '/wheel'}}>
<NavItem>
<i style={{color:'#F70025'}} className="fa fa-pie-chart fa-lg" aria-hidden="true"></i>
</NavItem>
</LinkContainer>
<LinkContainer to={{pathname: '/lifegoals'}}>
<NavItem>
<i style={{color:'#F25C00'}} className="fa fa-heart fa-lg" aria-hidden="true"></i>
</NavItem>
</LinkContainer>
<LinkContainer to={{pathname: '/history'}}>
<NavItem>
<i style={{color:'#FC354F'}} className="fa fa-database fa-lg" aria-hidden="true"></i>
</NavItem>
</LinkContainer>
</Nav>
<Nav pullRight className="nav-bar-right">
<Navbar.Text style={{color: "black"}}>
<i className="fa fa-user fa-lg" aria-hidden="true"></i> Welcome, {this.props.userStore.firstName}!
</Navbar.Text>
<LinkContainer onClick={this.props.userStore.logUserOut} to={{pathname: '/'}}>
<NavItem>
<i style={{color: "black"}} className="fa fa-sign-out fa-lg" aria-hidden="true"></i>
</NavItem>
</LinkContainer>
</Nav>
</Navbar.Collapse>
</Navbar>
</div>
);
}
}
Navigation.propTypes = {
userStore: React.PropTypes.object,
logUserOut: React.PropTypes.func
};
export default inject("userStore")(observer(Navigation));
|
chapter-11/react_router_chunked/src/pages/App.js | mocheng/react-and-redux | import React from 'react';
import {view as TopMenu} from '../components/TopMenu';
const App = ({children}) => {
return (
<div>
<TopMenu />
<div>{children}</div>
</div>
);
};
export default App;
|
src/js/components/chart/Axis.js | linde12/grommet | // (C) Copyright 2014-2016 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';
const CLASS_ROOT = CSSClassnames.CHART_AXIS;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class Axis extends Component {
constructor(props, context) {
super(props, context);
this.state = {
items: this._buildItems(props)
};
}
componentWillReceiveProps (nextProps) {
this.setState({ items: this._buildItems(nextProps) });
}
_buildItems (props) {
const { count, labels } = props;
let items = [];
const basis = 100.0 / (count - 1);
for (let index=0; index<count; index+=1) {
let item;
if (labels) {
const labelItem = labels.filter(item => item.index === index)[0];
if (labelItem) {
// clone since we're decorating something the user provided
item = { ...labelItem };
}
}
if (! item) {
item = { index: index };
}
if (0 === index) {
item.basis = basis / 2;
} else if (1 === index) {
item.basis = basis / 2;
} else {
item.basis = basis;
}
items.push(item);
}
return items;
}
render () {
const {
a11yTitle, align, className, reverse, ticks, vertical, tickAlign, ...props
} = this.props;
delete props.count;
delete props.labels;
const { items } = this.state;
const { intl } = this.context;
const classes = classnames(
CLASS_ROOT, {
[`${CLASS_ROOT}--reverse`]: reverse,
[`${CLASS_ROOT}--vertical`]: vertical,
[`${CLASS_ROOT}--align-${align}`]: align,
[`${CLASS_ROOT}--ticks`]: ticks,
[`${CLASS_ROOT}--ticks--${tickAlign}`]: tickAlign
},
className
);
let elements = items.map(item => {
const classes = classnames(
`${CLASS_ROOT}__slot`, {
[`${CLASS_ROOT}__slot--placeholder`]: item.placeholder,
[`${COLOR_INDEX}-${item.colorIndex}`]: item.colorIndex
}
);
const role = item.label && item.label !== '' ? 'row' : undefined;
const label = item.label ? <span>{item.label}</span> : undefined;
return (
<div key={item.value || item.index} className={classes} role={role}
style={{ flexBasis: `${item.basis}%` }}>
{label}
</div>
);
});
const axisLabel = a11yTitle || Intl.getMessage(intl, 'AxisLabel', {
orientation: vertical ? 'y' : 'x'
});
return (
<div {...props} role='rowgroup' aria-label={axisLabel}
className={classes}>
{elements}
</div>
);
}
}
Axis.contextTypes = {
intl: PropTypes.object
};
Axis.propTypes = {
a11yTitle: PropTypes.string,
align: PropTypes.oneOf(['start', 'end']), // only from Chart
count: PropTypes.number.isRequired,
labels: PropTypes.arrayOf(PropTypes.shape({
colorIndex: PropTypes.string,
index: PropTypes.number.isRequired,
label: PropTypes.node.isRequired
})),
reverse: PropTypes.bool,
ticks: PropTypes.bool,
tickAlign: PropTypes.oneOf(['start', 'end']),
vertical: PropTypes.bool
};
|
blocks/dangerously-set-inner-html.js | UXtemple/panels | import React from 'react'
const DangerouslySetInnerHTML = props => (
<div
dangerouslySetInnerHTML={{
__html: props.html,
}}
data-block={props['data-block']}
ref={props._ref}
style={props.style}
/>
)
export default DangerouslySetInnerHTML
|
features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/components/Apis/Details/LifeCycle/LifeCycleHistory.js | thusithak/carbon-apimgt | /*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react'
import List, {
ListItem,
ListItemText,
} from 'material-ui/List';
import Avatar from 'material-ui/Avatar'
import Person from 'material-ui-icons/Person';
const LifeCycleHistory = props => {
return (
<List>
{ props.lcHistory.map(entry =>
entry.previousState &&
<ListItem button key={entry.postState}>
<div>
<Avatar>
<Person />
</Avatar>
<div>{entry.user}</div>
</div>
<ListItemText
primary={"LC has changed from " + entry.postState + " to " + entry.previousState}
secondary={entry.updatedTime} />
</ListItem>
)}
</List>
);
};
export default LifeCycleHistory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.