path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
docs/app/Examples/collections/Message/Variations/MessageExampleAttached.js | clemensw/stardust | import React from 'react'
import { Button, Checkbox, Form, Icon, Message } from 'semantic-ui-react'
const MessageExampleAttached = () => (
<div>
<Message
attached
header='Welcome to our site!'
content='Fill out the form below to sign-up for a new account'
/>
<Form className='attached fluid segment'>
<Form.Group widths='equal'>
<Form.Input label='First Name' placeholder='First Name' type='text' />
<Form.Input label='Last Name' placeholder='Last Name' type='text' />
</Form.Group>
<Form.Input label='Username' placeholder='Username' type='text' />
<Form.Input label='Password' type='password' />
<Form.Checkbox inline label='I agree to the terms and conditions' />
<Button color='blue'>Submit</Button>
</Form>
<Message attached='bottom' warning>
<Icon name='help' />
Already signed up? <a href='#'>Login here</a> instead.
</Message>
</div>
)
export default MessageExampleAttached
|
apps/marketplace/components/Reports/ReportView.js | AusDTO/dto-digitalmarketplace-frontend | import React from 'react'
import DocumentTitle from 'react-document-title'
import { uniqueID } from '../helpers'
import ReportItem from './ReportItem'
import * as styles from './ReportView.scss'
const ReportView = props => {
const { data } = props
const { title, items, date } = data
return (
<div className={styles.reportView}>
<div className="row">
<div className="col-sm-12 col-xs-12">
<div>
<DocumentTitle title={`${title} ${date} | Digital Marketplace`} />
<h1 className={`${styles.reportViewTitle} au-display-lg`}>
{title} <span className={styles.reportViewDate}>{date}</span>
</h1>
<a
rel="noopener noreferrer"
target="_blank"
href="/static/media/documents/Digital Marketplace - February 2018 Insights.pdf"
>
View this report as a PDF (97KB)
</a>
</div>
<h2 className={`${styles.reportViewHeading} au-display-lg`}>Who are we?</h2>
<span>
The Digital Marketplace is a simple and fast way to buy and sell with government.{' '}
<strong>It breaks down the barriers of entry for SMEs</strong> (a small to medium enterprise with less than
200 employees) and makes it{' '}
<strong>easier to compete for the Australian Government's annual ICT spend</strong> ($6.2 billion in
financial year 2015-16).
</span>
{items && (
<div className="row">
<div className="hidden">
{items.map((item, id = uniqueID()) => (
<div key={id}>
<ReportItem {...item} />
</div>
))}
</div>
</div>
)}
<span className={styles.caveat}>
* Contract information is sourced from{' '}
<a href="http://tenders.gov.au" rel="external noopener noreferrer" target="_blank">
Austender
</a>
. It excludes contracts awarded by entities that don't report through Austender and contracts under
$10,000. Contracts may take up to 42 days to be published.
</span>
</div>
</div>
</div>
)
}
export default ReportView
|
screens/GuideScreen.js | FuzzyHatPublishing/isleep | import React, { Component } from 'react';
import {
Image,
View,
StyleSheet,
Text,
Platform,
Dimensions,
ScrollView,
TouchableHighlight
} from 'react-native';
import { Icon } from 'react-native-elements';
class GuideScreen extends Component {
static navigationOptions = ({ navigation }) => ({
title: 'Guide',
headerStyle: { marginTop: Platform.OS === 'android' ? 24 : 0, backgroundColor: "#000" },
headerTitleStyle: { color: '#fff', fontSize: 22, fontWeight: 'bold', marginHorizontal: 8, alignSelf: 'center' }
});
state = { guideSubjects: [] };
_getImage(i) {
switch (i) {
case 0:
return require('../assets/images/guide-icons/question.png')
break;
case 1:
return require('../assets/images/guide-icons/checked.png')
break;
case 2:
return require('../assets/images/guide-icons/inclined-candy.png')
break;
case 3:
return require('../assets/images/guide-icons/coffee.png')
break;
}
}
componentWillMount() {
let guideData = require('../assets/data/guide_data');
this.setState({ guideSubjects: guideData });
}
render() {
const { navigate } = this.props.navigation;
return (
<View style={{backgroundColor:"black"}}>
<Image style={styles.bgImage} source={require('../assets/images/clouds/guide-clouds.png')} />
<ScrollView>
<View style={styles.container}>
{
this.state.guideSubjects.map((subject, i) => (
<TouchableHighlight
key={subject.id}
underlayColor={'#494949'}
style={styles.touchable}
onPress={ () => navigate('subjectList', {subject}) }
>
<View backgroundColor={subject.colorGuide} style={styles.box}>
<Text style={styles.topic}>{subject.topic}</Text>
<Image style={styles.icons} source={ this._getImage(i) } />
</View>
</TouchableHighlight>
))
}
</View>
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bgImage: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0
},
touchable: {
height: 200,
width: 280,
marginBottom: 16,
alignItems: 'center',
alignSelf: 'center',
justifyContent: 'center'
},
box: {
marginTop: 8,
marginBottom: 8,
height: 200,
width: 280,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
borderRadius: 3,
shadowOpacity: 0.75,
shadowRadius: 10,
shadowColor: 'white',
shadowOffset: { height: 10, width: 10 },
elevation: 2
},
container: {
flex: 1,
paddingTop: 8,
paddingBottom: 8,
},
icons: {
marginTop: 10,
height: 60,
width: 60
},
topic: {
fontSize: 36,
paddingBottom: 10,
color: '#fff',
fontWeight: 'bold'
}
})
export default GuideScreen;
|
app/containers/Transactions/ui/components/TransactionSummaryComponent.js | sahilkhan99/PosApp | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class TransactionSummaryComponent extends Component {
render() {
return (
<div>
<div className="row row-inverse">
<div className="col-lg-6">
<div className="row">
<label className="control-label col-sm-4" for="email">Sub Total:</label>
<div className="col-sm-8">
<span>7.50</span>
</div>
</div>
</div>
{/*Eof Sub Total*/}
<div className="col-lg-6">
<div className="row">
<label className="control-label col-sm-4" for="email">Total:</label>
<div className="col-sm-8">
<span>7.50</span>
</div>
</div>
</div>
{/*Eof Total*/}
</div>
<div className="row row-inverse">
<div className="col-lg-6">
<div className="row">
<label className="control-label col-sm-4" for="email">Discount:</label>
<div className="col-sm-8">
<span>1.50</span>
</div>
</div>
</div>
{/*Eof Discount*/}
</div>
<div className="row row-inverse">
<div className="col-lg-6">
<div className="row">
<label className="control-label col-sm-4" for="email">Tax:</label>
<div className="col-sm-8">
<span>1.24</span>
</div>
</div>
</div>
{/*Eof Tax*/}
<div className="col-lg-6">
<div className="row">
<label className="control-label col-sm-4" for="email">Balance:</label>
<div className="col-sm-8">
<span>3.24</span>
</div>
</div>
</div>
{/*Eof Balance*/}
</div>
<div className="row row-inverse">
<div className="col-lg-offset-6 col-lg-6">
<div className="btn-toolbar" role="toolbar">
<button type="button" className="btn btn-primary col-lg-3">Hold order</button>
<button type="button" className="btn btn-primary col-lg-3">Cancel</button>
<button type="button" className="btn btn-primary col-lg-3">Save</button>
</div>
</div>
{/*Eof Buttons*/}
</div>
</div>
);
}
}
TransactionSummaryComponent.propTypes = {
};
export default TransactionSummaryComponent; |
src/svg-icons/av/mic-off.js | rscnt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvMicOff = (props) => (
<SvgIcon {...props}>
<path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17c0-.06.02-.11.02-.17V5c0-1.66-1.34-3-3-3S9 3.34 9 5v.18l5.98 5.99zM4.27 3L3 4.27l6.01 6.01V11c0 1.66 1.33 3 2.99 3 .22 0 .44-.03.65-.08l1.66 1.66c-.71.33-1.5.52-2.31.52-2.76 0-5.3-2.1-5.3-5.1H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c.91-.13 1.77-.45 2.54-.9L19.73 21 21 19.73 4.27 3z"/>
</SvgIcon>
);
AvMicOff = pure(AvMicOff);
AvMicOff.displayName = 'AvMicOff';
export default AvMicOff;
|
docs/app/Examples/elements/Button/Variations/ButtonExampleFluid.js | clemensw/stardust | import React from 'react'
import { Button } from 'semantic-ui-react'
const ButtonExampleFluid = () => (
<Button fluid>Fits to Container</Button>
)
export default ButtonExampleFluid
|
src/main.js | TheTorProject/ooni-wui | import React from 'react'
import ReactDOM from 'react-dom'
import createStore from './store/createStore'
import AppContainer from './containers/AppContainer'
// ========================================================
// Store Instantiation
// ========================================================
const initialState = window.___INITIAL_STATE__
const store = createStore(initialState)
// ========================================================
// Render Setup
// ========================================================
const MOUNT_NODE = document.getElementById('root')
let render = () => {
const routes = require('./routes/index').default(store)
ReactDOM.render(
<AppContainer store={store} routes={routes} />,
MOUNT_NODE
)
}
// This code is excluded from production bundle
if (__DEV__) {
if (module.hot) {
// Development render functions
const renderApp = render
const renderError = (error) => {
const RedBox = require('redbox-react').default
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE)
}
// Wrap render in try/catch
render = () => {
try {
renderApp()
} catch (error) {
renderError(error)
}
}
// Setup hot module replacement
module.hot.accept('./routes/index', () =>
setImmediate(() => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE)
render()
})
)
}
}
// ========================================================
// Go!
// ========================================================
if (!global.Intl) {
require.ensure([
'intl',
'intl/locale-data/jsonp/ar.js',
'intl/locale-data/jsonp/el.js',
'intl/locale-data/jsonp/en.js',
'intl/locale-data/jsonp/es.js',
'intl/locale-data/jsonp/fa.js',
'intl/locale-data/jsonp/fr.js',
'intl/locale-data/jsonp/it.js',
'intl/locale-data/jsonp/hi.js',
'intl/locale-data/jsonp/ru.js'
], (require) => {
require('intl')
require('intl/locale-data/jsonp/ar.js')
require('intl/locale-data/jsonp/el.js')
require('intl/locale-data/jsonp/en.js')
require('intl/locale-data/jsonp/es.js')
require('intl/locale-data/jsonp/fa.js')
require('intl/locale-data/jsonp/fr.js')
require('intl/locale-data/jsonp/it.js')
require('intl/locale-data/jsonp/hi.js')
require('intl/locale-data/jsonp/ru.js')
render()
})
} else {
render()
}
|
src/Libraries/NavigationExperimental/NavigationCard.js | dingbat/react-native-mock | import React from 'react';
class CardStackPanResponder {
}
class PagerPanResponder {
}
class NavigationCard extends React.Component {
static CardStackPanResponder = CardStackPanResponder;
static CardStackStyleInterpolator = {
forHorizontal: () => ({}),
forVertical: () => ({}),
};
static PagerPanResponder = PagerPanResponder;
static PagerStyleInterpolator = {
forHorizontal: () => ({}),
};
}
module.exports = NavigationCard;
|
src/svg-icons/editor/format-textdirection-r-to-l.js | andrejunges/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorFormatTextdirectionRToL = (props) => (
<SvgIcon {...props}>
<path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zm-2 7v-3l-4 4 4 4v-3h12v-2H8z"/>
</SvgIcon>
);
EditorFormatTextdirectionRToL = pure(EditorFormatTextdirectionRToL);
EditorFormatTextdirectionRToL.displayName = 'EditorFormatTextdirectionRToL';
EditorFormatTextdirectionRToL.muiName = 'SvgIcon';
export default EditorFormatTextdirectionRToL;
|
modules/dreamview/frontend/src/components/ModuleController/index.js | xiaoxq/apollo | import React from 'react';
import { inject, observer } from 'mobx-react';
import CheckboxItem from 'components/common/CheckboxItem';
import StatusDisplay from 'components/ModuleController/StatusDisplay';
import WS from 'store/websocket';
@inject('store') @observer
export default class ModuleController extends React.Component {
render() {
const {
modes, currentMode, moduleStatus, componentStatus,
} = this.props.store.hmi;
const moduleEntries = Array.from(moduleStatus.keys()).sort().map((key) => (
<CheckboxItem
key={key}
id={key}
title={key}
disabled={false}
isChecked={moduleStatus.get(key)}
onClick={() => {
this.props.store.hmi.toggleModule(key);
}}
extraClasses="controller"
/>
));
const componentEntries = Array.from(componentStatus.keys()).sort().map((key) => (
<StatusDisplay
key={key}
title={key}
status={componentStatus.get(key)}
/>
));
return (
<div className="module-controller">
<div className="card">
<div className="card-header"><span>Components</span></div>
<div className="card-content-column">
{componentEntries}
</div>
</div>
<div className="card">
<div className="card-header"><span>Modules</span></div>
<div className="card-content-row">
{moduleEntries}
</div>
</div>
</div>
);
}
}
|
client/src/react/_controls/MoneyDisplay.js | charlesj/Apollo | import React from 'react'
import Flexbox from 'flexbox-react'
import PropTypes from 'prop-types'
import ClassNames from 'classnames'
import './MoneyDisplay.css'
function MoneyDisplay({amount,}){
const displayAmount = parseFloat(Math.round(amount * 100) / 100).toFixed(2)
return (<Flexbox width='100px'>
<Flexbox>$</Flexbox>
<Flexbox flexGrow={1} justifyContent='flex-end' className={ClassNames({
'negativeAmount': amount < 0,
})}>{displayAmount}</Flexbox>
</Flexbox>)
}
MoneyDisplay.propTypes ={
amount: PropTypes.number.isRequired,
}
export default MoneyDisplay |
src/components/reports/report-cash.js | Xabadu/VendOS | import React, { Component } from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';
import Moment from 'moment';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import { getCash } from '../../actions/index';
class CashReport extends Component {
constructor(props) {
super(props);
}
componentWillMount() {
this.props.getCash();
}
_renderTable() {
return (
<BootstrapTable
data={this.props.cashDetail}
striped={true}
hover={true}
bordered={false}
search={true}
pagination={true}
options={{
paginationSize: 10,
noDataText: 'No hay datos para mostrar.'
}}
>
<TableHeaderColumn width="500" dataField="store" isKey={true} dataAlign="center" dataSort={true}>Tienda</TableHeaderColumn>
<TableHeaderColumn dataField="recycler" dataSort={true}>Reciclador</TableHeaderColumn>
<TableHeaderColumn dataField="tube_a" dataSort={true}>Tubo A(100v)</TableHeaderColumn>
<TableHeaderColumn dataField="tube_b" dataSort={true}>Tubo B(100n)</TableHeaderColumn>
<TableHeaderColumn dataField="tube_c" dataSort={true}>Tubo C(500)</TableHeaderColumn>
<TableHeaderColumn dataField="tube_d" dataSort={true}>Tubo D(100n)</TableHeaderColumn>
<TableHeaderColumn dataField="tube_e" dataSort={true}>Tubo E(50)</TableHeaderColumn>
<TableHeaderColumn dataField="tube_f" dataSort={true}>Tubo F(500)</TableHeaderColumn>
<TableHeaderColumn dataField="moneybox" dataSort={true}>Alcancía</TableHeaderColumn>
<TableHeaderColumn dataField="cassette" dataSort={true}>Casette</TableHeaderColumn>
</BootstrapTable>
);
}
render() {
return (
<div>
<div className="page-breadcrumb">
<ol className="breadcrumb container">
<li><Link to='/'>Inicio</Link></li>
<li><a href="#">Reportes</a></li>
<li className="active">Efectivo</li>
</ol>
</div>
<div className="page-title">
<div className="container">
<h3>Efectivo</h3>
</div>
</div>
<div id="main-wrapper" className="container">
<div className="row">
<div className="col-md-12">
<div className="panel panel-white">
<div className="panel-heading clearfix">
<h4 className="panel-title">Estado de efectivo en puntos</h4>
</div>
<div className="panel-body">
<div>
{this._renderTable()}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
function mapStateToProps(state) {
return {
cashDetail: state.reports.cashDetail
}
}
export default connect(mapStateToProps, { getCash })(CashReport);
|
src/svg-icons/image/photo-size-select-small.js | pomerantsev/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImagePhotoSizeSelectSmall = (props) => (
<SvgIcon {...props}>
<path d="M23 15h-2v2h2v-2zm0-4h-2v2h2v-2zm0 8h-2v2c1 0 2-1 2-2zM15 3h-2v2h2V3zm8 4h-2v2h2V7zm-2-4v2h2c0-1-1-2-2-2zM3 21h8v-6H1v4c0 1.1.9 2 2 2zM3 7H1v2h2V7zm12 12h-2v2h2v-2zm4-16h-2v2h2V3zm0 16h-2v2h2v-2zM3 3C2 3 1 4 1 5h2V3zm0 8H1v2h2v-2zm8-8H9v2h2V3zM7 3H5v2h2V3z"/>
</SvgIcon>
);
ImagePhotoSizeSelectSmall = pure(ImagePhotoSizeSelectSmall);
ImagePhotoSizeSelectSmall.displayName = 'ImagePhotoSizeSelectSmall';
ImagePhotoSizeSelectSmall.muiName = 'SvgIcon';
export default ImagePhotoSizeSelectSmall;
|
src/containers/ui/Menu/MenuView.js | shojil/bifapp | /**
* Menu Contents
*
* React Native Starter App
* https://github.com/mcnamee/react-native-starter-app
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
View,
Alert,
StyleSheet,
TouchableOpacity,
} from 'react-native';
import { Actions } from 'react-native-router-flux';
// Consts and Libs
import { AppStyles, AppSizes } from '@theme/';
// Components
import { Spacer, Text, Button } from '@ui/';
/* Styles ==================================================================== */
const MENU_BG_COLOR = '#263137';
const styles = StyleSheet.create({
backgroundFill: {
backgroundColor: MENU_BG_COLOR,
height: AppSizes.screen.height,
width: AppSizes.screen.width,
position: 'absolute',
top: 0,
left: 0,
},
container: {
position: 'relative',
flex: 1,
},
menuContainer: {
flex: 1,
left: 0,
right: 0,
backgroundColor: MENU_BG_COLOR,
},
// Main Menu
menu: {
flex: 3,
left: 0,
right: 0,
backgroundColor: MENU_BG_COLOR,
padding: 20,
paddingTop: AppSizes.statusBarHeight + 20,
},
menuItem: {
borderBottomWidth: 1,
borderBottomColor: 'rgba(255, 255, 255, 0.1)',
paddingBottom: 10,
},
menuItem_text: {
fontSize: 16,
lineHeight: parseInt(16 + (16 * 0.5), 10),
fontWeight: '500',
marginTop: 14,
marginBottom: 8,
color: '#EEEFF0',
},
// Menu Bottom
menuBottom: {
flex: 1,
left: 0,
right: 0,
justifyContent: 'flex-end',
paddingBottom: 10,
},
menuBottom_text: {
color: '#EEEFF0',
},
});
/* Component ==================================================================== */
class Menu extends Component {
static propTypes = {
logout: PropTypes.func.isRequired,
closeSideMenu: PropTypes.func.isRequired,
user: PropTypes.shape({
email: PropTypes.string,
}),
unauthMenu: PropTypes.arrayOf(PropTypes.shape({})),
authMenu: PropTypes.arrayOf(PropTypes.shape({})),
}
static defaultProps = {
user: null,
unauthMenu: [],
authMenu: [],
}
/**
* On Press of any menu item
*/
onPress = (action) => {
this.props.closeSideMenu();
if (action) action();
}
/**
* On Logout Press
*/
logout = () => {
if (this.props.logout) {
this.props.logout()
.then(() => {
this.props.closeSideMenu();
Actions.login();
}).catch(() => {
Alert.alert('Oh uh!', 'Something went wrong.');
});
}
}
/**
* Each Menu Item looks like this
*/
menuItem = item => (
<TouchableOpacity
key={`menu-item-${item.title}`}
onPress={() => this.onPress(item.onPress)}
>
<View style={[styles.menuItem]}>
<Text style={[styles.menuItem_text]}>
{item.title}
</Text>
</View>
</TouchableOpacity>
)
/**
* Build the Menu List
*/
menuList = () => {
// Determine which menu to use - authenticated user menu or unauthenicated version?
let menu = this.props.unauthMenu;
if (this.props.user && this.props.user.email) menu = this.props.authMenu;
return menu.map(item => this.menuItem(item));
}
render = () => (
<View style={[styles.container]}>
<View style={[styles.backgroundFill]} />
<View style={[styles.menuContainer]}>
<View style={[styles.menu]}>{this.menuList()}</View>
<View style={[styles.menuBottom]}>
{this.props.user && this.props.user.email ?
<View>
<Text
style={[
styles.menuBottom_text,
AppStyles.textCenterAligned,
]}
>
Logged in as:{'\n'}
{this.props.user.email}
</Text>
<Spacer size={10} />
<View style={[AppStyles.paddingHorizontal, AppStyles.paddingVerticalSml]}>
<Button small title={'Log Out'} onPress={this.logout} />
</View>
</View>
:
<View style={[AppStyles.paddingHorizontal, AppStyles.paddingVerticalSml]}>
<Button small title={'Log In'} onPress={() => this.onPress(Actions.login)} />
</View>
}
</View>
</View>
</View>
)
}
/* Export Component ==================================================================== */
export default Menu;
|
app/javascript/mastodon/components/column_header.js | tootcafe/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
import Icon from 'mastodon/components/icon';
const messages = defineMessages({
show: { id: 'column_header.show_settings', defaultMessage: 'Show settings' },
hide: { id: 'column_header.hide_settings', defaultMessage: 'Hide settings' },
moveLeft: { id: 'column_header.moveLeft_settings', defaultMessage: 'Move column to the left' },
moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' },
});
export default @injectIntl
class ColumnHeader extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
intl: PropTypes.object.isRequired,
title: PropTypes.node,
icon: PropTypes.string,
active: PropTypes.bool,
multiColumn: PropTypes.bool,
extraButton: PropTypes.node,
showBackButton: PropTypes.bool,
children: PropTypes.node,
pinned: PropTypes.bool,
placeholder: PropTypes.bool,
onPin: PropTypes.func,
onMove: PropTypes.func,
onClick: PropTypes.func,
appendContent: PropTypes.node,
collapseIssues: PropTypes.bool,
};
state = {
collapsed: true,
animating: false,
};
historyBack = () => {
if (window.history && window.history.length === 1) {
this.context.router.history.push('/');
} else {
this.context.router.history.goBack();
}
}
handleToggleClick = (e) => {
e.stopPropagation();
this.setState({ collapsed: !this.state.collapsed, animating: true });
}
handleTitleClick = () => {
this.props.onClick();
}
handleMoveLeft = () => {
this.props.onMove(-1);
}
handleMoveRight = () => {
this.props.onMove(1);
}
handleBackClick = () => {
this.historyBack();
}
handleTransitionEnd = () => {
this.setState({ animating: false });
}
handlePin = () => {
if (!this.props.pinned) {
this.context.router.history.replace('/');
}
this.props.onPin();
}
render () {
const { title, icon, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, placeholder, appendContent, collapseIssues } = this.props;
const { collapsed, animating } = this.state;
const wrapperClassName = classNames('column-header__wrapper', {
'active': active,
});
const buttonClassName = classNames('column-header', {
'active': active,
});
const collapsibleClassName = classNames('column-header__collapsible', {
'collapsed': collapsed,
'animating': animating,
});
const collapsibleButtonClassName = classNames('column-header__button', {
'active': !collapsed,
});
let extraContent, pinButton, moveButtons, backButton, collapseButton;
if (children) {
extraContent = (
<div key='extra-content' className='column-header__collapsible__extra'>
{children}
</div>
);
}
if (multiColumn && pinned) {
pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='times' /> <FormattedMessage id='column_header.unpin' defaultMessage='Unpin' /></button>;
moveButtons = (
<div key='move-buttons' className='column-header__setting-arrows'>
<button title={formatMessage(messages.moveLeft)} aria-label={formatMessage(messages.moveLeft)} className='text-btn column-header__setting-btn' onClick={this.handleMoveLeft}><Icon id='chevron-left' /></button>
<button title={formatMessage(messages.moveRight)} aria-label={formatMessage(messages.moveRight)} className='text-btn column-header__setting-btn' onClick={this.handleMoveRight}><Icon id='chevron-right' /></button>
</div>
);
} else if (multiColumn && this.props.onPin) {
pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='plus' /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>;
}
if (!pinned && (multiColumn || showBackButton)) {
backButton = (
<button onClick={this.handleBackClick} className='column-header__back-button'>
<Icon id='chevron-left' className='column-back-button__icon' fixedWidth />
<FormattedMessage id='column_back_button.label' defaultMessage='Back' />
</button>
);
}
const collapsedContent = [
extraContent,
];
if (multiColumn) {
collapsedContent.push(moveButtons);
collapsedContent.push(pinButton);
}
if (children || (multiColumn && this.props.onPin)) {
collapseButton = (
<button
className={collapsibleButtonClassName}
title={formatMessage(collapsed ? messages.show : messages.hide)}
aria-label={formatMessage(collapsed ? messages.show : messages.hide)}
aria-pressed={collapsed ? 'false' : 'true'}
onClick={this.handleToggleClick}
>
<i className='icon-with-badge'>
<Icon id='sliders' />
{collapseIssues && <i className='icon-with-badge__issue-badge' />}
</i>
</button>
);
}
const hasTitle = icon && title;
const component = (
<div className={wrapperClassName}>
<h1 className={buttonClassName}>
{hasTitle && (
<button onClick={this.handleTitleClick}>
<Icon id={icon} fixedWidth className='column-header__icon' />
{title}
</button>
)}
{!hasTitle && backButton}
<div className='column-header__buttons'>
{hasTitle && backButton}
{extraButton}
{collapseButton}
</div>
</h1>
<div className={collapsibleClassName} tabIndex={collapsed ? -1 : null} onTransitionEnd={this.handleTransitionEnd}>
<div className='column-header__collapsible-inner'>
{(!collapsed || animating) && collapsedContent}
</div>
</div>
{appendContent}
</div>
);
if (multiColumn || placeholder) {
return component;
} else {
// The portal container and the component may be rendered to the DOM in
// the same React render pass, so the container might not be available at
// the time `render()` is called.
const container = document.getElementById('tabs-bar__portal');
if (container === null) {
// The container wasn't available, force a re-render so that the
// component can eventually be inserted in the container and not scroll
// with the rest of the area.
this.forceUpdate();
return component;
} else {
return createPortal(component, container);
}
}
}
}
|
src/routes/error/index.js | brian-kilpatrick/react-starter-kit | import React from 'react';
import ErrorPage from './ErrorPage';
export default {
path: '/error',
action({ error }) {
return {
title: error.name,
description: error.message,
component: <ErrorPage error={error} />,
status: error.status || 500,
};
},
};
|
src/svg-icons/maps/local-drink.js | kittyjumbalaya/material-components-web | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalDrink = (props) => (
<SvgIcon {...props}>
<path d="M3 2l2.01 18.23C5.13 21.23 5.97 22 7 22h10c1.03 0 1.87-.77 1.99-1.77L21 2H3zm9 17c-1.66 0-3-1.34-3-3 0-2 3-5.4 3-5.4s3 3.4 3 5.4c0 1.66-1.34 3-3 3zm6.33-11H5.67l-.44-4h13.53l-.43 4z"/>
</SvgIcon>
);
MapsLocalDrink = pure(MapsLocalDrink);
MapsLocalDrink.displayName = 'MapsLocalDrink';
MapsLocalDrink.muiName = 'SvgIcon';
export default MapsLocalDrink;
|
frontend/src/index.js | natsukagami/hakkero-project | import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import App from './App';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducers from './data/reducers';
let store = createStore(reducers, applyMiddleware(thunk));
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
|
wwwroot/app/src/components/MealPlannerPage/AddNewMeal.js | AlinCiocan/PlanEatSave | import React from 'react';
import Select from 'react-select';
import Routes from '../../services/Routes';
import TopBar from '../TopBar/TopBar';
import { ApiRequest } from '../../services/ApiRequest';
import DateFormatter from '../../utils/DateFormatter';
import Button from '../base/buttons/Button';
import OrSeparator from '../base/OrSeparator';
export default class AddNewMeal extends React.Component {
constructor(props) {
super(props);
this.state = {
message: this.getRetrievingYourRecopesMessage(),
areRecipiesLoaded: false,
recipes: [],
selectedRecipeId: null
};
this.saveMeal = this.saveMeal.bind(this);
}
getMealDate() {
return DateFormatter.markLocaleDateAsUtc(DateFormatter.stringToDate(this.props.location.query.mealDate));
}
componentDidMount() {
ApiRequest.retrieveRecipes()
.then(rsp => {
const recipes = rsp.body;
const recipesOptions = recipes.map(recipe => ({ value: recipe.id, label: recipe.name }));
this.setState({ areRecipiesLoaded: true, message: null, recipes: recipesOptions });
}, err => {
this.setState({ message: this.getErrorMessage() });
});
}
onRecipeChanged(recipe) {
this.setState({ selectedRecipeId: recipe.value })
}
getRetrievingYourRecopesMessage() {
return (
<h3>Retrieving your recipes... </h3>
);
}
getSavingYourMealMessage() {
return (
<h3>Saving your meal... </h3>
);
}
getErrorMessage() {
return (
<h3 style={{ color: 'red' }}> There was an error with our server. Please try again! </h3>
);
}
getErrorMessageForInvalidDate() {
const mealDate = this.props.location.query.mealDate;
const message = mealDate ? `This meal date is not a valid date: ${mealDate}` : 'You do not have a meal date. Please go back to meal planner.';
return (
<h3 style={{ color: 'red' }}> {message} </h3>
);
}
saveMeal() {
const mealDate = this.getMealDate();
if (!mealDate.isValid()) {
this.setState({ message: this.getErrorMessageForInvalidDate() });
return;
}
this.setState({ message: this.getSavingYourMealMessage(), areRecipiesLoaded: false });
const { mealOrder } = this.props.location.query;
ApiRequest.addMealFromExistingRecipe(this.state.selectedRecipeId, DateFormatter.dateToIsoString(mealDate), mealOrder || 0)
.then(rsp => {
this.goToMealPlanner();
}, err => {
this.setState({ message: this.getErrorMessage(), areRecipiesLoaded: true })
});
}
goToMealPlanner() {
this.props.router.push(this.getRouteToMealPlanner());
}
getRouteToMealPlanner() {
return Routes.mealPlannerWithDate(this.props.location.query.mealDate);
}
renderBody() {
if (!this.state.areRecipiesLoaded) {
return null;
}
return (
<div>
<div className="pes-add-meal__existing-recipe">
<div className="pes-add-meal__existing-recipe-title">
Add meal from existing recipes
</div>
<div className="pes-add-meal__existing-recipe-dropdown">
<Select
options={this.state.recipes}
value={this.state.selectedRecipeId}
onChange={option => this.onRecipeChanged(option)}
clearable={true}
searchable={true}
placeholder="Select recipe"
/>
<div className="pes-add-meal__existing-recipe-add-button">
<Button onClick={this.saveMeal} text="Add meal" />
</div>
</div>
</div>
<OrSeparator />
<div>
</div>
</div>
);
}
render() {
return (
<div>
<TopBar
hideLogo
backButton backButtonText="Add meal" backButtonOnClick={() => this.props.router.push(this.getRouteToMealPlanner())} />
<div className="pes-row">
{this.state.message}
{this.renderBody()}
</div>
</div>
);
}
} |
src/svg-icons/image/rotate-90-degrees-ccw.js | frnk94/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageRotate90DegreesCcw = (props) => (
<SvgIcon {...props}>
<path d="M7.34 6.41L.86 12.9l6.49 6.48 6.49-6.48-6.5-6.49zM3.69 12.9l3.66-3.66L11 12.9l-3.66 3.66-3.65-3.66zm15.67-6.26C17.61 4.88 15.3 4 13 4V.76L8.76 5 13 9.24V6c1.79 0 3.58.68 4.95 2.05 2.73 2.73 2.73 7.17 0 9.9C16.58 19.32 14.79 20 13 20c-.97 0-1.94-.21-2.84-.61l-1.49 1.49C10.02 21.62 11.51 22 13 22c2.3 0 4.61-.88 6.36-2.64 3.52-3.51 3.52-9.21 0-12.72z"/>
</SvgIcon>
);
ImageRotate90DegreesCcw = pure(ImageRotate90DegreesCcw);
ImageRotate90DegreesCcw.displayName = 'ImageRotate90DegreesCcw';
ImageRotate90DegreesCcw.muiName = 'SvgIcon';
export default ImageRotate90DegreesCcw;
|
src/components/block/story.js | casesandberg/react-color | import React from 'react'
import { storiesOf } from '@storybook/react'
import { renderWithKnobs } from '../../../.storybook/report'
import SyncColorField from '../../../.storybook/SyncColorField'
import Block from './Block'
storiesOf('Pickers', module)
.add('BlockPicker', () => (
<SyncColorField component={ Block }>
{ renderWithKnobs(Block, {}, null, {
width: { range: true, min: 140, max: 500, step: 1 },
}) }
</SyncColorField>
))
|
src/platform/apps/team/admin/components/roles/index.js | ccetc/platform | import React from 'react'
import { connect } from 'react-redux'
import * as actions from './actions'
import _ from 'lodash'
class Roles extends React.Component {
static propTypes = {
assigned: React.PropTypes.array,
roles: React.PropTypes.array,
onLoad: React.PropTypes.func,
onToggleRole: React.PropTypes.func,
onChange: React.PropTypes.func
}
render() {
const { assigned, roles } = this.props
return (
<div className="roles">
{ roles.map((role, index) => {
return (
<div key={`role_${index}`} className="role">
<div className="role-label">
<strong>{ role.title }</strong><br />
{ role.description }
</div>
<div className="role-input">
<i className={`toggle ${_.includes(assigned, role.id) ? 'on' : 'off'} icon`} onClick={ this._handleToggleRole.bind(this, index) } />
</div>
</div>
)
})}
</div>
)
}
componentDidMount() {
const { defaultValue, onSetAssigned, onLoad } = this.props
if(defaultValue) {
onSetAssigned(defaultValue)
}
onLoad()
}
componentDidUpdate(prevProps) {
const { assigned, onChange } = this.props
if(assigned !== prevProps.assigned) {
onChange(assigned)
}
}
_handleToggleRole(index) {
this.props.onToggle(index)
}
}
const mapStateToProps = state => ({
roles: state.team.roles.roles,
assigned: state.team.roles.assigned
})
const mapDispatchToProps = {
onLoad: actions.load,
onSetAssigned: actions.setAssigned,
onToggle: actions.toggle
}
export default connect(mapStateToProps, mapDispatchToProps)(Roles)
|
src/pages/simplelife.js | vitorbarbosa19/ziro-online | import React from 'react'
import BrandGallery from '../components/BrandGallery'
export default () => (
<BrandGallery brand='Simplelife' />
)
|
src/components/characterList.js | vitorfranca/fe-fates | import React from 'react';
import R from 'ramda';
import Character from './character';
import connect from '../redux/connect';
class CharacterList extends React.Component {
constructor(props) {
super(props);
this.state = {
characters: require('../../data/characters')
};
}
loadMore() {
return this.props.dispatch(actions.getPokedex());
}
filteredCharacters() {
return R.filter(char => {
return (
char.name.toLowerCase().includes(this.props.filter.name) &&
(this.props.filter.path === '' || char.paths.includes(this.props.filter.path))
)
}, this.state.characters);
}
render() {
const { filter } = this.props;
const characters = this.filteredCharacters();
return (
<ul style={{
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'center',
alignItems: 'center'
}}>
{ R.map(character =>
<Character
key={character.name} character={character}
onClick={this.props.onCardClick} />
, R.values(characters)) }
</ul>
);
}
}
export default connect(['filter'])(CharacterList);
|
src/examples/styles/scss/index.js | vinogradov/react-starter-kit | import React from 'react';
import ReactDOM from 'react-dom';
import './style.scss';
function Scss() {
return (
<div className="parent">
<div className="child" />
</div>
);
}
ReactDOM.render(
<Scss />,
document.querySelector('#app')
);
|
examples/01 Dustbin/Multiple Targets/Container.js | tylercollier/react-dnd-demo | import React, { Component } from 'react';
import { DragDropContext } from 'react-dnd';
import HTML5Backend, { NativeTypes } from 'react-dnd-html5-backend';
import Dustbin from './Dustbin';
import Box from './Box';
import ItemTypes from './ItemTypes';
import update from 'react/lib/update';
@DragDropContext(HTML5Backend)
export default class Container extends Component {
constructor(props) {
super(props);
this.state = {
dustbins: [
{ accepts: [ItemTypes.GLASS], lastDroppedItem: null },
{ accepts: [ItemTypes.FOOD], lastDroppedItem: null },
{ accepts: [ItemTypes.PAPER, ItemTypes.GLASS, NativeTypes.URL], lastDroppedItem: null },
{ accepts: [ItemTypes.PAPER, NativeTypes.FILE], lastDroppedItem: null }
],
boxes: [
{ name: 'Bottle', type: ItemTypes.GLASS },
{ name: 'Banana', type: ItemTypes.FOOD },
{ name: 'Magazine', type: ItemTypes.PAPER }
],
droppedBoxNames: []
};
}
isDropped(boxName) {
return this.state.droppedBoxNames.indexOf(boxName) > -1;
}
render() {
const { boxes, dustbins } = this.state;
return (
<div>
<div style={{ overflow: 'hidden', clear: 'both' }}>
{dustbins.map(({ accepts, lastDroppedItem }, index) =>
<Dustbin accepts={accepts}
lastDroppedItem={lastDroppedItem}
onDrop={(item) => this.handleDrop(index, item)}
key={index} />
)}
</div>
<div style={{ overflow: 'hidden', clear: 'both' }}>
{boxes.map(({ name, type }, index) =>
<Box name={name}
type={type}
isDropped={this.isDropped(name)}
key={index} />
)}
</div>
</div>
);
}
handleDrop(index, item) {
const { name } = item;
this.setState(update(this.state, {
dustbins: {
[index]: {
lastDroppedItem: {
$set: item
}
}
},
droppedBoxNames: name ? {
$push: [name]
} : {}
}));
}
} |
src/Frontend/components/form/CompositeFormField.js | Sententiaregum/Sententiaregum | /*
* This file is part of the Sententiaregum project.
*
* (c) Maximilian Bosch <maximilian@mbosch.me>
* (c) Ben Bieler <ben@benbieler.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
'use strict';
import React, { Component } from 'react';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import HelpBlock from 'react-bootstrap/lib/HelpBlock';
import FormHelper from '../../util/react/FormHelper';
import counterpart from 'counterpart';
import invariant from 'invariant';
import Locale from '../../util/http/Locale';
/**
* Abstract ReactJS component which behaves as wrapper for form fields.
*
* @author Maximilian Bosch <maximilian@mbosch.me>
*/
export default class CompositeFormField extends Component {
/**
* Constructor.
*
* @param {Object} props The object properties.
*
* @returns {void}
*/
constructor(props) {
super(props);
this._change = () => this.forceUpdate();
}
/**
* Lifecycle hook which establishes a connection between the event manager of the translator
* and the form wrapper component.
*
* @returns {void}
*/
componentDidMount() {
counterpart.onLocaleChange(this._change);
}
/**
* Lifecycle hook which closes the connection between the event manager of the translator and the wrapper.
*
* @returns {void}
*/
componentWillUnmount() {
counterpart.offLocaleChange(this._change);
}
/**
* Renderer which creates the form component.
*
* @returns {React.Element} The markup.
*/
render() {
const { name, errors, helper } = this.props;
const messages = this._getArray(this._getErrorsForCurrentLanguage(errors, name));
return (
<FormGroup controlId={name} validationState={helper.associateFieldsWithStyle(messages)}>
{React.Children.map(this.props.children, child => {
if (child.props.placeholder) {
return React.cloneElement(child, { placeholder: helper.getTranslatedFormField(child.props.placeholder) });
}
return child;
})}
{messages.map((error, i) => <HelpBlock key={i}>{error}</HelpBlock>)}
</FormGroup>
);
}
/**
* Gets the errors for current language.
*
* @param {Object} errors The errors.
* @param {String} property The property.
*
* @returns {Array.<String>} The error list.
* @private
*/
_getErrorsForCurrentLanguage(errors, property) {
const errorList = errors[property];
if ('undefined' === typeof errorList) {
return [];
}
const errorsForProperty = errorList[Locale.getLocale()];
invariant(
'undefined' !== typeof errorsForProperty,
'Cannot extract errors from state!'
);
return errorsForProperty;
}
/**
* Transforms the error list in order to use a common format during the rendering process.
*
* @param {*} errors The errors.
*
* @returns {Array.<String>} The transformed error list.
* @private
*/
_getArray(errors) {
return 'undefined' === typeof errors ? [] : (Array.isArray(errors) ? errors : [errors]);
}
}
CompositeFormField.propTypes = {
name: React.PropTypes.string,
errors: React.PropTypes.object,
helper: React.PropTypes.instanceOf(FormHelper),
children: React.PropTypes.node
};
|
src/common/components/Box.js | TheoMer/este | // @flow
import type { Color, Theme } from '../themes/types';
import React from 'react';
import isReactNative from '../../common/app/isReactNative';
// Universal styled Box component. The same API for browsers and React Native.
// Some props are ommited or limited or set to match React Native behaviour.
// - default display is flex
// - default position is relative
// - default flexDirection is column
// We can use style prop for platform specific styling.
// style={theme => ({
// // Set borderTopWidth to 1 to componsate padding.
// borderTopWidth: StyleSheet.hairlineWidth,
// })}
export type BoxProps = {
// sitr.us/2017/01/03/flow-cookbook-react.html
as?: () => React.Element<*>,
// Low level deliberately not typed.
style?: (theme: Theme, style: Object) => Object,
// Maybe rhythm props.
margin?: number | string,
marginHorizontal?: number | string,
marginVertical?: number | string,
marginBottom?: number | string,
marginLeft?: number | string,
marginRight?: number | string,
marginTop?: number | string,
padding?: number | string,
paddingHorizontal?: number | string,
paddingVertical?: number | string,
paddingBottom?: number | string,
paddingLeft?: number | string,
paddingRight?: number | string,
paddingTop?: number | string,
height?: number | string,
maxHeight?: number | string,
maxWidth?: number | string,
minHeight?: number | string,
minWidth?: number | string,
width?: number | string,
bottom?: number | string,
left?: number | string,
right?: number | string,
top?: number | string,
flex?: number,
backgroundColor?: Color,
// Border props.
borderBottomColor?: Color,
borderBottomLeftRadius?: number,
borderBottomRightRadius?: number,
borderBottomWidth?: number,
borderColor?: Color,
borderLeftColor?: Color,
borderLeftWidth?: number,
borderRadius?: number,
borderRightColor?: Color,
borderRightWidth?: number,
borderStyle?: 'solid' | 'dotted' | 'dashed',
borderTopColor?: Color,
borderTopLeftRadius?: number,
borderTopRightRadius?: number,
borderTopWidth?: number,
borderWidth?: number,
// Just value props.
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline',
alignSelf?:
| 'auto'
| 'flex-start'
| 'flex-end'
| 'center'
| 'stretch'
| 'baseline',
flexBasis?: number | string,
flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse',
flexGrow?: number,
flexShrink?: number,
flexWrap?: 'wrap' | 'nowrap',
justifyContent?:
| 'flex-start'
| 'flex-end'
| 'center'
| 'space-between'
| 'space-around',
opacity?: number,
overflow?: 'visible' | 'hidden' | 'scroll',
position?: 'absolute' | 'relative',
zIndex?: number,
};
type BoxContext = {
View: () => React.Element<*>,
renderer: any, // TODO: Type it.
theme: Theme,
};
const setBorderTryEnsureRhythmViaPadding = (style, borderWidthProps) => {
Object.keys(borderWidthProps).forEach(borderWidthProp => {
const borderWidthPropValue = borderWidthProps[borderWidthProp];
if (typeof borderWidthPropValue !== 'number') return;
style = { ...style, [borderWidthProp]: borderWidthPropValue };
const paddingProp = borderWidthProp === 'borderBottomWidth'
? 'paddingBottom'
: borderWidthProp === 'borderLeftWidth'
? 'paddingLeft'
: borderWidthProp === 'borderRightWidth'
? 'paddingRight'
: 'paddingTop';
const paddingPropValue = style[paddingProp];
if (typeof paddingPropValue !== 'number') return;
const compensatedPaddingPropValue = paddingPropValue - borderWidthPropValue;
const canCompensate = compensatedPaddingPropValue >= 0;
if (!canCompensate) return;
style = { ...style, [paddingProp]: compensatedPaddingPropValue };
});
return style;
};
const computeBoxStyle = (
theme,
{
// Maybe rhythm props.
margin,
marginVertical = margin,
marginHorizontal = margin,
marginTop = marginVertical,
marginBottom = marginVertical,
marginLeft = marginHorizontal,
marginRight = marginHorizontal,
padding,
paddingVertical = padding,
paddingHorizontal = padding,
paddingTop = paddingVertical,
paddingBottom = paddingVertical,
paddingLeft = paddingHorizontal,
paddingRight = paddingHorizontal,
height,
maxHeight,
maxWidth,
minHeight,
minWidth,
width,
bottom,
left,
right,
top,
flex,
backgroundColor,
// Border props.
borderColor = 'gray',
// We can't use borderColor as default because some component in React Native,
// for example Image, doesn't support that.
borderBottomColor,
borderLeftColor,
borderRightColor,
borderTopColor,
borderRadius,
borderBottomLeftRadius = borderRadius,
borderBottomRightRadius = borderRadius,
borderTopLeftRadius = borderRadius,
borderTopRightRadius = borderRadius,
borderWidth = 0, // Enfore React Native behaviour. It also makes more sense.
borderBottomWidth = borderWidth,
borderLeftWidth = borderWidth,
borderRightWidth = borderWidth,
borderTopWidth = borderWidth,
borderStyle,
// Just value props.
alignItems,
alignSelf,
flexBasis,
flexDirection,
flexGrow,
flexShrink,
flexWrap,
justifyContent,
opacity,
overflow,
position,
zIndex,
...props
},
) => {
let style = isReactNative
? {}
: {
// Enforce React Native behaviour for browsers.
position: 'relative',
flexDirection: 'column',
display: 'flex',
};
const maybeRhythmProps = {
bottom,
height,
left,
marginBottom,
marginLeft,
marginRight,
marginTop,
maxHeight,
maxWidth,
minHeight,
minWidth,
paddingBottom,
paddingLeft,
paddingRight,
paddingTop,
right,
top,
width,
};
Object.keys(maybeRhythmProps).forEach(prop => {
const value = maybeRhythmProps[prop];
if (typeof value === 'number') {
style = { ...style, [prop]: theme.typography.rhythm(value) };
} else if (value) {
style = { ...style, [prop]: value };
}
});
// Enforce React Native flex behaviour. Can be overridden.
if (typeof flex === 'number') {
if (isReactNative) {
style = { ...style, flex: 1 };
} else {
style = { ...style, flexBasis: 'auto', flexGrow: flex, flexShrink: 1 };
}
}
const colorProps = {
backgroundColor,
// Do not sort, borderColor shorthand must be set first.
borderColor,
borderBottomColor,
borderLeftColor,
borderRightColor,
borderTopColor,
};
Object.keys(colorProps).forEach(prop => {
const value = colorProps[prop];
if (!value) return;
style = { ...style, [prop]: theme.colors[value] };
});
style = setBorderTryEnsureRhythmViaPadding(style, {
borderBottomWidth,
borderLeftWidth,
borderRightWidth,
borderTopWidth,
});
// Just value props.
const justValueProps = {
alignItems,
alignSelf,
borderBottomLeftRadius,
borderBottomRightRadius,
borderStyle,
borderTopLeftRadius,
borderTopRightRadius,
flexBasis,
flexDirection,
flexGrow,
flexShrink,
flexWrap,
justifyContent,
opacity,
overflow,
position,
zIndex,
};
Object.keys(justValueProps).forEach(prop => {
const value = justValueProps[prop];
const isDefined = typeof value === 'number' || value;
if (!isDefined) return;
style = { ...style, [prop]: value };
});
return [style, props];
};
const Box = (
{
as,
style,
...props
}: BoxProps,
{
// Note no $Exact<BoxProps>. It's up to the rendered component.
View,
renderer,
theme,
}: BoxContext,
) => {
const Component = as || View;
const [boxStyle, restProps] = computeBoxStyle(theme, props);
const rule = renderer.renderRule(() => ({
...boxStyle,
...(style && style(theme, boxStyle)),
}));
return (
<Component
{...restProps}
{...{ [isReactNative ? 'style' : 'className']: rule }}
/>
);
};
Box.contextTypes = {
View: React.PropTypes.func,
renderer: React.PropTypes.object,
theme: React.PropTypes.object,
};
export default Box;
|
src/client/notifications/Notifications.js | busyorg/busy | import React from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import LeftSidebar from '../app/Sidebar/LeftSidebar';
import Affix from '../components/Utils/Affix';
import * as notificationConstants from '../../common/constants/notifications';
import { getUpdatedSCUserMetadata } from '../auth/authActions';
import { getNotifications } from '../user/userActions';
import {
getAuthenticatedUserSCMetaData,
getNotifications as getNotificationsState,
getIsLoadingNotifications,
getAuthenticatedUserName,
} from '../reducers';
import requiresLogin from '../auth/requiresLogin';
import NotificationReply from '../components/Navigation/Notifications/NotificationReply';
import NotificationMention from '../components/Navigation/Notifications/NotificationMention';
import NotificationFollowing from '../components/Navigation/Notifications/NotificationFollowing';
import NotificationVote from '../components/Navigation/Notifications/NotificationVote';
import NotificationReblog from '../components/Navigation/Notifications/NotificationReblog';
import NotificationTransfer from '../components/Navigation/Notifications/NotificationTransfer';
import NotificationVoteWitness from '../components/Navigation/Notifications/NotificationVoteWitness';
import Loading from '../components/Icon/Loading';
import './Notifications.less';
class Notifications extends React.Component {
static propTypes = {
loadingNotifications: PropTypes.bool.isRequired,
getUpdatedSCUserMetadata: PropTypes.func.isRequired,
getNotifications: PropTypes.func.isRequired,
notifications: PropTypes.arrayOf(PropTypes.shape()),
currentAuthUsername: PropTypes.string,
userSCMetaData: PropTypes.shape(),
};
static defaultProps = {
notifications: [],
currentAuthUsername: '',
userSCMetaData: {},
};
componentDidMount() {
const { userSCMetaData, notifications } = this.props;
if (_.isEmpty(userSCMetaData)) {
this.props.getUpdatedSCUserMetadata();
}
if (_.isEmpty(notifications)) {
this.props.getNotifications();
}
}
render() {
const { notifications, currentAuthUsername, userSCMetaData, loadingNotifications } = this.props;
const lastSeenTimestamp = _.get(userSCMetaData, 'notifications_last_timestamp');
return (
<div className="shifted">
<div className="feed-layout container">
<Affix className="leftContainer" stickPosition={77}>
<div className="left">
<LeftSidebar />
</div>
</Affix>
<div className="NotificationsPage">
<div className="NotificationsPage__title">
<h1>
<FormattedMessage id="notifications" defaultMessage="Notifications" />
</h1>
</div>
<div className="NotificationsPage__content">
{loadingNotifications && (
<div className="NotificationsPage__loading">
<Loading />
</div>
)}
{_.map(notifications, (notification, index) => {
const key = `${index}${notification.timestamp}`;
const read = lastSeenTimestamp >= notification.timestamp;
switch (notification.type) {
case notificationConstants.REPLY:
return (
<NotificationReply
key={key}
notification={notification}
currentAuthUsername={currentAuthUsername}
read={read}
/>
);
case notificationConstants.FOLLOW:
return (
<NotificationFollowing key={key} notification={notification} read={read} />
);
case notificationConstants.MENTION:
return (
<NotificationMention key={key} notification={notification} read={read} />
);
case notificationConstants.VOTE:
return (
<NotificationVote
key={key}
notification={notification}
read={read}
currentAuthUsername={currentAuthUsername}
/>
);
case notificationConstants.REBLOG:
return (
<NotificationReblog
key={key}
notification={notification}
read={read}
currentAuthUsername={currentAuthUsername}
/>
);
case notificationConstants.TRANSFER:
return (
<NotificationTransfer key={key} notification={notification} read={read} />
);
case notificationConstants.WITNESS_VOTE:
return (
<NotificationVoteWitness key={key} notification={notification} read={read} />
);
default:
return null;
}
})}
{_.isEmpty(notifications) &&
!loadingNotifications && (
<div className="Notification Notification__empty">
<FormattedMessage
id="notifications_empty_message"
defaultMessage="You currently have no notifications."
/>
</div>
)}
</div>
</div>
</div>
</div>
);
}
}
export default connect(
state => ({
notifications: getNotificationsState(state),
userSCMetaData: getAuthenticatedUserSCMetaData(state),
currentAuthUsername: getAuthenticatedUserName(state),
loadingNotifications: getIsLoadingNotifications(state),
}),
{
getUpdatedSCUserMetadata,
getNotifications,
},
)(requiresLogin(Notifications));
|
frontend/app_v2/src/common/icons/Qrcode.js | First-Peoples-Cultural-Council/fv-web-ui | import React from 'react'
import PropTypes from 'prop-types'
function Qrcode({ styling }) {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 1200" className={styling}>
<title>QR Code</title>
<path d="M516.77-.082c-.047.023-.098.047-.145.074a37.561 37.561 0 00-30.816 20.63 37.56 37.56 0 0034.7 54.37h116.53v375.36a37.506 37.506 0 0064.312 27.062 37.526 37.526 0 0010.687-27.062V37.342a37.5 37.5 0 00-37.355-37.35h-154.18a36.086 36.086 0 00-3.734-.075zM39.09-.008a37.492 37.492 0 00-26.371 10.984A37.498 37.498 0 001.735 37.343v366.5a37.488 37.488 0 0010.883 26.56 37.523 37.523 0 0026.473 11.09h331.42a37.523 37.523 0 0026.473-11.09 37.487 37.487 0 0010.883-26.56v-366.5a37.5 37.5 0 00-37.355-37.35zm793.95 0a37.492 37.492 0 00-26.371 10.984 37.498 37.498 0 00-10.984 26.367v366.5a37.488 37.488 0 0010.883 26.56 37.523 37.523 0 0026.473 11.09h331.05a37.5 37.5 0 0037.644-37.648v-366.5a37.503 37.503 0 00-11.086-26.474A37.507 37.507 0 001164.09-.008zM35.8 557.732a37.533 37.533 0 00-32.508 18.766A37.539 37.539 0 0035.8 632.807h453.73v529.54a37.488 37.488 0 0010.883 26.56 37.523 37.523 0 0026.473 11.09h174.1-.004a37.519 37.519 0 0027.062-10.689 37.503 37.503 0 0011.281-26.812 37.503 37.503 0 00-38.343-37.5h-136.45v-529.62a37.484 37.484 0 00-10.984-26.66 37.484 37.484 0 00-26.66-10.984zm648.34 9.742a37.477 37.477 0 00-24.082 12.168 37.497 37.497 0 00-9.684 25.184v247.19a37.531 37.531 0 0010.684 27.062 37.512 37.512 0 0053.632 0 37.523 37.523 0 0010.684-27.062v-209.54h438.72a37.513 37.513 0 0031.789-56.015 37.51 37.51 0 00-31.789-18.984h-476.37a36.677 36.677 0 00-3.59 0zm148.9 190.43a37.503 37.503 0 00-37.356 37.645v366.21a37.52 37.52 0 0010.684 27.06 37.523 37.523 0 0026.816 11.284 37.514 37.514 0 0037.5-38.344V832.9h256.05v328.86a37.516 37.516 0 0037.5 38.344 37.515 37.515 0 0037.5-38.344V795.55a37.484 37.484 0 00-10.984-26.66 37.484 37.484 0 00-26.66-10.984zm-793.95.512a37.503 37.503 0 00-37.356 37.645v366.29a37.488 37.488 0 0010.883 26.56A37.523 37.523 0 0039.09 1200h331.42a37.523 37.523 0 0026.473-11.09 37.487 37.487 0 0010.883-26.56v-366.29a37.502 37.502 0 00-37.356-37.645z" />
</svg>
)
}
// PROPTYPES
const { string } = PropTypes
Qrcode.propTypes = {
styling: string,
}
export default Qrcode
|
app/index.js | pavelkomiagin/npmr | import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router, hashHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import routes from './routes';
import configureStore from './store/configureStore';
import './normalize.global.css';
import './antd.global.css';
import './app.global.sass';
//import 'antd/dist/antd.css';
const store = configureStore();
const history = syncHistoryWithStore(hashHistory, store);
render(
<Provider store={store}>
<Router history={history} routes={routes} />
</Provider>,
document.getElementById('root')
);
|
src/svg-icons/editor/insert-drive-file.js | matthewoates/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorInsertDriveFile = (props) => (
<SvgIcon {...props}>
<path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/>
</SvgIcon>
);
EditorInsertDriveFile = pure(EditorInsertDriveFile);
EditorInsertDriveFile.displayName = 'EditorInsertDriveFile';
EditorInsertDriveFile.muiName = 'SvgIcon';
export default EditorInsertDriveFile;
|
packages/bonde-admin/src/subscriptions/forms/recurring-form.js | ourcities/rebu-client | import PropTypes from 'prop-types'
import React from 'react'
import { reduxForm } from 'redux-form'
import { FormGroup, ControlLabel, FormControl } from '@/components/forms'
import { Pagarme } from '@/components/external-services'
import * as validationHelper from '@/utils/validation-helper'
import * as validators from '@/utils/redux-form/validators'
import * as normalizers from '@/utils/redux-form/normalizers'
const RecurringForm = ({
FormComponent,
fields: {
id,
token,
process_at: processAt
},
...formProps
}) => (
<div>
<Pagarme />
<FormComponent
{...formProps}
buttonText='Salvar'
>
<input type='hidden' name='id' value={id.value} />
<input type='hidden' name='token' value={token.value} />
<p className='mb3 lightgray'>
Preencha os campos abaixo para alterar a data em que a cobrança da sua doação é efetuada.
Sua doação continuará a mesma mas, a partir do momento em que salvar os dados abaixo,
o valor será cobrado neste novo cartão ; )
</p>
<FormGroup className='mb2' controlId='processAt' {...processAt}>
<ControlLabel>Nova data de cobrança</ControlLabel>
<FormControl
type='text'
placeholder='Ex: DD/MM/AAAA'
/>
</FormGroup>
</FormComponent>
</div>
)
const fields = ['id', 'token', 'process_at']
const abstractValidate = values => {
const errors = {}
if (!values.process_at) {
errors.process_at = 'Obrigatório'
} else if (!validationHelper.date(values.process_at).ddmmyyyy) {
errors.process_at = 'Formato de data inválido'
}
return errors
}
RecurringForm.propTypes = {
FormComponent: PropTypes.oneOfType([
PropTypes.node,
PropTypes.func
]).isRequired
}
export const normalizer = {
process_at: normalizers.date.ddmmyyyy
}
export default ({ validate, mapStateToProps, mapDispatchToProps }) => reduxForm({
form: 'recurringForm',
fields,
validate: validators.abstractValidate({ abstractValidate, validate })
}, mapStateToProps, mapDispatchToProps)(RecurringForm)
|
milestones/03-inline-styles/After/src/slide.js | jaketrent/react-drift | import PropTypes from 'prop-types'
import React from 'react'
import styles from './slide-styles.js'
function Slide(props) {
return (
<article style={{ ...styles.root, ...props.style }}>
<img src={props.image} alt={props.title} />
<footer style={styles.footer}>
<h2 style={styles.title}>{props.title}</h2>
<div>{props.children}</div>
</footer>
</article>
)
}
Slide.propTypes = {
image: PropTypes.string.isRequired,
style: PropTypes.object,
title: PropTypes.string
}
export default Slide
|
client/src/components/ViewCampaign/SignCampaign/AdminAddSignatureModal.js | codefordenver/Circular | import React from 'react';
import PropTypes from 'prop-types';
import { Button, ControlLabel, FormControl, FormGroup, Modal } from 'react-bootstrap';
import SignatureCheckbox from './SignatureCheckbox';
const AdminAddSignatureModalData = [
{
id: 'firstName',
label: 'First Name',
name: 'firstName',
placeholder: 'Sandra',
type: 'text'
},
{
id: 'lastName',
label: 'Last Name',
name: 'lastName',
placeholder: 'Recycleson',
type: 'text'
},
{
id: 'email',
label: 'Email',
name: 'email',
placeholder: 'sandra@recyclemore.net',
type: 'email'
},
{
id: 'signerMessage',
label: 'Signer Message',
name: 'signerMessage',
placeholder: "What's your recycle inspriation",
type: 'textarea'
}
];
const AdminAddSignatureModal = ({
adminAddSignatureData,
adminAddSignatureData: { formIsValid },
handleAdminAddSignature,
handleAdminAddSignatureModalDataChange,
keepMeUpdated,
onHide,
show,
toggleKeepMeUpdatedCheckbox
}) => (
<div>
<Modal keyboard show={show} onHide={onHide}>
<Modal.Header closeButton>
<Modal.Title style={{ color: 'black' }}>Add Signer To Campaign </Modal.Title>
</Modal.Header>
<Modal.Body className="update-campaign-modal-body" style={{ color: 'black' }}>
<form>
{AdminAddSignatureModalData.map(field => {
const { id, label, name, type, placeholder } = field;
return (
<FormGroup key={id} controlId={id}>
<ControlLabel>{label}</ControlLabel>
<FormControl
name={name}
type={type}
placeholder={placeholder}
value={adminAddSignatureData[id]}
onChange={e => handleAdminAddSignatureModalDataChange(e.target)}
/>
</FormGroup>
);
})}
<SignatureCheckbox
className="admin-add-signature"
keepMeUpdated={keepMeUpdated}
keepMeUpdatedLabel="Opt signer in to email updates"
toggleKeepMeUpdatedCheckbox={toggleKeepMeUpdatedCheckbox}
/>
</form>
</Modal.Body>
<Modal.Footer>
<Button disabled={!formIsValid} bsStyle="info" onClick={handleAdminAddSignature}>
Add Signature To List
</Button>
</Modal.Footer>
</Modal>
</div>
);
AdminAddSignatureModal.propTypes = {
adminAddSignatureData: PropTypes.shape({}).isRequired,
handleAdminAddSignature: PropTypes.func.isRequired,
handleAdminAddSignatureModalDataChange: PropTypes.func.isRequired,
keepMeUpdated: PropTypes.bool.isRequired,
onHide: PropTypes.func.isRequired,
show: PropTypes.bool.isRequired,
toggleKeepMeUpdatedCheckbox: PropTypes.func.isRequired
};
export default AdminAddSignatureModal;
|
src/components/android/plain/AndroidPlain.js | fpoumian/react-devicon | import React from 'react'
import PropTypes from 'prop-types'
import SVGDeviconInline from '../../_base/SVGDeviconInline'
import iconSVG from './AndroidPlain.svg'
/** AndroidPlain */
function AndroidPlain({ width, height, className }) {
return (
<SVGDeviconInline
className={'AndroidPlain' + ' ' + className}
iconSVG={iconSVG}
width={width}
height={height}
/>
)
}
AndroidPlain.propTypes = {
className: PropTypes.string,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}
export default AndroidPlain
|
app/javascript/mastodon/features/follow_requests/components/account_authorize.js | sylph-sin-tyaku/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Permalink from '../../../components/permalink';
import Avatar from '../../../components/avatar';
import DisplayName from '../../../components/display_name';
import IconButton from '../../../components/icon_button';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' },
reject: { id: 'follow_request.reject', defaultMessage: 'Reject' },
});
export default @injectIntl
class AccountAuthorize extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
onAuthorize: PropTypes.func.isRequired,
onReject: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
render () {
const { intl, account, onAuthorize, onReject } = this.props;
const content = { __html: account.get('note_emojified') };
return (
<div className='account-authorize__wrapper'>
<div className='account-authorize'>
<Permalink href={account.get('url')} to={`/accounts/${account.get('id')}`} className='detailed-status__display-name'>
<div className='account-authorize__avatar'><Avatar account={account} size={48} /></div>
<DisplayName account={account} />
</Permalink>
<div className='account__header__content' dangerouslySetInnerHTML={content} />
</div>
<div className='account--panel'>
<div className='account--panel__button'><IconButton title={intl.formatMessage(messages.authorize)} icon='check' onClick={onAuthorize} /></div>
<div className='account--panel__button'><IconButton title={intl.formatMessage(messages.reject)} icon='times' onClick={onReject} /></div>
</div>
</div>
);
}
}
|
src/components/web/App.js | mutualmobile/Brazos | import React, { Component } from 'react';
import { Route, Link } from 'react-router-dom';
import { inject, observer } from 'mobx-react';
import LazyRoute from 'lazy-route';
import DevTools from 'mobx-react-devtools';
import {withRouter} from 'react-router'
import TopBar from './TopBar';
@inject('store')
@withRouter
@observer
export default class App extends Component {
constructor(props) {
super(props);
this.store = this.props.store;
}
componentDidMount() {
this.authenticate();
}
authenticate(e) {
if (e) e.preventDefault();
this.store.appState.authenticate();
}
render() {
const {
authenticated,
authenticating,
timeToRefresh,
refreshToken,
testval
} = this.store.appState;
return (
<div className='wrapper'>
{/*<DevTools />*/}
<TopBar />
<Route
exact
path='/'
render={props => (
<LazyRoute {...props} component={import('../shared/Home')} />
)}
/>
<Route
exact
path='/page'
render={props => (
<LazyRoute {...props} component={import('../shared/Page')} />
)}
/>
<footer>
</footer>
</div>
);
}
} |
ReactJS/class-2017-12-31/redux2/src/App.js | tahashahid/cloud-computing-2017 | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import P1 from './com1';
import P2 from './com2';
class App extends Component {
render() {
return (
<div className="App">
<P1/>
<br/>
<P2/>
</div>
);
}
}
export default App;
|
src/svg-icons/maps/layers.js | barakmitz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLayers = (props) => (
<SvgIcon {...props}>
<path d="M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27-7.38 5.74zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16z"/>
</SvgIcon>
);
MapsLayers = pure(MapsLayers);
MapsLayers.displayName = 'MapsLayers';
MapsLayers.muiName = 'SvgIcon';
export default MapsLayers;
|
docs/src/components/seo.js | mistercrunch/panoramix | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import { Helmet } from 'react-helmet';
import { useStaticQuery, graphql } from 'gatsby';
import favicon from '../images/favicon.png';
function SEO({
description, lang, meta, title,
}) {
const { site } = useStaticQuery(
graphql`
query {
site {
siteMetadata {
title
description
author
}
}
}
`,
);
const metaDescription = description || site.siteMetadata.description;
return (
<Helmet
htmlAttributes={{
lang,
}}
title={title}
titleTemplate={`%s | ${site.siteMetadata.title}`}
meta={[
{
name: 'description',
content: metaDescription,
},
{
property: 'og:title',
content: title,
},
{
property: 'og:description',
content: metaDescription,
},
{
property: 'og:type',
content: 'website',
},
{
name: 'twitter:card',
content: 'summary',
},
{
name: 'twitter:creator',
content: site.siteMetadata.author,
},
{
name: 'twitter:title',
content: title,
},
{
name: 'twitter:description',
content: metaDescription,
},
].concat(meta)}
>
<link rel="icon" href={favicon} />
</Helmet>
);
}
SEO.defaultProps = {
lang: 'en',
meta: [],
description: '',
};
SEO.propTypes = {
description: PropTypes.string,
lang: PropTypes.string,
meta: PropTypes.arrayOf(PropTypes.object),
title: PropTypes.string.isRequired,
};
export default SEO;
|
src/components/dashboard/Dashboard.react.js | Space-Cadets/Titania-v2 | import React from 'react'
import Header from '../shared/Header.react.js'
import SearchContainer from '../../containers/SearchContainer.react.js'
const Dashboard = () => (
<div>
<Header />
<div className="contentContainer">
<h1>Dashboard</h1>
<SearchContainer />
</div>
</div>
)
export default Dashboard
|
client/node_modules/uu5g03/doc/main/client/src/data/source/uu5-forms-select-multiple.js | UnicornCollege/ucl.itkpd.configurator | import React from 'react';
import $ from 'jquery';
import {BaseMixin, ElementaryMixin, ContentMixin, Tools} from './../common/common.js';
import {Span, Div, Button, Glyphicon, Backdrop} from './../bricks/bricks.js';
import './select-multiple.less';
export default React.createClass({
mixins: [
BaseMixin,
ElementaryMixin,
ContentMixin
],
statics: {
tagName: 'UU5.Forms.Select._multiple',
classNames: {
main: 'uu5-forms-select-multiple',
inputGroup: 'input-group uu5-forms-text-group-with-feedback',
inputFeedback: 'uu5-forms-text-input-feedback',
inputBtnGroup: 'uu5-forms-select-input-btn-group input-group-btn',
header: 'uu5-forms-select-input-header form-control',
headerContent: 'uu5-forms-select-input-header-content',
menu: 'uu5-forms-select-input-menu',
innerMenu: 'uu5-forms-select-input-inner-menu list-group',
opened: 'uu5-forms-select-input-opened',
selectedItem: 'uu5-forms-select-input-selected-item bg-info',
hoverItem: 'uu5-forms-select-input-hover-item',
placeholder: 'uu5-forms-select-input-placeholder',
noButton: 'uu5-forms-select-input-no-button',
headerItem: 'uu5-forms-select-multiple-header-item bg-info',
headerItemText: 'uu5-forms-select-multiple-header-item-text',
headerItemClose: 'uu5-forms-select-multiple-header-item-close',
button: 'uu5-forms-input-button'
},
defaults: {
closeIcon: 'uu-glyphicon-cross'
}
},
propTypes: {
isOpened: React.PropTypes.bool,
value: React.PropTypes.arrayOf(React.PropTypes.number),
placeholder: React.PropTypes.string,
isButtonHidden: React.PropTypes.bool,
openedGlyphicon: React.PropTypes.string,
closedGlyphicon: React.PropTypes.string,
onChange: React.PropTypes.func
},
// Setting defaults
getDefaultProps: function () {
return {
isOpened: false,
value: null,
placeholder: null,
isButtonHidden: false,
openedGlyphicon: null,
closedGlyphicon: null,
onChange: null
};
},
getInitialState: function () {
this.toClose = true;
return {
isOpened: this.props.isOpened,
selectedIndex: null
};
},
// componentWillReceiveProps: function (nextProps) {
// nextProps.value != this.props.value && this.setState({ selectedIndexes: nextProps.value });
// },
// Interface
isOpened: function () {
return this.state.isOpened;
},
open: function (setStateCallback) {
this.setState({ isOpened: true }, setStateCallback);
return this;
},
close: function (setStateCallback) {
this.setState({ isOpened: false }, setStateCallback);
return this;
},
toggle: function (setStateCallback) {
var input = this;
this.setState(function (state) {
input.toClose = true;
return { isOpened: !state.isOpened, selectedIndex: null };
}, setStateCallback);
return this;
},
selectUp: function (setStateCallback) {
var input = this;
this.setState(function (state) {
var index = null;
if (state.isOpened) {
var childrenLength;
if (state.selectedIndex == null || state.selectedIndex === 0) {
childrenLength = input.getRenderedChildren().length;
index = childrenLength - 1;
} else {
index = state.selectedIndex - 1;
}
childrenLength = childrenLength || input.getRenderedChildren().length;
var offset = index > childrenLength - 3 ?
$('#' + input.getId() + '-item-' + (childrenLength - 1))[0].offsetTop :
index - 1 > 0 ? $('#' + input.getId() + '-item-' + (index - 1))[0].offsetTop : 0;
$('#' + this.getId() + '-menu').animate({ scrollTop: offset }, 0);
}
return { selectedIndex: index };
}, setStateCallback);
return this;
},
selectDown: function (setStateCallback) {
var input = this;
this.setState(function (state) {
var index = null;
var newState;
if (state.isOpened) {
var childrenLength = input.getRenderedChildren().length;
if (state.selectedIndex == null || state.selectedIndex === childrenLength - 1) {
index = 0;
} else {
index = state.selectedIndex + 1;
}
var offset = index > 1 ? $('#' + input.getId() + '-item-' + (index - 1))[0].offsetTop : 0;
$('#' + input.getId() + '-menu').animate({ scrollTop: offset }, 0);
newState = { selectedIndex: index };
} else {
newState = { isOpened: true, selectedIndex: 0 };
}
return newState;
}, setStateCallback);
return this;
},
changeValue: function (index, e, setStateCallback) {
if (typeof this.props.onChange === 'function') {
this.toClose = false;
this.props.onChange({ value: index, event: e, component: this, setStateCallback: setStateCallback });
}
},
getSelectedIndex: function () {
return this.state.selectedIndex;
},
getSelectedOptions: function () {
var input = this;
var options;
if (this.getSelectedIndex() === null) {
options = null;
} else {
options = this.getRenderedChildren().filter(function (child, i) {
return input.props.value && input.props.value.indexOf(i);
});
}
return options;
},
getSelectedValue: function () {
var options = this.getSelectedOptions();
return options ? options.map(function (opt) {
return opt.getValue();
}) : null;
},
// Overriding Functions
expandChildProps_: function (child, i) {
var props = Tools.mergeDeep({}, child.props);
props.selected = i == this.props.value;
if (this.props.value && this.props.value.indexOf(i) > -1 && this.state.selectedIndex !== i) {
props.className = props.className ? props.className + ' ' + this.getClassName().selectedItem : this.getClassName().selectedItem;
}
if (this.state.selectedIndex === i) {
props.className = props.className ? props.className + ' ' + this.getClassName().hoverItem : this.getClassName().hoverItem;
}
props.mainAttrs = props.mainAttrs || {};
props.mainAttrs.id = this.getId() + '-item-' + i;
var input = this;
var childOnClick = props.onClick;
props.onClick = function (opt) {
input.changeValue(opt.value, opt.event, childOnClick);
};
return props;
},
// Component Specific Helpers
_getMainAttrs: function () {
var attrs = this.getMainAttrs();
(this.props.isButtonHidden || this.props.isReadOnly) && (attrs.className += ' ' + this.getClassName().noButton);
if (this.isOpened()) {
attrs.className += ' ' + this.getClassName().opened;
var input = this;
var customOnKeyPress = attrs.onKeyPress;
attrs.onKeyPress = function (e) {
// stop submit form on enter if input is alone in form
if (e.keyCode == 13 || e.charCode == 13) {
e.preventDefault();
input.changeValue(input.getSelectedIndex(), e);
}
if (typeof customOnKeyPress === 'function') {
customOnKeyPress(e);
}
};
var customOnKeyDown = attrs.onKeyDown;
attrs.onKeyDown = function (e) {
switch (e.keyCode) {
case 27:
e.preventDefault();
input.close();
break;
case 38:
e.preventDefault();
input.selectUp();
break;
// case 39:
// input.open();
// break;
case 40:
e.preventDefault();
input.selectDown();
break;
}
if (typeof customOnKeyDown === 'function') {
customOnKeyDown(e);
}
};
var onMouseOver = attrs.onMouseOver;
attrs.onMouseOver = function (e) {
if (input.getSelectedIndex() !== null) {
var setStateCallback;
typeof onMouseOver === 'function' && (setStateCallback = onMouseOver.bind(input, e));
input.setState({ selectedIndex: null }, setStateCallback);
}
};
}
return attrs;
},
_getBackdropProps: function () {
var backdropId = this.getId() + "-backdrop";
return {
hidden: !this.isOpened(),
id: backdropId,
onClick: function (backdrop, event) {
event.target.id === backdropId && this.close();
}.bind(this)
};
},
_getChildren: function () {
return this.getChildren();
},
_getButtonProps: function () {
var input = this;
var props = {
className: this.getClassName('button'),
disabled: this.props.disabled,
pressed: this.isOpened()
};
if (!this.isReadOnly && !this.props.disabled) {
props.onClick = function () {
input.toggle();
};
}
return props;
},
_getHeader: function (children) {
var result;
if (this.props.value === null) {
if (this.props.placeholder) {
result = <Span className={this.getClassName().placeholder} content={this.props.placeholder} />
}
} else {
var input = this;
result = this.props.value.map(function (i) {
var child = children[i];
var value = child.props.selectedContent || child.props.content || (child.props.children && React.Children.toArray(child.props.children)) || child.props.value;
return (
<Span className={input.getClassName().headerItem} key={i}>
<Span className={input.getClassName().headerItemText} content={value} />
{!input.props.isReadOnly && !input.props.disabled && (
<Glyphicon
glyphicon={input.getDefault().closeIcon}
className={input.getClassName().headerItemClose}
mainAttrs={{
onClick: input.changeValue.bind(input, i)
}}
/>
)}
</Span>
);
});
}
return result;
},
_getMenuAttrs: function () {
return {
className: this.getClassName().menu
};
},
_getHeaderProps: function () {
var input = this;
var props = {
className: this.getClassName().header
};
if (!this.props.isReadOnly && !this.props.disabled) {
props.mainAttrs = {
onClick: function (e) {
if (input.toClose) {
input.toggle();
} else {
input.toClose = true;
}
}
};
}
return props;
},
_getHeaderContentProps: function (children) {
return {
className: this.getClassName().headerContent,
content: this._getHeader(children)
};
},
// Render
render: function () {
var children = this._getChildren();
return (
<div {...this._getMainAttrs()}>
<div className={this.getClassName().inputGroup}>
<div className={this.getClassName().inputFeedback}>
<Div {...this._getHeaderProps()}>
<Div {...this._getHeaderContentProps(children)} />
</Div>
{this.props.glyphicon}
</div>
{!this.props.isButtonHidden && !this.props.isReadOnly &&
<span className={this.getClassName().inputBtnGroup}>
<Button {...this._getButtonProps()}>
<Glyphicon glyphicon={this.props[this.isOpened() ? 'openedGlyphicon' : 'closedGlyphicon']} />
</Button>
</span>
}
</div>
<div {...this._getMenuAttrs()}>
<div className={this.getClassName().innerMenu} id={this.getId() + '-menu'}>
{children}
</div>
</div>
<Backdrop {...this._getBackdropProps()} />
</div>
);
}
}); |
demo/sections/Buttons.js | joshq00/react-mdl | import React from 'react';
import Example from './Example';
import Icon from '../../src/Icon';
import Button from '../../src/Button';
import IconButton from '../../src/IconButton';
import FABButton from '../../src/FABButton';
export default ( props ) => (
<section { ...props }>
<h3>Buttons</h3>
<Example>
<FABButton colored>
<Icon name="add" />
</FABButton>
<FABButton colored ripple>
<Icon name="add" />
</FABButton>
</Example>
<Example>
<FABButton>
<Icon name="add" />
</FABButton>
<FABButton ripple>
<Icon name="add" />
</FABButton>
<FABButton disabled>
<Icon name="add" />
</FABButton>
</Example>
<Example>
<Button raised>Button</Button>
<Button raised ripple>Button</Button>
<Button raised disabled>Button</Button>
</Example>
<Example>
<Button raised colored>Button</Button>
<Button raised accent>Button</Button>
<Button raised accent ripple>Button</Button>
</Example>
<Example>
<Button>Button</Button>
<Button ripple>Button</Button>
<Button disabled>Button</Button>
</Example>
<Example>
<Button primary colored>Button</Button>
<Button accent>Button</Button>
</Example>
<Example>
<IconButton name="mood" />
<IconButton colored name="mood" />
</Example>
<Example>
<FABButton mini>
<Icon name="add" />
</FABButton>
<FABButton colored mini>
<Icon name="add" />
</FABButton>
</Example>
</section>
);
|
node_modules/react-router/es6/RoutingContext.js | HK8383/react_project_imooc | import React from 'react';
import RouterContext from './RouterContext';
import warning from './routerWarning';
var RoutingContext = React.createClass({
displayName: 'RoutingContext',
componentWillMount: function componentWillMount() {
process.env.NODE_ENV !== 'production' ? warning(false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : void 0;
},
render: function render() {
return React.createElement(RouterContext, this.props);
}
});
export default RoutingContext; |
sundin/source/application.js | tkfeng/mppCalc | /**
* Main entry point into the app.
* Created by tkfeng on 3/29/17.
*/
import React from 'react';
import {
Navigator,
Linking,
AppState,
View,
StyleSheet,
Text,
} from 'react-native';
import { Router } from 'react-native-router-flux';
import scenes from './constants/scenes';
export default class Application extends React.Component {
render() {
return <Router scenes={scenes}/>
}
}
|
components/StickyNode/StickyNode.story.js | NGMarmaduke/bloom | import React from 'react';
import { storiesOf } from '@storybook/react';
import Hero from '../Hero/Hero';
import m from '../../globals/modifiers.css';
import StickyNode from './StickyNode';
storiesOf('StickyNode', module)
.add('Individual sticky bar', () => (
<div>
<div
className={m.pa96}
style={{
height: '150vh',
background: 'url(http://subtlepatterns2015.subtlepatterns' +
'.netdna-cdn.com/patterns/seigaiha.png)'
}}
>
<StickyNode>
<div className={[m.pal, m.bgPrimary].join(' ')} />
</StickyNode>
</div>
</div>
))
.add('Multiple sticky nodes', () => (
<div>
<div
className={m.pa96}
style={{
height: '300vh',
background: 'url(http://subtlepatterns2015.subtlepatterns' +
'.netdna-cdn.com/patterns/seigaiha.png)'
}}
>
<StickyNode>
<div className={[m.pa200, m.bgPrimary].join(' ')} />
</StickyNode>
<StickyNode className={m.mt200}>
<div className={[m.pa200, m.bgBlack].join(' ')} />
</StickyNode>
</div>
</div>
))
.add('Multiple sticky nodes that don’t overlay', () => (
<div>
<div
className={m.pa96}
style={{
height: '300vh',
background: 'url(http://subtlepatterns2015.subtlepatterns' +
'.netdna-cdn.com/patterns/seigaiha.png)'
}}
>
<StickyNode className="panelOne">
<div className={[m.pa200, m.bgPrimary].join(' ')} />
</StickyNode>
<StickyNode className={m.mt200} top=".panelOne">
<div className={[m.pa200, m.bgBlack].join(' ')} />
</StickyNode>
</div>
</div>
))
.add('Sticky bar with ’stick limit’', () => (
<div
className={m.pa96}
style={{
height: '150vh',
background: 'url(http://subtlepatterns2015.subtlepatterns' +
'.netdna-cdn.com/patterns/seigaiha.png)'
}}
>
<div style={{height: '500px'}} className={[m.bgWhite, 'boundary'].join(' ')}>
<StickyNode bottomBoundary=".boundary">
<div className={[m.pal, m.bgPrimary].join(' ')} />
</StickyNode>
</div>
</div>
));
|
Faw.Web.Client/src/routes/Quests/Index/components/CreateQuestDialog.js | Demenovich-A-J/Family-s-adventure-world | import React from 'react'
import {
Dialog,
DialogTitle,
DialogContent,
DialogActions,
Button
} from 'react-mdl'
import QuestForm from './QuestForm'
import './Quests.scss'
var form = null
export const CreateQuestDialog = (props) => {
function submitForm () {
form.dispatchEvent(new Event('submit'))
}
return (
<Dialog
open={props.openCreateQuestDialog}
onCancel={props.closeCreateQuestDialogHandler}
className='-create-quest-dialog'>
<DialogTitle>Create family quest</DialogTitle>
<DialogContent>
<QuestForm
onSubmit={props.submitQuestFormHandler}
getRef={(node) => { form = node }}
questInfoLoading={props.questInfoLoading}
isQuestInfoEdit={props.isQuestInfoEdit}
questFormSubmitting={props.questFormSubmitting}
questComplexity={props.questComplexity}
questInfoComplexity={props.questInfoComplexity}
/>
</DialogContent>
<DialogActions>
<Button type='button'
onClick={submitForm}
disabled={props.questFormSubmitting || props.questInfoLoading}>
{
props.isQuestInfoEdit
? (
'Edit'
)
: (
'Create'
)
}
</Button>
<Button type='button'
onClick={props.closeCreateQuestDialogHandler}
disabled={props.questFormSubmitting || props.questInfoLoading}>
Cancel
</Button>
</DialogActions>
</Dialog>
)
}
CreateQuestDialog.propTypes = {
closeCreateQuestDialogHandler: React.PropTypes.func.isRequired,
submitQuestFormHandler: React.PropTypes.func.isRequired,
openCreateQuestDialog: React.PropTypes.bool.isRequired,
questFormSubmitting: React.PropTypes.bool.isRequired,
questInfoLoading: React.PropTypes.bool.isRequired,
isQuestInfoEdit: React.PropTypes.bool.isRequired,
questComplexity: React.PropTypes.array.isRequired,
questInfoComplexity: React.PropTypes.string.isRequired
}
export default CreateQuestDialog
|
src/components/ArticlePreview.js | cfilby/react-mobx-realworld-example-app | import React from 'react';
import { Link } from 'react-router-dom';
import { inject, observer } from 'mobx-react';
const FAVORITED_CLASS = 'btn btn-sm btn-primary';
const NOT_FAVORITED_CLASS = 'btn btn-sm btn-outline-primary';
@inject('articlesStore')
@observer
export default class ArticlePreview extends React.Component {
handleClickFavorite = ev => {
ev.preventDefault();
const { articlesStore, article } = this.props;
if (article.favorited) {
articlesStore.unmakeFavorite(article.slug);
} else {
articlesStore.makeFavorite(article.slug);
}
};
render() {
const { article } = this.props;
const favoriteButtonClass = article.favorited ? FAVORITED_CLASS : NOT_FAVORITED_CLASS;
return (
<div className="article-preview">
<div className="article-meta">
<Link to={`/@${article.author.username}`}>
<img src={article.author.image} alt="" />
</Link>
<div className="info">
<Link className="author" to={`/@${article.author.username}`}>
{article.author.username}
</Link>
<span className="date">
{new Date(article.createdAt).toDateString()}
</span>
</div>
<div className="pull-xs-right">
<button className={favoriteButtonClass} onClick={this.handleClickFavorite}>
<i className="ion-heart" /> {article.favoritesCount}
</button>
</div>
</div>
<Link to={`/article/${article.slug}`} className="preview-link">
<h1>{article.title}</h1>
<p>{article.description}</p>
<span>Read more...</span>
<ul className="tag-list">
{
article.tagList.map(tag => {
return (
<li className="tag-default tag-pill tag-outline" key={tag}>
{tag}
</li>
)
})
}
</ul>
</Link>
</div>
);
}
}
|
src/pages/resume/components/education.js | dan9186/danielhess.me | import React from 'react'
import styled from 'styled-components'
import { faGraduationCap } from '@fortawesome/free-solid-svg-icons'
import { Date } from './date'
import { Icon, Subtitle } from '../../../components/typography'
import { Section } from '../../../components/grid'
export const Education = ({ education = [] }) => (
<Section>
<Subtitle>
<Icon icon={faGraduationCap} />
Education
</Subtitle>
<Content>
{education.map((ed) => (
<School>
<Date start={ed.start} end={ed.end} />
<Name>{ed.school}</Name>
<Location>{ed.location}</Location>
<Degrees>
{ed.degrees.map((d) => (
<li>{d}</li>
))}
</Degrees>
</School>
))}
</Content>
</Section>
)
const Content = styled.div`
display: flex;
flex-flow: column;
margin-top: ${({ theme }) => theme.spacing(2)};
margin-bottom: ${({ theme }) => theme.spacing(0)};
padding-left: ${({ theme }) => theme.spacing(2)};
`
const School = styled.div`
display: flex;
flex-flow: column;
flex: 1 0 50%;
margin-bottom: ${({ theme }) => theme.spacing(3)};
&:last-child {
margin-bottom: ${({ theme }) => theme.spacing(0)};
}
`
const Name = styled.h3`
margin-top: ${({ theme }) => theme.spacing(1)};
margin-bottom: ${({ theme }) => theme.spacing(0)};
color: ${({ theme }) => theme.palette.grey[300]};
font-size: 18px;
`
const Location = styled.div`
margin-top: ${({ theme }) => theme.spacing(1)};
font-size: 13px;
`
const Degrees = styled.ul`
margin-top: ${({ theme }) => theme.spacing(2)};
margin-bottom: ${({ theme }) => theme.spacing(0)};
padding-left: ${({ theme }) => theme.spacing(3)};
font-size: 16px;
font-weight: 500;
`
|
assets/javascripts/kitten/components/graphics/icons/stats-icon/index.js | KissKissBankBank/kitten | import React from 'react'
import PropTypes from 'prop-types'
export const StatsIcon = ({ color, title, ...props }) => (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
{title && <title>{title}</title>}
<path
d="M18 16v2H0v-2h18zM3 8v6H0V8h3zm5-8v14H5V0h3zm5 5v9h-3V5h3zm5 5v4h-3v-4h3z"
fill={color}
/>
</svg>
)
StatsIcon.propTypes = {
color: PropTypes.string,
title: PropTypes.string,
}
StatsIcon.defaultProps = {
color: '#222',
title: '',
}
|
test/test_helper.js | Rui-Carvalho/react-redux | import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
|
src/js/components/Grid/stories/NColumn.js | grommet/grommet | import React from 'react';
import { Box, Grid } from 'grommet';
export const NColumnGrid = () => (
// Uncomment <Grommet> lines when using outside of storybook
// <Grommet theme={...}>
<Grid
columns={{
count: 6,
size: 'auto',
}}
gap="small"
>
<Box background="brand">Item 1</Box>
<Box background="brand">Item 2</Box>
<Box background="brand">Item 3</Box>
<Box background="brand">Item 4</Box>
<Box background="brand">Item 5</Box>
<Box background="brand">Item 6</Box>
</Grid>
// </Grommet>
);
NColumnGrid.storyName = 'N-column layout';
NColumnGrid.args = {
full: true,
};
export default {
title: 'Layout/Grid/N-column layout',
};
|
src/svg-icons/navigation-arrow-drop-right.js | jacklam718/react-svg-iconx | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../SvgIcon';
let NavigationArrowDropRight = (props) => (
<SvgIcon {...props}>
<path d="M9.5,7l5,5l-5,5V7z" />
</SvgIcon>
);
NavigationArrowDropRight = pure(NavigationArrowDropRight);
NavigationArrowDropRight.displayName = 'NavigationArrowDropRight';
NavigationArrowDropRight.muiName = 'SvgIcon';
export default NavigationArrowDropRight;
|
src/upgrade/UpgradePage.js | qingweibinary/binary-next-gen | import React from 'react';
import MobilePage from '../containers/MobilePage';
import UpgradeContainer from './UpgradeContainer';
export default (props) => (
<MobilePage toolbarShown={false}>
<UpgradeContainer {...props} />
</MobilePage>
);
|
src/examples/AdvancedCounter/View/React.js | steos/elmar.js | import React from 'react'
import {Action} from '../Model'
export default (signal, model) => (
<div>
<button onClick={signal(Action.Decrement)}>-</button>
<div>{model}</div>
<button onClick={signal(Action.Increment)}>+</button>
</div>
)
|
test/integration/image-component/default/pages/invalid-placeholder-blur-static.js | zeit/next.js | import React from 'react'
import Image from 'next/image'
import testBMP from '../public/test.bmp'
const Page = () => {
return (
<div>
<Image
id="invalid-placeholder-blur-static"
src={testBMP}
placeholder="blur"
/>
</div>
)
}
export default Page
|
app/javascript/mastodon/features/ui/components/column_header.js | res-ac/mstdn.res.ac | import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class ColumnHeader extends React.PureComponent {
static propTypes = {
icon: PropTypes.string,
type: PropTypes.string,
active: PropTypes.bool,
onClick: PropTypes.func,
columnHeaderId: PropTypes.string,
};
handleClick = () => {
this.props.onClick();
}
render () {
const { icon, type, active, columnHeaderId } = this.props;
let iconElement = '';
if (icon) {
iconElement = <i className={`fa fa-fw fa-${icon} column-header__icon`} />;
}
return (
<h1 className={classNames('column-header', { active })} id={columnHeaderId || null}>
<button onClick={this.handleClick}>
{iconElement}
{type}
</button>
</h1>
);
}
}
|
app/javascript/mastodon/features/compose/index.js | lindwurm/mastodon | import React from 'react';
import ComposeFormContainer from './containers/compose_form_container';
import NavigationContainer from './containers/navigation_container';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { mountCompose, unmountCompose } from '../../actions/compose';
import { Link } from 'react-router-dom';
import { injectIntl, defineMessages } from 'react-intl';
import SearchContainer from './containers/search_container';
import Motion from '../ui/util/optional_motion';
import spring from 'react-motion/lib/spring';
import SearchResultsContainer from './containers/search_results_container';
import { changeComposing } from '../../actions/compose';
import { openModal } from 'mastodon/actions/modal';
import elephantUIPlane from '../../../images/elephant_ui_plane.svg';
import { mascot } from '../../initial_state';
import Icon from 'mastodon/components/icon';
import { logOut } from 'mastodon/utils/log_out';
const messages = defineMessages({
start: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
compose: { id: 'navigation_bar.compose', defaultMessage: 'Compose new toot' },
logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' },
logoutConfirm: { id: 'confirmations.logout.confirm', defaultMessage: 'Log out' },
});
const mapStateToProps = (state, ownProps) => ({
columns: state.getIn(['settings', 'columns']),
showSearch: ownProps.multiColumn ? state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']) : ownProps.isSearchPage,
});
export default @connect(mapStateToProps)
@injectIntl
class Compose extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
columns: ImmutablePropTypes.list.isRequired,
multiColumn: PropTypes.bool,
showSearch: PropTypes.bool,
isSearchPage: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
componentDidMount () {
const { isSearchPage } = this.props;
if (!isSearchPage) {
this.props.dispatch(mountCompose());
}
}
componentWillUnmount () {
const { isSearchPage } = this.props;
if (!isSearchPage) {
this.props.dispatch(unmountCompose());
}
}
handleLogoutClick = e => {
const { dispatch, intl } = this.props;
e.preventDefault();
e.stopPropagation();
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.logoutMessage),
confirm: intl.formatMessage(messages.logoutConfirm),
closeWhenConfirm: false,
onConfirm: () => logOut(),
}));
return false;
}
onFocus = () => {
this.props.dispatch(changeComposing(true));
}
onBlur = () => {
this.props.dispatch(changeComposing(false));
}
render () {
const { multiColumn, showSearch, isSearchPage, intl } = this.props;
let header = '';
if (multiColumn) {
const { columns } = this.props;
header = (
<nav className='drawer__header'>
<Link to='/getting-started' className='drawer__tab' title={intl.formatMessage(messages.start)} aria-label={intl.formatMessage(messages.start)}><Icon id='bars' fixedWidth /></Link>
{!columns.some(column => column.get('id') === 'HOME') && (
<Link to='/home' className='drawer__tab' title={intl.formatMessage(messages.home_timeline)} aria-label={intl.formatMessage(messages.home_timeline)}><Icon id='home' fixedWidth /></Link>
)}
{!columns.some(column => column.get('id') === 'NOTIFICATIONS') && (
<Link to='/notifications' className='drawer__tab' title={intl.formatMessage(messages.notifications)} aria-label={intl.formatMessage(messages.notifications)}><Icon id='bell' fixedWidth /></Link>
)}
{!columns.some(column => column.get('id') === 'COMMUNITY') && (
<Link to='/public/local' className='drawer__tab' title={intl.formatMessage(messages.community)} aria-label={intl.formatMessage(messages.community)}><Icon id='users' fixedWidth /></Link>
)}
{!columns.some(column => column.get('id') === 'PUBLIC') && (
<Link to='/public' className='drawer__tab' title={intl.formatMessage(messages.public)} aria-label={intl.formatMessage(messages.public)}><Icon id='globe' fixedWidth /></Link>
)}
<a href='/settings/preferences' className='drawer__tab' title={intl.formatMessage(messages.preferences)} aria-label={intl.formatMessage(messages.preferences)}><Icon id='cog' fixedWidth /></a>
<a href='/auth/sign_out' className='drawer__tab' title={intl.formatMessage(messages.logout)} aria-label={intl.formatMessage(messages.logout)} onClick={this.handleLogoutClick}><Icon id='sign-out' fixedWidth /></a>
</nav>
);
}
return (
<div className='drawer' role='region' aria-label={intl.formatMessage(messages.compose)}>
{header}
{(multiColumn || isSearchPage) && <SearchContainer /> }
<div className='drawer__pager'>
{!isSearchPage && <div className='drawer__inner' onFocus={this.onFocus}>
<NavigationContainer onClose={this.onBlur} />
<ComposeFormContainer />
<div className='drawer__inner__mastodon'>
<img alt='' draggable='false' src={mascot || elephantUIPlane} />
</div>
</div>}
<Motion defaultStyle={{ x: isSearchPage ? 0 : -100 }} style={{ x: spring(showSearch || isSearchPage ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
{({ x }) => (
<div className='drawer__inner darker' style={{ transform: `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>
<SearchResultsContainer />
</div>
)}
</Motion>
</div>
</div>
);
}
}
|
src/modules/rightActive/index.js | skydaya/react-sell | /**
* Created by dllo on 17/8/26.
*/
import React from 'react'
import ReactDOM from 'react-dom'
import App from './app'
ReactDOM.render(
<App />,
document.getElementById('rightactive')
)
|
src/components/Pagination/Pagination.js | bodguy/bodguy.github.io | // @flow strict
import React from 'react';
import classNames from 'classnames/bind';
import { Link } from 'gatsby';
import { PAGINATION } from '../../constants';
import styles from './Pagination.module.scss';
type Props = {
prevPagePath: string,
nextPagePath: string,
hasNextPage: boolean,
hasPrevPage: boolean
};
const cx = classNames.bind(styles);
const Pagination = ({
prevPagePath,
nextPagePath,
hasNextPage,
hasPrevPage
}: Props) => {
const prevClassName = cx({
'pagination__prev-link': true,
'pagination__prev-link--disable': !hasPrevPage
});
const nextClassName = cx({
'pagination__next-link': true,
'pagination__next-link--disable': !hasNextPage
});
return (
<div className={styles['pagination']}>
<div className={styles['pagination__prev']}>
<Link rel="prev" to={hasPrevPage ? prevPagePath : '/'} className={prevClassName}>{PAGINATION.PREV_PAGE}</Link>
</div>
<div className={styles['pagination__next']}>
<Link rel="next" to={hasNextPage ? nextPagePath : '/'} className={nextClassName}>{PAGINATION.NEXT_PAGE}</Link>
</div>
</div>
);
};
export default Pagination;
|
assets/jqwidgets/demos/react/app/chart/columnseriewithconditionalcolors/app.js | juannelisalde/holter | import React from 'react';
import ReactDOM from 'react-dom';
import JqxChart from '../../../jqwidgets-react/react_jqxchart.js';
class App extends React.Component {
render() {
let source =
{
datatype: 'csv',
datafields: [
{ name: 'Quarter' },
{ name: 'Change' }
],
url: '../sampledata/us_gdp_2008-2013.csv'
};
let dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: (xhr, status, error) => { alert('Error loading "' + source.url + '" : ' + error); } });
let padding = { left: 10, top: 5, right: 10, bottom: 5 };
let titlePadding = { left: 50, top: 0, right: 0, bottom: 10 };
let xAxis =
{
dataField: 'Quarter',
unitInterval: 1,
textRotationAngle: -75,
formatFunction: (value, itemIndex, serie, group) => {
return value;
},
valuesOnTicks: false
};
let seriesGroups =
[
{
type: 'column',
valueAxis:
{
description: 'Percentage Change',
formatFunction: (value) => {
return value + '%';
},
maxValue: 10,
minValue: -10,
unitInterval: 2
},
series:
[
{
dataField: 'Change',
displayText: 'Change',
toolTipFormatFunction: (value, itemIndex, serie, group, categoryValue, categoryAxis) => {
return '<DIV style="text-align:left";><b>Year-Quarter: </b>' + categoryValue
+ '<br /><b>GDP Change:</b> ' + value + ' %</DIV>'
},
// Modify this function to return the desired colors.
// jqxChart will call the function for each data point.
// Sequential points that have the same color will be
// grouped automatically in a line segment
colorFunction: (value, itemIndex, serie, group) => {
return (value < 0) ? '#CC1133' : '#55CC55';
}
}
]
}
];
return (
<JqxChart style={{ width: 850, height: 500 }}
title={'U.S. GDP Percentage Change'} description={'(source: Bureau of Economic Analysis)'}
showLegend={false} enableAnimations={true} padding={padding} borderLineWidth={1}
titlePadding={titlePadding} source={dataAdapter} xAxis={xAxis} showBorderLine={true}
colorScheme={'scheme05'} seriesGroups={seriesGroups}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
src/components/core/loading_spinner/loading_spinner.js | kyleaclark/ballcruncher | /* Credit https://github.com/lukehaas/css-loaders for spinner css */
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import styled, { keyframes } from 'styled-components';
const SpinnerKeyframes = keyframes`
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
`;
const Spinner = styled.div`
&,
&:before,
&:after {
background: #404040;
-webkit-animation: ${SpinnerKeyframes} 1s infinite ease-in-out;
animation: ${SpinnerKeyframes} 1s infinite ease-in-out;
width: 1em;
height: 4em;
}
& {
color: #404040;
text-indent: -9999em;
margin: 88px auto;
position: relative;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
&:before,
&:after {
position: absolute;
top: 0;
content: '';
}
&:before {
left: -1.5em;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
&:after {
left: 1.5em;
}
`;
class LoadingSpinner extends React.Component {
displayName: 'LoadingSpinner'
constructor(props) {
super(props);
}
render() {
return (
<Spinner>loading...</Spinner>
);
}
}
export default LoadingSpinner;
|
app/modules/layout/components/Logotype/index.js | anton-drobot/frontend-starter | import React from 'react';
import { observer, inject } from 'mobx-react';
import { URL_PROVIDER } from 'framework/Providers/types';
import { bem, mix } from 'app/libs/bem';
import { HOME_PAGE } from 'app/routes';
import Link from 'app/modules/core/components/Link';
import Icon from 'app/modules/core/components/Icon';
const b = bem('Logotype');
function Logotype(props) {
const {
router,
className,
...restProps
} = props;
const URL = this.app.make(URL_PROVIDER);
const icon = (<Icon glyph="logotype" className={b('image')} />);
let content = icon;
if (!router.match(HOME_PAGE)) {
const link = (new URL).makeApp(HOME_PAGE);
content = (<Link href={link} className={b('link')}>{icon}</Link>);
}
return (
<div {...restProps} className={mix(b(), className)}>{content}</div>
);
}
export default inject('router')(observer(Logotype));
|
app/index.js | riccardopiola/LeagueFlash | import React from 'react';
import ReactDOM from 'react-dom';
import Root from './Root';
// render to the DOM
// ReactDOM.render(<Root />, document.getElementById('root'));
ReactDOM.render(<Root />, document.getElementById('root'));
|
source/components/textBlock.react.js | argaskins/ThinkReact-Jenkins | import React from 'react';
import Row from 'react-bootstrap/lib/Row';
const style ={
color: 'green'
}
const blueStyle ={
color:'blue',
fontSize:".8em",
fontStyle:"italic"
}
const textBlock = (date, text, user) => (
<div>
<h3>{user}</h3>
<div style={style}>{text}</div>
<span style={blueStyle}>{date}</span>
</div>
);
export default textBlock;
|
js/components/sideBar/index.js | d3ming/kronos |
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Content, Text, ListItem } from 'native-base';
import { Actions } from 'react-native-router-flux';
import { closeDrawer } from '../../actions/drawer';
import { setIndex } from '../../actions/list';
import styles from './style';
class SideBar extends Component {
static propTypes = {
// setIndex: React.PropTypes.func,
closeDrawer: React.PropTypes.func,
navigateTo: React.PropTypes.func,
}
navigateTo(route) {
this.props.navigateTo(route, 'home');
}
render() {
return (
<Content style={styles.sidebar} >
<ListItem button onPress={() => { Actions.home(); this.props.closeDrawer(); }} >
<Text>Home</Text>
</ListItem>
<ListItem button onPress={() => { Actions.blankPage(); this.props.closeDrawer(); }} >
<Text>Blank Page</Text>
</ListItem>
</Content>
);
}
}
function bindAction(dispatch) {
return {
closeDrawer: () => dispatch(closeDrawer()),
setIndex: index => dispatch(setIndex(index)),
};
}
export default connect(null, bindAction)(SideBar);
|
packages/core/admin/admin/src/content-manager/components/DynamicZone/components/AddComponentButton/index.js | wistityhq/strapi | /**
*
* AddComponentButton
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import PlusCircle from '@strapi/icons/PlusCircle';
import { BaseButton } from '@strapi/design-system/BaseButton';
import { Box } from '@strapi/design-system/Box';
import { Flex } from '@strapi/design-system/Flex';
import { Typography } from '@strapi/design-system/Typography';
import { getTrad } from '../../../../utils';
const StyledAddIcon = styled(PlusCircle)`
transform: ${({ $isOpen }) => ($isOpen ? 'rotate(45deg)' : 'rotate(0deg)')};
> circle {
fill: ${({ theme, $hasError }) =>
$hasError ? theme.colors.danger200 : theme.colors.neutral150};
}
> path {
fill: ${({ theme, $hasError }) =>
$hasError ? theme.colors.danger600 : theme.colors.neutral600};
}
`;
const StyledButton = styled(BaseButton)`
border-radius: 26px;
border-color: ${({ theme }) => theme.colors.neutral150};
background: ${({ theme }) => theme.colors.neutral0};
padding-top: ${({ theme }) => theme.spaces[3]};
padding-right: ${({ theme }) => theme.spaces[4]};
padding-bottom: ${({ theme }) => theme.spaces[3]};
padding-left: ${({ theme }) => theme.spaces[4]};
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
svg {
height: ${({ theme }) => theme.spaces[6]};
width: ${({ theme }) => theme.spaces[6]};
> path {
fill: ${({ theme }) => theme.colors.neutral600};
}
}
&:hover {
color: ${({ theme }) => theme.colors.primary600} !important;
${Typography} {
color: ${({ theme }) => theme.colors.primary600} !important;
}
${StyledAddIcon} {
> circle {
fill: ${({ theme }) => theme.colors.primary600};
}
> path {
fill: ${({ theme }) => theme.colors.neutral100};
}
}
}
&:active {
${Typography} {
color: ${({ theme }) => theme.colors.primary600};
}
${StyledAddIcon} {
> circle {
fill: ${({ theme }) => theme.colors.primary600};
}
> path {
fill: ${({ theme }) => theme.colors.neutral100};
}
}
}
`;
const BoxFullHeight = styled(Box)`
height: 100%;
`;
const AddComponentButton = ({
hasError,
hasMaxError,
hasMinError,
isDisabled,
isOpen,
label,
missingComponentNumber,
name,
onClick,
}) => {
const { formatMessage } = useIntl();
const addLabel = formatMessage(
{
id: getTrad('components.DynamicZone.add-component'),
defaultMessage: 'Add a component to {componentName}',
},
{ componentName: label || name }
);
const closeLabel = formatMessage({ id: 'app.utils.close-label', defaultMessage: 'Close' });
let buttonLabel = isOpen ? closeLabel : addLabel;
if (hasMaxError && !isOpen) {
buttonLabel = formatMessage({
id: 'components.Input.error.validation.max',
defaultMessage: 'The value is too high.',
});
}
if (hasMinError && !isOpen) {
buttonLabel = formatMessage(
{
id: getTrad(`components.DynamicZone.missing-components`),
defaultMessage:
'There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}',
},
{ number: missingComponentNumber }
);
}
return (
<>
<Flex justifyContent="center">
<Box style={{ cursor: isDisabled ? 'not-allowed' : 'pointer' }}>
<StyledButton type="button" onClick={onClick} disabled={isDisabled} hasError={hasError}>
<Flex>
<BoxFullHeight aria-hidden paddingRight={2}>
<StyledAddIcon $isOpen={isOpen} $hasError={hasError && !isOpen} />
</BoxFullHeight>
<Typography
variant="pi"
fontWeight="bold"
textColor={hasError && !isOpen ? 'danger600' : 'neutral500'}
>
{buttonLabel}
</Typography>
</Flex>
</StyledButton>
</Box>
</Flex>
</>
);
};
AddComponentButton.defaultProps = {
label: '',
missingComponentNumber: 0,
};
AddComponentButton.propTypes = {
label: PropTypes.string,
hasError: PropTypes.bool.isRequired,
hasMaxError: PropTypes.bool.isRequired,
hasMinError: PropTypes.bool.isRequired,
isDisabled: PropTypes.bool.isRequired,
isOpen: PropTypes.bool.isRequired,
missingComponentNumber: PropTypes.number,
name: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
};
export default AddComponentButton;
|
src/components/ModalPanel.js | webcerebrium/ec-react15-lib | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import styled from 'styled-components';
const ContainerOuterStyle = styled.div`
overflow-y: scroll;
height: 100%;
display: flex;
align-items: flex-start;
justify-content: center;
`;
const ContainerInnerStyle = styled.div`
background-color: #fff;
padding: 0;
margin: 15px;
box-shadow: 0px 0px 10px #999;
max-width: 790px;
border-radius: 5px;
z-index: 1;
width: 100%;
`;
const Arr = styled.div`
padding: 20px;
`;
const Modal = styled.div`
position: fixed;
width: 100%;
height: 100%;
top: 0;
z-index: 0;
background-color: #000;
opacity: 0.8;
@media(min-width: 700px) {
right: 17px;
}
`;
class ModalPanel extends Component {
modalPanel = null;
componentDidMount() {
/* eslint-disable no-undef */
this.modalPanel = document.createElement('div');
this.modalPanel.setAttribute(
'style', 'position: fixed; height: 100%; left: 0; top: 0; width: 100%; z-index: 9999;'
);
document.body.appendChild(this.modalPanel);
document.documentElement.style.overflow = 'hidden';
this._render();
/* eslint-enable no-undef */
}
componentDidUpdate() {
this._render();
}
componentWillUnmount() {
ReactDOM.unmountComponentAtNode(this.modalPanel);
/* eslint-disable no-undef */
document.body.removeChild(this.modalPanel);
document.documentElement.style.overflow = 'auto';
/* eslint-enable no-undef */
}
_render() {
ReactDOM.render((
<ContainerOuterStyle
className={this.props.containerOuterClassName}
style={this.props.outerStyle ? this.props.outerStyle : {}}
>
<ContainerInnerStyle
className={this.props.containerInnerClassName}
style={this.props.innerStyle ? this.props.innerStyle : {}}
>
<Arr className={this.props.className} >{this.props.children}</Arr>
</ContainerInnerStyle>
<Modal
onMouseDown={this.props.onClick}
className={this.props.modalClassName}
style={this.props.modalStyle ? this.props.modalStyle : {}}
/>
</ContainerOuterStyle>
), this.modalPanel);
}
render() {
return <noscript />;
}
}
export default ModalPanel;
|
src/components/Demo/Demo.js | askd/animakit | import React from 'react';
import PropTypes from 'prop-types';
import styles from './Demo.css';
const Demo = (props) => {
const hasText = !!props.text;
return (
<div
className = { styles.root }
>
{ hasText && <p className = { styles.text }>{ props.text }</p> }
<div className = { styles.content }>
{ props.children }
</div>
</div>
);
};
Demo.propTypes = {
text: PropTypes.any,
children: PropTypes.any,
};
export default Demo;
|
src/client/components/LikeCounterWidget/LikeCounterWidget.js | vidaaudrey/trippian | //not in use
import log from '../../log'
import React from 'react'
import classnames from 'classnames'
import {
COLOR_LIGHT_BLACK, SPACING_XSMALL
}
from '../../utils/styleGuide'
import {
IconWidget
}
from '../../components/index'
const LikeCounter = ({
count, isActive, activeColor, handleLikes
}) => ( < a className = {
classnames({
'LikeCounter': true,
'LikeCounter--active': isActive
})
}
style = {
{
color: isActive ? activeColor : COLOR_LIGHT_BLACK
}
}
onClick = {
handleLikes
} >
<div>
<span style={{marginRight: SPACING_XSMALL, display: 'inline-block'}}>
<IconWidget name='thumbs-up' />
</span>
<span>{count} likes</span>
</div> < /a>
)
LikeCounter.propTypes = {
activeColor: React.PropTypes.string,
count: React.PropTypes.number.isRequired,
handleLikes: React.PropTypes.func,
isActive: React.PropTypes.bool
}
LikeCounter.displayName = 'LikeCounter'
export default LikeCounter
|
app/components/Transactions/RecentTransactions.js | soosgit/vessel | // @flow
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Button, Divider, Grid, Header, Segment, Statistic, Table } from 'semantic-ui-react';
export default class RecentTransactions extends Component {
render() {
const transactions = this.props.transactions;
const header = (
<Table.Row>
<Table.Header>
Test
</Table.Header>
</Table.Row>
);
const items = [];
transactions.forEach((tx) => {
items.push(
<Table.Row>
<Table.Cell>{tx.type}</Table.Cell>
<Table.Cell>{tx.amount.sbd}</Table.Cell>
<Table.Cell>{tx.amount.vest}</Table.Cell>
<Table.Cell>{tx.amount.steem}</Table.Cell>
</Table.Row>
);
console.log(tx);
});
// console.log(this.props)
return (
<Segment textAlign="left" attached>
<Header>
Recent Transactions
</Header>
<Table
unstackable
children={items}
headerRow={header}
/>
</Segment>
);
}
}
|
src/svg-icons/maps/directions-bike.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsDirectionsBike = (props) => (
<SvgIcon {...props}>
<path d="M15.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM5 12c-2.8 0-5 2.2-5 5s2.2 5 5 5 5-2.2 5-5-2.2-5-5-5zm0 8.5c-1.9 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5 3.5 1.6 3.5 3.5-1.6 3.5-3.5 3.5zm5.8-10l2.4-2.4.8.8c1.3 1.3 3 2.1 5.1 2.1V9c-1.5 0-2.7-.6-3.6-1.5l-1.9-1.9c-.5-.4-1-.6-1.6-.6s-1.1.2-1.4.6L7.8 8.4c-.4.4-.6.9-.6 1.4 0 .6.2 1.1.6 1.4L11 14v5h2v-6.2l-2.2-2.3zM19 12c-2.8 0-5 2.2-5 5s2.2 5 5 5 5-2.2 5-5-2.2-5-5-5zm0 8.5c-1.9 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5 3.5 1.6 3.5 3.5-1.6 3.5-3.5 3.5z"/>
</SvgIcon>
);
MapsDirectionsBike = pure(MapsDirectionsBike);
MapsDirectionsBike.displayName = 'MapsDirectionsBike';
MapsDirectionsBike.muiName = 'SvgIcon';
export default MapsDirectionsBike;
|
generators/react/static/src/Components/Home.js | ecliptic/ship-yard | // @flow
import React from 'react'
export default function Home () {
return <div>Hello world!</div>
}
|
assets/jqwidgets/demos/react/app/navbar/righttoleftlayout/app.js | juannelisalde/holter | import React from 'react';
import ReactDOM from 'react-dom';
import JqxNavBar from '../../../jqwidgets-react/react_jqxnavbar.js';
class App extends React.Component {
render() {
return (
<JqxNavBar height={40} selectedItem={0} rtl={true}>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</JqxNavBar>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
client/src/components/setup-workflow/index.js | safv12/trello-metrics | 'use strict';
import React, { Component } from 'react';
import { DragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import BoardList from './boards_list';
import ListConfiguration from './lists_configuration';
import MetricsControllers from './metrics_controllers';
class SetupWorkflow extends Component {
constructor(props) {
super(props);
this.state = {
boards: [],
openLists: [],
doneLists: [],
ignoreLists: [],
inprogressLists: [],
selectedBoard: null,
onTimeMetrics: null
};
this.baseurl = 'http://localhost:9001/v1';
this.getBoards(this.baseurl);
}
getBoards(base) {
var _this = this;
$('#loading').css('display', 'block');
$.ajax({
type: 'POST',
dataType: 'json',
url: base + '/trello/me/boards',
success: function(boards) {
$('#loading').css('display', 'none');
_this.setState({
boards: boards,
selectedBoard: boards[0]
});
_this.getLists(boards[0], base);
}
});
}
moveList(movement) {
var destination = this.state[movement.param.destination];
destination.push(movement.param.list);
var list = movement.param.list;
var source = this.state[list.source];
var itemIndex = source.indexOf(list);
source.splice(itemIndex, 1);
this.setState({
[destination]: destination
});
this.setState({
[list.source]: source
});
}
getLists(board, base) {
$('#loading').css('display', 'block');
var _this = this;
$.ajax({
type: 'GET',
dataType: 'json',
contentType: 'application/json',
url: base + `/trello/boards/${board.id}/lists`,
success: function(lists) {
$('#loading').css('display', 'none');
_this.setState({
ignoreLists: lists,
inprogressLists: [],
openLists: [],
doneLists: []
});
}
});
}
getTimeMetrics() {
var onTimeMetrics = this.props.onTimeMetrics;
$('#loading').css('display', 'block');
$.ajax({
type: 'POST',
data: JSON.stringify({
open: this.state.openLists,
inprogress: this.state.inprogressLists,
done: this.state.doneLists
}),
contentType: 'application/json',
dataType:'json',
url: this.baseurl + '/metrics/',
success: function(res) {
$('#loading').css('display', 'none');
onTimeMetrics(res);
}
});
}
render() {
return (
<div className="col-md-12">
<div className="col-md-2 padding-s">
<BoardList
onBoardSelect={selectedBoard => this.setState({selectedBoard})}
selectedBoard={ this.state.selectedBoard }
onBoardClick={id => this.getLists({id}, this.baseurl)}
boards={this.state.boards} />
</div>
<ListConfiguration
onMoveList={ param => this.moveList({param}) }
ignoreLists={this.state.ignoreLists}
openLists={this.state.openLists}
inprogressLists={this.state.inprogressLists}
doneLists={this.state.doneLists} />
<div className="col-md-2 padding-s">
<MetricsControllers
getTimeMetrics={ param => this.getTimeMetrics() }
saveMetrics={ this.props.saveMetrics() }
timeMetrics={ this.props.timeMetrics }/>
</div>
</div>
);
}
}
export default DragDropContext(HTML5Backend)(SetupWorkflow);
|
src/components/Main.js | k1sul1/wp-plugin.pro | import React, { Component } from 'react';
import { Switch, Route } from 'react-router-dom';
import Article from './Article';
import style from './Main.module.styl';
const About = () => (
<h1>About</h1>
);
class Main extends Component {
render() {
return (
<main className={style.Main} id={this.props.id}>
<Switch>
<Route exact path="/" component={(props) => <Article {...props} file="/docs/About/index.md" />} />
<Route path="/about" component={About} />
<Route path="/docs/:folder*/:filename" component={(props) => <Article {...props} />} />
<Route path="/docs/:folder" component={(props) => <Article {...props} />} />
</Switch>
</main>
);
}
}
export default Main;
|
pkg/ui/src/containers/Cluster.js | matt-deboer/kuill | import React from 'react'
import { connect } from 'react-redux'
import { requestResources } from '../state/actions/resources'
import ClusterPage from '../components/cluster/ClusterPage'
import { withRouter } from 'react-router-dom'
import LoadingSpinner from '../components/LoadingSpinner'
const mapStateToProps = function(store) {
return {
resources: store.resources.resources,
filterNames: store.resources.filterNames,
fetching: store.requests.fetching,
user: store.session.user,
}
}
const mapDispatchToProps = function(dispatch, ownProps) {
return {
requestResources: function() {
dispatch(requestResources())
},
}
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps) (
class Cluster extends React.Component {
componentDidUpdate = (prevProps, prevState) => {
if (!!this.props.user && !prevProps.user) {
this.props.requestResources()
}
}
componentWillMount = () => {
if (!!this.props.user) {
this.props.requestResources()
}
}
render() {
return (<div>
<LoadingSpinner loading={Object.keys(this.props.fetching).length > 0} />
<ClusterPage {...this.props} />
</div>)
}
}))
|
src/components/UIShell/SideNavSwitcher.js | carbon-design-system/carbon-components-react | /**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import ChevronDown20 from '@carbon/icons-react/lib/chevron--down/20';
import { settings } from 'carbon-components';
import cx from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
const { prefix } = settings;
const SideNavSwitcher = React.forwardRef(function SideNavSwitcher(props, ref) {
const { className: customClassName, labelText, onChange, options } = props;
const className = cx(`${prefix}--side-nav__switcher`, customClassName);
// Note for usage around `onBlur`: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
return (
<div className={className}>
<label
htmlFor="side-nav-switcher"
className={`${prefix}--assistive-text`}>
{labelText}
</label>
<select
id="carbon-side-nav-switcher"
className={`${prefix}--side-nav__select`}
defaultValue=""
onBlur={onChange}
onChange={onChange}
ref={ref}>
<option
className={`${prefix}--side-nav__option`}
disabled
hidden
value="">
{labelText}
</option>
{options.map(option => (
<option
key={option}
className={`${prefix}--side-nav__option`}
value={option}>
{option}
</option>
))}
</select>
<div className={`${prefix}--side-nav__switcher-chevron`}>
<ChevronDown20 />
</div>
</div>
);
});
SideNavSwitcher.propTypes = {
/**
* Provide an optional class to be applied to the containing node
*/
className: PropTypes.string,
/**
* Provide the label for the switcher. This will be the firt visible option
* when someone views this control
*/
labelText: PropTypes.string.isRequired,
/**
* Provide a callback function that is called whenever the switcher value is
* updated
*/
onChange: PropTypes.func,
/**
* Provide an array of options to be rendered in the switcher as an
* `<option>`. The text value will be what is displayed to the user and is set
* as the `value` prop for each `<option>`.
*/
options: PropTypes.arrayOf(PropTypes.string).isRequired,
};
export default SideNavSwitcher;
|
src/parser/rogue/assassination/CHANGELOG.js | ronaldpereira/WoWAnalyzer | import React from 'react';
import { tsabo, Cloake, Zerotorescue, Gebuz, Aelexe, Vetyst } from 'CONTRIBUTORS';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import { change, date } from 'common/changelog';
export default [
change(date(2020, 5, 26), <>Fixed garrote early refresh tracking.</>, [Vetyst]),
change(date(2019, 4, 22), <>Early dot refresh tracking</>, [tsabo]),
change(date(2018, 11, 20), <>Added Bleed snapshot tracking and support for <SpellLink id={SPELLS.NIGHTSTALKER_TALENT.id} />, <SpellLink id={SPELLS.SUBTERFUGE_TALENT.id} /> and <SpellLink id={SPELLS.MASTER_ASSASSIN_TALENT.id} />.</>, [Gebuz]),
change(date(2018, 11, 15), <>Fixed <SpellLink id={SPELLS.ARCANE_TORRENT_ENERGY.id} /> GCD.</>, [Aelexe]),
change(date(2018, 11, 13), <>Fixed cooldown tracking for <SpellLink id={SPELLS.MARKED_FOR_DEATH_TALENT.id} /> when targets die with the debuff.</>, [Aelexe]),
change(date(2018, 11, 11), <>Added suggestion for Sharpened Blades stack wastage.</>, [Aelexe]),
change(date(2018, 11, 9), <>Added <SpellLink id={SPELLS.MASTER_POISONER_TALENT.id} /> module and updated <SpellLink id={SPELLS.ELABORATE_PLANNING_TALENT.id} /> and <SpellLink id={SPELLS.BLINDSIDE_TALENT.id} /> modules.</>, [Gebuz]),
change(date(2018, 11, 5), 'Updated resource tracking to display percent instead of per minute, and added spenders to the energy tab.', [Gebuz]),
change(date(2018, 11, 5), 'Added Checklist.', [Gebuz]),
change(date(2018, 11, 4), <>Added suggestions for <SpellLink id={SPELLS.GARROTE.id} /> and <SpellLink id={SPELLS.RUPTURE.id} /> uptime.</>, [Gebuz]),
change(date(2018, 11, 4), 'Added cooldowns tab', [Gebuz]),
change(date(2018, 11, 4), 'Updated timeline with buffs & debuffs and added missing GCDs', [Gebuz]),
change(date(2018, 8, 2), 'Added natural energy regen.', [tsabo]),
change(date(2018, 7, 27), <>Added <SpellLink id={SPELLS.ELABORATE_PLANNING_TALENT.id} /> support.</>, [Cloake]),
change(date(2018, 7, 9), 'Added blindside support.', [tsabo]),
change(date(2018, 7, 7), 'Update for prepatch.', [tsabo]),
change(date(2018, 6, 24), 'Update all abilities to new BFA values.', [Zerotorescue]),
];
|
src/svg-icons/image/wb-cloudy.js | kittyjumbalaya/material-components-web | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageWbCloudy = (props) => (
<SvgIcon {...props}>
<path d="M19.36 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.64-4.96z"/>
</SvgIcon>
);
ImageWbCloudy = pure(ImageWbCloudy);
ImageWbCloudy.displayName = 'ImageWbCloudy';
ImageWbCloudy.muiName = 'SvgIcon';
export default ImageWbCloudy;
|
AirFront/point/activation.js | sunshinezxf/Airburg | import React from 'react';
import {
Button,
List,
WhiteSpace,
WingBlank,
InputItem,
Toast,
} from 'antd-mobile';
import {createForm} from 'rc-form';
var seconds=60;
const SendButton = React.createClass({
getInitialState(){
return {
disabled: false,
text: '获取验证码'
}
},
componentDidUpdate(){
if (this.state.disabled) {
if (this.state.text == '获取验证码') {
this.timer = setInterval(()=> {
seconds--;
this.setState({text: `重新发送(${seconds})`});
}, 1000);
} else if (seconds == 0) {
seconds=60;
clearInterval(this.timer);
this.setState({
disabled: false,
text: '获取验证码'
});
}
}
},
render(){
return <Button disabled={this.state.disabled} size="small"
onClick={()=> {
var able=this.props.sendMsg();
this.setState({disabled: able})
}}>{this.state.text}
</Button>
}
})
var Activation = React.createClass({
submit(){
var form = this.props.form;
form.validateFields((error, value) => {
console.log(error, value);
if(!error){
var phone=value.phone;
phone=phone.replace(/\s/g, "");
value.phone=phone;
console.log(value);
alert('activate account');
window.location.hash='/pointCenter';
}
// form.submit(()=> {
// alert('submit form call back')
// })
});
},
sendMsg(){
var phone = this.props.form.getFieldProps('phone').value;
if (phone){
phone = phone.replace(/\s/g, "");
if(/^1[3|4|5|7|8]\d{9}$/.test(phone)){
//send msg
Toast.info('验证码已发送',2);
return true;
}else {
Toast.info('请输入正确的手机号码',2);
return false;
}
}else{
Toast.info('请输入正确的手机号码',2);
return true;
}
// this.props.form.submit(this.callback);
},
render(){
const {getFieldProps} = this.props.form;
return (
<div>
<div className="bigTile">
账号激活
<p>欢迎加入</p>
</div>
<WhiteSpace size="lg"/>
<List>
<InputItem
{...getFieldProps('phone')}
type="phone" clear
extra={ <SendButton sendMsg={this.sendMsg}/>}
placeholder="请输入手机号码"
>手机号码</InputItem>
<InputItem
{...getFieldProps('code')}
type="number" clear
maxLength={6}
placeholder="请输入验证码"
>验证码</InputItem>
</List>
<WhiteSpace size="lg"/>
<WingBlank>
<Button type="primary" className='wred'
disabled={!(this.props.form.getFieldProps('phone').value &&
this.props.form.getFieldProps('code').value)}
onClick={this.submit}>确认激活
</Button>
</WingBlank>
</div>
);
}
});
Activation = createForm()(Activation);
export default Activation; |
src/svg-icons/maps/map.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsMap = (props) => (
<SvgIcon {...props}>
<path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z"/>
</SvgIcon>
);
MapsMap = pure(MapsMap);
MapsMap.displayName = 'MapsMap';
MapsMap.muiName = 'SvgIcon';
export default MapsMap;
|
src/routes.js | jimkim/vainglory | import React from 'react';
import { Route, IndexRoute } from 'react-router';
import App from './containers/app';
import Jumbotron from './containers/jumbotron';
import AllMatches from './containers/allMatches'
import Player from './containers/player';
import SingleHero from './containers/singleHero';
import ErrorPage from './containers/errorPage';
export default (
<Route path="/" component={App}>
<IndexRoute component={Jumbotron}></IndexRoute>
<Route path="matches" component={AllMatches}></Route>
<Route path="player/:player" component={Player}></Route>
<Route path="error" component={ErrorPage}></Route>
<Route path="hero/:name" component={SingleHero}></Route>
</Route>
)
|
addons/themes/read-only/layouts/Single.js | rendact/rendact | import $ from 'jquery'
import React from 'react';
import gql from 'graphql-tag';
import {graphql} from 'react-apollo';
import moment from 'moment';
import {Link} from 'react-router';
import scrollToElement from 'scroll-to-element';
import NavPanel from '../includes/NavPanel';
let Home = React.createClass({
componentDidMount(){
require('../assets/css/main.css')
},
render(){
let {
postData,
theConfig,
data,
thePagination,
loadDone,
isHome
} = this.props
return (
<div>
<div>
<section id="header">
<header>
<span className="image avatar">
<Link to="/">
<img src={ require('images/logo-128.png') } alt="" />
</Link>
</span>
<h1 id="logo">MENU</h1>
</header>
<nav id="nav">
{this.props.theMenu()}
</nav>
<footer>
<ul className="icons">
<li><a href="#" className="icon fa-twitter"><span className="label">Twitter</span></a></li>
<li><a href="#" className="icon fa-facebook"><span className="label">Facebook</span></a></li>
<li><a href="#" className="icon fa-instagram"><span className="label">Instagram</span></a></li>
<li><a href="#" className="icon fa-github"><span className="label">Github</span></a></li>
<li><a href="#" className="icon fa-envelope"><span className="label">Email</span></a></li>
</ul>
</footer>
</section>
<div id="wrapper">
<div id="main">
{postData &&
<section id="one">
<div className="container">
<header className="major">
<h2>{postData.title && postData.title}</h2>
</header>
<div className="features">
<article className="image">
<img src={postData.imageFeatured ? postData.imageFeatured.blobUrl: require('images/logo-128.png') } alt="" />
</article>
<article>
<p dangerouslySetInnerHTML={{__html: postData.content ? postData.content:""}} />
</article>
</div>
</div>
</section>
}
{this.props.footerWidgets &&
this.props.footerWidgets.map((fw, idx) =>
<section><div className="container">{fw}</div></section>)}
</div>
<section id="footer">
<div className="container">
<ul className="copyright">
<li>© Rendact Team. All rights reserved.</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</div>
</section>
</div>
</div>
<NavPanel {...this.props}/>
</div>
)
}
});
export default Home; |
app/components/Budget.js | jpsierens/budget | // @flow
import React from 'react';
import { Link } from 'react-router';
import handleUpdateItem from '../helpers/handleUpdateItem';
import withListDragAndDrop from '../helpers/withListDragAndDrop';
type Props = {
_id: string,
index: number,
name: string,
note: string,
completed: boolean,
updatedAt: string,
onRemove: () => void,
updateBudget: () => void,
isDragging: boolean,
};
const Budget = (props: Props) => {
const {
_id,
index,
name,
note,
completed,
updatedAt,
onRemove,
updateBudget,
isDragging
} = props;
const time = new Date(updatedAt);
return (
<div className={`budget ${ completed ? 'done' : ''} ${isDragging ? 'dragging' : ''}`}>
<Link to={`/${index}`}>
<h2> { name } </h2>
<p> { note} </p>
<div>
<button
className="btn-status"
onClick={(e) => {
e.preventDefault();
handleUpdateItem(updateBudget, _id, {
completed: !completed
});
}}>
Status: { completed ? 'Done' : 'Not Done'}
</button>
<span className="datetime">
Last Updated: { time.toLocaleString() }
</span>
</div>
<span
className="close-budget"
onClick={(e) => {
e.preventDefault();
onRemove(_id);
}}>
X
</span>
</Link>
</div>
);
};
export default withListDragAndDrop(Budget);
|
modules/dreamview/frontend/src/app.js | xiaoxq/apollo | import * as ReactDOM from 'react-dom';
import React from 'react';
import { Provider } from 'mobx-react';
import 'styles/main.scss';
import STORE from 'store';
import Dreamview from 'components/Dreamview';
ReactDOM.render(
<Provider store={STORE}>
<Dreamview />
</Provider>,
document.getElementById('root'),
);
|
BasicPractice/index.android.js | DajuanM/DHReactNativeDemo | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class HelloWorld extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('HelloWorld', () => HelloWorld);
|
Neos.Media.Browser/packages/neos-media-browser/src/Variants/Original.js | neos/neos-development-collection | import React from 'react';
export default class Original extends React.PureComponent {
render() {
const {persistenceIdentifier, previewUri, width, height} = this.props;
return (
<ul className="neos-thumbnails">
<li className="asset" data-asset-identifier={persistenceIdentifier}
data-local-asset-identifier={persistenceIdentifier}>
<a>
<div className="neos-img-container">
<img src={previewUri} className="" alt=""/>
</div>
</a>
<div className="neos-img-label">
<span className="neos-caption asset-label">
<span className="neos-badge neos-pull-right">
<pre>W: {width}px <br/>H: {height}px</pre>
</span>
</span>
</div>
</li>
</ul>
);
}
}
|
app/src/components/Users/views/form.js | jeremyhon/sia-challenge | import React from 'react';
import { Form, Control } from 'react-redux-form';
export default ({ error, handleChange, handleUpdate, handleSubmit }) => (
<Form model="user" onUpdate={form => handleUpdate(form)} onChange={values => handleChange(values)} onSubmit={values => handleSubmit(values)}>
{error && <div className="alert alert-danger">{error.message}</div>}
<div className="panel-body">
<div className="row">
<div className="form-group">
<label className="control-label">Username</label>
<Control.text model=".username" placeholder="Username" autoFocus />
</div>
</div>
</div>
<div className="panel-body">
<div className="row">
<div className="form-group">
<label className="control-label">Username</label>
<Control.text model=".password" type="password" placeholder="Password" />
</div>
</div>
</div>
<div className="panel-body">
<div className="row">
<div className="form-group">
<label className="control-label">Display Namme</label>
<Control.text model=".displayName" type="text" placeholder="Display Name" />
</div>
</div>
</div>
<div className="panel-body">
<div className="row">
<div className="form-group">
<label className="control-label">Role</label>
<Control.select model=".role" id="user.role">
<option value="admin">Admin</option>
<option value="commander">Commander</option>
</Control.select>
</div>
</div>
</div>
<button className="btn btn-primary btn-lg btn-block" type="submit">
Sign In
</button>
</Form>
);
|
admin/client/Signin/index.js | giovanniRodighiero/cms | /**
* The signin page, it renders a page with a username and password input form.
*
* This is decoupled from the main app (in the "App/" folder) because we inject
* lots of data into the other screens (like the lists that exist) that we don't
* want to have injected here, so this is a completely separate route and template.
*/
import qs from 'qs';
import React from 'react';
import ReactDOM from 'react-dom';
import Signin from './Signin';
const params = qs.parse(window.location.search.replace(/^\?/, ''));
const from = typeof params.from === 'string' && params.from.charAt(0) === '/'
? params.from : undefined;
ReactDOM.render(
<Signin
brand={Keystone.brand}
from={from}
logo={Keystone.logo}
user={Keystone.user}
userCanAccessKeystone={Keystone.userCanAccessKeystone}
/>,
document.getElementById('signin-view')
);
|
client/scripts/components/user/manual/manual-event/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 {ManualEventEntry} from '../manual-event-entry';
import {ManualEventRelations} from '../manual-event-relations';
import {Instructions} from '../../instructions';
import {DISCLOSURE_STEP} from '../../../../../../coi-constants';
export class ManualEvent extends React.Component {
constructor() {
super();
this.isDeclarationOpen = this.isDeclarationOpen.bind(this);
}
shouldComponentUpdate() { return true; }
isDeclarationOpen(id) {
if (this.props.declarationStates && this.props.declarationStates.manual) {
const state = this.props.declarationStates.manual[id];
return (state && state.open);
}
return false;
}
render() {
const {config} = this.context.configState;
let screen;
if (this.props.step === 3) {
screen = (
<ManualEventRelations
disclosure={this.props.disclosure}
entities={this.props.entities}
declarations={this.props.declarations}
open={this.isDeclarationOpen(this.props.disclosure.id)}
/>
);
}
else {
screen = (
<ManualEventEntry
step={this.props.step}
disclosure={this.props.disclosure}
selected={this.props.type}
/>
);
}
const instructionText = config.general.instructions[DISCLOSURE_STEP.MANUAL];
const contentState = config.general.richTextInstructions ?
config.general.richTextInstructions[DISCLOSURE_STEP.MANUAL] :
undefined;
const instructions = (
<Instructions
text={instructionText}
collapsed={!this.props.instructionsShowing[DISCLOSURE_STEP.MANUAL]}
contentState={contentState}
/>
);
return (
<div className={`${styles.container} ${this.props.className}`}>
{instructions}
<div className={styles.content}>
{screen}
</div>
</div>
);
}
}
ManualEvent.contextTypes = {
configState: React.PropTypes.object
};
|
docs-ui/components/mutedBox.stories.js | beeftornado/sentry | import React from 'react';
import {withInfo} from '@storybook/addon-info';
import MutedBox from 'app/components/mutedBox';
export default {
title: 'Features/Issues/Muted Box',
};
export const Default = withInfo('Default')(() => <MutedBox statusDetails={{}} />);
Default.story = {
name: 'default',
};
export const IgnoreUntil = withInfo('Ignore until timestamp')(() => (
<MutedBox statusDetails={{ignoreUntil: '2017-06-21T19:45:10Z'}} />
));
IgnoreUntil.story = {
name: 'ignoreUntil',
};
export const IgnoreCount = withInfo('Ignore until "count"')(() => (
<MutedBox statusDetails={{ignoreCount: 100}} />
));
IgnoreCount.story = {
name: 'ignoreCount',
};
export const IgnoreCountWIgnoreWindow = withInfo('Ignore count with window')(() => (
<MutedBox statusDetails={{ignoreCount: 100, ignoreWindow: 1}} />
));
IgnoreCountWIgnoreWindow.story = {
name: 'ignoreCount w/ ignoreWindow',
};
export const IgnoreUserCount = withInfo('Ignore user count')(() => (
<MutedBox statusDetails={{ignoreUserCount: 100}} />
));
IgnoreUserCount.story = {
name: 'ignoreUserCount',
};
export const IgnoreUserCountWIgnoreUserWindow = withInfo(
'Ignore user count with window'
)(() => <MutedBox statusDetails={{ignoreUserCount: 100, ignoreUserWindow: 1}} />);
IgnoreUserCountWIgnoreUserWindow.story = {
name: 'ignoreUserCount w/ ignoreUserWindow',
};
|
test/helpers/shallowRenderHelper.js | sunyuis/galler-by-reat | /**
* Function to get the shallow output for a given component
* As we are using phantom.js, we also need to include the fn.proto.bind shim!
*
* @see http://simonsmith.io/unit-testing-react-components-without-a-dom/
* @author somonsmith
*/
import React from 'react';
import TestUtils from 'react-addons-test-utils';
/**
* Get the shallow rendered component
*
* @param {Object} component The component to return the output for
* @param {Object} props [optional] The components properties
* @param {Mixed} ...children [optional] List of children
* @return {Object} Shallow rendered output
*/
export default function createComponent(component, props = {}, ...children) {
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(React.createElement(component, props, children.length > 1 ? children : children[0]));
return shallowRenderer.getRenderOutput();
}
|
app/components/footer/footer.js | Rorchackh/Sink | import React from 'react';
export default class Footer extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
static defaultProps = {
version: process.env.npm_package_version
}
render() {
let env = ""
if (global.appConfig.env.isDevelopment()) {
env = ' - Development Mode'
}
return (
<footer className="toolbar toolbar-footer">
<h1 className="title">Sink {this.props.version} {env}</h1>
</footer>
)
}
} |
src/components/streams/StreamOptions.js | streamr-app/streamr-web | import React from 'react'
import cx from 'classnames'
import { Button } from '../buttons'
import AudioRecordingStreamContainer from '../recording/AudioRecordingStreamContainer'
export default (props) => (
<form className={cx('stream-options', { pristine: props.pristine })} onSubmit={props.handleSubmit(props.onSubmit)}>
<AudioRecordingStreamContainer />
{getRecordingControls(props)}
</form>
)
function getRecordingControls ({
recording,
submitting,
valid,
recordingStopped,
onStopRecording,
canStopRecording,
recordingError
}) {
if (recording) {
return (
<div className='record-control-buttons'>
<a
href='#'
className={cx('button -record', { disabled: !canStopRecording || recordingStopped })}
onClick={(e) => canStopRecording && !recordingStopped && onStopRecording(e)}>
{
recordingStopped
? 'Finishing up...'
: 'Finish Recording'
}
</a>
</div>
)
} else {
return (
<div className='record-control-buttons'>
<Button className='-record' disabled={recordingError || submitting || !valid}>Start Recording</Button>
</div>
)
}
}
|
app/client/js/components/User.js | kgunbin/react-sprint-planning | import React from 'react';
import { Row, Col } from 'react-bootstrap';
import classnames from 'classnames';
export default class User extends React.Component {
static propTypes = {
user: React.PropTypes.object,
vote: React.PropTypes.string,
showVotes: React.PropTypes.bool
}
renderVote = () => {
var ret;
if (this.props.vote) {
if (this.props.showVotes) {
ret = (<div>{this.props.vote}</div>);
} else {
ret = (<div className='hidden-vote'>!</div>);
}
} else {
ret = (<div className='no-vote'>?</div>);
}
return ret;
}
render() {
const className = {
'hidden-vote': this.props.vote && !this.props.showVotes,
'no-vote': !this.props.vote,
'current-user': this.props.me
};
return (
<Row className={classnames(className)}>
<Col md={4}>
<h5>{this.props.user.name}</h5>
</Col>
<Col md={1}>
{this.renderVote()}
</Col>
</Row>
);
}
}
|
src/components/TargetList.js | samkarp/murmuration | import React from 'react';
const TargetList = React.createClass({
render: function() {
console.log("PROPS IN TL");
console.log(this.props);
var target = this.props.targets.map(function(target, index){
return <TargetItem key={ index } targetId={ target }/>
});
return (
<div> Target List goes here:<br/>
{ target }
</div>
)
}
});
var TargetItem = React.createClass({
getInitialState:function(){
return{
data:[]
};
},
showResult: function(response) {
//console.log(response.hits.hits);
this.setState({
data: response.hits.hits
});
},
componentDidMount(){
this.getDataFromServer('http://localhost:9200/murmuration_target/_search?q=_id:' + this.props.targetId);
},
getDataFromServer:function(URL){
$.ajax({
type:"GET",
dataType:"json",
url:URL,
success: function(response) {
this.showResult(response);
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
}.bind(this)
});
},
render:function(){
var targetId = this.props.targetId;
var targetResult = this.state.data.map(function(result,index){
return <TargetResult key={index} target={ result._source } />
});
return(
<div>
{ targetResult }<br/>
</div>
);
}
});
var TargetResult = React.createClass({
render:function(){
var target = this.props.target;
return(
<div>
<strong>Name: </strong>{target.name}<br/>
<strong>Description: </strong>{target.description}<br/>
<strong>Location: </strong>{target.loc}<br/>
<strong>RegionId: </strong>{target.regionid}<br/>
</div>
);
}
});
export default TargetList; |
src/index.js | vojtechsoban/mortgage-calc | import { AppContainer } from 'react-hot-loader';
import React from 'react';
import ReactDOM from 'react-dom';
import Root from 'src/containers/Root';
import configureStore from 'src/store/configureStore';
import { initialState } from 'src/store/InitialState';
const rootElement = document.getElementById('root');
const store = configureStore(initialState);
ReactDOM.render(
<AppContainer>
<Root store={store} />
</AppContainer>,
rootElement
);
if (module.hot) {
module.hot.accept('./containers/Root', () => {
// If you use Webpack 2 in ES modules mode, you can
// use <App /> here rather than require() a <NextApp />.
const RootContainer = require('./containers/Root').default;
ReactDOM.render(
<AppContainer>
<RootContainer store={store} />
</AppContainer>,
rootElement
);
});
}
|
server/sonar-web/src/main/js/apps/background-tasks/header.js | abbeyj/sonarqube | import React from 'react';
export default React.createClass({
render() {
return (
<header className="page-header">
<h1 className="page-title">{window.t('background_tasks.page')}</h1>
<p className="page-description">{window.t('background_tasks.page.description')}</p>
</header>
);
}
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.