path
stringlengths 5
195
| repo_name
stringlengths 5
79
| content
stringlengths 25
1.01M
|
---|---|---|
ui/js/pages/event/EventPreview.js | ericsoderberg/pbc-web | import React from 'react';
import PropTypes from 'prop-types';
import PageHeader from '../../components/PageHeader';
import EventContents from './EventContents';
const EventPreview = (props) => {
const { item } = props;
const event = item;
return (
<main className="page-preview">
<PageHeader title="Preview" />
<EventContents item={event} />
</main>
);
};
EventPreview.propTypes = {
item: PropTypes.object.isRequired,
};
export default EventPreview;
|
client/app/components/Cell.js | jfanderson/KIM | import React from 'react';
import classnames from 'classnames';
import sign from '../services/sign.js';
const PropTypes = React.PropTypes;
class Cell extends React.Component {
constructor() {
super();
this.state = {
editing: false,
value: '',
};
}
//-----------------------------------
// RENDERING
//-----------------------------------
render() {
let props = this.props;
let state = this.state;
let classes = {
[props.className]: props.className,
};
if (props.modifyField && state.editing) {
return (
<td className="editing">
<input autoFocus type="text"
ref="inputField"
value={state.value}
list="items"
onKeyDown={this._handleKeyDown.bind(this)}
onChange={this._handleChange.bind(this)}
onBlur={this._handleBlur.bind(this)}
/>
<datalist id="items">
{props.datalist.map(item =>
<option key={item} value={item} />
)}
</datalist>
</td>
);
} else if (props.modifyField) {
classes.editable = true;
return (
<td className={classnames(classes)} onClick={this._startEditing.bind(this)}>
{props.children}
</td>
);
}
return (
<td className={classnames(classes)} onClick={props.onClick}>
{props.children}
</td>
);
}
//-----------------------------------
// PRIVATE METHODS
//-----------------------------------
_handleBlur() {
this.setState({ editing: false });
}
_handleChange(event) {
this.setState({ value: event.target.value });
}
_handleKeyDown(event) {
let props = this.props;
let state = this.state;
if (event.keyCode === 13) {
// Validation
if (props.number || props.price || props.pricePerUnit || props.integer) {
if (isNaN(Number(state.value))) {
sign.setError('Value must be a number');
return;
} else if (props.integer && state.value % 1 !== 0) {
sign.setError('Value must be a whole number');
return;
}
}
props.modifyField(state.value);
this.setState({ editing: false });
} else if (event.keyCode === 27) {
this.setState({ editing: false });
}
}
_startEditing() {
let props = this.props;
// Trim dollar signs or units as necessary, so only numerical value is left.
if (props.price) {
this.setState({
editing: true,
value: props.children.slice(1),
});
} else if (props.pricePerUnit) {
this.setState({
editing: true,
value: props.children.slice(1, props.children.indexOf('/') - 1),
});
} else {
this.setState({
editing: true,
value: props.children || '',
});
}
setTimeout(() => {
this.refs.inputField.select();
}, 0);
}
}
Cell.propTypes = {
// Contents of the Cell.
children: PropTypes.node,
className: PropTypes.string,
// List of items for input autocomplete.
datalist: PropTypes.array,
// True if value must be an integer.
integer: PropTypes.bool,
// If passed, make cell editable on click.
// Callback invoked with new cell value.
modifyField: PropTypes.func,
// True if cell represents a numerical value.
number: PropTypes.bool,
// onClick function can only be applied to non-editable cells.
onClick: PropTypes.func,
// True if cell represents a price value.
price: PropTypes.bool,
// True if cell represents a price per unit value.
pricePerUnit: PropTypes.bool,
};
Cell.defaultProps = {
datalist: [],
int: false,
price: false,
pricePerUnit: false,
};
export default Cell;
|
src/components/Landing/Landing.js | NeversSync/gongfutea-v2 | import React, { Component } from 'react';
import styled from 'styled-components';
import backgroundImage from '../../assets/img/tetsu2.png';
import List from '../List/List';
import Map from '../Map/Map';
const Wrapper = styled.div`
height: 1900px;
`;
const BackgroundImage = styled.div`
background: url(${backgroundImage});
background-size: cover;
background-repeat: no-repeat;
`;
const HeaderContainer = styled.div`
height: 98vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
color: white;
`;
const PlacesWrapper = styled.div`
display: flex;
flex-direction: row;
`;
const Title = styled.h1`
font-weight: 400;
font-size: 5em;
`;
const SubHeader = styled.h2`
font-size: 2em;
font-weight: 400;
`;
class Main extends Component {
render() {
const { user, locations } = this.props;
return (
<Wrapper>
<BackgroundImage>
<HeaderContainer>
<Title>GONG FU TEA</Title>
<SubHeader>A site for tea lovers</SubHeader>
</HeaderContainer>
</BackgroundImage>
<PlacesWrapper>
<List locations={locations} />
<Map locations={locations}/>
</PlacesWrapper>
</Wrapper>
);
}
}
export default Main;
|
src/svg-icons/action/view-carousel.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionViewCarousel = (props) => (
<SvgIcon {...props}>
<path d="M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z"/>
</SvgIcon>
);
ActionViewCarousel = pure(ActionViewCarousel);
ActionViewCarousel.displayName = 'ActionViewCarousel';
ActionViewCarousel.muiName = 'SvgIcon';
export default ActionViewCarousel;
|
components/Tether/Tether.story.js | rdjpalmer/bloom | import React from 'react';
import { storiesOf } from '@storybook/react';
import Tether, { VERTICAL_ATTACHMENTS, HORIZONTAL_ATTACHMENTS } from './Tether';
const tetherStories = storiesOf('Tether', module)
.add('Tether left top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether center top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.CENTER }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether right top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether right center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether right bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'right',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether center bottom', () => (
<div
style={ {
marginTop: '98vh',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.CENTER }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether left bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'left',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether left center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether center center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.CENTER }
active
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
));
tetherStories
.add('Tether flushHorizontal left top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushHorizontal right top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushHorizontal right center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushHorizontal right bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'right',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushHorizontal left bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'left',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushHorizontal left center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
));
tetherStories
.add('Tether flushVertical left top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushVertical
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical right top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushVertical
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical right center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushVertical
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical right bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'right',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushVertical
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical left bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'left',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushVertical
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical left center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushVertical
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
));
tetherStories
.add('Tether flushVertical flushHorizontal left top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushVertical
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical flushHorizontal right top', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.TOP }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushVertical
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical flushHorizontal right center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushVertical
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical flushHorizontal right bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'right',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.RIGHT }
active
flushVertical
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical flushHorizontal left bottom', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'left',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.BOTTOM }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushVertical
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
))
.add('Tether flushVertical flushHorizontal left center', () => (
<div
style={ {
marginTop: '10rem',
height: '100vh',
textAlign: 'center',
} }
>
<Tether
target={ <button>Anchor</button> }
verticalAttachment={ VERTICAL_ATTACHMENTS.CENTER }
horizontalAttachment={ HORIZONTAL_ATTACHMENTS.LEFT }
active
flushVertical
flushHorizontal
>
<div
style={ {
width: '100px',
height: '100px',
backgroundColor: 'rgba(255, 185, 197, 0.5)',
} }
/>
</Tether>
</div>
));
|
docs/src/app/components/pages/components/SelectField/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 selectFieldReadmeText from './README';
import SelectFieldExampleSimple from './ExampleSimple';
import selectFieldExampleSimpleCode from '!raw!./ExampleSimple';
import SelectFieldLongMenuExample from './ExampleLongMenu';
import selectFieldLongMenuExampleCode from '!raw!./ExampleLongMenu';
import SelectFieldExampleCustomLabel from './ExampleCustomLabel';
import selectFieldExampleCustomLabelCode from '!raw!./ExampleCustomLabel';
import SelectFieldExampleFloatingLabel from './ExampleFloatingLabel';
import selectFieldExampleFloatingLabelCode from '!raw!./ExampleFloatingLabel';
import SelectFieldExampleError from './ExampleError';
import selectFieldExampleErrorCode from '!raw!./ExampleError';
import selectFieldCode from '!raw!material-ui/lib/SelectField/SelectField';
const descriptions = {
simple: '`SelectField` is implemented as a controlled component, with the current selection set through the ' +
'`value` property. The `SelectField` can be disabled with the `disabled` property.',
long: 'With the `maxHeight` property set, the Select Field will be scrollable if the number of items causes the ' +
'height to exceed this limit.',
label: 'With a `label` applied to each `MenuItem`, `SelectField` displays a complementary description of the ' +
'selected item.',
floating: '`SelectField` supports a floating label with the `floatingLabelText` property. This can be customised ' +
'with `the floatingLabelText` property.',
errorText: 'The `errorText` property displays an error message below the Select Field. This can be customised with ' +
'the `errorStyle` property.',
};
const SelectFieldPage = () => (
<div>
<Title render={(previousTitle) => `Select Field - ${previousTitle}`} />
<MarkdownElement text={selectFieldReadmeText} />
<CodeExample
title="Simple examples"
description={descriptions.simple}
code={selectFieldExampleSimpleCode}
>
<SelectFieldExampleSimple />
</CodeExample>
<CodeExample
title="Long example"
description={descriptions.long}
code={selectFieldLongMenuExampleCode}
>
<SelectFieldLongMenuExample />
</CodeExample>
<CodeExample
title="Label example"
description={descriptions.label}
code={selectFieldExampleCustomLabelCode}
>
<SelectFieldExampleCustomLabel />
</CodeExample>
<CodeExample
title="Floating label example"
description={descriptions.floating}
code={selectFieldExampleFloatingLabelCode}
>
<SelectFieldExampleFloatingLabel />
</CodeExample>
<CodeExample
title="ErrorText example"
description={descriptions.errorText}
code={selectFieldExampleErrorCode}
>
<SelectFieldExampleError />
</CodeExample>
<PropTypeDescription code={selectFieldCode} />
</div>
);
export default SelectFieldPage;
|
src/assets/js/react/components/Template/TemplateCloseDialog.js | blueliquiddesigns/gravity-forms-pdf-extended | import React from 'react'
import PropTypes from 'prop-types'
import { withRouter } from 'react-router-dom'
/**
* Renders our close dialog element
*
* @package Gravity PDF
* @copyright Copyright (c) 2020, Blue Liquid Designs
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 4.1
*/
/**
* React Component
*
* @since 4.1
*/
export class TemplateCloseDialog extends React.Component {
/**
* @since 4.1
*/
static propTypes = {
history: PropTypes.object,
closeRoute: PropTypes.string
}
/**
* Assign keydown listener to document on mount
*
* @since 4.1
*/
componentDidMount () {
document.addEventListener('keydown', this.handleKeyPress, false)
}
/**
* Remove keydown listener to document on mount
*
* @since 4.1
*/
componentWillUnmount () {
document.removeEventListener('keydown', this.handleKeyPress, false)
}
/**
* Check if Escape key pressed and current event target isn't our search box,
* or the search box is blank already
*
* @param {Object} e Event
*
* @since 4.1
*/
handleKeyPress = (e) => {
/* Escape Key */
if (e.keyCode === 27 && (e.target.className !== 'wp-filter-search' || e.target.value === '')) {
this.closeDialog()
}
}
/**
* @since 4.1
*/
closeDialog = () => {
/* trigger router */
this.props.history.push(this.props.closeRoute || '/')
}
/**
* @since 4.1
*/
render () {
return (
<button
className="close dashicons dashicons-no"
tabIndex="142"
onClick={this.closeDialog}
onKeyDown={this.handleKeyPress}
aria-label="close">
<span className="screen-reader-text">Close dialog</span>
</button>
)
}
}
export default withRouter(TemplateCloseDialog)
|
js/App/Components/Device/Common/USetting.js | telldus/telldus-live-mobile-v3 | /**
* Copyright 2016-present Telldus Technologies AB.
*
* This file is part of the Telldus Live! app.
*
* Telldus Live! app is free : you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Telldus Live! app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Telldus Live! app. If not, see <http://www.gnu.org/licenses/>.
*
*/
// @flow
'use strict';
import React from 'react';
import { useSelector } from 'react-redux';
import {
View,
Text,
CheckBoxIconText,
} from '../../../../BaseComponents';
import Theme from '../../../Theme';
const USetting = (props: Object): Object => {
const {
isChecked,
onToggleCheckBox,
intl,
option,
} = props;
const { layout } = useSelector((state: Object): Object => state.app);
const {
radioButtonLabelStyle,
optionWrapStyle,
optionButtonCover,
uCheckBoxIconStyle,
brandPrimary,
} = getStyles(layout);
return (
<View style={optionButtonCover}>
<CheckBoxIconText
isChecked={isChecked}
iconStyle={{
...optionWrapStyle,
...uCheckBoxIconStyle,
backgroundColor: isChecked ? brandPrimary : '#fff',
color: isChecked ? '#fff' : 'transparent',
}}
textStyle={radioButtonLabelStyle}
onToggleCheckBox={onToggleCheckBox}
intl={intl}/>
<Text style={radioButtonLabelStyle}>
{option}
</Text>
</View>
);
};
const getStyles = (appLayout: Object): Object => {
const { height, width } = appLayout;
const isPortrait = height > width;
const deviceWidth = isPortrait ? width : height;
const {
paddingFactor,
rowTextColor,
brandPrimary,
fontSizeFactorTen,
} = Theme.Core;
const padding = deviceWidth * paddingFactor;
const fontSizeText = deviceWidth * fontSizeFactorTen;
const outerPadding = padding * 2;
const checkBoxSpace = padding;
const totalPaddingU = checkBoxSpace * 11;
const borderWidthU = 1;
const size = Math.floor((deviceWidth - (outerPadding + totalPaddingU)) / 10);
return {
checkBoxSpace,
brandPrimary,
optionButtonCover: {
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
},
uCheckBoxIconStyle: {
fontSize: size * 0.8,
height: size,
width: size,
borderColor: brandPrimary,
borderWidth: borderWidthU,
},
radioButtonLabelStyle: {
fontSize: fontSizeText,
color: rowTextColor,
marginTop: padding,
},
rButtonStyle: {
},
optionWrapStyle: {
marginTop: padding,
},
};
};
export default (React.memo<Object>(USetting): Object);
|
examples/basic/app.js | rackt/react-modal | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Modal from 'react-modal';
import SimpleUsage from './simple_usage';
import MultipleModals from './multiple_modals';
import Forms from './forms';
import ReactRouter from './react-router';
import NestedModals from './nested_modals';
const appElement = document.getElementById('example');
Modal.setAppElement('#example');
const examples = [
SimpleUsage,
Forms,
MultipleModals,
NestedModals,
ReactRouter
];
class App extends Component {
render() {
return (
<div>
{examples.map((example, key) => {
const ExampleApp = example.app;
return (
<div key={key + 1} className="example">
<h3>{`#${key + 1}. ${example.label}`}</h3>
<ExampleApp />
</div>
);
})}
</div>
);
}
}
ReactDOM.render(<App />, appElement);
|
src/components/UploadTrack.js | ryanthomas30/AudioNimbus | import React, { Component } from 'react';
import * as actions from '../actions';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import Header from 'grommet/components/Header';
import Box from 'grommet/components/Box';
import Button from 'grommet/components/Button';
import FormField from 'grommet/components/FormField';
import Form from 'grommet/components/Form';
import Heading from 'grommet/components/Heading';
import Footer from 'grommet/components/Footer';
import TextInput from 'grommet/components/TextInput';
class UploadTrack extends Component {
constructor(props) {
super(props);
this.state = { name: '', image: '', file: '' };
}
_handleNameChange(event) {
this.setState({ name: event.target.value, image: this.state.image, file: this.state.file });
}
_handleImageChange(event) {
let image = event.target.files[0];
this.setState({ name: this.state.name, image: image, file: this.state.file });
}
_handleFileChange(event) {
let file = event.target.files[0];
this.setState({ name: this.state.name, image: this.state.image, file: file });
}
_submitForm() {
this.props.closeUpload();
const { userId, uploadTrack, history, routesMatch } = this.props;
const { name, image, file } = this.state
if (!routesMatch) {
history.push(`/profile/${userId}`);
location.reload();
}
uploadTrack(userId, name, image, file);
this.setState({ name: '', image: '', file: '' });
}
render() {
return (
<Box size={{ height: 'xlarge', width: 'xlarge' }} >
<Form onSubmit={() => this._submitForm()} >
<Header>
<Heading margin='medium'>
Upload Track
</Heading>
</Header>
<FormField label='Upload Track'>
<input type="file" accept="audio/*" onChange={ (e) => this._handleFileChange(e) }/>
</FormField>
<FormField label='Track Name'>
<TextInput defaultValue={name} onDOMChange={ (e) => this._handleNameChange(e) } />
</FormField>
<FormField label='Upload Track Image'>
<input type="file" accept="image/*" onChange={ (e) => this._handleImageChange(e) }/>
</FormField>
<Footer pad={{vertical: 'medium'}}>
<Button label='Submit' primary={true} onClick={ () => this._submitForm() } />
</Footer>
</Form>
</Box>
);
}
}
function mapStateToProps(state) {
return {
userId: state.auth.userId,
};
}
export default withRouter(connect(mapStateToProps, actions)(UploadTrack));
|
src/svg-icons/device/signal-wifi-3-bar.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceSignalWifi3Bar = (props) => (
<SvgIcon {...props}>
<path fillOpacity=".3" d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/><path d="M3.53 10.95l8.46 10.54.01.01.01-.01 8.46-10.54C20.04 10.62 16.81 8 12 8c-4.81 0-8.04 2.62-8.47 2.95z"/>
</SvgIcon>
);
DeviceSignalWifi3Bar = pure(DeviceSignalWifi3Bar);
DeviceSignalWifi3Bar.displayName = 'DeviceSignalWifi3Bar';
DeviceSignalWifi3Bar.muiName = 'SvgIcon';
export default DeviceSignalWifi3Bar;
|
spec/coffeescripts/jsx/due_dates/DueDateCalendarsSpec.js | djbender/canvas-lms | /*
* Copyright (C) 2015 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import $ from 'jquery'
import React from 'react'
import ReactDOM from 'react-dom'
import DueDateCalendars from 'jsx/due_dates/DueDateCalendars'
import fakeENV from 'helpers/fakeENV'
let wrapper = null
QUnit.module('DueDateCalendars', {
setup() {
wrapper = $('<div>').appendTo('body')[0]
fakeENV.setup()
ENV.context_asset_string = 'course_1'
this.someDate = new Date(Date.UTC(2012, 1, 1, 7, 0, 0))
const props = {
replaceDate() {},
rowKey: 'nullnullnull',
dates: {due_at: this.someDate},
overrides: [
{
get() {},
set() {}
}
],
sections: {},
dateValue: this.someDate
}
const DueDateCalendarsElement = <DueDateCalendars {...props} />
this.dueDateCalendars = ReactDOM.render(DueDateCalendarsElement, wrapper)
},
teardown() {
fakeENV.teardown()
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this.dueDateCalendars).parentNode)
return wrapper.remove()
}
})
test('renders', function() {
ok(this.dueDateCalendars)
})
test('can get the date for a datetype', function() {
equal(this.dueDateCalendars.props.dates.due_at, this.someDate)
})
|
blueocean-material-icons/src/js/components/svg-icons/av/branding-watermark.js | kzantow/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const AvBrandingWatermark = (props) => (
<SvgIcon {...props}>
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-9v-6h9v6z"/>
</SvgIcon>
);
AvBrandingWatermark.displayName = 'AvBrandingWatermark';
AvBrandingWatermark.muiName = 'SvgIcon';
export default AvBrandingWatermark;
|
packages/vulcan-core/lib/modules/containers/registeredMutation.js | VulcanJS/Vulcan | /*
HoC that provides a simple mutation that expects a single JSON object in return
Example usage:
export default withMutation({
name: 'getEmbedData',
args: {url: 'String'},
})(EmbedURL);
*/
import React from 'react';
import { useMutation } from '@apollo/client';
import gql from 'graphql-tag';
import { expandQueryFragments } from 'meteor/vulcan:lib';
import isEmpty from 'lodash/isEmpty';
import map from 'lodash/map';
export const useRegisteredMutation = (options) => {
const { name, args, fragmentText, fragmentName, mutationOptions = {} } = options;
let mutation, fragmentBlock = '';
if (fragmentName) {
fragmentBlock = `{
...${fragmentName}
}`;
} else if (fragmentText) {
fragmentBlock = `{
${fragmentText}
}`;
}
if (args && !isEmpty(args)) {
const args1 = map(args, (type, name) => `$${name}: ${type}`); // e.g. $url: String
const args2 = map(args, (type, name) => `${name}: $${name}`); // e.g. url: $url
mutation = `
mutation ${name}(${args1}) {
${name}(${args2})${fragmentBlock}
}
`;
} else {
mutation = `
mutation ${name} {
${name}${fragmentBlock}
}
`;
}
const query = gql(expandQueryFragments(mutation));
const [mutateFunc] = useMutation(query, mutationOptions);
const extendedMutateFunc = vars => mutateFunc({ variables: vars });
return extendedMutateFunc;
};
export const withMutation = (options) => C => {
const Wrapper = props => {
const mutation = useRegisteredMutation(options);
return (
<C {...props} {...{ [options.name]: mutation }} />
);
};
Wrapper.displayName = 'withMutation';
return Wrapper;
};
export default withMutation; |
client/modules/Reason/components/List/List.js | b3j0f/lechangement | import './List.css';
import React, { Component } from 'react';
import TextField from 'material-ui/TextField';
import ActionSearch from 'material-ui/svg-icons/action/search';
import Item from '../Item/Item';
class List extends Component {
constructor(props) {
super(props);
this.state = {
reasons: props.reasons || []
}
}
render() {
const reasons = Array.from(this.props.reasons) || [];
if (this.props.max) {
reasons.splice(1, this.props.max);
}
return (
<div className="reason-list">
{
reasons.map(
(reason, index) =>
<Item
key={reason.cuid}
reason={reason}
/>
)
}
</div>
);
}
}
export default List;
|
src/continuous-deployment/presentation.js | travi/presentations | import React from 'react';
import createTheme from 'spectacle/lib/themes/default';
import {Appear, Code, Deck, Heading, Image, Link, List, ListItem, Slide, Text} from 'spectacle';
import Terminal from 'spectacle-terminal';
import Typist from 'react-typist';
import CodeSlide from 'spectacle-code-slide';
import ImageSlide from 'spectacle-image-slide';
import preloader from 'spectacle/lib/utils/preloader';
import 'normalize.css';
import 'spectacle/lib/themes/default/index.css';
const theme = createTheme({
primary: '#C12127'
});
const logoSize = 400;
const images = {
greenkeeper: require('../../assets/greenkeeper.png'),
checksPassed: require('../../assets/checks-passed.png'),
checksFailed: require('../../assets/checks-failed.png'),
pr: require('../../assets/pr.png'),
lotsOfPrs: require('../../assets/lots-of-prs.png'),
cascade: require('../../assets/cascade.png')
};
preloader(images);
const notesForFatigue = 'There has been a lot said about JS Fatigue lately... Node Community is known for lots of ' +
'small packages. This, plus the frequency of updates contributes to fatigue';
const notesForInternalPackagesSlide = "If managing thirdparty dependencies in your app isn't enough, lets take a look" +
' at how we can handle internal packages.';
const notesForCommitizen = 'https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular/' +
'blob/e32d954eac0766916b9b7408efed95d643a198a9/convention.md';
const cursor = {show: false, blink: true, element: '|', hideWhenDone: false, hideWhenDoneDelay: 1000};
export default function Presentation() {
return (
<Deck transition={['zoom', 'slide']} transitionDuration={500} theme={theme}>
<Slide transition={['zoom']} bgColor="primary">
<Heading size={1} fit caps lineHeight={1} textColor="black">
Continuous Deployment
</Heading>
<Heading size={1} fit>
of npm packages
</Heading>
<Text textSize="1em" margin="40px 0px 0px" bold>
Matt Travi
</Text>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={1} fit textColor="primary" caps>
Payoff from Automated Testing Practices
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Automate to give confidence
</ListItem>
</Appear>
<Appear>
<ListItem>
Easy to question ROI of automated testing practices
</ListItem>
</Appear>
<Appear>
<ListItem>
I hope to show a big potential payoff
</ListItem>
</Appear>
<Appear>
<ListItem>
Only do this with enough automated coverage for confidence
</ListItem>
</Appear>
<Appear>
<ListItem>
The payoff can be valuable to increase your coverage
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="black" transition={['slide']} notes={notesForFatigue}>
<Heading size={1} fit>
JS Fatigue
</Heading>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={1} fit>
Positive side to the explosion of packages
</Heading>
</Slide>
<Slide transition={['slide']}>
<Heading size={1} fit>
First, some terminology...
</Heading>
<List>
<Appear>
<ListItem>
Continuous Integration
</ListItem>
</Appear>
<Appear>
<ListItem>
Continuous Delivery
</ListItem>
</Appear>
<Appear>
<ListItem>
Continuous Deployment
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Continuous Integration
</Heading>
<Heading size={1} fit>
favoring code in
{' '}
<Code textColor="white">
master
</Code>
{' '}
over long-lived branches
</Heading>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Continuous Delivery
</Heading>
<Heading size={1} fit>
<Code textColor="white">
master
</Code>
{' '}
is always deployable
</Heading>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Continuous Deployment
</Heading>
<Heading size={1} fit>
<Code textColor="white">
master
</Code>
{' '}
means production
</Heading>
</Slide>
<Slide transition={['zoom']}>
<Heading size={1} fit caps lineHeight={1} textColor="black">
Continuous Deployment
</Heading>
<Heading size={1} fit>
of applications
</Heading>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={1} fit>
Enough confidence to deploy without human intervention
</Heading>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Trust your test suite
</Heading>
<Text textSize="1em" margin="20px 0px 0px" bold>
Confidently deploy without human intervention
</Text>
</Slide>
<CodeSlide
textSize=".8em"
lang="json"
code={require('../../assets/package.app.example')}
ranges={[
{loc: [6, 7], note: 'the verification task'},
{loc: [2, 4], note: 'multiple lint tasks, like JavaScript and Markdown', title: 'Lint'},
{loc: [4, 6], note: 'multiple test tasks, like unit and integration', title: 'Tests'},
{loc: [7, 10], note: 'multiple build tasks, like server and client', title: 'Build'}
]}
/>
<CodeSlide
textSize=".8em"
lang="json"
notes="want to show a couple of tools that are helpful"
code={require('../../assets/package.app.example')}
ranges={[
{loc: [20, 21], note: 'improves ability to chain npm scripts', title: 'npm-run-all'},
{loc: [6, 7], note: 'run-s runs the tasks synchronously', title: 'npm-run-all'},
{loc: [14, 15], note: 'run-p runs tasks in parallel', title: 'npm-run-all'},
{loc: [19, 20], note: 'connects npm scripts to git hooks', title: 'husky'},
{loc: [16, 17], note: 'automatically run npm test before each commit', title: 'husky'}
]}
/>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Travis CI
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Tight integration with GitHub
</ListItem>
</Appear>
<Appear>
<ListItem>
Strongly encourages continuous deployment
</ListItem>
</Appear>
<Appear>
<ListItem>
Config is versioned with the project
</ListItem>
</Appear>
<Appear>
<ListItem>
CD by default on Travis, but any CI server could be configured this way
</ListItem>
</Appear>
</List>
</Slide>
<CodeSlide
lang="yaml"
code={require('../../assets/travis.app.example')}
ranges={[
{
loc: [1, 2],
title: 'Verification',
note: 'This is the default for node projects, so inclusion is optional'
},
{loc: [2, 6], title: 'Heroku'},
{loc: [6, 11], title: 'App Engine'}
]}
/>
<Slide transition={['zoom']}>
<Heading size={1} caps fit textFont="primary">
Keeping Application Dependencies
</Heading>
<Heading size={2} caps fit textFont="primary">
Up to Date
</Heading>
</Slide>
<Slide
bgColor="white"
bgDarken={0.75}
bgImage={images.greenkeeper.replace('/', '')}
textColor="white"
transition={['slide']}
>
<List>
<Appear>
<ListItem>
React (for example) publishes a new version to npm
</ListItem>
</Appear>
<Appear>
<ListItem>
Greenkeeper sends a PR to your application's repo
</ListItem>
</Appear>
<Appear>
<ListItem>
If all goes well, you only have to click merge
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="white">
<ImageSlide title="Greenkeeper sends a PR" image={images.pr.replace('/', '')} />
</Slide>
<Slide bgColor="white">
<ImageSlide title="All Commit Checks Passed" image={images.checksPassed.replace('/', '')} />
</Slide>
<Slide bgColor="white" transition={['slide']}>
<Heading size={2} fit textColor="primary" textFont="primary">
So many PRs!!!
</Heading>
<Heading size={1} textColor="black" fit>
Isn't this worse than before?
</Heading>
</Slide>
<Slide bgColor="white">
<ImageSlide title="A common day of PRs" image={images.lotsOfPrs.replace('/', '')} />
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Greenkeeper-keeper
</Heading>
<List textColor="white">
<Appear>
<ListItem>
PR verified to be from Greenkeeper
</ListItem>
</Appear>
<Appear>
<ListItem>
Commit statuses all pass
</ListItem>
</Appear>
<Appear>
<ListItem>
PR merged
</ListItem>
</Appear>
<Appear>
<ListItem>
Branch automatically deleted
</ListItem>
</Appear>
<Appear>
<ListItem>
Commit to
<Code textColor="white">
master
</Code>
{' '}
triggers production deploy
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="white">
<ImageSlide
title="greenkeeper-keeper will only merge if all checks pass"
image={images.checksFailed.replace('/', '')}
/>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Caveats
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Greenkeeper is a GitHub (only) integration
</ListItem>
</Appear>
<Appear>
<ListItem>
No developer to look at the execution before pushing
</ListItem>
</Appear>
<Appear>
<ListItem>
Unit tests alone might not provide enough confidence
</ListItem>
</Appear>
</List>
</Slide>
<Slide transition={['zoom']}>
<Heading size={1} fit caps lineHeight={1} textColor="black" notes={notesForInternalPackagesSlide}>
Continuous Deployment
</Heading>
<Heading size={1} fit>
of internal packages
</Heading>
</Slide>
<Slide
bgColor="black"
transition={['slide']}
notes="If a team isn't practicing CD, this is a complicated question"
>
<Heading size={2} caps fit textColor="primary" textFont="primary">
What does "done" mean?
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Change is in
{' '}
<Code textColor="white">
master
</Code>
{' '}
of the package repo?
</ListItem>
</Appear>
<Appear>
<ListItem>
New version of package published?
</ListItem>
</Appear>
<Appear>
<ListItem>
Updated in consuming apps?
</ListItem>
</Appear>
<Appear>
<ListItem>
Consuming apps deployed?
</ListItem>
</Appear>
<Appear>
<ListItem>
How could we apply "
<Code textColor="white">
master
</Code>
{' '}
means production"?
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Traditional Road Blocks
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Bundling changes into a release
</ListItem>
</Appear>
<Appear>
<ListItem>
Limiting major/breaking releases
</ListItem>
</Appear>
<Appear>
<ListItem>
Updating and deploying the consuming application
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Semantic-Release
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Determines the previously released version from the registry
</ListItem>
</Appear>
<Appear>
<ListItem>
Bumps the version based on commit messages
</ListItem>
</Appear>
<Appear>
<ListItem>
Publishes to the registry
</ListItem>
</Appear>
<Appear>
<ListItem>
Pushes the tag and release notes to GitHub
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Patch, feature, breakage
</Heading>
<List textColor="white">
<Appear>
<ListItem>
<Code textColor="white">
fix
</Code>
</ListItem>
</Appear>
<Appear>
<ListItem>
<Code textColor="white">
feat
</Code>
</ListItem>
</Appear>
<Appear>
<ListItem>
<Code textColor="white">
BREAKING CHANGE:
{' '}
</Code>
</ListItem>
</Appear>
</List>
</Slide>
<Slide transition={['slide']}>
<Heading size={1} fit>
Formatting the Commit for Semantic-Release
</Heading>
<Heading size={2} fit>
Can Be Complex
</Heading>
</Slide>
<CodeSlide
lang="json"
code={require('../../assets/package.npm.example')}
ranges={[
{
loc: [15, 16],
title: 'commitizen'
},
{
loc: [26, 29],
note: 'provides a wizard to simplify matching the expected commit pattern',
title: 'commitizen'
}
]}
/>
<Slide transition={['slide']}>
<Heading size={1} caps fit>
Commitizen Example
</Heading>
<Terminal
title="~/development/gain/front-end/react-components @ Travi-MBP"
output={[
<Typist cursor={cursor} key="cz command">
git cz
</Typist>,
[
<div key="inital cz step">
<div>
[email protected], [email protected]
</div>
<div style={{padding: '40px 0 20px 0'}}>
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Select the type of change that you're committing:
(Use arrow keys)
</div>
<div style={{color: '#00afff'}}>
❯ feat: A new feature
</div>
<div>
fix: A bug fix
</div>
<div>
docs: Documentation only changes
</div>
<div>
style: Changes that do not affect the meaning of the code (white-space, formatting,
missing semi-colons, etc)
</div>
<div>
refactor: A code change that neither fixes a bug nor adds a feature
</div>
<div>
perf: A code change that improves performance
</div>
<div>
test: Adding missing tests or correcting existing tests
</div>
<div>
(Move up and down to reveal more choices)
</div>
</div>,
<div key="second cz step">
<div>
[email protected], [email protected]
</div>
<div style={{padding: '40px 0 20px 0'}}>
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Select the type of change that you're committing:
<span style={{color: '#00afff'}}>
feat: A new feature
</span>
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Denote the scope of this change ($location, $browser,
$compile, etc.):
</div>
<div>
<Typist cursor={cursor}>
table-component
</Typist>
</div>
</div>,
<div key="third cz step">
<div>
[email protected], [email protected]
</div>
<div style={{padding: '40px 0 20px 0'}}>
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Select the type of change that you're committing:
<span style={{color: '#00afff'}}>
feat: A new feature
</span>
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Denote the scope of this change ($location, $browser,
$compile, etc.):
</div>
<div style={{color: '#00afff'}}>
table-component
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Write a short, imperative tense description of the
change:
</div>
<div>
<Typist cursor={cursor}>
Add column sort
</Typist>
</div>
</div>,
<div key="forth cz step">
<div>
[email protected], [email protected]
</div>
<div style={{padding: '40px 0 20px 0'}}>
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Select the type of change that you're committing:
<span style={{color: '#00afff'}}>
feat: A new feature
</span>
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Denote the scope of this change ($location, $browser,
$compile, etc.):
</div>
<div style={{color: '#00afff'}}>
table-component
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Write a short, imperative tense description of the
change:
</div>
<div style={{color: '#00afff'}}>
Add column sort
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Provide a longer description of the change:
</div>
<div>
<Typist cursor={cursor}>
Acending and decending sort orders were added
</Typist>
</div>
</div>,
<div key="fifth cz step">
<div>
[email protected], [email protected]
</div>
<div style={{padding: '40px 0 20px 0'}}>
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Select the type of change that you're committing:
<span style={{color: '#00afff'}}>
feat: A new feature
</span>
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Denote the scope of this change ($location, $browser,
$compile, etc.):
</div>
<div style={{color: '#00afff'}}>
table-component
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Write a short, imperative tense description of the change:
</div>
<div style={{color: '#00afff'}}>
Add column sort
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Provide a longer description of the change:
</div>
<div>
Acending and decending sort orders were added
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
List any breaking changes:
</div>
<div>
<Typist cursor={cursor}>
Adds a new required prop
</Typist>
</div>
</div>,
<div key="sixth cz step">
<div>
[email protected], [email protected]
</div>
<div style={{padding: '40px 0 20px 0'}}>
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Select the type of change that you're committing:
<span style={{color: '#00afff'}}>
feat: A new feature
</span>
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Denote the scope of this change ($location, $browser,
$compile, etc.):
</div>
<div style={{color: '#00afff'}}>
table-component
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Write a short, imperative tense description of the change:
</div>
<div style={{color: '#00afff'}}>
Add column sort
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
Provide a longer description of the change:
</div>
<div style={{color: '#00afff'}}>
Acending and decending sort orders were added
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
List any breaking changes:
</div>
<div style={{color: '#00afff'}}>
Adds a new required prop
</div>
<div>
<span style={{color: '#00ff00'}}>
?
</span>
{' '}
List any issues closed by this change:
</div>
<div>
<Typist cursor={cursor}>
closes #123
</Typist>
</div>
</div>,
<div key="hack to prevent showing the last item too early" />
]
]}
/>
</Slide>
<CodeSlide
lang="git"
code={require('../../assets/commit.example')}
notes={notesForCommitizen}
showLineNumbers={false}
ranges={[
{
loc: [6, 7],
title: 'Header',
note: 'The commit type, scope, and short description (subject) are combined into the header'
},
{
loc: [8, 9],
title: 'Body',
note: 'The longer description is added as the commit body'
},
{
loc: [10, 11],
title: 'Breaking Changes',
note: 'The breaking changes are added as a footer line, prefixed with `BREAKING CHANGE: `'
},
{
loc: [12, 13],
title: 'Issue Reference',
note: 'The issue reference is added as another footer line'
}
]}
/>
<Slide transition={['slide']}>
<Heading size={1} fit>
It's Easy to Forget to
</Heading>
<Heading size={2} fit>
Follow the Format
</Heading>
</Slide>
<CodeSlide
lang="json"
code={require('../../assets/package.npm.example')}
ranges={[
{
loc: [16, 17],
note: 'husky can be used for more git hooks',
title: 'husky'
},
{
loc: [9, 10],
note: 'Ensure the commit passes all tests before committing',
title: 'Verification'
},
{
loc: [8, 9],
note: 'Ensure the commit message is compatible with semantic-release',
title: 'Commit pattern verification'
}
]}
/>
<Slide transition={['slide']}>
<Heading size={1} caps fit>
Commit Message Validation Failure
</Heading>
<Terminal
title="~/development/gain/front-end/react-components @ Travi-MBP"
output={[
<Typist cursor={cursor} key="bad commit">
git commit -m 'foo'
</Typist>,
<div key="invalid commit warning">
<div>
Now using node v7.4.0 (npm v4.0.5)
</div>
<div />
<div>
> husky - npm run -s commitmsg
</div>
<div />
<div>
INVALID COMMIT MSG: does not match "<type>(<scope>): <subject>" !
</div>
<div>
foo
</div>
<div />
<div>
> husky - commit-msg hook failed (add --no-verify to bypass)
</div>
<div>
> husky - to debug, use 'npm run commitmsg'
</div>
</div>
]}
/>
</Slide>
<Slide transition={['slide']}>
<Heading size={1} fit>
Start the commit message with
<Code>
wip
</Code>
{' '}
to skip validation
</Heading>
</Slide>
<CodeSlide
lang="yaml"
code={require('../../assets/travis.npm.example')}
ranges={[
{
loc: [1, 5],
title: 'Publish',
note: 'The semantic-release task bumps the version, publishes, and compiles release notes'
}
]}
/>
<CodeSlide
textSize=".85em"
lang="json"
code={require('../../assets/package.npm.example')}
ranges={[
{
loc: [19, 20],
title: 'Version',
note: 'Only defined to prevent a cli warning. It is overwritten by semantic-release before publishing'
},
{
loc: [10, 11],
title: 'Pre-pack',
note: 'Any npm script can have a pre or post script. This script builds the bundled modules before pack, ' +
'which happens before publish'
},
{loc: [7, 8], title: 'Rollup', note: 'Build bundles for distribution'},
{
loc: [20, 22],
title: 'Bundles',
note: '`main` defines the common-js bundle. `module` defines the es module'
}
]}
/>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Dependencies of Dependencies
</Heading>
<Heading size={1} caps fit>
Greenkeeper uses semantic-release compatible commit messages
</Heading>
<List textColor="white">
<Appear>
<ListItem>
<Code textColor="white">
devDependencies
</Code>
{' '}
are committed as
<Code textColor="white">
chore
</Code>
</ListItem>
</Appear>
<Appear>
<ListItem>
<Code textColor="white">
dependencies
</Code>
{' '}
are committed as
<Code textColor="white">
fix
</Code>
</ListItem>
</Appear>
</List>
</Slide>
<Slide transition={['zoom']}>
<Heading size={1} fit>
Cascading Dependency Updates
</Heading>
</Slide>
<Slide bgColor="white">
<ImageSlide title="Cascade" image={images.cascade.replace('/', '')} />
</Slide>
<Slide bgColor="black" transition={['slide']}>
<Heading size={2} caps fit textColor="primary" textFont="primary">
Caveats
</Heading>
<List textColor="white">
<Appear>
<ListItem>
PRs for private packages only triggered by private npm
</ListItem>
</Appear>
<Appear>
<ListItem>
Other registries like Nexus or Artifactory are not supported
</ListItem>
</Appear>
</List>
</Slide>
<Slide transition={['slide']}>
<Heading size={1} fit>
Continuous Deployment isn't an option on my team
</Heading>
<Heading size={2} caps fit textFont="primary">
How can I dial this back?
</Heading>
<List textColor="white">
<Appear>
<ListItem>
Continuously deploy packages, but not the application
</ListItem>
</Appear>
<Appear>
<ListItem>
Consider starting with semantic-release
</ListItem>
</Appear>
<Appear>
<ListItem>
Introduce greenkeeper later
</ListItem>
</Appear>
<Appear>
<ListItem>
Consider the debt of opening PRs, but accepting later
</ListItem>
</Appear>
<Appear>
<ListItem>
greenkeeper-keeper instance before Greenkeeper
</ListItem>
</Appear>
</List>
</Slide>
<Slide transition={['slide']}>
<Heading size={1} fit>
Services
</Heading>
<Heading size={2} caps fit textFont="primary">
Value has made investment in specific services worthwhile
</Heading>
<List textColor="white">
<Appear>
<ListItem>
GitHub
</ListItem>
</Appear>
<Appear>
<ListItem>
Travis CI
</ListItem>
</Appear>
<Appear>
<ListItem>
Private npm
</ListItem>
</Appear>
</List>
</Slide>
<Slide bgColor="white">
<Heading size={1} fit textColor="rgb(13,114,185)" textFont="Impact" style={{fontVariant: 'small-caps'}}>
Matt Travi
</Heading>
<Image
src="https://storage.googleapis.com/static.gaincompliance.com/logo-square.svg"
height={logoSize}
width={logoSize}
style={{float: 'right'}}
/>
<List textColor="rgb(0,165,225)">
<ListItem>
<Link textColor="rgb(0,165,225)" href="https://matt.travi.org">
https://matt.travi.org
</Link>
</ListItem>
<ListItem>
<Link textColor="rgb(0,165,225)" href="https://presentations.travi.org">
https://presentations.travi.org
</Link>
</ListItem>
<ListItem>
<Link textColor="rgb(0,165,225)" href="https://gaincompliance.com">
https://gaincompliance.com
</Link>
</ListItem>
</List>
</Slide>
</Deck>
);
}
Presentation.displayName = 'Presentation';
|
app/components/social-list.js | eladg/gariany.com | import React from 'react';
class SocialList extends React.Component {
render() {
return (
<nav className="nav-icons">
<ul className="nav-list">
<li className="nav-icon">
<a href="https://github.com/eladg"><i className="fa fa-github"></i></a>
</li>
<li className="nav-icon">
<a href="https://twitter.com/elad_g"><i className="fa fa-twitter"></i></a>
</li>
<li className="nav-icon">
<a href="https://no.linkedin.com/in/eladgariany/en"><i className="fa fa-linkedin"></i></a>
</li>
<li className="nav-icon">
<a href="https://bitbucket.org/"><i className="fa fa-bitbucket"></i></a>
</li>
<li className="nav-icon">
<a href="mailto:[email protected]"><i className="fa fa-envelope"></i></a>
</li>
<li className="nav-icon">
<a href="http://gariany.com/files/elad.gariany.cv.pdf"><i className="fa fa-file-text"></i></a>
</li>
</ul>
</nav>
);
}
}
export default SocialList; |
src/components/LoadingComponent.js | AzSiAz/LN-Reader | import React from 'react'
import { View, Text, StyleSheet } from 'react-native'
export default class LoadingComponent extends React.PureComponent {
render() {
return (
<View style={styles.container}>
<Text style={styles.loader}>
Loading
</Text>
<Text>
{this.props.name}
</Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
loader: {
fontSize: 30,
fontWeight: 'bold',
}
}) |
app/javascript/mastodon/features/ui/components/compose_panel.js | tootsuite/mastodon | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import SearchContainer from 'mastodon/features/compose/containers/search_container';
import ComposeFormContainer from 'mastodon/features/compose/containers/compose_form_container';
import NavigationContainer from 'mastodon/features/compose/containers/navigation_container';
import LinkFooter from './link_footer';
import { changeComposing } from 'mastodon/actions/compose';
export default @connect()
class ComposePanel extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
};
onFocus = () => {
this.props.dispatch(changeComposing(true));
}
onBlur = () => {
this.props.dispatch(changeComposing(false));
}
render() {
return (
<div className='compose-panel' onFocus={this.onFocus}>
<SearchContainer openInRoute />
<NavigationContainer onClose={this.onBlur} />
<ComposeFormContainer singleColumn />
<LinkFooter withHotkeys />
</div>
);
}
}
|
client/src/javascript/components/icons/FolderClosedOutlined.js | jfurrow/flood | import React from 'react';
import BaseIcon from './BaseIcon';
export default class FolderClosedOutline extends BaseIcon {
render() {
return (
<svg className={`icon icon--directory-outlined ${this.props.className}`} viewBox={this.getViewBox()}>
<path d="M52.3,47.47a7.07,7.07,0,0,1-7,7H7a7.07,7.07,0,0,1-7-7V17.29a7.07,7.07,0,0,1,7-7H17.1a7.07,7.07,0,0,1,7,7v1H45.26a7.07,7.07,0,0,1,7,7V47.47Zm-4-22.13a3,3,0,0,0-3-3H23.13a3,3,0,0,1-3-3v-2a3,3,0,0,0-3-3H7a3,3,0,0,0-3,3V47.47a3,3,0,0,0,3,3H45.26a3,3,0,0,0,3-3V25.34Z" />
</svg>
);
}
}
|
docs/build.js | apkiernan/react-bootstrap | /* eslint no-console: 0 */
import fsp from 'fs-promise';
import path from 'path';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import {match, RouterContext} from 'react-router';
import Root from './src/Root';
import routes from './src/Routes';
import metadata from './generate-metadata';
import {copy} from '../tools/fs-utils';
import {exec} from '../tools/exec';
const repoRoot = path.resolve(__dirname, '../');
const docsBuilt = path.join(repoRoot, 'docs-built');
const license = path.join(repoRoot, 'LICENSE');
const readmeSrc = path.join(__dirname, 'README.docs.md');
const readmeDest = path.join(docsBuilt, 'README.md');
/**
* Generates HTML code for `fileName` page.
*
* @param {string} fileName Path for Router.Route
* @return {Promise} promise
* @internal
*/
function generateHTML(fileName) {
return new Promise( resolve => {
const location = fileName === 'index.html' ? '/' : `/${fileName}`;
match({routes, location}, (error, redirectLocation, renderProps) => {
let html = ReactDOMServer.renderToString(
<RouterContext {...renderProps} />
);
html = '<!doctype html>' + html;
let write = fsp.writeFile(path.join(docsBuilt, fileName), html);
resolve(write);
});
});
}
export default function BuildDocs({dev}) {
console.log('Building: '.cyan + 'docs'.green + (dev ? ' [DEV]'.grey : ''));
const devOption = dev ? '' : '-p';
return exec(`rimraf ${docsBuilt}`)
.then(() => fsp.mkdir(docsBuilt))
.then(metadata)
.then(propData => {
Root.assetBaseUrl = '';
Root.propData = propData;
const pagesGenerators = Root.getPages().map(generateHTML);
return Promise.all(pagesGenerators.concat([
exec(`webpack --config webpack.docs.js --bail ${devOption}`),
copy(license, docsBuilt),
copy(readmeSrc, readmeDest)
]));
})
.then(() => console.log('Built: '.cyan + 'docs'.green + (dev ? ' [DEV]'.grey : '')));
}
|
actor-apps/app-web/src/app/components/modals/invite-user/ContactItem.react.js | cnbin/actor-platform | import React from 'react';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
import classnames from 'classnames';
import AvatarItem from 'components/common/AvatarItem.react';
const {addons: { PureRenderMixin }} = addons;
@ReactMixin.decorate(PureRenderMixin)
class ContactItem extends React.Component {
static propTypes = {
contact: React.PropTypes.object,
onSelect: React.PropTypes.func,
member: React.PropTypes.bool
};
constructor(props) {
super(props);
}
onSelect = () => {
this.props.onSelect(this.props.contact);
};
render() {
const contact = this.props.contact;
const contactClassName = classnames('contacts__list__item row', {
'contacts__list__item--member': this.props.member
});
let controls;
if (!this.props.member) {
controls = <a className="material-icons" onClick={this.onSelect}>person_add</a>;
} else {
controls = <i className="material-icons">check</i>;
}
return (
<li className={contactClassName}>
<AvatarItem image={contact.avatar}
placeholder={contact.placeholder}
size="small"
title={contact.name}/>
<div className="col-xs">
<span className="title">
{contact.name}
</span>
</div>
<div className="controls">
{controls}
</div>
</li>
);
}
}
export default ContactItem;
|
src/components/FuelSavingsTextInput.js | mikejablonski/newo-brew-web | import React from 'react';
import PropTypes from 'prop-types';
const FuelSavingsTextInput = (props) => {
const handleChange = (e) => {
props.onChange(props.name, e.target.value);
};
const textInputStyle = {
'fontSize': '16px'
};
return (
<input
className="form-control"
type="text"
placeholder={props.placeholder}
value={props.value}
onChange={handleChange}
style={textInputStyle} />
);
};
FuelSavingsTextInput.propTypes = {
name: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
placeholder: PropTypes.string,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
])
};
export default FuelSavingsTextInput;
|
src/js/views/list-details.js | electronspin/touchstonejs-starter | import Container from 'react-container';
import React from 'react';
module.exports = React.createClass({
statics: {
navigationBar: 'main',
getNavigation (props, app) {
var leftLabel = props.prevView === 'list-simple' ? 'Simple' : 'Complex';
return {
leftArrow: true,
leftLabel: leftLabel,
leftAction: () => { app.transitionTo('tabs:' + props.prevView, { transition: 'reveal-from-right' }) },
title: 'Person'
}
}
},
getDefaultProps () {
return {
prevView: 'home'
}
},
render () {
var { person } = this.props;
return (
<Container direction="column">
<Container fill scrollable ref="scrollContainer" className="PersonDetails">
<img src={person.picture} className="PersonDetails__avatar" />
<div className="PersonDetails__heading">{person.name.full}</div>
<div className="PersonDetails__text text-block">{person.bio}</div>
{(person.twitter || person.github) && <div className="PersonDetails__profiles">
{person.twitter && <div className="PersonDetails__profile">
<span className="PersonDetails__profile__icon ion-social-twitter" />
{person.twitter}
</div>}
{person.github && <div className="PersonDetails__profile">
<span className="PersonDetails__profile__icon ion-social-github" />
{person.github}
</div>}
</div>}
</Container>
</Container>
);
}
});
|
packages/react-error-overlay/src/containers/StackFrameCodeBlock.js | just-boris/create-preact-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* @flow */
import React from 'react';
import CodeBlock from '../components/CodeBlock';
import { applyStyles } from '../utils/dom/css';
import { absolutifyCaret } from '../utils/dom/absolutifyCaret';
import type { ScriptLine } from '../utils/stack-frame';
import { primaryErrorStyle, secondaryErrorStyle } from '../styles';
import generateAnsiHTML from '../utils/generateAnsiHTML';
import codeFrame from 'babel-code-frame';
type StackFrameCodeBlockPropsType = {|
lines: ScriptLine[],
lineNum: number,
columnNum: ?number,
contextSize: number,
main: boolean,
|};
// Exact type workaround for spread operator.
// See: https://github.com/facebook/flow/issues/2405
type Exact<T> = $Shape<T>;
function StackFrameCodeBlock(props: Exact<StackFrameCodeBlockPropsType>) {
const { lines, lineNum, columnNum, contextSize, main } = props;
const sourceCode = [];
let whiteSpace = Infinity;
lines.forEach(function(e) {
const { content: text } = e;
const m = text.match(/^\s*/);
if (text === '') {
return;
}
if (m && m[0]) {
whiteSpace = Math.min(whiteSpace, m[0].length);
} else {
whiteSpace = 0;
}
});
lines.forEach(function(e) {
let { content: text } = e;
const { lineNumber: line } = e;
if (isFinite(whiteSpace)) {
text = text.substring(whiteSpace);
}
sourceCode[line - 1] = text;
});
const ansiHighlight = codeFrame(
sourceCode.join('\n'),
lineNum,
columnNum == null ? 0 : columnNum - (isFinite(whiteSpace) ? whiteSpace : 0),
{
forceColor: true,
linesAbove: contextSize,
linesBelow: contextSize,
}
);
const htmlHighlight = generateAnsiHTML(ansiHighlight);
const code = document.createElement('code');
code.innerHTML = htmlHighlight;
absolutifyCaret(code);
const ccn = code.childNodes;
// eslint-disable-next-line
oLoop: for (let index = 0; index < ccn.length; ++index) {
const node = ccn[index];
const ccn2 = node.childNodes;
for (let index2 = 0; index2 < ccn2.length; ++index2) {
const lineNode = ccn2[index2];
const text = lineNode.innerText;
if (text == null) {
continue;
}
if (text.indexOf(' ' + lineNum + ' |') === -1) {
continue;
}
// $FlowFixMe
applyStyles(node, main ? primaryErrorStyle : secondaryErrorStyle);
// eslint-disable-next-line
break oLoop;
}
}
return <CodeBlock main={main} codeHTML={code.innerHTML} />;
}
export default StackFrameCodeBlock;
|
components/BBButton.js | FredTingaud/quick-bench-front-end | import React from 'react';
import InteropHelper from 'components/InteropHelper';
import { Button, Tooltip, OverlayTrigger } from 'react-bootstrap';
import svg from 'components/resources/ico/bb.svg';
class BBButton extends React.Component {
openCodeInBB(text, options) {
let clientstate = { text: text };
Object.assign(clientstate, options);
console.log(JSON.stringify(clientstate));
var link = window.location.protocol + '//build-bench.com/#' + InteropHelper.b64UTFEncode(JSON.stringify(clientstate));
window.open(link, '_blank');
}
renderTooltip(props) {
return (
<Tooltip id="button-tooltip" {...props}>
Open in Build Bench
</Tooltip>
);
}
render() {
return (
<OverlayTrigger
placement="bottom"
delay={{ show: 250, hide: 400 }}
overlay={(p) => this.renderTooltip(p)}
>
<Button variant="outline-dark" onClick={() => this.openCodeInBB(this.props.text, this.props.options)} className="me-2">
<img src={svg} className="line-img" alt="Open in Build Bench" />
</Button>
</OverlayTrigger>
);
}
}
export default BBButton;
|
src/components/home/home.js | nordsoftware/react-foundation-docs | import React from 'react';
import {
Sizes,
GridContainer,
Grid,
Cell,
Link,
} from 'react-foundation';
import ButtonDocs from '../docs/button';
import ButtonGroupDocs from '../docs/button-group';
import SwitchDocs from '../docs/switch';
import MenuDocs from '../docs/menu';
import PaginationDocs from '../docs/pagination';
import BreadcrumbsDocs from '../docs/breadcrumbs';
import CalloutDocs from '../docs/callout';
import MediaObjectDocs from '../docs/media-object';
import BadgeDocs from '../docs/badge';
import FlexVideoDocs from '../docs/flex-video';
import LabelDocs from '../docs/label';
import ProgressBarDocs from '../docs/progress-bar';
import GridDocs from '../docs/grid';
import AccordionDocs from '../docs/accordion';
import TabsDocs from '../docs/tabs';
import RevealDocs from '../docs/reveal';
export const Home = () => (
<div className="home">
<div className="hero">
<Grid>
<Cell large={12}>
<h1>React + Foundation</h1>
<p className="mission">Foundation as React components</p>
<div className="buttons">
<Link href="//github.com/digiaonline/react-foundation" size={Sizes.LARGE}>Get started</Link>
</div>
</Cell>
</Grid>
</div>
<div className="content">
<GridContainer>
<ButtonDocs />
<ButtonGroupDocs />
<SwitchDocs />
<MenuDocs />
<PaginationDocs />
<BreadcrumbsDocs />
<CalloutDocs />
<MediaObjectDocs />
<BadgeDocs />
<FlexVideoDocs />
<LabelDocs />
<ProgressBarDocs />
<AccordionDocs />
<TabsDocs />
<RevealDocs />
<GridDocs />
</GridContainer>
</div>
</div>
);
|
github-projects/src/routes/ProjectList.js | xrlin/xrlin.github.io | import React from 'react';
import { connect } from 'dva';
import ProjectComponent from '../components/ProjectComponent';
import styles from './ProjectList.css';
var ProjectList = React.createClass({
componentWillMount: function () {
this.serverRequest = fetch("https://api.github.com/users/xrlin/repos").then(function(response) {
return response.json();
}).then((result) => {
let repos = result.filter(repo => repo.fork == false).sort((repo1, repo2) => {
if (repo1.stargazers_count > repo2.stargazers_count) {
return -1;
}
if (repo1.stargazers_count < repo2.stargazers_count) {
return 1;
}
if (repo1.updated_at > repo2.updated_at) {
return -1;
}
if (repo1.updated_at < repo2.updated_at) {
return 1;
}
return 0;
});
this.setState({
repos: repos
})
})
},
render: function () {
if (this.state)
return (
<div>
{this.state.repos.map((repo) => (<ProjectComponent repo={repo} key={repo.id}/>))}
</div>
);
else
return <div></div>;
}
});
ProjectList.propTypes = {
};
export default connect()(ProjectList);
|
src/modules/BootPagination/BootPaginationItem.js | shengnian/shengnian-ui-react | import React from 'react'
import PropTypes from 'prop-types'
import cx from 'classnames'
import { mapToCssModules } from '../../lib/'
const propTypes = {
active: PropTypes.bool,
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
disabled: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
}
const defaultProps = {
tag: 'li',
}
const PaginationItem = (props) => {
const {
active,
className,
cssModule,
disabled,
tag: Tag,
...attributes
} = props
const classes = mapToCssModules(cx(
className,
'page-item',
{
active,
disabled,
},
), cssModule)
return (
<Tag {...attributes} className={classes} />
)
}
PaginationItem.propTypes = propTypes
PaginationItem.defaultProps = defaultProps
export default PaginationItem
|
src/components/topic/related/related-as-cards.js | nickhsine/twreporter-react | import { shortenString } from '../../../utils/string'
import base from './base'
import Image from '@twreporter/react-article-components/lib/components/img-with-placeholder'
import mq from '../../../utils/media-query'
import React from 'react'
import styled from 'styled-components'
const ImageBorder = styled.div`
${mq.tabletAndAbove`
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0 solid #ffffff;
transition: border .1s ease;
`}
`
const ItemsContainer = styled(base.ItemsContainer)`
${mq.tabletAndAbove`
padding: 0 5%;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
`}
`
const ItemLink = styled(base.ItemLink)`
${mq.tabletAndAbove`
flex: 0 0 300px;
width: 300px;
margin: 0 10px 50px 10px;
box-shadow: none;
transition: top .1s ease, box-shadow .2s ease, transform .1s ease;
display: ${props => (props.hide ? 'none' : 'flex')};
flex-direction: column;
&::before {
transition: border-width .1s ease-out;
content: "";
width: 0;
height: 0;
top: -2px;
left: -2px;
position: absolute;
z-index: 5;
border-style: solid;
border-width: 25px 25px 0 0;
border-color: #fff transparent transparent;
}
:hover {
&::before {
border-width: 0;
}
transform: translateY(-5px);
box-shadow: 0 5px 15px 0 rgba(0,0,0,.25);
${base.ItemMeta} {
transform: translateY(0);
}
${ImageBorder} {
border: 5px solid #ffffff;
}
${base.ItemImageSizing}, ${base.ItemMeta} {
box-shadow: none;
}
}
`}
`
const ItemImageSizing = styled(base.ItemImageSizing)`
${mq.tabletAndAbove`
width: 100%;
height: 200px;
flex: 0 0 200px;
position: relative;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.1);
transition: box-shadow .1s ease, transform .2s ease;
`}
`
const ItemMeta = styled(base.ItemMeta)`
${mq.tabletAndAbove`
width: 100%;
height: 222px;
flex: 1 0 222px;
position: relative;
transform: translateY(5px);
padding: 17px 12px 2.5em 20px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.1);
transition: box-shadow .1s ease, transform .2s ease;
`}
`
const Date = styled(base.ItemDate)`
position: absolute;
right: 15px;
bottom: 18px;
`
const textLimit = {
desc: 59,
}
class Item extends base.Item {
render() {
const {
linkTo,
linkTarget,
image,
title,
description,
publishedDate,
hide,
} = this.props
return (
<ItemLink
to={linkTo}
target={linkTarget}
hide={
hide || undefined
} /* passing hide={false} to react-router Link will cause warning */
>
<ItemImageSizing>
<Image
alt={title}
defaultImage={image}
imageSet={[image]}
objectFit="cover"
/>
<ImageBorder />
</ItemImageSizing>
<ItemMeta>
<base.ItemTitle>{title}</base.ItemTitle>
<base.ItemDescription>
{shortenString(description, textLimit.desc)}
</base.ItemDescription>
<Date>{publishedDate}</Date>
</ItemMeta>
</ItemLink>
)
}
}
export default {
ItemsContainer,
Item,
}
|
client/containers/Root.prod.js | codeskeptk/capital | import React, { Component } from 'react';
import { Provider } from 'react-redux';
import App from './App';
export default ({
store,
}) => (
<Provider store={store}>
<App />
</Provider>
);
|
src/components/Responsive.js | WillMayger/CV | import React from 'react';
import PropTypes from 'prop-types';
const Responsive = props => (
<div className="too-small">
<span>This page is designed to be like a document and is therefore not responsive.
Please use a device with a screen size of 1366px or more (most laptops and desktops).
Thank you for your understanding.<p />
Your current screen width is: {props.width}px</span>
</div>
);
Responsive.propTypes = {
width: PropTypes.number.isRequired,
};
export default Responsive;
|
src/components/App.js | hiyangguo/react-netease-cloud-music | /** Libs **/
import React, { Component } from 'react';
/** Components **/
import AppBar from 'material-ui/AppBar';
import PropTypes from 'prop-types';
import Avatar from 'material-ui/Avatar';
import IconButton from 'material-ui/IconButton';
import NavigationMenu from 'material-ui/svg-icons/navigation/menu';
import PlayButton from 'material-ui/svg-icons/av/play-circle-outline';
import Paper from 'material-ui/Paper';
import Subheader from 'material-ui/Subheader';
import { blue300, indigo900 } from 'material-ui/styles/colors';
const styles = {
style: {
position: 'fixed',
height: '50px'
},
titleStyle: {
fontSize: '16px',
height: '50px',
lineHeight: '50px'
},
iconButtonStyle: {
margin: '-7px 1px 0px -8px'
}
};
class App extends Component {
static get childContextTypes() {
return {
router: PropTypes.object
}
}
getChildContext() {
return {
router: this.props.router
};
}
render() {
const { style, titleStyle, iconButtonStyle } = styles;
return (
<div>
<AppBar
title="网易云音乐"
iconClassNameRight="muidocs-icon-navigation-expand-more"
style={style}
titleStyle={titleStyle}
iconElementLeft={<IconButton style={iconButtonStyle}><NavigationMenu /></IconButton>}
/>
<div style={{
paddingTop: '50px',
paddingBottom: '70px'
}}>
{this.props.children}
</div>
<Paper zDepth={1} style={{
position: 'fixed',
bottom: '0px',
width: '100%',
zIndex: 10
}}>
<Avatar
// image=""
style={{
width: '50px',
height: '50px',
margin: 5,
float: 'left'
}}
/>
<Subheader className="music-title" style={{
fontSize: '16px',
fontWeight: 'normal',
lineHeight: '16px',
padding: '10px 60px 10px 70px',
width: 'calc(100% -40px)'
}}>未知</Subheader>
<Subheader className="music-author" style={{
fontSize: '14px',
color: '#b5b5b5',
fontWeight: 'normal',
lineHeight: '16px',
padding: '0px 60px 0px 70px',
width: 'calc(100% -40px)'
}}>未知</Subheader>
<IconButton iconStyle={{
width: 40,
height: 40
}}
style={{
width: 40,
height: 40,
padding: 0,
position: 'absolute',
top: 10,
right: 10
}}><PlayButton /></IconButton>
</Paper>
</div>
);
}
}
export default App;
|
docs/app/Examples/collections/Form/GroupVariations/index.js | koenvg/Semantic-UI-React | import React from 'react'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
const FormGroupVariationsExamples = () => (
<ExampleSection title='Group Variations'>
<ComponentExample
title='Evenly Divided'
description='Fields can have their widths divided evenly.'
examplePath='collections/Form/GroupVariations/FormExampleEvenlyDividedGroup'
/>
<ComponentExample
title='Inline'
description='Multiple fields may be inline in a row.'
examplePath='collections/Form/GroupVariations/FormExampleInlineGroupedFields'
/>
</ExampleSection>
)
export default FormGroupVariationsExamples
|
pootle/static/js/admin/components/Language/LanguageForm.js | r-o-b-b-i-e/pootle | /*
* Copyright (C) Pootle contributors.
*
* This file is a part of the Pootle project. It is distributed under the GPL3
* or later license. See the LICENSE file for a copy of the license and the
* AUTHORS file for copyright and authorship information.
*/
import React from 'react';
import FormElement from 'components/FormElement';
import ModelFormMixin from 'mixins/ModelFormMixin';
import ItemDelete from '../ItemDelete';
const LanguageForm = React.createClass({
propTypes: {
collection: React.PropTypes.object.isRequired,
onDelete: React.PropTypes.func,
onSuccess: React.PropTypes.func.isRequired,
},
mixins: [ModelFormMixin],
fields: ['code', 'fullname', 'specialchars', 'nplurals', 'pluralequation'],
/* Handlers */
handleSuccess(model) {
this.props.onSuccess(model);
},
/* Layout */
render() {
const model = this.getResource();
const { errors } = this.state;
const { formData } = this.state;
return (
<form
method="post"
id="item-form"
onSubmit={this.handleFormSubmit}
>
<div className="fields">
<FormElement
autoFocus
disabled={model.hasOwnProperty('id')}
label={gettext('Code')}
handleChange={this.handleChange}
name="code"
errors={errors.code}
value={formData.code}
/>
<FormElement
label={gettext('Full Name')}
handleChange={this.handleChange}
name="fullname"
errors={errors.fullname}
value={formData.fullname}
/>
<FormElement
label={gettext('Special Characters')}
handleChange={this.handleChange}
name="specialchars"
errors={errors.specialchars}
value={formData.specialchars}
/>
<FormElement
type="select"
clearable={false}
options={model.getFieldChoices('nplurals')}
label={gettext('Number of Plurals')}
handleChange={this.handleChange}
name="nplurals"
errors={errors.nplurals}
value={formData.nplurals}
/>
<FormElement
label={gettext('Plural Equation')}
handleChange={this.handleChange}
name="pluralequation"
errors={errors.pluralequation}
value={formData.pluralequation}
/>
</div>
<div className="buttons">
<input
type="submit"
className="btn btn-primary"
disabled={!this.state.isDirty}
value={gettext('Save')}
/>
{model.id &&
<ul className="action-links">
<li><a href={model.getAbsoluteUrl()}>{gettext('Overview')}</a></li>
<li><a href={model.getTeamUrl()}>{gettext('Team')}</a></li>
</ul>}
</div>
{this.props.onDelete &&
<div>
<p className="divider" />
<div className="buttons">
<ItemDelete item={model} onDelete={this.props.onDelete} />
</div>
</div>}
</form>
);
},
});
export default LanguageForm;
|
examples/src/components/NumericSelect.js | stephennyu/select-react | import React from 'react';
import Select from 'react-select';
var ValuesAsNumbersField = React.createClass({
displayName: 'ValuesAsNumbersField',
propTypes: {
label: React.PropTypes.string
},
getInitialState () {
return {
options: [
{ value: 10, label: 'Ten' },
{ value: 11, label: 'Eleven' },
{ value: 12, label: 'Twelve' },
{ value: 23, label: 'Twenty-three' },
{ value: 24, label: 'Twenty-four' }
],
matchPos: 'any',
matchValue: true,
matchLabel: true,
value: null,
multi: false
};
},
onChangeMatchStart(event) {
this.setState({
matchPos: event.target.checked ? 'start' : 'any'
});
},
onChangeMatchValue(event) {
this.setState({
matchValue: event.target.checked
});
},
onChangeMatchLabel(event) {
this.setState({
matchLabel: event.target.checked
});
},
onChange(value) {
this.setState({ value });
console.log('Numeric Select value changed to', value);
},
onChangeMulti(event) {
this.setState({
multi: event.target.checked
});
},
render () {
var matchProp = 'any';
if (this.state.matchLabel && !this.state.matchValue) {
matchProp = 'label';
}
if (!this.state.matchLabel && this.state.matchValue) {
matchProp = 'value';
}
return (
<div className="section">
<h3 className="section-heading">{this.props.label}</h3>
<Select
matchPos={this.state.matchPos}
matchProp={matchProp}
multi={this.state.multi}
onChange={this.onChange}
options={this.state.options}
simpleValue
value={this.state.value}
/>
<div className="checkbox-list">
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.multi} onChange={this.onChangeMulti} />
<span className="checkbox-label">Multi-Select</span>
</label>
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.matchValue} onChange={this.onChangeMatchValue} />
<span className="checkbox-label">Match value</span>
</label>
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.matchLabel} onChange={this.onChangeMatchLabel} />
<span className="checkbox-label">Match label</span>
</label>
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.matchPos === 'start'} onChange={this.onChangeMatchStart} />
<span className="checkbox-label">Only include matches from the start of the string</span>
</label>
</div>
<div className="hint">This example uses simple numeric values</div>
</div>
);
}
});
module.exports = ValuesAsNumbersField;
|
src/components/App/index.js | lucasreppewelander/react-stripe | import React, { Component } from 'react';
import _ from 'lodash';
import Login from '../Login';
import config from '../../config';
import Customers from '../../resources/customers';
import Modal from '../Modal';
import './App.scss';
class App extends Component {
constructor(props) {
super(props);
this.state = {
user: localStorage.getItem('user'),
customers: [],
customersLoaded: false,
edit: null,
editData: null
}
this.closeModal = this.closeModal.bind(this);
this.createNew = this.createNew.bind(this);
this.onCreated = this.onCreated.bind(this);
}
componentWillMount() {
// this is just for a "dummy database user"
if (!this.state.user || this.state.user !== 'lucas-superpassword') {
this.props.router.push('/login');
}
this.setCustomers();
}
getUserName() {
return this.state.user.split('-')[0];
}
edit(id) {
this.setState({ edit: id });
}
delete(id) {
if (confirm('Really want to delete the item?')) {
Customers.delete(id).then((r) => {
this.setCustomers();
}).catch((err) => {
console.log(err);
});
} else {
this.setCustomers();
}
}
getCustomers() {
const ret = [];
_.each(this.state.customers, (item) => {
ret.push(
<tr key={item.id}>
<td>{item.metadata.firstName ? item.metadata.firstName : <i className="ns">Not set</i>}</td>
<td>{item.metadata.lastName ? item.metadata.lastName : <i className="ns">Not set</i>}</td>
<td>{item.email ? item.email : <i className="ns">Not set</i>}</td>
<td>{item.description ? item.description : <i className="ns">Not set</i>}</td>
<td>{item.account_balance && item.account_balance > 0 ? item.account_balance : <i className="ns">0</i>}</td>
<td>
<button className="danger" onClick={this.delete.bind(this, item.id)}>Remove</button>
<button onClick={this.edit.bind(this, item.id)}>Edit</button>
</td>
</tr>
);
});
return ret;
}
setCustomers() {
Customers.list().then((res) => {
this.setState({
customers: res.data.data,
customersLoaded: true
});
});
}
closeModal() {
this.setState({ editData: null, edit: null, new: false })
}
getLoadingCustomers() {
return (
<tr>
<td colSpan={6}>
<i
style={{display: 'block', textAlign: 'center'}}
className="fa fa-circle-o-notch fa-spin"
/>
</td>
</tr>
)
}
createNew() {
this.setState({ new: true });
}
onCreated() {
Customers.list().then((res) => {
this.setState({
editData: null,
edit: null,
new: false,
customers: res.data.data,
customersLoaded: true
});
});
}
render() {
const username = this.getUserName();
const customers = this.state.customersLoaded ? this.getCustomers() : this.getLoadingCustomers();
return (
<div className="wrapper">
<div className="columns customer-columns">
<div className="column">
<h1>React Stripe Application</h1>
<span className="current">current user: {username}</span>
</div>
<div className="column">
<button onClick={this.createNew} className="btn green">
Add customer
<i className="fa fa-user-plus" />
</button>
</div>
</div>
<div className="columns">
<div className="column">
<span className="title">Customer list</span>
<table className="table">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Email</th>
<th>Description</th>
<th>Balance</th>
<th></th>
</tr>
</thead>
<tbody>
{customers}
</tbody>
</table>
</div>
</div>
{this.state.edit ? <Modal closeModal={this.closeModal} created={this.onCreated} isVisible={!!this.state.edit} item={this.state.edit} isNew={false} /> : ''}
{this.state.new ? <Modal closeModal={this.closeModal} created={this.onCreated} isVisible={this.state.new} item={null} isNew={true} /> : ''}
</div>
);
}
}
App.propTypes = {
// prop: React.PropTypes.[type of property (object,bool,string,func)]
};
export default App; |
node_modules/react-bootstrap/es/Popover.js | vitorgomateus/NotifyMe | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import isRequiredForA11y from 'react-prop-types/lib/isRequiredForA11y';
import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
var propTypes = {
/**
* An html id attribute, necessary for accessibility
* @type {string}
* @required
*/
id: isRequiredForA11y(React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number])),
/**
* Sets the direction the Popover is positioned towards.
*/
placement: React.PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
/**
* The "top" position value for the Popover.
*/
positionTop: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),
/**
* The "left" position value for the Popover.
*/
positionLeft: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),
/**
* The "top" position value for the Popover arrow.
*/
arrowOffsetTop: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),
/**
* The "left" position value for the Popover arrow.
*/
arrowOffsetLeft: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),
/**
* Title content
*/
title: React.PropTypes.node
};
var defaultProps = {
placement: 'right'
};
var Popover = function (_React$Component) {
_inherits(Popover, _React$Component);
function Popover() {
_classCallCheck(this, Popover);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Popover.prototype.render = function render() {
var _extends2;
var _props = this.props,
placement = _props.placement,
positionTop = _props.positionTop,
positionLeft = _props.positionLeft,
arrowOffsetTop = _props.arrowOffsetTop,
arrowOffsetLeft = _props.arrowOffsetLeft,
title = _props.title,
className = _props.className,
style = _props.style,
children = _props.children,
props = _objectWithoutProperties(_props, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'title', 'className', 'style', 'children']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[placement] = true, _extends2));
var outerStyle = _extends({
display: 'block',
top: positionTop,
left: positionLeft
}, style);
var arrowStyle = {
top: arrowOffsetTop,
left: arrowOffsetLeft
};
return React.createElement(
'div',
_extends({}, elementProps, {
role: 'tooltip',
className: classNames(className, classes),
style: outerStyle
}),
React.createElement('div', { className: 'arrow', style: arrowStyle }),
title && React.createElement(
'h3',
{ className: prefix(bsProps, 'title') },
title
),
React.createElement(
'div',
{ className: prefix(bsProps, 'content') },
children
)
);
};
return Popover;
}(React.Component);
Popover.propTypes = propTypes;
Popover.defaultProps = defaultProps;
export default bsClass('popover', Popover); |
src/routes/error/index.js | kumarrus/MuffinMan | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import ErrorPage from './ErrorPage';
function action() {
return {
title: 'Demo Error',
component: <ErrorPage />,
};
}
export default action;
|
packages/flow-upgrade/src/upgrades/0.53.0/ReactComponentExplicitTypeArgs/__tests__/fixtures/DefaultPropsUninitialized.js | gabelevi/flow | // @flow
import React from 'react';
class MyComponent extends React.Component {
static defaultProps: DefaultProps;
props: Props;
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
const expression = () =>
class extends React.Component {
static defaultProps: DefaultProps;
props: Props;
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
|
src/client.js | justin808/react-redux-universal-hot-example | /* global __DEVTOOLS__ */
import React from 'react';
import BrowserHistory from 'react-router/lib/BrowserHistory';
import Location from 'react-router/lib/Location';
import createStore from './redux/create';
import ApiClient from './ApiClient';
import universalRouter from './universalRouter';
const history = new BrowserHistory();
const client = new ApiClient();
const dest = document.getElementById('content');
const store = createStore(client, window.__data);
const location = new Location(document.location.pathname, document.location.search);
universalRouter(location, history, store)
.then(({component}) => {
if (__DEVTOOLS__) {
const { DevTools, DebugPanel, LogMonitor } = require('redux-devtools/lib/react');
console.info('You will see a "Warning: React attempted to reuse markup in a container but the checksum was' +
' invalid." message. That\'s because the redux-devtools are enabled.');
React.render(<div>
{component}
<DebugPanel top right bottom key="debugPanel">
<DevTools store={store} monitor={LogMonitor}/>
</DebugPanel>
</div>, dest);
} else {
React.render(component, dest);
}
}, (error) => {
console.error(error);
});
if (process.env.NODE_ENV !== 'production') {
window.React = React; // enable debugger
const reactRoot = window.document.getElementById('content');
if (!reactRoot || !reactRoot.firstChild || !reactRoot.firstChild.attributes || !reactRoot.firstChild.attributes['data-react-checksum']) {
console.error('Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.');
}
}
|
examples/shopping-cart/src/components/ProductsContainer.js | aldanor/nuclear-js | import React from 'react'
import ProductItem from '../../common/components/ProductItem'
import ProductsList from '../../common/components/ProductsList'
import reactor from '../reactor'
import getters from '../getters'
import actions from '../actions'
const ProductItemContainer = React.createClass({
onAddToCartClicked() {
actions.addToCart(this.props.product);
},
render() {
return (
<ProductItem product={this.props.product} onAddToCartClicked={this.onAddToCartClicked} />
);
}
});
export default React.createClass({
mixins: [reactor.ReactMixin],
getDataBindings() {
return {
products: getters.products,
}
},
render: function () {
return (
<ProductsList title="Flux Shop Demo (NuclearJS)">
{this.state.products.map(product => {
return <ProductItemContainer key={product.get('id')} product={product.toJS()} />;
}).toList()}
</ProductsList>
);
},
});
|
src/server/controllers/serverRenderCtrl.js | skcary/orangeB | import React from 'react'
import { RouterContext } from 'react-router'
import { renderToString } from 'react-dom/server'
import { Provider } from 'react-redux'
import config from '../../config'
import configureStore from '../../../app/store/configureStore'
const store = configureStore()
export default async (ctx, next, renderProps) => {
const route = renderProps.routes[renderProps.routes.length - 1]
let prefetchTasks = []
for (let component of renderProps.components) {
if (component && component.WrappedComponent && component.WrappedComponent.fetch) {
const _tasks = component.WrappedComponent.fetch(store.getState(), store.dispatch)
if (Array.isArray(_tasks)) {
prefetchTasks = prefetchTasks.concat(_tasks)
} else if (_tasks.then) {
prefetchTasks.push(_tasks)
}
}
}
await Promise.all(prefetchTasks)
await ctx.render('index', {
title: config.title,
dev: ctx.app.env === 'development',
reduxData: store.getState(),
app: renderToString(<Provider store={store}>
<RouterContext {...renderProps} />
</Provider>)
})
}
|
src/svg-icons/action/alarm.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionAlarm = (props) => (
<SvgIcon {...props}>
<path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/>
</SvgIcon>
);
ActionAlarm = pure(ActionAlarm);
ActionAlarm.displayName = 'ActionAlarm';
ActionAlarm.muiName = 'SvgIcon';
export default ActionAlarm;
|
lens-ui/app/components/SavedQueryPreviewComponent.js | sushrutikhar/grill | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { Link } from 'react-router';
import CodeMirror from 'codemirror';
import _ from 'lodash';
import 'codemirror/mode/sql/sql.js';
import 'codemirror/addon/runmode/runmode.js';
import QueryParamRowComponent from './QueryParamRowComponent';
import AdhocQueryActions from '../actions/AdhocQueryActions';
import UserStore from '../stores/UserStore';
class SavedQueryPreview extends React.Component {
constructor (props) {
super(props);
this.state = {
showDetail: false,
queryParams: props.query.parameters.reduce((prev, curr) => {
prev[curr.name] = curr;
return prev;
}, {})
};
this.toggleQueryDetails = this.toggleQueryDetails.bind(this);
this.runSavedQuery = this.runSavedQuery.bind(this);
this.update = this.update.bind(this);
}
render () {
let query = this.props.query;
if (!query.query) return null;
// code below before the return prepares the data to render, turning out
// crude properties to glazed, garnished ones e.g. formatting of query
let codeTokens = [];
CodeMirror
.runMode(query.query,
'text/x-mysql', function (text, style) {
// this method is called for every token and gives the
// token and style class for it.
codeTokens.push(<span className={'cm-' + style}>{text}</span>);
});
let params = query && query.parameters.map(param => {
return <QueryParamRowComponent param={param} entryMode={true}
saveParamChanges={this.update}/>;
});
let paramsTable = !params.length ? null :
(<table className='table table-striped table-condensed'>
<thead>
<tr><th>Param</th><th>Display Name</th><th>Data Type</th>
<th>Collection Type</th><th>Value</th></tr>
</thead>
<tbody>
{params}
</tbody>
</table>);
return (
<section ref='preview'>
<div className='panel panel-default'>
<div className='panel-heading blue-header' style={{cursor: 'pointer', padding: '2px 8px'}}
onClick={this.toggleQueryDetails}>
<h5 className='panel-title' style={{marginBottom: '4px'}}>
{query.name || 'Unnamed Query'}
</h5>
<small className='italics'>
{ query.description || 'No description available' }
</small>
</div>
{this.state.showDetail && (
<div className='panel-body' style={{borderTop: '1px solid #cccccc',
padding: '0px'}} key={'preview' + query.id}>
<pre className='cm-s-default' style={{
border: '0px', marginBottom: '0px'}}>
{codeTokens}
<Link to='query' query={{savedquery: query.id}}
className='btn btn-default pull-right'>
<i className='fa fa-pencil fa-lg'></i>
</Link>
<button className='btn btn-default pull-right' onClick={this.runSavedQuery}>
<i className='fa fa-play fa-lg'></i>
</button>
</pre>
{paramsTable}
</div>
)}
</div>
</section>
);
}
toggleQueryDetails () {
this.setState({ showDetail: !this.state.showDetail });
}
update (param) {
this.setState({
queryParams: _.assign({}, this.state.queryParams, {[param.name]: param})
});
}
runSavedQuery () {
let secretToken = UserStore.getUserDetails().secretToken;
let parameters = Object.keys(this.state.queryParams).map(paramName => {
return {
[paramName]: this.state.queryParams[paramName].defaultValue
};
});
AdhocQueryActions.runSavedQuery(secretToken, this.props.query.id, parameters);
}
}
SavedQueryPreview.propTypes = {
query: React.PropTypes.object,
params: React.PropTypes.object
};
export default SavedQueryPreview;
|
ReactComponents/UserDownloader.js | kunovg/pldownload | import React, { Component } from 'react';
import io from 'socket.io/node_modules/socket.io-client';
import PldAuthService from './PldAuthService';
import {Button, Table, ProgressBar} from 'react-bootstrap';
import FaDownload from 'react-icons/lib/fa/download';
import FaRefresh from 'react-icons/lib/fa/refresh';
import FaTrashO from 'react-icons/lib/fa/trash-o';
import FaPlus from 'react-icons/lib/fa/plus';
function OrigenFormatter(props){
return <img className={`pl-img-${props.value}`}/>
}
class Downloader extends Component {
constructor(){ super(); this.state={} }
render(){
if(!this.props.status){
return (
<Button
bsStyle="link"
className='pl-button'
disabled={this.props.disabled}
onClick={this.props.clickHandler}>
<FaDownload className="usr-dwnldr-icon" />
</Button>)
}
else if(this.props.status == "finished"){
return <a href={this.props.auth.getdownloadUrl(this.props.uuid)}>Descargar</a>
}
else return <ProgressBar className="pld-progress-bar" now={100 * this.props.c / this.props.t } />
}
}
class Updater extends Component {
constructor(){super(); this.state={}}
updatePlaylist(){
let {source, id, url} = this.props
let config = {source: source, id: id, url: url}
this.props.showLoading()
this.props.auth.updatePlaylist(config).then(res=>{
this.props.hideLoading()
this.props.updateTotalMissing(id, res.data)
})
}
render(){
return (<Button
bsStyle="link"
className='pl-button'
onClick={this.updatePlaylist.bind(this)}>
<FaRefresh className="usr-dwnldr-icon"/>
</Button>)
}
}
class PlaylistRow extends Component {
constructor(props){super(props); this.state={downloading: false}}
handleFullDownload(){
this.setState({downloading: true})
this.props.auth.downloadFull(this.props.id)
}
handlePartialDownload(){
this.setState({downloading: true})
this.props.auth.downloadPartial(this.props.id)
}
handleRemove(){
this.props.auth.unlinkPlaylist(this.props.id).then(res => {
this.props.removePlaylist(this.props.id)
})
}
render(){
return(<tr className='pl-table-row'>
<td className='pl-table-td'><Updater {...this.props}/></td>
<td className='pl-table-td'><OrigenFormatter value={this.props.source}/></td>
<td className='pl-table-td'><a className='pl-name' href={this.props.url} target="_blank">{this.props.name}</a></td>
<td className='pl-table-td'>{this.props.total}</td>
<td className='pl-table-td'>{this.props.missing}</td>
<td className='pl-table-td'><Downloader clickHandler={this.handleFullDownload.bind(this)} disabled={this.state.downloading} {...this.props}/></td>
<td className='pl-table-td'><Downloader clickHandler={this.handlePartialDownload.bind(this)} disabled={this.state.downloading} {...this.props}/></td>
<td className='pl-table-td'><Button onClick={this.handleRemove.bind(this)} disabled={this.state.downloading} bsStyle="link" className='pl-button delete-btn'><FaTrashO className="usr-dwnldr-icon" /></Button></td>
</tr>)
}
}
class PlaylistsTable extends Component {
constructor(props){super(props);}
render(){
let rows = this.props.playlists && this.props.playlists.map((obj,i) => <PlaylistRow
key={i}
{...this.props}
{...obj}/>)
if(rows && rows.length == 0){ rows = (<tr><td colSpan="8">No playlists</td></tr>) }
return(<Table responsive id='playliststable'>
<thead>
<tr>
<th className='pl-table-header'></th>
<th className='pl-table-header'></th>
<th className='pl-table-header'>Title</th>
<th className='pl-table-header'>Total</th>
<th className='pl-table-header'>Not downloaded</th>
<th className='pl-table-header'>Download all</th>
<th className='pl-table-header'>Download new</th>
<th className='pl-table-header'>Delete</th>
</tr>
</thead>
<tbody>
{rows}
</tbody>
</Table>)
}
}
class UserDownloader extends Component {
constructor(props){
super(props);
this.state = {
inputUrl: '',
playlists: [],
loading: false
}
}
componentDidMount(){
let _this = this,
userId = this.props.auth.getUserId(),
socket = io.connect('http://localhost:5000');
// Cargar las playlists
this.props.auth.getPlaylists().then(res =>{
_this.setState({playlists: res.data})
})
// WebSocket Listener
socket.on(`${userId}`, data => {
let playlists = _this.state.playlists;
playlists.forEach((p, i) => {
if(p.id == data.playlist_id){
playlists[i] = Object.assign({}, p, data)
}
})
_this.setState({playlists: playlists})
});
}
inputOnChange(e){ this.setState({inputUrl: e.target.value}) }
showLoading(){this.setState({loading: true})}
hideLoading(){this.setState({loading:false})}
removePlaylist(id){
let {playlists} = this.state;
this.setState({playlists: playlists.filter(p => p.id != id)})
}
updateTotalMissing(id, data){
let playlists = this.state.playlists;
let i = playlists.findIndex(p => p.id==id);
playlists[i] = Object.assign({}, playlists[i], data);
this.setState({playlists: playlists});
}
handleClick(){
let _this = this;
if (/youtube.com\/playlist\?list=.*|spotify.com\/user\/\d+|.+\/playlist\/.*|user:[^:]+:playlist:.*|soundcloud.com.*/.test(this.state.inputUrl)){
let config = {url: this.state.inputUrl}
this.showLoading()
this.props.auth.registerPlaylist(config).then(res=>{
this.hideLoading()
if(res.data){
_this.setState({playlists: _this.state.playlists.concat(res.data), inputUrl: ''})
}
})
}
else{alert('URL no valida')}
}
render(){
return(<div>
<h3>Add new playlist:</h3>
<input
type="text"
placeholder="Url"
className="mc-input bottom-border"
onChange={this.inputOnChange.bind(this)}
value={this.state.inputUrl}
/>
<Button
bsStyle="primary"
className='mc-button inline-button'
onClick={this.handleClick.bind(this)}>
<FaPlus className="usr-dwnldr-icon" /> Add</Button>
<PlaylistsTable
playlists={this.state.playlists}
removePlaylist={this.removePlaylist.bind(this)}
updateTotalMissing={this.updateTotalMissing.bind(this)}
showLoading={this.showLoading.bind(this)}
hideLoading={this.hideLoading.bind(this)}
auth={this.props.auth}/>
{this.state.loading ? <div className='body-loading'></div> : null}
</div>)
}
}
export default UserDownloader |
node_modules/[email protected]@rc-time-picker/es/TimePicker.js | ligangwolai/blog | 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';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Trigger from 'rc-trigger';
import Panel from './Panel';
import placements from './placements';
import moment from 'moment';
function noop() {}
function refFn(field, component) {
this[field] = component;
}
var Picker = function (_Component) {
_inherits(Picker, _Component);
function Picker(props) {
_classCallCheck(this, Picker);
var _this = _possibleConstructorReturn(this, (Picker.__proto__ || Object.getPrototypeOf(Picker)).call(this, props));
_initialiseProps.call(_this);
_this.saveInputRef = refFn.bind(_this, 'picker');
_this.savePanelRef = refFn.bind(_this, 'panelInstance');
var defaultOpen = props.defaultOpen,
defaultValue = props.defaultValue,
_props$open = props.open,
open = _props$open === undefined ? defaultOpen : _props$open,
_props$value = props.value,
value = _props$value === undefined ? defaultValue : _props$value;
_this.state = {
open: open,
value: value
};
return _this;
}
_createClass(Picker, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var value = nextProps.value,
open = nextProps.open;
if ('value' in nextProps) {
this.setState({
value: value
});
}
if (open !== undefined) {
this.setState({ open: open });
}
}
}, {
key: 'setValue',
value: function setValue(value) {
if (!('value' in this.props)) {
this.setState({
value: value
});
}
this.props.onChange(value);
}
}, {
key: 'getFormat',
value: function getFormat() {
var _props = this.props,
format = _props.format,
showHour = _props.showHour,
showMinute = _props.showMinute,
showSecond = _props.showSecond,
use12Hours = _props.use12Hours;
if (format) {
return format;
}
if (use12Hours) {
var fmtString = [showHour ? 'h' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) {
return !!item;
}).join(':');
return fmtString.concat(' a');
}
return [showHour ? 'HH' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) {
return !!item;
}).join(':');
}
}, {
key: 'getPanelElement',
value: function getPanelElement() {
var _props2 = this.props,
prefixCls = _props2.prefixCls,
placeholder = _props2.placeholder,
disabledHours = _props2.disabledHours,
disabledMinutes = _props2.disabledMinutes,
disabledSeconds = _props2.disabledSeconds,
hideDisabledOptions = _props2.hideDisabledOptions,
allowEmpty = _props2.allowEmpty,
showHour = _props2.showHour,
showMinute = _props2.showMinute,
showSecond = _props2.showSecond,
defaultOpenValue = _props2.defaultOpenValue,
clearText = _props2.clearText,
addon = _props2.addon,
use12Hours = _props2.use12Hours;
return React.createElement(Panel, {
clearText: clearText,
prefixCls: prefixCls + '-panel',
ref: this.savePanelRef,
value: this.state.value,
onChange: this.onPanelChange,
onClear: this.onPanelClear,
defaultOpenValue: defaultOpenValue,
showHour: showHour,
showMinute: showMinute,
showSecond: showSecond,
onEsc: this.onEsc,
allowEmpty: allowEmpty,
format: this.getFormat(),
placeholder: placeholder,
disabledHours: disabledHours,
disabledMinutes: disabledMinutes,
disabledSeconds: disabledSeconds,
hideDisabledOptions: hideDisabledOptions,
use12Hours: use12Hours,
addon: addon
});
}
}, {
key: 'getPopupClassName',
value: function getPopupClassName() {
var _props3 = this.props,
showHour = _props3.showHour,
showMinute = _props3.showMinute,
showSecond = _props3.showSecond,
use12Hours = _props3.use12Hours,
prefixCls = _props3.prefixCls;
var popupClassName = this.props.popupClassName;
// Keep it for old compatibility
if ((!showHour || !showMinute || !showSecond) && !use12Hours) {
popupClassName += ' ' + prefixCls + '-panel-narrow';
}
var selectColumnCount = 0;
if (showHour) {
selectColumnCount += 1;
}
if (showMinute) {
selectColumnCount += 1;
}
if (showSecond) {
selectColumnCount += 1;
}
if (use12Hours) {
selectColumnCount += 1;
}
popupClassName += ' ' + prefixCls + '-panel-column-' + selectColumnCount;
return popupClassName;
}
}, {
key: 'setOpen',
value: function setOpen(open) {
var _props4 = this.props,
onOpen = _props4.onOpen,
onClose = _props4.onClose;
if (this.state.open !== open) {
if (!('open' in this.props)) {
this.setState({ open: open });
}
if (open) {
onOpen({ open: open });
} else {
onClose({ open: open });
}
}
}
}, {
key: 'focus',
value: function focus() {
this.picker.focus();
}
}, {
key: 'render',
value: function render() {
var _props5 = this.props,
prefixCls = _props5.prefixCls,
placeholder = _props5.placeholder,
placement = _props5.placement,
align = _props5.align,
disabled = _props5.disabled,
transitionName = _props5.transitionName,
style = _props5.style,
className = _props5.className,
getPopupContainer = _props5.getPopupContainer,
name = _props5.name,
autoComplete = _props5.autoComplete;
var _state = this.state,
open = _state.open,
value = _state.value;
var popupClassName = this.getPopupClassName();
return React.createElement(
Trigger,
{
prefixCls: prefixCls + '-panel',
popupClassName: popupClassName,
popup: this.getPanelElement(),
popupAlign: align,
builtinPlacements: placements,
popupPlacement: placement,
action: disabled ? [] : ['click'],
destroyPopupOnHide: true,
getPopupContainer: getPopupContainer,
popupTransitionName: transitionName,
popupVisible: open,
onPopupVisibleChange: this.onVisibleChange
},
React.createElement(
'span',
{ className: prefixCls + ' ' + className, style: style },
React.createElement('input', {
className: prefixCls + '-input',
ref: this.saveInputRef,
type: 'text',
placeholder: placeholder,
name: name,
readOnly: true,
onKeyDown: this.onKeyDown,
disabled: disabled, value: value && value.format(this.getFormat()) || '',
autoComplete: autoComplete
}),
React.createElement('span', { className: prefixCls + '-icon' })
)
);
}
}]);
return Picker;
}(Component);
Picker.propTypes = {
prefixCls: PropTypes.string,
clearText: PropTypes.string,
value: PropTypes.object,
defaultOpenValue: PropTypes.object,
disabled: PropTypes.bool,
allowEmpty: PropTypes.bool,
defaultValue: PropTypes.object,
open: PropTypes.bool,
defaultOpen: PropTypes.bool,
align: PropTypes.object,
placement: PropTypes.any,
transitionName: PropTypes.string,
getPopupContainer: PropTypes.func,
placeholder: PropTypes.string,
format: PropTypes.string,
showHour: PropTypes.bool,
showMinute: PropTypes.bool,
showSecond: PropTypes.bool,
style: PropTypes.object,
className: PropTypes.string,
popupClassName: PropTypes.string,
disabledHours: PropTypes.func,
disabledMinutes: PropTypes.func,
disabledSeconds: PropTypes.func,
hideDisabledOptions: PropTypes.bool,
onChange: PropTypes.func,
onOpen: PropTypes.func,
onClose: PropTypes.func,
addon: PropTypes.func,
name: PropTypes.string,
autoComplete: PropTypes.string,
use12Hours: PropTypes.bool
};
Picker.defaultProps = {
clearText: 'clear',
prefixCls: 'rc-time-picker',
defaultOpen: false,
style: {},
className: '',
popupClassName: '',
align: {},
defaultOpenValue: moment(),
allowEmpty: true,
showHour: true,
showMinute: true,
showSecond: true,
disabledHours: noop,
disabledMinutes: noop,
disabledSeconds: noop,
hideDisabledOptions: false,
placement: 'bottomLeft',
onChange: noop,
onOpen: noop,
onClose: noop,
addon: noop,
use12Hours: false
};
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.onPanelChange = function (value) {
_this2.setValue(value);
};
this.onPanelClear = function () {
_this2.setValue(null);
_this2.setOpen(false);
};
this.onVisibleChange = function (open) {
_this2.setOpen(open);
};
this.onEsc = function () {
_this2.setOpen(false);
_this2.focus();
};
this.onKeyDown = function (e) {
if (e.keyCode === 40) {
_this2.setOpen(true);
}
};
};
export default Picker; |
client/node_modules/uu5g03/doc/main/server/public/data/source/uu5-bricks-pager.js | UnicornCollege/ucl.itkpd.configurator | import React from 'react';
import {BaseMixin, ElementaryMixin, ColorSchemaMixin, Tools} from '../common/common.js';
import {RowMixin, Row, Column, Wrapper, Flc} from '../layout/layout.js';
import Glyphicon from './glyphicon.js';
import Link from './link.js';
import './pager.less';
export const Pager = React.createClass({
//@@viewOn:mixins
mixins: [
BaseMixin,
ElementaryMixin,
ColorSchemaMixin,
RowMixin
],
//@@viewOff:mixins
//@@viewOn:statics
statics: {
tagName: 'UU5.Bricks.Pager',
classNames: {
main: 'uu5-bricks-pager uu5-common-text',
link: 'uu5-bricks-pager-link',
leftLink: 'uu5-bricks-pager-left',
rightLink: 'uu5-bricks-pager-right',
upLink: 'uu5-bricks-pager-up',
downLink: 'uu5-bricks-pager-down',
text: 'uu5-bricks-pager-text',
glyphicon: 'uu5-bricks-pager-glyphicon',
//bg: 'uu5-common-bg'
},
defaults: {
leftLink: 'uu-glyphicon-arrow-left',
rightLink: 'uu-glyphicon-arrow-right',
upLink: 'uu-glyphicon-arrow-up',
downLink: 'uu-glyphicon-arrow-down'
}
},
//@@viewOff:statics
//@@viewOn:propTypes
propTypes: {
leftLink: React.PropTypes.shape({
text: React.PropTypes.string,
href: React.PropTypes.string,
glyphicon: React.PropTypes.string,
onClick: React.PropTypes.function
}),
rightLink: React.PropTypes.shape({
text: React.PropTypes.string,
href: React.PropTypes.string,
glyphicon: React.PropTypes.string,
onClick: React.PropTypes.function
}),
upLink: React.PropTypes.shape({
text: React.PropTypes.string,
href: React.PropTypes.string,
glyphicon: React.PropTypes.string,
onClick: React.PropTypes.function
}),
downLink: React.PropTypes.shape({
text: React.PropTypes.string,
href: React.PropTypes.string,
glyphicon: React.PropTypes.string,
onClick: React.PropTypes.function
}),
//background: React.PropTypes.bool
},
//@@viewOff:propTypes
//@@viewOn:getDefaultProps
getDefaultProps: function () {
return {
leftLink: null,
rightLink: null,
upLink: null,
downLink: null,
//background: false
};
},
//@@viewOff:getDefaultProps
//@@viewOn:standardComponentLifeCycle
//@@viewOff:standardComponentLifeCycle
//@@viewOn:interface
//@@viewOff:interface
//@@viewOn:overridingMethods
//@@viewOff:overridingMethods
//@@viewOn:componentSpecificHelpers
_getColumn: function (key) {
var link = null;
if (this.props[key]) {
var linkProps = Tools.merge({}, this.props[key]);
linkProps.className = linkProps.className ? linkProps.className + ' ' + this.getClassName().link : this.getClassName().link;
var text = linkProps.text;
delete linkProps.text;
var glyphicon = (
<Glyphicon
glyphicon={linkProps.glyphicon || this.getDefault(key)}
className={this.getClassName().glyphicon}
title={text}
/>
);
var leftGlyphicon = null;
var rightGlyphicon = null;
if (key === 'leftLink' || key === 'upLink') {
leftGlyphicon = glyphicon;
} else {
rightGlyphicon = glyphicon;
}
link = (
<Link {...linkProps}>
{leftGlyphicon} <span className={this.getClassName().text}>{text}</span> {rightGlyphicon}
</Link>
);
}
return (
<Column className={this.getClassName(key)} colWidth='xs-3'>
<Wrapper>
<Flc>
{link}
</Flc>
</Wrapper>
</Column>
);
},
//@@viewOff:componentSpecificHelpers
//@@viewOn:render
render: function () {
var mainProps = this.getMainPropsToPass();
//this.props.background && (mainProps.className += ' ' + this.getClassName().bg);
return (
<Row {...mainProps}>
{this._getColumn('leftLink')}
{this._getColumn('upLink')}
{this._getColumn('downLink')}
{this._getColumn('rightLink')}
</Row>
);
}
//@@viewOff:render
});
export default Pager; |
Console/app/node_modules/rc-calendar/es/calendar/CalendarHeader.js | RisenEsports/RisenEsports.github.io | import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import MonthPanel from '../month/MonthPanel';
import YearPanel from '../year/YearPanel';
import toFragment from 'rc-util/es/Children/mapSelf';
function goMonth(direction) {
var next = this.props.value.clone();
next.add(direction, 'months');
this.props.onValueChange(next);
}
function goYear(direction) {
var next = this.props.value.clone();
next.add(direction, 'years');
this.props.onValueChange(next);
}
function showIf(condition, el) {
return condition ? el : null;
}
var CalendarHeader = createReactClass({
displayName: 'CalendarHeader',
propTypes: {
prefixCls: PropTypes.string,
value: PropTypes.object,
onValueChange: PropTypes.func,
showTimePicker: PropTypes.bool,
showMonthPanel: PropTypes.bool,
showYearPanel: PropTypes.bool,
onPanelChange: PropTypes.func,
locale: PropTypes.object,
enablePrev: PropTypes.any,
enableNext: PropTypes.any,
disabledMonth: PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
enableNext: 1,
enablePrev: 1,
onPanelChange: function onPanelChange() {},
onValueChange: function onValueChange() {}
};
},
getInitialState: function getInitialState() {
this.nextMonth = goMonth.bind(this, 1);
this.previousMonth = goMonth.bind(this, -1);
this.nextYear = goYear.bind(this, 1);
this.previousYear = goYear.bind(this, -1);
var _props = this.props,
showMonthPanel = _props.showMonthPanel,
showYearPanel = _props.showYearPanel;
return { showMonthPanel: showMonthPanel, showYearPanel: showYearPanel };
},
componentWillReceiveProps: function componentWillReceiveProps() {
var props = this.props;
if ('showMonthpanel' in props) {
this.setState({ showMonthPanel: props.showMonthPanel });
}
if ('showYearpanel' in props) {
this.setState({ showYearPanel: props.showYearPanel });
}
},
onSelect: function onSelect(value) {
this.triggerPanelChange({
showMonthPanel: 0,
showYearPanel: 0
});
this.props.onValueChange(value);
},
triggerPanelChange: function triggerPanelChange(panelStatus) {
if (!('showMonthPanel' in this.props)) {
this.setState({ showMonthPanel: panelStatus.showMonthPanel });
}
if (!('showYearPanel' in this.props)) {
this.setState({ showYearPanel: panelStatus.showYearPanel });
}
this.props.onPanelChange(panelStatus);
},
monthYearElement: function monthYearElement(showTimePicker) {
var props = this.props;
var prefixCls = props.prefixCls;
var locale = props.locale;
var value = props.value;
var localeData = value.localeData();
var monthBeforeYear = locale.monthBeforeYear;
var selectClassName = prefixCls + '-' + (monthBeforeYear ? 'my-select' : 'ym-select');
var year = React.createElement(
'a',
{
className: prefixCls + '-year-select',
role: 'button',
onClick: showTimePicker ? null : this.showYearPanel,
title: locale.yearSelect
},
value.format(locale.yearFormat)
);
var month = React.createElement(
'a',
{
className: prefixCls + '-month-select',
role: 'button',
onClick: showTimePicker ? null : this.showMonthPanel,
title: locale.monthSelect
},
localeData.monthsShort(value)
);
var day = void 0;
if (showTimePicker) {
day = React.createElement(
'a',
{
className: prefixCls + '-day-select',
role: 'button'
},
value.format(locale.dayFormat)
);
}
var my = [];
if (monthBeforeYear) {
my = [month, day, year];
} else {
my = [year, month, day];
}
return React.createElement(
'span',
{ className: selectClassName },
toFragment(my)
);
},
showMonthPanel: function showMonthPanel() {
this.triggerPanelChange({
showMonthPanel: 1,
showYearPanel: 0
});
},
showYearPanel: function showYearPanel() {
this.triggerPanelChange({
showMonthPanel: 0,
showYearPanel: 1
});
},
render: function render() {
var props = this.props,
state = this.state;
var prefixCls = props.prefixCls,
locale = props.locale,
value = props.value,
showTimePicker = props.showTimePicker,
enableNext = props.enableNext,
enablePrev = props.enablePrev,
disabledMonth = props.disabledMonth;
var panel = null;
if (state.showMonthPanel) {
panel = React.createElement(MonthPanel, {
locale: locale,
defaultValue: value,
rootPrefixCls: prefixCls,
onSelect: this.onSelect,
disabledDate: disabledMonth
});
} else if (state.showYearPanel) {
panel = React.createElement(YearPanel, {
locale: locale,
defaultValue: value,
rootPrefixCls: prefixCls,
onSelect: this.onSelect
});
}
return React.createElement(
'div',
{ className: prefixCls + '-header' },
React.createElement(
'div',
{ style: { position: 'relative' } },
showIf(enablePrev && !showTimePicker, React.createElement('a', {
className: prefixCls + '-prev-year-btn',
role: 'button',
onClick: this.previousYear,
title: locale.previousYear
})),
showIf(enablePrev && !showTimePicker, React.createElement('a', {
className: prefixCls + '-prev-month-btn',
role: 'button',
onClick: this.previousMonth,
title: locale.previousMonth
})),
this.monthYearElement(showTimePicker),
showIf(enableNext && !showTimePicker, React.createElement('a', {
className: prefixCls + '-next-month-btn',
onClick: this.nextMonth,
title: locale.nextMonth
})),
showIf(enableNext && !showTimePicker, React.createElement('a', {
className: prefixCls + '-next-year-btn',
onClick: this.nextYear,
title: locale.nextYear
}))
),
panel
);
}
});
export default CalendarHeader; |
src/website/app/demos/Grid/common/renderGridItems.js | mineral-ui/mineral-ui | /* @flow */
import React from 'react';
import GridItem from './DemoGridItem';
export default function renderGridItems(count: number) {
let gridItems = [];
for (let i = 0; i < count; i++) {
gridItems.push(<GridItem key={i}>{i + 1}</GridItem>);
}
return gridItems;
}
|
src/renderer/libraries/application.js | babie/retro-twitter-client | import _ from 'lodash'
import application from '../singletons/application'
import ChannelSelector from '../command-models/channel-selector'
import DefaultWebBrowser from '../command-models/default-web-browser'
import ipc from 'ipc'
import React from 'react'
import Root from '../components/root'
import TwitterAccount from '../command-models/twitter-account'
export default class Application {
get channelSelector() {
return _.memoize(() => {
return new ChannelSelector({
twitterAccount: this.twitterAccount
});
})();
}
get defaultWebBrowser() {
return _.memoize(() => {
return new DefaultWebBrowser();
})();
}
get propertiesForView() {
return {
channelSelector: this.channelSelector,
defaultWebBrowser: this.defaultWebBrowser,
onAnchorClicked: this.onAnchorClicked.bind(this),
onChannelClicked: this.onChannelClicked.bind(this),
onSearchQueryStringSubmitted: this.onSearchQueryStringSubmitted.bind(this),
onTweetSubmitted: this.onTweetSubmitted.bind(this),
twitterAccount: this.twitterAccount
}
}
get twitterAccount() {
return _.memoize(() => {
return new TwitterAccount({
accessToken: application.accessToken,
accessTokenSecret: application.accessTokenSecret,
consumerKey: application.consumerKey,
consumerSecret: application.consumerSecret
});
})();
}
fetchAndSubscribeUserData() {
this.twitterAccount.fetchAndSubscribeUserData();
}
onAnchorClicked(url) {
this.defaultWebBrowser.openUrl(url);
}
onChannelClicked(channelId) {
this.channelSelector.selectChannel(channelId);
}
onSearchQueryStringSubmitted(queryString) {
this.channelSelector.selectSearchChannel();
this.twitterAccount.searchTweets({ queryString });
this.twitterAccount.subscribeFilteredStream({ queryString });
}
onTweetSubmitted(text) {
this.twitterAccount.postTweet(text);
}
renderView() {
React.render(
<Root {...this.propertiesForView} />,
document.body
);
}
run() {
this.renderView();
this.fetchAndSubscribeUserData();
this.subscribeGlobalShortcutEvents();
}
subscribeGlobalShortcutEvents() {
ipc.on('select-next-channel-requested', () => {
this.channelSelector.selectNextChannel();
});
ipc.on('select-previous-channel-requested', () => {
this.channelSelector.selectPreviousChannel();
});
}
}
|
src/svg-icons/editor/border-inner.js | mit-cml/iot-website-source | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorBorderInner = (props) => (
<SvgIcon {...props}>
<path d="M3 21h2v-2H3v2zm4 0h2v-2H7v2zM5 7H3v2h2V7zM3 17h2v-2H3v2zM9 3H7v2h2V3zM5 3H3v2h2V3zm12 0h-2v2h2V3zm2 6h2V7h-2v2zm0-6v2h2V3h-2zm-4 18h2v-2h-2v2zM13 3h-2v8H3v2h8v8h2v-8h8v-2h-8V3zm6 18h2v-2h-2v2zm0-4h2v-2h-2v2z"/>
</SvgIcon>
);
EditorBorderInner = pure(EditorBorderInner);
EditorBorderInner.displayName = 'EditorBorderInner';
EditorBorderInner.muiName = 'SvgIcon';
export default EditorBorderInner;
|
src/js/applets/applet.js | SpaceHexagon/pylon | import React from 'react';
export default class Applet extends React.Component {
constructor() {
super();
// Initial state of the component
this.state = {name: 'generic applet'}
}
setName(name) {
// When there's a change in the state, the component and all its sub-components get updated.
this.setState({name: name});
}
close () {
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this).parentNode);
}
render(){
return (
<section className="applet">
<nav className="panel">
</nav>
</section>
);
}
}
Applet.defaultProps = {
appletData: {},
key: "Applet Name",
name: "Applet Name"
};
|
src/client/home/components/Menu/Menu.js | noahamar/smlscrn | import React from 'react';
import classNames from 'classnames/bind';
import styles from './Menu.styl';
const cx = classNames.bind(styles);
export default class Menu extends React.Component {
constructor() {
super();
}
render() {
return (
<div className={cx('Menu', { 'Menu--show': this.props.isShowMenu })}>
<div className={cx('Menu__background')} onClick={this.props.toggleMenu}></div>
<div className={cx('Menu__wrapper')}>
<div className={cx('Menu__logo')}></div>
<div className={cx('Menu__close-button')}></div>
<ul className={cx('Menu__items')}>
<li className={cx('Menu__item')}><a className={cx('Menu__item-link')} href="https://github.com/noahamar/smlscrn">View on GitHub</a></li>
<li className={cx('Menu__item')}><a className={cx('Menu__item-link')} href="https://www.themoviedb.org/documentation/api">TMDb API</a></li>
<li className={cx('Menu__item')}><a className={cx('Menu__item-link')} onClick={this.props.toggleMenu}>Back</a></li>
</ul>
</div>
</div>
);
}
}
|
client/src/app/routes/graphs/containers/HighchartTables.js | zraees/sms-project | import React from 'react'
import {Stats, BigBreadcrumbs, WidgetGrid, JarvisWidget} from '../../../components'
import HighchartTable from '../../../components/graphs/highchart/HighchartTable'
export default () => (
(
<div id="content">
<div className="row">
<BigBreadcrumbs items={['HighchartTable']} icon="fa fa-fw fa-bar-chart-o" className="col-xs-12 col-sm-7 col-md-7 col-lg-4"/>
<Stats />
</div>
<WidgetGrid>
{/* row */}
<div className="row">
<div className="col-sm-12">
<div className="alert alert-info">
<h3 className="no-margin">jQuery HighchartTable</h3>
<h5>Convert your HTML data tables into fancy Highcharts graphs without any coding!</h5>
<ul>
<li>The HighchartTable plugin takes data and attributes from a table and parses them to simply create an
Hightcharts chart
</li>
<li>Control the graph dynamically and easily without any javascript</li>
<li>Builds automatically during page load, all you need to do is load the plugin</li>
<li>See the full documentation <a href="http://highcharttable.org/#documentation"
target="_blank"><strong>here <i className="fa fa-link"/> </strong>
</a></li>
</ul>
</div>
<div className="col-sm-12 well">
<div className="col-sm-6">
<HighchartTable className="highchart table table-hover table-bordered"
data-graph-container=".. .. .highchart-container2" data-graph-type="column">
<caption>Column example</caption>
<thead>
<tr>
<th>Month</th>
<th className="">Sales</th>
<th className="">Benefits</th>
<th className="">Expenses</th>
<th className="">Prediction</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td className="">8000</td>
<td className="">2000</td>
<td className="">1000</td>
<td className="">9000</td>
</tr>
<tr>
<td>February</td>
<td className="">12000</td>
<td className="">3000</td>
<td className="">1300</td>
<td className="">10000</td>
</tr>
<tr>
<td>March</td>
<td className="">18000</td>
<td className="">4000</td>
<td className="">1240</td>
<td className="">11000</td>
</tr>
<tr>
<td>April</td>
<td className="">2000</td>
<td className="">-1000</td>
<td className="">-150</td>
<td className="">13000</td>
</tr>
<tr>
<td>May</td>
<td className="">500</td>
<td className="">-2500</td>
<td className="">1000</td>
<td className="">14000</td>
</tr>
<tr>
<td>June</td>
<td className="">600</td>
<td className="">-500</td>
<td className="">-500</td>
<td className="">15000</td>
</tr>
</tbody>
</HighchartTable>
</div>
<div className="col-sm-6">
<div className="highchart-container2"/>
</div>
</div>
<div className="col-sm-12 well">
<div className="col-sm-6">
<HighchartTable className="highchart table table-hover table-bordered"
data-graph-container=".. .. .highchart-container" data-graph-type="line">
<caption>Line example</caption>
<thead>
<tr>
<th>Month</th>
<th>Sales</th>
<th>Benefits</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>8000</td>
<td>2000</td>
</tr>
<tr>
<td>February</td>
<td>12000</td>
<td>3000</td>
</tr>
<tr>
<td>March</td>
<td>18000</td>
<td>4000</td>
</tr>
<tr>
<td>April</td>
<td>2000</td>
<td>-1000</td>
</tr>
<tr>
<td>May</td>
<td>500</td>
<td>-2500</td>
</tr>
</tbody>
</HighchartTable>
</div>
<div className="col-sm-6">
<div className="highchart-container"/>
</div>
</div>
<div className="col-sm-12 well">
<div className="col-sm-6">
<HighchartTable className="highchart table table-hover table-bordered"
data-graph-container=".. .. .highchart-container3" data-graph-type="column">
<caption>Column + area example</caption>
<thead>
<tr>
<th>Month</th>
<th>Sales</th>
<th data-graph-type="area">Benefits</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>8000</td>
<td>2000</td>
</tr>
<tr>
<td>February</td>
<td>12000</td>
<td>3000</td>
</tr>
<tr>
<td>March</td>
<td>18000</td>
<td>4000</td>
</tr>
<tr>
<td>April</td>
<td>2000</td>
<td>-1000</td>
</tr>
<tr>
<td>May</td>
<td>500</td>
<td>-2500</td>
</tr>
</tbody>
</HighchartTable>
</div>
<div className="col-sm-6 ">
<div className="highchart-container3"/>
</div>
</div>
</div>
{/* end row */}
</div>
{/* end row */}
</WidgetGrid>
</div>
)
) |
js/components/list/list-thumbnail.js | YeisonGomez/RNAmanda |
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { actions } from 'react-native-navigation-redux-helpers';
import { Container, Header, Title, Content, Button, Icon, List, ListItem, Text, Thumbnail, Left, Body, Right } from 'native-base';
import { Actions } from 'react-native-router-flux';
import styles from './styles';
const sankhadeep = require('../../../img/contacts/sankhadeep.png');
const supriya = require('../../../img/contacts/supriya.png');
const himanshu = require('../../../img/contacts/himanshu.png');
const shweta = require('../../../img/contacts/shweta.png');
const shruti = require('../../../img/contacts/shruti.png');
const datas = [
{
img: sankhadeep,
text: 'Sankhadeep',
note: 'Its time to build a difference . .',
},
{
img: supriya,
text: 'Supriya',
note: 'One needs courage to be happy and smiling all time . . ',
},
{
img: himanshu,
text: 'Himanshu',
note: 'Live a life style that matchs your vision',
},
{
img: shweta,
text: 'Shweta',
note: 'Failure is temporary, giving up makes it permanent',
},
{
img: shruti,
text: 'Shruti',
note: 'The biggest risk is a missed opportunity !!',
},
];
const {
popRoute,
} = actions;
class NHListThumbnail extends Component {
static propTypes = {
popRoute: React.PropTypes.func,
navigation: React.PropTypes.shape({
key: React.PropTypes.string,
}),
}
popRoute() {
this.props.popRoute(this.props.navigation.key);
}
render() {
return (
<Container style={styles.container}>
<Header>
<Left>
<Button transparent onPress={() => Actions.pop()}>
<Icon name="arrow-back" />
</Button>
</Left>
<Body>
<Title>List Thumbnail</Title>
</Body>
<Right />
</Header>
<Content>
<List
dataArray={datas} renderRow={data =>
<ListItem thumbnail>
<Left>
<Thumbnail square size={55} source={data.img} />
</Left>
<Body>
<Text>{data.text}</Text>
<Text numberOfLines={1} note>{data.note}</Text>
</Body>
<Right>
<Button transparent>
<Text>View</Text>
</Button>
</Right>
</ListItem>
}
/>
</Content>
</Container>
);
}
}
function bindAction(dispatch) {
return {
popRoute: key => dispatch(popRoute(key)),
};
}
const mapStateToProps = state => ({
navigation: state.cardNavigation,
themeState: state.drawer.themeState,
});
export default connect(mapStateToProps, bindAction)(NHListThumbnail);
|
src/routes/contact/index.js | samdenicola/react-starter-kit | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '../../components/Layout';
import Contact from './Contact';
const title = 'Contact Us';
export default {
path: '/contact',
action() {
return {
title,
component: <Layout><Contact title={title} /></Layout>,
};
},
};
|
src/components/about_me/about_me.js | jetshoji/Asia_Trip | import React, { Component } from 'react';
class AboutMe extends Component{
render(){
return(
<div>
<p>Welcome to Welcome
</p>
</div>
);
}
}
export default AboutMe;
|
src/svg-icons/image/rotate-90-degrees-ccw.js | hai-cea/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageRotate90DegreesCcw = (props) => (
<SvgIcon {...props}>
<path d="M7.34 6.41L.86 12.9l6.49 6.48 6.49-6.48-6.5-6.49zM3.69 12.9l3.66-3.66L11 12.9l-3.66 3.66-3.65-3.66zm15.67-6.26C17.61 4.88 15.3 4 13 4V.76L8.76 5 13 9.24V6c1.79 0 3.58.68 4.95 2.05 2.73 2.73 2.73 7.17 0 9.9C16.58 19.32 14.79 20 13 20c-.97 0-1.94-.21-2.84-.61l-1.49 1.49C10.02 21.62 11.51 22 13 22c2.3 0 4.61-.88 6.36-2.64 3.52-3.51 3.52-9.21 0-12.72z"/>
</SvgIcon>
);
ImageRotate90DegreesCcw = pure(ImageRotate90DegreesCcw);
ImageRotate90DegreesCcw.displayName = 'ImageRotate90DegreesCcw';
ImageRotate90DegreesCcw.muiName = 'SvgIcon';
export default ImageRotate90DegreesCcw;
|
src/svg-icons/maps/map.js | matthewoates/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsMap = (props) => (
<SvgIcon {...props}>
<path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z"/>
</SvgIcon>
);
MapsMap = pure(MapsMap);
MapsMap.displayName = 'MapsMap';
MapsMap.muiName = 'SvgIcon';
export default MapsMap;
|
docs/app/Examples/elements/Button/Content/ButtonExampleMultipleConditionals.js | aabustamante/Semantic-UI-React | import React from 'react'
import { Button } from 'semantic-ui-react'
const ButtonExampleMultipleConditionals = () => (
<Button.Group>
<Button>One</Button>
<Button.Or />
<Button>Two</Button>
<Button.Or />
<Button>Three</Button>
</Button.Group>
)
export default ButtonExampleMultipleConditionals
|
app/javascript/mastodon/features/ui/components/column_subheading.js | imas/mastodon | import React from 'react';
import PropTypes from 'prop-types';
const ColumnSubheading = ({ text }) => {
return (
<div className='column-subheading'>
{text}
</div>
);
};
ColumnSubheading.propTypes = {
text: PropTypes.string.isRequired,
};
export default ColumnSubheading;
|
app/components/Footer/index.js | Figedi/denon_menu | import React, { Component } from 'react';
import { Toolbar } from 'react-photonkit';
export default class Footer extends Component {
props: {
onQuit: () => void
};
render() {
return (
<Toolbar ptType="footer">
<div className="toolbar-actions">
<button onClick={this.props.onQuit} className="btn btn-primary pull-right">
Close
</button>
</div>
</Toolbar>
);
}
}
|
example/examples/AnimatedMarkers.js | ali-alamine/react-native-maps | import React from 'react';
import {
StyleSheet,
View,
Text,
Dimensions,
TouchableOpacity,
Animated,
} from 'react-native';
import MapView from 'react-native-maps';
const screen = Dimensions.get('window');
const ASPECT_RATIO = screen.width / screen.height;
const LATITUDE = 37.78825;
const LONGITUDE = -122.4324;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
class AnimatedMarkers extends React.Component {
constructor(props) {
super(props);
this.state = {
coordinate: new Animated.Region({
latitude: LATITUDE,
longitude: LONGITUDE,
}),
};
}
animate() {
const { coordinate } = this.state;
coordinate.timing({
latitude: LATITUDE + ((Math.random() - 0.5) * (LATITUDE_DELTA / 2)),
longitude: LONGITUDE + ((Math.random() - 0.5) * (LONGITUDE_DELTA / 2)),
}).start();
}
render() {
return (
<View style={styles.container}>
<MapView
provider={this.props.provider}
style={styles.map}
initialRegion={{
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
>
<MapView.Marker.Animated
coordinate={this.state.coordinate}
/>
</MapView>
<View style={styles.buttonContainer}>
<TouchableOpacity
onPress={this.animate}
style={[styles.bubble, styles.button]}
>
<Text>Animate</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
AnimatedMarkers.propTypes = {
provider: MapView.ProviderPropType,
};
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
justifyContent: 'flex-end',
alignItems: 'center',
},
map: {
...StyleSheet.absoluteFillObject,
},
bubble: {
flex: 1,
backgroundColor: 'rgba(255,255,255,0.7)',
paddingHorizontal: 18,
paddingVertical: 12,
borderRadius: 20,
},
latlng: {
width: 200,
alignItems: 'stretch',
},
button: {
width: 80,
paddingHorizontal: 12,
alignItems: 'center',
marginHorizontal: 10,
},
buttonContainer: {
flexDirection: 'row',
marginVertical: 20,
backgroundColor: 'transparent',
},
});
module.exports = AnimatedMarkers;
|
src/containers/DevTools.js | steelx/ReduxWeatherApp | import React from 'react'
import { createDevTools } from 'redux-devtools'
import LogMonitor from 'redux-devtools-log-monitor'
import DockMonitor from 'redux-devtools-dock-monitor'
export default createDevTools(
<DockMonitor
toggleVisibilityKey='ctrl-h'
changePositionKey='ctrl-q' >
<LogMonitor />
</DockMonitor>
)
|
src/helpers/universalRouter.js | DenisPostu/react-redux-universal-hot-example | import qs from 'query-string';
import React from 'react';
import {match, RoutingContext} from 'react-router';
import createRoutes from '../routes';
import {Provider} from 'react-redux';
const getFetchData = (component = {}) => {
return component.WrappedComponent ?
getFetchData(component.WrappedComponent) :
component.fetchData;
};
const fetchDataForContainers = (containers, store, params, query) => {
const promises = containers
.filter((component) => getFetchData(component)) // only look at ones with a static fetchData()
.map(getFetchData) // pull out fetch data methods
.map(fetchData => fetchData(store, params, query || {})); // call fetch data methods and save promises
return Promise.all(promises);
};
export default function universalRouter(location, history, store, preload) {
const routes = createRoutes(history);
return new Promise((resolve, reject) => {
match({routes, history, location}, (error, redirectLocation, renderProps) => {
if (error) {
return reject(error);
}
if (redirectLocation) {
return resolve({
redirectLocation
});
}
function resolveWithComponent() {
const component = (
<Provider store={store} key="provider">
<RoutingContext {...renderProps}/>
</Provider>
);
resolve({
component
});
}
if (preload) {
fetchDataForContainers(
renderProps.components,
store,
renderProps.params,
qs.parse(renderProps.location.search)
)
.then(() => resolveWithComponent(), err => reject(err));
} else {
resolveWithComponent();
}
});
});
}
|
hello-react/src/comment/components/CommentList.js | treason258/TreLibrary | import React from 'react';
import BaseComponent from '../BaseComponent.js'
import CommentItem from "./CommentItem";
class CommentList extends BaseComponent {
static defaultProps = {
comments: []
}
handleDeleteComment(index) {
if (this.props.onDeleteComment) {
this.props.onDeleteComment(index)
}
}
render() {
return (
<div>
{this.props.comments.map((comment, i) =>
<CommentItem
comment={comment}
key={i}
index={i}
onDeleteComment={this.handleDeleteComment.bind(this)}/>
)}
</div>
)
}
}
export default CommentList; |
packages/wix-style-react/src/Highlighter/HighlightedItem.js | wix/wix-style-react | import React from 'react';
import PropTypes from 'prop-types';
import escapeRegExp from 'lodash/escapeRegExp';
class HighlightedItem extends React.PureComponent {
static propTypes = {
/** Applied as data-hook HTML attribute that can be used in the tests */
dataHook: PropTypes.string,
match: PropTypes.string,
caseSensitive: PropTypes.bool,
};
renderElement() {
const { children, match } = this.props;
if (match) {
const matchRegExp = this.getMatchRegExp();
return this.highlightChildren(children, matchRegExp);
}
return children;
}
getMatchRegExp() {
const { match, caseSensitive } = this.props;
return new RegExp(escapeRegExp(match), caseSensitive ? '' : 'i');
}
getMatchBoundaries(subject, matchRegExp) {
const matches = matchRegExp.exec(subject);
if (matches) {
return {
first: matches.index,
last: matches.index + matches[0].length,
};
}
}
getMatchReactKey(index) {
return `match-index-${index}`;
}
highlightChildren(children, matchRegExp) {
const processedChildren = [];
let matchIndex = 0;
while (children) {
if (!matchRegExp.test(children)) {
processedChildren.push(
this.renderPlain(children, this.getMatchReactKey(matchIndex++)),
);
return processedChildren;
}
const boundaries = this.getMatchBoundaries(children, matchRegExp);
const nonMatch = children.slice(0, boundaries.first);
if (nonMatch) {
processedChildren.push(
this.renderPlain(nonMatch, this.getMatchReactKey(matchIndex++)),
);
}
const match = children.slice(boundaries.first, boundaries.last);
if (match) {
processedChildren.push(
this.renderHighlight(match, this.getMatchReactKey(matchIndex++)),
);
}
children = children.slice(boundaries.last);
}
return processedChildren;
}
renderPlain(plainString, key) {
return <span key={key}>{plainString}</span>;
}
renderHighlight(matchString, key) {
return React.createElement('strong', { key }, matchString);
}
render() {
const { dataHook } = this.props;
return <span data-hook={dataHook}>{this.renderElement()}</span>;
}
}
export default HighlightedItem;
|
src/svg-icons/editor/mode-comment.js | nathanmarks/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorModeComment = (props) => (
<SvgIcon {...props}>
<path d="M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18z"/>
</SvgIcon>
);
EditorModeComment = pure(EditorModeComment);
EditorModeComment.displayName = 'EditorModeComment';
EditorModeComment.muiName = 'SvgIcon';
export default EditorModeComment;
|
web/myonlineband-react/src/index.js | myonlineband/MyOnlineBand | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
|
node_modules/react-shadow/example/js/app.js | myapos/ClientManagerSpringBoot | import React from 'react';
import { render } from 'react-dom';
import ready from 'document-ready-promise';
import Weather from './weather';
ready().then(() => render(<Weather />, document.querySelector('section.container')));
|
examples/universal/client/index.js | motephyr/redux | import 'babel-core/polyfill';
import React from 'react';
import { Provider } from 'react-redux';
import configureStore from '../common/store/configureStore';
import App from '../common/containers/App';
const initialState = window.__INITIAL_STATE__;
const store = configureStore(initialState);
const rootElement = document.getElementById('app');
React.render(
<Provider store={store}>
{() => <App/>}
</Provider>,
rootElement
);
|
test/integration/static/pages/dynamic.js | nelak/next.js | /* global location */
import React from 'react'
import Link from 'next/link'
export default class DynamicPage extends React.Component {
state = {}
static getInitialProps ({ query }) {
return { text: query.text }
}
componentDidMount () {
const [, hash] = location.href.split('#')
this.setState({ hash })
}
render () {
const { text } = this.props
const { hash } = this.state
return (
<div id='dynamic-page'>
<div>
<Link href='/'>
<a>Go Back</a>
</Link>
</div>
<p>{ text }</p>
<div id='hash'>Hash: {hash}</div>
</div>
)
}
}
|
src/index.js | RanjithNair/RJTube | // modules
import { AppContainer } from 'react-hot-loader'
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { syncHistoryWithStore } from 'react-router-redux'
import { browserHistory } from 'react-router'
import injectTapEventPlugin from 'react-tap-event-plugin'
import 'react-select/dist/react-select.css'
// api
import FirebaseApi from './api/firebase'
// import LogRocket from 'logrocket'
// actions
import { authInitialized } from './actions/authActions'
import { ajaxCallError, beginAjaxCall } from './actions/ajaxStatusActions'
// components
import App from './components/App'
// Store
import initialState from './reducers/initialState'
import configureStore from './store/configureStore' // eslint-disable-line import/default
import { install } from 'offline-plugin/runtime'
// styles
import './styles/search.css'
import './styles/styles.css' // Webpack can import CSS files too!
import '../node_modules/bootstrap/dist/css/bootstrap.min.css'
import '../node_modules/toastr/build/toastr.min.css'
import './ReactotronConfig'
// LogRocket.init('c3fbge/rjtube')
// store initialization
const store = configureStore(initialState)
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store)
const rootEl = document.getElementById('root')
// Initialize Firebase Auth and then start the app
store.dispatch(beginAjaxCall())
install()
FirebaseApi.initAuth()
.then(user => {
store.dispatch(authInitialized(user))
injectTapEventPlugin()
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<App history={history} store={store} />
</Provider>
</AppContainer>,
rootEl
)
if (module.hot) {
module.hot.accept('./components/App', () => {
// If you use Webpack 2 in ES modules mode, you can
// use <App /> here rather than require() a <NextApp />.
const NextApp = require('./components/App').default // eslint-disable-line global-require
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<NextApp history={history} store={store} />
</Provider>
</AppContainer>,
rootEl
)
})
}
})
.catch(error => {
store.dispatch(ajaxCallError())
console.error('error while initializing Firebase Auth') // eslint-disable-line no-console
console.error(error) // eslint-disable-line no-console
})
|
node_modules/react-bootstrap/es/TabContent.js | chenjic215/search-doctor | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import elementType from 'prop-types-extra/lib/elementType';
import { bsClass as setBsClass, prefix, splitBsPropsAndOmit } from './utils/bootstrapUtils';
var propTypes = {
componentClass: elementType,
/**
* Sets a default animation strategy for all children `<TabPane>`s. Use
* `false` to disable, `true` to enable the default `<Fade>` animation or any
* `<Transition>` component.
*/
animation: PropTypes.oneOfType([PropTypes.bool, elementType]),
/**
* Wait until the first "enter" transition to mount tabs (add them to the DOM)
*/
mountOnEnter: PropTypes.bool,
/**
* Unmount tabs (remove it from the DOM) when they are no longer visible
*/
unmountOnExit: PropTypes.bool
};
var defaultProps = {
componentClass: 'div',
animation: true,
mountOnEnter: false,
unmountOnExit: false
};
var contextTypes = {
$bs_tabContainer: PropTypes.shape({
activeKey: PropTypes.any
})
};
var childContextTypes = {
$bs_tabContent: PropTypes.shape({
bsClass: PropTypes.string,
animation: PropTypes.oneOfType([PropTypes.bool, elementType]),
activeKey: PropTypes.any,
mountOnEnter: PropTypes.bool,
unmountOnExit: PropTypes.bool,
onPaneEnter: PropTypes.func.isRequired,
onPaneExited: PropTypes.func.isRequired,
exiting: PropTypes.bool.isRequired
})
};
var TabContent = function (_React$Component) {
_inherits(TabContent, _React$Component);
function TabContent(props, context) {
_classCallCheck(this, TabContent);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.handlePaneEnter = _this.handlePaneEnter.bind(_this);
_this.handlePaneExited = _this.handlePaneExited.bind(_this);
// Active entries in state will be `null` unless `animation` is set. Need
// to track active child in case keys swap and the active child changes
// but the active key does not.
_this.state = {
activeKey: null,
activeChild: null
};
return _this;
}
TabContent.prototype.getChildContext = function getChildContext() {
var _props = this.props,
bsClass = _props.bsClass,
animation = _props.animation,
mountOnEnter = _props.mountOnEnter,
unmountOnExit = _props.unmountOnExit;
var stateActiveKey = this.state.activeKey;
var containerActiveKey = this.getContainerActiveKey();
var activeKey = stateActiveKey != null ? stateActiveKey : containerActiveKey;
var exiting = stateActiveKey != null && stateActiveKey !== containerActiveKey;
return {
$bs_tabContent: {
bsClass: bsClass,
animation: animation,
activeKey: activeKey,
mountOnEnter: mountOnEnter,
unmountOnExit: unmountOnExit,
onPaneEnter: this.handlePaneEnter,
onPaneExited: this.handlePaneExited,
exiting: exiting
}
};
};
TabContent.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!nextProps.animation && this.state.activeChild) {
this.setState({ activeKey: null, activeChild: null });
}
};
TabContent.prototype.componentWillUnmount = function componentWillUnmount() {
this.isUnmounted = true;
};
TabContent.prototype.handlePaneEnter = function handlePaneEnter(child, childKey) {
if (!this.props.animation) {
return false;
}
// It's possible that this child should be transitioning out.
if (childKey !== this.getContainerActiveKey()) {
return false;
}
this.setState({
activeKey: childKey,
activeChild: child
});
return true;
};
TabContent.prototype.handlePaneExited = function handlePaneExited(child) {
// This might happen as everything is unmounting.
if (this.isUnmounted) {
return;
}
this.setState(function (_ref) {
var activeChild = _ref.activeChild;
if (activeChild !== child) {
return null;
}
return {
activeKey: null,
activeChild: null
};
});
};
TabContent.prototype.getContainerActiveKey = function getContainerActiveKey() {
var tabContainer = this.context.$bs_tabContainer;
return tabContainer && tabContainer.activeKey;
};
TabContent.prototype.render = function render() {
var _props2 = this.props,
Component = _props2.componentClass,
className = _props2.className,
props = _objectWithoutProperties(_props2, ['componentClass', 'className']);
var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['animation', 'mountOnEnter', 'unmountOnExit']),
bsProps = _splitBsPropsAndOmit[0],
elementProps = _splitBsPropsAndOmit[1];
return React.createElement(Component, _extends({}, elementProps, {
className: classNames(className, prefix(bsProps, 'content'))
}));
};
return TabContent;
}(React.Component);
TabContent.propTypes = propTypes;
TabContent.defaultProps = defaultProps;
TabContent.contextTypes = contextTypes;
TabContent.childContextTypes = childContextTypes;
export default setBsClass('tab', TabContent); |
src/svg-icons/device/signal-cellular-no-sim.js | lawrence-yu/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceSignalCellularNoSim = (props) => (
<SvgIcon {...props}>
<path d="M18.99 5c0-1.1-.89-2-1.99-2h-7L7.66 5.34 19 16.68 18.99 5zM3.65 3.88L2.38 5.15 5 7.77V19c0 1.1.9 2 2 2h10.01c.35 0 .67-.1.96-.26l1.88 1.88 1.27-1.27L3.65 3.88z"/>
</SvgIcon>
);
DeviceSignalCellularNoSim = pure(DeviceSignalCellularNoSim);
DeviceSignalCellularNoSim.displayName = 'DeviceSignalCellularNoSim';
DeviceSignalCellularNoSim.muiName = 'SvgIcon';
export default DeviceSignalCellularNoSim;
|
app/javascript/mastodon/features/hashtag_timeline/index.js | im-in-space/mastodon | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import StatusListContainer from '../ui/containers/status_list_container';
import Column from '../../components/column';
import ColumnHeader from '../../components/column_header';
import ColumnSettingsContainer from './containers/column_settings_container';
import { expandHashtagTimeline, clearTimeline } from '../../actions/timelines';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import { FormattedMessage } from 'react-intl';
import { connectHashtagStream } from '../../actions/streaming';
import { isEqual } from 'lodash';
const mapStateToProps = (state, props) => ({
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}${props.params.local ? ':local' : ''}`, 'unread']) > 0,
});
export default @connect(mapStateToProps)
class HashtagTimeline extends React.PureComponent {
disconnects = [];
static propTypes = {
params: PropTypes.object.isRequired,
columnId: PropTypes.string,
dispatch: PropTypes.func.isRequired,
hasUnread: PropTypes.bool,
multiColumn: PropTypes.bool,
};
handlePin = () => {
const { columnId, dispatch } = this.props;
if (columnId) {
dispatch(removeColumn(columnId));
} else {
dispatch(addColumn('HASHTAG', { id: this.props.params.id }));
}
}
title = () => {
let title = [this.props.params.id];
if (this.additionalFor('any')) {
title.push(' ', <FormattedMessage key='any' id='hashtag.column_header.tag_mode.any' values={{ additional: this.additionalFor('any') }} defaultMessage='or {additional}' />);
}
if (this.additionalFor('all')) {
title.push(' ', <FormattedMessage key='all' id='hashtag.column_header.tag_mode.all' values={{ additional: this.additionalFor('all') }} defaultMessage='and {additional}' />);
}
if (this.additionalFor('none')) {
title.push(' ', <FormattedMessage key='none' id='hashtag.column_header.tag_mode.none' values={{ additional: this.additionalFor('none') }} defaultMessage='without {additional}' />);
}
return title;
}
additionalFor = (mode) => {
const { tags } = this.props.params;
if (tags && (tags[mode] || []).length > 0) {
return tags[mode].map(tag => tag.value).join('/');
} else {
return '';
}
}
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
handleHeaderClick = () => {
this.column.scrollTop();
}
_subscribe (dispatch, id, tags = {}, local) {
let any = (tags.any || []).map(tag => tag.value);
let all = (tags.all || []).map(tag => tag.value);
let none = (tags.none || []).map(tag => tag.value);
[id, ...any].map(tag => {
this.disconnects.push(dispatch(connectHashtagStream(id, tag, local, status => {
let tags = status.tags.map(tag => tag.name);
return all.filter(tag => tags.includes(tag)).length === all.length &&
none.filter(tag => tags.includes(tag)).length === 0;
})));
});
}
_unsubscribe () {
this.disconnects.map(disconnect => disconnect());
this.disconnects = [];
}
componentDidMount () {
const { dispatch } = this.props;
const { id, tags, local } = this.props.params;
this._subscribe(dispatch, id, tags, local);
dispatch(expandHashtagTimeline(id, { tags, local }));
}
componentWillReceiveProps (nextProps) {
const { dispatch, params } = this.props;
const { id, tags, local } = nextProps.params;
if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) {
this._unsubscribe();
this._subscribe(dispatch, id, tags, local);
dispatch(clearTimeline(`hashtag:${id}${local ? ':local' : ''}`));
dispatch(expandHashtagTimeline(id, { tags, local }));
}
}
componentWillUnmount () {
this._unsubscribe();
}
setRef = c => {
this.column = c;
}
handleLoadMore = maxId => {
const { id, tags, local } = this.props.params;
this.props.dispatch(expandHashtagTimeline(id, { maxId, tags, local }));
}
render () {
const { hasUnread, columnId, multiColumn } = this.props;
const { id, local } = this.props.params;
const pinned = !!columnId;
return (
<Column bindToDocument={!multiColumn} ref={this.setRef} label={`#${id}`}>
<ColumnHeader
icon='hashtag'
active={hasUnread}
title={this.title()}
onPin={this.handlePin}
onMove={this.handleMove}
onClick={this.handleHeaderClick}
pinned={pinned}
multiColumn={multiColumn}
showBackButton
>
{columnId && <ColumnSettingsContainer columnId={columnId} />}
</ColumnHeader>
<StatusListContainer
trackScroll={!pinned}
scrollKey={`hashtag_timeline-${columnId}`}
timelineId={`hashtag:${id}${local ? ':local' : ''}`}
onLoadMore={this.handleLoadMore}
emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />}
bindToDocument={!multiColumn}
/>
</Column>
);
}
}
|
frontend/src/Components/Table/VirtualTableSelectAllHeaderCell.js | geogolem/Radarr | import PropTypes from 'prop-types';
import React from 'react';
import CheckInput from 'Components/Form/CheckInput';
import VirtualTableHeaderCell from './VirtualTableHeaderCell';
import styles from './VirtualTableSelectAllHeaderCell.css';
function getValue(allSelected, allUnselected) {
if (allSelected) {
return true;
} else if (allUnselected) {
return false;
}
return null;
}
function VirtualTableSelectAllHeaderCell(props) {
const {
allSelected,
allUnselected,
onSelectAllChange
} = props;
const value = getValue(allSelected, allUnselected);
return (
<VirtualTableHeaderCell
className={styles.selectAllHeaderCell}
name="selectAll"
>
<CheckInput
className={styles.input}
name="selectAll"
value={value}
onChange={onSelectAllChange}
/>
</VirtualTableHeaderCell>
);
}
VirtualTableSelectAllHeaderCell.propTypes = {
allSelected: PropTypes.bool.isRequired,
allUnselected: PropTypes.bool.isRequired,
onSelectAllChange: PropTypes.func.isRequired
};
export default VirtualTableSelectAllHeaderCell;
|
src/components/tap/TapLineItem.js | Sawtaytoes/Ghadyani-Framework-Webpack-React-Redux | import PropTypes from 'prop-types'
import React from 'react'
import { connect } from 'react-redux'
import {
tapMessageType,
tapColor,
} from 'reducers/tap/helpers'
const headerStyles = {
margin: '10px 10px 6px',
fontSize: '1em',
}
const Header = ({ text }) => (
<div style={headerStyles}>
{text}
</div>
)
Header.propTypes = {
text: PropTypes.string.isRequired,
}
const testRunStyles = {
container: {
display: 'flex',
margin: '3px 0',
padding: '10px',
},
testNumber: {
paddingRight: '2ex',
},
text: {
flex: '1 1 auto',
},
}
const tapMessageStyles = {
[tapMessageType.pass]: {
...testRunStyles.container,
color: 'greenyellow',
backgroundColor: tapColor.pass,
},
[tapMessageType.fail]: {
...testRunStyles.container,
color: 'white',
backgroundColor: tapColor.fail,
},
}
const TestRun = ({ testNumber, text, type }) => (
<p style={tapMessageStyles[type]}>
<b style={testRunStyles.testNumber}>
{testNumber}
</b>
<span style={testRunStyles.text}>
{text}
</span>
</p>
)
TestRun.propTypes = {
testNumber: PropTypes.number.isRequired,
text: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
}
export const TapLineItem = ({
testNumber,
text,
type,
}) => (
type === tapMessageType.header
? <Header text={text} />
: (
<TestRun
testNumber={testNumber}
text={text}
type={type}
/>
)
)
TapLineItem.propTypes = {
testNumber: PropTypes.number,
text: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
};
const mapStateToProps = (_, initialProps) => (
({ tap: { messages } }) => ({
...messages[initialProps.id]
})
)
export default connect(mapStateToProps)(TapLineItem)
|
src/components/theme-giraffe/petition-message.js | MoveOnOrg/mop-frontend | import React from 'react'
import PropTypes from 'prop-types'
import { Message } from 'GiraffeUI/message'
import PetitionFlagForm from '../../containers/petition-flag-form'
const hasTag = (tag, petition) =>
Boolean(petition.tags && petition.tags.filter(t => t.name === tag).length)
export const PetitionMessage = ({ petition: p, isFwd }) => (
<div className='col-12'>
<div className='row'>
{hasTag('possibly_out_of_date', p) && (
<Message color='orange'>
This petition has not been edited in a while. As a new legislative
session has begun, it’s possible some of the targets of this petition
are out of date.
</Message>
)}
{p.status !== 'Verified' &&
p.status !== 'Bad' && <PetitionFlagForm petition={p} />}
{p.status === 'Bad' && (
<Message color='red'>
MoveOn volunteers reviewed this petition and determined that it either
may not reflect MoveOn members' progressive values, or that MoveOn
members may disagree about whether to support this petition. MoveOn
will not promote the petition beyond hosting it on our site.{' '}
<a
href='https://act.moveon.org/cms/thanks/thanks-your-input'
target='_blank'
rel='noopener noreferrer'
>
Click here if you think MoveOn should support this petition.
</a>
</Message>
)}
{hasTag('outcome:victory', p) && (
<Message color='azure'>
Victory! The creator of this petition declared the campaign a
success. You can still sign the petition to show support.
</Message>
)}
{isFwd && (
<Message color='gray'>
We've forwarded you to this trending petition. To return to your
previous action, use your browser's back button.
</Message>
)}
</div>
</div>
)
PetitionMessage.propTypes = {
petition: PropTypes.object,
isFwd: PropTypes.bool
}
export default PetitionMessage
|
src/Accordion/index.js | daviferreira/react-sanfona | 'use strict';
import cx from 'classnames';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
arrayify,
getChildrenActiveItems,
getActiveItems,
isSame
} from './utils';
export default class Accordion extends Component {
constructor(props) {
super(props);
this.state = {
activeItems: getActiveItems(props.children, props.allowMultiple)
};
}
// eslint-disable-next-line
UNSAFE_componentWillReceiveProps({ children, allowMultiple }) {
if (
!isSame(
getChildrenActiveItems(this.props.children),
getChildrenActiveItems(children)
)
) {
this.setState({
activeItems: getActiveItems(children, allowMultiple)
});
}
}
handleChange(index) {
const {
allowMultiple,
children,
onChange,
openNextAccordionItem
} = this.props;
// clone active items state array
let activeItems = this.state.activeItems.slice(0);
const position = activeItems.indexOf(index);
if (position !== -1) {
activeItems.splice(position, 1);
if (openNextAccordionItem && index !== children.length - 1) {
activeItems.push(index + 1);
}
} else if (allowMultiple) {
activeItems.push(index);
} else {
activeItems = [index];
}
const newState = {
activeItems
};
this.setState(newState, () => {
if (onChange) {
onChange(newState);
}
});
}
renderItems() {
const { children, duration, easing, isHovered } = this.props;
if (!children) {
return null;
}
const { activeItems } = this.state;
return arrayify(children).reduce((acc, item, index) => {
if (item) {
const {
props: { disabled, duration: itemDuration, easing: itemEasing }
} = item;
const isExpanded = !disabled && activeItems.indexOf(index) !== -1;
const handleChange = this.handleChange.bind(this, index);
const element = React.cloneElement(item, {
duration: itemDuration || duration,
easing: itemEasing || easing,
expanded: isExpanded,
key: index,
index,
onClick: handleChange,
onMouseOver: isHovered && !disabled ? handleChange : null,
ref: `item-${index}`
});
acc.push(element);
}
return acc;
}, []);
}
render() {
const { className, style, rootTag: Root } = this.props;
return (
<Root className={cx('react-sanfona', className)} style={style}>
{this.renderItems()}
</Root>
);
}
}
Accordion.defaultProps = {
activeItems: [0],
allowMultiple: false,
duration: 300,
easing: 'ease',
rootTag: 'div'
};
Accordion.propTypes = {
allowMultiple: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]),
className: PropTypes.string,
duration: PropTypes.number,
easing: PropTypes.string,
onChange: PropTypes.func,
isHovered: PropTypes.bool,
openNextAccordionItem: PropTypes.bool,
style: PropTypes.object,
rootTag: PropTypes.string
};
|
node_modules/react-bootstrap/es/NavbarHeader.js | joekay/awebb | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { prefix } from './utils/bootstrapUtils';
var contextTypes = {
$bs_navbar: PropTypes.shape({
bsClass: PropTypes.string
})
};
var NavbarHeader = function (_React$Component) {
_inherits(NavbarHeader, _React$Component);
function NavbarHeader() {
_classCallCheck(this, NavbarHeader);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
NavbarHeader.prototype.render = function render() {
var _props = this.props,
className = _props.className,
props = _objectWithoutProperties(_props, ['className']);
var navbarProps = this.context.$bs_navbar || { bsClass: 'navbar' };
var bsClassName = prefix(navbarProps, 'header');
return React.createElement('div', _extends({}, props, { className: classNames(className, bsClassName) }));
};
return NavbarHeader;
}(React.Component);
NavbarHeader.contextTypes = contextTypes;
export default NavbarHeader; |
packages/now-cli/test/dev/fixtures/23-docusaurus/src/pages/index.js | zeit/now-cli | import React from 'react';
import classnames from 'classnames';
import Layout from '@theme/Layout';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import styles from './styles.module.css';
const features = [
{
title: <>Easy to Use</>,
imageUrl: 'img/undraw_docusaurus_mountain.svg',
description: (
<>
Docusaurus was designed from the ground up to be easily installed and
used to get your website up and running quickly.
</>
),
},
{
title: <>Focus on What Matters</>,
imageUrl: 'img/undraw_docusaurus_tree.svg',
description: (
<>
Docusaurus lets you focus on your docs, and we'll do the chores. Go
ahead and move your docs into the <code>docs</code> directory.
</>
),
},
{
title: <>Powered by React</>,
imageUrl: 'img/undraw_docusaurus_react.svg',
description: (
<>
Extend or customize your website layout by reusing React. Docusaurus can
be extended while reusing the same header and footer.
</>
),
},
];
function Feature({ imageUrl, title, description }) {
const imgUrl = useBaseUrl(imageUrl);
return (
<div className={classnames('col col--4', styles.feature)}>
{imgUrl && (
<div className="text--center">
<img className={styles.featureImage} src={imgUrl} alt={title} />
</div>
)}
<h3>{title}</h3>
<p>{description}</p>
</div>
);
}
function Home() {
const context = useDocusaurusContext();
const { siteConfig = {} } = context;
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />"
>
<header className={classnames('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className={classnames(
'button button--outline button--secondary button--lg',
styles.getStarted
)}
to={useBaseUrl('docs/doc1')}
>
Get Started
</Link>
</div>
</div>
</header>
<main>
{features && features.length && (
<section className={styles.features}>
<div className="container">
<div className="row">
{features.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
)}
</main>
</Layout>
);
}
export default Home;
|
src.test/utils-is-xxx.js | epsitec-sa/electrum | /* global describe it */
import {expect} from 'mai-chai';
import React from 'react';
import {isComponent} from '../src/utils/is-component.js';
import {isStatelessFunctionComponent} from '../src/utils/is-stateless-function-component.js';
/******************************************************************************/
describe ('Electrum utils/is...', () => {
describe ('isComponent()', () => {
const Foo = class extends React.Component {
render () {
return <div>Foo</div>;
}
};
Foo.displayName = 'Foo';
const StatelessFoo = props => <div>{props.text}</div>;
it ('identifies full component', () => {
expect (isComponent (Foo)).to.be.true ();
expect (isStatelessFunctionComponent (Foo)).to.be.false ();
});
it ('identifies stateless function component to not be a full component', () => {
expect (isComponent (StatelessFoo)).to.be.false ();
expect (isStatelessFunctionComponent (StatelessFoo)).to.be.true ();
});
});
});
/******************************************************************************/
|
examples/todo/js/components/TodoList.js | SBUtltmedia/relay | /**
* 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.
*/
import MarkAllTodosMutation from '../mutations/MarkAllTodosMutation';
import Todo from './Todo';
import React from 'react';
import Relay from 'react-relay';
class TodoList extends React.Component {
_handleMarkAllChange = (e) => {
var complete = e.target.checked;
Relay.Store.commitUpdate(
new MarkAllTodosMutation({
complete,
todos: this.props.viewer.todos,
viewer: this.props.viewer,
})
);
}
renderTodos() {
return this.props.viewer.todos.edges.map(edge =>
<Todo
key={edge.node.id}
todo={edge.node}
viewer={this.props.viewer}
/>
);
}
render() {
var numTodos = this.props.viewer.totalCount;
var numCompletedTodos = this.props.viewer.completedCount;
return (
<section className="main">
<input
checked={numTodos === numCompletedTodos}
className="toggle-all"
onChange={this._handleMarkAllChange}
type="checkbox"
/>
<label htmlFor="toggle-all">
Mark all as complete
</label>
<ul className="todo-list">
{this.renderTodos()}
</ul>
</section>
);
}
}
export default Relay.createContainer(TodoList, {
initialVariables: {
status: null,
},
prepareVariables({status}) {
var nextStatus;
if (status === 'active' || status === 'completed') {
nextStatus = status;
} else {
// This matches the Backbone example, which displays all todos on an
// invalid route.
nextStatus = 'any';
}
return {
status: nextStatus,
limit: Number.MAX_SAFE_INTEGER || 9007199254740991,
};
},
fragments: {
viewer: () => Relay.QL`
fragment on User {
completedCount,
todos(status: $status, first: $limit) {
edges {
node {
id,
${Todo.getFragment('todo')},
},
},
${MarkAllTodosMutation.getFragment('todos')},
},
totalCount,
${MarkAllTodosMutation.getFragment('viewer')},
${Todo.getFragment('viewer')},
}
`,
},
});
|
examples/pagination/src/index.js | tannerlinsley/react-table | import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
ReactDOM.render(<App />, document.getElementById('root'))
|
tests/site3/code2/components/component1.js | dominikwilkowski/cuttlebelle | import PropTypes from 'prop-types';
import React from 'react';
/**
* The Component1 component for the header
*/
const Component1 = ({
_ID,
_pages,
_storeSet,
_store,
_body
}) => {
_storeSet({ title: _pages[ _ID ].title }); // getting the title from the store (to test the store)
return (
<header>
<h1>{ _store()['title'] }</h1>
<div>{ _body }</div>
</header>
);
}
Component1.propTypes = {
/**
* _body: (text)(4)
*/
_body: PropTypes.node.isRequired,
};
Component1.defaultProps = {};
export default Component1;
|
public/app/components/base/confirm-dialog.js | vincent-tr/mylife-wine | import React from 'react';
import PropTypes from 'prop-types';
import * as mui from 'material-ui';
import { confirmable, createConfirmation } from 'react-confirm';
import Theme from './theme';
const ConfirmDialog = ({ show, proceed, /*dismiss,*/ cancel, /*confirmation,*/ options }) => (
<Theme>
<mui.Dialog
title={options.title}
actions={<div>
<mui.FlatButton
label="Oui"
onTouchTap={() => proceed()} />
<mui.FlatButton
label="Non"
onTouchTap={() => cancel()} />
</div>}
modal={true}
open={show}
autoScrollBodyContent={true}>
<mui.List>
{options.lines.map(it => (<mui.ListItem key={it} primaryText={it} />))}
</mui.List>
</mui.Dialog>
</Theme>
);
ConfirmDialog.propTypes = {
show: PropTypes.bool, // from confirmable. indicates if the dialog is shown or not.
proceed: PropTypes.func, // from confirmable. call to close the dialog with promise resolved.
cancel: PropTypes.func, // from confirmable. call to close the dialog with promise rejected.
dismiss: PropTypes.func, // from confirmable. call to only close the dialog.
confirmation: PropTypes.string, // arguments of your confirm function
options: PropTypes.object // arguments of your confirm function
};
const confirm = createConfirmation(confirmable(ConfirmDialog));
export default (options) => {
options.title = options.title || 'Confirmation';
options.lines = options.lines || ['Confirmer ?'];
confirm({ options }).then(
() => (options.proceed && options.proceed()),
() => (options.cancel && options.cancel()));
};
|
src/svg-icons/image/movie-creation.js | rscnt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageMovieCreation = (props) => (
<SvgIcon {...props}>
<path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/>
</SvgIcon>
);
ImageMovieCreation = pure(ImageMovieCreation);
ImageMovieCreation.displayName = 'ImageMovieCreation';
export default ImageMovieCreation;
|
src/svg-icons/av/replay-10.js | tan-jerene/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvReplay10 = (props) => (
<SvgIcon {...props}>
<path d="M12 5V1L7 6l5 5V7c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6H4c0 4.4 3.6 8 8 8s8-3.6 8-8-3.6-8-8-8zm-1.1 11H10v-3.3L9 13v-.7l1.8-.6h.1V16zm4.3-1.8c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1c.2.1.3.2.5.3s.2.3.3.6.1.5.1.8v.7zm-.9-.8v-.5s-.1-.2-.1-.3-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5z"/>
</SvgIcon>
);
AvReplay10 = pure(AvReplay10);
AvReplay10.displayName = 'AvReplay10';
AvReplay10.muiName = 'SvgIcon';
export default AvReplay10;
|
src/compos/Chat.js | Blacktoviche/RNChat | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Container, Content, Header, Icon, Input, List, Item, Left, Body, Right, ListItem, Thumbnail, Text } from 'native-base';
import { updateChatList, searchTextChanged } from '../core/actions';
import * as backend from '../backend/Mediator';
class Chat extends Component {
static navigationOptions = {
title: 'Chat',
};
componentWillMount() {
this.props.updateChatList();
}
onSearchChat(searchText) {
this.props.searchTextChanged(searchText, this.props.chatList);
}
onOpenConversation(chat) {
//console.log('data: ' + this.props.loggedinUser, chat.uidFrom, chat.uidTo);
let user = null;
if (this.props.loggedinUser.uid == chat.uidFrom) {
user = backend.getContact(chat.uidTo);
} else {
user = backend.getContact(chat.uidFrom);
}
this.props.navigate('Conversation', { receiver: user });
}
render() {
return (
<Container>
<Header searchBar rounded>
<Item>
<Icon name="search" />
<Input placeholder="Search" value={this.props.searchText}
onChangeText={this.onSearchChat.bind(this)} />
<Icon active name="people" />
</Item>
</Header>
<Content>
<List dataArray={this.props.filteredChatList} renderRow={(chat) =>
<ListItem avatar button onPress={() => this.onOpenConversation(chat)}>
<Left>
<Thumbnail source={require('../imgz/noimg.png')} />
</Left>
<Body>
<Text>{chat.title}</Text>
<Text note>{chat.lastMsgText}</Text>
</Body>
<Right>
<Text note>{new Date(chat.lastMsgDate).toDateString()}</Text>
</Right>
</ListItem>
} />
</Content>
</Container>
);
}
}
const mapStateToProps = ({ chatReducer }) => {
const { searchText, chatList, filteredChatList, loggedinUser } = chatReducer;
return { searchText, chatList, filteredChatList, loggedinUser };
};
export default connect(mapStateToProps, {
updateChatList, searchTextChanged
})(Chat); |
client/Admin/AdminPage.js | AnnotatedJS/meteor-react-start-app |
import React from 'react';
import { PageTitle } from './../_App/PageTitle'
export const AdminPage = () => (
<div className="container">
<PageTitle
pageTitle='Admin Page'
/>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris.</p>
</div>
);
|
node_modules/react-bootstrap/es/CarouselItem.js | firdiansyah/crud-req | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import TransitionEvents from './utils/TransitionEvents';
// TODO: This should use a timeout instead of TransitionEvents, or else just
// not wait until transition end to trigger continuing animations.
var propTypes = {
direction: PropTypes.oneOf(['prev', 'next']),
onAnimateOutEnd: PropTypes.func,
active: PropTypes.bool,
animateIn: PropTypes.bool,
animateOut: PropTypes.bool,
index: PropTypes.number
};
var defaultProps = {
active: false,
animateIn: false,
animateOut: false
};
var CarouselItem = function (_React$Component) {
_inherits(CarouselItem, _React$Component);
function CarouselItem(props, context) {
_classCallCheck(this, CarouselItem);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.handleAnimateOutEnd = _this.handleAnimateOutEnd.bind(_this);
_this.state = {
direction: null
};
_this.isUnmounted = false;
return _this;
}
CarouselItem.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (this.props.active !== nextProps.active) {
this.setState({ direction: null });
}
};
CarouselItem.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
var _this2 = this;
var active = this.props.active;
var prevActive = prevProps.active;
if (!active && prevActive) {
TransitionEvents.addEndEventListener(ReactDOM.findDOMNode(this), this.handleAnimateOutEnd);
}
if (active !== prevActive) {
setTimeout(function () {
return _this2.startAnimation();
}, 20);
}
};
CarouselItem.prototype.componentWillUnmount = function componentWillUnmount() {
this.isUnmounted = true;
};
CarouselItem.prototype.handleAnimateOutEnd = function handleAnimateOutEnd() {
if (this.isUnmounted) {
return;
}
if (this.props.onAnimateOutEnd) {
this.props.onAnimateOutEnd(this.props.index);
}
};
CarouselItem.prototype.startAnimation = function startAnimation() {
if (this.isUnmounted) {
return;
}
this.setState({
direction: this.props.direction === 'prev' ? 'right' : 'left'
});
};
CarouselItem.prototype.render = function render() {
var _props = this.props,
direction = _props.direction,
active = _props.active,
animateIn = _props.animateIn,
animateOut = _props.animateOut,
className = _props.className,
props = _objectWithoutProperties(_props, ['direction', 'active', 'animateIn', 'animateOut', 'className']);
delete props.onAnimateOutEnd;
delete props.index;
var classes = {
item: true,
active: active && !animateIn || animateOut
};
if (direction && active && animateIn) {
classes[direction] = true;
}
if (this.state.direction && (animateIn || animateOut)) {
classes[this.state.direction] = true;
}
return React.createElement('div', _extends({}, props, {
className: classNames(className, classes)
}));
};
return CarouselItem;
}(React.Component);
CarouselItem.propTypes = propTypes;
CarouselItem.defaultProps = defaultProps;
export default CarouselItem; |
src/routes/Itinerary/examples/ItineraryExamples.js | denimar/denibudget | import React from 'react';
import ItineraryPanel from '../components/ItineraryPanel';
import './ItineraryExamples.scss'
class ItineraryExamples extends React.Component {
getItinerary() {
return {
route: '1234',
direction: 'V',
trips: [
{
id: 1,
arrivalTime: '04:50',
departureTime: '05:00',
vehicle: {
prefix: '65489',
companyInitials: 'TRANS'
}
},
{
id: 2,
arrivalTime: '07:00',
departureTime: '07:18',
vehicle: {
prefix: '15987',
companyInitials: 'INSU'
}
},
{
id: 3,
arrivalTime: '09:02',
departureTime: '09:05',
vehicle: {
prefix: '65412',
companyInitials: 'TRANS'
}
},
{
id: 4,
arrivalTime: '10:08',
departureTime: '10:05',
vehicle: {
prefix: '5486',
companyInitials: 'ESTR'
}
},
{
id: 5,
arrivalTime: '10:50',
departureTime: '11:00',
vehicle: {
prefix: '3189',
companyInitials: 'TRANS'
}
},
{
id: 6,
arrivalTime: '12:30',
departureTime: '12:45',
vehicle: {
prefix: '29578',
companyInitials: 'ENFLO'
}
}
]
};
}
render() {
return (
<div className="itinerary-example-container">
<ItineraryPanel itinerary={ this.getItinerary() } />
</div>
);
}
}
export default ItineraryExamples
|
client/page/redirects/row-actions.js | johngodley/redirection | /**
* External dependencies
*/
import React from 'react';
import { connect } from 'react-redux';
import { translate as __ } from 'i18n-calypso';
/**
* Internal dependencies
*/
import { RowActions, RowAction } from 'component/table/row-action';
import { performTableAction } from 'state/redirect/action';
import { has_capability, CAP_REDIRECT_ADD, CAP_REDIRECT_DELETE } from 'lib/capabilities';
function RedirectRowActions( props ) {
const { disabled, rowParams, onDelete, onEnable, onDisable, row } = props;
const { setRowMode, rowMode } = rowParams;
const { id, enabled, regex, action_type, match_type } = row;
const menu = [];
if ( rowMode === 'edit' ) {
return null;
}
if ( enabled && has_capability( CAP_REDIRECT_ADD ) ) {
menu.push( <RowAction key="1" onClick={ () => setRowMode( 'edit' ) }>{ __( 'Edit' ) }</RowAction> );
}
if ( has_capability( CAP_REDIRECT_DELETE ) ) {
menu.push( <RowAction key="2" onClick={ () => onDelete( id ) }>{ __( 'Delete' ) }</RowAction> );
}
if ( has_capability( CAP_REDIRECT_ADD ) ) {
if ( enabled ) {
menu.push( <RowAction key="3" onClick={ () => onDisable( id ) }>{ __( 'Disable' ) }</RowAction> );
} else {
menu.push( <RowAction key="4" onClick={ () => onEnable( id ) }>{ __( 'Enable' ) }</RowAction> );
}
}
if ( enabled && ! regex && action_type === 'url' && ( match_type === 'url' || match_type === 'server' ) ) {
menu.push( <RowAction key="5" onClick={ () => setRowMode( 'check' ) }>{ __( 'Check Redirect' ) }</RowAction> );
}
return <RowActions disabled={ disabled } actions={ menu } />;
}
function mapDispatchToProps( dispatch ) {
return {
onDelete: ( id ) => {
dispatch( performTableAction( 'delete', [ id ] ) );
},
onEnable: ( id ) => {
dispatch( performTableAction( 'enable', [ id ] ) );
},
onDisable: ( id ) => {
dispatch( performTableAction( 'disable', [ id ] ) );
},
};
}
export default connect(
null,
mapDispatchToProps
)( RedirectRowActions );
|
src/svg-icons/communication/call-merge.js | xmityaz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationCallMerge = (props) => (
<SvgIcon {...props}>
<path d="M17 20.41L18.41 19 15 15.59 13.59 17 17 20.41zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5 7.5 8z"/>
</SvgIcon>
);
CommunicationCallMerge = pure(CommunicationCallMerge);
CommunicationCallMerge.displayName = 'CommunicationCallMerge';
CommunicationCallMerge.muiName = 'SvgIcon';
export default CommunicationCallMerge;
|
app/jsx/outcomes/IndividualStudentMastery/OutcomeGroup.js | djbender/canvas-lms | /*
* Copyright (C) 2018 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react'
import PropTypes from 'prop-types'
import ImmutablePropTypes from 'react-immutable-proptypes'
import I18n from 'i18n!IndividualStudentMasteryOutcomeGroup'
import {Flex, View} from '@instructure/ui-layout'
import {ToggleGroup} from '@instructure/ui-toggle-details'
import {List, Pill, Text} from '@instructure/ui-elements'
import natcompare from 'compiled/util/natcompare'
import TruncateWithTooltip from '../../shared/components/TruncateWithTooltip'
import Outcome from './Outcome'
import * as shapes from './shapes'
const outcomeGroupHeader = (outcomeGroup, numMastered, numGroup) => (
<Flex justifyItems="space-between">
<Flex.Item padding="0 x-small 0 0" size="0" grow>
<Text size="large" weight="bold">
<TruncateWithTooltip>{outcomeGroup.title}</TruncateWithTooltip>
</Text>
</Flex.Item>
<Flex.Item>
<Pill text={I18n.t('%{numMastered} of %{numGroup} Mastered', {numMastered, numGroup})} />
</Flex.Item>
</Flex>
)
export default class OutcomeGroup extends React.Component {
static propTypes = {
outcomeGroup: shapes.outcomeGroupShape.isRequired,
outcomes: PropTypes.arrayOf(shapes.outcomeShape).isRequired,
expanded: PropTypes.bool.isRequired,
expandedOutcomes: ImmutablePropTypes.set.isRequired,
onExpansionChange: PropTypes.func.isRequired,
outcomeProficiency: shapes.outcomeProficiencyShape
}
static defaultProps = {
outcomeProficiency: null
}
handleToggle = (_event, expanded) => {
this.props.onExpansionChange('group', this.props.outcomeGroup.id, expanded)
}
render() {
const {
outcomeGroup,
outcomes,
expanded,
expandedOutcomes,
onExpansionChange,
outcomeProficiency
} = this.props
const numMastered = outcomes.filter(o => o.mastered).length
const numGroup = outcomes.length
return (
<View as="div" className="outcomeGroup">
<ToggleGroup
summary={outcomeGroupHeader(outcomeGroup, numMastered, numGroup)}
toggleLabel={I18n.t('Toggle outcomes for %{title}', {title: outcomeGroup.title})}
expanded={expanded}
onToggle={this.handleToggle}
>
<List variant="unstyled" delimiter="solid">
{outcomes.sort(natcompare.byKey('title')).map(outcome => (
<List.Item key={outcome.id} margin="0">
<Outcome
outcome={outcome}
expanded={expandedOutcomes.has(outcome.expansionId)}
onExpansionChange={onExpansionChange}
outcomeProficiency={outcomeProficiency}
/>
</List.Item>
))}
</List>
</ToggleGroup>
</View>
)
}
}
|
site/renderPath.js | Reggino/react-dnd | import React from 'react';
import IndexPage from './IndexPage';
export default function renderPath(path, props, onRender) {
onRender(
IndexPage.renderToString(props)
);
}
|
src/components/Common/Tabs.js | MattMcFarland/tw-client | import React from 'react';
class Tabs extends React.Component {
render () {
const {activeTab, onFilter} = this.props;
return (
<div className="tabs">
<ul className="tab-list">
<li>
<button className={activeTab === "latest" ? 'active' : ''} data-filter="latest" onClick={onFilter}>Latest</button>
</li>
<li>
<button className={activeTab === "wanted" ? 'active' : ''} data-filter="wanted" onClick={onFilter}>Most Wanted</button>
</li>
<li>
<button className={activeTab === "best" ? 'active' : ''} data-filter="best" onClick={onFilter}>Best Tutorials</button>
</li>
</ul>
</div>
);
}
}
export default Tabs;
|
src/svg-icons/social/sentiment-very-satisfied.js | owencm/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialSentimentVerySatisfied = (props) => (
<SvgIcon {...props}>
<path d="M11.99 2C6.47 2 2 6.47 2 12s4.47 10 9.99 10S22 17.53 22 12 17.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 8zm1-10.06L14.06 11l1.06-1.06L16.18 11l1.06-1.06-2.12-2.12zm-4.12 0L9.94 11 11 9.94 8.88 7.82 6.76 9.94 7.82 11zM12 17.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/>
</SvgIcon>
);
SocialSentimentVerySatisfied = pure(SocialSentimentVerySatisfied);
SocialSentimentVerySatisfied.displayName = 'SocialSentimentVerySatisfied';
SocialSentimentVerySatisfied.muiName = 'SvgIcon';
export default SocialSentimentVerySatisfied;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.