path
stringlengths 5
195
| repo_name
stringlengths 5
79
| content
stringlengths 25
1.01M
|
---|---|---|
src/components/Reset/Reset.js | Zoomdata/nhtsa-dashboard | import React, { Component } from 'react';
import Circle from '../Circle/Circle';
import Label from '../Label/Label';
export default class Reset extends Component {
render() {
return (
<button className="reset">
<Circle />
<Label />
</button>
);
}
}
|
src/common/Socket/Schedule.js | Syncano/syncano-dashboard | import React from 'react';
import { colors as Colors } from 'material-ui/styles/';
import SocketWrapper from './SocketWrapper';
export default React.createClass({
displayName: 'ScheduleSocket',
getDefaultProps() {
return {
tooltip: 'Create a Schedule Socket'
};
},
getStyles() {
return {
iconStyle: {
color: Colors.lime400
}
};
},
render() {
const styles = this.getStyles();
const {
style,
iconStyle,
...other
} = this.props;
return (
<SocketWrapper
{...other}
iconClassName="synicon-socket-schedule"
style={style}
iconStyle={{ ...styles.iconStyle, ...iconStyle }}
/>
);
}
});
|
src/App.js | wescleymatos/iRango | import React, { Component } from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import Home from './components/Home';
import Restaurantes from './components/Restaurantes';
import Sobre from './components/Sobre';
import Login from './components/Login';
import NovoRestaurante from './components/NovoRestaurante';
import CriarUsuario from './components/CriarUsuario';
class App extends Component {
render() {
return (
<Router>
<div>
<Route exact path="/" component={ Home } />
<Route exact path="/restaurantes" component={ Restaurantes } />
<Route exact path="/sobre" component={ Sobre } />
<Route exact path="/login" component={ Login } />
<Route exact path="/add-restaurante" component={ NovoRestaurante } />
<Route exact path="/add-usuario" component={ CriarUsuario } />
</div>
</Router>
);
}
}
export default App;
|
client/src/app/components/forms/inputs/MaskedInput.js | zraees/sms-project | import React from 'react'
import 'script-loader!jquery.maskedinput/src/jquery.maskedinput.js'
export default class MaskedInput extends React.Component {
componentDidMount() {
var options = {};
if (this.props.maskPlaceholder) options.placeholder = this.props.maskPlaceholder;
$(this.refs.input).mask(this.props.mask, options);
}
render() {
const {maskPlaceholder, mask, ...props} = {...this.props}
return (
<input ref="input" {...props}/>
)
}
} |
actor-apps/app-web/src/app/components/common/MentionDropdown.react.js | WangCrystal/actor-platform | import React from 'react';
import classnames from 'classnames';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
import { KeyCodes } from 'constants/ActorAppConstants';
import AvatarItem from 'components/common/AvatarItem.react';
const {addons: { PureRenderMixin }} = addons;
const DROPDOWN_ITEM_HEIGHT = 38; // is this right?
let scrollIndex = 0;
@ReactMixin.decorate(PureRenderMixin)
class MentionDropdown extends React.Component {
static propTypes = {
mentions: React.PropTypes.array,
className: React.PropTypes.string,
onSelect: React.PropTypes.func.isRequired,
onClose: React.PropTypes.func
};
constructor(props) {
super(props);
const { mentions } = props;
this.state = {
isShown: mentions && mentions.length > 0,
selectedIndex: 0
};
}
componentWillUnmount() {
this.cleanListeners();
}
componentWillUpdate(nextProps, nextState) {
if (nextState.isShown && !this.state.isShown) {
this.setListeners();
} else if (!nextState.isShown && this.state.isShown) {
this.cleanListeners();
}
}
componentWillReceiveProps(props) {
const { mentions } = props;
this.setState({
isShown: mentions && mentions.length > 0,
selectedIndex: 0
});
}
setListeners() {
document.addEventListener('keydown', this.onKeyDown, false);
document.addEventListener('click', this.closeMentions, false);
}
cleanListeners() {
//console.info('cleanListeners');
document.removeEventListener('keydown', this.onKeyDown, false);
document.removeEventListener('click', this.closeMentions, false);
}
closeMentions = () => {
this.setState({isShown: false});
};
onSelect = (value) => {
const { onSelect } = this.props;
onSelect(value);
};
handleScroll = (top) => {
const menuListNode = React.findDOMNode(this.refs.mentionList);
menuListNode.scrollTop = top;
};
onKeyDown = (event) => {
const { mentions, onClose } = this.props;
const { selectedIndex } = this.state;
const visibleItems = 6;
let index = selectedIndex;
if (index !== null) {
switch (event.keyCode) {
case KeyCodes.ENTER:
event.stopPropagation();
event.preventDefault();
this.onSelect(mentions[selectedIndex]);
break;
case KeyCodes.ARROW_UP:
event.stopPropagation();
event.preventDefault();
if (index > 0) {
index -= 1;
} else if (index === 0) {
index = mentions.length - 1;
}
if (scrollIndex > index) {
scrollIndex = index;
} else if (index === mentions.length - 1) {
scrollIndex = mentions.length - visibleItems;
}
this.handleScroll(scrollIndex * DROPDOWN_ITEM_HEIGHT);
this.setState({selectedIndex: index});
break;
case KeyCodes.ARROW_DOWN:
case KeyCodes.TAB:
event.stopPropagation();
event.preventDefault();
if (index < mentions.length - 1) {
index += 1;
} else if (index === mentions.length - 1) {
index = 0;
}
if (index + 1 > scrollIndex + visibleItems) {
scrollIndex = index + 1 - visibleItems;
} else if (index === 0) {
scrollIndex = 0;
}
this.handleScroll(scrollIndex * DROPDOWN_ITEM_HEIGHT);
this.setState({selectedIndex: index});
break;
default:
}
}
if (event.keyCode === KeyCodes.ESC) {
this.closeMentions();
if (onClose) onClose();
}
};
render() {
const { className, mentions } = this.props;
const { isShown, selectedIndex } = this.state;
const mentionClassName = classnames('mention', {
'mention--opened': isShown
}, className);
const mentionsElements = _.map(mentions, (mention, index) => {
const itemClassName = classnames('mention__list__item', {
'mention__list__item--active': selectedIndex === index
});
const title = mention.isNick ?
[
<span className="nickname">{mention.mentionText}</span>,
<span className="name">{mention.secondText}</span>
]
:
<span className="name">{mention.mentionText}</span>;
return (
<li className={itemClassName}
key={index}
onClick={() => this.onSelect(mention)}
onMouseOver={() => this.setState({selectedIndex: index})}>
<AvatarItem image={mention.peer.avatar}
placeholder={mention.peer.placeholder}
size="tiny"
title={mention.peer.title}/>
<div className="title">{title}</div>
</li>
);
});
if (isShown) {
return (
<div className={mentionClassName}>
<div className="mention__wrapper">
<header className="mention__header">
<div className="pull-left"><strong>tab</strong> or <strong>โ</strong><strong>โ</strong> to navigate</div>
<div className="pull-left"><strong>โต</strong> to select</div>
<div className="pull-right"><strong>esc</strong> to close</div>
</header>
<ul className="mention__list" ref="mentionList">
{mentionsElements}
</ul>
</div>
</div>
);
} else {
return null;
}
}
}
export default MentionDropdown;
|
src/pages/system/index.js | pprimm/ds-contest-material | import React from 'react'
import {Divider} from 'material-ui'
import AppWrapper from '../../components/AppWrapper'
import SystemTitleBar from '../../components/SystemTitleBar'
import StatusList from '../../components/StatusList'
import StatusPanel from '../../components/StatusPanel'
import SystemButtonPanel from '../../components/SystemButtonPanel'
export default function SystemPage() {
return (
<AppWrapper>
<SystemTitleBar />
<div>
<StatusPanel />
<SystemButtonPanel />
<Divider />
<StatusList />
</div>
</AppWrapper>
)
} |
docs/app/Examples/collections/Table/States/TableExampleActive.js | clemensw/stardust | import React from 'react'
import { Table } from 'semantic-ui-react'
const TableExampleActive = () => {
return (
<Table celled>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Status</Table.HeaderCell>
<Table.HeaderCell>Notes</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
<Table.Row active>
<Table.Cell>John</Table.Cell>
<Table.Cell>Selected</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell active>Jill</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
)
}
export default TableExampleActive
|
geonode/contrib/monitoring/frontend/src/components/organisms/error-list/index.js | kartoza/geonode | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import HoverPaper from '../../atoms/hover-paper';
import {
Table,
TableBody,
TableHeader,
TableHeaderColumn,
TableRow,
TableRowColumn,
} from 'material-ui/Table';
import styles from './styles';
import actions from './actions';
const mapStateToProps = (state) => ({
errorList: state.errorList.response,
interval: state.interval.interval,
timestamp: state.interval.timestamp,
});
@connect(mapStateToProps, actions)
class ErrorList extends React.Component {
static contextTypes = {
router: PropTypes.object.isRequired,
}
static propTypes = {
errorList: PropTypes.object,
get: PropTypes.func.isRequired,
interval: PropTypes.number,
timestamp: PropTypes.instanceOf(Date),
}
constructor(props) {
super(props);
this.handleClick = (row, column, event) => {
this.context.router.push(`/errors/${event.target.dataset.id}`);
};
}
componentWillMount() {
this.props.get(this.props.interval);
}
componentWillReceiveProps(nextProps) {
if (nextProps && nextProps.interval) {
if (this.props.timestamp !== nextProps.timestamp) {
this.props.get(nextProps.interval);
}
}
}
render() {
const errorList = this.props.errorList;
const errors = this.props.errorList
? errorList.exceptions.map(
error => <TableRow key={error.id}>
<TableRowColumn data-id={error.id}>{error.id}</TableRowColumn>
<TableRowColumn data-id={error.id}>{error.error_type}</TableRowColumn>
<TableRowColumn data-id={error.id}>{error.service.name}</TableRowColumn>
<TableRowColumn data-id={error.id}>{error.created}</TableRowColumn>
</TableRow>
) : '';
return (
<HoverPaper style={styles.content}>
<div style={styles.header}>
<h3 style={styles.title}>Errors</h3>
</div>
<Table onCellClick={this.handleClick}>
<TableHeader displaySelectAll={false}>
<TableRow>
<TableHeaderColumn>ID</TableHeaderColumn>
<TableHeaderColumn>Type</TableHeaderColumn>
<TableHeaderColumn>Service</TableHeaderColumn>
<TableHeaderColumn>Date</TableHeaderColumn>
</TableRow>
</TableHeader>
<TableBody showRowHover stripedRows displayRowCheckbox={false}>
{errors}
</TableBody>
</Table>
</HoverPaper>
);
}
}
export default ErrorList;
|
src/components/card.js | nfcortega89/nikkotoonaughty | import React from 'react';
export default function Card(props) {
return (
<div className="card pic-card">
<div className="image">
<img src={props.image.images.standard_resolution.url} />
</div>
<div className="card-details">
</div>
</div>
)
}
|
src/containers/organizations/components/IntegrationConfigGenerator.js | dataloom/gallery | import React from 'react';
import styled from 'styled-components';
import StyledInput from '../../../components/controls/StyledInput';
import StyledSelect from '../../../components/controls/StyledSelect';
import InfoButton from '../../../components/buttons/InfoButton';
import { DATA_SQL_TYPES, exportTemplate } from '../utils/IntegrationYamlUtils';
type Props = {
orgId :string,
orgName :string,
orgUsername :string,
orgPassword :string
}
const Container = styled.div`
display: flex;
flex-direction: column;
`;
const InputRow = styled.div`
display: flex;
flex-direction: column;
align-items: center;
font-family: 'Open Sans', sans-serif;
margin: 10px 0;
div {
font-size: 16px;
font-weight: 600;
line-height: normal;
margin: 0 20px 0 0;
}
span {
color: #8e929b;
margin: 10px 0;
}
`;
export default class IntegrationConfigGenerator extends React.Component {
constructor(props) {
super(props);
this.state = {
dataSqlType: '',
server: '',
port: '',
dbName: ''
};
}
onSubmit = () => {
const {
dataSqlType,
server,
port,
dbName
} = this.state;
const {
orgId,
orgName,
orgUsername,
orgPassword
} = this.props;
exportTemplate({
dataSqlType,
server,
port,
dbName,
orgId,
orgName,
orgUsername,
orgPassword
});
}
getOnChange = field => ({ target }) => {
this.setState({ [field]: target.value });
}
onSQLTypeChange = ({ target }) => {
const { port } = this.state;
this.setState({
dataSqlType: target.value,
port: target.value ? DATA_SQL_TYPES[target.value].defaultPort : port
});
}
isReadyToSubmit = () => {
const {
dataSqlType,
server,
port,
dbName
} = this.state;
return dataSqlType && server && port && dbName;
}
render() {
const {
dataSqlType,
server,
port,
dbName
} = this.state;
return (
<Container>
<InputRow>
<div>Target Server</div>
<span>ex. PD database hostname</span>
<StyledInput value={server} onChange={this.getOnChange('server')} />
</InputRow>
<InputRow>
<div>Target Database</div>
<span>ex. PD SQL database name</span>
<StyledInput value={dbName} onChange={this.getOnChange('dbName')} />
</InputRow>
<InputRow>
<div>Target Database SQL Type</div>
<StyledSelect value={dataSqlType} onChange={this.onSQLTypeChange}>
<option value="" />
{
Object.keys(DATA_SQL_TYPES).map(name => <option value={name}>{name}</option>)
}
</StyledSelect>
</InputRow>
<InputRow>
<div>Target Port</div>
<span>ex. PD database port</span>
<StyledInput value={port} onChange={this.getOnChange('port')} />
</InputRow>
<InfoButton disabled={!this.isReadyToSubmit()} onClick={this.onSubmit}>Export</InfoButton>
</Container>
);
}
}
|
src/index.js | easyCZ/react-2048 | import React from 'react';
import { render } from 'react-dom';
import { App } from './App';
render(<App />, document.getElementById('root'));
|
packages/icons/src/md/image/CropPortrait.js | suitejs/suitejs | import React from 'react';
import IconBase from '@suitejs/icon-base';
function MdCropPortrait(props) {
return (
<IconBase viewBox="0 0 48 48" {...props}>
<path d="M34 6c2.21 0 4 1.79 4 4v28c0 2.21-1.79 4-4 4H14c-2.21 0-4-1.79-4-4V10c0-2.21 1.79-4 4-4h20zm0 32V10H14v28h20z" />
</IconBase>
);
}
export default MdCropPortrait;
|
src/components/App.js | Tori1810/Task3 | /**
* 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 PropTypes from 'prop-types';
import { IntlProvider } from 'react-intl';
import { Provider as ReduxProvider } from 'react-redux';
const ContextType = {
// Enables critical path CSS rendering
// https://github.com/kriasoft/isomorphic-style-loader
insertCss: PropTypes.func.isRequired,
// Universal HTTP client
fetch: PropTypes.func.isRequired,
// Integrate Redux
// http://redux.js.org/docs/basics/UsageWithReact.html
...ReduxProvider.childContextTypes,
// Apollo Client
client: PropTypes.object.isRequired,
};
/**
* The top-level React component setting context (global) variables
* that can be accessed from all the child components.
*
* https://facebook.github.io/react/docs/context.html
*
* Usage example:
*
* const context = {
* history: createBrowserHistory(),
* store: createStore(),
* };
*
* ReactDOM.render(
* <App context={context}>
* <Layout>
* <LandingPage />
* </Layout>
* </App>,
* container,
* );
*/
class App extends React.PureComponent {
static propTypes = {
context: PropTypes.shape(ContextType).isRequired,
children: PropTypes.element.isRequired,
};
static childContextTypes = ContextType;
getChildContext() {
return this.props.context;
}
componentDidMount() {
const store = this.props.context && this.props.context.store;
if (store) {
this.lastLocale = store.getState().intl.locale;
this.unsubscribe = store.subscribe(() => {
const state = store.getState();
const { newLocale, locale } = state.intl;
if (!newLocale && this.lastLocale !== locale) {
this.lastLocale = locale;
this.forceUpdate();
}
});
}
}
componentWillUnmount() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
}
render() {
// NOTE: If you need to add or modify header, footer etc. of the app,
// please do that inside the Layout component.
const store = this.props.context && this.props.context.store;
const state = store && store.getState();
this.intl = (state && state.intl) || {};
const { initialNow, locale, messages } = this.intl;
const localeMessages = (messages && messages[locale]) || {};
return (
<IntlProvider
initialNow={initialNow}
locale={locale}
messages={localeMessages}
defaultLocale="en-US"
>
{React.Children.only(this.props.children)}
</IntlProvider>
);
}
}
export default App;
|
src/js/components/EndButton.js | BavoG/onesupportdocu | import React from 'react';
import Up from 'grommet/components/icons/base/Up';
import Button from 'grommet/components/Button';
import Box from 'grommet/components/Box';
const CLASS_ROOT = 'infographic__button';
export default function EndButton (props) {
return (
<Button plain={true} className={`${CLASS_ROOT} ${CLASS_ROOT}--end`} onClick={props.onClick}>
<Box direction="column" align="center" justify="center">
<span className={`${CLASS_ROOT}-icon`}>
<Up a11yTitle={'Scroll to top'} onClick={props.onClick} />
</span>
</Box>
</Button>
);
}
|
packages/lore-hook-forms-material-ui/src/blueprints/update/Wizard/index.js | lore/lore-forms | import React from 'react';
import createReactClass from 'create-react-class';
import Wizard from './Wizard';
export default createReactClass({
render: function() {
const { modelName } = this.props;
const {
model,
schema,
fieldMap,
actionMap,
steps,
data,
validators,
fields,
actions,
...other
} = this.props;
return (
<Wizard
modelName={modelName}
model={model}
schema={schema}
fieldMap={fieldMap}
actionMap={actionMap}
data={data}
steps={steps || [
{
form: 'step',
// steps: [
// 'Enter Data'
// ],
// activeStep: 0,
validators: validators || {},
fields: fields || [
{
key: 'question',
type: 'custom',
props: {
render: (form) => {
return (
<p>
No fields have been provided.
</p>
);
}
}
}
],
actions: actions || [
{
type: 'raised',
props: (form) => {
return {
label: 'Update',
primary: true,
disabled: form.hasError,
onClick: () => {
form.callbacks.onSubmit(form.data)
}
}
}
}
]
},
{
form: 'confirmation'
}
]}
{...other}
/>
);
}
});
|
app/components/Common/PageLoader/index.js | VineRelay/VineRelayStore | import React from 'react';
import styled from 'styled-components';
const Wrapper = styled.div`
`;
const PageLoader = () => (
<Wrapper>
Loading ...
</Wrapper>
);
PageLoader.propTypes = {
};
export default PageLoader;
|
src/containers/Header/index.js | Guseff/services-on-map-demo | import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import LoginMenu from '../../components/LoginMenu';
import {
showLoginMenu,
closeLoginMenu,
} from '../../actions/MarkerActions';
import {
checkLogin,
logOutUser,
loginUser,
} from '../../actions/LoginActions';
import {
showUserModal,
showEditUser,
findOfferer,
} from '../../actions/ModalActions';
import './style.css';
class Header extends Component {
constructor() {
super();
this.photoClick = this.photoClick.bind(this);
}
componentDidMount() {
this.props.checkLogin(localStorage.getItem('token'));
}
photoClick() {
this.props.showLoginMenu();
}
renderUserMenu() {
if (!this.props.loggedUser) {
return null;
}
return (
<div className='user-photo'>
<img alt='' title={`Logged as ${this.props.loggedUser.name}`} src={this.props.loggedUser.photoURL} onClick={this.photoClick} />
</div>
);
}
renderLoginLI() {
if (!this.props.loggedUser) {
return (
<li>
<button href='#' onClick={this.photoClick}>
Log In
</button>
</li>
);
}
return null;
}
render() {
const {
showLogMenu, loggedUser,
closeLoginMenu, logOutUser, loginUser, showUserModal, showEditUser, findOfferer,
} = this.props;
return (
<div className="head">
<div className="logo">
Welcome to Brest service offer App
</div>
{this.renderUserMenu()}
<div className="menu">
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/about">About</Link></li>
{this.renderLoginLI()}
</ul>
</div>
<LoginMenu
loggedUser={loggedUser}
showLogMenu={showLogMenu}
closeLoginMenu={closeLoginMenu}
logOutUser={logOutUser}
loginUser={loginUser}
showUserModal={showUserModal}
showEditUser={showEditUser}
findOfferer={findOfferer}
/>
</div>
);
}
}
function mapStateToProps(state) {
return {
loggedUser: state.login.loggedUser,
showLogMenu: state.login.showLogMenu,
}
}
function mapDispatchToProps(dispatch) {
return {
loginUser: bindActionCreators(loginUser, dispatch),
showLoginMenu: bindActionCreators(showLoginMenu, dispatch),
closeLoginMenu: bindActionCreators(closeLoginMenu, dispatch),
logOutUser: bindActionCreators(logOutUser, dispatch),
checkLogin: bindActionCreators(checkLogin, dispatch),
showUserModal: bindActionCreators(showUserModal, dispatch),
showEditUser: bindActionCreators(showEditUser, dispatch),
findOfferer: bindActionCreators(findOfferer, dispatch),
};
}
Header.propTypes = {
loggedUser: PropTypes.object,
showLogMenu: PropTypes.bool.isRequired,
loginUser: PropTypes.func.isRequired,
showLoginMenu: PropTypes.func.isRequired,
closeLoginMenu: PropTypes.func.isRequired,
logOutUser: PropTypes.func.isRequired,
checkLogin: PropTypes.func.isRequired,
showUserModal: PropTypes.func.isRequired,
showEditUser: PropTypes.func.isRequired,
findOfferer: PropTypes.func.isRequired,
}
export default connect(mapStateToProps, mapDispatchToProps)(Header);
|
src/components/slider/slide/templates/video-overlay.js | adrienhobbs/redux-glow | import React from 'react';
import styles from './video-slide.css';
import {primaryColor} from 'constants/colors';
const VideoOverlay = () => {
return (
<div id='video-home-overlay'>
<div className={styles.video_intro}></div>
<div className={styles.copy_wrap}>
<div className={styles.featured_headline}>
<svg style={{fill: primaryColor}} id='Layer_1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500.3 60.5'>
<path d='M33 33.1l-8.1 25.2H14.7L0 18.8h12.9l7.3 23.5 7-23.5h11.6l7 23.5L53 18.8h13L51.2 58.3H41l-8-25.2zm42.1 8.5c.2 4.8 2.2 8.8 8.8 8.8 4.3 0 6.5-2 7.3-4.5h12.3c-1.1 7.5-8.2 13.5-19.5 13.5-13.8 0-21.3-8.6-21.3-20.8 0-11.6 7.3-20.8 21-20.8 12.4 0 20.3 8.4 20.3 18 0 1.6 0 3.4-.4 5.8H75.1zm0-7.2h16.5c0-5.1-3.4-8.3-8.1-8.3-4.8 0-8.4 2.9-8.4 8.3zm90.5-15.6v39.5h-12.5v-5.6c-1.9 3.6-7 6.6-12 6.6-11.4 0-19.3-8.9-19.3-20.7 0-11.8 7.9-20.7 19.3-20.7 5.1 0 10.2 3 12 6.6v-5.7h12.5zm-12.5 19.7c0-5.4-3.8-10.1-9.4-10.1-5.7 0-9.4 4.7-9.4 10.1 0 5.5 3.8 10.1 9.4 10.1 5.6 0 9.4-4.6 9.4-10.1zm45.8-8.3c-1.7-.4-2.7-.6-4.4-.6-6.9 0-11.4 3.6-11.4 13.3v15.4h-12.5V18.8H183v6.4c1.8-3.7 6.6-7 12-7 1.6 0 2.6.2 3.8.7v11.3zm12.4 11.4c.2 4.8 2.2 8.8 8.8 8.8 4.3 0 6.5-2 7.3-4.5h12.3c-1.1 7.5-8.2 13.5-19.5 13.5-13.8 0-21.3-8.6-21.3-20.8 0-11.6 7.3-20.8 21-20.8 12.4 0 20.3 8.4 20.3 18 0 1.6 0 3.4-.4 5.8h-28.5zm0-7.2h16.6c0-5.1-3.4-8.3-8.1-8.3-5 0-8.5 2.9-8.5 8.3zM291.8 27.1h26.7v11.2c-2.1 13.2-12 22.1-28.9 22.1-19.7 0-30.6-13.8-30.6-30.2C259 14.5 270.2 0 289.5 0c16.6 0 27.4 9.8 28.5 21.5h-18.8c-.6-3.3-3.8-6.9-9.8-6.9-9.2 0-12.9 7.8-12.9 15.9 0 8.9 4.6 16 14 16 6.4 0 10-3.6 10.8-8.1h-9.5V27.1zM354.7 44.3v14.6h-32V1.6h17v42.8h15zM354.3 30.2c0-15.8 11.4-30.2 31.1-30.2 19.7 0 31.1 14.4 31.1 30.2s-11.4 30.2-31.1 30.2c-19.7.1-31.1-14.4-31.1-30.2zm44.9 0c0-7.6-5.1-14.7-13.8-14.7-8.7 0-13.8 7-13.8 14.7s5.2 14.7 13.8 14.7c8.8 0 13.8-7 13.8-14.7zM455.3 27.7l-9.6 31.2h-14.8L410.2 1.6h18l10.2 34.2 10.1-34.2h13.6l10 34.2 10.2-34.2h18L479.7 59h-14.9l-9.5-31.3z'/>
</svg>
</div>
<p>We provide real solutions covering the full spectrum of social and digital marketing.</p>
</div>
</div>
);
};
export default VideoOverlay;
|
Realization/frontend/czechidm-core/src/components/advanced/Icon/ContractGuaranteeRemoveIcon.js | bcvsolutions/CzechIdMng | import React from 'react';
import { faUserTie, faMinusSquare } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
//
import AbstractIcon from './AbstractIcon';
import Icon from '../../basic/Icon/Icon';
/**
* Remove assigned identity role.
*
* @author Ondrej Husnik
* @since 10.8.0
*/
export default class ContractGuaranteeRemoveIcon extends AbstractIcon {
renderIcon() {
const { disabled } = this.props;
//
return (
<span className={ this.getClassName('fa-layers fa-fw') }>
<FontAwesomeIcon icon={ faUserTie } transform="left-2"/>
<Icon
level={ disabled ? 'default' : 'danger' }
icon={
<FontAwesomeIcon icon={ faMinusSquare } transform="up-3 right-7 shrink-6"/>
}/>
</span>
);
}
}
|
src/svg-icons/image/flash-off.js | hwo411/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageFlashOff = (props) => (
<SvgIcon {...props}>
<path d="M3.27 3L2 4.27l5 5V13h3v9l3.58-6.14L17.73 20 19 18.73 3.27 3zM17 10h-4l4-8H7v2.18l8.46 8.46L17 10z"/>
</SvgIcon>
);
ImageFlashOff = pure(ImageFlashOff);
ImageFlashOff.displayName = 'ImageFlashOff';
ImageFlashOff.muiName = 'SvgIcon';
export default ImageFlashOff;
|
examples/real-world/routes.js | gajus/redux | import React from 'react'
import { Route } from 'react-router'
import App from './containers/App'
import UserPage from './containers/UserPage'
import RepoPage from './containers/RepoPage'
export default (
<Route path="/" component={App}>
<Route path="/:login/:name"
component={RepoPage} />
<Route path="/:login"
component={UserPage} />
</Route>
)
|
information/blendle-frontend-react-source/app/modules/timeline/components/UpgradeBulletin/Message.js | BramscoChill/BlendleParser | import React from 'react';
import { string, number } from 'prop-types';
function Message({ name, daysLeft }) {
// Last day, with name
if (daysLeft === 0 && name) {
return (
<div className={CSS.message}>
<strong>{name}</strong>, let op! Dit is je <strong>laatste dag</strong> gratis Blendle
Premium. Ook na vandaag toegang houden?
</div>
);
}
// Countdown with name
if (daysLeft === 1 && name) {
return (
<div className={CSS.message}>
<strong>{name}</strong>, je leest Blendle Premium nog <strong>{daysLeft} dag</strong>{' '}
gratis. Ook daarna toegang houden?
</div>
);
}
// Countdown without name
if (daysLeft === 1) {
return (
<div className={CSS.message}>
Je leest Blendle Premium nog <strong>{daysLeft} dag</strong> gratis. Ook daarna
toegang houden?
</div>
);
}
// Last day, without name
if (daysLeft === 0) {
return (
<div className={CSS.message}>
Let op! Dit is je <strong>laatste dag</strong> gratis Blendle Premium. Ook na vandaag
toegang houden?
</div>
);
}
// Expired
if (daysLeft < 0) {
return (
<div className={CSS.message}>
Onbeperkt toegang tot al deze artikelen? Dat kan met Blendle Premium.
</div>
);
}
// Generic countdown with name
if (name) {
return (
<div className={CSS.message}>
<strong>{name}</strong>, je leest Blendle Premium nog <strong>{daysLeft} dagen</strong>{' '}
gratis. Ook daarna toegang houden?
</div>
);
}
// Generic Countdown
return (
<div className={CSS.message}>
Je leest Blendle Premium nog <strong>{daysLeft} dagen</strong> gratis. Ook daarna
toegang houden?
</div>
);
}
Message.propTypes = {
name: string,
daysLeft: number.isRequired,
};
Message.defaultProps = {
name: '',
};
export default Message;
// WEBPACK FOOTER //
// ./src/js/app/modules/timeline/components/UpgradeBulletin/Message.js |
app/Resources/js/containers/home.js | ryota-murakami/daily-tweet | import React from 'react'
import { connect } from 'react-redux'
import ImportModal from '../components/import/importModal'
import Timeline from '../components/timeline'
import Header from '../components/header'
import '../../sass/common/common.scss'
import '../../sass/page/home.scss'
class App extends React.Component {
render() {
return (
<div>
<ImportModal/>
<Header/>
<Timeline/>
</div>
)
}
}
export default connect()(App)
|
packages/frint-react/src/components/getMountableComponent.js | Travix-International/frint | /* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import Provider from './Provider';
export default function getMountableComponent(app) {
const Component = app.get('component');
const providerProps = { app };
const ComponentInProvider = (componentProps) => {
return (
<Provider {...providerProps}>
<Component {...componentProps} />
</Provider>
);
};
return (props) => {
return <ComponentInProvider {...props} />;
};
}
|
src/components/EmployeeList.js | amir5000/react-native-manager-app | import _ from 'lodash';
import React, { Component } from 'react';
import { ListView } from 'react-native';
import { connect } from 'react-redux';
import { employeeFetch } from '../actions';
import ListItem from './ListItem';
class EmployeeList extends Component {
componentWillMount() {
this.props.employeeFetch();
this.createDataSource(this.props);
}
componentWillReceiveProps(nextProps) {
this.createDataSource(nextProps);
}
createDataSource( { employees } ) {
const ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2
});
this.dataSource = ds.cloneWithRows(employees);
}
renderRow(employee) {
return <ListItem employee={employee} />;
}
render() {
return (
<ListView
enableEmptySections
dataSource={this.dataSource}
renderRow={this.renderRow}
/>
);
}
}
const mapStateToProps = state => {
const employees = _.map(state.employees, (val, uid) => {
return { ...val, uid };
});
return { employees };
};
export default connect(mapStateToProps, { employeeFetch })(EmployeeList);
|
docs/src/app/components/pages/components/TimePicker/ExampleSimple.js | matthewoates/material-ui | import React from 'react';
import TimePicker from 'material-ui/TimePicker';
const TimePickerExampleSimple = () => (
<div>
<TimePicker
hintText="12hr Format"
/>
<TimePicker
format="24hr"
hintText="24hr Format"
/>
<TimePicker
disabled={true}
format="24hr"
hintText="Disabled TimePicker"
/>
</div>
);
export default TimePickerExampleSimple;
|
client/fragments/quizzes/debris/index.js | yeoh-joer/synapse | /**
* External dependencies
*/
import React from 'react'
import PropTypes from 'prop-types'
import page from 'page'
/**
* Internal dependencies
*/
import './style.scss'
import Button from 'client/components/button'
import Card from 'client/components/card'
export default class Debris extends React.Component {
static propTypes = {
quizId: PropTypes.string.isRequired,
sections: PropTypes.array.isRequired
}
render() {
const { sections, quizId } = this.props
return (
<div className='debris'>
{ sections.map(function (row, i) {
return (
<Card className='debris__item' key={i}>
<section className='mdc-card__primary'>
<h1 className='mdc-card__title'>{ row.name }</h1>
</section>
<section className='mdc-card__supporting-text cc-color-text--grey-500'>
<div className='cc-ui__ellipsis'>
{ row.description }
</div>
</section>
<section className='mdc-card__actions mdc-card__actions--divider'>
{
row.completed === 0
? <Button compact primary className='mdc-card__action' onClick={() => page(`/quizzes/${quizId}/${row.id}`)}>
Start
</Button>
: <Button compact primary className='mdc-card__action' onClick={() => page(`/quizzes/${quizId}/${row.id}/result`)}>
View
</Button>
}
</section>
</Card>
)
}) }
</div>
)
}
} |
src/main/js/builder/assets/containers/MediBotInput.js | Bernardo-MG/dreadball-toolkit-webpage | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { setMediBot } from 'builder/assets/actions';
import ObservableNumberInput from 'components/ObservableNumberInput';
import { selectMediBots } from 'builder/assets/selectors';
const MediBotInput = (props) =>
<ObservableNumberInput id={props.id} name={props.name} value={props.value} min={props.min} max={props.max} onChange={props.onChange} />;
MediBotInput.propTypes = {
onChange: PropTypes.func.isRequired,
id: PropTypes.string,
name: PropTypes.string,
min: PropTypes.number,
max: PropTypes.number,
value: PropTypes.number
};
const mapStateToProps = (state) => {
return {
value: selectMediBots(state)
};
};
const mapDispatchToProps = (dispatch) => {
return {
onChange: bindActionCreators(setMediBot, dispatch)
};
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(MediBotInput);
|
spec/javascripts/jsx/blueprint_courses/components/BlueprintModalSpec.js | djbender/canvas-lms | /*
* Copyright (C) 2017 - 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 * as enzyme from 'enzyme'
import BlueprintModal from 'jsx/blueprint_courses/components/BlueprintModal'
QUnit.module('BlueprintModal component', {
setup() {
const appElement = document.createElement('div')
appElement.id = 'application'
document.getElementById('fixtures').appendChild(appElement)
},
teardown() {
document.getElementById('fixtures').innerHTML = ''
}
})
const defaultProps = () => ({
isOpen: true
})
const render = (props = defaultProps(), children = <p>content</p>) => (
<BlueprintModal {...props}>{children}</BlueprintModal>
)
test('renders the BlueprintModal component', () => {
const tree = enzyme.shallow(render())
const node = tree.find('ModalBody')
ok(node.exists())
tree.unmount()
})
test('renders the Done button when there are no changes', () => {
const wrapper = enzyme.shallow(render())
const buttons = wrapper.find('ModalFooter').find('Button')
equal(buttons.length, 1)
equal(buttons.at(0).prop('children'), 'Done')
})
test('renders the Checkbox, Save, and Cancel buttons when there are changes', () => {
const props = {
...defaultProps(),
hasChanges: true,
willAddAssociations: true,
canAutoPublishCourses: true
}
const wrapper = enzyme.shallow(render(props))
const buttons = wrapper.find('ModalFooter').find('Button')
equal(buttons.length, 2)
ok(
wrapper
.find('ModalFooter')
.find('Checkbox')
.exists()
)
equal(buttons.at(0).prop('children'), 'Cancel')
equal(buttons.at(1).prop('children'), 'Save')
})
test('renders the Done button when there are changes, but is in the process of saving', () => {
const props = {
...defaultProps(),
hasChanges: true,
isSaving: true
}
const wrapper = enzyme.shallow(render(props))
const buttons = wrapper.find('ModalFooter').find('Button')
equal(buttons.length, 1)
equal(buttons.at(0).prop('children'), 'Done')
})
|
packages/react/components/block.js | iamxiaoma/Framework7 | import React from 'react';
import Utils from '../utils/utils';
import Mixins from '../utils/mixins';
import __reactComponentDispatchEvent from '../runtime-helpers/react-component-dispatch-event.js';
import __reactComponentSlots from '../runtime-helpers/react-component-slots.js';
import __reactComponentSetProps from '../runtime-helpers/react-component-set-props.js';
class F7Block extends React.Component {
constructor(props, context) {
super(props, context);
this.__reactRefs = {};
(() => {
Utils.bindMethods(this, ['onTabShow', 'onTabHide']);
})();
}
onTabShow(el) {
if (this.eventTargetEl !== el) return;
this.dispatchEvent('tabShow tab:show', el);
}
onTabHide(el) {
if (this.eventTargetEl !== el) return;
this.dispatchEvent('tabHide tab:hide', el);
}
render() {
const self = this;
const props = self.props;
const {
className,
inset,
xsmallInset,
smallInset,
mediumInset,
largeInset,
xlargeInset,
strong,
accordionList,
accordionOpposite,
tabs,
tab,
tabActive,
noHairlines,
noHairlinesIos,
noHairlinesMd,
noHairlinesAurora,
id,
style
} = props;
const classes = Utils.classNames(className, 'block', {
inset,
'xsmall-inset': xsmallInset,
'small-inset': smallInset,
'medium-inset': mediumInset,
'large-inset': largeInset,
'xlarge-inset': xlargeInset,
'block-strong': strong,
'accordion-list': accordionList,
'accordion-opposite': accordionOpposite,
tabs,
tab,
'tab-active': tabActive,
'no-hairlines': noHairlines,
'no-hairlines-md': noHairlinesMd,
'no-hairlines-ios': noHairlinesIos,
'no-hairlines-aurora': noHairlinesAurora
}, Mixins.colorClasses(props));
return React.createElement('div', {
id: id,
style: style,
className: classes,
ref: __reactNode => {
this.__reactRefs['el'] = __reactNode;
}
}, this.slots['default']);
}
componentWillUnmount() {
const el = this.refs.el;
if (!el || !this.$f7) return;
this.$f7.off('tabShow', this.onTabShow);
this.$f7.off('tabHide', this.onTabHide);
delete this.eventTargetEl;
}
componentDidMount() {
const self = this;
const el = self.refs.el;
if (!el) return;
self.eventTargetEl = el;
self.$f7ready(f7 => {
f7.on('tabShow', self.onTabShow);
f7.on('tabHide', self.onTabHide);
});
}
get slots() {
return __reactComponentSlots(this.props);
}
dispatchEvent(events, ...args) {
return __reactComponentDispatchEvent(this, events, ...args);
}
get refs() {
return this.__reactRefs;
}
set refs(refs) {}
}
__reactComponentSetProps(F7Block, Object.assign({
id: [String, Number],
className: String,
style: Object,
inset: Boolean,
xsmallInset: Boolean,
smallInset: Boolean,
mediumInset: Boolean,
largeInset: Boolean,
xlargeInset: Boolean,
strong: Boolean,
tabs: Boolean,
tab: Boolean,
tabActive: Boolean,
accordionList: Boolean,
accordionOpposite: Boolean,
noHairlines: Boolean,
noHairlinesMd: Boolean,
noHairlinesIos: Boolean,
noHairlinesAurora: Boolean
}, Mixins.colorProps));
F7Block.displayName = 'f7-block';
export default F7Block; |
web/src/components/Button/Button.js | gianksp/warbots | import React from 'react'
import PropTypes from 'prop-types'
import 'bulma/css/bulma.css'
export const Button = (props) => {
var throwAlert = () => alert("Copy and paste is a design error")
return (
<div>
<div className="columns">
<div className="column is-half">
<a className="button is-danger" onClick={throwAlert}>{props.btnName}</a>
</div>
</div>
</div>
)
}
Button.propTypes = {
btnName: PropTypes.string
} |
src/views/discover/Feedback.js | airloy/objective | /**
* Created by Layman(http://github.com/anysome) on 16/3/4.
*/
import React from 'react';
import {StyleSheet, ScrollView, View, Text, TouchableOpacity, ListView, LayoutAnimation} from 'react-native';
import Button from 'react-native-button';
import moment from 'moment';
import {styles, colors, airloy, api, L, toast} from '../../app';
import util from '../../libs/Util';
import TextArea from '../../widgets/TextArea';
import FeedbackDetail from './FeedbackDetail';
export default class Feedback extends React.Component {
constructor(props) {
super(props);
this.state = {
input: '',
dataSource: new ListView.DataSource({
rowHasChanged: (row1, row2) => true
})
};
this.list = [];
this._input = null;
this._renderRow = this._renderRow.bind(this);
}
componentWillUpdate(props, state) {
if (this.state.dataSource !== state.dataSource) {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
}
}
componentDidMount() {
this.reload();
}
async reload() {
let result = await airloy.net.httpGet(api.feedback.list);
if (result.success) {
this.list = result.info;
this.setState({
dataSource: this.state.dataSource.cloneWithRows(this.list)
});
} else {
toast(L(result.message));
}
}
async _send() {
if (this.state.input) {
let result = await airloy.net.httpPost(api.feedback.add, {
content: this.state.input,
from: 'Objective'
});
if (result.success) {
this.list.unshift(result.info);
this.setState({
input: '',
dataSource: this.state.dataSource.cloneWithRows(this.list)
});
} else {
toast(L(result.message));
}
} else {
this._input.focus();
}
}
_toReply(rowData) {
this.props.navigator.push({
title: 'ๅๅคๅ้ฆ',
component: FeedbackDetail,
rightButtonIcon: require('../../../resources/icons/trash.png'),
onRightButtonPress: () => this.removeRow(rowData),
navigationBarHidden: false,
passProps: {
data: rowData,
onFeedback: (feedback) => this.updateRow(feedback)
}
});
}
async removeRow(rowData) {
let result = await airloy.net.httpGet(api.feedback.remove, {id: rowData.id});
if (result.success) {
util.removeFromArray(this.list, rowData);
this.setState({
dataSource: this.state.dataSource.cloneWithRows(this.list)
});
this.props.navigator.pop();
} else {
toast(L(result.message));
}
}
updateRow(rowData) {
this.setState({
dataSource: this.state.dataSource.cloneWithRows(this.list)
});
}
_renderRow(rowData, sectionId, rowId) {
return (
<TouchableOpacity style={style.row} onPress={() => this._toReply(rowData)}>
<Text style={styles.navText}>{rowData.content}</Text>
<View style={styles.containerF}>
<Text style={styles.hint}>{rowData.answers + ' ๅๅค'}</Text>
<Text style={styles.hint}>{moment(rowData.createTime).fromNow()}</Text>
</View>
</TouchableOpacity>
);
}
_renderSeparator(sectionId, rowId, adjacentRowHighlighted) {
return <View key={rowId + '_separator'} style={styles.separator}></View>
}
render() {
return (
<ScrollView style={styles.container} keyboardDismissMode='on-drag' keyboardShouldPersistTaps>
<TextArea
ref={(c)=> this._input = c}
defaultValue={this.state.input}
onChangeText={text => this.setState({input:text})}
placeholder="่กไบๆ๏ผๅ ไฝ ๆด็พๅฅฝ๏ผ"
autoFocus={true}/>
<Button
style={styles.buttonText}
containerStyle={styles.button}
activeOpacity={0.5}
onPress={()=>this._send()}>
ๅ้ฆ
</Button>
<ListView style={style.list} initialListSize={10}
enableEmptySections={true}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderSeparator={this._renderSeparator}
/>
</ScrollView>
);
}
}
const style = StyleSheet.create({
list: {
marginTop: 20
},
row: {
flexDirection: 'column',
flex: 1,
paddingTop: 5,
paddingBottom: 5
}
});
|
es6/Radio/Radio.js | yurizhang/ishow | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
import React from 'react';
import PropTypes from 'prop-types';
import { default as Component } from '../Common/plugs/index.js'; //ๆไพstyle, classnameๆนๆณ
import '../Common/css/radio.css';
var Radio = function (_Component) {
_inherits(Radio, _Component);
function Radio(props) {
_classCallCheck(this, Radio);
var _this = _possibleConstructorReturn(this, (Radio.__proto__ || Object.getPrototypeOf(Radio)).call(this, props));
_this.state = {
checked: _this.getChecked(props)
};
return _this;
}
_createClass(Radio, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
var checked = this.getChecked(props);
if (this.state.checked !== checked) {
this.setState({ checked: checked });
}
}
}, {
key: 'onChange',
value: function onChange(e) {
var checked = e.target.checked;
if (checked) {
if (this.props.onChange) {
this.props.onChange(this.props.value);
}
}
this.setState({ checked: checked });
}
}, {
key: 'onFocus',
value: function onFocus() {
this.setState({
focus: true
});
}
}, {
key: 'onBlur',
value: function onBlur() {
this.setState({
focus: false
});
}
}, {
key: 'getChecked',
value: function getChecked(props) {
return props.model === props.value || Boolean(props.checked);
}
}, {
key: 'render',
value: function render() {
var _state = this.state,
checked = _state.checked,
focus = _state.focus;
var _props = this.props,
disabled = _props.disabled,
value = _props.value,
children = _props.children;
return React.createElement(
'label',
{ style: this.style(), className: this.className('ishow-radio') },
React.createElement(
'span',
{ className: this.classNames({
'ishow-radio__input': true,
'is-checked': checked,
'is-disabled': disabled,
'is-focus': focus
}) },
React.createElement('span', { className: 'ishow-radio__inner' }),
React.createElement('input', {
type: 'radio',
className: 'ishow-radio__original',
checked: checked,
disabled: disabled,
onChange: this.onChange.bind(this),
onFocus: this.onFocus.bind(this),
onBlur: this.onBlur.bind(this)
})
),
React.createElement(
'span',
{ className: 'ishow-radio__label' },
children || value
)
);
}
}]);
return Radio;
}(Component);
Radio.elementType = 'Radio';
export default Radio;
Radio.propTypes = {
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
onChange: PropTypes.func,
disabled: PropTypes.bool,
checked: PropTypes.bool
}; |
modules/components/Students/components/Student/index.js | hmltnbrn/classroom-library | import React from 'react';
import {Link} from 'react-router';
import DocumentTitle from 'react-document-title';
import Paper from 'material-ui/Paper';
import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn} from 'material-ui/Table';
import Divider from 'material-ui/Divider';
import moment from "moment";
import * as libraryService from './../../../../services/library-service';
class Student extends React.Component {
constructor(props) {
super(props);
this.state = {
student: {},
current_books: [],
history_books: []
}
}
componentDidMount() {
if (this.props.signedIn === true) {
this.findStudents();
}
else {
this.props.setPageTitle("Student");
}
}
componentWillReceiveProps(nextProps) {
if (this.props.signedIn === false && nextProps.signedIn === true) {
this.findStudents();
}
else if (this.props.signedIn === true && nextProps.signedIn === false) {
this.props.setPageTitle("Student");
}
}
findStudents() {
libraryService.findStudentHistoryById({studentId: this.props.params.studentId})
.then(data => {
this.setState({
student: data.student[0],
current_books: data.out_books,
history_books: data.in_books
}, this.setTitle);
});
}
setTitle() {
let title = this.state.student !== undefined ? this.state.student.name + " " + this.state.student.class : 'Student';
this.props.setPageTitle(title);
}
render() {
let listCurrentBooks = this.state.current_books.map(book => {
let date_out = moment(book.date_out).format('dddd, MMMM D, YYYY');
return (
<TableRow key={book.id}>
<TableRowColumn>{book.title}</TableRowColumn>
<TableRowColumn>{book.level}</TableRowColumn>
<TableRowColumn>{date_out}</TableRowColumn>
</TableRow>
);
});
let listHistoryBooks = this.state.history_books.map(book => {
let date_out = moment(book.date_out).format('dddd, MMMM D, YYYY');
let date_in = moment(book.date_in).format('dddd, MMMM D, YYYY');
return (
<TableRow key={book.id}>
<TableRowColumn>{book.title}</TableRowColumn>
<TableRowColumn>{book.level}</TableRowColumn>
<TableRowColumn>{date_out}</TableRowColumn>
<TableRowColumn>{date_in}</TableRowColumn>
</TableRow>
);
});
if (this.props.signedIn === true) {
return (
<DocumentTitle title={"Library | " + this.state.student.name}>
<div className="students flex flex-column align-center">
<div className="student-active" style={this.state.student.active === true ? {color:'#2E7D32'} : {color:'#C62828'}}>
{this.state.student.active === true ? "Active" : "Inactive"}
</div>
<Divider style={{width:'70%',marginBottom:18}}/>
<Paper className="student-current-paper">
<Table
style={{tableLayout:'auto'}}
bodyStyle={{overflow:'auto'}}
>
<TableHeader
displaySelectAll={false}
adjustForCheckbox={false}
>
<TableRow>
<TableHeaderColumn
colSpan="7"
style={{textAlign:'center',fontSize:18}}
>
Current Books
</TableHeaderColumn>
</TableRow>
</TableHeader>
<TableBody
displayRowCheckbox={false}
>
<TableRow>
<TableHeaderColumn>Book Title</TableHeaderColumn>
<TableHeaderColumn>Level</TableHeaderColumn>
<TableHeaderColumn>Date Checked Out</TableHeaderColumn>
</TableRow>
{listCurrentBooks}
</TableBody>
</Table>
</Paper>
<Paper className="student-history-paper">
<Table
style={{tableLayout:'auto'}}
bodyStyle={{overflow:'auto'}}
>
<TableHeader
displaySelectAll={false}
adjustForCheckbox={false}
>
<TableRow>
<TableHeaderColumn
colSpan="7"
style={{textAlign:'center',fontSize:18}}
>
History
</TableHeaderColumn>
</TableRow>
</TableHeader>
<TableBody
displayRowCheckbox={false}
>
<TableRow>
<TableHeaderColumn>Book Title</TableHeaderColumn>
<TableHeaderColumn>Level</TableHeaderColumn>
<TableHeaderColumn>Date Checked Out</TableHeaderColumn>
<TableHeaderColumn>Date Checked In</TableHeaderColumn>
</TableRow>
{listHistoryBooks}
</TableBody>
</Table>
</Paper>
</div>
</DocumentTitle>
);
}
else {
return (
<DocumentTitle title="Library | Student">
<div className="students flex flex-column align-center">
<p>Sign in to view this page.</p>
</div>
</DocumentTitle>
);
}
}
};
export default Student;
|
actor-apps/app-web/src/app/components/common/State.react.js | fengshao0907/actor-platform | import React from 'react';
import { MessageContentTypes } from 'constants/ActorAppConstants';
class State extends React.Component {
static propTypes = {
message: React.PropTypes.object.isRequired
};
render() {
const { message } = this.props;
if (message.content.content === MessageContentTypes.SERVICE) {
return null;
} else {
let icon = null;
switch(message.state) {
case 'pending':
icon = <i className="status status--penging material-icons">access_time</i>;
break;
case 'sent':
icon = <i className="status status--sent material-icons">done</i>;
break;
case 'received':
icon = <i className="status status--received material-icons">done_all</i>;
break;
case 'read':
icon = <i className="status status--read material-icons">done_all</i>;
break;
case 'error':
icon = <i className="status status--error material-icons">report_problem</i>;
break;
default:
}
return (
<div className="message__status">{icon}</div>
);
}
}
}
export default State;
|
actor-apps/app-web/src/app/components/dialog/messages/Document.react.js | dut3062796s/actor-platform | import React from 'react';
import classnames from 'classnames';
class Document extends React.Component {
static propTypes = {
content: React.PropTypes.object.isRequired,
className: React.PropTypes.string
};
constructor(props) {
super(props);
}
render() {
const { content, className } = this.props;
const documentClassName = classnames(className, 'row');
let availableActions;
if (content.isUploading === true) {
availableActions = <span>Loading...</span>;
} else {
availableActions = <a href={content.fileUrl}>Download</a>;
}
return (
<div className={documentClassName}>
<div className="document row">
<div className="document__icon">
<i className="material-icons">attach_file</i>
</div>
<div className="col-xs">
<span className="document__filename">{content.fileName}</span>
<div className="document__meta">
<span className="document__meta__size">{content.fileSize}</span>
<span className="document__meta__ext">{content.fileExtension}</span>
</div>
<div className="document__actions">
{availableActions}
</div>
</div>
</div>
<div className="col-xs"></div>
</div>
);
}
}
export default Document;
|
app/components/about_page.js | laynemcnish/personal-site | import React from 'react';
import PureComponent from 'react-pure-render/component';
import ShapeTween from './shape_tween';
export default class AboutPage extends PureComponent {
render () {
return (
<div className="row">
<div className="col-md-4 shape-container">
<div id="shape-tween"></div>
<ShapeTween />
</div>
<div className="col-md-8 about-container">
<h2> About page text </h2>
<h3>
"Turmoil has engulfed the Galactic Republic. The taxation of trade routes to outlying star systems is in dispute. Hoping to resolve the matter with a blockade of deadly battleships, the greedy Trade Federation has stopped all shipping to the small planet of Naboo. While the Congress of the Republic endlessly debates this alarming chain of events, the Supreme Chancellor has secretly dispatched two Jedi Knights, the guardians of peace and justice in the galaxy, to settle the conflict...."
</h3>
<h3>
"There is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. This separatist movement, under the leadership of the mysterious Count Dooku, has made it difficult for the limited number of Jedi Knights to maintain peace and order in the galaxy. Senator Amidala, the former Queen of Naboo, is returning to the Galactic Senate to vote on the critical issue of creating an ARMY OF THE REPUBLIC to assist the overwhelmed Jedi...."
</h3>
<h3>
"War! The Republic is crumbling under attacks by the ruthless Sith Lord, Count Dooku. There are heroes on both sides. Evil is everywhere. In a stunning move, the fiendish droid leader, General Grievous, has swept into the Republic capital and kidnapped Chancellor Palpatine, leader of the Galactic Senate. As the Separatist Droid Army attempts to flee the besieged capital with their valuable hostage, two Jedi Knights lead a desperate mission to rescue the captive Chancellor...."
</h3>
<h3>
"It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. During the battle, rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR, an armored space station with enough power to destroy an entire planet. Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy...."
</h3>
<h3>
"It is a dark time for the Rebellion. Although the Death Star has been destroyed, Imperial troops have driven the Rebel forces from their hidden base and pursued them across the galaxy. Evading the dreaded Imperial Starfleet, a group of freedom fighters led by Luke Skywalker has established a new secret base on the remote ice world of Hoth. The evil lord Darth Vader, obsessed with finding young Skywalker, has dispatched thousands of remote probes into the far reaches of space..."
</h3>
<h3>
"Luke Skywalker has returned to his home planet of Tatooine in an attempt to rescue his friend Han Solo from the clutches of the vile gangster Jabba the Hutt. Little does Luke know that the GALACTIC EMPIRE has secretly begun construction on a new armored space station even more powerful than the first dreaded Death Star. When completed, this ultimate weapon will spell certain doom for the small band of rebels struggling to restore freedom to the galaxy...."
</h3>
</div>
</div>
);
}
}
|
node_modules/react-native/Libraries/Text/Text.js | Ten-Wang/hackfoldr-android | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Text
* @flow
*/
'use strict';
const NativeMethodsMixin = require('react/lib/NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const StyleSheetPropType = require('StyleSheetPropType');
const TextStylePropTypes = require('TextStylePropTypes');
const Touchable = require('Touchable');
const createReactNativeComponentClass =
require('react/lib/createReactNativeComponentClass');
const merge = require('merge');
const mergeFast = require('mergeFast');
const stylePropType = StyleSheetPropType(TextStylePropTypes);
const viewConfig = {
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
numberOfLines: true,
ellipsizeMode: true,
allowFontScaling: true,
selectable: true,
adjustsFontSizeToFit: true,
minimumFontScale: true,
}),
uiViewClassName: 'RCTText',
};
/**
* A React component for displaying text.
*
* `Text` supports nesting, styling, and touch handling.
*
* In the following example, the nested title and body text will inherit the `fontFamily` from
*`styles.baseText`, but the title provides its own additional styles. The title and body will
* stack on top of each other on account of the literal newlines:
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react';
* import { AppRegistry, Text, StyleSheet } from 'react-native';
*
* class TextInANest extends Component {
* constructor(props) {
* super(props);
* this.state = {
* titleText: "Bird's Nest",
* bodyText: 'This is not really a bird nest.'
* };
* }
*
* render() {
* return (
* <Text style={styles.baseText}>
* <Text style={styles.titleText} onPress={this.onPressTitle}>
* {this.state.titleText}<br /><br />
* </Text>
* <Text numberOfLines={5}>
* {this.state.bodyText}
* </Text>
* </Text>
* );
* }
* }
*
* const styles = StyleSheet.create({
* baseText: {
* fontFamily: 'Cochin',
* },
* titleText: {
* fontSize: 20,
* fontWeight: 'bold',
* },
* });
*
* // App registration and rendering
* AppRegistry.registerComponent('TextInANest', () => TextInANest);
* ```
*/
const Text = React.createClass({
propTypes: {
/**
* This can be one of the following values:
*
* - `head` - The line is displayed so that the end fits in the container and the missing text
* at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
* - `middle` - The line is displayed so that the beginning and end fit in the container and the
* missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
* - `tail` - The line is displayed so that the beginning fits in the container and the
* missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
* - `clip` - Lines are not drawn past the edge of the text container.
*
* The default is `tail`.
*
* `numberOfLines` must be set in conjunction with this prop.
*
* > `clip` is working only for iOS
*/
ellipsizeMode: React.PropTypes.oneOf(['head', 'middle', 'tail', 'clip']),
/**
* Used to truncate the text with an ellipsis after computing the text
* layout, including line wrapping, such that the total number of lines
* does not exceed this number.
*
* This prop is commonly used with `ellipsizeMode`.
*/
numberOfLines: React.PropTypes.number,
/**
* Invoked on mount and layout changes with
*
* `{nativeEvent: {layout: {x, y, width, height}}}`
*/
onLayout: React.PropTypes.func,
/**
* This function is called on press.
*
* e.g., `onPress={() => console.log('1st')}``
*/
onPress: React.PropTypes.func,
/**
* This function is called on long press.
*
* e.g., `onLongPress={this.increaseSize}>``
*/
onLongPress: React.PropTypes.func,
/**
* Lets the user select text, to use the native copy and paste functionality.
*
* @platform android
*/
selectable: React.PropTypes.bool,
/**
* When `true`, no visual change is made when text is pressed down. By
* default, a gray oval highlights the text on press down.
*
* @platform ios
*/
suppressHighlighting: React.PropTypes.bool,
style: stylePropType,
/**
* Used to locate this view in end-to-end tests.
*/
testID: React.PropTypes.string,
/**
* Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The
* default is `true`.
*
* @platform ios
*/
allowFontScaling: React.PropTypes.bool,
/**
* When set to `true`, indicates that the view is an accessibility element. The default value
* for a `Text` element is `true`.
*
* See the
* [Accessibility guide](/react-native/docs/accessibility.html#accessible-ios-android)
* for more information.
*/
accessible: React.PropTypes.bool,
/**
* Specifies whether font should be scaled down automatically to fit given style constraints.
* @platform ios
*/
adjustsFontSizeToFit: React.PropTypes.bool,
/**
* Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
* @platform ios
*/
minimumFontScale: React.PropTypes.number,
},
getDefaultProps(): Object {
return {
accessible: true,
allowFontScaling: true,
ellipsizeMode: 'tail',
};
},
getInitialState: function(): Object {
return mergeFast(Touchable.Mixin.touchableGetInitialState(), {
isHighlighted: false,
});
},
mixins: [NativeMethodsMixin],
viewConfig: viewConfig,
getChildContext(): Object {
return {isInAParentText: true};
},
childContextTypes: {
isInAParentText: React.PropTypes.bool
},
contextTypes: {
isInAParentText: React.PropTypes.bool
},
/**
* Only assigned if touch is needed.
*/
_handlers: (null: ?Object),
_hasPressHandler(): boolean {
return !!this.props.onPress || !!this.props.onLongPress;
},
/**
* These are assigned lazily the first time the responder is set to make plain
* text nodes as cheap as possible.
*/
touchableHandleActivePressIn: (null: ?Function),
touchableHandleActivePressOut: (null: ?Function),
touchableHandlePress: (null: ?Function),
touchableHandleLongPress: (null: ?Function),
touchableGetPressRectOffset: (null: ?Function),
render(): ReactElement<any> {
let newProps = this.props;
if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
if (!this._handlers) {
this._handlers = {
onStartShouldSetResponder: (): bool => {
const shouldSetFromProps = this.props.onStartShouldSetResponder &&
this.props.onStartShouldSetResponder();
const setResponder = shouldSetFromProps || this._hasPressHandler();
if (setResponder && !this.touchableHandleActivePressIn) {
// Attach and bind all the other handlers only the first time a touch
// actually happens.
for (const key in Touchable.Mixin) {
if (typeof Touchable.Mixin[key] === 'function') {
(this: any)[key] = Touchable.Mixin[key].bind(this);
}
}
this.touchableHandleActivePressIn = () => {
if (this.props.suppressHighlighting || !this._hasPressHandler()) {
return;
}
this.setState({
isHighlighted: true,
});
};
this.touchableHandleActivePressOut = () => {
if (this.props.suppressHighlighting || !this._hasPressHandler()) {
return;
}
this.setState({
isHighlighted: false,
});
};
this.touchableHandlePress = (e: SyntheticEvent) => {
this.props.onPress && this.props.onPress(e);
};
this.touchableHandleLongPress = (e: SyntheticEvent) => {
this.props.onLongPress && this.props.onLongPress(e);
};
this.touchableGetPressRectOffset = function(): RectOffset {
return PRESS_RECT_OFFSET;
};
}
return setResponder;
},
onResponderGrant: function(e: SyntheticEvent, dispatchID: string) {
this.touchableHandleResponderGrant(e, dispatchID);
this.props.onResponderGrant &&
this.props.onResponderGrant.apply(this, arguments);
}.bind(this),
onResponderMove: function(e: SyntheticEvent) {
this.touchableHandleResponderMove(e);
this.props.onResponderMove &&
this.props.onResponderMove.apply(this, arguments);
}.bind(this),
onResponderRelease: function(e: SyntheticEvent) {
this.touchableHandleResponderRelease(e);
this.props.onResponderRelease &&
this.props.onResponderRelease.apply(this, arguments);
}.bind(this),
onResponderTerminate: function(e: SyntheticEvent) {
this.touchableHandleResponderTerminate(e);
this.props.onResponderTerminate &&
this.props.onResponderTerminate.apply(this, arguments);
}.bind(this),
onResponderTerminationRequest: function(): bool {
// Allow touchable or props.onResponderTerminationRequest to deny
// the request
var allowTermination = this.touchableHandleResponderTerminationRequest();
if (allowTermination && this.props.onResponderTerminationRequest) {
allowTermination = this.props.onResponderTerminationRequest.apply(this, arguments);
}
return allowTermination;
}.bind(this),
};
}
newProps = {
...this.props,
...this._handlers,
isHighlighted: this.state.isHighlighted,
};
}
if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) {
newProps = {
...newProps,
style: [this.props.style, {color: 'magenta'}],
};
}
if (this.context.isInAParentText) {
return <RCTVirtualText {...newProps} />;
} else {
return <RCTText {...newProps} />;
}
},
});
type RectOffset = {
top: number,
left: number,
right: number,
bottom: number,
}
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
var RCTText = createReactNativeComponentClass(viewConfig);
var RCTVirtualText = RCTText;
if (Platform.OS === 'android') {
RCTVirtualText = createReactNativeComponentClass({
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',
});
}
module.exports = Text;
|
src/containers/toputilizers/containers/TopUtilizersSelectionRowContainer.js | kryptnostic/gallery | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Immutable from 'immutable';
import * as actionFactory from '../TopUtilizersActionFactory';
import TopUtilizersSelectionRow from '../components/TopUtilizersSelectionRow';
class TopUtilizersSelectionRowContainer extends React.Component {
static propTypes = {
neighborTypes: PropTypes.instanceOf(Immutable.List).isRequired,
entitySetTitle: PropTypes.string.isRequired,
updateEdgeTypes: PropTypes.func.isRequired,
selectedEdges: PropTypes.instanceOf(Immutable.List).isRequired
}
updateEdgeTypes = (options) => {
const selectedEdges = options.map((option) => {
return {
associationTypeId: option.assocId,
neighborTypeIds: [option.neighborId],
utilizerIsSrc: option.src
};
});
this.props.updateEdgeTypes(Immutable.fromJS(selectedEdges));
}
render() {
return (
<TopUtilizersSelectionRow
entitySetTitle={this.props.entitySetTitle}
neighborTypes={this.props.neighborTypes}
updateEdgeTypes={this.updateEdgeTypes}
selectedEdges={this.props.selectedEdges} />
);
}
}
function mapStateToProps(state) {
const topUtilizers = state.get('topUtilizers');
return {
neighborTypes: topUtilizers.get('neighborTypes', Immutable.List()),
selectedEdges: topUtilizers.get('topUtilizersDetailsList', Immutable.List())
};
}
function mapDispatchToProps(dispatch) {
const actions = {
updateEdgeTypes: actionFactory.updateEdgeTypes
};
return bindActionCreators(actions, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(TopUtilizersSelectionRowContainer);
|
app/javascript/mastodon/features/ui/components/drawer_loading.js | imas/mastodon | import React from 'react';
const DrawerLoading = () => (
<div className='drawer'>
<div className='drawer__pager'>
<div className='drawer__inner' />
</div>
</div>
);
export default DrawerLoading;
|
client/src/components/HistoricElementView/HistoricElementView.js | dnadesign/silverstripe-elemental | import React from 'react';
import i18n from 'i18n';
import classnames from 'classnames';
const ElementalAreaHistoryFactory = (FieldGroup) =>
class HistoricElementView extends FieldGroup {
getClassName() {
const classlist = [super.getClassName()];
if (this.props.data.ElementID) {
classlist.unshift('elemental-area__element--historic-inner');
}
return classnames(classlist);
}
render() {
const legend = this.getLegend();
const Tag = this.props.data.tag || 'div';
const classNames = this.getClassName();
const { data } = this.props;
if (!data.ElementID) {
return super.render();
}
return (
<Tag className={classNames}>
{legend}
<div className={'elemental-preview elemental-preview--historic'}>
{data.ElementEditLink &&
<a className="elemental-preview__link" href={data.ElementEditLink}>
<span className="elemental-preview__link-text">{i18n._t('HistoricElementView.VIEW_BLOCK_HISTORY', 'Block history')}</span>
<i className="font-icon-angle-right btn--icon-lg elemental-preview__link-caret" />
</a>
}
<div className={'elemental-preview__icon'}><i className={data.ElementIcon} /></div>
<div className={'elemental-preview__detail'}>
<h3>{data.ElementTitle} <small>{data.ElementType}</small></h3>
</div>
</div>
{this.props.children}
</Tag>
);
}
};
export default ElementalAreaHistoryFactory;
|
src/svg-icons/maps/local-play.js | lawrence-yu/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalPlay = (props) => (
<SvgIcon {...props}>
<path d="M20 12c0-1.1.9-2 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-1.99.9-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2zm-4.42 4.8L12 14.5l-3.58 2.3 1.08-4.12-3.29-2.69 4.24-.25L12 5.8l1.54 3.95 4.24.25-3.29 2.69 1.09 4.11z"/>
</SvgIcon>
);
MapsLocalPlay = pure(MapsLocalPlay);
MapsLocalPlay.displayName = 'MapsLocalPlay';
MapsLocalPlay.muiName = 'SvgIcon';
export default MapsLocalPlay;
|
src/components/Hero/Hero.js | webpack/analyse-tool | import React from 'react';
import styles from './Hero.scss';
import classNames from 'classnames';
export default class Hero extends React.Component {
static displayName = 'Hero';
static propTypes = {
children: React.PropTypes.node,
displayUnderNavbar: React.PropTypes.bool,
small: React.PropTypes.bool,
};
render() {
const classes = classNames({
[styles.hero]: true,
[styles['move-up']]: this.props.displayUnderNavbar,
[styles['hero-small']]: this.props.small,
});
return (
<div className={ classes }>
{this.props.children}
</div>
);
}
}
|
src/svg-icons/maps/local-gas-station.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalGasStation = (props) => (
<SvgIcon {...props}>
<path d="M19.77 7.23l.01-.01-3.72-3.72L15 4.56l2.11 2.11c-.94.36-1.61 1.26-1.61 2.33 0 1.38 1.12 2.5 2.5 2.5.36 0 .69-.08 1-.21v7.21c0 .55-.45 1-1 1s-1-.45-1-1V14c0-1.1-.9-2-2-2h-1V5c0-1.1-.9-2-2-2H6c-1.1 0-2 .9-2 2v16h10v-7.5h1.5v5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V9c0-.69-.28-1.32-.73-1.77zM12 10H6V5h6v5zm6 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"/>
</SvgIcon>
);
MapsLocalGasStation = pure(MapsLocalGasStation);
MapsLocalGasStation.displayName = 'MapsLocalGasStation';
MapsLocalGasStation.muiName = 'SvgIcon';
export default MapsLocalGasStation;
|
packages/react/components/messagebar-attachment.js | AdrianV/Framework7 | import React from 'react';
import Utils from '../utils/utils';
import Mixins from '../utils/mixins';
import __reactComponentDispatchEvent from '../runtime-helpers/react-component-dispatch-event.js';
import __reactComponentSlots from '../runtime-helpers/react-component-slots.js';
import __reactComponentSetProps from '../runtime-helpers/react-component-set-props.js';
class F7MessagebarAttachment extends React.Component {
constructor(props, context) {
super(props, context);
(() => {
this.onClickBound = this.onClick.bind(this);
this.onDeleteClickBound = this.onDeleteClick.bind(this);
})();
}
onClick(e) {
this.dispatchEvent('attachment:click attachmentClick', e);
}
onDeleteClick(e) {
this.dispatchEvent('attachment:delete attachmentDelete', e);
}
render() {
const self = this;
const props = self.props;
const {
deletable,
image,
className,
id,
style
} = props;
const classes = Utils.classNames(className, 'messagebar-attachment', Mixins.colorClasses(props));
return React.createElement('div', {
id: id,
style: style,
className: classes,
onClick: self.onClickBound
}, image && React.createElement('img', {
src: image
}), deletable && React.createElement('span', {
className: 'messagebar-attachment-delete',
onClick: self.onDeleteClickBound
}), this.slots['default']);
}
get slots() {
return __reactComponentSlots(this.props);
}
dispatchEvent(events, ...args) {
return __reactComponentDispatchEvent(this, events, ...args);
}
}
__reactComponentSetProps(F7MessagebarAttachment, Object.assign({
id: [String, Number],
image: String,
deletable: {
type: Boolean,
default: true
}
}, Mixins.colorProps));
F7MessagebarAttachment.displayName = 'f7-messagebar-attachment';
export default F7MessagebarAttachment; |
techCurriculum/ui/solutions/6.1/src/components/Title.js | jennybkim/engineeringessentials | /**
* Copyright 2017 Goldman Sachs.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
**/
import React from 'react';
function Title() {
return (
<div>
<h1>Cards</h1>
<h2>Share your ideas</h2>
</div>
);
}
export default Title;
|
folktale-react/src/index.js | Muzietto/react-playground | import React from 'react';
import ReactDOM from 'react-dom';
import Maybe from 'folktale/maybe';
import compose from 'folktale/core/lambda/compose';
ReactDOM.render(<App />, document.getElementById('root'));
function App() {
const inc = x => x + 1;
const double = x => x * 2;
const theMaybe = Maybe.Just(1).map(compose(double, inc));
const n = 5;
const result = n
|> double
|> double
|> (x => { console.log(x); return x + 1; })
|> double;
return <div>
{`theMaybe=${theMaybe}`}
<hr />
{`result=${result}`}
</div>;
}
|
components/Tools/AvailableHours.js | juhojo/WLO | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Card, CardActions, CardHeader, CardText } from 'material-ui/Card';
import Slider from 'material-ui/Slider';
export default class AvailableHours extends Component {
constructor(props) {
super(props);
this.state = {
expanded: false,
};
}
handleExpandChange(expanded) {
this.setState({expanded: expanded});
};
sliderChange(e, value) {
const { updateHours } = this.props;
updateHours(value);
}
render() {
const { hours } = this.props;
const { expanded } = this.state;
const headerText = expanded ? "Available hours" : `Available hours (${hours * 400} hours)`;
return (
<Card expanded={expanded} onExpandChange={this.handleExpandChange.bind(this)}>
<CardHeader
title={headerText}
actAsExpander={true}
showExpandableButton={true}
/>
<CardText expandable={true}>
Choose the amount of hours you have available for courses.
<Slider name="hours" onChange={this.sliderChange.bind(this)} step={0.10} value={hours} />
<p style={{ textAlign: 'center' }}>{hours * 400} hours</p>
</CardText>
</Card>
);
}
}
AvailableHours.propTypes = {
hours: React.PropTypes.number,
updateHours: React.PropTypes.func,
}
|
techCurriculum/ui/solutions/3.3/src/components/Message.js | jennybkim/engineeringessentials | /**
* Copyright 2017 Goldman Sachs.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
**/
import React from 'react';
function Message(props) {
return (
<div className='message-text'>
<p>{props.text}</p>
</div>
);
}
export default Message;
|
src/components/Columns.js | kdesterik/koendirkvanesterik.com | import React from 'react';
export default class Columns extends React.Component {
render() {
let columns = '';
switch( this.props.width ){
case 'full':
columns = (
<div className="col-lg-12
col-md-12
col-sm-12
col-xs-12" dangerouslySetInnerHTML={{ __html: this.props.text }} />
);
break;
case 'half':
default:
columns = (
<div className="col-lg-offset-3
col-lg-6
col-md-offset-3
col-md-6
col-sm-offset-2
col-sm-8
col-xs-12" dangerouslySetInnerHTML={{ __html: this.props.text }}/>
);
break;
}
return (
<div className='columns'>
<div className="container">
<div className="row">
{ columns }
</div>
</div>
</div>
);
}
} |
src/Main/ReportHistory.js | hasseboulen/WoWAnalyzer | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { getReportHistory } from 'selectors/reportHistory';
import { makePlainUrl } from 'Main/makeAnalyzerUrl';
import { title as AboutArticleTitle } from 'Main/News/Articles/2017-01-31-About';
import makeNewsUrl from 'Main/News/makeUrl';
class ReportHistory extends React.PureComponent {
static propTypes = {
reportHistory: PropTypes.arrayOf(PropTypes.shape({
code: PropTypes.string.isRequired,
fightId: PropTypes.number.isRequired,
fightName: PropTypes.string.isRequired,
playerId: PropTypes.number.isRequired,
playerName: PropTypes.string.isRequired,
playerClass: PropTypes.string.isRequired,
end: PropTypes.number.isRequired,
})).isRequired,
};
render() {
const { reportHistory } = this.props;
const now = (+new Date()) / 1000;
return (
<ul className="list selection">
{[...reportHistory].reverse().map(report => (
<li key={report.code} className="selectable">
<Link to={makePlainUrl(report.code, report.fightId, report.fightName, report.playerId, report.playerName)} style={{ color: '#fff', textDecoration: 'none' }}>
<div>
<div className={`playerName ${report.playerClass}`}>{report.playerName}</div>
<div className="flex wrapable">
<div>{report.fightName}</div>
<div className="flex-sub">{Math.floor(Math.max(0, now - report.end) / 86400)}d old report</div>
</div>
</div>
</Link>
</li>
))}
{reportHistory.length === 0 && (
<li style={{ padding: '10px 22px' }}>
You haven't viewed a report yet. Not sure where to start? <Link to={makeNewsUrl(AboutArticleTitle)}>About WoWAnalyzer.</Link>
</li>
)}
</ul>
);
}
}
const mapStateToProps = state => ({
reportHistory: getReportHistory(state),
});
export default connect(mapStateToProps, null)(ReportHistory);
|
client/index.js | forkful/forkful | import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux';
import App from './components/App';
import MainRecipe from './components/MainRecipe';
import Profile from './components/Profile';
import Dashboard from './components/Dashboard';
import Discover from './components/Discover';
import SearchResults from './components/SearchResults';
import ImageUpload from './components/ImageUpload.js';
import CreateRecipe from './components/CreateRecipe';
import Landing from './components/Landing';
import rootReducer from './reducers';
const middleware = routerMiddleware(browserHistory);
// createStore accepts a single reducer or a collection of reducers
const store = createStore(rootReducer, applyMiddleware(middleware));
const history = syncHistoryWithStore(browserHistory, store);
const render = function () {
ReactDOM.render(
<Provider store={store}>
<div>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Landing} />
<Route path="/dashboard" component={Dashboard} />
<Route path="/landing" component={Landing} />
<Route path="/discover" component={Discover} />
<Route path="/profile/:user_id" component={Profile} />
<Route path="/recipe/:id" component={MainRecipe} />
<Route path="/create" component={CreateRecipe} />
<Route path="/search" component={SearchResults} />
<Route path="/*" component={Dashboard} />
</Route>
</Router>
</div>
</Provider>,
document.getElementById('app')
);
};
render();
store.subscribe(render);
|
docs/app/Examples/elements/Loader/Variations/LoaderExampleInline.js | shengnian/shengnian-ui-react | import React from 'react'
import { Loader } from 'shengnian-ui-react'
const LoaderExampleInline = () => (
<Loader active inline />
)
export default LoaderExampleInline
|
client/src/components/streamsList/listOfStreams.js | AuggieH/GigRTC | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getActivePerformances } from '../../actions';
import { Link } from 'react-router';
import List from 'material-ui/lib/lists/list';
import ListItem from 'material-ui/lib/lists/list-item';
import Divider from 'material-ui/lib/divider';
import Avatar from 'material-ui/lib/avatar';
import Colors from 'material-ui/lib/styles/colors';
import PlayCircleOutline from 'material-ui/lib/svg-icons/av/play-circle-outline';
export class StreamsUL extends Component {
componentWillMount(){
this.props.getActivePerformances()
}
render () {
if (this.props.presentActiveStreams && this.props.presentActiveStreams.length) {
return(
<div>
<ul className="sidebar-ul-landing">
{this.renderEvents()}
</ul>
</div>
)
} else {
return (
<div>
<span>Stream Yourself!</span>
</div>
)
}
}
renderEvents () {
return this.props.presentActiveStreams.map((performance)=> {
return (
<li className="sidebar-li" key={performance.room} style={{"margin-top": "1em"}}>
<Link to={`/router/activeStream/${performance.room}`} style={{"color": "white"}}>
{performance.title} by {performance.room}
</Link>
</li>
)
})
}
}
function mapStateToProps(state){
return {
presentActiveStreams : state.data.activeStreams
}
}
const mapDispatchToProps = {
getActivePerformances
};
export default connect(mapStateToProps,mapDispatchToProps)(StreamsUL)
|
src/components/TouchableWithoutFeedback.js | lelandrichardson/react-native-mock | /**
* https://github.com/facebook/react-native/blob/master/Libraries/Components/Touchable/TouchableWithoutFeedback.js
*/
import React from 'react';
import EdgeInsetsPropType from '../propTypes/EdgeInsetsPropType';
import View from './View';
const TouchableWithoutFeedback = React.createClass({
propTypes: {
accessible: React.PropTypes.bool,
accessibilityComponentType: React.PropTypes.oneOf(View.AccessibilityComponentType),
accessibilityTraits: React.PropTypes.oneOfType([
React.PropTypes.oneOf(View.AccessibilityTraits),
React.PropTypes.arrayOf(React.PropTypes.oneOf(View.AccessibilityTraits)),
]),
/**
* If true, disable all interactions for this component.
*/
disabled: React.PropTypes.bool,
/**
* Called when the touch is released, but not if cancelled (e.g. by a scroll
* that steals the responder lock).
*/
onPress: React.PropTypes.func,
onPressIn: React.PropTypes.func,
onPressOut: React.PropTypes.func,
/**
* Invoked on mount and layout changes with
*
* `{nativeEvent: {layout: {x, y, width, height}}}`
*/
onLayout: React.PropTypes.func,
onLongPress: React.PropTypes.func,
/**
* Delay in ms, from the start of the touch, before onPressIn is called.
*/
delayPressIn: React.PropTypes.number,
/**
* Delay in ms, from the release of the touch, before onPressOut is called.
*/
delayPressOut: React.PropTypes.number,
/**
* Delay in ms, from onPressIn, before onLongPress is called.
*/
delayLongPress: React.PropTypes.number,
/**
* When the scroll view is disabled, this defines how far your touch may
* move off of the button, before deactivating the button. Once deactivated,
* try moving it back and you'll see that the button is once again
* reactivated! Move it back and forth several times while the scroll view
* is disabled. Ensure you pass in a constant to reduce memory allocations.
*/
pressRetentionOffset: EdgeInsetsPropType,
/**
* This defines how far your touch can start away from the button. This is
* added to `pressRetentionOffset` when moving off of the button.
* ** NOTE **
* The touch area never extends past the parent view bounds and the Z-index
* of sibling views always takes precedence if a touch hits two overlapping
* views.
*/
hitSlop: EdgeInsetsPropType,
},
render() {
return null;
},
});
module.exports = TouchableWithoutFeedback;
|
app/components/Home.js | pyreta/songrider | // @flow
import React, { Component } from 'react';
import { Link } from 'react-router';
import styles from './Home.css';
export default class Home extends Component {
render() {
return (
<div>
<div className={styles.container}>
<h2>Homerr</h2>
<Link to="/counter">to Counter</Link>
</div>
</div>
);
}
}
|
src/index.js | RedZulu/ReduxArt | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import App from './components/app';
import reducers from './reducers';
const createStoreWithMiddleware = applyMiddleware()(createStore);
ReactDOM.render(
<Provider store={createStoreWithMiddleware(reducers)}>
<App />
</Provider>
, document.querySelector('.container'));
|
admin/src/components/AltText.js | ligson/keystone | import React from 'react';
import blacklist from 'blacklist';
import vkey from 'vkey';
var AltText = React.createClass({
getDefaultProps () {
return {
component: 'span',
modifier: '<alt>',
normal: '',
modified: ''
};
},
getInitialState () {
return {
modified: false
};
},
componentDidMount () {
document.body.addEventListener('keydown', this.handleKeyDown, false);
document.body.addEventListener('keyup', this.handleKeyUp, false);
},
componentWillUnmount () {
document.body.removeEventListener('keydown', this.handleKeyDown);
document.body.removeEventListener('keyup', this.handleKeyUp);
},
handleKeyDown (e) {
if (vkey[e.keyCode] !== this.props.modifier) return;
this.setState({
modified: true
});
},
handleKeyUp (e) {
if (vkey[e.keyCode] !== this.props.modifier) return;
this.setState({
modified: false
});
},
render () {
var props = blacklist(this.props, 'component', 'modifier', 'normal', 'modified');
return React.createElement(this.props.component, props, this.state.modified ? this.props.modified : this.props.normal);
}
});
module.exports = AltText;
|
src/timelines/components/card/TootAge.js | algernon/mad-tooter | // @flow
/* The Mad Tooter -- A Mastodon client
* Copyright (C) 2017 Gergely Nagy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react';
import moment from 'moment';
import { withStyles } from 'material-ui/styles';
const styles = theme => ({
tootAge: {
textDecoration: 'none',
color: theme.palette.text.secondary,
'a&:hover': {
textDecoration: 'underline',
},
}
});
class TootAge extends React.Component {
constructor(props) {
super(props);
this.state = {time: props.time,
age: moment(props.time).fromNow()};
}
componentDidMount() {
this.timerID = setInterval(
() => this.tick(),
10000
);
}
componentWillUnmount() {
clearInterval(this.timerID);
}
tick() {
this.setState({age: moment(this.props.time).fromNow()});
}
render() {
if (this.props.href !== null) {
return (
<a href={this.props.href} className={this.props.classes.tootAge}
target="_blank">{this.state.age}</a>
);
} else {
return (
<span className={this.props.classes.tootAge}>{this.state.age}</span>
);
}
}
}
export default withStyles(styles)(TootAge);
|
src/components/MenuBar.js | Journey316/resume | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
class MenuBar extends React.Component {
constructor(props){
super(props);
this.state = {
selected : props.selected || 0
};
this.callHistory = this.callHistory.bind(this);
}
renderOverlay() {
console.log('overlay', this.props.menu);
return (
<div
onClick={this.props.onPressOverlay}
className={this.props.menu === true ? "overlay" : "hide-overlay"}>
</div>
);
}
renderMenu() {
let className = "menu-btn";
if (this.props.menu === true) {
className += " active";
}
return (
<div>
<a onClick={this.props.onPressMenu} className={className}>
<span></span>
</a>
</div>
);
}
callHistory(el, i) {
this.setState({
selected: i
});
}
renderFull() {
return this.props.data.map((el, i) => {
let selected = '';
if(this.state.selected == i) {
selected = 'active';
}
return (
<li key={i} className={selected}>
<Link
to={el.link}
onClick={() => this.callHistory(el, i)}>
{el.title}
</Link>
</li>
)
});
}
renderNav() {
let className = "menu";
if (this.props.menu && this.props.menu === true) {
className += " active";
}
return (
<div className={className}>
{this.renderMenu()}
<ul className="menu-list">
<span className="menu-container">
{this.renderFull()}
</span>
</ul>
</div>
);
}
render() {
return (
<div className="test-overlay">
{this.renderNav()}
{this.renderOverlay()}
</div>
);
}
}
export default MenuBar;
|
server/sonar-web/src/main/js/apps/permission-templates/permission-template.js | vamsirajendra/sonarqube | import _ from 'underscore';
import Backbone from 'backbone';
import React from 'react';
import Defaults from './permission-template-defaults';
import SetDefaults from './permission-template-set-defaults';
import UsersView from './users-view';
import GroupsView from './groups-view';
import UpdateView from './update-view';
import DeleteView from './delete-view';
export default React.createClass({
propTypes: {
permissionTemplate: React.PropTypes.object.isRequired,
topQualifiers: React.PropTypes.array.isRequired,
refresh: React.PropTypes.func.isRequired
},
showGroups(permission, e) {
e.preventDefault();
new GroupsView({
permission: permission,
permissionTemplate: this.props.permissionTemplate,
refresh: this.props.refresh
}).render();
},
showUsers(permission, e) {
e.preventDefault();
new UsersView({
permission: permission,
permissionTemplate: this.props.permissionTemplate,
refresh: this.props.refresh
}).render();
},
onUpdate(e) {
e.preventDefault();
new UpdateView({
model: new Backbone.Model(this.props.permissionTemplate),
refresh: this.props.refresh
}).render();
},
onDelete(e) {
e.preventDefault();
new DeleteView({
model: new Backbone.Model(this.props.permissionTemplate),
refresh: this.props.refresh
}).render();
},
renderAssociation() {
let projectKeyPattern = this.props.permissionTemplate.projectKeyPattern;
if (!projectKeyPattern) {
return null;
}
return <div className="spacer-bottom">Project Key Pattern: <code>{projectKeyPattern}</code></div>;
},
renderDeleteButton() {
if (_.size(this.props.permissionTemplate.defaultFor) > 0) {
return null;
}
return <button onClick={this.onDelete} className="button-red">Delete</button>;
},
render() {
let permissions = this.props.permissionTemplate.permissions.map(p => {
return (
<td key={p.key}>
<table>
<tbody>
<tr>
<td className="spacer-right">Users</td>
<td className="spacer-left bordered-left">{p.usersCount}</td>
<td className="spacer-left">
<a onClick={this.showUsers.bind(this, p)} className="icon-bullet-list" title="Update Users"
data-toggle="tooltip" href="#"></a>
</td>
</tr>
<tr>
<td className="spacer-right">Groups</td>
<td className="spacer-left bordered-left">{p.groupsCount}</td>
<td className="spacer-left">
<a onClick={this.showGroups.bind(this, p)} className="icon-bullet-list" title="Update Users"
data-toggle="tooltip" href="#"></a>
</td>
</tr>
</tbody>
</table>
</td>
);
});
return (
<tr>
<td>
<strong>{this.props.permissionTemplate.name}</strong>
<p className="note little-spacer-top">{this.props.permissionTemplate.description}</p>
</td>
{permissions}
<td className="thin text-right">
{this.renderAssociation()}
<Defaults
permissionTemplate={this.props.permissionTemplate}
topQualifiers={this.props.topQualifiers}/>
<div className="nowrap">
<SetDefaults
permissionTemplate={this.props.permissionTemplate}
topQualifiers={this.props.topQualifiers}
refresh={this.props.refresh}/>
<div className="button-group">
<button onClick={this.onUpdate}>Update</button>
{this.renderDeleteButton()}
</div>
</div>
</td>
</tr>
);
}
});
|
packages/flow-upgrade/src/upgrades/0.53.0/ReactComponentExplicitTypeArgs/__tests__/fixtures/DefaultPropsInferred.js | MichaelDeBoey/flow | // @flow
import React from 'react';
class MyComponent extends React.Component {
static 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 = {};
props: Props;
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
|
jenkins-design-language/src/js/components/material-ui/svg-icons/device/screen-rotation.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const DeviceScreenRotation = (props) => (
<SvgIcon {...props}>
<path d="M16.48 2.52c3.27 1.55 5.61 4.72 5.97 8.48h1.5C23.44 4.84 18.29 0 12 0l-.66.03 3.81 3.81 1.33-1.32zm-6.25-.77c-.59-.59-1.54-.59-2.12 0L1.75 8.11c-.59.59-.59 1.54 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12L10.23 1.75zm4.6 19.44L2.81 9.17l6.36-6.36 12.02 12.02-6.36 6.36zm-7.31.29C4.25 19.94 1.91 16.76 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32z"/>
</SvgIcon>
);
DeviceScreenRotation.displayName = 'DeviceScreenRotation';
DeviceScreenRotation.muiName = 'SvgIcon';
export default DeviceScreenRotation;
|
src/index.js | JimFung/interval | import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { Router, Route, browserHistory, IndexRoute } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import promiseMiddleware from 'redux-promise-middleware';
import thunkMiddleware from 'redux-thunk';
import rootReducers from './reducers/index.js'
import App from './components/App'
import Home from './components/Home'
// Add the reducer to your store on the `routing` key
const store = createStore(rootReducers, {}, applyMiddleware(thunkMiddleware, promiseMiddleware() ));
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store)
const Routes = (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Home}></IndexRoute>
</Route>
</Router>
</Provider>
)
ReactDOM.render(
Routes,
document.getElementById('root')
);
|
src/svg-icons/action/shop.js | mmrtnz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionShop = (props) => (
<SvgIcon {...props}>
<path d="M16 6V4c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H2v13c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6h-6zm-6-2h4v2h-4V4zM9 18V9l7.5 4L9 18z"/>
</SvgIcon>
);
ActionShop = pure(ActionShop);
ActionShop.displayName = 'ActionShop';
ActionShop.muiName = 'SvgIcon';
export default ActionShop;
|
system/src/layouts/containers/HeaderDropdownContainer/index.js | axmatthew/react | /* eslint react/prefer-stateless-function: 0 */
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { List, Map } from 'immutable';
import enquiryModule from '../../../modules/enquiries';
import HeaderDropdown from '../../components/HeaderDropdown';
class HeaderDropdownContainer extends Component {
static propTypes = {
user: React.PropTypes.instanceOf(Map),
enquiries: React.PropTypes.instanceOf(List).isRequired
};
render() {
const { user, enquiries } = this.props;
return React.createElement(HeaderDropdown, {
newEnquiries: user
? enquiries.filter(enquiry => (
enquiry.get('status') === 'New' &&
enquiry.get('sales') === user.get('username')
))
: List()
});
}
}
function mapStateToProps(state) {
return {
user: state.users.getIn(['data', 'user']),
enquiries: state[enquiryModule.entityUrl].getIn(['listView', 'data', 'entities'])
};
}
export default connect(mapStateToProps)(HeaderDropdownContainer);
|
examples/real-world/containers/Root.js | xiamidaxia/redux | import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { Router, Route } from 'react-router';
import configureStore from '../store/configureStore';
import App from './App';
import UserPage from './UserPage';
import RepoPage from './RepoPage';
const store = configureStore();
export default class Root extends Component {
render() {
return (
<div>
<Provider store={store}>
{() =>
<Router history={this.props.history}>
<Route path='/' component={App}>
<Route path='/:login/:name'
component={RepoPage} />
<Route path='/:login'
component={UserPage} />
</Route>
</Router>
}
</Provider>
</div>
);
}
}
|
src/components/layout/Aside.js | dhruv-kumar-jha/productivity-frontend | 'use strict';
import React from 'react';
const AsideLayout = (props) => {
return (
<aside className="default">
{ props.children }
</aside>
);
}
export default AsideLayout;
|
src/components/ShowHeader.js | kiyoshitaro/Instagram- | import React from 'react';
class ShowHeader extends React.Component {
constructor(props) {
super(props);
this.state = {
value: 1
};
}
render() {
return (
<div>
{/*<div className="section section-cards section-gold">*/}
{/*<header className="codrops-header">*/}
{/*<div className="row">*/}
{/*<div className="col-md-4">*/}
{/*<div className="section-description">*/}
{/*<h3 className="title">Beautiful Cards</h3>*/}
{/*<h6 className="category">One Card for Every Problem</h6>*/}
{/*<h5 className="description">We have gone above and beyond with options for you to organise your information. From cards designed for blog posts, to product cards or user profiles, you will have many options to choose from. All the cards follow the Paper Kit style principles and have a design that stands out. </h5>*/}
{/*</div>*/}
{/*</div>*/}
{/*</div>*/}
{/*</header>*/}
{/*<section className="section-intro ">*/}
{/*<div className="isolayer isolayer--deco1 isolayer--shadow " style={{"transform-style": "preserve-3d", transform: "translateX(33vw) translateY(-340px) rotateX(45deg) rotateZ(45deg)"}}>*/}
{/*<ul className="grid grid--loaded" style={{position: "relative", width: "1200px", height: "1110px"}}>*/}
{/*<li className="grid__item first-card" style={{position: "absolute", left: "0px", top: "0px", "z-index":" 1"}}>*/}
{/*<a className="grid__link" href="index.html#cards" style={{"z-index": "1"}}>*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/purple-card.png" alt="01" style={{transform: "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)" }}/>*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item second-card" style={{position: "absolute", left: "400px", top: "0px", "z-index": "1"}}>*/}
{/*<a className="grid__link" href="index.html#cards" style="z-index: 1;">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/twitter-card.jpg" alt="02" style={{transform: "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)"}} />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item third-card" style={{position: "absolute", left: "800px", top: "0px"}}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/facebook-card.jpg" alt="03" />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item fourth-card" style={{position: "absolute", left: "0px" ,top: "300px"}}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/pricing-card.jpg" alt="04" />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item fifth-card" style={{position: "absolute", left: "800px", top: "300px"}}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/blog-card.jpg" alt="05" />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item sixth-card" style={{position: "absolute", left: "400px", top:" 510px" }}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/capture.jpg" alt="06" />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item seventh-card" style={{position: "absolute", left: "0px", top: "600px"}}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/team-card.jpg" alt="07" />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item eight-card" style={{position: "absolute", left: "800px", top: "600px"}}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/testimonal-card.jpg" alt="07" />*/}
{/*</a>*/}
{/*</li>*/}
{/*<li className="grid__item ninth-card" style={{position: "absolute", left: "400px", top: "810px"}}>*/}
{/*<a className="grid__link" href="index.html#cards">*/}
{/*<img className="grid__img layer" src="assets/img/presentation-page/try/pricing-card-icon.jpg" alt="07" />*/}
{/*</a>*/}
{/*</li>*/}
{/*</ul>*/}
{/*</div>*/}
{/*</section>*/}
{/*</div>*/}
<div className="page-header" data-parallax="true"
style={{"background-image": "url(../Girl.jpg)"}}>
<div className="filter"></div>
<div className="content-center">
<div className="container">
<div className="motto">
<div>
<center><h1 className="title"
style={{color: "mediumseagreen", "font-family": "TlwgTypewriter", "font-size": "80px"}}>
Instagram</h1></center>
<br/>
<h3 className="description" style={{color: "mediumseagreen"}}>Start designing your landing page
here.</h3>
<br/>
<br/><br/>
<div>
<center>
<button type="button" className="btn btn-outline-success btn-round" onClick={() => {
this.setState({value: this.state.value + 1});
this.props.getPost(this.state.value);
this.props.isAddHeader();
}}
style={{width: "400px", value: "Readmore..."}}>Go with me ...
</button>
</center>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
export default ShowHeader;
|
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/export-destructuring.input.js | kadirahq/react-storybook | /* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import { storiesOf } from '@storybook/react';
import ComponentRow from './ComponentRow';
import * as SpecRowStories from './SpecRow.stories';
export const { actions } = SpecRowStories;
storiesOf('ComponentRow', module).add('pending', () => (
<ComponentRow snapshots={snapshots.pending} buildNumber={2} {...actions} />
));
|
nlyyAPP/component/ๅพ็็ฎก็ๆจกๅ/ๆจกๅไธไผ /MLMoKuaiNewUpdateList.js | a497500306/nlyy_APP | /**
* Created by Rolle on 2017/5/25.
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
TouchableOpacity,
Platform
} from 'react-native';
var MLNavigatorBar = require('../../MLNavigatorBar/MLNavigatorBar');
var MLTableCell = require('../../MLTableCell/MLTableCell');
var ImagePicker = require('react-native-image-picker');
import ImagePicker1 from 'react-native-image-crop-picker';
import ActionSheet from 'react-native-actionsheet';
var settings = require("../../../settings");
var buttons = ['ๅๆถ', 'ๆ็
ง', '็ธๅไธญ้ๆฉ'];
if (Platform.OS !== 'ios'){
buttons = ['ๅๆถ', '็ธๅไธญ้ๆฉ'];
}
const CANCEL_INDEX = 0;
const DESTRUCTIVE_INDEX = 4;
var friendId = 0;
var seveRowData = {};
var options = {
title: 'Select Avatar',
customButtons: [
{name: 'fb', title: 'Choose Photo from Facebook'},
],
storageOptions: {
skipBackup: true,
path: 'images',
},
mediaType:'photo',
quality:0.4
};
var MLMoKuaiNewUpdateList = React.createClass({
show() {
this.ActionSheet.show();
},
_handlePress(index) {
},
getInitialState() {
//ListView่ฎพ็ฝฎ
var ds = new ListView.DataSource({rowHasChanged:(r1, r2) => r1 !== r2});
return {
tableData:[],
//ListView่ฎพ็ฝฎ
dataSource: ds.cloneWithRows([]),
avatarSource:null
}
},
render() {
// console.log('ๆดๆฐๅฑๆง' + this.props.initialProps.weChatUser + "123")
return (
<View style={styles.container}>
<MLNavigatorBar title={'ๆๆจกๅไธไผ '} isBack={true} newTitle={"plus-circle"} backFunc={() => {
this.props.navigator.pop()
}} newFunc={()=>{
this.show(this)
}} leftTitle={'้ฆ้กต'} leftFunc={()=>{
this.props.navigator.popToRoute(this.props.navigator.getCurrentRoutes()[1])
}}/>
<ListView
dataSource={this.state.dataSource}//ๆฐๆฎๆบ
renderRow={this.renderRow}
/>
<ActionSheet
ref={(o) => this.ActionSheet = o}
title="้ๆฉๆจ็ๆไฝ๏ผ"
options={buttons}
cancelButtonIndex={CANCEL_INDEX}
destructiveButtonIndex={DESTRUCTIVE_INDEX}
onPress={(sss)=>{
this._handlePress(this)
if (sss == 1){//็นๅปไฟฎๆนๅคๆณจ
console.log('็นๅป็ธๆบ');
if (Platform.OS != 'ios'){
console.log('็นๅปๅฎๅ็ธๅ');
ImagePicker1.openPicker({
cropping: false,
multiple: false
}).then(image => {
console.log('ๅพ็ๅฐๅ');
console.log(image.path);
let formData = new FormData();
let file = {uri: image.path, type: 'multipart/form-data', name: 'image.png'};
formData.append("images",file);
fetch(settings.fwqUrl + "/app/imageUpdata",{
method:'POST',
headers:{
'Content-Type':'multipart/form-data',
},
body:formData,
})
.then((response) => response.json())
.then((responseJson) => {
console.log('ๆๅ??');
console.log(responseJson);
})
.catch((error) => {
console.log('้่ฏฏ??');
console.log(error);
});
})
}else {
options.quality = 0.5;
//ๅฏๅจ็ธๆบ๏ผ
ImagePicker.launchCamera(options, (response) => {
if (response.didCancel) {
console.log('User cancelled image picker');
}
else if (response.error) {
console.log('ImagePicker Error: ', response.error);
}
else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
}
else {
let source = {uri: response.uri};
console.log('Response = ', source);
// You can also display the image using data:
// let source = { uri: 'data:image/jpeg;base64,' + response.data };
this.setState({
avatarSource: source
});
}
});
ImagePicker.showImagePicker(options, (response) => {
});
}
}else if (sss == 2){//็นๅปๆฅ็่ตๆ
console.log('็นๅป็ธๅ');
// Open Image Library:
ImagePicker.launchImageLibrary(options, (response) => {
if (response.didCancel) {
console.log('User cancelled image picker');
}
else if (response.error) {
console.log('ImagePicker Error: ', response.error);
}
else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
}
else {
let source = { uri: response.uri };
console.log('็ธๅ = ', source);
// You can also display the image using data:
// let source = { uri: 'data:image/jpeg;base64,' + response.data };
this.setState({
avatarSource: source
});
let formData = new FormData();
let file = {uri: source.uri, type: 'multipart/form-data', name: 'image.png'};
formData.append("images",file);
fetch(settings.fwqUrl + "/app/imageUpdata",{
method:'POST',
headers:{
'Content-Type':'multipart/form-data',
},
body:formData,
})
.then((response) => response.json())
.then((responseJson) => {
console.log('ๆๅ??');
console.log(responseJson);
})
.catch((error) => {
console.log('้่ฏฏ??');
console.log(error);
});
}
});
}
}}
/>
</View>
);
},
//่ฟๅๅ
ทไฝ็cell
renderRow(rowData, sectionID, rowID){
return (
<TouchableOpacity onPress={()=> {
}}>
<MLTableCell title={'ๅพ็' + rowID}/>
</TouchableOpacity>
)
}
})
const styles = StyleSheet.create({
container: {
flex: 1,
// justifyContent: 'center',
// alignItems: 'center',
backgroundColor: 'rgba(233,234,239,1.0)',
},
});
// ่พๅบ็ปไปถ็ฑป
module.exports = MLMoKuaiNewUpdateList; |
examples/src/components/CustomOption.js | pdrko/react-select | import React from 'react';
import Gravatar from 'react-gravatar';
var Option = React.createClass({
propTypes: {
addLabelText: React.PropTypes.string,
className: React.PropTypes.string,
mouseDown: React.PropTypes.func,
mouseEnter: React.PropTypes.func,
mouseLeave: React.PropTypes.func,
option: React.PropTypes.object.isRequired,
renderFunc: React.PropTypes.func
},
render () {
var obj = this.props.option;
var size = 15;
var gravatarStyle = {
borderRadius: 3,
display: 'inline-block',
marginRight: 10,
position: 'relative',
top: -2,
verticalAlign: 'middle',
};
return (
<div className={this.props.className}
onMouseEnter={this.props.mouseEnter}
onMouseLeave={this.props.mouseLeave}
onMouseDown={this.props.mouseDown}
onClick={this.props.mouseDown}>
<Gravatar email={obj.email} size={size} style={gravatarStyle} />
{obj.value}
</div>
);
}
});
module.exports = Option;
|
fields/types/location/LocationColumn.js | riyadhalnur/keystone | import React from 'react';
import ItemsTableCell from '../../../admin/client/components/ItemsTableCell';
import ItemsTableValue from '../../../admin/client/components/ItemsTableValue';
const SUB_FIELDS = ['street1', 'suburb', 'state', 'postcode', 'country'];
var LocationColumn = React.createClass({
displayName: 'LocationColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
},
renderValue () {
let value = this.props.data.fields[this.props.col.path];
if (!value || !Object.keys(value).length) return null;
let output = [];
SUB_FIELDS.map((i) => {
if (value[i]) {
output.push(value[i]);
}
});
return (
<ItemsTableValue field={this.props.col.type} title={output.join(', ')}>
{output.join(', ')}
</ItemsTableValue>
);
},
render () {
return (
<ItemsTableCell>
{this.renderValue()}
</ItemsTableCell>
);
}
});
module.exports = LocationColumn;
|
public/components/Login.js | supportivesantas/project-ipsum | import React from 'react';
import actions from '../actions/ipsumActions.js';
import { connect } from 'react-redux';
import maps from '../mappingFunctions.js';
import NavigationBarLogin from './NavigationBarLogin.js';
import { Grid, Panel, Col, Row, Jumbotron } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
import { Link } from 'react-router';
import Footer from './Footer.js';
var Login = () => {
return (
<div className="outerContainer" >
<Grid fluid className="mainContainer" >
<Row><Col>
<NavigationBarLogin />
</Col></Row>
<Row><Col md={12}>
<Jumbotron className="loginJumbo">
<Row>
<Col xs={12} sm={8}>
<h1> The easiest way to manage all your deployments</h1>
<Link to={'/about'}>Take the tour</Link>
</Col>
</Row>
</Jumbotron>
</Col></Row>
<Row><Col md={12}>
<div className='layout-middle'>
<div className='layout-middle-img-cover' style={{backgroundImage: 'url(assets/img/using-phone.jpg)'}}></div>
<div className='layout-middle-text'>
<h1> <small> Control</small> </h1>
<h3> The freedom to let go </h3>
<p>Manage all your deployment servers in one place. Heroku, Digital Ocean, AWS, and Azure supported</p>
</div>
</div>
</Col></Row>
<Row><Col md={12}>
<div className='layout-middle flip'>
<div className='layout-middle-img-cover' style={{backgroundImage: 'url(assets/img/servers.jpg)'}}></div>
<div className='layout-middle-text'>
<h1> <small> Trust</small> </h1>
<h3> A robust service at your disposal </h3>
<p>Add our proprietary middleware to your applications, and watch the data flow!</p>
</div>
</div>
</Col></Row>
<Row><Col md={12}>
<div className='layout-middle'>
<div className='layout-middle-img-cover' style={{backgroundImage: 'url(assets/img/woman.jpg)'}}>
</div>
<div className='layout-middle-text'>
<h1> <small>Insight</small> </h1>
<h3> Data you can depend on </h3>
<p>Get real time data on all your servers, applications, and even individual API endpoints!</p>
</div>
</div>
</Col></Row>
</Grid>
<Footer />
</div>
)
}
Login = connect(state => ({ state: state }))(Login);
export default Login;
|
src/js/components/success/Success.component.js | katie-day/we_do | import React from 'react';
import Header from '../common/header/Header.component';
import { getWindowHeight } from '../../utils';
const Success = () => {
const windowHeight = getWindowHeight();
const guest = {};
const style = {
minHeight: windowHeight - 50,
};
return (
<div>
<Header guest={guest} />
<div className="welcome u-text-center t-plum" style={style}>
<div className="welcome__background" />
<div className="gutters welcome__table-cell">
<h4 className="u-current-text-color">
Thanks for your rsvp
</h4>
</div>
</div>
</div>
);
};
export default Success;
|
app/javascript/mastodon/features/home_timeline/index.js | robotstart/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 '../ui/components/column';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnSettingsContainer from './containers/column_settings_container';
import { Link } from 'react-router';
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' }
});
const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0,
hasFollows: state.getIn(['accounts_counters', state.getIn(['meta', 'me']), 'following_count']) > 0
});
class HomeTimeline extends React.PureComponent {
render () {
const { intl, hasUnread, hasFollows } = this.props;
let emptyMessage;
if (hasFollows) {
emptyMessage = <FormattedMessage id='empty_column.home.inactivity' defaultMessage="Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon." />
} else {
emptyMessage = <FormattedMessage id='empty_column.home' defaultMessage="You aren't following anyone yet. Visit {public} or use search to get started and meet other users." values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />;
}
return (
<Column icon='home' active={hasUnread} heading={intl.formatMessage(messages.title)}>
<ColumnSettingsContainer />
<StatusListContainer
{...this.props}
scrollKey='home_timeline'
type='home'
emptyMessage={emptyMessage}
/>
</Column>
);
}
}
HomeTimeline.propTypes = {
intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool,
hasFollows: PropTypes.bool
};
export default connect(mapStateToProps)(injectIntl(HomeTimeline));
|
App/containers/DayThreeScreen/MeScreen.js | carney520/30-days-of-react-native | // @flow
import React from 'react'
import {Text} from 'react-native'
import TabbarIcon from './components/TabbarIcon'
export default class MeScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Me',
icon: ({tintColor}) => <TabbarIcon name="user" color={tintColor} />
}
}
render () {
return (<Text>MeScreen</Text>)
}
}
|
node_modules/react-bootstrap/es/Form.js | caughtclean/but-thats-wrong-blog | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import elementType from 'react-prop-types/lib/elementType';
import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
var propTypes = {
horizontal: React.PropTypes.bool,
inline: React.PropTypes.bool,
componentClass: elementType
};
var defaultProps = {
horizontal: false,
inline: false,
componentClass: 'form'
};
var Form = function (_React$Component) {
_inherits(Form, _React$Component);
function Form() {
_classCallCheck(this, Form);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Form.prototype.render = function render() {
var _props = this.props,
horizontal = _props.horizontal,
inline = _props.inline,
Component = _props.componentClass,
className = _props.className,
props = _objectWithoutProperties(_props, ['horizontal', 'inline', 'componentClass', 'className']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var classes = [];
if (horizontal) {
classes.push(prefix(bsProps, 'horizontal'));
}
if (inline) {
classes.push(prefix(bsProps, 'inline'));
}
return React.createElement(Component, _extends({}, elementProps, {
className: classNames(className, classes)
}));
};
return Form;
}(React.Component);
Form.propTypes = propTypes;
Form.defaultProps = defaultProps;
export default bsClass('form', Form); |
example/js/main.js | shirou/goagen_js | import React from 'react';
import * as api from "./api_request.js";
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createStore, combineReducers} from 'redux';
import {reducer as reduxFormReducer} from 'redux-form';
import { Values } from 'redux-form-website-template';
const dest = document.getElementById('content');
const reducer = combineReducers({
form: reduxFormReducer // mounted under "form"
});
const store = (createStore)(reducer);
const showResults = (values) => {
api.UserCreate(values).then((result) =>{
if (result.status !== 200){
throw new Error('invalid paramater');
}
alert("OK!")
}).catch((error) => {
alert(error.message)
});
};
const FieldLevelValidationForm = require('./components/FieldLevelValidationForm').default;
ReactDOM.render(
<Provider store={store}>
<div>
<h2>Form</h2>
<FieldLevelValidationForm onSubmit={showResults} />
<Values form="fieldLevelValidation" />
</div>
</Provider>,
dest
);
|
src/app/components/Layout.js | Dynamit/healthcare-microsite | /**
* Master layout
* @description Layout wrapper. Used only in prerender. Client-side app renders on `document.body`
*/
import React from 'react';
class Layout extends React.Component {
constructor(props) {
super(props);
// improved async Typekit loading https://goo.gl/t1jDL8
let kitId = 'omf4gip';
this.loadFonts = `!function(e){var t=3e3;window.sessionStorage&&"false"===sessionStorage.getItem("useTypekit")&&(t=0);var s,a={kitId:'${kitId}',scriptTimeout:t},i=e.documentElement,o=setTimeout(function(){i.className=i.className.replace(/\bwf-loading\b/g,"")+"wf-inactive",window.sessionStorage&&sessionStorage.setItem("useTypekit","false")},a.scriptTimeout),n=e.createElement("script"),c=!1,r=e.getElementsByTagName("script")[0];i.className+="wf-loading",n.src="//use.typekit.net/"+a.kitId+".js",n.async=!0,n.onload=n.onreadystatechange=function(){if(s=this.readyState,!(c||s&&"complete"!=s&&"loaded"!=s)){c=!0,clearTimeout(o);try{Typekit.load(a)}catch(e){}}},r.parentNode.insertBefore(n,r)}(document);`;
this.GA = `
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-23605672-3', 'auto');
`;
}
/**
* Convert a string returned by react-helmet to React DOM
* @param {String} str react-helmet `meta` or `link` value from `rewind()`
* @return {Array} Array of React components
*/
_helmetToComponent(str) {
// stop if str is empty
if (!str.length) {
return;
}
// an array of React components
let Components = [];
// react-helmet returns a line-break delimited list of tags
// split so we can deal with each individually
str.split(/\n/).forEach((node, i) => {
// extrapolate node type
let nodeType = str.match(/[a-z]+/)[0];
// container for props
let props = {
key: i
};
// match attr="value" pattern
// store props
node.match(/([a-z\-]+=".*?")/g).forEach((attr) => {
let matches = attr.match(/([a-z\-]+)="(.*?)"/);
props[matches[1]] = matches[2];
});
// create and save the component
Components.push(React.createElement(nodeType, props));
});
// return the array of components
return Components;
}
render() {
let meta = this._helmetToComponent(this.props.head.meta);
let link = this._helmetToComponent(this.props.head.link);
return (
<html lang="en">
<head>
<title>{this.props.head.title}</title>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{meta}
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/assets/styles/main.css" />
{link}
<script src="http://use.typekit.net/omf4gip.js"></script>
<script dangerouslySetInnerHTML={{__html: this.loadFonts}}></script>
<script dangerouslySetInnerHTML={{__html: this.GA }}></script>
</head>
<body dangerouslySetInnerHTML={{ __html: this.props.markup }} />
<script src="/assets/scripts/main.js" async></script>
</html>
);
}
};
export default Layout;
|
src/components/ResourceGroup/index.js | DeveloperLaPoste/protagonist-react | import PropTypes from 'prop-types';
import React from 'react';
import { ResourceGroupTitle, Description, Resources } from '../';
export default function ResourceGroup({ resourceGroup }) {
const resources = resourceGroup.resources ? (
<div className="ResourceGroup-content">
<Resources resources={resourceGroup.resources} />
</div>
) : <div className="ResourceGroup-noContent" />;
return (
<div className="ResourceGroup-main">
<ResourceGroupTitle title={resourceGroup.name} />
<Description description={resourceGroup.description} />
{resources}
</div>
);
}
ResourceGroup.propTypes = {
resourceGroup: PropTypes.shape({
name: PropTypes.string,
description: PropTypes.string,
resources: PropTypes.array,
}),
};
ResourceGroup.defaultProps = {
resourceGroup: {},
};
|
examples/todomvc/index.js | chrisege/redux | import React from 'react';
import App from './containers/App';
import 'todomvc-app-css/index.css';
React.render(
<App />,
document.getElementById('root')
);
|
src/index.js | shonmacray/Showcase | import React from 'react';
import ReactDOM from 'react-dom';
import Mainlayout from './Showcase/index';
import registerServiceWorker from './registerServiceWorker';
import './index.css';
import './abc.css';
ReactDOM.render(<Mainlayout />, document.getElementById('root'));
registerServiceWorker();
|
packages/es-components/src/components/controls/buttons/OutlineButton.js | jrios/es-components | import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { useTheme } from '../../util/useTheme';
const StyledButton = styled.button`
background-color: ${props => props.variant.bgColor};
border: 2px solid ${props => props.variant.borderColor};
border-radius: ${props => props.buttonSize.borderRadius};
box-sizing: border-box;
color: ${props => props.variant.textColor};
cursor: pointer;
display: block;
font-family: inherit;
font-size: ${props => props.buttonSize.fontSize};
font-weight: ${props => props.buttonSize.fontWeight || 'normal'};
line-height: ${props =>
props.buttonSize.lineHeight || props.theme.sizes.baseLineHeight};
min-width: 100px;
outline: none;
padding-bottom: ${props => props.buttonSize.paddingBottom};
padding-left: ${props => props.buttonSize.paddingSides};
padding-right: ${props => props.buttonSize.paddingSides};
padding-top: ${props => props.buttonSize.paddingTop};
text-align: center;
text-decoration: none;
text-transform: ${props =>
props.buttonSize.textTransform ? props.buttonSize.textTransform : 'none'};
transition: background-color 150ms linear, color 150ms linear;
white-space: nowrap;
width: 100%;
@media (min-width: ${props => props.theme.screenSize.tablet}) {
display: ${props => (props.block ? 'block' : 'inline-block')};
width: ${props => (props.block ? '100%' : 'auto')};
}
&:focus,
&:focus-within {
box-shadow: 0 0 3px 3px ${props => props.theme.colors.inputFocus};
}
&:hover {
background-color: ${props => props.variant.hoverBgColor};
color: ${props => props.variant.hoverTextColor};
}
&:active {
background-color: ${props => props.variant.activeBgColor};
color: ${props => props.variant.activeTextColor};
}
&[disabled] {
cursor: not-allowed;
opacity: 0.65;
> * {
pointer-events: none;
}
}
&[disabled]:hover {
color: ${props => props.variant.textColor};
background-color: ${props => props.variant.bgColor};
}
`;
const OutlineButton = React.forwardRef(function OutlineButton(props, ref) {
const { children, styleType, size, block, ...other } = props;
const theme = useTheme();
const buttonSize = theme.buttonStyles.outlineButton.size[size];
const variant = theme.buttonStyles.outlineButton.variant[styleType];
return (
<StyledButton
ref={ref}
block={block}
buttonSize={buttonSize}
variant={variant}
type="button"
{...other}
>
{children}
</StyledButton>
);
});
OutlineButton.propTypes = {
children: PropTypes.node.isRequired,
/** Select the color style of the button, types come from theme buttonStyles.outlineButton */
styleType: PropTypes.string,
size: PropTypes.oneOf(['lg', 'default', 'sm', 'xs']),
/** Make the button's width the size of it's parent container */
block: PropTypes.bool
};
OutlineButton.defaultProps = {
styleType: 'default',
block: false,
size: 'default'
};
export default OutlineButton;
|
_deprecated/src/components/Home.js | paigekehoe/paigekehoe.github.io | import React from 'react';
import Interactive from 'react-interactive';
import { Link } from 'react-router-dom';
import { Code } from '../styles/style';
import s from '../styles/home.style';
export default function Home() {
const repoReadmeLink = text => (
<Interactive
as="a"
{...s.link}
href="https://github.com/paigekehoe/paigekehoe.github.io#readme"
>{text}</Interactive>
);
return (
<div>
<p style={s.p}>
Welcome to my little site - a work in progress.
Come back soon!
</p>
</div>
);
}
|
src/components/UsernameForm/TimeMessage/index.js | jenkoian/hacktoberfest-checker | import React from 'react';
import getTimeMessage from './getTimeMessage';
const TimeMessage = () => (
<p className="text-center light-mode:text-hack-dark-title pb-2">
{getTimeMessage()}
</p>
);
export default TimeMessage;
|
client/scripts/components/config/disclosure-requirements/disclosure-requirements/index.js | kuali/research-coi | /*
The Conflict of Interest (COI) module of Kuali Research
Copyright ยฉ 2005-2016 Kuali, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
import styles from './style';
import React from 'react';
import Panel from '../../panel';
import ConfigActions from '../../../../actions/config-actions';
import CheckBox from '../../check-box';
import ActiveProjectType from '../active-project-type';
import InactiveProjectType from '../inactive-project-type';
import {BlueButton} from '../../../blue-button';
import ConfiguringPanel from '../configuring-panel';
import ConfigPage from '../../config-page';
export default class DisclosureRequirements extends React.Component {
constructor() {
super();
this.toggleSelectingProjectTypes = this.toggleSelectingProjectTypes.bind(this);
}
toggleSelectingProjectTypes() {
ConfigActions.toggle('applicationState.selectingProjectTypes');
}
render() {
const {configState} = this.context;
let projectTypesPanel;
if (
configState.config &&
configState.config.projectTypes &&
!configState.applicationState.configuringProjectType
) {
const projectsRequiringDisclosure = configState.config.projectTypes.filter(projectType => {
return projectType.reqDisclosure === 1;
});
if (configState.applicationState.selectingProjectTypes) {
const projectTypes = configState.config.projectTypes.map((projectType, index) => {
return (
<span key={projectType.typeCd} className={styles.checkbox}>
<CheckBox
path={`config.projectTypes[${index}].reqDisclosure`}
checked={projectType.reqDisclosure === 1}
label={projectType.description}
/>
</span>
);
});
let doneButton;
if (projectsRequiringDisclosure.length > 0) {
doneButton = (
<BlueButton onClick={this.toggleSelectingProjectTypes}>DONE</BlueButton>
);
}
projectTypesPanel = (
<div>
<div className={styles.title}>
Choose from the project types below <br />
which require the completion of a COI disclosure
</div>
<Panel>
{projectTypes}
<div style={{textAlign: 'center'}}>
{doneButton}
</div>
</Panel>
</div>
);
} else {
const activeProjectTypes = projectsRequiringDisclosure.map(projectType => {
return (
<ActiveProjectType
{...projectType}
key={projectType.typeCd}
configure={ConfigActions.configureProjectType}
/>
);
});
const inactiveProjectTypes = configState.config.projectTypes.filter(projectType => {
return Number(projectType.reqDisclosure) === 0;
})
.map(projectType => {
return (
<InactiveProjectType
{...projectType}
key={projectType.typeCd}
/>
);
});
projectTypesPanel = (
<div>
<div className={styles.title}>
The project types below require the completion of a COI disclosure.<br />
<a className={styles.link} onClick={this.toggleSelectingProjectTypes}>Click here to edit these project types</a>
</div>
<div>
<div style={{marginBottom: '50px'}}>
<div className={styles.activeHeader}>
ACTIVE
</div>
{activeProjectTypes}
</div>
<div>
<div className={styles.activeHeader} style={{marginBottom: '15px'}}>
NOT ACTIVE
</div>
{inactiveProjectTypes}
</div>
</div>
</div>
);
}
}
let configuringPanel;
if (configState.applicationState.configuringProjectType) {
configuringPanel = (
<ConfiguringPanel
projectType={configState.applicationState.configuringProjectType}
roles={configState.config.projectRoles}
statuses={configState.config.projectStatuses}
/>
);
}
return (
<ConfigPage
title='Disclosure Requirements'
routeName='disclosure-requirements'
dirty={configState.dirty}
className={this.props.className}
>
{projectTypesPanel}
{configuringPanel}
</ConfigPage>
);
}
}
DisclosureRequirements.contextTypes = {
configState: React.PropTypes.object
}; |
week02-rest-basics/client/src/App.js | kajayr/isit322-leosinani-2017 | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import 'whatwg-fetch';
class App extends Component {
constructor() {
super();
this.state = {
file: 'Get Nine Result will be placed here.',
foo: 'waiting for express server'
};
}
bar = () => {
// this.setState({foo: 'Clicked the express succesfully'});
//this.setState({file: 'The results have been placed'});
const that = this;
fetch('/api/foo')
.then(function(response) {
return response.json();
}).then(function(json) {
console.log('parsed json', json);
that.setState(foo => (json));
}).catch(function(ex) {
console.log('parsing failed', ex);
});
};
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
state.foo: {this.state.foo}
</p>
<p className="App-intro">
state.file: {this.state.file}
</p>
<button onClick={this.bar}> Click me </button>
</div>
);
}
}
export default App;
|
src/svg-icons/device/devices.js | matthewoates/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceDevices = (props) => (
<SvgIcon {...props}>
<path d="M4 6h18V4H4c-1.1 0-2 .9-2 2v11H0v3h14v-3H4V6zm19 2h-6c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1zm-1 9h-4v-7h4v7z"/>
</SvgIcon>
);
DeviceDevices = pure(DeviceDevices);
DeviceDevices.displayName = 'DeviceDevices';
DeviceDevices.muiName = 'SvgIcon';
export default DeviceDevices;
|
blueprints/view/files/__root__/views/__name__View/__name__View.js | availabs/kauffman-atlas | import React from 'react'
type Props = {
};
export class <%= pascalEntityName %> extends React.Component {
props: Props;
render () {
return (
<div></div>
)
}
}
export default <%= pascalEntityName %>
|
src/components/NotFoundPage/NotFoundPage.js | phoenixbox/vesty-fe | /*
* React.js Starter Kit
* Copyright (c) 2014 Konstantin Tarkus (@koistya), KriaSoft LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
'use strict';
//require('./NotFoundPage.less');
import React from 'react';
export default React.createClass({
render() {
return (
<div>
<h1>Page Not Found</h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
</div>
);
}
});
|
client/node_modules/react-router/es6/IndexLink.js | Discounty/Discounty | 'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
import React, { Component } from 'react';
import Link from './Link';
/**
* An <IndexLink> is used to link to an <IndexRoute>.
*/
var IndexLink = (function (_Component) {
_inherits(IndexLink, _Component);
function IndexLink() {
_classCallCheck(this, IndexLink);
_Component.apply(this, arguments);
}
IndexLink.prototype.render = function render() {
return React.createElement(Link, _extends({}, this.props, { onlyActiveOnIndex: true }));
};
return IndexLink;
})(Component);
export default IndexLink; |
app/javascript/mastodon/features/compose/components/compose_form.js | esetomo/mastodon | import React from 'react';
import CharacterCounter from './character_counter';
import Button from '../../../components/button';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ReplyIndicatorContainer from '../containers/reply_indicator_container';
import AutosuggestTextarea from '../../../components/autosuggest_textarea';
import UploadButtonContainer from '../containers/upload_button_container';
import { defineMessages, injectIntl } from 'react-intl';
import Collapsable from '../../../components/collapsable';
import SpoilerButtonContainer from '../containers/spoiler_button_container';
import PrivacyDropdownContainer from '../containers/privacy_dropdown_container';
import SensitiveButtonContainer from '../containers/sensitive_button_container';
import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
import UploadFormContainer from '../containers/upload_form_container';
import WarningContainer from '../containers/warning_container';
import { isMobile } from '../../../is_mobile';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { length } from 'stringz';
import { countableText } from '../util/counter';
const messages = defineMessages({
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' },
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
publish: { id: 'compose_form.publish', defaultMessage: 'Toot' },
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
});
@injectIntl
export default class ComposeForm extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
text: PropTypes.string.isRequired,
suggestion_token: PropTypes.string,
suggestions: ImmutablePropTypes.list,
spoiler: PropTypes.bool,
privacy: PropTypes.string,
spoiler_text: PropTypes.string,
focusDate: PropTypes.instanceOf(Date),
preselectDate: PropTypes.instanceOf(Date),
is_submitting: PropTypes.bool,
is_uploading: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onClearSuggestions: PropTypes.func.isRequired,
onFetchSuggestions: PropTypes.func.isRequired,
onSuggestionSelected: PropTypes.func.isRequired,
onChangeSpoilerText: PropTypes.func.isRequired,
onPaste: PropTypes.func.isRequired,
onPickEmoji: PropTypes.func.isRequired,
showSearch: PropTypes.bool,
};
static defaultProps = {
showSearch: false,
};
handleChange = (e) => {
this.props.onChange(e.target.value);
}
handleKeyDown = (e) => {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
this.handleSubmit();
}
}
handleSubmit = () => {
if (this.props.text !== this.autosuggestTextarea.textarea.value) {
// Something changed the text inside the textarea (e.g. browser extensions like Grammarly)
// Update the state to match the current text
this.props.onChange(this.autosuggestTextarea.textarea.value);
}
this.props.onSubmit();
}
onSuggestionsClearRequested = () => {
this.props.onClearSuggestions();
}
onSuggestionsFetchRequested = (token) => {
this.props.onFetchSuggestions(token);
}
onSuggestionSelected = (tokenStart, token, value) => {
this._restoreCaret = null;
this.props.onSuggestionSelected(tokenStart, token, value);
}
handleChangeSpoilerText = (e) => {
this.props.onChangeSpoilerText(e.target.value);
}
componentWillReceiveProps (nextProps) {
// If this is the update where we've finished uploading,
// save the last caret position so we can restore it below!
if (!nextProps.is_uploading && this.props.is_uploading) {
this._restoreCaret = this.autosuggestTextarea.textarea.selectionStart;
}
}
componentDidUpdate (prevProps) {
// This statement does several things:
// - If we're beginning a reply, and,
// - Replying to zero or one users, places the cursor at the end of the textbox.
// - Replying to more than one user, selects any usernames past the first;
// this provides a convenient shortcut to drop everyone else from the conversation.
// - If we've just finished uploading an image, and have a saved caret position,
// restores the cursor to that position after the text changes!
if (this.props.focusDate !== prevProps.focusDate || (prevProps.is_uploading && !this.props.is_uploading && typeof this._restoreCaret === 'number')) {
let selectionEnd, selectionStart;
if (this.props.preselectDate !== prevProps.preselectDate) {
selectionEnd = this.props.text.length;
selectionStart = this.props.text.search(/\s/) + 1;
} else if (typeof this._restoreCaret === 'number') {
selectionStart = this._restoreCaret;
selectionEnd = this._restoreCaret;
} else {
selectionEnd = this.props.text.length;
selectionStart = selectionEnd;
}
this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd);
this.autosuggestTextarea.textarea.focus();
} else if(prevProps.is_submitting && !this.props.is_submitting) {
this.autosuggestTextarea.textarea.focus();
}
}
setAutosuggestTextarea = (c) => {
this.autosuggestTextarea = c;
}
handleEmojiPick = (data) => {
const position = this.autosuggestTextarea.textarea.selectionStart;
const emojiChar = data.native;
this._restoreCaret = position + emojiChar.length + 1;
this.props.onPickEmoji(position, data);
}
render () {
const { intl, onPaste, showSearch } = this.props;
const disabled = this.props.is_submitting;
const text = [this.props.spoiler_text, countableText(this.props.text)].join('');
let publishText = '';
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
publishText = <span className='compose-form__publish-private'><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>;
} else {
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
}
return (
<div className='compose-form'>
<Collapsable isVisible={this.props.spoiler} fullHeight={50}>
<div className='spoiler-input'>
<label>
<span style={{ display: 'none' }}>{intl.formatMessage(messages.spoiler_placeholder)}</span>
<input placeholder={intl.formatMessage(messages.spoiler_placeholder)} value={this.props.spoiler_text} onChange={this.handleChangeSpoilerText} onKeyDown={this.handleKeyDown} type='text' className='spoiler-input__input' id='cw-spoiler-input' />
</label>
</div>
</Collapsable>
<WarningContainer />
<ReplyIndicatorContainer />
<div className='compose-form__autosuggest-wrapper'>
<AutosuggestTextarea
ref={this.setAutosuggestTextarea}
placeholder={intl.formatMessage(messages.placeholder)}
disabled={disabled}
value={this.props.text}
onChange={this.handleChange}
suggestions={this.props.suggestions}
onKeyDown={this.handleKeyDown}
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
onSuggestionSelected={this.onSuggestionSelected}
onPaste={onPaste}
autoFocus={!showSearch && !isMobile(window.innerWidth)}
/>
<EmojiPickerDropdown onPickEmoji={this.handleEmojiPick} />
</div>
<div className='compose-form__modifiers'>
<UploadFormContainer />
</div>
<div className='compose-form__buttons-wrapper'>
<div className='compose-form__buttons'>
<UploadButtonContainer />
<PrivacyDropdownContainer />
<SensitiveButtonContainer />
<SpoilerButtonContainer />
</div>
<div className='compose-form__publish'>
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
<div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block /></div>
</div>
</div>
</div>
);
}
}
|
components/Entry.js | nikhilsaraf/react-native-todo-app | /**
* @flow
*/
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import PropTypes from 'prop-types';
import { Icon } from 'react-native-elements';
import Box from './Box';
class Entry extends React.Component {
render() {
return (
<Box
style={styles.box}
numberOfLines={this.props.numberOfLines}
>
<Text
style={styles.text}
numberOfLines={this.props.numberOfLines}
ellipsizeMode='tail'
>
{this.props.text}
</Text>
<Icon
style={styles.icon}
name={this.props.icon1}
raised={true}
color='#000'
size={20}
underlayColor='transparent'
onPress={this.props.onPressIcon1}
/>
<Icon
style={styles.icon}
name={this.props.icon2}
raised={true}
color='#000'
size={20}
underlayColor='transparent'
onPress={this.props.onPressIcon2}
/>
</Box>
);
}
}
Entry.propTypes = {
text: PropTypes.string.isRequired,
numberOfLines: PropTypes.number.isRequired,
icon1: PropTypes.string.isRequired,
icon2: PropTypes.string.isRequired,
onPressIcon1: PropTypes.func.isRequired,
onPressIcon2: PropTypes.func.isRequired
};
const styles = StyleSheet.create({
box: {
flexDirection: 'row',
alignItems: 'center',
},
text: {
flex: 10,
paddingTop: 6,
paddingBottom: 2,
paddingLeft: 6,
paddingRight: 2,
color: '#000',
alignItems: 'center',
justifyContent: 'center',
fontSize: 16,
fontFamily: 'Helvetica',
},
icon: {
flex: 1,
paddingTop: 4,
paddingRight: 2,
},
});
export default Entry; |
src/components/Login/Login.js | nambawan/g-old | /* eslint-disable react/destructuring-assignment */
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { defineMessages, FormattedMessage } from 'react-intl';
import { login } from '../../actions/session';
import { getAccountUpdates } from '../../reducers';
import Link from '../Link';
import Button from '../Button';
import Box from '../Box';
import FormField from '../FormField';
import {
createValidator,
passwordValidation,
emailValidation,
} from '../../core/validation';
const messages = defineMessages({
email: {
id: 'label.email',
defaultMessage: 'Email',
description: 'Heading of email section',
},
password: {
id: 'label.password',
defaultMessage: 'Password',
description: 'Heading of password section',
},
resetPassword: {
id: 'login.resetPassword',
defaultMessage: 'Forgot your password?',
description: 'Help for password',
},
empty: {
id: 'form.error-empty',
defaultMessage: "You can't leave this empty",
description: 'Help for empty fields',
},
invalidEmail: {
id: 'form.error-invalidEmail',
defaultMessage: 'Your email address seems to be invalid',
description: 'Help for email',
},
error: {
id: 'login.error',
defaultMessage: 'Login attempt failed',
description: 'Failed login',
},
login: {
id: 'label.login',
defaultMessage: 'Log In',
description: 'Label login',
},
});
class Login extends React.Component {
static propTypes = {
status: PropTypes.shape({
login: PropTypes.shape({
error: PropTypes.bool,
success: PropTypes.bool,
pending: PropTypes.bool,
}),
}).isRequired,
login: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.onSubmit = this.onSubmit.bind(this);
this.handleLogin = this.handleLogin.bind(this);
this.onEmailChange = this.onEmailChange.bind(this);
this.onPasswordChange = this.onPasswordChange.bind(this);
this.state = {
email: '',
password: '',
errors: { email: {}, password: {} },
};
const testValues = {
password: { fn: 'password' },
email: { fn: 'email' },
};
this.Validator = createValidator(
testValues,
{
password: passwordValidation,
email: emailValidation,
},
this,
obj => obj.state,
);
}
componentWillReceiveProps(nextProps) {
if (
nextProps.status &&
nextProps.status.login &&
nextProps.status.login.error
) {
this.setState({ password: '' });
}
}
onEmailChange(e) {
this.setState({ email: e.target.value });
}
onPasswordChange(e) {
this.setState({ password: e.target.value });
}
onSubmit(e) {
/* prevent the default form-submit action */
e.preventDefault();
this.handleLogin();
/* apparently this is needed with some browsers to prevent the submit action */
return false;
}
handleLogin() {
const validated = this.Validator(['password', 'email']);
this.setState(prevState => ({
errors: { ...prevState.errors, ...validated.errors },
}));
if (!validated.failed) {
this.props.login({
email: this.state.email.trim(),
password: this.state.password.trim(),
});
}
}
render() {
const { status } = this.props;
const { errors, password, email } = this.state;
/* if (status.login && status.login.success) {
// / history.push('/private');
} */
const emailError = errors.email.errorName ? (
<FormattedMessage {...messages[errors.email.errorName]} />
) : null;
const passwordError = errors.password.errorName ? (
<FormattedMessage {...messages[errors.password.errorName]} />
) : null;
const loginError =
status.login && status.login.error ? (
<div style={{ backgroundColor: 'rgba(255, 50, 77,0.3)' }}>
<FormattedMessage {...messages.error} />
</div>
) : null;
return (
<Box column pad>
<form onSubmit={this.onSubmit}>
{/* invisible submit button */}
<input type="submit" style={{ display: 'none' }} />
<fieldset>
<FormField
label={<FormattedMessage {...messages.email} />}
error={emailError}
>
<input
name="email"
type="text"
value={email}
onChange={this.onEmailChange}
/>
</FormField>
<FormField
label={<FormattedMessage {...messages.password} />}
error={passwordError}
>
<input
name="password"
type="password"
value={password}
onChange={this.onPasswordChange}
/>
</FormField>
{loginError}
</fieldset>
</form>
<Button
fill
primary
label={<FormattedMessage {...messages.login} />}
onClick={this.handleLogin}
disabled={status.login && status.login.pending}
/>
{/* eslint-disable */}
<Link to="/account/password/reset">
{/* eslint-enable */}
<FormattedMessage {...messages.resetPassword} />
</Link>
</Box>
);
}
}
const mapStateToProps = state => {
const initialId = '0000';
return {
status: getAccountUpdates(state, initialId),
};
};
const mapDispatch = {
login,
};
export default connect(
mapStateToProps,
mapDispatch,
)(Login);
|
src/components/Seo.js | rhostem/blog | import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby'
import { concat, not, isEmpty, filter, includes, isNil, compose } from 'ramda'
import { PROFILE_IMAGE } from 'src/constants'
export const DEFAULT_KEYWORDS = ['์น ๊ฐ๋ฐ', 'Front-end', 'ํ๋ก ํธ์๋']
function SEO({ title, description, keywords = [], meta = [], lang }) {
return (
<StaticQuery
query={detailsQuery}
render={data => {
const metaDescription =
description || data.site.siteMetadata.description
const siteTitle = data.site.siteMetadata.title
let metaTags = [
{ name: `description`, content: metaDescription },
{ property: `og:url`, content: 'https://blog.rhostem.com' },
{ property: `og:type`, content: 'website' },
{ property: `og:title`, content: title },
{ property: `og:description`, content: metaDescription },
{ property: `og:image`, content: PROFILE_IMAGE },
{ name: `twitter:card`, content: `summary_large_image` },
{ name: `twitter:creator`, content: data.site.siteMetadata.author },
{ name: `twitter:title`, content: title },
{ name: `twitter:description`, content: metaDescription },
{ name: `twitter:image`, content: PROFILE_IMAGE },
]
// ํค์๋ ์ถ๊ฐ
if (keywords && !isEmpty(keywords)) {
metaTags.push({
name: `keywords`,
content: keywords.concat(DEFAULT_KEYWORDS).join(`, `),
})
} else {
metaTags.push({
name: 'keywords',
content: DEFAULT_KEYWORDS.join(', '),
})
}
// SEO ์ปดํฌ๋ํธ์ ์ง์ ์ ๋ฌ๋ฐ์ ๋ฉํ ํ๊ทธ๋ ์ค๋ณต์ ์ ๊ฑฐํ๊ณ ์ถ๊ฐํ๋ค.
if (meta.length > 0) {
const metaNamesToAdd = meta
.map(m => m.name)
.filter(
compose(
not,
isNil
)
)
metaTags = concat(
// metaTags์์ SEO ์ปดํฌ๋ํธ์ ์ง์ ์ ๋ฌ๋
filter(currentMeta =>
not(includes(currentMeta.name, metaNamesToAdd))
)(metaTags),
meta
)
}
return (
<Helmet
htmlAttributes={{
lang: 'ko',
}}
title={title || siteTitle}
titleTemplate={title ? `%s | ${siteTitle}` : ''}
meta={metaTags}
/>
)
}}
/>
)
}
SEO.defaultProps = {
lang: `ko`,
meta: [],
keywords: [],
}
SEO.propTypes = {
description: PropTypes.string,
lang: PropTypes.string,
meta: PropTypes.array,
keywords: PropTypes.arrayOf(PropTypes.string),
title: PropTypes.string,
}
export default SEO
const detailsQuery = graphql`
query DefaultSEOQuery {
site {
siteMetadata {
title
description
author
}
}
}
`
|
fields/components/DateInput.js | lastjune/keystone | import moment from 'moment';
import DayPicker from 'react-day-picker';
import React from 'react';
import Popout from '../../admin/src/components/Popout';
import { FormInput } from 'elemental';
function isSameDay(d1, d2) {
d1.setHours(0, 0, 0, 0);
d2.setHours(0, 0, 0, 0);
return d1.getTime() === d2.getTime();
}
module.exports = React.createClass({
displayName: 'DateInput',
// set default properties
getDefaultProps () {
return {
format: 'YYYY-MM-DD'
};
},
getInitialState () {
return {
selectedDay: new Date(),
id: Math.round(Math.random() * 100000),
pickerIsOpen: false
};
},
// componentWillReceiveProps: function(newProps) {
// console.log(moment(newProps.value).format("ddd MMMM DD YYYY hh:mm:ss a Z"));
// if (newProps.value === this.state.selectedDay) return;
// this.setState({
// selectedDay: moment(newProps.value).format("ddd MMMM DD YYYY hh:mm:ss a Z")
// });
// },
handleChange (e, day) {
this.setState({
selectedDay: day
}, () => {
setTimeout(() => {
this.setState({
pickerIsOpen: false
});
}, 200);
});
},
handleFocus (e) {
this.setState({
pickerIsOpen: true
});
},
handleBlur (e) {
},
render () {
let { selectedDay } = this.state;
let modifiers = {
'selected': (day) => isSameDay(selectedDay, day)
};
return (
<div>
<FormInput
autoComplete="off"
id={this.state.id}
name={this.props.name}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
onChange={this.handleChange}
placeholder={this.props.format}
value={moment(selectedDay).format(this.props.format)} />
<Popout
isOpen={this.state.pickerIsOpen}
onCancel={() => this.setState({ pickerIsOpen: false })}
relativeToID={this.state.id}
width={260}>
<DayPicker
modifiers={ modifiers }
onDayClick={ this.handleChange }
style={{ marginBottom: 9 }}
tabIndex={-1} />
</Popout>
</div>
);
// return <FormInput name={this.props.name} value={this.state.value} placeholder={this.props.format} onChange={this.handleChange} onBlur={this.handleBlur} autoComplete="off" />;
}
});
|
q-a11y-training-demo/src/components/person/achievements/Achievements.js | AlmeroSteyn/Q-A11y-Training | import React from 'react';
const Achievements = () => <div>Achievements page</div>;
export default Achievements;
|
node_modules/react-error-overlay/lib/index.js | lujinming1/hejicaoye | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import CompileErrorContainer from './containers/CompileErrorContainer';
import RuntimeErrorContainer from './containers/RuntimeErrorContainer';
import { listenToRuntimeErrors } from './listenToRuntimeErrors';
import { iframeStyle, overlayStyle } from './styles';
import { applyStyles } from './utils/dom/css';
var iframe = null;
var isLoadingIframe = false;
var renderedElement = null;
var currentBuildError = null;
var currentRuntimeErrorRecords = [];
var currentRuntimeErrorOptions = null;
var stopListeningToRuntimeErrors = null;
export function reportBuildError(error) {
currentBuildError = error;
update();
}
export function dismissBuildError() {
currentBuildError = null;
update();
}
export function startReportingRuntimeErrors(options) {
if (stopListeningToRuntimeErrors !== null) {
throw new Error('Already listening');
}
currentRuntimeErrorOptions = options;
listenToRuntimeErrors(function (errorRecord) {
try {
if (typeof options.onError === 'function') {
options.onError.call(null);
}
} finally {
handleRuntimeError(errorRecord);
}
}, options.filename);
}
function handleRuntimeError(errorRecord) {
if (currentRuntimeErrorRecords.some(function (_ref) {
var error = _ref.error;
return error === errorRecord.error;
})) {
// Deduplicate identical errors.
// This fixes https://github.com/facebookincubator/create-react-app/issues/3011.
return;
}
currentRuntimeErrorRecords = currentRuntimeErrorRecords.concat([errorRecord]);
update();
}
function dismissRuntimeErrors() {
currentRuntimeErrorRecords = [];
update();
}
export function stopReportingRuntimeErrors() {
if (stopListeningToRuntimeErrors === null) {
throw new Error('Not currently listening');
}
currentRuntimeErrorOptions = null;
try {
stopListeningToRuntimeErrors();
} finally {
stopListeningToRuntimeErrors = null;
}
}
function update() {
renderedElement = render();
// Loading iframe can be either sync or async depending on the browser.
if (isLoadingIframe) {
// Iframe is loading.
// First render will happen soon--don't need to do anything.
return;
}
if (iframe) {
// Iframe has already loaded.
// Just update it.
updateIframeContent();
return;
}
// We need to schedule the first render.
isLoadingIframe = true;
var loadingIframe = window.document.createElement('iframe');
applyStyles(loadingIframe, iframeStyle);
loadingIframe.onload = function () {
var iframeDocument = loadingIframe.contentDocument;
if (iframeDocument != null && iframeDocument.body != null) {
iframeDocument.body.style.margin = '0';
// Keep popup within body boundaries for iOS Safari
iframeDocument.body.style['max-width'] = '100vw';
var iframeRoot = iframeDocument.createElement('div');
applyStyles(iframeRoot, overlayStyle);
iframeDocument.body.appendChild(iframeRoot);
// Ready! Now we can update the UI.
iframe = loadingIframe;
isLoadingIframe = false;
updateIframeContent();
}
};
var appDocument = window.document;
appDocument.body.appendChild(loadingIframe);
}
function render() {
if (currentBuildError) {
return React.createElement(CompileErrorContainer, { error: currentBuildError });
}
if (currentRuntimeErrorRecords.length > 0) {
if (!currentRuntimeErrorOptions) {
throw new Error('Expected options to be injected.');
}
return React.createElement(RuntimeErrorContainer, {
errorRecords: currentRuntimeErrorRecords,
close: dismissRuntimeErrors,
launchEditorEndpoint: currentRuntimeErrorOptions.launchEditorEndpoint
});
}
return null;
}
function updateIframeContent() {
if (iframe === null) {
throw new Error('Iframe has not been created yet.');
}
var iframeBody = iframe.contentDocument.body;
if (!iframeBody) {
throw new Error('Expected iframe to have a body.');
}
var iframeRoot = iframeBody.firstChild;
if (renderedElement === null) {
// Destroy iframe and force it to be recreated on next error
window.document.body.removeChild(iframe);
ReactDOM.unmountComponentAtNode(iframeRoot);
iframe = null;
return;
}
// Update the overlay
ReactDOM.render(renderedElement, iframeRoot);
} |
src/ThreadView.js | drop-table-ryhmatyo/tekislauta-front | import React, { Component } from 'react';
import Helmet from 'react-helmet';
import Post, { OriginalPost } from './Post';
import SubmitForm from './SubmitForm';
import Endpoints from './Endpoints';
var self;
class ThreadView extends Component {
constructor(props) {
super(props);
this.state = { title: "Loading..." };
}
componentDidMount() { this.fetchPosts(); }
render() {
self = this;
let posts = [];
if (this.state && this.state.posts && this.state.posts.length >= 0) {
posts.push(<OriginalPost data={this.state.posts[0]} key={this.state.posts[0].id} board={this.props.params.board} onReplyClicked={d => this.handleReplyClick(d)} />);
for (let i = 1; i < this.state.posts.length; i++) {
const t = this.state.posts[i];
posts.push(<Post data={t} key={t.id} board={this.props.abbreviation} onReplyClicked={d => this.handleReplyClick(d)} />);
}
}
return (
<div className='Thread'>
<Helmet title={this.state.title}/>
<div className='SubmitFormBox'>
<SubmitForm title="Submit new reply" submit={this.submitResponse.bind(this)} callback={inst => self.submitForm = inst} />
</div>
<div>
{posts}
</div>
<p>
{posts.length === 1 ? 'No replies' : ''}
</p>
</div>
);
}
handleReplyClick(postId) {
self.submitForm.setMessageBoxVal('>> ' + postId);
}
fetchPosts() {
Endpoints.Replies(this.props.params.board, this.props.params.thread).getData()
.then(data => {
const opMsg = data[0].message;
const truncatedMsg = opMsg.length > 32 ? opMsg.substr(0, 32-3) + "..." : opMsg;
this.setState({
posts: data,
title: `/${this.props.params.board}/ - ${truncatedMsg}`
});
})
.catch(err => console.error("ThreadView::fetchPots", "Error while getting posts!", err));
}
submitResponse(formData) {
Endpoints.Replies(this.props.params.board, this.props.params.thread).postData(formData)
.then(data => {
console.log("ThreadView::submitResponse", "Submitted new post!", data);
window.location.reload();
})
.catch(err => {
console.log("ThreadView::submitResponse", "Error while submitting new post!", err);
});
}
}
export default ThreadView; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.