path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
src/frontend/components/admin/ToolBar.js
ChVince/new-record
import React from 'react' import {Navbar, Nav, NavItem, Modal, Button} from 'react-bootstrap' import AddClip from './AddClip' class ToolBar extends React.Component { constructor(props) { super(props); this.state = { showModal: false }; } close = () => { this.props.clearAddClipForm(); this.setState({showModal: false}); }; open = () => { this.setState({showModal: true}); } render() { return ( <div> <Navbar inverse collapseOnSelect> <Nav> <NavItem onClick={this.open}>Добавить видео</NavItem> </Nav> <Nav pullRight> <NavItem onClick={this.props.logout}>Выйти</NavItem> </Nav> </Navbar> <Modal show={this.state.showModal} onHide={this.close}> <Modal.Header closeButton> <Modal.Title>Добавить видео</Modal.Title> </Modal.Header> <Modal.Body> <AddClip {...this.props} /> </Modal.Body> <Modal.Footer> <Button onClick={this.close}>Закрыть</Button> </Modal.Footer> </Modal> </div> ) } } ToolBar.propTypes = { addClip: React.PropTypes.func.isRequired, validateAddClipForm: React.PropTypes.func.isRequired, clearAddClipForm: React.PropTypes.func.isRequired, validateForms: React.PropTypes.array.isRequired, logout: React.PropTypes.func.isRequired } export default ToolBar;
src/icons/GlyphFilter.js
ipfs/webui
import React from 'react' const GlyphFilter = props => ( <svg viewBox='0 0 100 100' {...props}> <path d='M78.48 19.84h-57a4.1 4.1 0 0 0-4.08 4.08v52.16a4.1 4.1 0 0 0 4.08 4.08h57a4.1 4.1 0 0 0 4.08-4.08V23.92a4.1 4.1 0 0 0-4.08-4.08zm-7.36 43.57h-27a5.07 5.07 0 0 1-9.83 0h-5.41a1.25 1.25 0 1 1 0-2.5h5.43a5.07 5.07 0 0 1 9.83 0h27a1.25 1.25 0 0 1 0 2.5zm0-11.52h-8.2a5.07 5.07 0 0 1-9.84 0h-24.2a1.25 1.25 0 1 1 0-2.5h24.2a5.07 5.07 0 0 1 9.84 0h8.2a1.25 1.25 0 0 1 0 2.5zm0-12.8H43.71a5.07 5.07 0 0 1-9.83 0h-5a1.25 1.25 0 1 1 0-2.5h5a5.07 5.07 0 0 1 9.83 0h27.41a1.25 1.25 0 0 1 0 2.5z' /> </svg> ) export default GlyphFilter
src/js/index.js
mirandagithub/reactflux_try
import React from 'react'; import App from './components/App.react'; React.render(<App />, document.getElementById('root'));
src/components/PreviousButton.js
joellanciaux/Griddle
import React from 'react'; const PreviousButton = ({ hasPrevious, onClick, style, className, text }) => hasPrevious ? ( <button type="button" onClick={onClick} style={style} className={className}>{text}</button> ) : null; export default PreviousButton;
src/components/header.js
mozilla/donate.mozilla.org
import React from 'react'; module.exports = React.createClass({ contextTypes: { intl: React.PropTypes.object }, propTypes: { alt: React.PropTypes.string }, render: function() { var alt = "Mozilla"; // FIXME: Should update the list in the regex for locales that did the translation // for whatever `alt` that has been translated. if (/^(en)(\b|$)/.test(this.context.intl.locale)) { alt = this.props.alt; } return ( <div className="header"> <h1> <img className="auto-margin" alt={alt} src="/assets/images/mozilla.1068965acefde994a71c187d253aca2b.svg" /> </h1> <div className="header-copy"> <div className="row"> {this.props.children} </div> </div> </div> ); } });
examples/app.js
Tiendq/youtube-embed-video
import React from 'react'; import ReactDOM from 'react-dom'; import YoutubeEmbedVideo from '../dist/youtube'; // import YoutubeEmbedVideo from 'youtube-embed-video'; ReactDOM.render(<YoutubeEmbedVideo size="medium" videoId="RnDC9MXSqCY" className="video-player" style={{ borderWidth: 10, borderColor: '#00c775', borderStyle: 'solid' }} suggestions={false} />, document.getElementById('app'));
react/examples/Unit_Tests/src/index.js
jsperts/workshop_unterlagen
import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import App from './components/App'; import store from './store'; render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') );
src/components/TableBody/TableView.js
cantonjs/re-admin
import React, { Component } from 'react'; import PropTypes from 'utils/PropTypes'; import { toJS } from 'mobx'; import { observer } from 'mobx-react'; import { isEmpty } from 'utils/fp'; import clearSortedInfo from 'utils/clearSortedInfo'; import { TABLE } from 'utils/Issuers'; import withIssuer from 'hocs/withIssuer'; import TableContext from './TableContext'; import { Table as AntdTable } from 'antd'; import TableCell from './TableCell'; import TableHeadCell from './TableHeadCell'; const components = { header: { cell: TableHeadCell }, body: { cell: TableCell }, }; @withIssuer({ issuer: TABLE }) @observer export default class TableView extends Component { static propTypes = { store: PropTypes.shape({ columns: PropTypes.array.isRequired, collection: PropTypes.array, isFetching: PropTypes.bool.isRequired, size: PropTypes.number.isRequired, setSelectedKeys: PropTypes.func.isRequired, toggleSelectedKey: PropTypes.func.isRequired, query: PropTypes.object.isRequired, config: PropTypes.object.isRequired, }), rowSelection: PropTypes.any, selectionType: PropTypes.oneOf(['checkbox', 'radio']), }; static defaultProps = { selectionType: 'checkbox', }; static contextTypes = { appConfig: PropTypes.object.isRequired, }; constructor(props) { super(props); this.tableContext = { toggleSelectedKey: this._toggleSelectedKey }; } _toggleSelectedKey = (selectedRowKey) => { if (this.props.selectionType === 'radio') { this.props.store.toggleSelectedKey(selectedRowKey); } }; _handleSelectChange = (selectedRowKeys) => { this.props.store.setSelectedKeys(selectedRowKeys); }; _handleChange = (pagination, filters, sorter) => { const { context: { appConfig, appConfig: { api: { sortKey, orderKey, descValue, ascValue }, }, }, props: { store }, } = this; if (isEmpty(sorter)) { return clearSortedInfo(appConfig); } store.setQuery({ ...store.query, [sortKey]: sorter.columnKey, [orderKey]: sorter.order === 'descend' ? descValue : ascValue, }); }; render() { const { props: { store, selectionType, rowSelection }, } = this; const { columns, collection, isFetching, selectedKeys, uniqueKey, maxSelections, config, } = store; const defaultRowSelection = maxSelections ? { type: selectionType, selectedRowKeys: selectedKeys, onChange: this._handleSelectChange, getCheckboxProps: (record) => ({ disabled: selectionType === 'checkbox' && maxSelections > 0 && selectedKeys.length >= maxSelections && selectedKeys.indexOf(record[uniqueKey]) < 0, }), } : undefined; return ( <TableContext.Provider value={this.tableContext}> <AntdTable rowSelection={rowSelection || defaultRowSelection} columns={columns} dataSource={toJS(collection)} loading={isFetching} pagination={false} components={components} onChange={this._handleChange} size={config.viewSize} /> </TableContext.Provider> ); } }
src/svg-icons/device/bluetooth-searching.js
ArcanisCz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceBluetoothSearching = (props) => ( <SvgIcon {...props}> <path d="M14.24 12.01l2.32 2.32c.28-.72.44-1.51.44-2.33 0-.82-.16-1.59-.43-2.31l-2.33 2.32zm5.29-5.3l-1.26 1.26c.63 1.21.98 2.57.98 4.02s-.36 2.82-.98 4.02l1.2 1.2c.97-1.54 1.54-3.36 1.54-5.31-.01-1.89-.55-3.67-1.48-5.19zm-3.82 1L10 2H9v7.59L4.41 5 3 6.41 8.59 12 3 17.59 4.41 19 9 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM11 5.83l1.88 1.88L11 9.59V5.83zm1.88 10.46L11 18.17v-3.76l1.88 1.88z"/> </SvgIcon> ); DeviceBluetoothSearching = pure(DeviceBluetoothSearching); DeviceBluetoothSearching.displayName = 'DeviceBluetoothSearching'; DeviceBluetoothSearching.muiName = 'SvgIcon'; export default DeviceBluetoothSearching;
app/jsx/assignments_2/student/components/LatePolicyStatusDisplay/AccessibleTipContent.js
djbender/canvas-lms
/* * Copyright (C) 2018 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import I18n from 'i18n!a2_AccessibleTipContent' import {ScreenReaderContent} from '@instructure/ui-a11y' import PropTypes from 'prop-types' import GradeFormatHelper from '../../../../gradebook/shared/helpers/GradeFormatHelper' export default function AccessibleTipContent(props) { const {attempt, gradingType, grade, originalGrade, pointsDeducted, pointsPossible} = props return ( <ScreenReaderContent data-testid="late-policy-accessible-tip-content"> {I18n.t('Attempt %{attempt}: %{grade}', { attempt, grade: GradeFormatHelper.formatGrade(originalGrade, { gradingType, pointsPossible, formatType: 'points_out_of_fraction' }) })} {I18n.t( {one: 'Late Penalty: minus 1 Point', other: 'Late Penalty: minus %{count} Points'}, {count: pointsDeducted} )} {I18n.t('Grade: %{grade}', { grade: GradeFormatHelper.formatGrade(grade, { gradingType, pointsPossible, formatType: 'points_out_of_fraction' }) })} </ScreenReaderContent> ) } AccessibleTipContent.propTypes = { attempt: PropTypes.number.isRequired, grade: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, gradingType: PropTypes.string.isRequired, originalGrade: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, pointsDeducted: PropTypes.number.isRequired, pointsPossible: PropTypes.number.isRequired }
src/main/webapp/static/js/club/view/back/blog/ueditor.js
weijiafen/antBlog
import React from 'react'; require('../../../library/ueditor/ueditor.config.js') require('../../../library/ueditor/ueditor.all.min.js') require('../../../library/ueditor/lang/zh-cn/zh-cn.js') var UEditor = React.createClass({ displayName: 'UEditor', // 设置默认的属性值 getDefaultProps: function () { return { disabled: false, height: 500, content: '', id: 'editor' }; }, render: function () { return ( <div> <script id={this.props.id} name="content" type="text/plain"> </script> </div> ); }, 调用初始化方法 componentDidMount: function () { this.initEditor(); }, // 编辑器配置项初始化 initEditor: function () { var id = this.props.id; var ue = UE.getEditor(id, { // 工具栏,不配置有默认项目 toolbars: [[ 'fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'emotion', 'horizontal', '|', 'date', 'time', '|', 'insertimage' ]], lang: 'zh-cn', // 字体 'fontfamily': [ {label: '', name: 'songti', val: '宋体,SimSun'}, {label: '', name: 'kaiti', val: '楷体,楷体_GB2312, SimKai'}, {label: '', name: 'yahei', val: '微软雅黑,Microsoft YaHei'}, {label: '', name: 'heiti', val: '黑体, SimHei'}, {label: '', name: 'lishu', val: '隶书, SimLi'}, {label: '', name: 'andaleMono', val: 'andale mono'}, {label: '', name: 'arial', val: 'arial, helvetica,sans-serif'}, {label: '', name: 'arialBlack', val: 'arial black,avant garde'}, {label: '', name: 'comicSansMs', val: 'comic sans ms'}, {label: '', name: 'impact', val: 'impact,chicago'}, {label: '', name: 'timesNewRoman', val: 'times new roman'} ], // 字号 'fontsize': [10, 11, 12, 14, 16, 18, 20, 24, 36], // 为编辑器实例添加一个路径,必需项 'UEDITOR_HOME_URL': '/react/dist/ueditor/', // 上传图片时后端提供的接口 serverUrl: window.api_host + '/innerMessage/uploadImage', enableAutoSave: false, autoHeightEnabled: false, initialFrameHeight: this.props.height, initialFrameWidth: '100%', // 是否允许编辑 readonly: this.props.disabled }); this.editor = ue; var self = this; this.editor.ready(function (ueditor) { if (!ueditor) { // 如果初始化后ueditor不存在删除后重新调用 UE.delEditor(self.props.id); self.initEditor(); } }); }, // 获取编辑器的内容 getContent: function () { if (this.editor) { return this.editor.getContent(); } return ''; }, /** * 写入内容|追加内容 * @param {Boolean} isAppendTo [是否是追加] * @param {String} appendContent [内容] */ setContent: function (appendContent, isAppendTo) { if (this.editor) { this.editor.setContent(appendContent, isAppendTo); } }, // 获取纯文本 getContentTxt: function () { if (this.editor) { return this.editor.getContentTxt(); } return ''; }, // 获得带格式的纯文本 getPlainTxt: function () { if (this.editor) { return this.editor.getPlainTxt(); } return ''; }, // 判断是否有内容 hasContent: function () { if (this.editor) { return this.editor.hasContents(); } return false; }, // 插入给定的html insertHtml: function (content) { if (this.editor) { this.editor.execCommand('insertHtml', content); } }, // 使编辑器获得焦点 setFocus: function () { if (this.editor) { this.editor.focus(); } }, // 设置高度 setHeight: function (height) { if (this.editor) { this.editor.setHeight(height); } } }); module.exports = UEditor;
fluent-react/test/provider_change_test.js
zbraniecki/fluent.js
import React from 'react'; import assert from 'assert'; import sinon from 'sinon'; import { shallow } from 'enzyme'; import { LocalizationProvider } from '../src/index'; suite('LocalizationProvider - changing props', function() { test('does not change the ReactLocalization', function() { const wrapper = shallow( <LocalizationProvider bundles={[]}> <div /> </LocalizationProvider> ); const oldL10n = wrapper.instance().l10n; wrapper.setProps({ bundles: [] }); const newL10n = wrapper.instance().l10n; assert.strictEqual(oldL10n, newL10n); }); test('calls the ReactLocalization\'s setBundles method', function() { const wrapper = shallow( <LocalizationProvider bundles={[]}> <div /> </LocalizationProvider> ); const spy = sinon.spy(wrapper.instance().l10n, 'setBundles'); const newMessages = []; wrapper.setProps({ bundles: newMessages }); const { args } = spy.getCall(0); assert.deepEqual(args, [newMessages]); }); test('changes the ReactLocalization\'s bundles bundles', function() { const wrapper = shallow( <LocalizationProvider bundles={[]}> <div /> </LocalizationProvider> ); const oldContexts = wrapper.instance().l10n.bundles; wrapper.setProps({ bundles: [] }); const newContexts = wrapper.instance().l10n.bundles; assert.notEqual(oldContexts, newContexts); }); });
app/ActionExtensionScreen.js
shaneosullivan/ReactNativeExampleBrowserExtension
// @flow import React from 'react'; import { NativeModules, TouchableOpacity, Text, View } from 'react-native'; export default class ActionExtensionScreen extends React.Component { constructor() { super(); this.state = { domainUrl: null }; } componentDidMount() { NativeModules.ActionExtension.fetchDomainUrl((error, url) => { if (!error) { this.setState({ domainUrl: url }); } }); } render() { return ( <View style={{ paddingTop: 100 }}> <Text style={{ fontSize: 30, textAlign: 'center' }}>Hello from our Action Extension!</Text> {this.state.domainUrl ? <Text> Got url {this.state.domainUrl} </Text> : <Text>Got no url</Text>} <View style={{ paddingTop: 100 }}> <TouchableOpacity onPress={this._handleDone}> <Text style={{ fontSize: 30, textAlign: 'center' }}>Done</Text> </TouchableOpacity> </View> </View> ); } _handleDone = () => { // Call the function that has been exposed on the native module to close the screen. NativeModules.ActionExtension.done(); }; }
src/svg-icons/device/screen-lock-portrait.js
mit-cml/iot-website-source
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceScreenLockPortrait = (props) => ( <SvgIcon {...props}> <path d="M10 16h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2v1h-2.4v-1zM17 1H7c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 18H7V5h10v14z"/> </SvgIcon> ); DeviceScreenLockPortrait = pure(DeviceScreenLockPortrait); DeviceScreenLockPortrait.displayName = 'DeviceScreenLockPortrait'; DeviceScreenLockPortrait.muiName = 'SvgIcon'; export default DeviceScreenLockPortrait;
src/containers/DevTools.js
tylergraf/react-twitter
import React from 'react' import { createDevTools } from 'redux-devtools' import LogMonitor from 'redux-devtools-log-monitor' import DockMonitor from 'redux-devtools-dock-monitor' export default createDevTools( <DockMonitor toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-w"> <LogMonitor /> </DockMonitor> )
routes/react-server.js
domjtalbot/Find-a-listing
/* eslint-disable no-console */ import { Router } from 'express'; import React from 'react'; import { renderToString } from 'react-dom/server'; import { match, RouterContext } from 'react-router'; import routes from '../modules/routes'; const router = new Router(); router.get('*', (req, res) => { res.set('Cache-control', 'private, max-age=600'); match({ routes, location: req.url, }, (error, redirect, routerProps) => { if (error) { res.status(500).send(error.message); } else if (redirect) { res.redirect(`${redirect.pathname}${redirect.search}`); } else if (routerProps) { const appHtml = renderToString( <RouterContext {...routerProps} /> ); res.status(200).render('_reactServer', { title: 'React Server', appHtml, }); } else { res.status(404).send('Not Found'); } }); }); export { router as default };
client/src/js/containers/App.js
rmhowe/transport-app
import React from 'react'; import Header from '../components/Header'; import MetroLine from '../components/MetroLine'; import Immutable from 'immutable'; import fetch from 'isomorphic-fetch'; export default class App extends React.Component { constructor(props) { super(props); this.urlRoot = '/'; this.state = { disruptions: Immutable.List() }; } componentDidMount() { this.fetchDisruptions(); } handleAddDisruption = (disruptionData) => { this.addDisruption(disruptionData).then(() => { this.fetchDisruptions(); }); }; handleDeleteDisruption = (disruptionId) => { this.deleteDisruption(disruptionId).then(() => { this.fetchDisruptions(); }); }; fetchDisruptions() { fetch(`${this.urlRoot}disruptions/`).then((response) => { return response.json(); }).then((disruptions) => { this.setState({ disruptions: Immutable.fromJS(disruptions.data) }); }); } addDisruption(disruptionData) { return fetch(`${this.urlRoot}disruptions/`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(disruptionData) }); } deleteDisruption(disruptionId) { return fetch(`${this.urlRoot}disruptions/${disruptionId}`, { method: 'DELETE' }); } getMetroLineData() { return { "1": "Yonge-University", "2": "Bloor-Danforth", "3": "Scarborough", "4": "Sheppard" }; } getMetroLines(metroLineData) { return Object.keys(metroLineData).map((lineNumber) => { const lineDisruptions = this.state.disruptions.filter((disruption) => { return disruption.get('line_number') === lineNumber; }); return ( <MetroLine key={lineNumber} lineNumber={lineNumber} lineName={metroLineData[lineNumber]} lineDisruptions={lineDisruptions} handleAddDisruption={this.handleAddDisruption} handleDeleteDisruption={this.handleDeleteDisruption} /> ); }); } render() { const metroLineData = this.getMetroLineData(); const metroLines = this.getMetroLines(metroLineData); return ( <div className="app"> <Header/> {metroLines} </div> ); } }
src/containers/Ecommerce/checkout/index.js
EncontrAR/backoffice
import React from 'react'; import LayoutWrapper from '../../../components/utility/layoutWrapper'; import Box from '../../../components/utility/box'; import BillingForm from './billing-form'; import OrderInfo from './order-info'; class CartPage extends React.Component { render() { return ( <LayoutWrapper className="isoCheckoutPage"> <Box> <div className="isoBillingAddressWrapper"> <h3 className="isoSectionTitle">Billing details</h3> <div className="isoBillingSection"> <BillingForm /> <OrderInfo /> </div> </div> </Box> </LayoutWrapper> ); } } export default CartPage;
node_modules/react-bootstrap/es/Row.js
xuan6/admin_dashboard_local_dev
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import elementType from 'react-prop-types/lib/elementType'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { componentClass: elementType }; var defaultProps = { componentClass: 'div' }; var Row = function (_React$Component) { _inherits(Row, _React$Component); function Row() { _classCallCheck(this, Row); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Row.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, props = _objectWithoutProperties(_props, ['componentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) })); }; return Row; }(React.Component); Row.propTypes = propTypes; Row.defaultProps = defaultProps; export default bsClass('row', Row);
src/routes/login/index.js
maadcodr/carshow
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-2016 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 Login from './Login'; export const path = '/login'; export const action = async (state) => { const title = 'Log In'; state.context.onSetTitle(title); return <Login title={title} />; };
packages/editor/src/components/Controls/ColorPicker/ColorPickerLayout.js
boldr/boldr
/* eslint-disable react/no-unused-prop-types, react/no-array-index-key */ /* @flow */ import React from 'react'; import type { Node } from 'react'; import cn from 'classnames'; import { EyeDropper } from '../../Icons'; import { stopPropagation } from '../../../utils/common'; import Option from '../../Option'; import type { ColorPickerConfig } from '../../../core/config'; type ColorCurrent = { color: string, bgColor: string, }; type Props = { expanded?: boolean, onChange?: Function, config: ColorPickerConfig, onExpandEvent: Function, currentState: ColorCurrent, }; type State = { currentStyle: string, }; class ColorPickerLayout extends React.Component<Props, State> { state = { currentStyle: 'color', }; componentWillReceiveProps(props: Props) { if (!this.props.expanded && props.expanded) { this.setState({ currentStyle: 'color', }); } } props: Props; setCurrentStyleBgcolor: Function = (): void => { this.setState({ currentStyle: 'bgcolor', }); }; setCurrentStyleColor: Function = (): void => { this.setState({ currentStyle: 'color', }); }; onChange: Function = (color: string): void => { const { onChange } = this.props; const { currentStyle } = this.state; onChange(currentStyle, color); }; renderModal: Function = (): React.Node => { const { config: { modalClassName, colors }, currentState: { color, bgColor } } = this.props; const { currentStyle } = this.state; const currentSelectedColor = currentStyle === 'color' ? color : bgColor; return ( <div className={cn('be-modal', modalClassName)} onClick={stopPropagation}> <div className={cn('be-modal__top')}> <span className={cn('be-color__modal-label', { 'is-active': currentStyle === 'color', })} onClick={this.setCurrentStyleColor}> Text </span> <span className={cn('be-color__modal-label', { 'is-active': currentStyle === 'bgcolor', })} onClick={this.setCurrentStyleBgcolor}> Background </span> </div> <span className={cn('be-color__modal-opts')}> {colors.map((color, index) => ( <Option value={color} key={index} active={currentSelectedColor === color} onClick={this.onChange} isDark> <span style={{ backgroundColor: color }} className="be-color__cube" /> </Option> ))} </span> </div> ); }; render(): Node { const { expanded, onExpandEvent } = this.props; return ( <div className={cn('be-ctrl__group')} aria-haspopup="true" aria-expanded={expanded} aria-label="be-color-picker" title={this.props.config.title}> <Option onClick={onExpandEvent} className={cn(this.props.config.className)}> <EyeDropper fill="#222" size={20} onClick={onExpandEvent} /> </Option> {expanded ? this.renderModal() : undefined} </div> ); } } export default ColorPickerLayout;
blueprints/view/files/__root__/views/__name__View/__name__View.js
cargo-transport/web-frontend
import React from 'react' type Props = { }; export class <%= pascalEntityName %> extends React.Component { props: Props; render () { return ( <div></div> ) } } export default <%= pascalEntityName %>
src/svg-icons/notification/vpn-lock.js
kasra-co/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationVpnLock = (props) => ( <SvgIcon {...props}> <path d="M22 4v-.5C22 2.12 20.88 1 19.5 1S17 2.12 17 3.5V4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h5c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zm-.8 0h-3.4v-.5c0-.94.76-1.7 1.7-1.7s1.7.76 1.7 1.7V4zm-2.28 8c.04.33.08.66.08 1 0 2.08-.8 3.97-2.1 5.39-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H7v-2h2c.55 0 1-.45 1-1V8h2c1.1 0 2-.9 2-2V3.46c-.95-.3-1.95-.46-3-.46C5.48 3 1 7.48 1 13s4.48 10 10 10 10-4.48 10-10c0-.34-.02-.67-.05-1h-2.03zM10 20.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L8 16v1c0 1.1.9 2 2 2v1.93z"/> </SvgIcon> ); NotificationVpnLock = pure(NotificationVpnLock); NotificationVpnLock.displayName = 'NotificationVpnLock'; NotificationVpnLock.muiName = 'SvgIcon'; export default NotificationVpnLock;
src/svg-icons/social/sentiment-satisfied.js
pomerantsev/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialSentimentSatisfied = (props) => ( <SvgIcon {...props}> <circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-4c-1.48 0-2.75-.81-3.45-2H6.88c.8 2.05 2.79 3.5 5.12 3.5s4.32-1.45 5.12-3.5h-1.67c-.7 1.19-1.97 2-3.45 2z"/> </SvgIcon> ); SocialSentimentSatisfied = pure(SocialSentimentSatisfied); SocialSentimentSatisfied.displayName = 'SocialSentimentSatisfied'; SocialSentimentSatisfied.muiName = 'SvgIcon'; export default SocialSentimentSatisfied;
src/svg-icons/action/lightbulb-outline.js
rhaedes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionLightbulbOutline = (props) => ( <SvgIcon {...props}> <path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"/> </SvgIcon> ); ActionLightbulbOutline = pure(ActionLightbulbOutline); ActionLightbulbOutline.displayName = 'ActionLightbulbOutline'; export default ActionLightbulbOutline;
examples/e-commerce/widgets/Ratings.js
algolia/react-instantsearch
import React from 'react'; import { connectRange } from 'react-instantsearch-dom'; import cx from 'classnames'; const Ratings = ({ currentRefinement, refine, createURL, count }) => { const ratings = new Array(4).fill(null).map((_, ratingIndex) => { const value = 4 - ratingIndex; const itemsCount = count .filter((countObj) => value <= parseInt(countObj.value, 10)) .map((countObj) => countObj.count) .reduce((sum, currentCount) => sum + currentCount, 0); return { value, count: itemsCount, }; }); const stars = new Array(5).fill(null); return ( <div className="ais-RatingMenu"> <ul className="ais-RatingMenu-list"> {ratings.map((rating, ratingIndex) => { const isRatingSelected = ratings.every( (currentRating) => currentRating.value !== currentRefinement.min ) || rating.value === currentRefinement.min; return ( <li className={cx('ais-RatingMenu-item', { 'ais-RatingMenu-item--selected': isRatingSelected, 'ais-RatingMenu-item--disabled': rating.count === 0, })} key={rating.value} > <a className="ais-RatingMenu-link" aria-label={`${rating.value} & up`} href={createURL(rating.value)} onClick={(event) => { event.preventDefault(); if (currentRefinement.min === rating.value) { refine({ min: 0 }); } else { refine({ min: rating.value }); } }} > {stars.map((_, starIndex) => { const starNumber = starIndex + 1; const isStarFull = starNumber < 5 - ratingIndex; return ( <svg key={starIndex} className={cx('ais-RatingMenu-starIcon', { 'ais-RatingMenu-starIcon--full': isStarFull, 'ais-RatingMenu-starIcon--empty': !isStarFull, })} aria-hidden="true" viewBox="0 0 16 16" > <path fillRule="evenodd" d="M10.472 5.008L16 5.816l-4 3.896.944 5.504L8 12.616l-4.944 2.6L4 9.712 0 5.816l5.528-.808L8 0z" /> </svg> ); })} <span className="ais-RatingMenu-count">{rating.count}</span> </a> </li> ); })} </ul> </div> ); }; export default connectRange(Ratings);
app/javascript/mastodon/features/ui/components/embed_modal.js
PlantsNetwork/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage, injectIntl } from 'react-intl'; import api from '../../../api'; @injectIntl export default class EmbedModal extends ImmutablePureComponent { static propTypes = { url: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, } state = { loading: false, oembed: null, }; componentDidMount () { const { url } = this.props; this.setState({ loading: true }); api().post('/api/web/embed', { url }).then(res => { this.setState({ loading: false, oembed: res.data }); const iframeDocument = this.iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(res.data.html); iframeDocument.close(); iframeDocument.body.style.margin = 0; this.iframe.width = iframeDocument.body.scrollWidth; this.iframe.height = iframeDocument.body.scrollHeight; }); } setIframeRef = c => { this.iframe = c; } handleTextareaClick = (e) => { e.target.select(); } render () { const { oembed } = this.state; return ( <div className='modal-root__modal embed-modal'> <h4><FormattedMessage id='status.embed' defaultMessage='Embed' /></h4> <div className='embed-modal__container'> <p className='hint'> <FormattedMessage id='embed.instructions' defaultMessage='Embed this status on your website by copying the code below.' /> </p> <input type='text' className='embed-modal__html' readOnly value={oembed && oembed.html || ''} onClick={this.handleTextareaClick} /> <p className='hint'> <FormattedMessage id='embed.preview' defaultMessage='Here is what it will look like:' /> </p> <iframe className='embed-modal__iframe' frameBorder='0' ref={this.setIframeRef} title='preview' /> </div> </div> ); } }
src/main.js
Spwahle/Narcan-Now-Frontend
import './style/main.scss'; import React from 'react'; import ReactDom from 'react-dom'; import App from './component/app'; import {Provider} from 'react-redux'; import appCreateStore from './lib/app-create-store'; let store = appCreateStore(); class AppContainer extends React.Component { render() { return ( <Provider store={store}> <App /> </Provider> ); } } ReactDom.render(<AppContainer />, document.getElementById('root'));
hello-world/src/index.js
tychay/slideshow-react
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './index.css'; ReactDOM.render( <App />, document.getElementById('root') );
pootle/static/js/admin/general/components/ContentEditor.js
JohnnyKing94/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ import React from 'react'; import CodeMirror from 'components/CodeMirror'; import { getName } from 'utils/markup'; const ContentEditor = React.createClass({ propTypes: { markup: React.PropTypes.string, // Temporarily needed to support submitting forms not controlled by JS name: React.PropTypes.string, onChange: React.PropTypes.func, style: React.PropTypes.object, value: React.PropTypes.string, }, render() { const { markup } = this.props; const markupName = getName(markup); return ( <div className="content-editor" style={this.props.style} > <CodeMirror markup={markup} name={this.props.name} value={this.props.value} onChange={this.props.onChange} placeholder={gettext(`Allowed markup: ${markupName}`)} /> </div> ); }, }); export default ContentEditor;
blueocean-material-icons/src/js/components/svg-icons/notification/ondemand-video.js
jenkinsci/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const NotificationOndemandVideo = (props) => ( <SvgIcon {...props}> <path d="M21 3H3c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.11-.9-2-2-2zm0 14H3V5h18v12zm-5-6l-7 4V7z"/> </SvgIcon> ); NotificationOndemandVideo.displayName = 'NotificationOndemandVideo'; NotificationOndemandVideo.muiName = 'SvgIcon'; export default NotificationOndemandVideo;
docs/src/examples/elements/Reveal/States/RevealExampleActive.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Image, Reveal } from 'semantic-ui-react' const RevealExampleActive = () => ( <Reveal active animated='move'> <Reveal.Content visible> <Image src='/images/wireframe/square-image.png' size='small' /> </Reveal.Content> <Reveal.Content hidden> <Image src='/images/avatar/large/nan.jpg' size='small' /> </Reveal.Content> </Reveal> ) export default RevealExampleActive
app/javascript/flavours/glitch/features/ui/components/report_modal.js
Kirishima21/mastodon
import React from 'react'; import { connect } from 'react-redux'; import { changeReportComment, changeReportForward, submitReport } from 'flavours/glitch/actions/reports'; import { expandAccountTimeline } from 'flavours/glitch/actions/timelines'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { makeGetAccount } from 'flavours/glitch/selectors'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import StatusCheckBox from 'flavours/glitch/features/report/containers/status_check_box_container'; import { OrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; import Button from 'flavours/glitch/components/button'; import Toggle from 'react-toggle'; import IconButton from '../../../components/icon_button'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' }, submit: { id: 'report.submit', defaultMessage: 'Submit' }, }); const makeMapStateToProps = () => { const getAccount = makeGetAccount(); const mapStateToProps = state => { const accountId = state.getIn(['reports', 'new', 'account_id']); return { isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']), account: getAccount(state, accountId), comment: state.getIn(['reports', 'new', 'comment']), forward: state.getIn(['reports', 'new', 'forward']), statusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])), }; }; return mapStateToProps; }; export default @connect(makeMapStateToProps) @injectIntl class ReportModal extends ImmutablePureComponent { static propTypes = { isSubmitting: PropTypes.bool, account: ImmutablePropTypes.map, statusIds: ImmutablePropTypes.orderedSet.isRequired, comment: PropTypes.string.isRequired, forward: PropTypes.bool, dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; handleCommentChange = e => { this.props.dispatch(changeReportComment(e.target.value)); } handleForwardChange = e => { this.props.dispatch(changeReportForward(e.target.checked)); } handleSubmit = () => { this.props.dispatch(submitReport()); } handleKeyDown = e => { if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { this.handleSubmit(); } } componentDidMount () { this.props.dispatch(expandAccountTimeline(this.props.account.get('id'), { withReplies: true })); } componentWillReceiveProps (nextProps) { if (this.props.account !== nextProps.account && nextProps.account) { this.props.dispatch(expandAccountTimeline(nextProps.account.get('id'), { withReplies: true })); } } render () { const { account, comment, intl, statusIds, isSubmitting, forward, onClose } = this.props; if (!account) { return null; } const domain = account.get('acct').split('@')[1]; return ( <div className='modal-root__modal report-modal'> <div className='report-modal__target'> <IconButton className='report-modal__close' title={intl.formatMessage(messages.close)} icon='times' onClick={onClose} size={20} /> <FormattedMessage id='report.target' defaultMessage='Report {target}' values={{ target: <strong>{account.get('acct')}</strong> }} /> </div> <div className='report-modal__container'> <div className='report-modal__comment'> <p><FormattedMessage id='report.hint' defaultMessage='The report will be sent to your server moderators. You can provide an explanation of why you are reporting this account below:' /></p> <textarea className='setting-text light' placeholder={intl.formatMessage(messages.placeholder)} value={comment} onChange={this.handleCommentChange} onKeyDown={this.handleKeyDown} disabled={isSubmitting} autoFocus /> {domain && ( <div> <p><FormattedMessage id='report.forward_hint' defaultMessage='The account is from another server. Send an anonymized copy of the report there as well?' /></p> <div className='setting-toggle'> <Toggle id='report-forward' checked={forward} disabled={isSubmitting} onChange={this.handleForwardChange} /> <label htmlFor='report-forward' className='setting-toggle__label'><FormattedMessage id='report.forward' defaultMessage='Forward to {target}' values={{ target: domain }} /></label> </div> </div> )} <Button disabled={isSubmitting} text={intl.formatMessage(messages.submit)} onClick={this.handleSubmit} /> </div> <div className='report-modal__statuses'> <div> {statusIds.map(statusId => <StatusCheckBox id={statusId} key={statusId} disabled={isSubmitting} />)} </div> </div> </div> </div> ); } }
src/encoded/static/components/item-pages/components/WorkflowNodeElement.js
4dn-dcic/fourfront
'use strict'; import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; import { console, object, valueTransforms } from '@hms-dbmi-bgm/shared-portal-components/es/components/util'; import { expFxn } from './../../util'; import { ViewMetricButton } from './WorkflowDetailPane/FileDetailBodyMetricsView'; /** TODO codify what we want shown here and cleanup code - breakup into separate functional components */ export class WorkflowNodeElement extends React.PureComponent { static propTypes = { 'node' : PropTypes.object.isRequired, 'title': PropTypes.string, 'disabled' : PropTypes.bool, 'selected' : PropTypes.bool, 'related' : PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), 'columnWidth' : PropTypes.number }; static ioFileTypes = new Set(['data file', 'QC', 'reference file', 'report']); static isNodeParameter(node){ return node.ioType === 'parameter'; } static isNodeFile(node){ return WorkflowNodeElement.ioFileTypes.has(node.ioType); } static isNodeGroup(node){ return ((node.nodeType || '').indexOf('group') > -1); } static isNodeQCMetric(node){ if (node.ioType === 'qc') return true; if (node.ioType === 'report') return true; if (node.meta && node.meta.type === 'QC') return true; if (node.meta && node.meta.type === 'report') return true; if (node.meta && node.meta.run_data && node.meta.run_data.type === 'quality_metric') return true; return false; } static doesRunDataExist(node){ if (WorkflowNodeElement.isNodeGroup(node)){ return ( node.meta && node.meta.run_data && node.meta.run_data.file && Array.isArray(node.meta.run_data.file) && node.meta.run_data.file.length > 0 && typeof node.meta.run_data.file[0]['@id'] === 'string' /* && typeof node.meta.run_data.file.display_title === 'string'*/ ); } else if (WorkflowNodeElement.isNodeParameter(node)){ return (node.meta && node.meta.run_data && ( typeof node.meta.run_data.value === 'string' || typeof node.meta.run_data.value === 'number' || typeof node.meta.run_data.value === 'boolean' )); } else if (WorkflowNodeElement.isNodeFile(node)) { // Uncomment this in-line comment once all Workflows have been upgraded and have 'step.inputs[]|outputs[].meta.type' return ( node.meta && node.meta.run_data && node.meta.run_data.file && typeof node.meta.run_data.file['@id'] === 'string' /* && typeof node.meta.run_data.file.display_title === 'string'*/ ); } } static getFileFormat(node){ /** @see https://medium.com/@JasonCust/fun-with-destructuring-assignments-ba5717c8d7e **/ const { meta : { file_format: metaFileFormat = null, run_data: nodeRunData = null } } = node; const { file : { file_format : fileFileFormat = null } = {} } = (nodeRunData || {}); if (object.itemUtil.isAnItem(fileFileFormat)) { // The file_format attached to file itself (if any) is most accurate. return fileFileFormat; } else if (object.itemUtil.isAnItem(metaFileFormat)) { // This might be inaccurate if multiple files of different formats are in an array for same input/output argument. // Is only option available for when viewing a Workflow Item (vs WorkflowRun, Provenance Graph) return metaFileFormat; } return null; } static getFileFormatString(node){ const fileFormatItem = WorkflowNodeElement.getFileFormat(node); if (!fileFormatItem) { const fileFormatStrDeprecated = (node.meta && typeof node.meta.file_format === 'string' && node.meta.file_format) || null; if (fileFormatStrDeprecated){ return fileFormatStrDeprecated; } // Some extra glitter to show lack of defined file_format. // Assuming is Workflow visualization with no run data or file_format definition pre-defined. return "Any file format"; } return (fileFormatItem && (fileFormatItem.file_format || fileFormatItem.display_title)) || null; } icon(){ const { node } = this.props; const { ioType, nodeType } = node; const fileFormatAsString = WorkflowNodeElement.getFileFormatString(node); let iconClass; if (nodeType === 'input-group' || nodeType === 'output-group'){ iconClass = 'folder-open fas'; } else if (nodeType === 'input' || nodeType === 'output'){ // By file_format if (fileFormatAsString === 'zip' || fileFormatAsString === 'tar' || fileFormatAsString === 'gz') { iconClass = 'file-zip far'; } // By meta.type & ioType else if (typeof ioType === 'undefined'){ iconClass = 'question fas'; } else if (typeof ioType === 'string') { if (WorkflowNodeElement.isNodeQCMetric(node)) { iconClass = 'check-square far'; } else if (WorkflowNodeElement.isNodeParameter(node) || ioType.indexOf('int') > -1 || ioType.indexOf('string') > -1){ iconClass = 'wrench fas'; } else if (WorkflowNodeElement.isNodeFile(node)){ iconClass = 'file-alt far'; } else { iconClass = 'question fas'; } } else if (Array.isArray(ioType)) { // Deprecated? if ( ioType[0] === 'File' || (ioType[0] === 'null' && ioType[1] === 'File') ){ iconClass = 'file-alt far'; } else if ( (ioType[0] === 'int' || ioType[0] === 'string') || (ioType[0] === 'null' && (ioType[1] === 'int' || ioType[1] === 'string')) ){ iconClass = 'wrench fas'; } } } else if (nodeType === 'step'){ iconClass = 'cogs fas'; } if (!iconClass) { iconClass = 'question fas'; } return <i className={"icon icon-fw icon-" + iconClass}/>; } tooltip(){ const { node } = this.props; const { nodeType, meta, name } = node; let output = ''; let hasRunDataFile = false; // Titles // Node Type -specific if (nodeType === 'step'){ if (meta && meta.workflow){ output += '<small>Workflow Run</small>'; // Workflow Run } else { output += '<small>Step</small>'; // Reg Step } // Step Title output += '<h5 class="text-600 tooltip-title">' + ((meta && (meta.display_title || meta.name)) || name) + '</h5>'; } if (nodeType === 'input-group'){ output += '<small>Input Argument</small>'; } if (nodeType === 'input' || nodeType === 'output'){ let argumentName = nodeType; argumentName = argumentName.charAt(0).toUpperCase() + argumentName.slice(1); hasRunDataFile = WorkflowNodeElement.isNodeFile(node) && WorkflowNodeElement.doesRunDataExist(node); const fileTitle = hasRunDataFile && (meta.run_data.file.display_title || meta.run_data.file.accession); if (fileTitle) { output += '<small>' + argumentName + ' File</small>'; output += '<h5 class="text-600 tooltip-title">' + fileTitle + '</h5>'; output += '<hr class="mt-08 mb-05"/>'; } if (argumentName === 'Input' || argumentName === 'Output'){ argumentName += ' Argument &nbsp; <span class="text-500 text-monospace">' + name + '</span>'; } output += '<small class="mb-03 d-inline-block">' + argumentName + '</small>'; } // If file, and has file-size, add it (idk, why not) const fileSize = hasRunDataFile && typeof meta.run_data.file.file_size === 'number' && meta.run_data.file.file_size; if (fileSize){ output += '<div class="mb-05"><span class="text-300">Size:</span> ' + valueTransforms.bytesToLargerUnit(meta.run_data.file.file_size) + '</div>'; } // Workflow name, if any if (nodeType === 'step' && meta && meta.workflow && meta.workflow.display_title){ // Workflow //title output += '<hr class="mt-08 mb-05"/><div class="mb-05 mt-08"><span class="text-600">Workflow: </span><span class="text-400">' + node.meta.workflow.display_title + '</span></div>'; } // Description const description = ( (typeof node.description === 'string' && node.description) || (meta && typeof meta.description === 'string' && meta.description) || (meta.run_data && meta.run_data.meta && meta.run_data.meta.description) || (meta.run_data && meta.run_data.file && typeof meta.run_data.file === 'object' && meta.run_data.file.description) ); if (description){ output += '<hr class="mt-05 mb-05"/>'; output += '<small class="mb-05 d-inline-block">' + description + '</small>'; } return output; } aboveNodeTitle(){ const { node, title, columnWidth } = this.props; const fileFormatAsString = WorkflowNodeElement.getFileFormatString(node); const elemProps = { 'style' : { 'maxWidth' : columnWidth }, 'className' : "text-truncate above-node-title", 'key' : 'above-node-title' }; if (node.nodeType === 'input-group'){ return <div {...elemProps}>{ title }</div>; } // If WorkflowRun & Workflow w/ steps w/ name if (node.nodeType === 'step' && node.meta.workflow && Array.isArray(node.meta.workflow.steps) && node.meta.workflow.steps.length > 0 && typeof node.meta.workflow.steps[0].name === 'string' ){ //elemProps.className += ' text-monospace'; return <div {...elemProps}>{ _.pluck(node.meta.workflow.steps, 'name').join(', ') }</div>; } // If Parameter if (WorkflowNodeElement.isNodeParameter(node)){ if (WorkflowNodeElement.doesRunDataExist(node)){ elemProps.className += ' text-monospace'; return <div {...elemProps}>{ node.name }</div>; } return <div {...elemProps}>Parameter</div>; } // If File if (WorkflowNodeElement.isNodeFile(node)){ if (fileFormatAsString) { return <div {...elemProps}>{ fileFormatAsString }</div>; } elemProps.className += ' text-monospace'; return <div {...elemProps}>{ title }</div>; } // If Analysis Step (--- this case is unused since node.meta.workflow.steps is used up above?) if (node.nodeType === 'step' && node.meta.uuid){ if (node.meta.uuid && Array.isArray(node.meta.analysis_step_types) && node.meta.analysis_step_types.length > 0){ return <div {...elemProps}>{ _.map(node.meta.analysis_step_types, valueTransforms.capitalize).join(', ') }</div>; } if (node.meta.workflow && Array.isArray(node.meta.workflow.experiment_types) && node.meta.workflow.experiment_types.length > 0){ // Currently these are strings but might change to linkTo Item in near future(s). // TODO: Remove this block once is never string if (typeof node.meta.workflow.experiment_types[0] === 'string'){ return <div {...elemProps}>{ _.map(node.meta.workflow.experiment_types, valueTransforms.capitalize).join(', ') }</div>; } return <div {...elemProps}>{ _.map(node.meta.workflow.experiment_types, expFxn.getExperimentTypeStr).join(', ') }</div>; } } // If IO Arg w/o file but w/ format if ((node.nodeType === 'input' || node.nodeType === 'output') && fileFormatAsString){ return <div {...elemProps}>{ fileFormatAsString }</div>; } // QC Report if (node.ioType === 'qc') { return <div {...elemProps}>Quality Control Metric</div>; } // Default-ish for IO node if (typeof node.ioType === 'string') { return <div {...elemProps}>{ valueTransforms.capitalize(node.ioType) }</div>; } return null; } belowNodeTitle(){ const { node, columnWidth } = this.props; const elemProps = { 'style' : { 'maxWidth' : columnWidth }, 'className' : "text-truncate below-node-title", 'key' : 'below-node-title' }; /* if (node.meta && typeof node.meta.argument_type === 'string') { return <div {...elemProps}><span className="lighter">{ node.meta.argument_type }</span></div>; } */ /* if (node.meta && typeof node.meta.argument_format === 'string') { return <div {...elemProps}><span className="lighter"><span className="text-500">Format: </span>{ node.meta.argument_format }</span></div>; } */ // STEPS - SOFTWARE USED function softwareTitle(s, i){ if (typeof s.name === 'string' && typeof s.version === 'string'){ return ( <React.Fragment key={object.itemUtil.atId(s) || i}> { i > 0 ? ', ' : null } { s.name } <span className="lighter">v{ s.version }</span> </React.Fragment> ); } return ( <React.Fragment key={object.itemUtil.atId(s) || i}> { i > 0 ? ', ' : null } { s.title || s.display_title } </React.Fragment> ); } if (node.nodeType === 'step' && node.meta && Array.isArray(node.meta.software_used) && node.meta.software_used.length > 0 && node.meta.software_used[0].title){ return <div {...elemProps}>{ _.map(node.meta.software_used, softwareTitle) }</div>; } if (WorkflowNodeElement.isNodeFile(node) && WorkflowNodeElement.doesRunDataExist(node)){ var belowTitle; if (node.meta && node.meta.file_type){ belowTitle = node.meta.file_type; } else if (node.meta && node.meta.run_data && node.meta.run_data.file && typeof node.meta.run_data.file === 'object' && node.meta.run_data.file.file_type){ belowTitle = node.meta.run_data.file.file_type; } else { belowTitle = <small className="text-monospace" style={{ 'bottom' : -15, 'color' : '#888' }}>{ node.name }</small>; } return <div {...elemProps}>{ belowTitle }</div>; } return null; } nodeTitle(){ const { node } = this.props; const { nodeType, ioType, name, title = null, meta : { workflow, run_data } = {} } = node; if (nodeType === 'input-group'){ var files = node.meta.run_data.file; if (Array.isArray(files)){ var len = files.length - 1; return ( <div className="node-name"> { this.icon() } <b>{ files.length - 1 }</b> similar file{ len === 1 ? '' : 's' } </div> ); } } if (nodeType === 'step' && workflow && typeof workflow === 'object' && workflow.display_title){ return <div className="node-name">{ this.icon() }{ workflow.display_title }</div>; } if (WorkflowNodeElement.isNodeFile(node) && WorkflowNodeElement.doesRunDataExist(node)){ const { file : { accession, display_title } } = run_data; return ( <div className={"node-name" + (accession ? ' text-monospace' : '')}> { this.icon() } { typeof file === 'string' ? ioType : accession || display_title } </div> ); } if (WorkflowNodeElement.isNodeParameter(node) && WorkflowNodeElement.doesRunDataExist(node)){ return <div className="node-name text-monospace">{ this.icon() }{ run_data.value }</div>; } // Fallback / Default - use node.name return <div className="node-name">{ this.icon() }{ title || name }</div>; } /** * Return a JSX element to be shown at top of right of file node * to indicate that a quality metric is present on said file. * * We can return a <a href={object.itemUtil.atId(qc)}>...</a> element, but * seems having a link on node would be bit unexpected if clicked accidentally. */ qcMarker(){ const { node, selected } = this.props; if (!WorkflowNodeElement.isNodeFile(node) || !WorkflowNodeElement.doesRunDataExist(node)){ return null; } const { meta : { run_data : { file } } } = node; const qc = file && file.quality_metric; if (!qc) return null; const qcStatus = qc.overall_quality_status && qc.overall_quality_status.toLowerCase(); const markerProps = { 'className' : "qc-present-node-marker", 'data-tip' : "This file has a quality control metric associated with it.", 'children' : "QC", 'key' : 'qc-marker' }; if (qcStatus){ if (qcStatus === 'pass') markerProps.className += ' status-passing'; else if (qcStatus === 'warn') markerProps.className += ' status-warning'; else if (qcStatus === 'error') markerProps.className += ' status-error'; } if (selected && qc.url){ markerProps.className += ' clickable'; return <a href={qc.url} target="_blank" rel="noreferrer noopener" {...markerProps} onClick={function(e){ e.preventDefault(); e.stopPropagation(); ViewMetricButton.openChildWindow(qc.url); }} />; } return <div {...markerProps} />; } render(){ return ( <div className="node-visible-element" key="outer"> <div className="innermost" data-tip={this.tooltip()} data-place="top" data-html key="node-title"> { this.nodeTitle() } </div> { this.qcMarker() } { this.belowNodeTitle() } { this.aboveNodeTitle() } </div> ); } }
node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
ralrwais/Portfolio_2017
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'));
webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
adamruzicka/foreman-tasks
import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { Icon, Button, OverlayTrigger, Tooltip } from 'patternfly-react'; import { translate as __ } from 'foremanReact/common/I18n'; import { TASKS_DASHBOARD_AVAILABLE_QUERY_STATES, TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS, } from '../../../../TasksDashboardConstants'; import { queryPropType } from '../../../../TasksDashboardPropTypes'; const tooltip = ( <Tooltip id="stopped-tooltip"> {__('Other includes all stopped tasks that are cancelled or pending')} </Tooltip> ); export const OtherInfo = ({ updateQuery, otherCount, query }) => { const { OTHER } = TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS; const { STOPPED } = TASKS_DASHBOARD_AVAILABLE_QUERY_STATES; const active = query.state === STOPPED && query.result === OTHER; return ( <span className={classNames(active && 'other-active')}> <OverlayTrigger overlay={tooltip} trigger={['hover', 'focus']} placement="bottom" > <span> <Icon type="pf" name="info" /> <span>{__('Other:')} </span> </span> </OverlayTrigger> <Button bsStyle="link" onClick={() => updateQuery({ state: STOPPED, result: OTHER, }) } > {otherCount} </Button> </span> ); }; OtherInfo.propTypes = { updateQuery: PropTypes.func.isRequired, otherCount: PropTypes.number.isRequired, query: queryPropType.isRequired, };
Console/app/node_modules/antd/es/layout/layout.js
RisenEsports/RisenEsports.github.io
import _defineProperty from 'babel-runtime/helpers/defineProperty'; import _extends from 'babel-runtime/helpers/extends'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; var __rest = this && this.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; import React from 'react'; import classNames from 'classnames'; function generator(props) { return function (BacicComponent) { return function (_React$Component) { _inherits(Adapter, _React$Component); function Adapter() { _classCallCheck(this, Adapter); return _possibleConstructorReturn(this, (Adapter.__proto__ || Object.getPrototypeOf(Adapter)).apply(this, arguments)); } _createClass(Adapter, [{ key: 'render', value: function render() { var prefixCls = props.prefixCls; return React.createElement(BacicComponent, _extends({ prefixCls: prefixCls }, this.props)); } }]); return Adapter; }(React.Component); }; } var Basic = function (_React$Component2) { _inherits(Basic, _React$Component2); function Basic() { _classCallCheck(this, Basic); return _possibleConstructorReturn(this, (Basic.__proto__ || Object.getPrototypeOf(Basic)).apply(this, arguments)); } _createClass(Basic, [{ key: 'render', value: function render() { var _a = this.props, prefixCls = _a.prefixCls, className = _a.className, children = _a.children, others = __rest(_a, ["prefixCls", "className", "children"]); var hasSider = void 0; React.Children.forEach(children, function (element) { if (element && element.type && element.type.__ANT_LAYOUT_SIDER) { hasSider = true; } }); var divCls = classNames(className, prefixCls, _defineProperty({}, prefixCls + '-has-sider', hasSider)); return React.createElement( 'div', _extends({ className: divCls }, others), children ); } }]); return Basic; }(React.Component); var Layout = generator({ prefixCls: 'ant-layout' })(Basic); var Header = generator({ prefixCls: 'ant-layout-header' })(Basic); var Footer = generator({ prefixCls: 'ant-layout-footer' })(Basic); var Content = generator({ prefixCls: 'ant-layout-content' })(Basic); Layout.Header = Header; Layout.Footer = Footer; Layout.Content = Content; export default Layout;
src/Home.js
Luanre/react-transform-boilerplate
import React, { Component } from 'react'; export default class Home extends Component { render () { return ( <div> <h1>hello</h1> </div> ) } }
Docker/KlusterKiteMonitoring/klusterkite-web/src/components/Warnings/MigratableResourcesWarning.js
KlusterKite/KlusterKite
import React from 'react'; import Relay from 'react-relay' export class MigratableResourcesWarning extends React.Component { render() { const resourceState = this.props.resourceState; return ( <div> {resourceState && resourceState.configurationState && resourceState.configurationState.migratableResources.edges.length > 0 && <div className="alert alert-warning" role="alert"> <span className="glyphicon glyphicon-alert" aria-hidden="true"></span> {' '} Migratable Resources found. </div> } </div> ); } } export default Relay.createContainer( MigratableResourcesWarning, { fragments: { resourceState: () => Relay.QL`fragment on IKlusterKiteNodeApi_ResourceState { configurationState { migratableResources { edges { node { position } } } } } `, }, }, )
src/form/DateField.js
carab/Pinarium
import React from 'react' import BaseTextField from '@material-ui/core/TextField' export default function DateField({ onChange, value, InputLabelProps, ...props }) { const handleChange = event => { const {value, name} = event.target if (onChange instanceof Function) { const computedValue = value === '' ? null : value onChange(computedValue, name) } } return ( <BaseTextField value={value === null ? '' : value} type="date" onChange={handleChange} InputLabelProps={{ shrink: true, ...InputLabelProps, }} {...props} /> ) }
app/public/index.js
jmcolella/unique-twitter-followers
import React from 'react'; import ReactDOM from 'react-dom'; import routes from '../config/routes'; import App from '../containers/App'; ReactDOM.render( routes, document.getElementById( 'app' ) );
src/svg-icons/av/av-timer.js
igorbt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvAvTimer = (props) => ( <SvgIcon {...props}> <path d="M11 17c0 .55.45 1 1 1s1-.45 1-1-.45-1-1-1-1 .45-1 1zm0-14v4h2V5.08c3.39.49 6 3.39 6 6.92 0 3.87-3.13 7-7 7s-7-3.13-7-7c0-1.68.59-3.22 1.58-4.42L12 13l1.41-1.41-6.8-6.8v.02C4.42 6.45 3 9.05 3 12c0 4.97 4.02 9 9 9 4.97 0 9-4.03 9-9s-4.03-9-9-9h-1zm7 9c0-.55-.45-1-1-1s-1 .45-1 1 .45 1 1 1 1-.45 1-1zM6 12c0 .55.45 1 1 1s1-.45 1-1-.45-1-1-1-1 .45-1 1z"/> </SvgIcon> ); AvAvTimer = pure(AvAvTimer); AvAvTimer.displayName = 'AvAvTimer'; AvAvTimer.muiName = 'SvgIcon'; export default AvAvTimer;
client/views/room/contextualBar/Threads/components/Message.stories.js
VoiSmart/Rocket.Chat
import React from 'react'; import Message from './Message'; const message = { msg: 'hello world', ts: new Date(0), username: 'guilherme.gazzo', replies: 1, participants: 2, tlm: new Date(0).toISOString(), }; const largeText = { ...message, msg: 'Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text, Large text', }; const following = { ...largeText, following: true, }; const unread = { ...largeText, unread: true, }; const all = { ...unread, all: true, }; const mention = { ...all, mention: true, }; export default { title: 'components/Threads/Message', component: Message, }; export const Basic = () => <Message {...message} />; export const LargeText = () => <Message {...largeText} />; export const Following = () => <Message {...following} />; export const Unread = () => <Message {...unread} />; export const Mention = () => <Message {...mention} />; export const MentionAll = () => <Message {...all} />;
assets/javascripts/kitten/components/graphics/icons/cb-icon/index.js
KissKissBankBank/kitten
import React from 'react' import classNames from 'classnames' export const CbIcon = ({ className, ...props }) => ( <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2051.48 845.02" width="36" className={classNames('k-ColorSvg', className)} {...props} > <title>CB</title> <path d="M2051.48 204.28C2051.48 91.6 1960.21.21 1847.56.03h-743.23v408.73h743.23v-.22c112.65-.17 203.92-91.58 203.92-204.26zm0 433.53c0-112.68-91.27-204.05-203.92-204.25h-743.23v408.76h743.23v-.26c112.65-.18 203.92-91.54 203.92-204.25zM544.31 433.54v-24.78h545.72v-34.44c0-205.23-166.35-371.6-371.58-371.6H371.63C166.39 2.72-.04 169.08-.04 374.32v99.05c0 205.22 166.39 371.6 371.62 371.6h346.86c205.23 0 371.58-166.38 371.58-371.6v-39.83z" /> </svg> )
src/client/src/Components/TimerForm/index.js
severnsc/brewing-app
import React from 'react' import Button from '../Button' import ErrorText from '../ErrorText' import FlexDiv from '../FlexDiv' import styled from 'styled-components' import PropTypes from 'prop-types' const TimerInputForm = styled.form` display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; ` const MinutesInput = styled.input` height: 1em; font: 2em arial; text-align: end; max-width: 200px; ` const Minutes = styled.span` margin-left:5px; font: 2em arial; ` const SubmitContainer = FlexDiv.extend` align-items: center; justify-content: center; width: 100%; margin-top: 10px; ` const TimerSubmit = Button.extend` width:100%; height: 3em; font: 1em arial; ` const TimerForm = ({errorText, createTimer}) => { let minutesInput const onSubmit = (e) => { e.preventDefault() createTimer(parseInt(minutesInput.value, 10)) } return( <FlexDiv> <ErrorText> {errorText} </ErrorText> <h1>Create New Timer</h1> <TimerInputForm onSubmit={onSubmit} > <div> <MinutesInput type="text" innerRef={(input) => {minutesInput = input}} /> <Minutes>minutes</Minutes> </div> <SubmitContainer> <TimerSubmit type="submit" background="#05a905"> Create Timer </TimerSubmit> </SubmitContainer> </TimerInputForm> </FlexDiv> ) } TimerForm.propTypes = { errorText: PropTypes.string.isRequired, createTimer: PropTypes.func.isRequired } export default TimerForm
Example/components/Register.js
hungtn/react-native-router-flux
import React from 'react'; import { View, Text, StyleSheet } from 'react-native'; import Button from 'react-native-button'; import { Actions } from 'react-native-router-flux'; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, }); const Register = () => ( <View style={styles.container}> <Text>Register page</Text> <Button onPress={Actions.home}>Replace screen</Button> <Button onPress={Actions.pop}>Back</Button> </View> ); export default Register;
app/containers/companies/components/create-company/index.js
kimurakenshi/caravanas
import { connect } from 'react-redux'; import { saveCompany } from 'app/actions/company-actions'; import { hasCompany } from 'app/reducers'; import React, { Component } from 'react'; import TextField from 'material-ui/TextField'; import RaisedButton from 'material-ui/RaisedButton'; import PageSubtitle from 'app/components/page-subtitle'; import styles from './style/create-company.scss'; import isEmpty from 'lodash/isEmpty'; class CreateCompany extends Component { constructor(props) { super(props); this.onCreate = this.onCreate.bind(this); this.state = { description: '', errorMessage: '', isDirty: false, isValid: true, name: '', }; } onCreate() { if (this.validateForm()) { this.props.saveCompany({ name: this.state.name.trim(), description: this.state.description.trim(), }); this.setState({ description: '', errorMessage: '', isDirty: false, isValid: true, name: '', }); } } validateForm() { if (isEmpty(this.state.name.trim())) { this.setState({ errorMessage: 'Nombre es requerido', isValid: false, isDirty: true, }); return false; } if (this.props.isExistentCompany(this.state.name.trim())) { this.setState({ errorMessage: 'Ya existe una empresa con ese nombre.', isValid: false, isDirty: true, }); return false; } return true; } render() { const errorStyle = { position: 'absolute', bottom: '-7px', }; const { name, description, } = this.state; return ( <div className={styles['create-company']}> <PageSubtitle title="Crear Empresa" /> <TextField className={styles['create-company-input']} errorStyle={errorStyle} floatingLabelText="Nombre" errorText={this.state.errorMessage} value={name} onChange={(event) => this.setState({ name: event.target.value.toUpperCase() })} /> <TextField className={styles['create-company-input']} floatingLabelText="Descripción" value={description} onChange={(event) => this.setState({ description: event.target.value })} /> <RaisedButton className={styles['create-company-action']} label="Crear" onClick={this.onCreate} primary /> </div> ); } } function mapStateToProps(state) { return { isExistentCompany: (name) => hasCompany(state, name), }; } export default connect( mapStateToProps, { saveCompany, } )(CreateCompany);
resource/js/components/Page/PageBody.js
crow-misia/crowi
import React from 'react'; export default class PageBody extends React.Component { constructor(props) { super(props); this.crowiRenderer = window.crowiRenderer; // FIXME this.getMarkupHTML = this.getMarkupHTML.bind(this); } getMarkupHTML() { let body = this.props.pageBody; if (body === '') { body = this.props.page.revision.body; } return { __html: this.crowiRenderer.render(body) }; } render() { const parsedBody = this.getMarkupHTML(); return ( <div className="content" dangerouslySetInnerHTML={parsedBody} /> ); } } PageBody.propTypes = { page: React.PropTypes.object.isRequired, pageBody: React.PropTypes.string, }; PageBody.defaultProps = { page: {}, pageBody: '', };
app/javascript/mastodon/components/avatar_composite.js
imas/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; export default class AvatarComposite extends React.PureComponent { static propTypes = { accounts: ImmutablePropTypes.list.isRequired, animate: PropTypes.bool, size: PropTypes.number.isRequired, }; static defaultProps = { animate: autoPlayGif, }; renderItem (account, size, index) { const { animate } = this.props; let width = 50; let height = 100; let top = 'auto'; let left = 'auto'; let bottom = 'auto'; let right = 'auto'; if (size === 1) { width = 100; } if (size === 4 || (size === 3 && index > 0)) { height = 50; } if (size === 2) { if (index === 0) { right = '1px'; } else { left = '1px'; } } else if (size === 3) { if (index === 0) { right = '1px'; } else if (index > 0) { left = '1px'; } if (index === 1) { bottom = '1px'; } else if (index > 1) { top = '1px'; } } else if (size === 4) { if (index === 0 || index === 2) { right = '1px'; } if (index === 1 || index === 3) { left = '1px'; } if (index < 2) { bottom = '1px'; } else { top = '1px'; } } const style = { left: left, top: top, right: right, bottom: bottom, width: `${width}%`, height: `${height}%`, backgroundSize: 'cover', backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`, }; return ( <div key={account.get('id')} style={style} /> ); } render() { const { accounts, size } = this.props; return ( <div className='account__avatar-composite' style={{ width: `${size}px`, height: `${size}px` }}> {accounts.take(4).map((account, i) => this.renderItem(account, Math.min(accounts.size, 4), i))} {accounts.size > 4 && ( <span className='account__avatar-composite__label'> +{accounts.size - 4} </span> )} </div> ); } }
src/Project.js
Miloucodaisseur/task_manager
import React from 'react'; import jQuery from 'jquery'; import { Router, Route, IndexRoute, Link, browserHistory } from 'react-router'; import ToDoList from './toDoList'; import EditableTitle from './EditableTitle'; class Project extends React.Component { constructor() { super(); this.state = { project: {} }; } componentDidMount() { this.findProject(); } findProject(){ let projectId = this.props.params.projectId; let component = this; jQuery.getJSON("https://projectapitask.herokuapp.com/projects/" + projectId + ".json", function(data) { component.setState({ project: data.project }); }); } destroy(event){ let component = this; let destroyedProject = this.state.project.id; jQuery.ajax({ type: "DELETE", url: "http://projectapitask.herokuapp.com/projects/" + destroyedProject, data: JSON.stringify({ project: destroyedProject }), contentType: "application/json", dataType: "json" }) .done(function(data){ browserHistory.push('/'); }) .fail(function(error){ console.log(error); }) } changedText(newTitle){ let oldState = this.state; let changedState = { project: { title: newTitle } } let newState = jQuery.extend(oldState, changedState); this.setState(newState); let projectId = this.props.params.projectId; jQuery.ajax({ type: "PUT", url: "https://projectapitask.herokuapp.com/projects/" + projectId + ".json", data: JSON.stringify({ project: this.state.project }), contentType: "application/json", dataType: "json" }) .done(function(data) { // something after done }) .fail(function(error) { console.log(error); }); } render() { var style = { width: '31%', padding: '20px', backgroundColor: 'white', display: 'inline-block', verticalAlign: 'top', margin: '5px', } var todo = { display: 'inline-block', verticalAlign: 'top', margin: '5px', width: '55%', } var container = { width: '1200px', margin: 'auto' } var del = { width: '140px', height: '30px', fontFamily: 'helvetica-light', fontSize: '12px', textTransform: 'uppercase', color: 'white', padding: '5px', border: 'none', backgroundColor: '#D11F57', borderRadius: '3px', letterSpacing: '1px', outline: '0' } var header = { marginLeft: '10px', fontWeight: '100' } var user = { width: '50px', height: '50px', marginRight: '20px', marginBottom: '20px', borderRadius: '50%', display: 'inline-block' } var adduser = { fontWeight: '100', color: 'lightgrey', marginTop: '20px' } return ( <div style={container}> <h1 style={header}>My Dashboard / All projects / {this.state.project.title} </h1> <div style={style}> <h2><EditableTitle value={this.state.project.title} onChange={this.changedText.bind(this)} /></h2> <p>{this.state.project.description}</p> <h2 style={adduser}>Members:</h2> <img style={user} src="https://qph.is.quoracdn.net/main-qimg-498de3782ec00063441d03e10b7548c4?convert_to_webp=true" /> <img style={user} src="https://qph.is.quoracdn.net/main-qimg-498de3782ec00063441d03e10b7548c4?convert_to_webp=true" /> <img style={user} src="http://www.tjinauyeung.nl/adduser.jpg" /> <button style={del} onClick={this.destroy.bind(this)}>Delete Project</button> </div> <div style={todo}> <ToDoList projectId={this.props.params.projectId} /> </div> </div> ); } } export default Project;
ui/src/main/js/pages/Jobs.js
rdelval/aurora
import React from 'react'; import Breadcrumb from 'components/Breadcrumb'; import JobList from 'components/JobList'; import PanelGroup, { PanelSubtitle, StandardPanelTitle } from 'components/Layout'; import Loading from 'components/Loading'; import RoleQuota from 'components/RoleQuota'; import { isNully } from 'utils/Common'; export default class Jobs extends React.Component { constructor(props) { super(props); this.state = {cluster: '', jobs: [], loading: isNully(props.jobs)}; } componentWillMount() { const that = this; this.props.api.getJobSummary(this.props.match.params.role, (response) => { const jobs = (that.props.match.params.environment) ? response.result.jobSummaryResult.summaries.filter( (j) => j.job.key.environment === that.props.match.params.environment) : response.result.jobSummaryResult.summaries; that.setState({ cluster: response.serverInfo.clusterName, loading: false, jobs }); }); this.props.api.getQuota(this.props.match.params.role, (response) => { that.setState({ cluster: response.serverInfo.clusterName, loading: false, quota: response.result.getQuotaResult }); }); } render() { return this.state.loading ? <Loading /> : (<div> <Breadcrumb cluster={this.state.cluster} env={this.props.match.params.environment} role={this.props.match.params.role} /> <div className='container'> <div className='row'> <div className='col-md-6'> <PanelGroup noPadding title={<PanelSubtitle title='Resources' />}> <RoleQuota quota={this.state.quota} /> </PanelGroup> </div> </div> <div className='row'> <div className='col-md-12'> <PanelGroup title={<StandardPanelTitle title='Jobs' />}> <JobList env={this.props.match.params.environment} jobs={this.state.jobs} /> </PanelGroup> </div> </div> </div> </div>); } }
src/utils/defaultMenuRenderer.js
OpenGov/react-select
import classNames from 'classnames'; import React from 'react'; function menuRenderer ({ focusedOption, instancePrefix, labelKey, onFocus, onSelect, optionClassName, optionComponent, optionRenderer, options, valueArray, valueKey, onOptionRef }) { let Option = optionComponent; return options.map((option, i) => { let isSelected = valueArray && valueArray.indexOf(option) > -1; let isFocused = option === focusedOption; let optionClass = classNames(optionClassName, { 'Select-option': true, 'is-selected': isSelected, 'is-focused': isFocused, 'is-disabled': option.disabled, }); return ( <Option className={optionClass} instancePrefix={instancePrefix} isDisabled={option.disabled} isFocused={isFocused} isSelected={isSelected} key={`option-${i}-${option[valueKey]}`} onFocus={onFocus} onSelect={onSelect} option={option} optionIndex={i} ref={ref => { onOptionRef(ref, isFocused); }} > {optionRenderer(option, i)} </Option> ); }); } module.exports = menuRenderer;
src/js/components/video/Share.js
linde12/grommet
// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { findDOMNode } from 'react-dom'; import Box from '../Box'; import SocialShare from '../SocialShare'; import Form from '../Form'; import FormField from '../FormField'; import CSSClassnames from '../../utils/CSSClassnames'; const CLASS_ROOT = CSSClassnames.VIDEO; const BUTTON_CLASS = `${CLASS_ROOT}__button`; export default class Overlay extends Component { constructor () { super(); this._onClickShareLink = this._onClickShareLink.bind(this); } _onClickShareLink () { findDOMNode(this.shareLinkRef).select(); } render() { const { shareLink, shareHeadline, shareText } = this.props; // this has to be null to be a valid react children let shareContent = null; if (shareLink) { shareContent = ( <Box align='center'> <Form pad={{vertical: 'small'}}> <FormField strong={true}> <input ref={ref => this.shareLinkRef = ref} className='share-link' type='text' value={shareLink} onClick={this._onClickShareLink} readOnly /> </FormField> </Form> <Box direction='row' className={BUTTON_CLASS}> <SocialShare type='email' link={shareLink} colorIndex='brand' className={`${BUTTON_CLASS}__icon`} title={shareHeadline} text={shareText} /> <SocialShare type='twitter' colorIndex='brand' className={`${BUTTON_CLASS}__icon`} link={shareLink} text={shareHeadline} /> <SocialShare type='facebook' colorIndex='brand' className={`${BUTTON_CLASS}__icon`} link={shareLink} /> <SocialShare type='linkedin' colorIndex='brand' className={`${BUTTON_CLASS}__icon`} link={shareLink} title={shareHeadline} text={shareText} /> </Box> </Box> ); } return shareContent; } } Overlay.propTypes = { shareLink: PropTypes.string, shareHeadline: PropTypes.string, shareText: PropTypes.string }; Overlay.defaultProps = { shareHeadline: '', shareText: '' };
ReportSystem/src/main/webapp/resources/js/components/common/sidermenu.js
LittleLazyCat/TXEY
import { Menu, Icon } from 'antd'; import React from 'react' const SubMenu = Menu.SubMenu; export default class SiderMenu extends React.Component { constructor(props) { super(props); this.state={ current: 'userMgt', openKeys: [] }; } handleClick(e) { window.location.hash = e.key; this.setState({ current: e.key, openKeys: e.keyPath.slice(1) }); } render() { return ( <Menu onClick={this.handleClick.bind(this)} style={{ width: '100%' }} penKeys = {this.state.openKeys} theme={'light'} defaultOpenKeys={['sub2','sub4',"sub1"]} selectedKeys={[this.state.current]} mode="inline" > <SubMenu key="sub2" title={<span><Icon type="appstore" /><span>Echarts图表示例</span></span>}> <Menu.Item key="AreaStack">折线图</Menu.Item> <Menu.Item key="HeatmapCartesian">热力图</Menu.Item> </SubMenu> <SubMenu key="sub4" title={<span><Icon type="setting" /><span>增删改查</span></span>}> <Menu.Item key="userMgt">用户管理</Menu.Item> <Menu.Item key="10">选项10</Menu.Item> <Menu.Item key="11">选项11</Menu.Item> <Menu.Item key="12">选项12</Menu.Item> </SubMenu> <SubMenu key="sub1" title={<span><Icon type="mail" /><span>导航一</span></span>}> <Menu.Item key="1">选项1</Menu.Item> <Menu.Item key="2">选项2</Menu.Item> <Menu.Item key="3">选项3</Menu.Item> <Menu.Item key="4">选项4</Menu.Item> </SubMenu> </Menu> ); } }
src/client/js/menu/MainMenu.js
GoodBoy123/crendorianinvitational
import React from 'react'; import { IndexLink, Link } from 'react-router'; class MainMenu extends React.Component { constructor(props) { super(props) } render() { return( <div className="pure-menu pure-menu-horizontal"> <ul className="pure-menu-list"> <li className="ci-Mainmenu-item"><IndexLink to='/' className="pure-menu-link ci-Mainmenu-link" activeClassName="ci-Mainmenu-link-active">News</IndexLink></li> <li className="ci-Mainmenu-item"><Link to='/schedule' className="pure-menu-link ci-Mainmenu-link" activeClassName="ci-Mainmenu-link-active">Schedule</Link></li> <li className="ci-Mainmenu-item"><a href="#" className="pure-menu-link ci-Mainmenu-link">Statistics</a></li> </ul> </div> ); } } export default MainMenu;
app/components/ContactCreated/index.js
guigonc/client_app
import React from 'react' import { Link } from 'react-router'; import { Alert } from 'react-bootstrap'; const Price = ({}) => ( <div> <Alert bsStyle="success"> <h4>Your contact has been sent!</h4> <p>Our team will get in touch!!!</p> </Alert> </div> ) export default Price
src/demos/testing-a-geospatial-app/1-smoke-tests/root.js
uber-common/vis-academy
/* global document */ import React from 'react'; import {render} from 'react-dom'; import App from './src/provider'; const Root = () => ( <div className="app-container"><App/></div> ); render(<Root />, document.body.appendChild(document.createElement('div')));
app/javascript/flavours/glitch/features/status/components/detailed_status.js
Kirishima21/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Avatar from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import StatusContent from 'flavours/glitch/components/status_content'; import MediaGallery from 'flavours/glitch/components/media_gallery'; import AttachmentList from 'flavours/glitch/components/attachment_list'; import { Link } from 'react-router-dom'; import { injectIntl, FormattedDate, FormattedMessage } from 'react-intl'; import Card from './card'; import ImmutablePureComponent from 'react-immutable-pure-component'; import Video from 'flavours/glitch/features/video'; import Audio from 'flavours/glitch/features/audio'; import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; import scheduleIdleTask from 'flavours/glitch/util/schedule_idle_task'; import classNames from 'classnames'; import PollContainer from 'flavours/glitch/containers/poll_container'; import Icon from 'flavours/glitch/components/icon'; import AnimatedNumber from 'flavours/glitch/components/animated_number'; import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; export default @injectIntl class DetailedStatus extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object, }; static propTypes = { status: ImmutablePropTypes.map, settings: ImmutablePropTypes.map.isRequired, onOpenMedia: PropTypes.func.isRequired, onOpenVideo: PropTypes.func.isRequired, onToggleHidden: PropTypes.func, expanded: PropTypes.bool, measureHeight: PropTypes.bool, onHeightChange: PropTypes.func, domain: PropTypes.string.isRequired, compact: PropTypes.bool, showMedia: PropTypes.bool, usingPiP: PropTypes.bool, onToggleMediaVisibility: PropTypes.func, intl: PropTypes.object.isRequired, }; state = { height: null, }; handleAccountClick = (e) => { if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) { e.preventDefault(); let state = {...this.context.router.history.location.state}; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state); } e.stopPropagation(); } parseClick = (e, destination) => { if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) { e.preventDefault(); let state = {...this.context.router.history.location.state}; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; this.context.router.history.push(destination, state); } e.stopPropagation(); } handleOpenVideo = (options) => { this.props.onOpenVideo(this.props.status.getIn(['media_attachments', 0]), options); } _measureHeight (heightJustChanged) { if (this.props.measureHeight && this.node) { scheduleIdleTask(() => this.node && this.setState({ height: Math.ceil(this.node.scrollHeight) + 1 })); if (this.props.onHeightChange && heightJustChanged) { this.props.onHeightChange(); } } } setRef = c => { this.node = c; this._measureHeight(); } componentDidUpdate (prevProps, prevState) { this._measureHeight(prevState.height !== this.state.height); } handleChildUpdate = () => { this._measureHeight(); } handleModalLink = e => { e.preventDefault(); let href; if (e.target.nodeName !== 'A') { href = e.target.parentNode.href; } else { href = e.target.href; } window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes'); } render () { const status = (this.props.status && this.props.status.get('reblog')) ? this.props.status.get('reblog') : this.props.status; const { expanded, onToggleHidden, settings, usingPiP, intl } = this.props; const outerStyle = { boxSizing: 'border-box' }; const { compact } = this.props; if (!status) { return null; } let media = []; let mediaIcons = []; let applicationLink = ''; let reblogLink = ''; let reblogIcon = 'retweet'; let favouriteLink = ''; let edited = ''; if (this.props.measureHeight) { outerStyle.height = `${this.state.height}px`; } if (status.get('poll')) { media.push(<PollContainer pollId={status.get('poll')} />); mediaIcons.push('tasks'); } if (usingPiP) { media.push(<PictureInPicturePlaceholder />); mediaIcons.push('video-camera'); } else if (status.get('media_attachments').size > 0) { if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) { media.push(<AttachmentList media={status.get('media_attachments')} />); } else if (status.getIn(['media_attachments', 0, 'type']) === 'audio') { const attachment = status.getIn(['media_attachments', 0]); media.push( <Audio src={attachment.get('url')} alt={attachment.get('description')} duration={attachment.getIn(['meta', 'original', 'duration'], 0)} poster={attachment.get('preview_url') || status.getIn(['account', 'avatar_static'])} backgroundColor={attachment.getIn(['meta', 'colors', 'background'])} foregroundColor={attachment.getIn(['meta', 'colors', 'foreground'])} accentColor={attachment.getIn(['meta', 'colors', 'accent'])} height={150} />, ); mediaIcons.push('music'); } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { const attachment = status.getIn(['media_attachments', 0]); media.push( <Video preview={attachment.get('preview_url')} frameRate={attachment.getIn(['meta', 'original', 'frame_rate'])} blurhash={attachment.get('blurhash')} src={attachment.get('url')} alt={attachment.get('description')} inline sensitive={status.get('sensitive')} letterbox={settings.getIn(['media', 'letterbox'])} fullwidth={settings.getIn(['media', 'fullwidth'])} preventPlayback={!expanded} onOpenVideo={this.handleOpenVideo} autoplay visible={this.props.showMedia} onToggleVisibility={this.props.onToggleMediaVisibility} />, ); mediaIcons.push('video-camera'); } else { media.push( <MediaGallery standalone sensitive={status.get('sensitive')} media={status.get('media_attachments')} letterbox={settings.getIn(['media', 'letterbox'])} fullwidth={settings.getIn(['media', 'fullwidth'])} hidden={!expanded} onOpenMedia={this.props.onOpenMedia} visible={this.props.showMedia} onToggleVisibility={this.props.onToggleMediaVisibility} />, ); mediaIcons.push('picture-o'); } } else if (status.get('card')) { media.push(<Card sensitive={status.get('sensitive')} onOpenMedia={this.props.onOpenMedia} card={status.get('card')} />); mediaIcons.push('link'); } if (status.get('application')) { applicationLink = <React.Fragment> · <a className='detailed-status__application' href={status.getIn(['application', 'website'])} target='_blank' rel='noopener noreferrer'>{status.getIn(['application', 'name'])}</a></React.Fragment>; } const visibilityLink = <React.Fragment> · <VisibilityIcon visibility={status.get('visibility')} /></React.Fragment>; if (status.get('visibility') === 'direct') { reblogIcon = 'envelope'; } else if (status.get('visibility') === 'private') { reblogIcon = 'lock'; } if (!['unlisted', 'public'].includes(status.get('visibility'))) { reblogLink = null; } else if (this.context.router) { reblogLink = ( <React.Fragment> <React.Fragment> · </React.Fragment> <Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}/reblogs`} className='detailed-status__link'> <Icon id={reblogIcon} /> <span className='detailed-status__reblogs'> <AnimatedNumber value={status.get('reblogs_count')} /> </span> </Link> </React.Fragment> ); } else { reblogLink = ( <React.Fragment> <React.Fragment> · </React.Fragment> <a href={`/interact/${status.get('id')}?type=reblog`} className='detailed-status__link' onClick={this.handleModalLink}> <Icon id={reblogIcon} /> <span className='detailed-status__reblogs'> <AnimatedNumber value={status.get('reblogs_count')} /> </span> </a> </React.Fragment> ); } if (this.context.router) { favouriteLink = ( <Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}/favourites`} className='detailed-status__link'> <Icon id='star' /> <span className='detailed-status__favorites'> <AnimatedNumber value={status.get('favourites_count')} /> </span> </Link> ); } else { favouriteLink = ( <a href={`/interact/${status.get('id')}?type=favourite`} className='detailed-status__link' onClick={this.handleModalLink}> <Icon id='star' /> <span className='detailed-status__favorites'> <AnimatedNumber value={status.get('favourites_count')} /> </span> </a> ); } if (status.get('edited_at')) { edited = ( <React.Fragment> <React.Fragment> · </React.Fragment> <FormattedMessage id='status.edited' defaultMessage='Edited {date}' values={{ date: intl.formatDate(status.get('edited_at'), { hour12: false, month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) }} /> </React.Fragment> ); } return ( <div style={outerStyle}> <div ref={this.setRef} className={classNames('detailed-status', `detailed-status-${status.get('visibility')}`, { compact })} data-status-by={status.getIn(['account', 'acct'])}> <a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'> <div className='detailed-status__display-avatar'><Avatar account={status.get('account')} size={48} /></div> <DisplayName account={status.get('account')} localDomain={this.props.domain} /> </a> <StatusContent status={status} media={media} mediaIcons={mediaIcons} expanded={expanded} collapsed={false} onExpandedToggle={onToggleHidden} parseClick={this.parseClick} onUpdate={this.handleChildUpdate} tagLinks={settings.get('tag_misleading_links')} rewriteMentions={settings.get('rewrite_mentions')} disabled /> <div className='detailed-status__meta'> <a className='detailed-status__datetime' href={status.get('url')} target='_blank' rel='noopener noreferrer'> <FormattedDate value={new Date(status.get('created_at'))} hour12={false} year='numeric' month='short' day='2-digit' hour='2-digit' minute='2-digit' /> </a>{edited}{visibilityLink}{applicationLink}{reblogLink} · {favouriteLink} </div> </div> </div> ); } }
index.js
mvader/react-categorized-tag-input
import React from 'react'; import ReactDOM from 'react-dom'; import Input from './src/index'; const categories = [ { id: 'animals', title: 'Animals', type: 'animal', items: ['Dog', 'Cat', 'Bird', 'Dolphin', 'Apes'] }, { id: 'something', title: 'Something cool', items: ['Something cool'], single: true }, { id: 'food', title: 'food', type: 'food', items: ['Apple', 'Banana', 'Grapes', 'Pear'] }, { id: 'professions', title: 'Professions', type: 'profession', items: ['Waiter', 'Writer', 'Hairdresser', 'Policeman'] } ]; function transformTag(tag) { const categoryMatches = categories.filter(category => category.id === tag.category); const categoryTitle = categoryMatches[0].title; return `${categoryTitle}/${tag.title}`; } function getTagStyle(tag){ if (tag.title === "rhino") { return { base: { backgroundColor: "gray", color: "lightgray" } } return {} } } function getCreateNewText(title, text){ return `create new ${title} "${text}"` } const Wrap = React.createClass({ getInitialState() { return { editable: true, tags: [{ title: "rhino", category: 'animals' }] }; }, toggleEdit(e) { e.preventDefault(); e.stopPropagation(); this.setState({ editable: !this.state.editable }); }, render() { return ( <div> <button onClick={this.toggleEdit}>Toggle edit</button> {this.state.editable ? <Input addNew={true} categories={categories} getTagStyle={getTagStyle} value={this.state.tags} placeholder="Add a tag" onChange={(tags) => { console.log('Changed', tags); this.setState({tags}); }} onBlur={() => { console.log('Blur'); }} transformTag={transformTag} getCreateNewText={getCreateNewText} /> : <span>Not editable</span>} </div> ); } }); ReactDOM.render( React.createElement(Wrap, {}), document.getElementById('app') );
components/ProgressiveTransitionImage/index.js
samuelngs/px
import React, { Component } from 'react'; import { Animated, View, InteractionManager } from 'react-native'; import TransitionImage from 'px/components/TransitionImage'; export default class ProgressiveTransitionImage extends Component { static defaultProps = { ...TransitionImage.defaultProps, wrapper : View, options : { }, containerStyle: null, } static propTypes = { ...TransitionImage.propTypes, wrapper : React.PropTypes.func, options : React.PropTypes.object, containerStyle: React.PropTypes.object, } state = { opacity: new Animated.Value(0), } constructor(props) { super(props); this.onLoad = this.onLoad.bind(this); } setNativeProps(props) { this.node && this.node.setNativeProps(props); } onLoad() { InteractionManager.runAfterInteractions(() => { const { onLoad } = this.props; Animated.timing(this.state.opacity, { toValue: 1, duration: 250, }).start(() => { typeof onLoad === 'function' && onLoad.call(this); }); }); } render() { const { wrapper: Wrapper, options, containerStyle, ...props } = this.props; const { opacity } = this.state; return <Wrapper { ...options } ref={n => this.node = n} style={containerStyle}> <Animated.View style={{ opacity }}> <TransitionImage { ...props } onLoad={this.onLoad} /> </Animated.View> </Wrapper> } }
app/javascript/mastodon/features/lists/components/new_list_form.js
abcang/mastodon
import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from '../../../actions/lists'; import IconButton from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ label: { id: 'lists.new.title_placeholder', defaultMessage: 'New list title' }, title: { id: 'lists.new.create', defaultMessage: 'Add list' }, }); const mapStateToProps = state => ({ value: state.getIn(['listEditor', 'title']), disabled: state.getIn(['listEditor', 'isSubmitting']), }); const mapDispatchToProps = dispatch => ({ onChange: value => dispatch(changeListEditorTitle(value)), onSubmit: () => dispatch(submitListEditor(true)), }); export default @connect(mapStateToProps, mapDispatchToProps) @injectIntl class NewListForm extends React.PureComponent { static propTypes = { value: PropTypes.string.isRequired, disabled: PropTypes.bool, intl: PropTypes.object.isRequired, onChange: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired, }; handleChange = e => { this.props.onChange(e.target.value); } handleSubmit = e => { e.preventDefault(); this.props.onSubmit(); } handleClick = () => { this.props.onSubmit(); } render () { const { value, disabled, intl } = this.props; const label = intl.formatMessage(messages.label); const title = intl.formatMessage(messages.title); return ( <form className='column-inline-form' onSubmit={this.handleSubmit}> <label> <span style={{ display: 'none' }}>{label}</span> <input className='setting-text' value={value} disabled={disabled} onChange={this.handleChange} placeholder={label} /> </label> <IconButton disabled={disabled || !value} icon='plus' title={title} onClick={this.handleClick} /> </form> ); } }
src/components/general/modals/InformationModal.js
katima-g33k/blu-react-desktop
import React from 'react'; import PropTypes from 'prop-types'; import { Button, Modal } from 'react-bootstrap'; const InformationModal = props => ( <Modal.Dialog> <Modal.Header> <Modal.Title> {props.title} </Modal.Title> </Modal.Header> <Modal.Body> {props.message} </Modal.Body> <Modal.Footer> <Button bsStyle={props.labelStyle} onClick={props.onClick} > {props.label || 'Ok'} </Button> </Modal.Footer> </Modal.Dialog> ); InformationModal.propTypes = { label: PropTypes.string, labelStyle: PropTypes.string, message: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, title: PropTypes.string.isRequired, }; export default InformationModal;
src/reconciler/proxyAdapter.js
gaearon/react-hot-loader
import React from 'react'; import { enterHotUpdate, get as getGeneration, hotComparisonOpen, setComparisonHooks } from '../global/generation'; import { getProxyByType, setStandInOptions } from './proxies'; import reconcileHotReplacement, { flushScheduledUpdates, unscheduleUpdate } from './index'; import configuration, { internalConfiguration } from '../configuration'; import { EmptyErrorPlaceholder, logException } from '../errorReporter'; import { RENDERED_GENERATION } from '../proxy'; export const renderReconciler = (target, force) => { // we are not inside parent reconcilation const currentGeneration = getGeneration(); const componentGeneration = target[RENDERED_GENERATION]; target[RENDERED_GENERATION] = currentGeneration; if (!internalConfiguration.disableProxyCreation) { if ((componentGeneration || force) && componentGeneration !== currentGeneration) { enterHotUpdate(); reconcileHotReplacement(target); return true; } } return false; }; function asyncReconciledRender(target) { renderReconciler(target, false); } export function proxyWrapper(element) { // post wrap on post render if (!internalConfiguration.disableProxyCreation) { unscheduleUpdate(this); } if (!element) { return element; } if (Array.isArray(element)) { return element.map(proxyWrapper); } if (typeof element.type === 'function') { const proxy = getProxyByType(element.type); if (proxy) { return { ...element, type: proxy.get(), }; } } return element; } const ERROR_STATE = 'react_hot_loader_catched_error'; const ERROR_STATE_PROTO = 'react_hot_loader_catched_error-prototype'; const OLD_RENDER = 'react_hot_loader_original_render'; function componentDidCatch(error, errorInfo) { this[ERROR_STATE] = { location: 'boundary', error, errorInfo, generation: getGeneration(), }; Object.getPrototypeOf(this)[ERROR_STATE_PROTO] = this[ERROR_STATE]; if (!configuration.errorReporter) { logException(error, errorInfo, this); } this.forceUpdate(); } function componentRender(...args) { const { error, errorInfo, generation } = this[ERROR_STATE] || {}; if (error && generation === getGeneration()) { return React.createElement(configuration.errorReporter || EmptyErrorPlaceholder, { error, errorInfo, component: this, }); } if (this.hotComponentUpdate) { this.hotComponentUpdate(); } try { return this[OLD_RENDER].render.call(this, ...args); } catch (renderError) { this[ERROR_STATE] = { location: 'render', error: renderError, generation: getGeneration(), }; if (!configuration.errorReporter) { logException(renderError, undefined, this); } return componentRender.call(this); } } export function retryHotLoaderError() { delete this[ERROR_STATE]; this.forceUpdate(); } setComparisonHooks( () => ({}), component => { if (!hotComparisonOpen()) { return; } const { prototype } = component; if (!prototype[OLD_RENDER]) { const renderDescriptior = Object.getOwnPropertyDescriptor(prototype, 'render'); prototype[OLD_RENDER] = { descriptor: renderDescriptior ? renderDescriptior.value : undefined, render: prototype.render, }; prototype.componentDidCatch = componentDidCatch; prototype.retryHotLoaderError = retryHotLoaderError; prototype.render = componentRender; } delete prototype[ERROR_STATE]; }, ({ prototype }) => { if (prototype[OLD_RENDER]) { const { generation } = prototype[ERROR_STATE_PROTO] || {}; if (generation === getGeneration()) { // still in error. // keep render hooked } else { delete prototype.componentDidCatch; delete prototype.retryHotLoaderError; // undo only what we did if (prototype.render === componentRender) { if (!prototype[OLD_RENDER].descriptor) { delete prototype.render; } else { prototype.render = prototype[OLD_RENDER].descriptor; } } else { console.error('React-Hot-Loader: something unexpectedly mutated Component', prototype); } delete prototype[ERROR_STATE_PROTO]; delete prototype[OLD_RENDER]; } } }, ); setStandInOptions({ componentWillRender: asyncReconciledRender, componentDidRender: proxyWrapper, componentDidUpdate: component => { component[RENDERED_GENERATION] = getGeneration(); flushScheduledUpdates(); }, });
src/svg-icons/action/bookmark-border.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionBookmarkBorder = (props) => ( <SvgIcon {...props}> <path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"/> </SvgIcon> ); ActionBookmarkBorder = pure(ActionBookmarkBorder); ActionBookmarkBorder.displayName = 'ActionBookmarkBorder'; ActionBookmarkBorder.muiName = 'SvgIcon'; export default ActionBookmarkBorder;
docs/src/app/components/pages/components/IconButton/Page.js
ruifortes/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 iconButtonCode from '!raw!material-ui/IconButton/IconButton'; import iconButtonReadmeText from './README'; import iconButtonExampleSimpleCode from '!raw!./ExampleSimple'; import IconButtonExampleSimple from './ExampleSimple'; import iconButtonExampleComplexCode from '!raw!./ExampleComplex'; import IconButtonExampleComplex from './ExampleComplex'; import iconButtonExampleSizeCode from '!raw!./ExampleSize'; import IconButtonExampleSize from './ExampleSize'; import iconButtonExampleTooltipCode from '!raw!./ExampleTooltip'; import IconButtonExampleTooltip from './ExampleTooltip'; import iconButtonExampleTouchCode from '!raw!./ExampleTouch'; import IconButtonExampleTouch from './ExampleTouch'; const descriptions = { simple: 'An Icon Button using an icon specified with the `iconClassName` property, and a `disabled` example.', tooltip: 'Icon Buttons showing the available `tooltip` positions.', touch: 'The `touch` property adjusts the tooltip size for better visibility on mobile devices.', size: 'Examples of Icon Button in different sizes.', other: 'An Icon Button using a nested [Font Icon](/#/components/font-icon), ' + 'a nested [SVG Icon](/#/components/svg-icon) and an icon font ligature.', }; const IconButtonPage = () => ( <div> <Title render={(previousTitle) => `Icon Button - ${previousTitle}`} /> <MarkdownElement text={iconButtonReadmeText} /> <CodeExample title="Simple example" description={descriptions.simple} code={iconButtonExampleSimpleCode} > <IconButtonExampleSimple /> </CodeExample> <CodeExample title="Further examples" description={descriptions.other} code={iconButtonExampleComplexCode} > <IconButtonExampleComplex /> </CodeExample> <CodeExample title="Size examples" description={descriptions.size} code={iconButtonExampleSizeCode} > <IconButtonExampleSize /> </CodeExample> <CodeExample title="Tooltip examples" description={descriptions.tooltip} code={iconButtonExampleTooltipCode} > <IconButtonExampleTooltip /> </CodeExample> <CodeExample title="Touch example" description={descriptions.touch} code={iconButtonExampleTouchCode} > <IconButtonExampleTouch /> </CodeExample> <PropTypeDescription code={iconButtonCode} /> </div> ); export default IconButtonPage;
packages/mineral-ui-icons/src/IconLocalSee.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 IconLocalSee(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <circle cx="12" cy="12" r="3.2"/><path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"/> </g> </Icon> ); } IconLocalSee.displayName = 'IconLocalSee'; IconLocalSee.category = 'maps';
src/svg-icons/action/view-array.js
rhaedes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionViewArray = (props) => ( <SvgIcon {...props}> <path d="M4 18h3V5H4v13zM18 5v13h3V5h-3zM8 18h9V5H8v13z"/> </SvgIcon> ); ActionViewArray = pure(ActionViewArray); ActionViewArray.displayName = 'ActionViewArray'; export default ActionViewArray;
frontend/src/Settings/CustomFormats/CustomFormats/Specifications/AddSpecificationPresetMenuItem.js
geogolem/Radarr
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import MenuItem from 'Components/Menu/MenuItem'; class AddSpecificationPresetMenuItem extends Component { // // Listeners onPress = () => { const { name, implementation } = this.props; this.props.onPress({ name, implementation }); } // // Render render() { const { name, implementation, ...otherProps } = this.props; return ( <MenuItem {...otherProps} onPress={this.onPress} > {name} </MenuItem> ); } } AddSpecificationPresetMenuItem.propTypes = { name: PropTypes.string.isRequired, implementation: PropTypes.string.isRequired, onPress: PropTypes.func.isRequired }; export default AddSpecificationPresetMenuItem;
src/client/main.js
jirastom/react-learnig
import React from 'react'; import Router from 'react-router'; import routes from './routes'; const app = document.getElementById('app'); const initialState = window._initialState; Router.run(routes, Router.HistoryLocation, (Handler) => { React.render(<Handler initialState={initialState} />, app); });
frontend/src/Settings/ImportLists/ImportListExclusions/EditImportListExclusionModalContentConnector.js
lidarr/Lidarr
import _ from 'lodash'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { saveImportListExclusion, setImportListExclusionValue } from 'Store/Actions/settingsActions'; import selectSettings from 'Store/Selectors/selectSettings'; import EditImportListExclusionModalContent from './EditImportListExclusionModalContent'; const newImportListExclusion = { artistName: '', foreignId: '' }; function createImportListExclusionSelector() { return createSelector( (state, { id }) => id, (state) => state.settings.importListExclusions, (id, importListExclusions) => { const { isFetching, error, isSaving, saveError, pendingChanges, items } = importListExclusions; const mapping = id ? _.find(items, { id }) : newImportListExclusion; const settings = selectSettings(mapping, pendingChanges, saveError); return { id, isFetching, error, isSaving, saveError, item: settings.settings, ...settings }; } ); } function createMapStateToProps() { return createSelector( createImportListExclusionSelector(), (importListExclusion) => { return { ...importListExclusion }; } ); } const mapDispatchToProps = { setImportListExclusionValue, saveImportListExclusion }; class EditImportListExclusionModalContentConnector extends Component { // // Lifecycle componentDidMount() { if (!this.props.id) { Object.keys(newImportListExclusion).forEach((name) => { this.props.setImportListExclusionValue({ name, value: newImportListExclusion[name] }); }); } } componentDidUpdate(prevProps, prevState) { if (prevProps.isSaving && !this.props.isSaving && !this.props.saveError) { this.props.onModalClose(); } } // // Listeners onInputChange = ({ name, value }) => { this.props.setImportListExclusionValue({ name, value }); } onSavePress = () => { this.props.saveImportListExclusion({ id: this.props.id }); } // // Render render() { return ( <EditImportListExclusionModalContent {...this.props} onSavePress={this.onSavePress} onInputChange={this.onInputChange} /> ); } } EditImportListExclusionModalContentConnector.propTypes = { id: PropTypes.number, isSaving: PropTypes.bool.isRequired, saveError: PropTypes.object, item: PropTypes.object.isRequired, setImportListExclusionValue: PropTypes.func.isRequired, saveImportListExclusion: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired }; export default connect(createMapStateToProps, mapDispatchToProps)(EditImportListExclusionModalContentConnector);
packages/material-ui-icons/src/AirplanemodeInactive.js
dsslimshaddy/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let AirplanemodeInactive = props => <SvgIcon {...props}> <path d="M13 9V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v3.68l7.83 7.83L21 16v-2l-8-5zM3 5.27l4.99 4.99L2 14v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-3.73L18.73 21 20 19.73 4.27 4 3 5.27z" /> </SvgIcon>; AirplanemodeInactive = pure(AirplanemodeInactive); AirplanemodeInactive.muiName = 'SvgIcon'; export default AirplanemodeInactive;
tests/lib/rules/indent.js
dguo/eslint
/** * @fileoverview This option sets a specific tab width for your code * @author Dmitriy Shekhovtsov * @author Gyandeep Singh * @copyright 2014 Dmitriy Shekhovtsov. All rights reserved. * @copyright 2015 Gyandeep Singh. All rights reserved. */ "use strict"; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ var rule = require("../../../lib/rules/indent"), RuleTester = require("../../../lib/testers/rule-tester"); var fs = require("fs"); var path = require("path"); //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ var fixture = fs.readFileSync(path.join(__dirname, "../../fixtures/rules/indent/indent-invalid-fixture-1.js"), "utf8"); var fixedFixture = fs.readFileSync(path.join(__dirname, "../../fixtures/rules/indent/indent-valid-fixture-1.js"), "utf8"); /** * Create error message object for failure cases * @param {string} indentType indent type of string or tab * @param {array} errors error info * @returns {object} returns the error messages collection * @private */ function expectedErrors(indentType, errors) { if (Array.isArray(indentType)) { errors = indentType; indentType = "space"; } if (!errors[0].length) { errors = [errors]; } return errors.map(function(err) { var chars = err[1] === 1 ? "character" : "characters"; return { message: "Expected indentation of " + err[1] + " " + indentType + " " + chars + " but found " + err[2] + ".", type: err[3] || "Program", line: err[0] }; }); } var ruleTester = new RuleTester(); ruleTester.run("indent", rule, { valid: [ { code: "function test() {\n" + " return client.signUp(email, PASSWORD, { preVerified: true })\n" + " .then(function (result) {\n" + " // hi\n" + " })\n" + " .then(function () {\n" + " return FunctionalHelpers.clearBrowserState(self, {\n" + " contentServer: true,\n" + " contentServer1: true\n" + " });\n" + " });\n" + "}", options: [2] }, { code: "function test() {\n" + " return client.signUp(email, PASSWORD, { preVerified: true })\n" + " .then(function (result) {\n" + " var x = 1;\n" + " var y = 1;\n" + " }, function(err){\n" + " var o = 1 - 2;\n" + " var y = 1 - 2;\n" + " return true;\n" + " });\n" + "}", options: [4] }, { code: "// hi", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var Command = function() {\n" + " var fileList = [],\n" + " files = []\n" + "\n" + " files.concat(fileList)\n" + "};\n", options: [2, {"VariableDeclarator": { "var": 2, "let": 2, "const": 3}}] }, { code: " ", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "if(data) {\n" + " console.log('hi');\n" + " b = true;};", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "foo = () => {\n" + " console.log('hi');\n" + " return true;};", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}], ecmaFeatures: {arrowFunctions: true} }, { code: "function test(data) {\n" + " console.log('hi');\n" + " return true;};", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var test = function(data) {\n" + " console.log('hi');\n" + "};", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "arr.forEach(function(data) {\n" + " otherdata.forEach(function(zero) {\n" + " console.log('hi');\n" + " }) });", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "a = [\n" + " ,3\n" + "]", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "[\n" + " ['gzip', 'gunzip'],\n" + " ['gzip', 'unzip'],\n" + " ['deflate', 'inflate'],\n" + " ['deflateRaw', 'inflateRaw'],\n" + "].forEach(function(method) {\n" + " console.log(method);\n" + "});\n", options: [2, {"SwitchCase": 1, "VariableDeclarator": 2}] }, { code: "test(123, {\n" + " bye: {\n" + " hi: [1,\n" + " {\n" + " b: 2\n" + " }\n" + " ]\n" + " }\n" + "});", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var xyz = 2,\n" + " lmn = [\n" + " {\n" + " a: 1\n" + " }\n" + " ];", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "lmn = [{\n" + " a: 1\n" + "},\n" + "{\n" + " b: 2\n" + "}," + "{\n" + " x: 2\n" + "}];", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "abc({\n" + " test: [\n" + " [\n" + " c,\n" + " xyz,\n" + " 2\n" + " ].join(',')\n" + " ]\n" + "});", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "abc = {\n" + " test: [\n" + " [\n" + " c,\n" + " xyz,\n" + " 2\n" + " ]\n" + " ]\n" + "};", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "abc(\n" + " {\n" + " a: 1,\n" + " b: 2\n" + " }\n" + ");", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "abc({\n" + " a: 1,\n" + " b: 2\n" + "});", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var abc = \n" + " [\n" + " c,\n" + " xyz,\n" + " {\n" + " a: 1,\n" + " b: 2\n" + " }\n" + " ];", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var abc = [\n" + " c,\n" + " xyz,\n" + " {\n" + " a: 1,\n" + " b: 2\n" + " }\n" + "];", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var abc = 5,\n" + " c = 2,\n" + " xyz = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "var abc = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "var a = new abc({\n" + " a: 1,\n" + " b: 2\n" + " }),\n" + " b = 2;", options: [4, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var a = 2,\n" + " c = {\n" + " a: 1,\n" + " b: 2\n" + " },\n" + " b = 2;", options: [2, {"VariableDeclarator": 1, "SwitchCase": 1}] }, { code: "var x = 2,\n" + " y = {\n" + " a: 1,\n" + " b: 2\n" + " },\n" + " b = 2;", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "var e = {\n" + " a: 1,\n" + " b: 2\n" + " },\n" + " b = 2;", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "var a = {\n" + " a: 1,\n" + " b: 2\n" + "};", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "function test() {\n" + " if (true ||\n " + " false){\n" + " console.log(val);\n" + " }\n" + "}", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "for (var val in obj)\n" + " if (true)\n" + " console.log(val);", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "if(true)\n" + " if (true)\n" + " if (true)\n" + " console.log(val);", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "function hi(){ var a = 1;\n" + " y++; x++;\n" + "}", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "for(;length > index; index++)if(NO_HOLES || index in self){\n" + " x++;\n" + "}", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "function test(){\n" + " switch(length){\n" + " case 1: return function(a){\n" + " return fn.call(that, a);\n" + " };\n" + " }\n" + "}", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}] }, { code: "var geometry = 2,\n" + "rotate = 2;", options: [2, {VariableDeclarator: 0}] }, { code: "var geometry,\n" + " rotate;", options: [4, {VariableDeclarator: 1}] }, { code: "var geometry,\n" + "\trotate;", options: ["tab", {VariableDeclarator: 1}] }, { code: "var geometry,\n" + " rotate;", options: [2, {VariableDeclarator: 1}] }, { code: "var geometry,\n" + " rotate;", options: [2, {VariableDeclarator: 2}] }, { code: "let geometry,\n" + " rotate;", options: [2, {VariableDeclarator: 2}], ecmaFeatures: { blockBindings: true } }, { code: "const geometry = 2,\n" + " rotate = 3;", options: [2, {VariableDeclarator: 2}], ecmaFeatures: { blockBindings: true } }, { code: "var geometry, box, face1, face2, colorT, colorB, sprite, padding, maxWidth,\n" + " height, rotate;", options: [2, {SwitchCase: 1}] }, { code: "var geometry, box, face1, face2, colorT, colorB, sprite, padding, maxWidth;", options: [2, {SwitchCase: 1}] }, { code: "if (1 < 2){\n" + "//hi sd \n" + "}", options: [2] }, { code: "while (1 < 2){\n" + " //hi sd \n" + "}", options: [2] }, { code: "while (1 < 2) console.log('hi');", options: [2] }, { code: "[a, b, \nc].forEach((index) => {\n" + " index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true } }, { code: "[a, b, \nc].forEach(function(index){\n" + " return index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true } }, { code: "[a, b, c].forEach((index) => {\n" + " index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true } }, { code: "[a, b, c].forEach(function(index){\n" + " return index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true } }, { code: "switch (x) {\n" + " case \"foo\":\n" + " a();\n" + " break;\n" + " case \"bar\":\n" + " switch (y) {\n" + " case \"1\":\n" + " break;\n" + " case \"2\":\n" + " a = 6;\n" + " break;\n" + " }\n" + " case \"test\":\n" + " break;\n" + "}", options: [4, {SwitchCase: 1}] }, { code: "switch (x) {\n" + " case \"foo\":\n" + " a();\n" + " break;\n" + " case \"bar\":\n" + " switch (y) {\n" + " case \"1\":\n" + " break;\n" + " case \"2\":\n" + " a = 6;\n" + " break;\n" + " }\n" + " case \"test\":\n" + " break;\n" + "}", options: [4, {SwitchCase: 2}] }, { code: "switch (a) {\n" + "case \"foo\":\n" + " a();\n" + " break;\n" + "case \"bar\":\n" + " switch(x){\n" + " case '1':\n" + " break;\n" + " case '2':\n" + " a = 6;\n" + " break;\n" + " }\n" + "}" }, { code: "switch (a) {\n" + "case \"foo\":\n" + " a();\n" + " break;\n" + "case \"bar\":\n" + " if(x){\n" + " a = 2;\n" + " }\n" + " else{\n" + " a = 6;\n" + " }\n" + "}" }, { code: "switch (a) {\n" + "case \"foo\":\n" + " a();\n" + " break;\n" + "case \"bar\":\n" + " if(x){\n" + " a = 2;\n" + " }\n" + " else\n" + " a = 6;\n" + "}" }, { code: "switch (a) {\n" + "case \"foo\":\n" + " a();\n" + " break;\n" + "case \"bar\":\n" + " a(); break;\n" + "case \"baz\":\n" + " a(); break;\n" + "}" }, { code: "switch (0) {\n}" }, { code: "function foo() {\n" + " var a = \"a\";\n" + " switch(a) {\n" + " case \"a\":\n" + " return \"A\";\n" + " case \"b\":\n" + " return \"B\";\n" + " }\n" + "}\n" + "foo();" }, { code: "switch(value){\n" + " case \"1\":\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " a();\n" + " break;\n" + "}\n" + "switch(value){\n" + " case \"1\":\n" + " a();\n" + " break;\n" + " case \"2\":\n" + " break;\n" + " default:\n" + " break;\n" + "}", options: [4, {SwitchCase: 1}] }, { code: "var obj = {foo: 1, bar: 2};\n" + "with (obj) {\n" + " console.log(foo + bar);\n" + "}\n" }, { code: "if (a) {\n" + " (1 + 2 + 3);\n" + // no error on this line "}" }, { code: "switch(value){ default: a(); break; }\n" }, { code: "import {addons} from 'react/addons'\nimport React from 'react'", options: [2], ecmaFeatures: { modules: true } }, { code: "var a = 1,\n" + " b = 2,\n" + " c = 3;\n", options: [4] }, { code: "var a = 1\n" + " ,b = 2\n" + " ,c = 3;\n", options: [4] }, { code: "while (1 < 2) console.log('hi')\n", options: [2] }, { code: "function salutation () {\n" + " switch (1) {\n" + " case 0: return console.log('hi')\n" + " case 1: return console.log('hey')\n" + " }\n" + "}\n", options: [2, { SwitchCase: 1 }] }, { code: "var items = [\n" + " {\n" + " foo: 'bar'\n" + " }\n" + "];\n", options: [2, {"VariableDeclarator": 2}] }, { code: "const geometry = 2,\n" + " rotate = 3;\n" + "var a = 1,\n" + " b = 2;\n" + "let light = true,\n" + " shadow = false;", options: [2, { VariableDeclarator: { "const": 3, "let": 2 } }], ecmaFeatures: { blockBindings: true } }, { code: "const abc = 5,\n" + " c = 2,\n" + " xyz = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };\n" + "let abc = 5,\n" + " c = 2,\n" + " xyz = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };\n" + "var abc = 5,\n" + " c = 2,\n" + " xyz = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };\n", options: [2, { VariableDeclarator: { var: 2, const: 3 }, "SwitchCase": 1}], ecmaFeatures: { blockBindings: true } }, { code: "module.exports =\n" + "{\n" + " 'Unit tests':\n" + " {\n" + " rootPath: './',\n" + " environment: 'node',\n" + " tests:\n" + " [\n" + " 'test/test-*.js'\n" + " ],\n" + " sources:\n" + " [\n" + " '*.js',\n" + " 'test/**.js'\n" + " ]\n" + " }\n" + "};", options: [2] }, { code: "var path = require('path')\n" + " , crypto = require('crypto')\n" + " ;\n", options: [2] }, { code: "var a = 1\n" + " ,b = 2\n" + " ;" }, { code: "export function create (some,\n" + " argument) {\n" + " return Object.create({\n" + " a: some,\n" + " b: argument\n" + " });\n" + "};", ecmaFeatures: { modules: true }, options: [2] }, { code: "export function create (id, xfilter, rawType,\n" + " width=defaultWidth, height=defaultHeight,\n" + " footerHeight=defaultFooterHeight,\n" + " padding=defaultPadding) {\n" + " // ... function body, indented two spaces\n" + "}\n", ecmaFeatures: { modules: true, defaultParams: true }, options: [2] }, { code: "var obj = {\n" + " foo: function () {\n" + " return new p()\n" + " .then(function (ok) {\n" + " return ok;\n" + " }, function () {\n" + " // ignore things\n" + " });\n" + " }\n" + "};\n", options: [2] }, { code: "a.b()\n" + " .c(function(){\n" + " var a;\n" + " }).d.e;\n", options: [2] }, { code: "const YO = 'bah',\n" + " TE = 'mah'\n" + "\n" + "var res,\n" + " a = 5,\n" + " b = 4\n", ecmaFeatures: { blockBindings: true }, options: [2, {"VariableDeclarator": { "var": 2, "let": 2, "const": 3}}] }, { code: "const YO = 'bah',\n" + " TE = 'mah'\n" + "\n" + "var res,\n" + " a = 5,\n" + " b = 4\n" + "\n" + "if (YO) console.log(TE)", ecmaFeatures: { blockBindings: true }, options: [2, {"VariableDeclarator": { "var": 2, "let": 2, "const": 3}}] }, { code: "var foo = 'foo',\n" + " bar = 'bar',\n" + " baz = function() {\n" + " \n" + " }\n" + "\n" + "function hello () {\n" + " \n" + "}\n", options: [2] }, { code: "var obj = {\n" + " send: function () {\n" + " return P.resolve({\n" + " type: 'POST'\n" + " })\n" + " .then(function () {\n" + " return true;\n" + " }, function () {\n" + " return false;\n" + " });\n" + " }\n" + "};\n", options: [2] }, { code: "const someOtherFunction = argument => {\n" + " console.log(argument);\n" + " },\n" + " someOtherValue = 'someOtherValue';\n", ecmaFeatures: { arrowFunctions: true, blockBindings: true } } ], invalid: [ { code: "var a = b;\n" + "if (a) {\n" + "b();\n" + "}\n", options: [2], errors: expectedErrors([[3, 2, 0, "ExpressionStatement"]]), output: "var a = b;\n" + "if (a) {\n" + " b();\n" + "}\n" }, { code: "if (array.some(function(){\n" + " return true;\n" + "})) {\n" + "a++; // ->\n" + " b++;\n" + " c++; // <-\n" + "}\n", output: "if (array.some(function(){\n" + " return true;\n" + "})) {\n" + " a++; // ->\n" + " b++;\n" + " c++; // <-\n" + "}\n", options: [2], errors: expectedErrors([[4, 2, 0, "ExpressionStatement"], [6, 2, 4, "ExpressionStatement"]]) }, { code: "if (a){\n\tb=c;\n\t\tc=d;\ne=f;\n}", output: "if (a){\n\tb=c;\n\tc=d;\n\te=f;\n}", options: ["tab"], errors: expectedErrors("tab", [[3, 1, 2, "ExpressionStatement"], [4, 1, 0, "ExpressionStatement"]]) }, { code: "if (a){\n b=c;\n c=d;\n e=f;\n}", output: "if (a){\n b=c;\n c=d;\n e=f;\n}", options: [4], errors: expectedErrors([[3, 4, 6, "ExpressionStatement"], [4, 4, 1, "ExpressionStatement"]]) }, { code: fixture, output: fixedFixture, options: [2, {SwitchCase: 1}], errors: expectedErrors([ [5, 2, 4, "VariableDeclaration"], [10, 4, 6, "BlockStatement"], [11, 2, 4, "BlockStatement"], [15, 4, 2, "ExpressionStatement"], [16, 2, 4, "BlockStatement"], [23, 2, 4, "BlockStatement"], [29, 2, 4, "ForStatement"], [31, 4, 2, "BlockStatement"], [36, 4, 6, "ExpressionStatement"], [38, 2, 4, "BlockStatement"], [39, 4, 2, "ExpressionStatement"], [40, 2, 0, "BlockStatement"], [46, 0, 1, "VariableDeclaration"], [54, 2, 4, "BlockStatement"], [114, 4, 2, "VariableDeclaration"], [120, 4, 6, "VariableDeclaration"], [124, 4, 2, "BreakStatement"], [134, 4, 6, "BreakStatement"], [143, 4, 0, "ExpressionStatement"], [151, 4, 6, "ExpressionStatement"], [159, 4, 2, "ExpressionStatement"], [161, 4, 6, "ExpressionStatement"], [175, 2, 0, "ExpressionStatement"], [177, 2, 4, "ExpressionStatement"], [189, 2, 0, "VariableDeclaration"], [193, 6, 4, "ExpressionStatement"], [195, 6, 8, "ExpressionStatement"], [304, 4, 6, "ExpressionStatement"], [306, 4, 8, "ExpressionStatement"], [307, 2, 4, "BlockStatement"], [308, 2, 4, "VariableDeclarator"], [311, 4, 6, "Identifier"], [312, 4, 6, "Identifier"], [313, 4, 6, "Identifier"], [314, 2, 4, "ArrayExpression"], [315, 2, 4, "VariableDeclarator"], [318, 4, 6, "Property"], [319, 4, 6, "Property"], [320, 4, 6, "Property"], [321, 2, 4, "ObjectExpression"], [322, 2, 4, "VariableDeclarator"], [326, 2, 1, "Literal"], [327, 2, 1, "Literal"], [328, 2, 1, "Literal"], [329, 2, 1, "Literal"], [330, 2, 1, "Literal"], [331, 2, 1, "Literal"], [332, 2, 1, "Literal"], [333, 2, 1, "Literal"], [334, 2, 1, "Literal"], [335, 2, 1, "Literal"], [340, 2, 4, "ExpressionStatement"], [341, 2, 0, "ExpressionStatement"], [344, 2, 4, "ExpressionStatement"], [345, 2, 0, "ExpressionStatement"], [348, 2, 4, "ExpressionStatement"], [349, 2, 0, "ExpressionStatement"], [355, 2, 0, "ExpressionStatement"], [357, 2, 4, "ExpressionStatement"], [361, 4, 6, "ExpressionStatement"], [362, 2, 4, "BlockStatement"], [363, 2, 4, "VariableDeclarator"], [368, 2, 0, "SwitchCase"], [370, 2, 4, "SwitchCase"], [374, 4, 6, "VariableDeclaration"], [376, 4, 2, "VariableDeclaration"], [383, 2, 0, "ExpressionStatement"], [385, 2, 4, "ExpressionStatement"], [390, 2, 0, "ExpressionStatement"], [392, 2, 4, "ExpressionStatement"], [409, 2, 0, "ExpressionStatement"], [410, 2, 4, "ExpressionStatement"], [415, 6, 2, "ExpressionStatement"], [416, 6, 0, "ExpressionStatement"], [417, 6, 4, "ExpressionStatement"], [418, 4, 0, "BlockStatement"], [422, 2, 4, "ExpressionStatement"], [423, 2, 0, "ExpressionStatement"], [427, 2, 6, "ExpressionStatement"], [428, 2, 8, "ExpressionStatement"], [429, 2, 4, "ExpressionStatement"], [430, 0, 4, "BlockStatement"], [433, 2, 4, "ExpressionStatement"], [434, 0, 4, "BlockStatement"], [437, 2, 0, "ExpressionStatement"], [438, 0, 4, "BlockStatement"], [442, 4, 2, "ExpressionStatement"], [443, 4, 2, "ExpressionStatement"], [444, 2, 0, "BlockStatement"], [451, 2, 0, "ExpressionStatement"], [453, 2, 4, "ExpressionStatement"], [499, 6, 8, "BlockStatement"], [500, 10, 8, "ExpressionStatement"], [501, 8, 6, "BlockStatement"], [506, 6, 8, "BlockStatement"] ]) }, { code: "switch(value){\n" + " case \"1\":\n" + " a();\n" + " break;\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " a();\n" + " break;\n" + "}", output: "switch(value){\n" + " case \"1\":\n" + " a();\n" + " break;\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " a();\n" + " break;\n" + "}", options: [4, {SwitchCase: 1}], errors: expectedErrors([[4, 8, 4, "BreakStatement"], [7, 8, 4, "BreakStatement"]]) }, { code: "switch(value){\n" + " case \"1\":\n" + " a();\n" + " break;\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " break;\n" + "}", output: "switch(value){\n" + " case \"1\":\n" + " a();\n" + " break;\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " break;\n" + "}", options: [4, {SwitchCase: 1}], errors: expectedErrors([9, 8, 4, "BreakStatement"]) }, { code: "switch(value){\n" + " case \"1\":\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " break;\n" + "}\n" + "switch(value){\n" + " case \"1\":\n" + " break;\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " a();\n" + " break;\n" + "}", output: "switch(value){\n" + " case \"1\":\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " break;\n" + "}\n" + "switch(value){\n" + " case \"1\":\n" + " break;\n" + " case \"2\":\n" + " a();\n" + " break;\n" + " default:\n" + " a();\n" + " break;\n" + "}", options: [4, {SwitchCase: 1}], errors: expectedErrors([[11, 8, 4, "BreakStatement"], [14, 8, 4, "BreakStatement"], [17, 8, 4, "BreakStatement"]]) }, { code: "switch(value){\n" + "case \"1\":\n" + " a();\n" + " break;\n" + " case \"2\":\n" + " break;\n" + " default:\n" + " break;\n" + "}", output: "switch(value){\n" + "case \"1\":\n" + " a();\n" + " break;\n" + "case \"2\":\n" + " break;\n" + "default:\n" + " break;\n" + "}", options: [4], errors: expectedErrors([ [3, 4, 8, "ExpressionStatement"], [4, 4, 8, "BreakStatement"], [5, 0, 4, "SwitchCase"], [6, 4, 8, "BreakStatement"], [7, 0, 4, "SwitchCase"], [8, 4, 8, "BreakStatement"] ]) }, { code: "var obj = {foo: 1, bar: 2};\n" + "with (obj) {\n" + "console.log(foo + bar);\n" + "}\n", output: "var obj = {foo: 1, bar: 2};\n" + "with (obj) {\n" + " console.log(foo + bar);\n" + "}\n", errors: expectedErrors([3, 4, 0, "ExpressionStatement"]) }, { code: "switch (a) {\n" + "case '1':\n" + "b();\n" + "break;\n" + "default:\n" + "c();\n" + "break;\n" + "}\n", output: "switch (a) {\n" + " case '1':\n" + " b();\n" + " break;\n" + " default:\n" + " c();\n" + " break;\n" + "}\n", options: [4, {SwitchCase: 1}], errors: expectedErrors([ [2, 4, 0, "SwitchCase"], [3, 8, 0, "ExpressionStatement"], [4, 8, 0, "BreakStatement"], [5, 4, 0, "SwitchCase"], [6, 8, 0, "ExpressionStatement"], [7, 8, 0, "BreakStatement"] ]) }, { code: "while (a) \n" + "b();", output: "while (a) \n" + " b();", options: [4], errors: expectedErrors([ [2, 4, 0, "ExpressionStatement"] ]) }, { code: "for (;;) \n" + "b();", output: "for (;;) \n" + " b();", options: [4], errors: expectedErrors([ [2, 4, 0, "ExpressionStatement"] ]) }, { code: "for (a in x) \n" + "b();", output: "for (a in x) \n" + " b();", options: [4], errors: expectedErrors([ [2, 4, 0, "ExpressionStatement"] ]) }, { code: "do \n" + "b();\n" + "while(true)", output: "do \n" + " b();\n" + "while(true)", options: [4], errors: expectedErrors([ [2, 4, 0, "ExpressionStatement"] ]) }, { code: "if(true) \n" + "b();", output: "if(true) \n" + " b();", options: [4], errors: expectedErrors([ [2, 4, 0, "ExpressionStatement"] ]) }, { code: "var test = {\n" + " a: 1,\n" + " b: 2\n" + " };\n", output: "var test = {\n" + " a: 1,\n" + " b: 2\n" + "};\n", options: [2], errors: expectedErrors([ [2, 2, 6, "Property"], [3, 2, 4, "Property"], [4, 0, 4, "ObjectExpression"] ]) }, { code: "var a = function() {\n" + " a++;\n" + " b++;\n" + " c++;\n" + " },\n" + " b;\n", output: "var a = function() {\n" + " a++;\n" + " b++;\n" + " c++;\n" + " },\n" + " b;\n", options: [4], errors: expectedErrors([ [2, 8, 6, "ExpressionStatement"], [3, 8, 4, "ExpressionStatement"], [4, 8, 10, "ExpressionStatement"] ]) }, { code: "var a = 1,\n" + "b = 2,\n" + "c = 3;\n", output: "var a = 1,\n" + " b = 2,\n" + " c = 3;\n", options: [4], errors: expectedErrors([ [2, 4, 0, "VariableDeclarator"], [3, 4, 0, "VariableDeclarator"] ]) }, { code: "[a, b, \nc].forEach((index) => {\n" + " index;\n" + "});\n", output: "[a, b, \nc].forEach((index) => {\n" + " index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true }, errors: expectedErrors([ [3, 4, 2, "ExpressionStatement"] ]) }, { code: "[a, b, \nc].forEach(function(index){\n" + " return index;\n" + "});\n", output: "[a, b, \nc].forEach(function(index){\n" + " return index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true }, errors: expectedErrors([ [3, 4, 2, "ReturnStatement"] ]) }, { code: "[a, b, c].forEach((index) => {\n" + " index;\n" + "});\n", output: "[a, b, c].forEach((index) => {\n" + " index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true }, errors: expectedErrors([ [2, 4, 2, "ExpressionStatement"] ]) }, { code: "[a, b, c].forEach(function(index){\n" + " return index;\n" + "});\n", output: "[a, b, c].forEach(function(index){\n" + " return index;\n" + "});\n", options: [4], ecmaFeatures: { arrowFunctions: true }, errors: expectedErrors([ [2, 4, 2, "ReturnStatement"] ]) }, { code: "while (1 < 2)\nconsole.log('foo')\n console.log('bar')", output: "while (1 < 2)\n console.log('foo')\nconsole.log('bar')", options: [2], errors: expectedErrors([ [2, 2, 0, "ExpressionStatement"], [3, 0, 2, "ExpressionStatement"] ]) }, { code: "function salutation () {\n" + " switch (1) {\n" + " case 0: return console.log('hi')\n" + " case 1: return console.log('hey')\n" + " }\n" + "}\n", output: "function salutation () {\n" + " switch (1) {\n" + " case 0: return console.log('hi')\n" + " case 1: return console.log('hey')\n" + " }\n" + "}\n", options: [2, { SwitchCase: 1 }], errors: expectedErrors([ [3, 4, 2, "SwitchCase"] ]) }, { code: "var geometry, box, face1, face2, colorT, colorB, sprite, padding, maxWidth,\n" + "height, rotate;", output: "var geometry, box, face1, face2, colorT, colorB, sprite, padding, maxWidth,\n" + " height, rotate;", options: [2, {SwitchCase: 1}], errors: expectedErrors([ [2, 2, 0, "VariableDeclarator"] ]) }, { code: "switch (a) {\n" + "case '1':\n" + "b();\n" + "break;\n" + "default:\n" + "c();\n" + "break;\n" + "}\n", output: "switch (a) {\n" + " case '1':\n" + " b();\n" + " break;\n" + " default:\n" + " c();\n" + " break;\n" + "}\n", options: [4, {SwitchCase: 2}], errors: expectedErrors([ [2, 8, 0, "SwitchCase"], [3, 12, 0, "ExpressionStatement"], [4, 12, 0, "BreakStatement"], [5, 8, 0, "SwitchCase"], [6, 12, 0, "ExpressionStatement"], [7, 12, 0, "BreakStatement"] ]) }, { code: "var geometry,\n" + "rotate;", output: "var geometry,\n" + " rotate;", options: [2, {VariableDeclarator: 1}], errors: expectedErrors([ [2, 2, 0, "VariableDeclarator"] ]) }, { code: "var geometry,\n" + " rotate;", output: "var geometry,\n" + " rotate;", options: [2, {VariableDeclarator: 2}], errors: expectedErrors([ [2, 4, 2, "VariableDeclarator"] ]) }, { code: "var geometry,\n" + "\trotate;", output: "var geometry,\n" + "\t\trotate;", options: ["tab", {VariableDeclarator: 2}], errors: expectedErrors("tab", [ [2, 2, 1, "VariableDeclarator"] ]) }, { code: "let geometry,\n" + " rotate;", output: "let geometry,\n" + " rotate;", options: [2, {VariableDeclarator: 2}], ecmaFeatures: { blockBindings: true }, errors: expectedErrors([ [2, 4, 2, "VariableDeclarator"] ]) }, { code: "if(true)\n" + " if (true)\n" + " if (true)\n" + " console.log(val);", output: "if(true)\n" + " if (true)\n" + " if (true)\n" + " console.log(val);", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}], errors: expectedErrors([ [4, 6, 4, "ExpressionStatement"] ]) }, { code: "var a = {\n" + " a: 1,\n" + " b: 2\n" + "}", output: "var a = {\n" + " a: 1,\n" + " b: 2\n" + "}", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}], errors: expectedErrors([ [2, 2, 4, "Property"], [3, 2, 4, "Property"] ]) }, { code: "var a = [\n" + " a,\n" + " b\n" + "]", output: "var a = [\n" + " a,\n" + " b\n" + "]", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}], errors: expectedErrors([ [2, 2, 4, "Identifier"], [3, 2, 4, "Identifier"] ]) }, { code: "let a = [\n" + " a,\n" + " b\n" + "]", output: "let a = [\n" + " a,\n" + " b\n" + "]", options: [2, {"VariableDeclarator": { let: 2 }, "SwitchCase": 1}], ecmaFeatures: { blockBindings: true }, errors: expectedErrors([ [2, 2, 4, "Identifier"], [3, 2, 4, "Identifier"] ]) }, { code: "var a = new Test({\n" + " a: 1\n" + " }),\n" + " b = 4;\n", output: "var a = new Test({\n" + " a: 1\n" + " }),\n" + " b = 4;\n", options: [4], errors: expectedErrors([ [2, 8, 6, "Property"], [3, 4, 2, "ObjectExpression"] ]) }, { code: "var a = new Test({\n" + " a: 1\n" + " }),\n" + " b = 4;\n" + "const a = new Test({\n" + " a: 1\n" + " }),\n" + " b = 4;\n", output: "var a = new Test({\n" + " a: 1\n" + " }),\n" + " b = 4;\n" + "const a = new Test({\n" + " a: 1\n" + " }),\n" + " b = 4;\n", options: [2, { VariableDeclarator: { var: 2 }}], ecmaFeatures: { blockBindings: true }, errors: expectedErrors([ [6, 4, 6, "Property"], [7, 2, 4, "ObjectExpression"], [8, 2, 4, "VariableDeclarator"] ]) }, { code: "var abc = 5,\n" + " c = 2,\n" + " xyz = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };", output: "var abc = 5,\n" + " c = 2,\n" + " xyz = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}], errors: expectedErrors([ [4, 4, 5, "ObjectExpression"], [5, 6, 7, "Property"], [6, 6, 8, "Property"], [7, 4, 5, "ObjectExpression"] ]) }, { code: "var abc = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };", output: "var abc = \n" + " {\n" + " a: 1,\n" + " b: 2\n" + " };", options: [2, {"VariableDeclarator": 2, "SwitchCase": 1}], errors: expectedErrors([ [2, 4, 5, "ObjectExpression"], [3, 6, 7, "Property"], [4, 6, 8, "Property"], [5, 4, 5, "ObjectExpression"] ]) }, { code: "var path = require('path')\n" + " , crypto = require('crypto')\n" + ";\n", output: "var path = require('path')\n" + " , crypto = require('crypto')\n" + " ;\n", options: [2], errors: expectedErrors([ [3, 1, 0, "VariableDeclaration"] ]) }, { code: "var a = 1\n" + " ,b = 2\n" + ";", output: "var a = 1\n" + " ,b = 2\n" + " ;", errors: expectedErrors([ [3, 3, 0, "VariableDeclaration"] ]) } ] });
src/index.js
sljavi/intro-web-speech-api
import React from 'react'; import ReactDOM from 'react-dom'; import Main from './lib/components/main'; import './style/main.css'; var initialProps = { frameUrl: '//slides.com/javierperez-3/deck-1/embed?style=light' }; window.onload = () => { ReactDOM.render( <Main {...initialProps} />, document.querySelector('#container') ); };
src/components/App.js
roslaneshellanoo/react-redux-tutorial
import React from 'react' import { browserHistory, Router } from 'react-router' import { Provider } from 'react-redux' import PropTypes from 'prop-types' class App extends React.Component { static propTypes = { store: PropTypes.object.isRequired, routes: PropTypes.object.isRequired, } shouldComponentUpdate () { return false } render () { return ( <Provider store={this.props.store}> <div style={{ height: '100%' }}> <Router history={browserHistory} children={this.props.routes} /> </div> </Provider> ) } } export default App
examples/async/index.js
grahamlyus/redux
import 'babel-core/polyfill'; import React from 'react'; import { Provider } from 'react-redux'; import App from './containers/App'; import configureStore from './store/configureStore'; const store = configureStore(); React.render( <Provider store={store}> {() => <App />} </Provider>, document.getElementById('root') );
react-flux-mui/js/material-ui/docs/src/app/components/pages/components/GridList/Page.js
pbogdan/react-flux-mui
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 gridListExampleSingleLineCode from '!raw!./ExampleSingleLine'; import GridListExampleSingleLine from './ExampleSingleLine'; import gridListCode from '!raw!material-ui/GridList/GridList'; import gridTileCode from '!raw!material-ui/GridList/GridTile'; const GridListPage = () => ( <div> <Title render={(previousTitle) => `Grid List - ${previousTitle}`} /> <MarkdownElement text={gridListReadmeText} /> <CodeExample title="Simple example" code={gridListExampleSimpleCode} > <GridListExampleSimple /> </CodeExample> <CodeExample title="Complex example" code={gridListExampleComplexCode} > <GridListExampleComplex /> </CodeExample> <CodeExample title="One line example" code={gridListExampleSingleLineCode} > <GridListExampleSingleLine /> </CodeExample> <PropTypeDescription header="### GridList Properties" code={gridListCode} /> <PropTypeDescription header="### GridTile Properties" code={gridTileCode} /> </div> ); export default GridListPage;
src/containers/DevTools.js
Shenseye/fisrt-react-redux-todolist
import React from 'react'; import { createDevTools } from 'redux-devtools'; import LogMonitor from 'redux-devtools-log-monitor'; import DockMonitor from 'redux-devtools-dock-monitor'; export default createDevTools( <DockMonitor toggleVisibilityKey='ctrl-h' changePositionKey='ctrl-q' > <LogMonitor /> </DockMonitor> );
node_modules/browser-sync/node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
qwerjkl112/CMPEN482
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'));
app/containers/App/components/Building.js
nikb747/threejs-react-proto
// @flow import React from 'react' import * as THREE from 'three' import {GLOBAL_X_OFFSET, GLOBAL_Y_OFFSET, UNIT_SCALE} from '../constants' const Building = (props: { x: number, y: number, width: number, length: number, color: number, height: number}) => { let actualWidth = UNIT_SCALE * props.width; let actualLength = UNIT_SCALE * props.length; let actualHeight = UNIT_SCALE * props.height; let localOffsetWidth = (UNIT_SCALE * (props.width - 1)) / 2; let localOffsetLength = (UNIT_SCALE * (props.length - 1)) / 2; let position = new THREE.Vector3( (props.x * UNIT_SCALE) + GLOBAL_X_OFFSET + localOffsetWidth, actualHeight / 2, (props.y * UNIT_SCALE) + GLOBAL_Y_OFFSET + localOffsetLength); return ( <group> <mesh castShadow receiveShadow position={position}> <boxGeometry width={actualWidth} height={actualHeight} depth={actualLength}/> <meshStandardMaterial color={props.color} metalness={0.5}/> </mesh> <mesh castShadow receiveShadow position={position}> <boxGeometry width={actualWidth - 0.2} height={actualHeight + 0.2} depth={actualLength - 0.2}/> <meshStandardMaterial color={props.color} metalness={0.8}/> </mesh> </group> ) } export default Building;
src/routes.js
karlbright/hotplate
import React from 'react' import { Route } from 'react-router' import Helmet from 'react-helmet' import Example from './components/example' const test = () => ( <div> <Helmet title='Test title' /> <Example /> </div> ) export default <Route path='/' component={test} />
src/layouts/CoreLayout/CoreLayout.js
hrnik/roofbar
import React from 'react' import PropTypes from 'prop-types' // import Header from '../../components/Header' import './CoreLayout.scss' import '../../styles/core.scss' import NotificationContainer from 'containers/NotificationContainer' export const CoreLayout = ({ children }) => ( <div className='core-layout__viewport'> {children} <NotificationContainer /> </div> ) CoreLayout.propTypes = { children: PropTypes.element.isRequired } export default CoreLayout
app/scripts/views/nodeprops.js
transmute-industries/monarch-portal
import React from 'react' import PropTable from './proptable' import {addr} from './typography' export default class NodeProps extends React.Component { render () { const node = this.props || {} const table = [ ['Node ID', addr(node.ID)], ['Version', addr(node.AgentVersion)] ] return PropTable({ table }) } }
client/components/Footer/index.js
lafin/talks-on-map
import React, { Component } from 'react'; import classnames from 'classnames'; import style from './style.css'; class Footer extends Component { shouldComponentUpdate() { return false; } render() { return ( <div className={classnames(style.main)}> Footer </div> ); } } export default Footer;
src/svg-icons/image/timelapse.js
igorbt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageTimelapse = (props) => ( <SvgIcon {...props}> <path d="M16.24 7.76C15.07 6.59 13.54 6 12 6v6l-4.24 4.24c2.34 2.34 6.14 2.34 8.49 0 2.34-2.34 2.34-6.14-.01-8.48zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/> </SvgIcon> ); ImageTimelapse = pure(ImageTimelapse); ImageTimelapse.displayName = 'ImageTimelapse'; ImageTimelapse.muiName = 'SvgIcon'; export default ImageTimelapse;
src/components/library/MotionTypography.js
theshaune/react-animated-typography-experiments
import React from 'react'; import PropTypes from 'prop-types'; import styled, { keyframes } from 'styled-components'; const stagger = keyframes` to { opacity: 1; transform: translateY(0%); } `; const Segments = styled.div` font-family: 'Playfair Display', serif; font-size: 18px; @media (min-width: 600px){ font-size: 28px; } @media (min-width: 900px){ font-size: 36px; } `; const Segment = styled.span` animation-fill-mode: forwards; animation-timing-function: cubic-bezier(0, 0, 0, 1); display: inline-block; opacity: 0; white-space: pre-wrap; `; const MotionTypography = props => { const styles = index => ({ animationDuration: `${props.animationDuration + index * 0.15}ms`, animationDelay: props.direction === 'up' ? `${props.animationDelay * (props.title.length - index)}ms` : `${props.animationDelay * index}ms`, animationName: props.isVisible ? `${stagger}` : null, transform: `translateY(${props.direction === 'up' ? '-75%' : '75%'})`, }); return ( <Segments> {[...props.title].map((segment, index) => ( <Segment direction={props.direction} isVisible={props.isVisible} style={styles(index)} > {segment} </Segment> ))} </Segments> ); }; MotionTypography.propTypes = { animationDelay: PropTypes.number, animationDuration: PropTypes.number, direction: PropTypes.string, isVisible: PropTypes.bool, title: PropTypes.string, }; MotionTypography.defaultProps = { animationDelay: 10, animationDuration: 1500, direction: 'down', isVisible: true, title: '', }; export default MotionTypography;
src/screens/App/screens/About/components/index.js
enesTufekci/react-clear-starter-kit
import React from 'react'; const About = () => ( <div className="text-center"> <h1> About </h1> </div> ); export default About;
react/eventwizard/eventwizard.js
phil-lopreiato/the-blue-alliance
import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import { createStore, applyMiddleware, compose } from 'redux' import thunk from 'redux-thunk' import EventWizardFrame from './components/EventWizardFrame' import eventwizardReducer from './reducers' const store = createStore(eventwizardReducer, compose( applyMiddleware(thunk), window.devToolsExtension ? window.devToolsExtension() : (f) => f )) ReactDOM.render( <Provider store={store}> <EventWizardFrame /> </Provider>, document.getElementById('content') )
app/components/CrafterList.js
stratigos/stormsreach
import React from 'react'; import PropTypes from 'prop-types'; import AvatarContainer from '../containers/AvatarContainer'; const CrafterList = ({ avatars }) => { return( <div className='crafter-list-container'> {avatars.map( (avatar) => { return(<AvatarContainer key={avatar.id} avatarId={avatar.id} />); })} </div> ); } CrafterList.propTypes = { avatars: PropTypes.arrayOf( PropTypes.shape({ id: PropTypes.number, name: PropTypes.string.isRequired, image: PropTypes.string.isRequired, town: PropTypes.string, shop: PropTypes.string, abilities: PropTypes.arrayOf(PropTypes.string) }) ).isRequired } export default CrafterList;
src/svg-icons/navigation/more-horiz.js
kasra-co/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NavigationMoreHoriz = (props) => ( <SvgIcon {...props}> <path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/> </SvgIcon> ); NavigationMoreHoriz = pure(NavigationMoreHoriz); NavigationMoreHoriz.displayName = 'NavigationMoreHoriz'; NavigationMoreHoriz.muiName = 'SvgIcon'; export default NavigationMoreHoriz;
apps/marketplace/components/Opportunities/OpportunitiesPagination.js
AusDTO/dto-digitalmarketplace-frontend
import React from 'react' import PropTypes from 'prop-types' import AUdirectionLink from '@gov.au/direction-links/lib/js/react' import styles from './Opportunities.scss' const scrollToTop = () => (typeof window !== 'undefined' ? window.scrollTo(0, 0) : '') const showPrevious = props => props.lastPage > 1 && props.currentPage > 1 const showNext = props => props.lastPage > 1 && props.currentPage < props.lastPage export const OpportunitiesPagination = props => ( <div className="row"> <div className={`col-xs-6 ${styles.pageLeft}`}> {showPrevious(props) && ( <span> <p> <AUdirectionLink direction="left" link="#prev" text="Previous page" onClick={e => { e.preventDefault() scrollToTop() props.onPageClick(props.currentPage - 1) }} title={`${props.currentPage - 1} of ${props.lastPage}`} /> </p> <span className={styles.pageSummary}> {props.currentPage - 1} of {props.lastPage} </span> </span> )} </div> <div className={`col-xs-6 ${styles.pageRight}`}> {showNext(props) && ( <span> <p> <AUdirectionLink direction="right" link="#next" text="Next page" onClick={e => { e.preventDefault() scrollToTop() props.onPageClick(props.currentPage + 1) }} title={`${props.currentPage + 1} of ${props.lastPage}`} /> </p> <span className={styles.pageSummary}> {props.currentPage + 1} of {props.lastPage} </span> </span> )} </div> </div> ) OpportunitiesPagination.defaultProps = { onPageClick: () => {} } OpportunitiesPagination.propTypes = { currentPage: PropTypes.number.isRequired, lastPage: PropTypes.number.isRequired, onPageClick: PropTypes.func } export default OpportunitiesPagination
docs/app/src/components/NavMain.js
tercenya/compendium
import React from 'react'; import { Link } from 'react-router'; import { Navbar, Nav } from 'react-bootstrap'; import FontAwesomeIcon from './FontAwesomeIcon'; import Root from '../Root'; const baseUrl = Root.assetBaseUrl || ''; const NAV_LINKS = { 'introduction': { link: `${baseUrl}/introduction.html`, title: 'introduction' }, 'prerequisites': { link: `${baseUrl}/prerequisites.html`, title: 'prerequisites' }, 'guides': { link: `${baseUrl}/guides.html`, title: 'guides' }, 'faq': { link: `${baseUrl}/faq.html`, title: 'faq' }, 'resources': { link: `${baseUrl}/resources.html`, title: 'resources' } }; const NavMainItem = (props) => { const linkKey = props.linkKey; const link = NAV_LINKS[linkKey]; return ( <li className={props.activePage === linkKey ? 'active' : null}> <Link to={link.link}>{link.title}</Link> </li> ) }; const NavMain = (props) => { const links = Object.keys(NAV_LINKS).map( (linkKey,i) => { return(<NavMainItem linkKey={linkKey} key={i} {...props} />); }); return ( <Navbar staticTop componentClass="header" className="compendium-nav" role="banner" > <Navbar.Header> <Navbar.Brand> <Link to={`${baseUrl}/`}> <span className="compendium-logo" /> </Link> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header> <Navbar.Collapse className="bs-navbar-collapse"> <Nav role="navigation" key='left'> {links} </Nav> <Nav role="navigation" key='right' pullRight> <li key="github-link"> <a href="https://github.com/tercenya/compendium" target="_blank"> <FontAwesomeIcon icon="github" /> &nbsp; github </a> </li> </Nav> </Navbar.Collapse> </Navbar> ); }; export default NavMain;
src/svg-icons/image/center-focus-weak.js
owencm/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageCenterFocusWeak = (props) => ( <SvgIcon {...props}> <path d="M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/> </SvgIcon> ); ImageCenterFocusWeak = pure(ImageCenterFocusWeak); ImageCenterFocusWeak.displayName = 'ImageCenterFocusWeak'; ImageCenterFocusWeak.muiName = 'SvgIcon'; export default ImageCenterFocusWeak;
packages/material-ui-icons/src/Cloud.js
dsslimshaddy/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let Cloud = props => <SvgIcon {...props}> <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z" /> </SvgIcon>; Cloud = pure(Cloud); Cloud.muiName = 'SvgIcon'; export default Cloud;
src/app/components/search/SearchResultsTable/StatusCell.js
meedan/check-web
import React from 'react'; import PropTypes from 'prop-types'; import TableCell from '@material-ui/core/TableCell'; import { makeStyles } from '@material-ui/core/styles'; function findStatusObjectOrNull(statuses, statusId) { if (!statuses) { return null; } const index = statuses.findIndex(({ id }) => id === statusId); if (index === -1) { return null; } return statuses[index]; } const useStyles = makeStyles(theme => ({ root: { whiteSpace: 'nowrap', maxWidth: theme.spacing(28), overflow: 'hidden', textOverflow: 'ellipsis', }, })); export default function StatusCell({ projectMedia }) { const classes = useStyles(); const statusObject = findStatusObjectOrNull( projectMedia.team.verification_statuses.statuses, projectMedia.list_columns_values.status, ); return ( <TableCell classes={classes}> {statusObject ? statusObject.label : null} </TableCell> ); } StatusCell.propTypes = { projectMedia: PropTypes.shape({ team: PropTypes.shape({ verification_statuses: PropTypes.shape({ statuses: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired, label: PropTypes.string.isRequired, }).isRequired), // undefined during optimistic update }).isRequired, }), list_columns_values: PropTypes.shape({ status: PropTypes.string.isRequired, }).isRequired, }).isRequired, };
src/components/SaveButton/SaveButton.js
pedrojimenezp/nested-forms
import React from 'react'; import { connect } from 'react-redux'; import { selectors as attributesSelectors } from '../../reducers/attributes'; import './styles.css'; const SaveButton = ({ attributes }) => { const isDisabled = attributes.some(a => !a.valid); return ( <div className="buttons"> <button type="button" className="btn btn-success" disabled={isDisabled}> Save </button> </div> ); }; const mapStateToProps = (state, ownProps) => { const attributes = attributesSelectors(state); return { attributes: attributes.getAllAttributes() }; }; export default connect(mapStateToProps, {})(SaveButton);
client/src/app/routes/settings/containers/FeeCollections/Details.js
zraees/sms-project
import React from 'react' import {reset} from 'redux-form'; import axios from 'axios'; import classNames from 'classnames'; import isEmpty from 'lodash/isEmpty'; import {connect} from 'react-redux' import { Field, FieldArray, reduxForm, formValueSelector, getFormValues } from 'redux-form' import {required, email, number} from '../../../../components/forms/validation/CustomValidation' import Datatable from '../../../../components/tables/Datatable' import {RFField, RFReactSelect, RFRadioButtonList, RFReactSelectSingle, RFLabel, RFDatePicker} from '../../../../components/ui' import AlertMessage from '../../../../components/common/AlertMessage' import Msg from '../../../../components/i18n/Msg' import mapForCombo, {getWebApiRootUrl, mapForRadioList, getLangKey, today, renderDate, getDateBackEndFormat, guid, instanceAxios, isYesClicked, isNoClicked} from '../../../../components/utils/functions' import { submitFeePayment, removePayment, printFeeSlip} from './submit' import StudentControl from '../Students/StudentControl' import { config } from '../../../../config/config'; import validate from './validate' import alert, {confirmation} from '../../../../components/utils/alerts' import LanguageStore from '../../../../components/i18n/LanguageStore' class Details extends React.Component { constructor(props){ super(props); this.state = { langKey: getLangKey(), paymentDate: today(), feeDueDetails: [], studentId: this.props.studentId, //paymentModeOptions: [] } // this.handleFeeTypeBlur = this.handleFeeTypeBlur.bind(this); // this.handleFeeBlur = this.handleFeeBlur.bind(this); // this.handleDiscountRateBlur = this.handleDiscountRateBlur.bind(this); this.handleAdditionalDiscountBlur = this.handleAdditionalDiscountBlur.bind(this); this.initializeFeeDues = this.initializeFeeDues.bind(this); } componentDidMount() { // this.props.initialize(initData); //this.props.change("feeDiscountTypeId", 1); this.initializeFeeDues(this.state.studentId); // instanceAxios.get('/api/lookup/paymentModes/') // .then(res => { // console.log('/api/lookup/paymentModes/', res.data); // const paymentModeOptions = mapForCombo(res.data); // this.setState({ paymentModeOptions }); // }); // var url = '/api/FeeCollections/FeePaymentDetailsByStudentID/' + this.state.langKey + '/' + this.state.studentId; // //this.setState({ url }); // var table = $('#feePaymentDetailsGrid').DataTable(); // table.ajax.url(url).load(); $('#feePaymentDetailsGrid').on('click', 'td', function (event) { //var thisElement = $('#feePaymentDetailsGrid td'); console.log('???? fix the print and delete thisElement -- ', $(this).find('#dele').length, $(this).find('#prnt').length ); console.log('test ==> ', $(this).find('#dele').data('tid'), $(this).find('#prnt').data('tid')) if ($(this).find('#dele').length > 0) { var id = $(this).find('#dele').data('tid'); removePayment(id, $(this)); } else if ($(this).find('#prnt').length > 0) { var id = $(this).find('#prnt').data('tid'); console.log('print slip from popup -- ', id) printFeeSlip('', id); } }); console.log('componentDidMount --> Details'); } initializeFeeDues(studentId) { //console.log('initializeFeeDues -- this.state.studentId ', this.state.studentId); instanceAxios.get('/api/FeeCollections/FeeDueDetailsByStudentID/' + this.state.langKey + '/' + studentId) .then(res => { if (res.data) { //console.log('exists..'); let feeDueDetails = []; res.data.map(function (item, index) { feeDueDetails.push({ "feeCollectionAgingID": item.FeeCollectionAgingID, "feeCollectionId": item.FeeCollectionID, // "studentId":item.StudentId, // "studentClassId":item.StudentClassId, //"feeTypeID":FeeTypeID, "feeTypeName": item.FeeTypeName, "dueOn": item.DueOn != null ? moment(item.DueOn).format("MM/DD/YYYY") : "", "dueAmountBeforeAdditionalDiscount": item.DueAmountBeforeAdditionalDiscount, "additionalDiscount": item.AdditionalDiscount, "newAdditionalDiscount": item.NewAdditionalDiscount, "dueAmountAfterAddDisc": item.DueAmountAfterAddDisc, "outstandingAmount": item.OutstandingAmount, "totalPaidAmount": item.TotalPaidAmount, "paymentAmount": item.PaymentAmount, //"feePaymentStatusName":item.FeePaymentStatusName, "paymentDate": "", "paymentComments": "", //"paymentModeId":null, "feeCollectedBy": "" }); }); const initData = { "feeCollectionDetailId": 0, "paymentDate": today(), "feeDueDetails": feeDueDetails, "paymentModeId": null } this.props.initialize(initData); //this.setState({feeDueDetails}) //console.log('this.state.feeDueDetails', initData.feeDueDetails, this.state.feeDueDetails); // instanceAxios.get('/api/lookup/paymentModes/') // .then(res => { // //console.log('/api/lookup/paymentModes/', res.data); // const paymentModeOptions = mapForCombo(res.data); // this.setState({ paymentModeOptions }); // }); var url =getWebApiRootUrl() + '/api/FeeCollections/FeePaymentDetailsByStudentID/' + this.state.langKey + '/' + studentId; //console.log(url); //this.setState({ url }); var table = $('#feePaymentDetailsGrid').DataTable(); table.ajax.url(url).load(); } else { // show error message, there is some this went wrong } }); } shouldComponentUpdate(nextProps, nextState) { // const { batchId, sectionId, classId, shiftId, studentId } = this.props; // const { nbatchId, nsectionId, nclassId, nshiftId, nstudentId } = nextProps; //console.log('shouldComponentUpdate --> FeeCollection Details', this.state.studentId != nextState.nstudentId, nextProps, nextState); // if (this.state.studentId != nextState.studentId && nextState.studentId) { // console.log('aaa'); // this.initializeFeeDues(nextState.studentId); // } //else if (this.props.guid != nextProps.guid || (this.props.studentId != nextProps.studentId && nextProps.studentId)) { console.log('aaa aaa'); this.initializeFeeDues(nextProps.studentId); } //return this.state.studentId != nextState.studentId || this.props.studentId != nextProps.studentId; console.log('guid ==> ', this.props.guid, nextProps.guid, this.props.guid != nextProps.guid ) console.log('nextState.studentId nextProps.studentId', nextState.studentId, nextProps.studentId) return this.props.guid != nextProps.guid; } handleAdditionalDiscountBlur(index, event) { //console.log('handleAdditionalDiscountBlur(obj, value) == ', index, event, this.state.feeDueDetails[index].additionalDiscount); //var value = event.target.value; // if (value) { // axios.get('api/TeachersSubjects/All/' + value) // .then(res => { // //console.log('subjectOptions2D 1 -- ', subjectOptions2D); // let subjectOptions2D = this.state.subjectOptions2D; // const subjectOptions = mapForCombo(res.data); // subjectOptions2D[index] = subjectOptions; // this.setState({ subjectOptions2D }); // //console.log('subjectOptions2D 2 -- ', subjectOptions2D); // }); // } // else { // let subjectOptions2D = this.state.subjectOptions2D; // subjectOptions2D[index] = []; // this.setState({ subjectOptions2D }); // //this.setState({ subjectOptions2D: [] }); // } } render() { const { feeCollectionId, handleSubmit, pristine, reset, submitting, touched, error, warning } = this.props; const { batchId, sectionId, classId, shiftId, studentId, guid, paymentModeOptions} = this.props; const { langKey } = this.state; return ( <form id="form-Fee-Aging" className="smart-form" onSubmit={handleSubmit((values) => { submitFeePayment(values, $('#dueFeeId').val()) })}> <StudentControl batchId={batchId} sectionId={sectionId} classId={classId} shiftId={shiftId} studentId={studentId} /> <br/> <fieldset> <div className="tabbable tabs"> <ul className="nav nav-tabs"> <li id="tabFeeDetailsLink" className="active"> <a id="tabAddFeeDetails" data-toggle="tab" href="#A1P1A"><Msg phrase="FeeOutstandingText" /></a> </li> <li id="tabPaymentHistoryLink"> <a id="tabPaymentHistory" data-toggle="tab" href="#B1P1B"><Msg phrase="PaymentHistoryText" /></a> </li> </ul> {/* guid = {guid} */} <div className="tab-content"> <div className="tab-pane active" id="A1P1A"> <div className="row"> <section className="remove-col-padding col-sm-12 col-md-12 col-lg-12"> </section> </div> <div className="row"> <section className="remove-col-padding col-sm-4 col-md-4 col-lg-4"> <Field name="paymentDate" label="PaymentDateText" component={RFDatePicker} /> </section> <section className="remove-col-padding col-sm-4 col-md-4 col-lg-4"> <Field multi={false} name="paymentModeId" label="PaymentModeText" options={paymentModeOptions} component={RFReactSelect} /> </section> <section className="remove-col-padding col-sm-4 col-md-4 col-lg-4"> <Field name="feeCollectedBy" labelClassName="input" validate={required} component={RFField} maxLength="50" type="text" label="FeeCollectedByText" /> </section> </div> <div className="row"> <section className="remove-col-padding col-sm-12 col-md-12 col-lg-12"> <Field name="paymentComments" labelClassName="input" labelIconClassName="icon-append fa fa-file-text-o" component={RFField} maxLength="150" type="text" label="FeePaymentCommentsText" placeholder="P" /> </section> </div> <div className="row"> <section className="remove-col-padding col-sm-12 col-md-12 col-lg-12"> <FieldArray name="feeDueDetails" component={renderFeeDueDetails} /> </section> </div> </div> <div className="tab-pane table-responsive" id="B1P1B"> <Datatable id="feePaymentDetailsGrid" options={{ ajax: { "url": getWebApiRootUrl() +'/api/FeeCollections/FeePaymentDetailsByStudentID/' + langKey + '/' + studentId, "dataSrc": "" }, columnDefs: [ { "type": "date", "render": function (data, type, row) { return renderDate(data); }, "targets": 2 }, { "render": function (data, type, row) { return '<a id="prnt" data-tid="' + data + '"><i class=\"glyphicon glyphicon-print\"></i><span class=\"sr-only\">Print</span></a>'; }.bind(self), "className": "dt-center", "sorting": false, "targets": 6 }, { "render": function (data, type, row) { return '<a id="dele" data-tid="' + data + '"><i class=\"glyphicon glyphicon-trash\"></i><span class=\"sr-only\">Edit</span></a>'; }.bind(self), "className": "dt-center", "sorting": false, "targets": 7 } ], columns: [ { data: "Code" }, { data: "FeeCollectedBy" }, { data: "PaidOn" }, { data: "TotalPaidAmount" }, { data: "Balance" }, { data: "Comments" }, { data: "FeePaymentID" }, { data: "FeePaymentID" } ], // buttons: [ // 'copy', 'excel', 'pdf' // ] }} paginationLength={true} className="table table-striped table-bordered table-hover" width="100%"> <thead> <tr> <th data-hide="mobile-p"><Msg phrase="CodeText" /></th> <th data-class="expand"><Msg phrase="FeeCollectedByText" /></th> <th data-hide="mobile-p"><Msg phrase="PaidOnText" /></th> <th data-hide="mobile-p"><Msg phrase="TotalPaidAmountText" /></th> <th data-hide="mobile-p"><Msg phrase="BalanceText" /></th> <th data-hide="mobile-p"><Msg phrase="CommentsText" /></th> <th data-hide="mobile-p"></th> <th data-hide="mobile-p"></th> </tr> </thead> </Datatable> </div> </div> </div> </fieldset> <input id="dueFeeId" type="hidden"></input> {(error !== undefined && <AlertMessage type="w" icon="alert-danger" message={error} />)} <footer> <button type="button" disabled={submitting} onClick={reset} className="btn btn-primary"> {feeCollectionId > 0 ? <Msg phrase="UndoChangesText" /> : <Msg phrase="ResetText" />} </button> <button type="submit" disabled={submitting} className="btn btn-primary"> <Msg phrase="SaveText" /> </button> </footer> </form> ) } } const afterSubmit = function(result, dispatch) { //console.log('result = ', result); dispatch(reset('Details')); } //export default Details = reduxForm({ form: 'Details', // a unique identifier for this form validate, onSubmitSuccess: afterSubmit, keepDirtyOnReinitialize: false })(Details) // const selector = formValueSelector('Details') // <-- same as form name // Details = connect( // state => { // const { fee, discountOption, discountRate, discountValue } = selector(state, 'fee', 'discountOption', 'discountRate', 'discountValue') // return { // discountValue: discountOption=='P'? fee * (discountRate||0) / 100 : discountRate, // netFee: fee - (discountOption=='P'? fee * (discountRate||0) / 100 : discountRate) // } // } // )(Details) const myHandler = (index, fields) => { let messageText = LanguageStore.getData().phrases["DeleteConfirmationMessageText"] || 'Are you sure, you want to delete this record?'; confirmation(messageText, function (ButtonPressed) { deleteRecord(ButtonPressed); }); } function deleteRecord(ButtonPressed) { if (isYesClicked(ButtonPressed)) { LoaderVisibility(true); $('#dueFeeId').val($('#dueFeeId').val() + ',' + fields.get(index).feeCollectionAgingID); fields.remove(index); console.log('#dueFeeId', $('#dueFeeId').val()) } } const renderFeeDueDetails = ({ fields, meta: { touched, error } }) => ( <div > <div className="table-responsive"> {(error && <span><em className="invalid"><h5><Msg phrase={error}/></h5></em></span>)} <table className="table table-striped table-bordered table-hover table-responsive"> <thead> <tr> <th> <Msg phrase="FeeTypeText" /> </th> <th> <Msg phrase="DueDateText" /> </th> {/* <th> <Msg phrase="DueAmountBeforeAdditionalDiscountText" /> </th> */} <th> <Msg phrase="AdditionalDiscountText" /> <Msg phrase="OldNewText" /> </th> <th> <Msg phrase="TotalDueAmountAfterAdditionalDiscountText" /> </th> <th> <Msg phrase="OutstandingAmountText" /> </th> <th> <Msg phrase="TotalPaidAmountText" /> </th> {/* <th> <Msg phrase="FeePaymentStatusText" /> </th> */} <th> </th> </tr> </thead> <tbody> {fields.map((period, index) => <tr key={period}> <td> <Field name={`${period}.feeTypeName`} component={RFLabel} className="width-150-px" disabled={true} type="label" /> </td> <td> <Field name={`${period}.dueOn`} component={RFLabel} labelClassName="width-50-px" disabled={true} label="" type="label" /> </td> {/* <td> <Field name={`${period}.dueAmountBeforeAdditionalDiscount`} component={RFLabel} className="width-50-px" disabled={true} type="label" /> </td> */} <td> <Field name={`${period}.additionalDiscount`} component={RFLabel} className="width-50-px" disabled={true} type="text" /> <Field name={`${period}.newAdditionalDiscount`} labelClassName="input remove-col-padding " labelIconClassName="" validate={[number]} component={RFField} // onBlur={(e) => this.handleAdditionalDiscountBlur(index, `${period}.additionalDiscount`)} type="text" maxLength="5" /> </td> <td> <Field name={`${period}.dueAmountAfterAddDisc`} component={RFLabel} className="width-50-px" disabled={true} type="text" /> </td> <td> <Field name={`${period}.outstandingAmount`} component={RFLabel} className="width-50-px" disabled={true} type="text" /> </td> <td> <Field name={`${period}.paymentAmount`} labelClassName="input remove-col-padding " labelIconClassName="" validate={[number]} component={RFField} type="text" /> </td> {/* <td> <Field name={`${period}.feePaymentStatusName`} component="input" className="width-50-px" disabled={true} type="text" /> </td> */} <td> {/* <a onClick={() => fields.remove(index)}><i className="glyphicon glyphicon-trash"></i></a> */} {(fields.get(index).totalPaidAmount<=0)? <a onClick={(e) => myHandler(index, fields)}><i className="glyphicon glyphicon-trash"></i></a> :""} </td> </tr> )} </tbody> </table> </div> </div> ) export default Details;
newclient/scripts/components/user/radio-control/index.js
kuali/research-coi
/* The Conflict of Interest (COI) module of Kuali Research Copyright © 2005-2016 Kuali, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/> */ import styles from './style'; import React from 'react'; import Control from '../control'; export class RadioControl extends Control { isValid(answer) { return answer !== undefined && answer.length > 0; } onChange(evt) { this.props.onChange(evt.target.value, this.props.questionId, this.props.isParent); } render() { const options = this.props.options.map((option, index) => { return ( <span className={styles.option} key={`${this.props.questionId}_${index}`}> <div> <input id={`multi_${option}_${this.props.questionId}`} value={option} checked={this.props.answer === option} onChange={this.onChange} type="radio" className={styles.radio} name={`radioControl:${this.props.questionId}`} /> <label htmlFor={`multi_${option}_${this.props.questionId}`} className={styles.label}>{option}</label> </div> </span> ); }); return ( <div id={`qn${this.props.questionId}`}> {options} </div> ); } }
actor-apps/app-web/src/app/components/modals/invite-user/InviteByLink.react.js
it33/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/javascript/mastodon/features/compose/components/character_counter.js
kazh98/social.arnip.org
import React from 'react'; import PropTypes from 'prop-types'; import { length } from 'stringz'; export default class CharacterCounter extends React.PureComponent { static propTypes = { text: PropTypes.string.isRequired, max: PropTypes.number.isRequired, }; checkRemainingText (diff) { if (diff < 0) { return <span className='character-counter character-counter--over'>{diff}</span>; } return <span className='character-counter'>{diff}</span>; } render () { const diff = this.props.max - length(this.props.text); return this.checkRemainingText(diff); } }
src/components/icons/InsideSalesLogoIcon.js
austinknight/ui-components
import React from 'react'; const InsideSalesLogoIcon = props => ( <svg {...props.size || { width: '180px', height: '180px' }} {...props} viewBox="0 0 180 180"> {props.title && <title>{props.title}</title>} <g id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd"> <g id="InsideSales-logo"> <polygon id="Background" fill="#3AB676" points="0 180 180 180 180 0 0 0"></polygon> <g id="Text-Outlines" transform="translate(18.000000, 27.000000)" fill="#FFFFFF"> <polygon id="Fill-2" points="3.687 1.29525 6.87375 1.29525 6.87375 29.53425 3.687 29.53425"></polygon> <polygon id="Fill-3" points="13.1259 1.29555 16.1109 1.29555 33.90165 23.9268 33.90165 1.29555 37.00815 1.29555 37.00815 29.53455 34.4664 29.53455 16.2324 6.3783 16.2324 29.53455 13.1259 29.53455"></polygon> <path d="M41.120625,25.4193 L43.097625,23.0793 C46.042125,25.7418 48.865875,27.0738 52.779375,27.0738 C56.571375,27.0738 59.072625,25.0563 59.072625,22.2723 L59.072625,22.19205 C59.072625,19.57005 57.661125,18.07755 51.730125,16.82655 C45.235875,15.4143 42.250125,13.3173 42.250125,8.6778 L42.250125,8.59755 C42.250125,4.1598 46.163625,0.89205 51.529125,0.89205 C55.643625,0.89205 58.588125,2.0613 61.452375,4.36155 L59.596875,6.8223 C56.974875,4.68405 54.352875,3.7563 51.448125,3.7563 C47.776875,3.7563 45.436875,5.77305 45.436875,8.3148 L45.436875,8.3958 C45.436875,11.0583 46.889625,12.5508 53.101875,13.8813 C59.395875,15.2538 62.299875,17.55255 62.299875,21.86955 L62.299875,21.95055 C62.299875,26.79105 58.265625,29.9373 52.658625,29.9373 C48.180375,29.9373 44.509125,28.4448 41.120625,25.4193" id="Fill-4"></path> <polygon id="Fill-6" points="67.059 1.29525 70.24575 1.29525 70.24575 29.53425 67.059 29.53425"></polygon> <path d="M86.3004,26.589075 C93.4404,26.589075 97.9989,21.747825 97.9989,15.495825 L97.9989,15.414825 C97.9989,9.161325 93.4404,4.239825 86.3004,4.239825 L79.6839,4.239825 L79.6839,26.589075 L86.3004,26.589075 Z M76.49715,1.295325 L86.3004,1.295325 C95.17515,1.295325 101.30715,7.386825 101.30715,15.333825 L101.30715,15.414825 C101.30715,23.361825 95.17515,29.534325 86.3004,29.534325 L76.49715,29.534325 L76.49715,1.295325 Z" id="Fill-8"></path> <polygon id="Fill-9" points="106.02525 1.29555 126.438 1.29555 126.438 4.19955 109.212 4.19955 109.212 13.84155 124.62225 13.84155 124.62225 16.7463 109.212 16.7463 109.212 26.6298 126.63975 26.6298 126.63975 29.53455 106.02525 29.53455"></polygon> <path d="M0.863325,58.29915 L4.534575,53.9019 C7.076325,56.0004 9.738075,57.3309 12.966075,57.3309 C15.507075,57.3309 17.040075,56.3229 17.040075,54.6684 L17.040075,54.58815 C17.040075,53.01465 16.071825,52.20765 11.352075,50.99715 C5.664075,49.54515 1.992825,47.97165 1.992825,42.3639 L1.992825,42.28365 C1.992825,37.1604 6.108075,33.7719 11.876325,33.7719 C15.991575,33.7719 19.500825,35.06265 22.365075,37.36215 L19.137825,42.0414 C16.636575,40.3074 14.175825,39.25815 11.796075,39.25815 C9.415575,39.25815 8.165325,40.34715 8.165325,41.7189 L8.165325,41.7999 C8.165325,43.6554 9.375825,44.26065 14.256825,45.5109 C19.985325,47.0034 23.212575,49.06065 23.212575,53.9829 L23.212575,54.0639 C23.212575,59.6709 18.936075,62.81715 12.844575,62.81715 C8.568825,62.81715 4.251825,61.32465 0.863325,58.29915" id="Fill-10"></path> <path d="M43.224375,50.594175 L39.472875,41.436675 L35.721375,50.594175 L43.224375,50.594175 Z M36.688875,33.973425 L42.418125,33.973425 L54.520125,62.414175 L48.025125,62.414175 L45.442875,56.080425 L33.502125,56.080425 L30.920625,62.414175 L24.586875,62.414175 L36.688875,33.973425 Z" id="Fill-11"></path> <polygon id="Fill-12" points="57.866325 34.1748 64.079325 34.1748 64.079325 56.7663 78.158325 56.7663 78.158325 62.4138 57.866325 62.4138"></polygon> <polygon id="Fill-13" points="81.827475 34.1748 103.127475 34.1748 103.127475 39.70155 87.999225 39.70155 87.999225 45.4308 101.311725 45.4308 101.311725 50.9568 87.999225 50.9568 87.999225 56.88705 103.329225 56.88705 103.329225 62.4138 81.827475 62.4138"></polygon> <path d="M105.908925,58.29915 L109.580175,53.9019 C112.121925,56.0004 114.784425,57.3309 118.011675,57.3309 C120.552675,57.3309 122.086425,56.3229 122.086425,54.6684 L122.086425,54.58815 C122.086425,53.01465 121.118175,52.20765 116.397675,50.99715 C110.709675,49.54515 107.038425,47.97165 107.038425,42.3639 L107.038425,42.28365 C107.038425,37.1604 111.153675,33.7719 116.922675,33.7719 C121.037175,33.7719 124.547175,35.06265 127.411425,37.36215 L124.184175,42.0414 C121.682925,40.3074 119.222175,39.25815 116.841675,39.25815 C114.461925,39.25815 113.210925,40.34715 113.210925,41.7189 L113.210925,41.7999 C113.210925,43.6554 114.421425,44.26065 119.302425,45.5109 C125.030925,47.0034 128.258175,49.06065 128.258175,53.9829 L128.258175,54.0639 C128.258175,59.6709 123.981675,62.81715 117.890925,62.81715 C113.614425,62.81715 109.298175,61.32465 105.908925,58.29915" id="Fill-14"></path> <polygon id="Fill-15" points="2.517 91.0575 6.22875 91.0575 6.22875 95.2935 2.517 95.2935"></polygon> <path d="M8.404875,81.25425 L8.404875,81.174 C8.404875,73.1865 14.375625,66.57 22.685625,66.57 C27.808875,66.57 30.874875,68.38575 33.699375,71.04825 L31.520625,73.38825 C29.140875,71.12925 26.477625,69.51525 22.645125,69.51525 C16.392375,69.51525 11.713125,74.598 11.713125,81.093 L11.713125,81.174 C11.713125,87.70875 16.432875,92.83275 22.645125,92.83275 C26.518125,92.83275 29.059875,91.34025 31.762875,88.758 L33.860625,90.816 C30.915375,93.801 27.688125,95.778 22.564875,95.778 C14.415375,95.778 8.404875,89.36325 8.404875,81.25425" id="Fill-16"></path> <path d="M60.846075,81.25425 L60.846075,81.174 C60.846075,74.76 56.166825,69.51525 49.711575,69.51525 C43.257075,69.51525 38.658075,74.679 38.658075,81.093 L38.658075,81.174 C38.658075,87.58875 43.338075,92.83275 49.792575,92.83275 C56.247075,92.83275 60.846075,87.669 60.846075,81.25425 M35.350575,81.25425 L35.350575,81.174 C35.350575,73.38825 41.199825,66.57 49.792575,66.57 C58.385325,66.57 64.154325,73.30725 64.154325,81.093 C64.194825,81.1335 64.194825,81.1335 64.154325,81.174 C64.154325,88.95975 58.304325,95.778 49.711575,95.778 C41.118825,95.778 35.350575,89.04075 35.350575,81.25425" id="Fill-17"></path> <polygon id="Fill-18" points="68.669775 67.05405 71.897025 67.05405 82.184025 82.4643 92.471025 67.05405 95.698275 67.05405 95.698275 95.29305 92.511525 95.29305 92.511525 72.4203 82.224525 87.5478 82.063275 87.5478 71.776275 72.46005 71.776275 95.29305 68.669775 95.29305"></polygon> </g> </g> </g> </svg > ); export default InsideSalesLogoIcon;