path
stringlengths 5
195
| repo_name
stringlengths 5
79
| content
stringlengths 25
1.01M
|
---|---|---|
src/routes/Login/components/Register.js | SHBailey/echo-mvp | import React from 'react'
import classes from './Register.scss'
export const Register = () => (
<div>
<form>
<div>
<label for="name"> User Name: </label>
<input type="text" placeholder="Pick a User Name"/>
</div>
<div>
<label for="mail">E-mail:</label>
<input type="email" id="mail" name="user_mail" />
</div>
<div className={classes.button}>
<button type="submit"> Register! </button>
</div>
</form>
</div>
)
export default Register |
src/svg-icons/image/looks.js | tan-jerene/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageLooks = (props) => (
<SvgIcon {...props}>
<path d="M12 10c-3.86 0-7 3.14-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.86-3.14-7-7-7zm0-4C5.93 6 1 10.93 1 17h2c0-4.96 4.04-9 9-9s9 4.04 9 9h2c0-6.07-4.93-11-11-11z"/>
</SvgIcon>
);
ImageLooks = pure(ImageLooks);
ImageLooks.displayName = 'ImageLooks';
ImageLooks.muiName = 'SvgIcon';
export default ImageLooks;
|
app/components/Dashboard/DashPie.js | mikeluz/flock | import React from 'react'
import {Link} from 'react-router'
import Chart from 'chart.js'
const countUserSubs = (subs) => {
let subsPerStatusArray = [0, 0, 0, 0];
subs.forEach(sub => {
if (sub.sub_status === "in process") {
subsPerStatusArray[0] += 1;
}
if (sub.sub_status === "accepted") {
subsPerStatusArray[1] += 1;
}
if (sub.sub_status === "rejected") {
subsPerStatusArray[2] += 1;
}
if (sub.sub_status === "withdrawn") {
subsPerStatusArray[3] += 1;
}
})
return subsPerStatusArray;
}
class DashPie extends React.Component {
constructor(props) {
super(props)
}
componentDidUpdate() {
if (this.props.userSubs.length > 0) {
let subStatusData = countUserSubs(this.props.userSubs);
let ctx = document.getElementById("myChart").getContext('2d');
let chart = new Chart(ctx, {
type: 'pie',
data: {
labels: ["In Process", "Accepted", "Rejected", "Withdrawn"],
datasets: [{
label: `${this.props.user.name}`,
backgroundColor: ['blue', 'green', 'red', 'black'],
borderColor: 'rgb(255, 99, 132)',
data: countUserSubs(this.props.userSubs),
}]
},
options: {}
});
}
}
render() {
let areThereSubs = this.props.userSubs ? this.props.userSubs.length : 0;
return (
<div id="pie">
<h2 id="centerMe">Your Submissions</h2>
<div>{
areThereSubs ?
<canvas id="myChart"></canvas> : <h4 id="centerMe">You have no submissions!</h4>
}</div>
</div>
)}
}
import {connect} from 'react-redux'
export default connect(
({ auth, userSubs, closingCalls }) => ({
user: auth,
userSubs: userSubs
}), {}
)(DashPie) |
src/svg-icons/image/photo-size-select-small.js | xmityaz/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;
|
client/containers/App.js | danekszy/tttoe | import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import * as actionCreators from '../actions/actionCreators';
import Main from '../components/Main';
function mapStateToProps(state) {
return {
players: state.players,
status: state.status,
checkboard: state.checkboard
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(actionCreators, dispatch);
}
const App = connect(mapStateToProps, mapDispatchToProps)(Main);
export default App;
|
voting-web-views/src/js/Components/Navbar/Navbar.js | joaolrpaulo/eletronic-voting-system | import React from 'react';
import NavbarTemplate from './Navbar.rt';
export default class Navbar extends React.Component {}
Navbar.prototype.render = NavbarTemplate;
|
src/components/video_list.js | Robert-Zandberg/MovieFinder | /**
* Created by Robert on 16-5-2017.
*/
import React from 'react';
import VideoListItem from './video_list_item';
const VideoList = (props) => {
const videoItems = props.videos.map(( video) => {
return (
<VideoListItem
onVideoSelect={props.onVideoSelect}
key={video.etag}
video={video} />
);
});
return (
<ul className="col-md-4 list-group">
{videoItems}
</ul>
);
};
export default VideoList; |
assets/src/containers/Applications/Frame/AppModal.js | mmillet/mock-server | /**
* Created by zhengguo.chen on 16/11/29.
*/
import React from 'react';
import classnames from 'classnames'
import STYLE from './style.less';
import brace from 'brace';
import AceEditor from 'react-ace';
import 'brace/mode/javascript';
import 'brace/theme/github';
import {APP_INITIAL_DATA} from 'constants/config';
import {Modal, Tabs, Form, Input, Switch, Select} from "antd";
const Option = Select.Option;
const FormItem = Form.Item;
const TabPane = Tabs.TabPane;
const getInitialAppData = currentGroupId => ({...APP_INITIAL_DATA, group: currentGroupId});
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 14 },
};
const AppModal = React.createClass({
getInitialState() {
return {
currentTab: '1',
// initial app data
appData: {},
error: {}
}
},
onAppChange(field, value) {
this.setState({
appData: Object.assign({}, this.state.appData, {[field]: value})
});
},
onChangeTab(currentTab) {
this.setState({currentTab});
},
onHandleOk() {
if(this.onValidate()) {
this.props.onOk(this.state.appData);
}
},
onValidate() {
var {appData} = this.state;
var isValid = true;
var error = {};
if(appData.group === undefined) {
error.group = 'Group should not be null.';
isValid = false;
}
if(appData.name == '') {
error.name = 'Name should not be null.';
isValid = false;
}
if(appData.apiPrefix == '') {
error.apiPrefix = 'Api Prefix should not be null.';
isValid = false;
}
this.setState({error});
return isValid;
},
componentWillReceiveProps(nextProps) {
var {currentGroupId} = nextProps;
if(nextProps.visible) {
this.setState({
currentTab: '1',
appData: nextProps.appData || getInitialAppData(currentGroupId),
error: {}
});
}
},
render() {
var {visible, onOk, onCancel, groupList, currentGroupId} = this.props;
var {currentTab, appData, error} = this.state;
return (
<Modal title={appData.id ? 'Edit Application' : 'Add Application'} visible={visible}
onOk={this.onHandleOk} onCancel={onCancel}
okText="OK"
cancelText="Cancel"
>
<Tabs activeKey={currentTab} onChange={this.onChangeTab}>
<TabPane tab="Setting" key="1">
<Form horizontal>
<FormItem
{...formItemLayout}
validateStatus={error.group ? 'error': ''}
help={error.group ? error.group: ''}
label="Group"
>
<Select
showSearch
placeholder="Select a group"
optionFilterProp="children"
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
value={`${appData.group || currentGroupId}`}
onChange={v => this.onAppChange('group', v)}
>
{
groupList.map(group => {
return <Option value={`${group.id}`} key={`${group.id}`}>{group.name}</Option>
})
}
</Select>
</FormItem>
<FormItem
{...formItemLayout}
validateStatus={error.name ? 'error': ''}
help={error.name ? error.name: ''}
label="Name"
>
<Input ref="name" value={appData.name} onChange={e => this.onAppChange('name', e.target.value)}/>
</FormItem>
<FormItem
{...formItemLayout}
label="Description"
>
<Input value={appData.description} type="textarea" autosize={{ minRows: 2, maxRows: 6 }} onChange={e => this.onAppChange('description', e.target.value)}/>
</FormItem>
<FormItem
{...formItemLayout}
validateStatus={error.apiPrefix ? 'error': ''}
help={error.apiPrefix ? error.apiPrefix: ''}
label="API Prefix"
>
<Input value={appData.apiPrefix} onChange={e => this.onAppChange('apiPrefix', e.target.value)}/>
</FormItem>
<FormItem
{...formItemLayout}
label="Enabled"
>
<Switch checked={appData.enabled} onChange={v => this.onAppChange('enabled', v)}/>
</FormItem>
</Form>
</TabPane>
<TabPane tab="Response Template" key="2">
<AceEditor
value={typeof appData.responseTemplate === 'string' ? appData.responseTemplate : ''}
mode="javascript"
theme="github"
name="response_template_ace"
tabSize={2}
style={{height: 257}}
editorProps={{$blockScrolling: true}}
onChange={v => this.onAppChange('responseTemplate', v)}
/>
</TabPane>
</Tabs>
</Modal>
);
}
});
export default AppModal;
|
test/server_side-test.js | gianu/react-flexbox-layout | import React from 'react';
import ReactDOMServer from 'react-dom/server';
import { createCustomClasses } from '../lib';
function createApp({ VLayout, VLayoutItem, HLayout, HLayoutItem }) {
return class App extends React.Component {
render() {
return (
<VLayout>
<VLayoutItem>
Top
</VLayoutItem>
<VLayoutItem flexGrow />
<VLayoutItem height={50}>
<div>
Bottom
<HLayout>
<div>
Left
</div>
<HLayoutItem flexGrow>
Right
</HLayoutItem>
</HLayout>
</div>
</VLayoutItem>
</VLayout>
);
}
};
}
console.log('RENDERING FLEXBOX LAYOUT:');
console.log(ReactDOMServer.renderToString(React.createElement(
createApp(createCustomClasses())
)));
console.log('\n');
console.log('RENDERING SIMULATED FLEXBOX LAYOUT (IE9):');
console.log(ReactDOMServer.renderToString(React.createElement(
createApp(createCustomClasses({ simulateFlexbox: true }))
)));
|
docs/src/app/components/pages/components/DropDownMenu/Page.js | rscnt/material-ui | import React from 'react';
import Title from 'react-title-component';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';
import dropDownMenuReadmeText from './README';
import DropDownMenuSimpleExample from './ExampleSimple';
import dropDownMenuSimpleExampleCode from '!raw!./ExampleSimple';
import DropDownMenuOpenImmediateExample from './ExampleOpenImmediate';
import dropDownMenuOpenImmediateExampleCode from '!raw!./ExampleOpenImmediate';
import DropDownMenuLongMenuExample from './ExampleLongMenu';
import dropDownMenuLongMenuExampleCode from '!raw!./ExampleLongMenu';
import DropDownMenuLabeledExample from './ExampleLabeled';
import dropDownMenuLabeledExampleCode from '!raw!./ExampleLabeled';
import dropDownMenuCode from '!raw!material-ui/lib/DropDownMenu/DropDownMenu';
const descriptions = {
simple: '`DropDownMenu` is implemented as a controlled component, with the current selection set through the ' +
'`value` property.',
openImmediate: 'With `openImmediately` property set, the menu will open on mount.',
long: 'With the `maxHeight` property set, the menu will be scrollable if the number of items causes the height ' +
'to exceed this limit.',
label: 'With a `label` applied to each `MenuItem`, `DropDownMenu` displays a complementary description ' +
'of the selected item.',
};
const DropDownMenuPage = () => (
<div>
<Title render={(previousTitle) => `Drop Down Menu - ${previousTitle}`} />
<MarkdownElement text={dropDownMenuReadmeText} />
<CodeExample
title="Simple example"
description={descriptions.simple}
code={dropDownMenuSimpleExampleCode}
>
<DropDownMenuSimpleExample />
</CodeExample>
<CodeExample
title="Open Immediate example"
description={descriptions.openImmediate}
code={dropDownMenuOpenImmediateExampleCode}
>
<DropDownMenuOpenImmediateExample />
</CodeExample>
<CodeExample
title="Long example"
description={descriptions.long}
code={dropDownMenuLongMenuExampleCode}
>
<DropDownMenuLongMenuExample />
</CodeExample>
<CodeExample
title="Label example"
description={descriptions.label}
code={dropDownMenuLabeledExampleCode}
>
<DropDownMenuLabeledExample />
</CodeExample>
<PropTypeDescription code={dropDownMenuCode} />
</div>
);
export default DropDownMenuPage;
|
src/components/Menu/index.js | kimshako/portfolio.shako.net | import React from 'react'
import { Container } from '..'
import menus from '../../data/menus'
import './styles.css'
const Menu = ({ tag, onTagSelect }) => (
<div className="Menu">
<Container>
{menus.map((menu, i) => (
<div key={i} className={`item ${tag === menu.tag && 'selected'}`} onClick={e => {
e.preventDefault()
onTagSelect(menu.tag)
}}>
{menu.name}
</div>
))}
</Container>
</div>
)
export default Menu
|
docs/app/Examples/collections/Table/Variations/TableExampleCollapsing.js | mohammed88/Semantic-UI-React | import React from 'react'
import { Table } from 'semantic-ui-react'
const TableExampleCollapsing = () => {
return (
<Table collapsing>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Status</Table.HeaderCell>
<Table.HeaderCell>Notes</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>John</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jill</Table.Cell>
<Table.Cell>Denied</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
</Table.Body>
<Table.Footer>
<Table.Row>
<Table.HeaderCell>3 People</Table.HeaderCell>
<Table.HeaderCell>2 Approved</Table.HeaderCell>
<Table.HeaderCell />
</Table.Row>
</Table.Footer>
</Table>
)
}
export default TableExampleCollapsing
|
addons/storyshots/storyshots-core/stories/required_with_context/Button.stories.js | kadirahq/react-storybook | import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '@storybook/react/demo';
export default {
title: 'Button',
parameters: {
component: Button,
},
};
export const withText = () => <Button onClick={action('clicked')}>Hello Button</Button>;
export const withSomeEmoji = () => (
<Button onClick={action('clicked')}>
<span role="img" aria-label="so cool">
😀 😎 👍 💯
</span>
</Button>
);
withSomeEmoji.storyName = 'with some emoji';
|
test/plain-list/AutosuggestApp.js | moroshko/test-react-autosuggest | import React, { Component } from 'react';
import sinon from 'sinon';
import Autosuggest from '../../src/AutosuggestContainer';
import languages from './languages';
import { escapeRegexCharacters } from '../../demo/src/components/utils/utils.js';
import highlight from 'autosuggest-highlight';
function getMatchingLanguages(value) {
const escapedValue = escapeRegexCharacters(value.trim());
const regex = new RegExp('^' + escapedValue, 'i');
return languages.filter(language => regex.test(language.name));
}
let app = null;
export const getSuggestionValue = sinon.spy(suggestion => {
return suggestion.name;
});
export const renderSuggestion = sinon.spy((suggestion, { value, valueBeforeUpDown }) => {
const query = (valueBeforeUpDown || value).trim();
const matches = highlight.match(suggestion.name, query);
const parts = highlight.parse(suggestion.name, matches);
return parts.map((part, index) => {
return part.highlight ?
<strong key={index}>{part.text}</strong> :
<span key={index}>{part.text}</span>;
});
});
export const onChange = sinon.spy((event, { newValue, method }) => {
if (method === 'type') {
app.setState({
value: newValue,
suggestions: getMatchingLanguages(newValue)
});
} else {
app.setState({
value: newValue
});
}
});
export const shouldRenderSuggestions = sinon.spy(value => {
return value.trim().length > 0 && value[0] !== ' ';
});
export const onSuggestionSelected = sinon.spy((event, { suggestionValue }) => {
app.setState({
suggestions: getMatchingLanguages(suggestionValue)
});
});
export default class AutosuggestApp extends Component {
constructor() {
super();
app = this;
this.state = {
value: '',
suggestions: getMatchingLanguages('')
};
}
render() {
const { value, suggestions } = this.state;
const inputProps = {
id: 'my-awesome-autosuggest',
placeholder: 'Type a programming language',
type: 'search',
value,
onChange
};
return (
<Autosuggest suggestions={suggestions}
getSuggestionValue={getSuggestionValue}
renderSuggestion={renderSuggestion}
inputProps={inputProps}
shouldRenderSuggestions={shouldRenderSuggestions}
onSuggestionSelected={onSuggestionSelected} />
);
}
}
|
src/browser/intl/IntlPage.react.js | nikolalosic/este-app--assignment | import Component from 'react-pure-render/component';
import Helmet from 'react-helmet';
import Locales from './Locales.react';
import React from 'react';
import linksMessages from '../../common/app/linksMessages';
import {
FormattedDate,
FormattedMessage,
FormattedNumber,
FormattedRelative,
defineMessages
} from 'react-intl';
const messages = defineMessages({
h2: {
defaultMessage: 'react-intl demonstration',
id: 'intl.page.h2'
},
unreadCount: {
defaultMessage: `{unreadCount, plural,
one {message}
other {messages}
}`,
id: 'intl.page.unreadCount'
}
});
export default class IntlPage extends Component {
constructor() {
super();
this.componentRenderedAt = Date.now();
}
render() {
// To remember beloved −123 min. https://www.youtube.com/watch?v=VKOv1I8zKso
const unreadCount = 123;
return (
<div className="intl-page">
<FormattedMessage {...linksMessages.intl}>
{message => <Helmet title={message} />}
</FormattedMessage>
<h2>
<FormattedMessage {...messages.h2} />
</h2>
<Locales />
<p>
<FormattedDate
value={Date.now()}
day="numeric"
month="long"
year="numeric"
formatMatcher="basic" // while this bug remains in react-intl: https://github.com/andyearnshaw/Intl.js/issues/179
/>
</p>
<p>
<FormattedNumber value={unreadCount} /> {' '}
<FormattedMessage {...messages.unreadCount} values={{ unreadCount }} />
</p>
<p>
<FormattedRelative
initialNow={this.componentRenderedAt}
updateInterval={1000 * 1}
value={this.componentRenderedAt}
/>
</p>
</div>
);
}
}
|
ui/src/plugins/epl-dashboard/components/SystemOverview.js | mkacper/erlangpl | // @flow
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Row, Col, ListGroup, ListGroupItem } from 'react-bootstrap';
import Measure from 'react-measure';
import Chart from './SystemOverviewChart';
import './SystemOverview.css';
class SystemOverview extends Component {
state: { width: number };
constructor(props) {
super(props);
this.state = {
width: 0
};
}
render() {
const { info, overview } = this.props;
const mem = ['KB', 'MB', 'GB'];
const memory = mem.reduce(
(acc, a) => {
if (acc.v > 1000) {
return { v: acc.v / 1000, t: a };
} else {
return acc;
}
},
{ v: parseInt(info.memoryTotal, 10), t: 'B' }
);
const systemOverview = [
['Throughput', info.receive ? `${info.receive.count} msg` : undefined],
['Throughput', info.receive ? `${info.receive.sizes} B` : undefined],
['Processes', info.processCount],
['Spawns', info.spawn ? info.spawn.count : undefined],
['Exits', info.exit ? info.exit.count : undefined],
['Abnormal Exits', info.exit ? info.exit.abnormal : undefined],
[
'Memory',
info.memoryTotal ? `${memory.v.toFixed(2)} ${memory.t}` : undefined
]
];
const throughputData = overview.receive.map(a => ({
name: 'Throughput (msg)',
count: parseInt(a.count, 10)
}));
const memoryData = overview.memoryTotal.map(a => {
return {
name: 'Memory (MB)',
usage: Number((parseInt(a, 10) / 1000000).toFixed(2))
};
});
const processesData = overview.processCount.map(a => ({
name: 'Processes',
count: parseInt(a, 10)
}));
const maxProcesses = Math.max(...overview.processCount);
const dimensions = {
width: this.state.width - this.state.width / 10,
height: 210
};
return (
<Row className="SystemOverview">
<Col xs={4}>
<h5 className="SystemInfo-list-header">
Overview (last 5 sec)
</h5>
<ListGroup className="SystemInfo-list">
{systemOverview.map(([name, value], i) => (
<ListGroupItem key={i}>
<span>{name}</span>
<span className="value">{value || 'N/A'}</span>
</ListGroupItem>
))}
</ListGroup>
</Col>
<Measure
includeMargin={false}
onMeasure={({ width }) => this.setState({ width })}
>
<Col xs={8} className="charts">
<Chart
title="Memory usage"
height={dimensions.height}
width={dimensions.width}
data={memoryData}
color="#8FBF47"
dataKey="usage"
domain={['dataMin', 'dataMax']}
loaderText="Gathering memory usage data"
/>
<Chart
title="Processes"
height={dimensions.height}
width={dimensions.width}
data={processesData}
color="#227A50"
dataKey="count"
domain={[
`dataMin - ${Math.floor(maxProcesses / 5)}`,
`dataMax + ${Math.floor(maxProcesses / 5)}`
]}
loaderText="Gathering processes data"
/>
<Chart
title="Throughput"
height={dimensions.height}
width={dimensions.width}
data={throughputData}
color="#1F79B7"
dataKey="count"
loaderText="Gathering throughput data"
/>
</Col>
</Measure>
</Row>
);
}
}
export default connect(state => {
return {
info: state.eplDashboard.systemInfo,
overview: state.eplDashboard.systemOverview
};
}, {})(SystemOverview);
|
docs/public/static/examples/v35.0.0/magnetometer.js | exponent/exponent | import React from 'react';
import { Magnetometer } from 'expo-sensors';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
export default class MagnetometerSensor extends React.Component {
state = {
MagnetometerData: {},
};
componentDidMount() {
this._toggle();
}
componentWillUnmount() {
this._unsubscribe();
}
_toggle = () => {
if (this._subscription) {
this._unsubscribe();
} else {
this._subscribe();
}
};
_slow = () => {
Magnetometer.setUpdateInterval(1000);
};
_fast = () => {
Magnetometer.setUpdateInterval(16);
};
_subscribe = () => {
this._subscription = Magnetometer.addListener(result => {
this.setState({ MagnetometerData: result });
});
};
_unsubscribe = () => {
this._subscription && this._subscription.remove();
this._subscription = null;
};
render() {
let { x, y, z } = this.state.MagnetometerData;
return (
<View style={styles.sensor}>
<Text>Magnetometer:</Text>
<Text>
x: {round(x)} y: {round(y)} z: {round(z)}
</Text>
<View style={styles.buttonContainer}>
<TouchableOpacity onPress={this._toggle} style={styles.button}>
<Text>Toggle</Text>
</TouchableOpacity>
<TouchableOpacity onPress={this._slow} style={[styles.button, styles.middleButton]}>
<Text>Slow</Text>
</TouchableOpacity>
<TouchableOpacity onPress={this._fast} style={styles.button}>
<Text>Fast</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
function round(n) {
if (!n) {
return 0;
}
return Math.floor(n * 100) / 100;
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
buttonContainer: {
flexDirection: 'row',
alignItems: 'stretch',
marginTop: 15,
},
button: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#eee',
padding: 10,
},
middleButton: {
borderLeftWidth: 1,
borderRightWidth: 1,
borderColor: '#ccc',
},
sensor: {
marginTop: 15,
paddingHorizontal: 10,
},
});
|
src/containers/Intro.js | kdesterik/koendirkvanesterik.com | import React from 'react';
import { connect } from 'react-redux';
import Section from '../components/Section';
import Columns from '../components/Columns';
import Instruction from '../components/Instruction';
class Intro extends React.Component {
render() {
return (
<div className='intro'>
<Section>
<div className='spacer'></div>
{
this.props.intro.map(( data, index ) => {
return( <Columns key={ index } width={ 'half' } text={ data.content.rendered } /> );
})
}
<Instruction/>
</Section>
</div>
);
}
}
function mapStateToProps( state ){
return {
intro: state.intro
}
}
export default connect( mapStateToProps )( Intro ); |
autotuning/dashboard/src/helpers/ListItemLink.js | sassoftware/sas-viya-machine-learning | import React from 'react';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import Typography from '@material-ui/core/Typography';
import {Link} from 'react-router-dom';
const styles = {
textItem: {
color: 'white',
fontSize: '12pt',
},
};
class ListItemLink extends React.Component {
renderLink = (itemProps) => <Link to={this.props.to} {...itemProps} />;
debugger;
render() {
const {icon, primary} = this.props;
// debugger;
return (
<li>
<ListItem button component={this.renderLink}>
{(icon != null) ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText
disableTypography
primary={<Typography type="h6" style={styles.textItem}>{primary}</Typography>}
/>
</ListItem>
</li>
);
}
}
export default ListItemLink;
|
scripts/index.js | hugobessaa/rx-react-pinch | import React from 'react';
import App from './App';
React.render(<App />, document.getElementById('root'));
|
4.ferfer/theCatApi-examples-master/react/breed-selection/App.js | Surufel/Personal | import React, { Component } from 'react';
import axios from 'axios';
import './App.css';
axios.defaults.baseURL = 'https://api.thecatapi.com/v1';
axios.defaults.headers.common['x-api-key'] = 'DEMO-API-KEY';
class App extends Component {
async getBreeds() {
const res = await axios('/breeds');
return res.data;
}
async getCatsImagesByBreed(breed_id, amount) {
const res = await axios('/images/search?breed_ids='+breed_id + "&limit="+ amount);
console.table(res.data)
return res.data;
}
async loadBreedImages() {
console.log('Load Breed Images:', this.state.selected_breed)
let breed_images = await this.getCatsImagesByBreed(this.state.selected_breed, 5)
this.setState({ images: breed_images });
}
constructor(...args) {
super(...args);
this.state = {
images: [],
breeds: [],
selected_breed: 0
};
this.onBreedSelectChange = this.onBreedSelectChange.bind(this);
}
async onBreedSelectChange(e) {
console.log("Breed Selected. ID:",e.target.value)
await this.setState({selected_breed:e.target.value});
await this.loadBreedImages();
}
componentDidMount() {
if (this.state.breeds.length===0) {
(async () => {
try {
this.setState({breeds: await this.getBreeds()});
} catch (e) {
//...handle the error...
console.error(e)
}
})();
}
}
render() {
return (
<div>
<select value={this.state.selected_breed}
onChange={this.onBreedSelectChange}>
{this.state.breeds.map((breed) => <option key={breed.id} value={breed.id}>{breed.name}</option>)}
</select>
<div>
{this.state.images.map((image) => <img className="cat-image" alt="" src={image.url}></img>)}
</div>
</div>
);
}
}
export default App;
|
node_modules/[email protected]@antd/es/dropdown/dropdown-button.js | ligangwolai/blog | import _extends from 'babel-runtime/helpers/extends';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
}if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
}return t;
};
import React from 'react';
import Button from '../button';
import Icon from '../icon';
import Dropdown from './dropdown';
import classNames from 'classnames';
var ButtonGroup = Button.Group;
var DropdownButton = function (_React$Component) {
_inherits(DropdownButton, _React$Component);
function DropdownButton() {
_classCallCheck(this, DropdownButton);
return _possibleConstructorReturn(this, (DropdownButton.__proto__ || Object.getPrototypeOf(DropdownButton)).apply(this, arguments));
}
_createClass(DropdownButton, [{
key: 'render',
value: function render() {
var _a = this.props,
type = _a.type,
disabled = _a.disabled,
onClick = _a.onClick,
children = _a.children,
prefixCls = _a.prefixCls,
className = _a.className,
overlay = _a.overlay,
trigger = _a.trigger,
align = _a.align,
visible = _a.visible,
onVisibleChange = _a.onVisibleChange,
placement = _a.placement,
getPopupContainer = _a.getPopupContainer,
restProps = __rest(_a, ["type", "disabled", "onClick", "children", "prefixCls", "className", "overlay", "trigger", "align", "visible", "onVisibleChange", "placement", "getPopupContainer"]);
var dropdownProps = {
align: align,
overlay: overlay,
trigger: disabled ? [] : trigger,
onVisibleChange: onVisibleChange,
placement: placement,
getPopupContainer: getPopupContainer
};
if ('visible' in this.props) {
dropdownProps.visible = visible;
}
return React.createElement(
ButtonGroup,
_extends({}, restProps, { className: classNames(prefixCls, className) }),
React.createElement(
Button,
{ type: type, disabled: disabled, onClick: onClick },
children
),
React.createElement(
Dropdown,
dropdownProps,
React.createElement(
Button,
{ type: type, disabled: disabled },
React.createElement(Icon, { type: 'down' })
)
)
);
}
}]);
return DropdownButton;
}(React.Component);
export default DropdownButton;
DropdownButton.defaultProps = {
placement: 'bottomRight',
type: 'default',
prefixCls: 'ant-dropdown-button'
}; |
jenkins-design-language/src/js/components/material-ui/svg-icons/editor/wrap-text.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const EditorWrapText = (props) => (
<SvgIcon {...props}>
<path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/>
</SvgIcon>
);
EditorWrapText.displayName = 'EditorWrapText';
EditorWrapText.muiName = 'SvgIcon';
export default EditorWrapText;
|
src/components/tabBar/index.js | feralclaw/moe | import React, { Component } from 'react';
import TabBarItem from './item';
import './index.less';
class TabBar extends Component {
static get propTypes() {
return {
children: React.PropTypes.node
};
}
static get defaultProps() {
return {
children: null
};
}
constructor() {
super();
this.state = {
hidden: false
};
}
shouldComponentUpdate() {
return false;
}
render() {
return (
<div className="tab-bar">{this.props.children.map(item => item)}</div>
);
}
}
TabBar.Item = TabBarItem;
export default TabBar;
|
src/svg-icons/image/brightness-2.js | hwo411/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageBrightness2 = (props) => (
<SvgIcon {...props}>
<path d="M10 2c-1.82 0-3.53.5-5 1.35C7.99 5.08 10 8.3 10 12s-2.01 6.92-5 8.65C6.47 21.5 8.18 22 10 22c5.52 0 10-4.48 10-10S15.52 2 10 2z"/>
</SvgIcon>
);
ImageBrightness2 = pure(ImageBrightness2);
ImageBrightness2.displayName = 'ImageBrightness2';
ImageBrightness2.muiName = 'SvgIcon';
export default ImageBrightness2;
|
src/components/Event/Event.react.js | HackCWRU/HackCWRU-Website | import React from 'react';
import PropTypes from 'prop-types';
import styles from 'components/Event/Event.scss';
export default class Event extends React.Component {
render() {
return (
<div className={styles.event}>
<div className={styles.name}>
{this.props.name}
</div>
<div className={styles.whenAndWhere}>
{`${this.props.when} | ${this.props.where}`}
</div>
{this.props.description && <div className={styles.description}>
{this.props.description}
</div>}
</div>
);
}
}
Event.propTypes = {
name: PropTypes.string.isRequired,
when: PropTypes.string.isRequired,
where: PropTypes.string.isRequired,
description: PropTypes.string
};
|
examples/draft-0-10-0/tex/js/app.js | johnmpotter/draft-js | /**
* Copyright (c) 2013-present, Facebook, Inc. All rights reserved.
*
* This file provided by Facebook is for non-commercial testing and evaluation
* purposes only. Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
import 'babel/polyfill';
import TeXEditorExample from './components/TeXEditorExample';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<TeXEditorExample />,
document.getElementById('target'),
);
|
src/page/InputPage.js | jerryshew/react-uikits | import React, { Component } from 'react';
import {CN, TitleBlock} from '../util/tools';
import {NS, COLORS, SHAPE_SIZE} from '../constant';
import CodeView from './CodeView';
const makeInput = (cn='') => {
return <div className="field">
<input type="text" placeholder={cn ? cn : 'input...'} className={CN(`${cn} input`)}/>
</div>;
};
const actionInputs = () => {
let node = [];
for (var i = 0; i < SHAPE_SIZE.length; i++) {
node.push(<div className="field" key={`${SHAPE_SIZE[i]}-action-button`}>
<div className={CN(`${SHAPE_SIZE[i]} input`)}>
<input type="text" placeholder='input...'/>
<div className="action">
<button>button</button>
</div>
</div>
</div>);
}
return <div>{node}</div>;
};
export class InputPage extends Component {
render() {
return (
<div>
{TitleBlock('输入框')}
<ul>
<li>
<h4>默认输入框</h4>
<CodeView component={
makeInput()
}>
{`<input type="text" className="${NS} input"/>`}
</CodeView>
<br/>
<h4>直角输入框</h4>
<CodeView component={
makeInput('angled')
}>
{`<input type="text" className="${NS} angled input"/>`}
</CodeView>
<br/>
<h4>文本框</h4>
<CodeView component={
<textarea className={CN('input')} placeholder='type in something...'></textarea>
}>
{`<textarea className="${NS} input"></textarea>`}
</CodeView>
<br/>
<h4>输入异常输入框</h4>
<CodeView component={
makeInput('error')
}>
{`<div className="${NS} error input">
<input type="text" />
</div>`}
</CodeView>
<br/>
<h4>聚焦输入框</h4>
<CodeView component={
makeInput('focus')
}>
{`<div className="${NS} focus input">
<input type="text" />
</div>`}
</CodeView>
<br/>
<h4>圆角输入框</h4>
<CodeView component={
makeInput('round')
}>
{`<div className="${NS} round input">
<input type="text" />
</div>`}
</CodeView>
<br/>
<h4>圆角带图标输入框</h4>
<CodeView component={
<div className={CN('round input icon')}>
<input type="text" placeholder="search..."/>
<i className="icon">search</i>
</div>
}>
{`<div className="${NS} round input icon">
<input type="text" />
<i className="icon">search</i>
</div>`}
</CodeView>
<br/>
<h4>圆角带按钮标输入框</h4>
<CodeView component={
<div className={CN('input round')}>
<input type="text" placeholder='input...'/>
<div className="action">
<div className="button">button</div>
</div>
</div>
}>
{`<div className="${NS} input round">
<input type="text"/>
<div className="action">
<div className="button">button</div>
</div>
</div>`}
</CodeView>
<br/>
<h4>Fluid 输入框</h4>
<CodeView component={
makeInput('fluid')
}>
{`<div className="${NS} fluid input">
<input type="text" />
</div>`}
</CodeView>
<br/>
<h4>Disabled 输入框</h4>
<CodeView component={
makeInput('disabled')
}>
{`<div className="${NS} disabled input">
<input type="text" />
</div>`}
</CodeView>
<br/>
</li>
<li>
<h4>输入框尺寸</h4>
<CodeView component={
<div>
{makeInput('tiny')}
{makeInput('small')}
{makeInput('')}
{makeInput('large')}
{makeInput('huge')}
</div>
}>
{`<div className="${NS} tiny input">
<input type="text" />
</div>`}
</CodeView>
<br/>
</li>
<li>
<h4>带按钮输入框</h4>
<CodeView component={
<div>
{actionInputs()}
<br/>
<div className={CN('fluid input')}>
<input type="text" placeholder='input...'/>
<div className="action">
<div className="button">button</div>
</div>
</div>
<br/>
<div className={CN('fluid huge input')}>
<div className="action">
<div className="button">button</div>
</div>
<input type="text" placeholder='input...'/>
</div>
</div>
}>
{`<div className="${NS} input">
<input type="text" />
<button className="button">button</button>
</div>
<div className="${NS} fluid input">
<input type="text" />
<div className="action">
<div className="button">button</div>
</div>
</div>
<div className="${NS} fluid input">
<div className="action">
<div className="button">button</div>
</div>
<input type="text" />
</div>
`}
</CodeView>
<br/>
</li>
<li>
<h4>带图标输入法</h4>
<CodeView component={
<div>
<div className={CN('input icon')}>
<input type="text" placeholder="input..."/>
<i className="icon">search</i>
</div>
<br/>
<div className={CN('huge input icon')}>
<input type="text" placeholder="input..."/>
<i className="icon">search</i>
</div>
<br/>
<div className={CN('input icon')}>
<i className="icon">search</i>
<input type="text" placeholder="input..."/>
</div>
<br/>
<div className={CN('fluid input icon')}>
<input type="text" placeholder="input..."/>
<i className="icon">search</i>
</div>
</div>
}>
{`<div className="${NS} input icon">
<input type="text" />
<i className="icon">search</i>
</div>
<div className="${NS} huge input icon">
<input type="text" />
<i className="icon">search</i>
</div>
<div className="${NS} input icon">
<i className="icon">search</i>
<input type="text" />
</div>
<div className="${NS} fluid input icon">
<input type="text" />
<i className="icon">search</i>
</div>
`}
</CodeView>
<br/>
</li>
</ul>
</div>
);
}
} |
src/layout-v2/main-content/reserve.js | bblassingame/at-home-climate-website | import React from 'react'
import ReactGA from 'react-ga'
import PhoneIcon from './phone-icon.png'
const logPhoneClick = function() {
ReactGA.event({
category: 'Phone Link',
action: 'Click to Call'
})
}
const Reserve = () => {
return (
<div className='mc-sub-panel' >
<img className='mc-sub-panel-img' src={PhoneIcon} alt='phone icon indicating to call to reserve a storage unit' />
<div className='mc-sub-panel-header-container'>
<h1 className='mc-sub-panel-header'>Reserve Today</h1>
<div>
<p>
<span>Call: </span>
<a href="tel:+19037575845" rel="nofollow" onClick={logPhoneClick}>903-757-5845</a>
</p>
</div>
</div>
</div>
)
}
export default Reserve |
packages/material-ui-icons/src/SignalCellularConnectedNoInternet0BarSharp.js | lgollut/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fillOpacity=".3" d="M22 8V2L2 22h16V8h4z" /><path d="M20 22h2v-2h-2v2zm0-12v8h2v-8h-2z" /></React.Fragment>
, 'SignalCellularConnectedNoInternet0BarSharp');
|
animations/FadeAnimation.js | evetstech/react-native-animated-ptr | import React from 'react'
import {
View,
Animated,
Image,
UIManager
} from 'react-native'
export default class FadeAnimation extends React.Component {
constructor(props) {
super(props);
this.state = {
scrollY : this.props.scrollY,
isRefreshing: this.props.isRefreshing,
minPullDistance: this.props.minPullDistance,
}
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
}
static propTypes = {
/**
* Component Type being created. View allows for more nested components.
* @type {Enum}
*/
componentType: React.PropTypes.oneOf(['View', 'Image']).isRequired,
/**
* If using image, define the source
* @type {node}
*/
imageSrc: React.PropTypes.node,
/**
* The components style props.
* @type {StyleSheet}
*/
styleProps: React.PropTypes.any,
/**
* Fade Type for component.
* @type {Enum}
*/
fadeType: React.PropTypes.oneOf(['FADE_IN', 'FADE_OUT']).isRequired,
/**
* Lower bound opacity
* @type {Integer}
*/
maxOpacity: React.PropTypes.number.isRequired,
/**
* Upper bound opacity
* @type {Integer}
*/
minOpacity: React.PropTypes.number.isRequired
}
render() {
const fadeAnimation = this.state.scrollY.interpolate({
inputRange: [-this.state.minPullDistance, 0],
outputRange: this.props.fadeType === 'FADE_IN' ? [this.props.maxOpacity, this.props.minOpacity] : [this.props.minOpacity,this.props.maxOpacity],
extrapolate: 'clamp'
});
if(this.props.occurrence === 'BEFORE_REFRESH' || this.state.isRefreshing) {
return (
this.props.componentType === 'Image' ?
<Animated.Image
style={[
this.props.styleProps,
{opacity: fadeAnimation}
]}
source={this.props.imageSrc}
/> :
<Animated.View
style={[
this.props.styleProps,
{opacity: fadeAnimation}
]}>
{React.Children.map(this.props.children, (child) => {
return React.cloneElement(child, {
isRefreshing: this.props.isRefreshing,
scrollY: this.state.scrollY,
minPullDistance: this.props.minPullDistance
})
})}
</Animated.View>
)
}
return null;
}
};
|
src/www/js/demos/index_create_component.js | training4developers/bootcamp_04112016 | 'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
// ES5 legacy only
// var HelloWorld = React.createClass({
// render: function() {
// return React.DOM.h1({ className: 'intuit' }, 'Hello World!');
// }
// });
// ES2015 Class Syntax - preferred when you have state and events
// class HelloWorld extends React.Component {
//
// render() {
// return <h1>Hello World!</h1>; // JSX approach
// return React.DOM.h1({ className: 'intuit' }, 'Hello World!'); // JS only approach
// }
//
// }
//const HelloWorld = props => <h1 className={props.className}>HelloWorld</h1>;
const HelloWorld = function(props) {
return <h1 className={props.className}>Hello World</h1>;
};
ReactDOM.render(<HelloWorld className='intuit' />, document.querySelector('main'));
//ReactDOM.render(React.createElement(HelloWorld), document.querySelector('main'));
|
views/components/App/index.js | KochiyaOcean/www.kochiyaocean.org | import React from 'react'
import '../../3rd/fss'
import mesh from '../../3rd/mesh'
import Header from '../Header'
import MainPage from '../MainPage'
// import Footer from '../Footer'
import en_US from '../../intl/en-US'
import zh_CN from '../../intl/zh-CN'
import zh_TW from '../../intl/zh-TW'
import ja_JP from '../../intl/ja-JP'
import styles from './styles'
const intl = language => key => {
switch (language) {
case 'zh-CN':
return zh_CN[key]
case 'zh-TW':
return zh_TW[key]
case 'ja-JP':
return ja_JP[key]
default:
return en_US[key]
}
}
class App extends React.Component {
switchLanguage(lang) {
this.props.history.push(`/${lang}`)
}
getChildContext() {
const locale = this.props.match.params.locale
return {
__: intl(locale),
switchLanguage: (lang) => this.switchLanguage(lang),
locale,
}
}
componentDidMount() {
mesh(this.ground)
}
render() {
return (
<div className={styles.container}>
<div ref={node => this.ground = node} className={styles.ground} />
<div className={styles.wrapper}>
<Header />
<MainPage />
{/* <Footer /> */}
</div>
</div>
)
}
}
App.childContextTypes = {
__: React.PropTypes.func,
switchLanguage: React.PropTypes.func,
locale: React.PropTypes.string,
}
App.contextTypes = {
router: React.PropTypes.object,
}
export default App
|
src/containers/countInput.js | Harlantr/text-mod | import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { changeCount } from '../actions/actions';
class CountInput extends Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
}
handleChange(event) {
/*
Propagate the count change
*/
this.props.changeCount(event.target.value);
}
handleKeyPress(event) {
/*
Kill the default behavior if the user enters
anything other than a number
*/
const charCode = event.charCode;
if(!(charCode >= 48 && charCode <= 57)){
event.preventDefault();
}
}
render() {
return (
<div className="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="txtCount"
className="mdl-textfield__input"
type="number"
onChange={this.handleChange}
value={this.props.count}
onKeyPress={this.handleKeyPress}
min="0"/>
<label className="mdl-textfield__label" htmlFor="txtCount">Count</label>
</div>
);
}
}
const mapStateToProps = state => ({
count: state.reducer.count
})
const mapDispatchToProps = dispatch => bindActionCreators({
changeCount
}, dispatch)
export default connect(
mapStateToProps,
mapDispatchToProps
)(CountInput)
|
src/svg-icons/social/sentiment-satisfied.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialSentimentSatisfied = (props) => (
<SvgIcon {...props}>
<circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-4c-1.48 0-2.75-.81-3.45-2H6.88c.8 2.05 2.79 3.5 5.12 3.5s4.32-1.45 5.12-3.5h-1.67c-.7 1.19-1.97 2-3.45 2z"/>
</SvgIcon>
);
SocialSentimentSatisfied = pure(SocialSentimentSatisfied);
SocialSentimentSatisfied.displayName = 'SocialSentimentSatisfied';
SocialSentimentSatisfied.muiName = 'SvgIcon';
export default SocialSentimentSatisfied;
|
src/svg-icons/editor/border-clear.js | kasra-co/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorBorderClear = (props) => (
<SvgIcon {...props}>
<path d="M7 5h2V3H7v2zm0 8h2v-2H7v2zm0 8h2v-2H7v2zm4-4h2v-2h-2v2zm0 4h2v-2h-2v2zm-8 0h2v-2H3v2zm0-4h2v-2H3v2zm0-4h2v-2H3v2zm0-4h2V7H3v2zm0-4h2V3H3v2zm8 8h2v-2h-2v2zm8 4h2v-2h-2v2zm0-4h2v-2h-2v2zm0 8h2v-2h-2v2zm0-12h2V7h-2v2zm-8 0h2V7h-2v2zm8-6v2h2V3h-2zm-8 2h2V3h-2v2zm4 16h2v-2h-2v2zm0-8h2v-2h-2v2zm0-8h2V3h-2v2z"/>
</SvgIcon>
);
EditorBorderClear = pure(EditorBorderClear);
EditorBorderClear.displayName = 'EditorBorderClear';
EditorBorderClear.muiName = 'SvgIcon';
export default EditorBorderClear;
|
src/item.js | wi2/sails-react-store | import React from 'react'
import ReactBase from './base.js'
import {ReactItemButtons} from './item-button.js'
import {StoreItem} from 'sails-store'
export default class ReactItem extends ReactBase {
static defaultProps = {
item: {},
buttons: []
}
static propTypes = {
item: React.PropTypes.object.isRequired,
buttons: React.PropTypes.array.isRequired
}
state = {
item: this.props.item||{}
}
shouldComponentUpdate(newProps, newState) {
if (newProps.params) {
this.deleteStore();
this.createStore(newProps.identity, newProps.params)
this.store.get();
delete this.props.params;
return false;
}
return true;
}
componentDidMount() {
if (this.props.params && this.props.item && !this.props.item.id)
this.setState(this.props.params);
else
this.storage()
}
componentWillUpdate() {
this.storage();
}
componentWillUnmount() {
this.deleteStore();
}
update(data){
if (data !== this.state.item) this.setState({item: data})
}
storage() {
let item = this.state.item;
this.createStore(this.props.identity, item)
if (!item.createdAt) this.store.get();
}
createStore(identity, value) {
if (!this.store) {
this.store = new StoreItem({identity, value});
this.store.startListening();
this.store.on('update', this.update.bind(this));
}
}
deleteStore() {
if (this.store) {
this.store.stopListening();
delete this.store;
}
}
render() {
let item = this.state.item;
return (
<li className={this.props.identity+'-item'}>
<p>{item.message}</p>
<small>{item.name}</small>
<ReactItemButtons items={this.props.buttons} id={item.id} />
</li>
)
}
}
|
priv/src/navbar.js | Blackrush/dofus.next | import React from 'react';
export default class extends React.Component {
render() {
return (
<nav className="navbar navbar-default">
<div className="container">
<div className="navbar-header">
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
<a className="navbar-brand" href="#">DofusNext</a>
</div>
<div className="collapse navbar-collapse">
<ul className="nav navbar-nav">
<li className="active"><a href="#">Home</a></li>
</ul>
</div>
</div>
</nav>
);
}
}
|
app/index.js | benmccormick/trollbox | /* @flow */
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import {AppContainer} from './modules/app/app.container';
import {store} from './setup/store';
import {initializeUserData} from './setup/data';
initializeUserData(store);
ReactDOM.render(<Provider store={store}>
<AppContainer/>
</Provider>, document.getElementById('container'));
|
app/javascript/mastodon/components/avatar_composite.js | TheInventrix/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from '../initial_state';
export default class AvatarComposite extends React.PureComponent {
static propTypes = {
accounts: ImmutablePropTypes.list.isRequired,
animate: PropTypes.bool,
size: PropTypes.number.isRequired,
};
static defaultProps = {
animate: autoPlayGif,
};
renderItem (account, size, index) {
const { animate } = this.props;
let width = 50;
let height = 100;
let top = 'auto';
let left = 'auto';
let bottom = 'auto';
let right = 'auto';
if (size === 1) {
width = 100;
}
if (size === 4 || (size === 3 && index > 0)) {
height = 50;
}
if (size === 2) {
if (index === 0) {
right = '2px';
} else {
left = '2px';
}
} else if (size === 3) {
if (index === 0) {
right = '2px';
} else if (index > 0) {
left = '2px';
}
if (index === 1) {
bottom = '2px';
} else if (index > 1) {
top = '2px';
}
} else if (size === 4) {
if (index === 0 || index === 2) {
right = '2px';
}
if (index === 1 || index === 3) {
left = '2px';
}
if (index < 2) {
bottom = '2px';
} else {
top = '2px';
}
}
const style = {
left: left,
top: top,
right: right,
bottom: bottom,
width: `${width}%`,
height: `${height}%`,
backgroundSize: 'cover',
backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`,
};
return (
<div key={account.get('id')} style={style} />
);
}
render() {
const { accounts, size } = this.props;
return (
<div className='account__avatar-composite' style={{ width: `${size}px`, height: `${size}px` }}>
{accounts.take(4).map((account, i) => this.renderItem(account, accounts.size, i))}
</div>
);
}
}
|
modules/RouterContext.js | djkirby/react-router | import invariant from 'invariant'
import React from 'react'
import getRouteParams from './getRouteParams'
import { ContextProvider } from './ContextUtils'
import { isReactChildren } from './RouteUtils'
const { array, func, object } = React.PropTypes
/**
* A <RouterContext> renders the component tree for a given router state
* and sets the history object and the current location in context.
*/
const RouterContext = React.createClass({
mixins: [ ContextProvider('router') ],
propTypes: {
router: object.isRequired,
location: object.isRequired,
routes: array.isRequired,
params: object.isRequired,
components: array.isRequired,
createElement: func.isRequired
},
getDefaultProps() {
return {
createElement: React.createElement
}
},
childContextTypes: {
router: object.isRequired
},
getChildContext() {
return {
router: this.props.router
}
},
createElement(component, props) {
return component == null ? null : this.props.createElement(component, props)
},
render() {
const { location, routes, params, components, router } = this.props
let element = null
if (components) {
element = components.reduceRight((element, components, index) => {
if (components == null)
return element // Don't create new children; use the grandchildren.
const route = routes[index]
const routeParams = getRouteParams(route, params)
const props = {
location,
params,
route,
router,
routeParams,
routes
}
if (isReactChildren(element)) {
props.children = element
} else if (element) {
for (const prop in element)
if (Object.prototype.hasOwnProperty.call(element, prop))
props[prop] = element[prop]
}
if (typeof components === 'object') {
const elements = {}
for (const key in components) {
if (Object.prototype.hasOwnProperty.call(components, key)) {
// Pass through the key as a prop to createElement to allow
// custom createElement functions to know which named component
// they're rendering, for e.g. matching up to fetched data.
elements[key] = this.createElement(components[key], {
key, ...props
})
}
}
return elements
}
return this.createElement(components, props)
}, element)
}
invariant(
element === null || element === false || React.isValidElement(element),
'The root route must render a single element'
)
return element
}
})
export default RouterContext
|
docs/app/Examples/collections/Grid/index.js | clemensw/stardust | import React from 'react'
import Content from './Content'
import Types from './Types'
import Variations from './Variations'
import ResponsiveVariations from './ResponsiveVariations'
const GridExamples = () => (
<div>
<Types />
<Content />
<Variations />
<ResponsiveVariations />
</div>
)
export default GridExamples
|
app/components/filters.js | nypl-spacetime/logs-viewer | import React, { Component } from 'react';
import './logs-list.scss'
const Filters = React.createClass({
getInitialState: function() {
var types = new Set()
this.props.logs.forEach((log) => {
(log.logs || []).forEach((error) => {
types.add(error.error)
})
})
return {
types: types
}
},
render: function() {
console.log(this.state.types)
return (
<div>
<input placeholder='ID' />
<input placeholder='Name' />
</div>
)
}
})
export default Filters
|
webapp/src/routes/dashboard/components/user.js | templatetools/trace | import React from 'react'
import PropTypes from 'prop-types'
import { Button } from 'antd'
import CountUp from 'react-countup'
import { color } from 'utils'
import styles from './user.less'
const countUpProps = {
start: 0,
duration: 2.75,
useEasing: true,
useGrouping: true,
separator: ',',
}
function User ({ avatar, name, email, sales, sold }) {
return (<div className={styles.user}>
<div className={styles.header}>
<div className={styles.headerinner}>
<div className={styles.avatar} style={{ backgroundImage: `url(${avatar})` }} />
<h5 className={styles.name}>{name}</h5>
<p>{email}</p>
</div>
</div>
<div className={styles.number}>
<div className={styles.item}>
<p>EARNING SALES</p>
<p style={{ color: color.green }}><CountUp
end={sales}
prefix="$"
{...countUpProps}
/></p>
</div>
<div className={styles.item}>
<p>ITEM SOLD</p>
<p style={{ color: color.blue }}><CountUp
end={sold}
{...countUpProps}
/></p>
</div>
</div>
<div className={styles.footer}>
<Button type="ghost" size="large">View Profile</Button>
</div>
</div>)
}
User.propTypes = {
avatar: PropTypes.string,
name: PropTypes.string,
email: PropTypes.string,
sales: PropTypes.number,
sold: PropTypes.number,
}
export default User
|
src/containers/Question1Container.js | umgauper/USDA-UX-Challenge | import React from 'react'
import { connect } from 'react-redux'
import { addChildNames } from '../actions'
import Question1 from '../components/ChildrenQuestions/Question1'
const mapDispatchToProps = (dispatch) => {
return {
onNextClick: (namesArray, firstNamesArray) => {
dispatch(addChildNames(namesArray, firstNamesArray))
}
}
}
const Question1Container = connect(
null,
mapDispatchToProps
)(Question1)
export default Question1Container |
src/components/Input.js | dazhifu/react-touch-ui | import React from 'react';
import assign from 'object-assign'
import classnames from 'classnames';
import { View } from "./View.js"
import Utils from "./common/Utils.js"
import './Input.scss'
import IOSearch from 'react-icons/lib/io/ios-search';
import { Layout } from "../components/Layout.js"
import Config from "./common/Config.js"
export class Input extends React.Component {
static propTypes = {
fontSize: React.PropTypes.string, // 字体大小
fontColor: React.PropTypes.string, // 字体颜色
type: React.PropTypes.string, // 类型 默认是编辑,search 搜索
placeholder: React.PropTypes.string, // 提示文字
value: React.PropTypes.string, // 默认文字
maxLength: React.PropTypes.string, // 最大长度
onChange: React.PropTypes.string, // onchange 方法
};
static defaultProps = {
fontSize: Config.InputFontSize,
fontColor: Config.InputFontColor,
h: Config.InputH
};
constructor(props) {
super(props);
const {
fontSize,
fontColor,
h, value,
maxLength,
} = this.props;
this.state = {
fontSize: fontSize,
fontColor: fontColor,
h: h,
value: value,
maxLength: maxLength
};
};
handle(e) {
var value = e.target.value;
this.setState({value: value});
this.state.onChange(e, value)
};
renderSearch(inputStyle, type, placeholder, props) {
var IORadioIcon;
return (
<Layout flexDirection="row" justifyContent="flex-start" h= {this.props.h} className="aui-searchinput-outline"
{...props}
>
<Layout alignSelf="center" mr="3">
<IOSearch size={30}/>
</Layout >
<input style={inputStyle} type={type} className="aui-input" placeholder={placeholder}
value={this.state.value} onChange={this.handle.bind(this)} data-input-clear="1"
data-input-search="1">
</input>
</Layout >
)
}
renderCommon(inputStyle, type, placeholder, props) {
return (
<View className="aui-input-outline"
{...props}
>
<input style={inputStyle} type={type} className="aui-input" placeholder={placeholder}
maxLength={this.state.maxLength }
value={this.state.value} onChange={this.handle.bind(this)} data-input-clear="1"
data-input-search="1">
</input>
</View>
);
}
render() {
const {
fontSize, // 字体大小
fontColor, // 字体颜色
onChange,
type,
placeholder, // 提示字
...props
} = this.props;
this.state.onChange = onChange;
var h = this.state.h;
var hStyle;
if (h) {
var lineHeight = h;
hStyle = assign(
Utils.kvSize("lineHeight", h -2),
Utils.kvSize("height", h-2)
)
}
const inputStyle = assign(
// {-webkit-appearance:none},
{color: this.state.fontColor},
Utils.kvSize('fontSize', this.state.fontSize),
hStyle
);
if (type == "search") {
return this.renderSearch(inputStyle, type, placeholder, props);
} else {
return this.renderCommon(inputStyle, type, placeholder, props);
}
}
}
|
src/components/appbar.js | alphanumeric0101/pomodo-it | import React from 'react';
import AppBar from 'material-ui/lib/app-bar';
import IconButton from 'material-ui/lib/icon-button';
import Settings from 'material-ui/lib/svg-icons/action/settings';
import AddButton from 'material-ui/lib/floating-action-button';
import Add from 'material-ui/lib/svg-icons/content/add';
import FlatButton from 'material-ui/lib/flat-button';
import MenuItem from 'material-ui/lib/menus/menu-item';
import IconMenu from 'material-ui/lib/menus/icon-menu';
import Nav from './leftnav.js';
const styles = {
title: {
cursor: 'pointer',
},
add: {
}
};
const Top = () => (
<AppBar
title={<span style={styles.title}>Pomodo-It</span>}
iconElementLeft={
<Nav />
}
iconElementRight={
<IconButton><Settings /></IconButton>
}
/>
);
export default Top; |
playground/client/src/components/loadingAnimation/LoadingAnimation.js | JHerrickII/NewsTree | import React, { Component } from 'react';
import ReactLoading from 'react-loading';
export default class LoadingAnimation extends Component{
componentDidMount() {
}
componentWillUnmount(){
}
render() {
return(
<ReactLoading type="bars" color="#444" />
);
}
}
|
packages/react-router-website/modules/examples/PreventingTransitions.js | react-translate-team/react-router-CN | import React from 'react'
import {
BrowserRouter as Router,
Route,
Link,
Prompt
} from 'react-router-dom'
const PreventingTransitionsExample = () => (
<Router>
<div>
<ul>
<li><Link to="/">表单</Link></li>
<li><Link to="/one">页面 1</Link></li>
<li><Link to="/two">页面 2</Link></li>
</ul>
<Route path="/" exact component={Form}/>
<Route path="/one" render={() => <h3>页面 1</h3>}/>
<Route path="/two" render={() => <h3>页面 2</h3>}/>
</div>
</Router>
)
class Form extends React.Component {
state = {
isBlocking: false
}
render() {
const { isBlocking } = this.state
return (
<form
onSubmit={event => {
event.preventDefault()
event.target.reset()
this.setState({
isBlocking: false
})
}}
>
<Prompt
when={isBlocking}
message={location => (
`你真的要跳转到 ${location.pathname}么?`
)}
/>
<p>
是否无法跳转? {isBlocking ? '好,现在试试再试试点击那些链接' : '可以正常跳转'}
</p>
<p>
<input
size="50"
placeholder="你这里面输入了以后就不能正常跳转了"
onChange={event => {
this.setState({
isBlocking: event.target.value.length > 0
})
}}
/>
</p>
<p>
<button>提交表单以后就可以正常跳转了</button>
</p>
</form>
)
}
}
export default PreventingTransitionsExample
|
wrappers/json.js | tcpbros/tcpbros.github.io | import React from 'react'
import Helmet from 'react-helmet'
import { config } from 'config'
module.exports = React.createClass({
propTypes () {
return {
route: React.PropTypes.object,
}
},
render () {
const data = this.props.route.page.data
return (
<div>
<Helmet
title={`${config.siteTitle} | ${data.title}`}
/>
<h1>{data.title}</h1>
<p>Raw view of json file</p>
<pre dangerouslySetInnerHTML={{ __html: JSON.stringify(data, null, 4) }} />
</div>
)
},
})
|
app/routes.js | raptiq/voting-app | import React from 'react';
import {Route} from 'react-router';
import App from './components/app';
import Home from './components/home';
export default (
<Route component={App}>
<Route path='/' component={Home} />
</Route>
) |
src/widgets/bottomModals/ItemDetails.js | sussol/mobile | /* eslint-disable react/forbid-prop-types */
/* eslint-disable import/prefer-default-export */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
import React from 'react';
import PropTypes from 'prop-types';
import { ScrollView } from 'react-native';
import { formatExpiryDate } from '../../utilities';
import { PageInfo } from '../PageInfo/PageInfo';
import { tableStrings, generalStrings } from '../../localization';
import { DARKER_GREY, SUSSOL_ORANGE } from '../../globalStyles';
import { twoDecimalsMax } from '../../utilities/formatters';
export const ItemDetailsComponent = ({ item }) => {
const headers = {
batch: generalStrings.batch_name,
expiryDate: generalStrings.expiry_date,
numberOfPacks: generalStrings.quantity,
doses: generalStrings.doses,
vials: generalStrings.vials,
category: tableStrings.category,
department: tableStrings.department,
usage: tableStrings.monthly_usage_s,
};
const formatters = {
expiryDate: expiryDate => formatExpiryDate(expiryDate),
numberOfPacks: packs => twoDecimalsMax(packs),
};
const getRow = (title, info) => ({ info, title });
const getBatchColumn = field =>
item.batchesWithStock.sorted('expiryDate').map(itemBatch => {
const title = headers[field];
const data = itemBatch[field];
const info =
(formatters[field] && formatters[field](data)) || data || generalStrings.not_available;
return getRow(title, info);
});
const getBatchInfo = () => {
const batchNameColumn = getBatchColumn('batch');
const expiryDateColumn = getBatchColumn('expiryDate');
const quantityColumn = getBatchColumn('numberOfPacks');
return [batchNameColumn, expiryDateColumn, quantityColumn];
};
const getVaccineBatchInfo = () => {
const batchNameColumn = getBatchColumn('batch');
const expiryDateColumn = getBatchColumn('expiryDate');
const vialsColumn = getBatchColumn('numberOfPacks').map(batchColumn => ({
title: headers.vials,
info: batchColumn.info,
}));
const dosesColumn = getBatchColumn('doses');
return [batchNameColumn, expiryDateColumn, vialsColumn, dosesColumn];
};
const getItemInfo = () => {
const { categoryName, departmentName, monthlyUsage } = item;
const categoryRow = {
title: `${tableStrings.category}:`,
info: categoryName || generalStrings.not_available,
};
const departmentRow = {
title: `${tableStrings.department}:`,
info: departmentName || generalStrings.not_available,
};
const usageRow = { title: `${tableStrings.monthly_usage_s}:`, info: Math.round(monthlyUsage) };
return [[categoryRow, departmentRow, usageRow]];
};
return (
<ScrollView indicatorStyle="white" style={localStyles.container}>
<PageInfo titleColor={SUSSOL_ORANGE} infoColor="white" columns={getItemInfo()} />
<PageInfo
titleColor={SUSSOL_ORANGE}
infoColor="white"
columns={item.isVaccine ? getVaccineBatchInfo() : getBatchInfo()}
/>
</ScrollView>
);
};
export const ItemDetails = React.memo(ItemDetailsComponent);
const localStyles = {
container: {
height: 250,
marginLeft: 20,
marginRight: 20,
paddingLeft: 50,
backgroundColor: DARKER_GREY,
},
};
ItemDetailsComponent.propTypes = {
item: PropTypes.object.isRequired,
};
|
front/app/app/rh-components/rh-PageModule.js | nudoru/React-Starter-2-app | import React from 'react';
const PageModule = ({style, title, headline, children, className=''}) => {
/*
<div className="rh-page-module-cta">
<button className="rh-button">Read more</button>
</div>
*/
style = 'rh-page-module' + (style ? ' rh-page-module-' + style : '') + ' ' + className;
title = title ? (
<h1 className="rh-page-module-title">{title}</h1>) : (
<div></div>);
headline = headline ? (
<h2
className="rh-page-module-headline">{headline}</h2>) : (
<div></div>);
return (<div className={style}>
<div className="page-container">
{title}
{headline}
{children}
</div>
</div>);
};
export default PageModule; |
client/src/components/channels/ChannelCard.js | kevinladkins/newsfeed |
import React from 'react'
import {Link} from 'react-router-dom'
import Card from '../common/Card'
const ChannelCard = ({channel, articles, setArticleUrl}) => {
//finds articles associated with this channel
const articleObject = articles.find(articleObject => articleObject.name === channel.name);
//maps article titles to links
const channelArticles = articleObject.articles.map((article, index) => {
return (
<Link to={`/newsfeed/${channel.source_id}/${setArticleUrl(article.title)}`}><h4 className="article-title">{article.title}</h4></Link>
)
})
const title = (
<Link to={`/newsfeed/${channel.source_id}`}>{channel.name}</Link>
)
return (
<Card title={title} content={channelArticles} key={channel.source_id}/>
)
}
export default ChannelCard
|
src/routes/tests/index.js | fkn/ndo | import React from 'react';
import Layout from '../../components/Layout';
import Tests from './Tests';
const title = 'Tests';
function action({ store }) {
const { user } = store.getState();
if (!user) {
return { redirect: '/login' };
}
return {
chunks: ['tests'],
title,
component: (
<Layout>
<Tests title={title} />
</Layout>
),
};
}
export default action;
|
src/Parser/AfflictionWarlock/Modules/Features/AlwaysBeCasting.js | mwwscott0/WoWAnalyzer | import React from 'react';
import CoreAlwaysBeCasting from 'Parser/Core/Modules/AlwaysBeCasting';
import SPELLS from 'common/SPELLS';
import Icon from 'common/Icon';
import { formatPercentage } from 'common/format';
import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox';
import SpellLink from 'common/SpellLink';
class AlwaysBeCasting extends CoreAlwaysBeCasting {
static ABILITIES_ON_GCD = [
SPELLS.AGONY.id,
SPELLS.CORRUPTION_CAST.id,
SPELLS.DEMONIC_GATEWAY_CAST.id,
SPELLS.DRAIN_SOUL.id,
SPELLS.HEALTH_FUNNEL_CAST.id,
SPELLS.LIFE_TAP.id,
SPELLS.REAP_SOULS.id,
SPELLS.SEED_OF_CORRUPTION_DEBUFF.id,
SPELLS.SOULSTONE.id,
SPELLS.UNENDING_RESOLVE.id,
SPELLS.UNSTABLE_AFFLICTION_CAST.id,
// talents
SPELLS.HAUNT.id,
SPELLS.DEMONIC_CIRCLE_SUMMON.id,
SPELLS.DEMONIC_CIRCLE_TELEPORT.id,
SPELLS.MORTAL_COIL.id,
SPELLS.PHANTOM_SINGULARITY.id,
SPELLS.SOUL_HARVEST.id,
SPELLS.BURNING_RUSH.id,
SPELLS.SIPHON_LIFE.id,
// practically unused, for the sake of completeness
SPELLS.SUMMON_DOOMGUARD_TALENTED.id,
SPELLS.SUMMON_INFERNAL_TALENTED.id,
SPELLS.DARK_PACT.id,
SPELLS.SUMMON_DOOMGUARD_UNTALENTED.id,
SPELLS.SUMMON_INFERNAL_UNTALENTED.id,
SPELLS.GRIMOIRE_OF_SACRIFICE_BUFF.id,
SPELLS.HOWL_OF_TERROR_TALENT.id,
SPELLS.GRIMOIRE_IMP.id,
SPELLS.GRIMOIRE_VOIDWALKER.id,
SPELLS.GRIMOIRE_FELHUNTER.id,
SPELLS.GRIMOIRE_SUCCUBUS.id,
SPELLS.SUMMON_IMP.id,
SPELLS.SUMMON_VOIDWALKER.id,
SPELLS.SUMMON_FELHUNTER.id,
SPELLS.SUMMON_SUCCUBUS.id,
];
suggestions(when) {
const deadTimePercentage = this.totalTimeWasted / this.owner.fightDuration;
when(deadTimePercentage).isGreaterThan(0.2)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<span>Your dead GCD time can be improved. Try to Always Be Casting (ABC), try to reduce the delay between casting spells. Even if you have to move, try casting something instant - maybe refresh your dots or replenish your mana with <SpellLink id={SPELLS.LIFE_TAP.id} /></span>)
.icon('spell_mage_altertime')
.actual(`${formatPercentage(actual)}% dead GCD time`)
.recommended(`<${formatPercentage(recommended)}% is recommended`)
.regular(recommended + 0.15).major(recommended + 0.2);
});
}
statistic() {
const deadTimePercentage = this.totalTimeWasted / this.owner.fightDuration;
return (
<StatisticBox
icon={<Icon icon="petbattle_health-down" alt="Dead time" />}
value={`${formatPercentage(deadTimePercentage)} %`}
label="Dead time"
tooltip="Dead time is available casting time not used for casting any spell. This can be caused by latency, cast interrupting, not casting anything (e.g. due to movement/being stunned), etc."
/>
);
}
statisticOrder = STATISTIC_ORDER.CORE(1);
}
export default AlwaysBeCasting;
|
src/index.js | fahmifachreza/fahmifachreza-portofolio | import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import App from './components/App';
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root'),
);
|
src/views/GestionsComponents/Flottes/GestionDesFlottes.js | Cruis-R/GestionOutil | import React, { Component } from 'react';
import { TabContent, TabPane, Nav, NavItem, NavLink, Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import classnames from 'classnames';
const data = [{
"id_flotte":"1",
"nom" : "CruisR",
"date_ajout":"2017-08-03",
"raison_sociale" : "123456",
"address" : "82 rue Denfert Rochereau",
"referent" : "0001",
"poste" : "75012",
"email" : "[email protected]",
"tel" : "0650651584"
}];
export default class GestionDesFlottes extends Component {
constructor(props) {
super(props);
this.state = {
activeTab: '1',
isInsertFlotteModal : false,
isModifierFlotteModal : false,
isInfoGlobaleModal : false,
isTransfererContratsModal : false,
isAfficherContratsModal : false,
flotteConcerne : null,
profilConcerne : null
}
this.toggle = this.toggle.bind(this);
this.toggleInsertFlotteModal = this.toggleInsertFlotteModal.bind(this);
this.toggleModifierFlotteModal = this.toggleModifierFlotteModal.bind(this);
this.toggleInfoGlobaleModal = this.toggleInfoGlobaleModal.bind(this);
this.toggleAfficherContratsModal = this.toggleAfficherContratsModal.bind(this);
this.toggleTransfererContratsModal = this.toggleTransfererContratsModal.bind(this);
this.flottesGestionFormatter = this.flottesGestionFormatter.bind(this);
}
toggle(tab) {
if (this.state.activeTab !== tab) {
this.setState({
activeTab: tab
});
}
}
toggleModifierFlotteModal(data){
this.setState({
isModifierFlotteModal : !this.state.isModifierFlotteModal,
flotteConcerne : data
});
}
toggleInfoGlobaleModal(data){
this.setState({
isInfoGlobaleModal : !this.state.isInfoGlobaleModal,
flotteConcerne : data
});
}
toggleAfficherContratsModal(data){
this.setState({
isAfficherContratsModal : !this.state.isAfficherContratsModal,
flotteConcerne : data
});
}
toggleTransfererContratsModal(data){
this.setState({
isTransfererContratsModal : !this.state.isTransfererContratsModal,
flotteConcerne : data
});
}
toggleInsertFlotteModal(){
this.setState({
isInsertFlotteModal : !this.state.isInsertFlotteModal
});
}
flottesGestionFormatter(cell,row){
return (
<div>
<button type="button" data-toggle="tooltip" data-placement="top" title="Afflicher/Modifier" className="btn btn-success btn-sm col-lg-3" onClick={()=>this.toggleModifierFlotteModal(row)}>
Afflicher/Modifier
</button>
<button type="button" data-toggle="tooltip" data-placement="top" title="Afflicher Info Globale" className="btn btn-info btn-sm col-lg-3" onClick={()=>this.toggleInfoGlobaleModal(row)}>
Afflicher Info Globale
</button>
<button type="button" data-toggle="tooltip" data-placement="top" title="Afflicher Contrats" className="btn btn-primary btn-sm col-lg-3" onClick={()=>this.toggleAfficherContratsModal(row)}>
Afflicher Contrats
</button>
<button type="button" data-toggle="tooltip" data-placement="top" title="Transférer Contrats" className="btn btn-danger btn-sm col-lg-3" onClick={()=>this.toggleTransfererContratsModal(row)}>
Transférer Contrats
</button>
</div>
);
}
flottesInsertButton = () => {
return (
<div>
<button type="button" className="btn btn-info btn-md" onClick = {this.toggleInsertFlotteModal}>Ajouter un Nouveau Flotte</button>
<Modal isOpen={this.state.isInsertFlotteModal} toggle={this.toggleInsertFlotteModal}>
<ModalHeader toggle={this.toggleInsertFlotteModal}>Ajouter un Nouveau Flotte</ModalHeader>
<ModalBody>
<div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-tag"></i></span>
<span className="input-group-addon col-3">Nom</span>
<input type="text" id="nom" name="nom" className="form-control" placeholder="Nom"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-calendar"></i></span>
<span className="input-group-addon col-3">Date de Création</span>
<input type="date" id="date_ajout" name="motdepasse" className="form-control" placeholder="Date de Création"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-archive"></i></span>
<span className="input-group-addon col-3">Raison Sociale</span>
<input type="text" id="raison_sociale" name="profil" className="form-control" placeholder="Raison Sociale"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-home"></i></span>
<span className="input-group-addon col-3">Address</span>
<input type="text" id="address" name="societe" className="form-control" placeholder="Address"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-search"></i></span>
<span className="input-group-addon col-3">Référent</span>
<input type="text" id="referent" name="societe" className="form-control" placeholder="Référent"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-suitcase"></i></span>
<span className="input-group-addon col-3">Poste</span>
<input type="text" id="poste" name="societe" className="form-control" placeholder="Poste"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-envelope"></i></span>
<span className="input-group-addon col-3">Email</span>
<input type="email" id="email" name="email" className="form-control" placeholder="Email"/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon col-1"><i className="fa fa-phone"></i></span>
<span className="input-group-addon col-3">Tel</span>
<input type="tel" id="tel" name="tel" className="form-control" placeholder="Tel"/>
</div>
</div>
</div>
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-sm btn-success" onClick={this.toggleInsertFlotteModal}>Submit</button>
<button type="button" className="btn btn-sm btn-secondary" onClick={this.toggleInsertFlotteModal}>Cancel</button>
</ModalFooter>
</Modal>
</div>
);
}
createCustomToolBar = props => {
return (
<div style={ { margin: '15px', width: "100%" } }>
<div className='row'>
<div className="col-8">
{ props.components.btnGroup }
</div>
<div className="col-4">
{ props.components.searchPanel }
</div>
</div>
</div>
);
}
render(){
let cur = this;
const optionsFlottes = {
insertBtn: cur.flottesInsertButton,
toolBar: this.createCustomToolBar
}
return(
<div className="animated fadeIn">
<div className="row">
<div className="col-lg-12">
<Nav tabs>
<NavItem>
<NavLink
className={classnames({ active: this.state.activeTab === '1' })}
onClick={() => { this.toggle('1'); }}>
Flottes
</NavLink>
</NavItem>
</Nav>
<TabContent activeTab={this.state.activeTab}>
<TabPane tabId="1">
<div className="card">
<div className="card-header">
<i className="fa fa-align-justify"></i> Gestion des Flottes
</div>
<div className="card-block">
<BootstrapTable
options = {optionsFlottes}
data={ data }
headerStyle = { { "backgroundColor" : "#63c2de" } }
insertRow>
<TableHeaderColumn
dataField="id_flotte"
isKey
dataSort
width = "15%">
ID
</TableHeaderColumn>
<TableHeaderColumn
dataField="nom"
dataSort
width = "15%">
Nom
</TableHeaderColumn>
<TableHeaderColumn
dataField=""
dataFormat={ this.flottesGestionFormatter }
width = "30%">
Gestion
</TableHeaderColumn>
</BootstrapTable>
</div>
</div>
</TabPane>
</TabContent>
</div>
</div>
{
this.state.isModifierFlotteModal?
<Modal className='modal-lg modal-success' isOpen={this.state.isModifierFlotteModal} toggle={this.toggleModifierFlotteModal}>
<ModalHeader toggle={this.toggleModifierFlotteModal}>Afficher/Modifier un Flotte</ModalHeader>
<ModalBody>
<div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-tag"></i></span>
<span className="input-group-addon col-3">Nom</span>
<input type="text" id="nom" name="nom" className="form-control" placeholder="Nom" defaultValue={this.state.flotteConcerne['nom']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-calendar"></i></span>
<span className="input-group-addon col-3">Date de Création</span>
<input type="date" id="date_ajout" name="date_ajout" className="form-control" placeholder="Date de Création" defaultValue={this.state.flotteConcerne['date_ajout']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-archive"></i></span>
<span className="input-group-addon col-3">Raison Sociale</span>
<input type="text" id="raison_sociale" name="raison_sociale" className="form-control" placeholder="Raison Sociale" defaultValue={this.state.flotteConcerne['raison_sociale']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-home"></i></span>
<span className="input-group-addon col-3">Address</span>
<input type="text" id="address" name="address" className="form-control" placeholder="Address" defaultValue={this.state.flotteConcerne['address']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-search"></i></span>
<span className="input-group-addon col-3">Référent</span>
<input type="text" id="referent" name="referent" className="form-control" placeholder="Référent" defaultValue={this.state.flotteConcerne['referent']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-suitcase"></i></span>
<span className="input-group-addon col-3">Poste</span>
<input type="text" id="poste" name="poste" className="form-control" placeholder="Poste" defaultValue={this.state.flotteConcerne['poste']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-envelope"></i></span>
<span className="input-group-addon col-3">Email</span>
<input type="email" id="email" name="email" className="form-control" placeholder="Email" defaultValue={this.state.flotteConcerne['email']}/>
</div>
</div>
<div className="form-group">
<div className="input-group">
<span className="input-group-addon"><i className="fa fa-phone"></i></span>
<span className="input-group-addon col-3">Tel</span>
<input type="tel" id="tel" name="tel" className="form-control" placeholder="Tel" defaultValue={this.state.flotteConcerne['tel']}/>
</div>
</div>
</div>
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-sm btn-success" onClick={this.toggleModifierFlotteModal}>Submit</button>
<button type="button" className="btn btn-sm btn-secondary" onClick={this.toggleModifierFlotteModal}>Cancel</button>
</ModalFooter>
</Modal>:null
}
{
this.state.isInfoGlobaleModal?
<Modal className='modal-lg modal-info' isOpen={this.state.isInfoGlobaleModal} toggle={this.toggleInfoGlobaleModal}>
<ModalHeader toggle={this.toggleInfoGlobaleModal}>Information Globale de Flotte</ModalHeader>
<ModalBody>
<div className="row">
<div className="col-sm-6 col-lg-3">
<div className="card">
<div className="card-block">
<div>{this.state.flotteConcerne["nom"]}</div>
<small className="text-muted">Nom</small>
</div>
</div>
</div>
<div className="col-sm-6 col-lg-3">
<div className="card">
<div className="card-block">
<div>{this.state.flotteConcerne["raison_sociale"]}</div>
<small className="text-muted">Raison Sociale</small>
</div>
</div>
</div>
<div className="col-sm-6 col-lg-3">
<div className="card">
<div className="card-block">
<div>{this.state.flotteConcerne["referent"]}</div>
<small className="text-muted">Référent</small>
</div>
</div>
</div>
<div className="col-sm-6 col-lg-3">
<div className="card">
<div className="card-block">
<div>{this.state.flotteConcerne["date_ajout"]}</div>
<small className="text-muted">Date de Création</small>
</div>
</div>
</div>
<div className="card-group col-lg-12">
<div className="card card-inverse card-success">
<div className="card-block">
<div className="h1 text-muted text-right mb-2">
<i className="icon-speedometer"></i>
</div>
<div className="h4 mb-0">{this.state.flotteConcerne["contrats_actifs"]?this.state.flotteConcerne["contrats_actifs"]:"4"}</div>
<small className="text-muted text-uppercase font-weight-bold">nombre de contrats actifs</small>
</div>
</div>
<div className="card card-inverse card-warning">
<div className="card-block">
<div className="h1 text-muted text-right mb-2">
<i className="icon-speedometer"></i>
</div>
<div className="h4 mb-0">{this.state.flotteConcerne["nb_intervention"]?this.state.flotteConcerne["nb_intervention"]:"4"}</div>
<small className="text-muted text-uppercase font-weight-bold">nombre d’intervention</small>
</div>
</div>
<div className="card card-inverse card-danger">
<div className="card-block">
<div className="h1 text-muted text-right mb-2">
<i className="icon-speedometer"></i>
</div>
<div className="h4 mb-0">{this.state.flotteConcerne["nb_accident"]?this.state.flotteConcerne["nb_accident"]:"2"}</div>
<small className="text-muted text-uppercase font-weight-bold">nombre d’accident</small>
</div>
</div>
</div>
<div className="card-group col-lg-12">
<div className="card card-inverse card-success">
<div className="card-block">
<div className="h1 text-muted text-right mb-2">
<i className="icon-speedometer"></i>
</div>
<div className="h4 mb-0">{this.state.flotteConcerne["nb_scooters"]?this.state.flotteConcerne["nb_scooters"]:"2"}</div>
<small className="text-muted text-uppercase font-weight-bold">nombre de scooters en location</small>
</div>
</div>
<div className="card card-inverse card-primary">
<div className="card-block">
<div className="h1 text-muted text-right mb-2">
<i className="icon-speedometer"></i>
</div>
<div className="h4 mb-0">{this.state.flotteConcerne["nb_km"]?this.state.flotteConcerne["nb_km"]:"200"}</div>
<small className="text-muted text-uppercase font-weight-bold">nombre de Kilomètre total</small>
</div>
</div>
<div className="card card-inverse card-info">
<div className="card-block">
<div className="h1 text-muted text-right mb-2">
<i className="icon-speedometer"></i>
</div>
<div className="h4 mb-0">{this.state.flotteConcerne["nb_km_moyenne"]?this.state.flotteConcerne["nb_km_moyenne"]:"2"}</div>
<small className="text-muted text-uppercase font-weight-bold">moyenne de kilomètre par mois </small>
</div>
</div>
</div>
<div className="col-6">
<div className="card">
<div className="card-block p-3 clearfix">
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">{this.state.flotteConcerne["address"]}</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Address</div>
</div>
</div>
</div>
<div className="col-6">
<div className="card">
<div className="card-block p-3 clearfix">
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">{this.state.flotteConcerne["poste"]}</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Poste</div>
</div>
</div>
</div>
<div className="col-6">
<div className="card">
<div className="card-block p-3 clearfix">
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">{this.state.flotteConcerne["tel"]}</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Tel</div>
</div>
</div>
</div>
<div className="col-6">
<div className="card">
<div className="card-block p-3 clearfix">
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">{this.state.flotteConcerne["email"]}</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Email</div>
</div>
</div>
</div>
</div>
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-sm btn-primary" onClick={this.toggleInfoGlobaleModal}>Close</button>
</ModalFooter>
</Modal>:null
}
{
this.state.isAfficherContratsModal?
<Modal className='modal-lg modal-info' isOpen={this.state.isAfficherContratsModal} toggle={this.toggleAfficherContratsModal}>
<ModalHeader toggle={this.toggleAfficherContratsModal}>Afficher l'ensemble des Contrats</ModalHeader>
<ModalBody>
<div className="col-12">
<div className="card">
<div className="card-block p-3 clearfix">
<div className="btn-group float-right ">
<button type="button" className="btn btn-lg btn-link"><i className="icon-settings"></i></button>
</div>
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">Contrat 1</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Contrat</div>
</div>
</div>
</div>
<div className="col-12">
<div className="card">
<div className="card-block p-3 clearfix">
<div className="btn-group float-right ">
<button type="button" className="btn btn-lg btn-link"><i className="icon-settings"></i></button>
</div>
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">Contrat 2</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Contrat</div>
</div>
</div>
</div>
<div className="col-12">
<div className="card">
<div className="card-block p-3 clearfix">
<div className="btn-group float-right ">
<button type="button" className="btn btn-lg btn-link"><i className="icon-settings"></i></button>
</div>
<i className="fa fa-laptop bg-primary p-3 font-2xl mr-3 float-left"></i>
<div className="h5 text-info mb-0 mt-2">Contrat 3</div>
<div className="text-muted text-uppercase font-weight-bold font-xs">Contrat</div>
</div>
</div>
</div>
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-sm btn-primary" onClick={this.toggleAfficherContratsModal}>Close</button>
</ModalFooter>
</Modal>:null
}
{
this.state.isTransfererContratsModal?
<Modal className='modal-lg modal-danger' isOpen={this.state.isTransfererContratsModal} toggle={this.toggleTransfererContratsModal}>
<ModalHeader toggle={this.toggleTransfererContratsModal}>Transferer Contrats</ModalHeader>
<ModalBody>
<div className="row">
<div className="form-group col-12">
<label htmlFor="id_flotte">Flotte Origine</label>
<input type="input" className="form-control" id="id_flotte" placeholder="Flotte Origine" defaultValue={this.state.flotteConcerne["id_flotte"]} disabled/>
</div>
<div className="form-group col-12">
<label htmlFor="id_flotte">Flotte Destination</label>
<input type="input" className="form-control" id="id_flotte" placeholder="Flotte Destination"/>
</div>
<div className="form-group col-12">
<label htmlFor="selectContrats">Selectionner les Contrats</label>
<select multiple className="form-control" id="selectContrats" size="5">
<option>Contrat 1</option>
<option>Contrat 2</option>
<option>Contrat 3</option>
<option>Contrat 4</option>
<option>Contrat 5</option>
</select>
</div>
</div>
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-sm btn-success" onClick={this.toggleTransfererContratsModal}>Submit</button>
<button type="button" className="btn btn-sm btn-secondary" onClick={this.toggleTransfererContratsModal}>Cancel</button>
</ModalFooter>
</Modal>:null
}
</div>
);
}
}
/*
*/
|
src/svg-icons/social/public.js | barakmitz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialPublic = (props) => (
<SvgIcon {...props}>
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
</SvgIcon>
);
SocialPublic = pure(SocialPublic);
SocialPublic.displayName = 'SocialPublic';
SocialPublic.muiName = 'SvgIcon';
export default SocialPublic;
|
src/index.js | bsansouci/sixteen-fs | import React from 'react';
import { App } from './app';
React.render(<App />, document.getElementById('root'));
|
src/components/common/svg-icons/editor/format-size.js | abzfarah/Pearson.NAPLAN.GnomeH | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorFormatSize = (props) => (
<SvgIcon {...props}>
<path d="M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z"/>
</SvgIcon>
);
EditorFormatSize = pure(EditorFormatSize);
EditorFormatSize.displayName = 'EditorFormatSize';
EditorFormatSize.muiName = 'SvgIcon';
export default EditorFormatSize;
|
local-cli/templates/HelloNavigation/views/welcome/WelcomeText.android.js | gilesvangruisen/react-native | 'use strict';
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
export default class WelcomeText extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
This app shows the basics of navigating between a few screens,
working with ListView and handling text input.
</Text>
<Text style={styles.instructions}>
Modify any files to get started. For example try changing the
file views/welcome/WelcomeText.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: 'white',
padding: 20,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 16,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 12,
},
});
|
src/svg-icons/action/face.js | matthewoates/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionFace = (props) => (
<SvgIcon {...props}>
<path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"/>
</SvgIcon>
);
ActionFace = pure(ActionFace);
ActionFace.displayName = 'ActionFace';
ActionFace.muiName = 'SvgIcon';
export default ActionFace;
|
tp-4/sebareverso/src/pages/home/HomePage.js | jpgonzalezquinteros/sovos-reactivo-2017 | import React from 'react';
import { Layout, Icon } from 'antd';
const { Header, Content } = Layout;
const HomePage = () => (
<Layout>
<Header style={{ background: '#fff', padding: 0 }}>
<Icon
className="trigger"
/>
</Header>
<Content style={{ margin: '24px 16px', padding: 24, background: '#fff', minHeight: 280 }}>
Content
</Content>
</Layout>
);
export default HomePage;
|
src/components/Init.js | literarymachine/crg-ui | import React from 'react'
import PropTypes from 'prop-types'
import I18nProvider from './I18nProvider'
import EmittProvider from './EmittProvider'
import App from './App'
const Init = ({locales, emitter, data, user }) => (
<I18nProvider locales={locales}>
<EmittProvider emitter={emitter}>
<App data={data} user={user} />
</EmittProvider>
</I18nProvider>
)
Init.propTypes = {
emitter: PropTypes.objectOf(PropTypes.any).isRequired,
locales: PropTypes.arrayOf(PropTypes.string).isRequired,
data: PropTypes.objectOf(PropTypes.any).isRequired,
user: PropTypes.string
}
Init.defaultProps = {
user: null
}
export default Init
|
20161210/RN-test/src/pages/WebViewPage.js | fengnovo/react-native | import React, { Component } from 'react';
import {
StyleSheet,
PropTypes,
WebView,
BackAndroid,
Dimensions,
Text,
Image,
Platform,
TouchableOpacity,
View
} from 'react-native';
import CustomToolbar from '../components/CustomToolbar';
import {ToastShort} from '../utils/ToastUtils';
import LoadingView from '../components/LoadingView';
import {NaviGoBack} from '../utils/CommonUtils';
// import Portal from 'react-native/Libraries/Portal/Portal.js';
let tag;
var canGoBack = false;
class WebViewPage extends React.Component {
constructor (props) {
super(props);
this.onActionSelected = this.onActionSelected.bind(this);
this.onNavigationStateChange = this.onNavigationStateChange.bind(this);
this.goBack = this.goBack.bind(this);
}
componentWillMount () {
if (Platform.OS === 'android') {
// tag = Portal.allocateTag();
}
}
componentDidMount () {
BackAndroid.addEventListener('hardwareBackPress', this.goBack);
}
componentWillUnmount () {
BackAndroid.removeEventListener('hardwareBackPress', this.goBack);
}
onActionSelected () {
}
onNavigationStateChange (navState) {
canGoBack = navState.canGoBack;
}
goBack () {
// if (Portal.getOpenModals().length != 0) {
// Portal.closeModal(tag);
// return true;
// } else if (canGoBack) {
// this.refs.webview.goBack();
return true;
// }
return NaviGoBack(this.props.navigator);
}
renderLoading () {
return <LoadingView />;
}
render () {
const {navigator, route} = this.props;
return (
<View style={styles.container}>
<CustomToolbar
onActionSelected={this.onActionSelected}
title={route.reddit.data.title}
navigator={navigator}
/>
<WebView
ref='webview'
automaticallyAdjustContentInsets={false}
style={{flex: 1}}
source={{uri: route.reddit.data.url}}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
scalesPageToFit={true}
decelerationRate="normal"
onShouldStartLoadWithRequest={true}
onNavigationStateChange={this.onNavigationStateChange}
renderLoading={this.renderLoading.bind(this)}
/>
</View>
);
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column'
},
spinner: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(0, 0, 0, 0.65)'
},
spinnerContent: {
justifyContent: 'center',
width: Dimensions.get('window').width * (7 / 10),
height: Dimensions.get('window').width * (7 / 10) * 0.68,
backgroundColor: '#fcfcfc',
padding: 20,
borderRadius: 5
},
spinnerTitle: {
fontSize: 18,
color: '#313131',
textAlign: 'center'
},
shareContent: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center'
},
shareIcon: {
width: 40,
height: 40
}
});
export default WebViewPage; |
src/svg-icons/action/extension.js | skarnecki/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionExtension = (props) => (
<SvgIcon {...props}>
<path d="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"/>
</SvgIcon>
);
ActionExtension = pure(ActionExtension);
ActionExtension.displayName = 'ActionExtension';
export default ActionExtension;
|
demo/index.js | sapegin/react-pagify-preset-bootstrap | import React from 'react';
import ReactDOM from 'react-dom';
import hljs from 'highlight.js';
import App from './App.jsx';
const app = document.getElementsByClassName('demonstration')[0];
ReactDOM.render(<App />, app);
hljs.initHighlightingOnLoad();
|
src/views/Search.js | astrauka/expensable-r3 | import React from 'react';
export default class Search {
render() {
return (
<div>
<h1>Search</h1>
</div>
);
}
}
|
customView/node_modules/babel-plugin-react-transform/test/fixtures/code-class-extends-component-with-render-method/actual.js | TheKingOfNorway/React-Native | import React, { Component } from 'react';
class Foo extends Component {
render() {}
}
|
packages/react-router/modules/StaticRouter.js | d-oliveros/react-router | import warning from 'warning'
import invariant from 'invariant'
import React from 'react'
import PropTypes from 'prop-types'
import { addLeadingSlash, createPath, parsePath } from 'history/PathUtils'
import Router from './Router'
const normalizeLocation = (object) => {
const { pathname = '/', search = '', hash = '' } = object
return {
pathname,
search: search === '?' ? '' : search,
hash: hash === '#' ? '' : hash
}
}
const addBasename = (basename, location) => {
if (!basename)
return location
return {
...location,
pathname: addLeadingSlash(basename) + location.pathname
}
}
const stripBasename = (basename, location) => {
if (!basename)
return location
const base = addLeadingSlash(basename)
if (location.pathname.indexOf(base) !== 0)
return location
return {
...location,
pathname: location.pathname.substr(base.length)
}
}
const createLocation = (location) =>
typeof location === 'string' ? parsePath(location) : normalizeLocation(location)
const createURL = (location) =>
typeof location === 'string' ? location : createPath(location)
const staticHandler = (methodName) => () => {
invariant(
false,
'You cannot %s with <StaticRouter>',
methodName
)
}
const noop = () => {}
/**
* The public top-level API for a "static" <Router>, so-called because it
* can't actually change the current location. Instead, it just records
* location changes in a context object. Useful mainly in testing and
* server-rendering scenarios.
*/
class StaticRouter extends React.Component {
static propTypes = {
basename: PropTypes.string,
context: PropTypes.object.isRequired,
location: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object
])
}
static defaultProps = {
basename: '',
location: '/'
}
static childContextTypes = {
router: PropTypes.object.isRequired
}
getChildContext() {
return {
router: {
staticContext: this.props.context
}
}
}
createHref = (path) =>
addLeadingSlash(this.props.basename + createURL(path))
handlePush = (location) => {
const { basename, context } = this.props
context.action = 'PUSH'
context.location = addBasename(basename, createLocation(location))
context.url = createURL(context.location)
}
handleReplace = (location) => {
const { basename, context } = this.props
context.action = 'REPLACE'
context.location = addBasename(basename, createLocation(location))
context.url = createURL(context.location)
}
handleListen = () =>
noop
handleBlock = () =>
noop
componentWillMount() {
warning(
!this.props.history,
'<StaticRouter> ignores the history prop. To use a custom history, ' +
'use `import { Router }` instead of `import { StaticRouter as Router }`.'
)
}
render() {
const { basename, context, location, ...props } = this.props
const history = {
createHref: this.createHref,
action: 'POP',
location: stripBasename(basename, createLocation(location)),
push: this.handlePush,
replace: this.handleReplace,
go: staticHandler('go'),
goBack: staticHandler('goBack'),
goForward: staticHandler('goForward'),
listen: this.handleListen,
block: this.handleBlock
}
return <Router {...props} history={history}/>
}
}
export default StaticRouter
|
app/javascript/mastodon/components/avatar.js | WitchesTown/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from '../initial_state';
export default class Avatar extends React.PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
size: PropTypes.number.isRequired,
style: PropTypes.object,
inline: PropTypes.bool,
animate: PropTypes.bool,
};
static defaultProps = {
animate: autoPlayGif,
size: 20,
inline: false,
};
state = {
hovering: false,
};
handleMouseEnter = () => {
if (this.props.animate) return;
this.setState({ hovering: true });
}
handleMouseLeave = () => {
if (this.props.animate) return;
this.setState({ hovering: false });
}
render () {
const { account, size, animate, inline } = this.props;
const { hovering } = this.state;
const src = account.get('avatar');
const staticSrc = account.get('avatar_static');
let className = 'account__avatar';
if (inline) {
className = className + ' account__avatar-inline';
}
const style = {
...this.props.style,
width: `${size}px`,
height: `${size}px`,
backgroundSize: `${size}px ${size}px`,
};
if (hovering || animate) {
style.backgroundImage = `url(${src})`;
} else {
style.backgroundImage = `url(${staticSrc})`;
}
return (
<div
className={className}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
style={style}
/>
);
}
}
|
examples/InputRadio.js | jsbranco/react-materialize | import React from 'react';
import Input from '../src/Input';
export default
<div>
<Input name='group1' type='radio' value='red' label='Red' />
<Input name='group1' type='radio' value='yellow' label='Yellow' />
<Input name='group1' type='radio' value='green' label='Green' className='with-gap' />
<Input name='group1' type='radio' value='brown' label='Brown' disabled='disabled' />
</div>;
|
src/components/Common/ActivityStream.js | MattMcFarland/tw-client | import React from 'react';
import Widget from './Widget';
import moment from 'moment';
/*
<ul>
<li><span className="icon ion-chevron-down down"></span><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rhoncus dapibus urna quis posuere. </p></li>
<li><span className="icon ion-ios-chatboxes-outline blue"></span><p>Phasellus pulvinar magna a massa maximus imperdiet. Sed sed sagittis eros, vel cursus neque. In sodales ipsum id turpis viverra, et venenatis diam tincidunt.</p></li>
<li><span className="icon ion-chevron-up up"></span><p>Maecenas justo odio, tempus sed velit sed, mattis fermentum lorem. Sed placerat nisi vitae ante blandit, et volutpat massa cursus. </p></li>
<li><span className="icon ion-document blue"></span><p>onec nunc ipsum, laoreet non velit non, lobortis pellentesque felis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam ultricies neque eu arcu tincidunt, eu venenatis orci cursus.</p></li>
</ul>
*/
const actvityStream = (state = [], action) => {
var length = (state.activities && state.activities.length ? state.activities.length : 0);
switch(action.type) {
case "ADD_ACTIVITY":
if (length < 20) {
return Object.assign({}, state, {
activities: [
{
...action.data
},
...state.activities
]
})
} else {
return Object.assign({}, state, {
activities: [
{
...action.data
},
...state.activities.slice(0, 19)
]
})
}
break;
default:
return state;
break;
}
};
const getIcon = (action, user) => {
switch (action) {
case "voteUp":
return (<a data-tipsy={user + ' voted up...'} className="tipsy tipsy--w"><span className="icon ion-chevron-up up"/></a>);
break;
case "undoVoteUp":
return (<a data-tipsy={user + ' took back their vote...'} className="tipsy tipsy--w"><span className="icon ion-chevron-up down"/></a>);
break;
case "voteDown":
return (<a data-tipsy={user + ' voted down...'} className="tipsy tipsy--w"><span className="icon ion-chevron-down down"/></a>);
break;
case "undoVoteDown":
return (<a data-tipsy={user + ' took back their vote...'} className="tipsy tipsy--w"><span className="icon ion-chevron-down up"/></a>);
break;
case "addCommentToTutorialRequest":
return (<a data-tipsy={user + ' commented on a request.'} className="tipsy tipsy--w"><span className="icon ion-ios-chatboxes-outline"/></a>);
break;
case "addCommentToTutorialSolution":
return (<a data-tipsy={user + ' commented on a tutorial.'} className="tipsy tipsy--w"><span className="icon ion-ios-chatboxes-outline"/></a>);
break;
case "addSolution":
return (<a data-tipsy={user + ' posted a tutorial.'} className="tipsy tipsy--w"><span className="icon ion-document up"/></a>);
break;
default:
return (<a data-tipsy={user + ' posted...'} className="tipsy tipsy--w"><span className="icon ion-document blue"/></a>);
break;
}
}
export default class ActivityStream extends React.Component {
constructor (props) {
super(props);
if (localStorage.activities) {
this.state = {
activities: JSON.parse(localStorage.activities)
}
} else {
this.state = {
activities: []
}
}
}
componentDidMount () {
window.socket.on('action', (data) => {
var newState = actvityStream(this.state, {type: 'ADD_ACTIVITY', data});
console.log('newState', newState);
localStorage.activities = JSON.stringify(newState.activities);
this.setState(newState);
})
}
render () {
return (
<div>
<Widget title="Activity Stream" icon="ion-ios-pulse-strong" addClass="activity-stream">
<ul>
{this.state.activities.map((activity, index) => (
<li key={index}>
{getIcon(activity.action, activity.user)}
<p>{activity.excerpt}</p>
<footer>
<span>{activity.user}</span>
<a href={activity.href}>{moment(activity.timestamp).fromNow()}</a>
</footer>
</li>
))}
</ul>
</Widget>
</div>
);
}
}
|
actor-apps/app-web/src/app/components/dialog/messages/Document.react.js | Dreezydraig/actor-platform | import React from 'react';
import classnames from 'classnames';
class Document extends React.Component {
static propTypes = {
content: React.PropTypes.object.isRequired,
className: React.PropTypes.string
};
constructor(props) {
super(props);
}
render() {
const { content, className } = this.props;
const documentClassName = classnames(className, 'row');
let availableActions;
if (content.isUploading === true) {
availableActions = <span>Loading...</span>;
} else {
availableActions = <a href={content.fileUrl}>Download</a>;
}
return (
<div className={documentClassName}>
<div className="document row">
<div className="document__icon">
<i className="material-icons">attach_file</i>
</div>
<div className="col-xs">
<span className="document__filename">{content.fileName}</span>
<div className="document__meta">
<span className="document__meta__size">{content.fileSize}</span>
<span className="document__meta__ext">{content.fileExtension}</span>
</div>
<div className="document__actions">
{availableActions}
</div>
</div>
</div>
<div className="col-xs"></div>
</div>
);
}
}
export default Document;
|
addons/info/.storybook/config.js | enjoylife/storybook | import React from 'react';
import { configure, setAddon, addDecorator } from '@storybook/react';
import InfoAddon from '../src/';
addDecorator((story) => (
<div style={{padding: 20}}>
{story()}
</div>
));
setAddon(InfoAddon);
configure(function () {
require('../example/story');
}, module);
|
src/browser/intl/IntlPage.react.js | abelaska/este | import Helmet from 'react-helmet';
import Locales from './Locales.react';
import React, { Component } from 'react';
import linksMessages from '../../common/app/linksMessages';
import {
FormattedDate,
FormattedMessage,
FormattedNumber,
FormattedRelative,
defineMessages,
} from 'react-intl';
const messages = defineMessages({
h2: {
defaultMessage: 'react-intl demonstration',
id: 'intl.page.h2',
},
unreadCount: {
defaultMessage: `{unreadCount, plural,
one {message}
other {messages}
}`,
id: 'intl.page.unreadCount',
},
});
export default class IntlPage extends Component {
constructor() {
super();
this.componentRenderedAt = Date.now();
}
render() {
// To remember beloved −123 min. https://www.youtube.com/watch?v=VKOv1I8zKso
const unreadCount = 123;
return (
<div className="intl-page">
<FormattedMessage {...linksMessages.intl}>
{message =>
<Helmet title={message} />
}
</FormattedMessage>
<h2>
<FormattedMessage {...messages.h2} />
</h2>
<Locales />
<p>
<FormattedDate
value={Date.now()}
day="numeric"
month="long"
year="numeric"
formatMatcher="basic" // while this bug remains in react-intl: https://github.com/andyearnshaw/Intl.js/issues/179
/>
</p>
<p>
<FormattedNumber value={unreadCount} /> {' '}
<FormattedMessage {...messages.unreadCount} values={{ unreadCount }} />
</p>
<p>
<FormattedRelative
initialNow={this.componentRenderedAt}
updateInterval={1000 * 1}
value={this.componentRenderedAt}
/>
</p>
</div>
);
}
}
|
src/docs/TocHeader.js | FredBoat/fredboat.com | import React, { Component } from 'react';
import {Link} from 'react-router-dom'
import "./css/TocHeader.css";
class TocHeader extends Component {
render() {
if (this.props.activePage === this.props.page) {
document.title = this.props.name;
if (this.props.name === "Quickstart") document.title = "Commands";
}
return (
<div className="TocHeader">
<Link to={"/docs/" + this.props.page}>
<h1 className={this.props.activePage === this.props.page ? "active" : ""}>
{this.props.name}
</h1>
</Link>
</div>
)
}
}
export default TocHeader; |
src/Select/Async.js | agutoli/react-styled-select | import React from 'react'
import PropTypes from 'prop-types'
class SelectAsync extends React.PureComponent {
constructor(props) {
super(props)
this.state = {
isLoading: false,
options: props.options
}
}
loadOptions = (term) => {
const { loadOptions } = this.props
const callback = (error, data) => {
const options = data && data.options || [];
if (callback === this._callback) {
this._callback = null;
this.setState({
isLoading: false,
options
});
}
}
this._callback = callback
const promise = loadOptions(term, callback);
if (promise) {
promise.then(
(data) => callback(null, data),
(error) => callback(error)
);
}
if ( this._callback && !this.state.isLoading ) {
this.setState({
isLoading: true
});
}
}
render() {
return React.cloneElement(this.props.children, Object.assign({}, this.props, {
options: this.state.options,
onTyping: this.loadOptions
}))
}
}
SelectAsync.propTypes = {
autoload: PropTypes.bool.isRequired,
ignoreAccents: PropTypes.bool,
ignoreCase: PropTypes.bool,
loadOptions: PropTypes.func.isRequired
}
SelectAsync.defaultProps = {
loadOptions: () => {}
}
export default SelectAsync
|
src/svg-icons/action/trending-up.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionTrendingUp = (props) => (
<SvgIcon {...props}>
<path d="M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"/>
</SvgIcon>
);
ActionTrendingUp = pure(ActionTrendingUp);
ActionTrendingUp.displayName = 'ActionTrendingUp';
ActionTrendingUp.muiName = 'SvgIcon';
export default ActionTrendingUp;
|
test/fixtures/basic/pages/css.js | dstreet/next.js | import React from 'react'
import style from 'next/css'
export default () => <div className={styles}>This is red</div>
const styles = style({ color: 'red' })
|
awsmobilecognitocustomui/App.js | adrianhall/blog-code | import React from 'react';
import { StackNavigator } from 'react-navigation';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';
import uuid from 'uuid';
import { persistor, store } from './src/redux/store';
import TaskDetailsScreen from './src/redux/components/ConnectedTaskDetailsScreen';
import TaskListScreen from './src/redux/components/ConnectedTaskListScreen';
import Loading from './src/components/Loading';
import Amplify from 'aws-amplify-react-native';
import awsmobile from './src/aws-exports';
Amplify.configure(awsmobile);
Auth.configure({ autoRefresh: false });
/**
* Wrapper helper to map the navigation params to props. it also adds the appropriate
* event handlers to ensure that navigation continues to work properly.
*
* @param {React.Component} Component the component to wrap
*/
const mapParamsToProps = (WrappedComponent) => {
return class extends React.Component {
render() {
const { navigation, ...props } = this.props;
const { state: { params }} = navigation;
const eventHandlers = {
onBack: () => { navigation.goBack(); },
onAddTask: () => { navigation.navigate('details', { taskId: uuid.v4() }); },
onViewTask: (item) => { navigation.navigate('details', { taskId: item.taskId }); }
};
return <WrappedComponent {...eventHandlers} {...props} {...params} />;
}
};
};
const App = (props) => {
const routeConfig = {
'master': { screen: mapParamsToProps(TaskListScreen) },
'details': { screen: mapParamsToProps(TaskDetailsScreen) }
};
const navigatorOptions = {
initialRoute: 'master',
headerMode: 'none'
};
const Navigator = StackNavigator(routeConfig, navigatorOptions);
return (
<Provider store={store}>
<PersistGate persistor={persistor} loading={<Loading/>}>
<Navigator/>
</PersistGate>
</Provider>
);
};
export default App;
|
client/src/Components/oldMasterForm/FinancialInfo.js | teamcrux/EmploymentOptions | import React from 'react';
import { Field } from 'redux-form';
const FinancialInfo = () => {
return (
<div className="section">
<div>
<label htmlFor="consulted">Have you consulted a benefits professional?</label>
<label><Field name="consulted" id="consulted" component="input" type="checkbox"/> Yes</label>
</div>
<div>
<label htmlFor="fin_exp">Are you aware if/how this will help with your employment search? Explain</label>
<Field name="fin_exp" component="input" type="text"/>
</div>
</div>
)
}
export default FinancialInfo
|
src/Topic.js | rdwrcode/myreact-demo | import React from 'react'
const Topic = ({ params }) => (
<div>
<h3>{params.topicId}</h3>
</div>
)
export default Topic
|
carbon-page/stories/task/card.js | ShotaOd/Carbon | import React, { Component } from 'react';
import Card from '../../src/task/Card';
export default story => {
story.add('Card', () => <div className="row">
<div className="col s3">
<Card title="testtest" text="storybook render properly" point={10} />
</div>
<div className="col s3">
<Card title="testtest" text="storybook render properly" point={10} />
</div>
<div className="col s3">
<Card title="testtest" text="storybook render properly" point={10} />
</div>
<div className="col s3">
<Card title="testtest" text="storybook render properly" point={10} />
</div>
</div>);
};
|
app/react-icons/fa/glass.js | scampersand/sonos-front | import React from 'react';
import IconBase from 'react-icon-base';
export default class FaGlass extends React.Component {
render() {
return (
<IconBase viewBox="0 0 40 40" {...this.props}>
<g><path d="m37.9 4.2q0 0.7-0.9 1.7l-14.1 14.1v17.1h7.1q0.6 0 1 0.5t0.4 1-0.4 1-1 0.4h-20q-0.6 0-1-0.4t-0.4-1 0.4-1 1-0.5h7.1v-17.1l-14.1-14.1q-0.9-1-0.9-1.7 0-0.6 0.4-0.9t0.8-0.4 1 0h31.4q0.5 0 1 0t0.8 0.4 0.4 0.9z"/></g>
</IconBase>
);
}
}
|
examples/src/js/index.js | gevorgmakaryan/react-range-scale | /*jshint esversion: 6 */
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
(function () {
ReactDOM.render(<App />, document.getElementById('app'));
})();
|
src/components/Features.js | liron-navon/liron-navon.github.io | import React from 'react'
import PropTypes from 'prop-types'
import PreviewCompatibleImage from '../components/PreviewCompatibleImage'
const FeatureGrid = ({ gridItems }) => (
<div className="columns is-multiline">
{gridItems.map(item => (
<div key={item.text} className="column is-6">
<section className="section">
<div className="has-text-centered">
<div
style={{
width: '240px',
display: 'inline-block',
}}
>
<PreviewCompatibleImage imageInfo={item} />
</div>
</div>
<p>{item.text}</p>
</section>
</div>
))}
</div>
)
FeatureGrid.propTypes = {
gridItems: PropTypes.arrayOf(
PropTypes.shape({
image: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
text: PropTypes.string,
})
),
}
export default FeatureGrid
|
src/routes.js | nordsoftware/react-starter | import React from 'react';
import { IndexRoute, Route } from 'react-router';
import { requireAuth, requireGuest } from './helpers/auth';
import { HelloContainer } from './components/hello/hello';
import { LoginContainer } from './components/login/login';
import { LogoutContainer } from './components/logout/logout';
import { NotFound } from './components/not-found/not-found';
export default () => (
<Route path="/">
<IndexRoute component={HelloContainer}/>
<Route path="login" component={LoginContainer} onEnter={requireGuest}/>
<Route path="logout" component={LogoutContainer} onEnter={requireAuth}/>
<Route path="*" component={NotFound}/>
</Route>
);
|
src/component/dictation-container/index.js | SpenGietz/dictate-it | import React from 'react';
import {connect} from 'react-redux';
import {Link, Redirect} from 'react-router-dom';
import {dictationFetchAllRequest, dictationDeleteRequest} from '../../action/dictation-actions.js';
import * as util from '../../lib/util';
import superagent from 'superagent';
export class DictationContainer extends React.Component {
constructor(props){
super(props);
this.state = {
ownerId: '',
};
this.handleDeleteDictation = this.handleDeleteDictation.bind(this);
this.getUserFromToken = this.getUserFromToken.bind(this);
}
getUserFromToken(token) {
return superagent.get(`${__API_URL__}/user`)
.set('Authorization', `Bearer ${token}`)
.then(res => {
this.setState({ ownerId: res.body._id });
return res;
});
}
componentWillMount() {
util.log(this.props);
this.props.getAllDictations()
this.getUserFromToken(this.props.token)
.catch(err => util.logError(err));
}
handleDeleteDictation(event) {
event.preventDefault();
this.props.dictationDelete(event.target.id)
// .then(() => this.props.getAllDictations())
// .catch(err => util.logError(err));
this.props.getAllDictations();
}
render() {
util.log('asdasdas', this.props.dictations)
return (
<div>
{util.renderIf(!this.props.token,
<Redirect to='/' />
)}
<table className="my-dictations-container">
<thead>
<tr>
<th colSpan={3}>My Dictations</th>
</tr>
</thead>
<tbody>
{this.props.dictations.filter(dictation => dictation.ownerId === this.state.ownerId).map((dictation, i) =>
dictation._id ? <tr key={i}>
<td>
<button onClick={this.handleDeleteDictation} id={dictation._id}>X</button>
</td>
<td>
<Link to={`/dictation/${dictation._id}`}>{dictation.title}</Link>
</td>
<td>
{dictation.description}
</td>
</tr>
: undefined
)}
</tbody>
</table>
<table className="all-dictations-container">
<thead>
<tr>
<th colSpan={2}>Public Dictations</th>
</tr>
</thead>
<tbody>
{this.props.dictations.map((dictation, i) => {
return <tr key={i}>
<td>
<Link to={`/dictation/${dictation._id}`}>{dictation.title}</Link>
</td>
<td>
{dictation.description}
</td>
</tr>
})}
</tbody>
</table>
</div>
);
}
}
export const mapStateToProps = (state) => ({
token: state.token,
dictations: state.dictations ? state.dictations || []: [],
});
export const mapDispatchToProps = (dispatch) => ({
getAllDictations: () => dispatch(dictationFetchAllRequest()),
dictationDelete: id => dispatch(dictationDeleteRequest(id)),
});
export default connect(mapStateToProps, mapDispatchToProps)(DictationContainer);
|
src/svg-icons/action/find-in-page.js | ArcanisCz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionFindInPage = (props) => (
<SvgIcon {...props}>
<path d="M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"/>
</SvgIcon>
);
ActionFindInPage = pure(ActionFindInPage);
ActionFindInPage.displayName = 'ActionFindInPage';
ActionFindInPage.muiName = 'SvgIcon';
export default ActionFindInPage;
|
js/components/App.react.js | tholapz/caverna | /**
*
* App.react.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*/
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Logo from '../../img/logo.jpg';
class App extends Component {
render() {
return (
<div className="wrapper">
<img className="logo" src={Logo} />
{ this.props.children }
</div>
);
}
}
// REDUX STUFF
// Which props do we want to inject, given the global state?
function select(state) {
return {
data: state
};
}
// Wrap the component to inject dispatch and state into it
export default connect(select)(App);
|
src/server/middlewares/router.js | arvigeus/studentlife | import React from 'react';
import { renderToStaticMarkup, renderToString } from 'react-dom/server';
import IsomorphicRouter from 'isomorphic-relay-router';
import createMemoryHistory from 'react-router/lib/createMemoryHistory';
import match from 'react-router/lib/match';
import { DefaultNetworkLayer } from 'react-relay';
import Helmet from 'react-helmet';
import { Settings, Analytics } from '../config';
import Html from '../../components/Html';
import routes from '../../routes';
const { serverUrl, graphqlUrl } = Settings;
// eslint-disable-next-line import/no-dynamic-require
const clientAssets = require(KYT.ASSETS_MANIFEST);
// TODO: https://www.npmjs.com/package/spider-detector
// Setup server side routing.
export default (req, res, next) => {
const history = createMemoryHistory(req.originalUrl);
match({ routes, history, location: req.url }, (error, redirectLocation, renderProps) => {
if (error) {
res.status(500).send(error.message);
} else if (redirectLocation) {
res.redirect(302, `${redirectLocation.pathname}${redirectLocation.search}`);
} else if (renderProps) {
IsomorphicRouter
.prepareData(renderProps, new DefaultNetworkLayer(serverUrl + graphqlUrl))
.then(({ data, props }) => {
// When a React Router route is matched then we render
// the components and assets into the template.
const markup = renderToString(IsomorphicRouter.render(props));
const { title, meta } = Helmet.rewind();
res.status(200).send(`<!DOCTYPE html>\n${renderToStaticMarkup(
<Html
title={title}
meta={meta}
cssUri={clientAssets.main.css}
data={data}
jsUri={clientAssets.main.js}
markup={markup}
settings={{ Settings }}
analytics={Analytics}
/>
)}`);
}).catch(next);
} else {
res.status(404).send('Not Found');
}
});
};
|
client/src/components/GoogleMap/GoogleMapContainer.js | bwuphan/raptor-ads | import React, { Component } from 'react';
import { connect } from 'react-redux';
import GoogleMapRender from './GoogleMap';
import { changeMarkerShowInfo } from '../../actions/googleMapActions';
class GoogleMapContainer extends Component {
constructor(props) {
super(props);
this.handleInfoWindow = this.handleInfoWindow.bind(this);
}
handleInfoWindow(targetMarker, index) {
this.props.dispatch(changeMarkerShowInfo(index));
}
render() {
const { center, markers } = this.props;
return (
<div style={{height: '100%'}}>
<GoogleMapRender
containerElement={
<div style={{ height: '300px' }} />
}
mapElement={
<div style={{ height: '100%' }} />
}
defaultCenter={center}
markers={markers}
handleInfoWindow={this.handleInfoWindow}
/>
</div>
);
}
}
const mapStateToProps = (state) => {
const { center } = state.googleMap;
return { center };
};
export default connect(mapStateToProps)(GoogleMapContainer);
|
stories/components/tabs.stories.js | LN-Zap/zap-desktop | import React from 'react'
import { storiesOf } from '@storybook/react'
import { Tabs } from 'components/UI'
storiesOf('Components', module).addWithChapters('Tabs', {
subtitle: 'List of buttons formatted as tabs',
chapters: [
{
sections: [
{
sectionFn: () => (
<Tabs
items={[
{ key: 'all', name: 'All' },
{ key: 'sent', name: 'Send' },
{ key: 'received', name: 'Received' },
{ key: 'pending', name: 'Pending' },
]}
/>
),
},
],
},
],
})
|
src/app/index.js | nileshp-cuelogic/react-redux-training | import React from 'react'
import { render } from "react-dom"
import store from './store/store'
import { Provider } from 'react-redux'
import { App } from './components/App'
render(<Provider store={store}><App /></Provider>, document.getElementById('div-app')); |
src/components/app.js | jeffgietz/rr_weather | import React, { Component } from 'react';
// App
// Searchbar
import SearchBar from '../containers/search_bar';
// ForecastList
import WeatherList from '../containers/weather_list';
// Chart
export default class App extends Component {
render() {
return (
<div>
<SearchBar />
<WeatherList />
</div>
);
}
}
|
src/components/SegmentedControl.js | apisandipas/elemental | import classnames from 'classnames';
import React from 'react';
module.exports = React.createClass({
displayName: 'SegmentedControl',
propTypes: {
className: React.PropTypes.string,
equalWidthSegments: React.PropTypes.bool,
onChange: React.PropTypes.func.isRequired,
options: React.PropTypes.array.isRequired,
type: React.PropTypes.oneOf(['default', 'muted', 'danger', 'info', 'primary', 'success', 'warning']),
value: React.PropTypes.string
},
getDefaultProps () {
return {
type: 'default'
};
},
onChange (value) {
this.props.onChange(value);
},
render () {
let componentClassName = classnames('SegmentedControl', ('SegmentedControl--' + this.props.type), {
'SegmentedControl--equal-widths': this.props.equalWidthSegments
}, this.props.className);
let options = this.props.options.map((op) => {
let buttonClassName = classnames('SegmentedControl__button', {
'is-selected': op.value === this.props.value
});
return (
<span key={'option-' + op.value} className="SegmentedControl__item">
<button type="button" onClick={this.onChange.bind(this, op.value)} className={buttonClassName}>
{op.label}
</button>
</span>
);
});
return <div className={componentClassName}>{options}</div>;
}
});
|
jenkins-design-language/src/js/components/material-ui/svg-icons/notification/do-not-disturb-off.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const NotificationDoNotDisturbOff = (props) => (
<SvgIcon {...props}>
<path d="M17 11v2h-1.46l4.68 4.68C21.34 16.07 22 14.11 22 12c0-5.52-4.48-10-10-10-2.11 0-4.07.66-5.68 1.78L13.54 11H17zM2.27 2.27L1 3.54l2.78 2.78C2.66 7.93 2 9.89 2 12c0 5.52 4.48 10 10 10 2.11 0 4.07-.66 5.68-1.78L20.46 23l1.27-1.27L11 11 2.27 2.27zM7 13v-2h1.46l2 2H7z"/>
</SvgIcon>
);
NotificationDoNotDisturbOff.displayName = 'NotificationDoNotDisturbOff';
NotificationDoNotDisturbOff.muiName = 'SvgIcon';
export default NotificationDoNotDisturbOff;
|
src/Hexagon/Text.js | Hellenic/react-hexgrid | import React, { Component } from 'react';
import PropTypes from 'prop-types';
// TODO Text is a separate component so that it could wrap the given text inside the surrounding hexagon
class Text extends Component {
static propTypes = {
children: PropTypes.string,
x: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
y: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
className: PropTypes.string
};
render() {
const { children, x, y, className } = this.props;
return (
<text x={x || 0} y={y ? y : '0.3em'} className={className} textAnchor="middle">{children}</text>
);
}
}
export default Text;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.