path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
src/SparklinesBars.js
konsumer/react-sparklines
import React from 'react'; export default class SparklinesBars extends React.Component { static propTypes = { style: React.PropTypes.object }; static defaultProps = { style: { fill: 'slategray' } }; render() { const { points, width, height, margin, style } = this.props; const barWidth = points.length >= 2 ? points[1].x - points[0].x : 0; return ( <g> {points.map((p, i) => <rect key={i} x={p.x} y={p.y} width={barWidth} height={height - p.y} style={style} /> )} </g> ) } }
app/javascript/mastodon/features/compose/components/upload_button.js
cybrespace/mastodon
import React from 'react'; import IconButton from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; const messages = defineMessages({ upload: { id: 'upload_button.label', defaultMessage: 'Add media (JPEG, PNG, GIF, WebM, MP4, MOV)' }, }); const makeMapStateToProps = () => { const mapStateToProps = state => ({ acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']), }); return mapStateToProps; }; const iconStyle = { height: null, lineHeight: '27px', }; export default @connect(makeMapStateToProps) @injectIntl class UploadButton extends ImmutablePureComponent { static propTypes = { disabled: PropTypes.bool, onSelectFile: PropTypes.func.isRequired, style: PropTypes.object, resetFileKey: PropTypes.number, acceptContentTypes: ImmutablePropTypes.listOf(PropTypes.string).isRequired, intl: PropTypes.object.isRequired, }; handleChange = (e) => { if (e.target.files.length > 0) { this.props.onSelectFile(e.target.files); } } handleClick = () => { this.fileElement.click(); } setRef = (c) => { this.fileElement = c; } render () { const { intl, resetFileKey, disabled, acceptContentTypes } = this.props; return ( <div className='compose-form__upload-button'> <IconButton icon='camera' title={intl.formatMessage(messages.upload)} disabled={disabled} onClick={this.handleClick} className='compose-form__upload-button-icon' size={18} inverted style={iconStyle} /> <label> <span style={{ display: 'none' }}>{intl.formatMessage(messages.upload)}</span> <input key={resetFileKey} ref={this.setRef} type='file' multiple={false} accept={acceptContentTypes.toArray().join(',')} onChange={this.handleChange} disabled={disabled} style={{ display: 'none' }} /> </label> </div> ); } }
src/components/account/recover-password-page/index.js
datea/datea-webapp-react
import React from 'react'; import Button from '@material-ui/core/Button'; import {Tr, translatable} from '../../../i18n'; import {observer, inject} from 'mobx-react'; import AccountFormContainer from '../account-form-container'; import TextField from '@material-ui/core/TextField'; import DIcon from '../../../icons'; import './recover-password.scss'; @inject('store') @translatable @observer export default class RecoverPasswordPage extends React.Component { render() { const form = this.props.store.recoverPassView; return ( <AccountFormContainer className="recover-password-page"> {!form.success && <div> <div className="account-form-header with-icon"> <DIcon name="daterito6" /> <h3 className="title"><Tr id="RECOVER_PASSWORD.PAGE_TITLE" /></h3> </div> <div className="recover-password-content"> <div className="info-text"><Tr id="RECOVER_PASSWORD.INFO_TEXT" /></div> {!!form.error && <div className="error-msg"><Tr id={form.error} /></div> } <div className="form"> <div className="input-row"> <TextField name="email" required className="email-field" fullWidth={true} label={<Tr id="LOGIN_PAGE.EMAIL_PH" />} onChange={ev => form.setEmail(ev.target.value)} value={form.email} /> </div> <div className="form-btns"> <Button variant="raised" color="primary" type="submit" onClick={form.submit} disabled={!form.isValid}> <Tr id="SUBMIT" /> </Button> </div> </div> </div> </div> } {form.success && <div> <div className="account-form-header with-icon"> <DIcon name="daterito2" /> <h3 className="title"><Tr id="ACCOUNT_MSG.PASS_RESET_SENT_TITLE" /></h3> </div> <div className="recover-password-content reset-success"> <div className="info-text"><Tr id="ACCOUNT_MSG.PASS_RESET_SENT" /></div> <div className="info-text"><Tr id="ACCOUNT_MSG.CLOSE_TAB" /></div> <div className="form-btns"> <Button variant="raised" color="primary" onClick={form.resubmit}> <Tr id="RESUBMIT" /> </Button> </div> {form.resubmitted && <div className="resubmit-success green-text"><Tr id="ACCOUNT_MSG.PASS_RESET_RESENT" /></div> } {!!form.error && <div className="error-msg"><Tr id={form.error} /></div> } </div> </div> } </AccountFormContainer> ) } }
packages/bonde-admin/src/components/data-grid/hocs/col-hoc.js
ourcities/rebu-client
import React from 'react' import classnames from 'classnames' export default (WrappedComponent) => { return class PP extends React.Component { render () { const colProps = { className: classnames('flex-auto', this.props.className) } return ( <WrappedComponent {...this.props} {...colProps} /> ) } } }
app/containers/EditUserProfile.js
alexko13/block-and-frame
import React from 'react'; import userHelpers from '../utils/userHelpers'; import authHelpers from '../utils/authHelpers'; import MenuBar from '../components/MenuBar'; import UserProfileForm from '../components/users/UserProfileForm'; import ImageUpload from '../components/users/Uploader'; import EditSuccess from '../components/users/EditSuccess'; // TODO: Confirm profile deletion, msg about success, redirect user to home. class UserProfile extends React.Component { constructor(props) { super(props); this.state = { email: '', username: '', bio: '', location: '', isTraveling: null, sucess: false, instagram: '', instagramProfilePic: '', }; this.onNameChange = this.onNameChange.bind(this); this.onEmailChange = this.onEmailChange.bind(this); this.onLocationChange = this.onLocationChange.bind(this); this.onLocationSelect = this.onLocationSelect.bind(this); this.onBioChange = this.onBioChange.bind(this); this.onTravelingChange = this.onTravelingChange.bind(this); this.handleProfileSubmit = this.handleProfileSubmit.bind(this); this.handleDeleteUser = this.handleDeleteUser.bind(this); this.preventDefaultSubmit = this.preventDefaultSubmit.bind(this); } componentDidMount() { userHelpers.getCurrentUserData() .then((user) => { console.log('user in comp did mount', user.data); this.setState({ email: user.data.email, username: user.data.username, bio: user.data.bio, location: user.data.location, isTraveling: user.data.is_traveling, avatarId: user.data.avatar_id, instagramProfilePic: user.data.instagram_profile_pic, instagram: user.data.instagram_username, }); }); } onNameChange(e) { this.setState({ username: e.target.value }); } onEmailChange(e) { this.setState({ email: e.target.value }); } onLocationChange(value) { this.setState({ location: value }); } onLocationSelect(location) { this.setState({ location: location.label }); } onBioChange(e) { this.setState({ bio: e.target.value }); } onTravelingChange(e) { this.setState({ isTraveling: e.target.checked }); } handleProfileSubmit() { userHelpers.updateUser(this.state) .then((user) => { console.log(user); this.setState({ success: true, duplicateEmail: false, }); }) .catch((err) => { if (err.data.constraint === 'users_email_unique') { this.setState({ success: false, duplicateEmail: true, }); } console.log(err); }); } handleDeleteUser() { userHelpers.deleteUser(). then((info) => { console.log(info); authHelpers.logout(); this.context.router.push('/signup'); }) .catch((err) => { console.log(err); }); } preventDefaultSubmit(e) { e.preventDefault(); } render() { return ( <div> <MenuBar /> <div className="ui container top-margin-bit"> <h1 className="ui dividing header" id="editprofileheader"> Edit Profile: </h1> </div> <div className="ui raised text container segment"> <div className="ui container centered"> <ImageUpload avatarId={this.state.avatarId} instagramProfilePic={this.state.instagramProfilePic} /> <UserProfileForm username={this.state.username} email={this.state.email} location={this.state.location} bio={this.state.bio} isTraveling={this.state.isTraveling} onNameChange={this.onNameChange} onEmailChange={this.onEmailChange} onLocationChange={this.onLocationChange} onLocationSelect={this.onLocationSelect} onBioChange={this.onBioChange} onTravelingChange={this.onTravelingChange} onDeleteUser={this.handleDeleteUser} onProfileSubmit={this.handleProfileSubmit} preventDefaultSubmit={this.preventDefaultSubmit} /> <EditSuccess success={this.state.success} duplicateEmail={this.state.duplicateEmail} /> </div> </div> </div> ); } } UserProfile.contextTypes = { router: React.PropTypes.object.isRequired, }; export default UserProfile;
src/components/App.js
jozanza/pixels
import React from 'react'; import { compose, mapProps, withHandlers, withState } from 'recompose'; import styled, { ThemeProvider } from 'styled-components'; import * as actionCreators from '../actionCreators'; import ArtboardSection from './ArtboardSection'; import ToolbarSection from './ToolbarSection'; import MenuWrapper from './MenuWrapper'; import ToolMenu from './ToolMenu'; import LayersMenu from './LayersMenu'; import DocumentMenu from './DocumentMenu'; import PreviewMenu from './PreviewMenu'; import theme from '../theme'; import { toDataURI } from '../utils'; const transformProps = props => { return { ...props, selectedTool: { name: props.tool, ...props.toolbar[props.tool] } }; }; const enhance = compose( mapProps(transformProps), withState('bottomMenuHeight', 'setBottomMenuHeight', '25vh'), withHandlers(actionCreators) ); export default enhance(props => ( <ThemeProvider theme={theme}> <main> <ArtboardSection {...props} /> <ToolbarSection {...props}> <ToolMenu active={props.panel === 'tool'} {...props} /> <LayersMenu active={props.panel === 'layers'} {...props} /> <PreviewMenu active={props.panel === 'preview'} {...props} /> {/* <DocumentMenu active={props.panel === 'document'} {...props} /> */} </ToolbarSection> </main> </ThemeProvider> ));
packages/fyndiq-ui-test/stories/component-modal.js
fyndiq/fyndiq-ui
import React from 'react' import { storiesOf, action } from '@storybook/react' import Button from 'fyndiq-component-button' import Modal, { ModalButton, confirm, Confirm, ConfirmWrapper, } from 'fyndiq-component-modal' import { Warning } from 'fyndiq-icons' import './component-modal.css' storiesOf('Modal', module) .addWithInfo('default', () => <ModalButton>Content</ModalButton>) .addWithInfo('custom modal styles', () => ( <ModalButton button="Open Custom Modal"> <Modal overlayClassName="test-overlay--red" wrapperClassName="test-wrapper--black" > Content with black background on a red transparent overlay </Modal> </ModalButton> )) .addWithInfo('custom button', () => ( <ModalButton button={<Button type="primary">Open Modal</Button>}> Content </ModalButton> )) .addWithInfo('custom close button', () => ( <ModalButton> <Modal> {({ onClose }) => <button onClick={onClose}>Close modal</button>} </Modal> </ModalButton> )) .addWithInfo('forced modal', () => ( <ModalButton button="Open forced modal"> <Modal forced> {({ onClose }) => ( <div style={{ padding: 20 }}> You cannot close me by clicking outside or pressing ESC. The only way to close me is to use a custom close button.<br /> <button onClick={onClose}>Close modal</button> </div> )} </Modal> </ModalButton> )) .addWithInfo('confirm dialog', () => ( <React.Fragment> <ConfirmWrapper /> <Button onClick={async () => { const validate = await confirm( <Confirm type="warning" icon={<Warning />} title="Do you really want to delete that thing?" message="If you delete it, there is no way back" validateButton="Delete" />, ) if (validate) { action('validated')() } else { action('not validated')() } }} > Delete something </Button> </React.Fragment> ))
packages/material-ui-icons/src/SettingsInputAntenna.js
AndriusBil/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let SettingsInputAntenna = props => <SvgIcon {...props}> <path d="M12 5c-3.87 0-7 3.13-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.87-3.13-7-7-7zm1 9.29c.88-.39 1.5-1.26 1.5-2.29 0-1.38-1.12-2.5-2.5-2.5S9.5 10.62 9.5 12c0 1.02.62 1.9 1.5 2.29v3.3L7.59 21 9 22.41l3-3 3 3L16.41 21 13 17.59v-3.3zM12 1C5.93 1 1 5.93 1 12h2c0-4.97 4.03-9 9-9s9 4.03 9 9h2c0-6.07-4.93-11-11-11z" /> </SvgIcon>; SettingsInputAntenna = pure(SettingsInputAntenna); SettingsInputAntenna.muiName = 'SvgIcon'; export default SettingsInputAntenna;
src/NodeInputListItem.js
falcon-client/hawk
import React from 'react'; export default class NodeInputListItem extends React.Component { constructor(props) { super(props); this.state = { hover: false }; } onMouseUp(e) { e.stopPropagation(); e.preventDefault(); this.props.onMouseUp(this.props.index); } onMouseOver() { this.setState({ hover: true }); } onMouseOut() { this.setState({ hover: false }); } noop(e) { e.stopPropagation(); e.preventDefault(); } render() { const { name } = this.props.item; const { hover } = this.state; return ( <li> <a onClick={e => this.noop(e)} onMouseUp={e => this.onMouseUp(e)} href="#" > <i className={hover ? 'fa fa-circle-o hover' : 'fa fa-circle-o'} onMouseOver={() => { this.onMouseOver(); }} onMouseOut={() => { this.onMouseOut(); }} /> {name} </a> </li> ); } }
src/containers/Asians/TabControls/BreakCategorySettings/BreakCategoryRounds/index.js
westoncolemanl/tabbr-web
import React from 'react' import { connect } from 'react-redux' import CreateRounds from './CreateRounds' import ViewRounds from './ViewRounds' export default connect(mapStateToProps)(({ breakCategory, breakRounds, disabled }) => { const filterBreakRounds = breakRoundToMatch => breakRoundToMatch.breakCategory === breakCategory._id const breakRoundsThisBreakCategory = breakRounds.filter(filterBreakRounds) if (breakRoundsThisBreakCategory.length === 0) { return <CreateRounds breakCategory={breakCategory} /> } else { return <ViewRounds breakCategory={breakCategory} disabled={disabled} /> } }) function mapStateToProps (state, ownProps) { return { tournament: state.tournaments.current.data, breakRounds: Object.values(state.breakRounds.data) } }
stories/list/index.js
shulie/dh-component
import React from 'react'; import { storiesOf, action, linkTo } from '@kadira/storybook'; import withReadme from 'storybook-readme/with-readme'; import { List, Menu, Dropdown, Icon, Avatar} from '../../src'; import listReadme from './list.md'; const addWithInfoOptions = { inline: true, propTables: false }; const menu = ( <Menu> <Menu.Item> <span>菜单1</span> </Menu.Item> <Menu.Item> <span>菜单2</span> </Menu.Item> </Menu> ); const suffix = ( <Dropdown overlay={menu} trigger="click"> <Icon type="list-circle"/> </Dropdown> ); storiesOf('列表组件', module) .addDecorator(withReadme(listReadme)) .addWithInfo('默认列表', () => ( <List mode="only" itemClassName="wjb-" itemStyles={{color: 'red'}}> <List.Item key="1" onClick={action('onClick')}> 我是默认列表 </List.Item> <List.Item key="2" onClick={action('onClick')}> 我是默认列表 </List.Item> <List.Item key="3" onClick={action('onClick')}> 我是默认列表 </List.Item> </List> ), addWithInfoOptions) .addWithInfo('单行选择', () => ( <List mode="only" selectedKeys={['1']} onChange={action('onChange')}> <List.Item key="1"> 我可以被操作选择</List.Item> <List.Item key="2"> 我可以被操作选择</List.Item> <List.Item key="3"> 我可以被操作选择</List.Item> </List> ), addWithInfoOptions) .addWithInfo('单行选择不可变', () => ( <List mode="only" immutable icon onChange={action('onChange')}> <List.Item key="1"> 我可以被操作选择, 但是不可变</List.Item> <List.Item key="2"> 我可以被操作选择, 但是不可变</List.Item> <List.Item key="3"> 我可以被操作选择, 但是不可变</List.Item> </List> ), addWithInfoOptions) .addWithInfo('多行选择', () => ( <List mode="multiple" icon onChange={action('onChange')}> <List.Item key="1"> 来点我一下</List.Item> <List.Item key="2"> 来点我一下</List.Item> <List.Item key="3"> 来点我一下</List.Item> </List> ), addWithInfoOptions) .addWithInfo('前缀图标', () => ( <List> <List.Item key="1" prefix={<Avatar />}>Avatar的前置图标</List.Item> <List.Item key="2" prefix={<Avatar src="http://7xr8fr.com1.z0.glb.clouddn.com/IMG_2197.JPG"/>} > Avatar用户传入图片 </List.Item> <List.Item key="3" prefix={<Avatar>OK</Avatar>} > Avatar自定义中间元素 </List.Item> <List.Item key="4" prefix={<Avatar radius={false}>中国</Avatar>} > 我是方形的前置元素 </List.Item> </List> ), addWithInfoOptions) .addWithInfo('后缀图标', () => ( <List> <List.Item key="1" suffix={suffix}> Avatar用户传入图片</List.Item> <List.Item key="2" suffix={suffix}> Avatar用户传入图片</List.Item> <List.Item key="3" suffix={suffix}> Avatar用户传入图片</List.Item> <List.Item key="4" suffix={suffix}> Avatar用户传入图片</List.Item> <List.Item key="5" suffix={suffix}> Avatar用户传入图片</List.Item> </List> ), addWithInfoOptions)
frontend/src/components/eois/modals/withdrawApplication/withdrawApplicationForm.js
unicef/un-partner-portal
import React from 'react'; import { reduxForm } from 'redux-form'; import PropTypes from 'prop-types'; import { withStyles } from 'material-ui/styles'; import TextFieldForm from '../../../forms/textFieldForm'; const messages = { label: 'Justification', placeholder: 'Provide justification of retraction', }; const styleSheet = () => ({ spread: { minWidth: 500, }, }); const WithdrawAward = (props) => { const { classes, handleSubmit } = props; return ( <form onSubmit={handleSubmit}> <TextFieldForm className={classes.spread} label={messages.label} placeholder={messages.placeholder} fieldName="withdraw_reason" textFieldProps={{ multiline: true, InputProps: { inputProps: { maxLength: '5000', }, }, }} /> </form > ); }; WithdrawAward.propTypes = { /** * callback for form submit */ handleSubmit: PropTypes.func.isRequired, classes: PropTypes.object, }; const formWithdrawAward = reduxForm({ form: 'withdrawApplication', })(WithdrawAward); export default withStyles(styleSheet)(formWithdrawAward);
packages/components/src/Actions/ActionFile/File.stories.js
Talend/ui
import React from 'react'; import { action } from '@storybook/addon-actions'; import Action from '../Action'; const myAction = { label: 'Click me', 'data-feature': 'actionfile', icon: 'talend-upload', onChange: action('You changed me'), displayMode: 'file', }; export default { title: 'Buttons/File', decorators: [story => <div className="col-lg-offset-2 col-lg-8">{story()}</div>], }; export const Default = () => ( <div> <p>By default :</p> <Action id="default" {...myAction} /> <p>With hideLabel option</p> <Action id="hidelabel" {...myAction} hideLabel /> <p>In progress</p> <Action id="inprogress" {...myAction} inProgress /> <p>Disabled</p> <Action id="disabled" {...myAction} disabled /> <p>Reverse display</p> <Action id="reverseDisplay" {...myAction} iconPosition="right" /> <p>Transform icon</p> <Action id="reverseDisplay" {...myAction} iconTransform="rotate-180" /> <p>Custom tooltip</p> <Action id="default" {...myAction} tooltipLabel="Custom label here" /> <p>Bootstrap style</p> <Action id="default" {...myAction} bsStyle="primary" tooltipLabel="Custom label here" /> <Action id="default" {...myAction} className="btn-default btn-inverse" tooltipLabel="Custom label here" /> </div> );
client/accept-invite/controller.js
ironmanLee/my_calypso
/** * External Dependencies */ import React from 'react'; /** * Internal Dependencies */ import i18n from 'lib/mixins/i18n'; import titleActions from 'lib/screen-title/actions'; import Main from './main'; export default { acceptInvite( context ) { titleActions.setTitle( i18n.translate( 'Accept Invite', { textOnly: true } ) ); React.unmountComponentAtNode( document.getElementById( 'secondary' ) ); React.render( React.createElement( Main, context.params ), document.getElementById( 'primary' ) ); } };
src/svg-icons/action/settings-cell.js
pomerantsev/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionSettingsCell = (props) => ( <SvgIcon {...props}> <path d="M7 24h2v-2H7v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zM16 .01L8 0C6.9 0 6 .9 6 2v16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V2c0-1.1-.9-1.99-2-1.99zM16 16H8V4h8v12z"/> </SvgIcon> ); ActionSettingsCell = pure(ActionSettingsCell); ActionSettingsCell.displayName = 'ActionSettingsCell'; ActionSettingsCell.muiName = 'SvgIcon'; export default ActionSettingsCell;
gatsby-strapi-tutorial/cms/admin/admin/src/containers/HomePage/BlockLink.js
strapi/strapi-examples
/** * * BlockLink */ import React from 'react'; import { FormattedMessage } from 'react-intl'; import cn from 'classnames'; import PropTypes from 'prop-types'; import styles from './styles.scss'; function BlockLink({ content, isDocumentation, link, title }) { return ( <a className={cn( styles.blockLink, isDocumentation ? styles.blockLinkDocumentation : styles.blockLinkCode, )} href={link} target="_blank" > <FormattedMessage {...title} /> <FormattedMessage {...content}>{message => <p>{message}</p>}</FormattedMessage> </a> ); } BlockLink.propTypes = { content: PropTypes.object.isRequired, isDocumentation: PropTypes.bool.isRequired, link: PropTypes.string.isRequired, title: PropTypes.object.isRequired, }; export default BlockLink;
src/components/Counter/Counter.js
murrayjbrown/react-redux-rxjs-stampit-babylon-universal
import React from 'react'; import classes from './Counter.scss'; export const Counter = (props) => ( <div> <h2 className={classes.counterContainer}> Counter: {' '} <span className={classes['counter--green']}> {props.counter} </span> </h2> <button className="btn btn-default" onClick={props.increment}> Increment </button> {' '} <button className="btn btn-default" onClick={props.doubleAsync}> Double (Async) </button> </div> ); Counter.propTypes = { counter: React.PropTypes.number.isRequired, doubleAsync: React.PropTypes.func.isRequired, increment: React.PropTypes.func.isRequired }; export default Counter;
src/components/Box/Tools.js
falmar/react-adm-lte
import React from 'react' import PropTypes from 'prop-types' const Body = ({children}) => { return ( <div className='box-tools'> {children} </div> ) } Body.propTypes = { children: PropTypes.node } export default Body
src/components/Newsletter/index.js
fathomlondon/fathomlondon.github.io
import React from 'react'; export function Newsletter() { return ( <section className="newsletter bg-black white pt3 pt5-m"> <div id="mc_embed_signup" className="grid"> <div className="grid-item w-10 push-1"> <h3 className="f2">Our newsletter</h3> </div> <form className="grid-item w-10 push-1 validate justify-end" action="//fathomlondon.us16.list-manage.com/subscribe/post?u=9e5fce7688712fa6bf674d034&amp;id=adf3cf97ef" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" target="_blank" > <div id="mc_embed_signup_scroll"> <div className="mc-field-group"> <label htmlFor="mce-EMAIL" className="label light-grey"> Email Address </label> <input type="email" required placeholder="[email protected]" name="EMAIL" className="required email" id="mce-EMAIL" /> </div> <div id="mce-responses" className="clear"> <div className="response" id="mce-error-response" style={{ display: 'none' }} /> <div className="response" id="mce-success-response" style={{ display: 'none' }} /> </div> {/* real people should not fill this in and expect good things - do not remove this or risk form bot signups */} <div style={{ position: 'absolute', left: '-5000px' }} hidden> <input type="text" name="b_9e5fce7688712fa6bf674d034_adf3cf97ef" tabIndex="-1" /> </div> <div className="flex justify-end"> <input type="submit" value="Subscribe" name="subscribe" title="Subscribe" aria-label="Subscribe" id="mc-embedded-subscribe" className="button mt1 hover-bg-white hover-black" /> </div> </div> </form> </div> </section> ); }
src/components/common/Image.js
jaggerwang/zqc-app-demo
/** * 在球场 * zaiqiuchang.com */ import React from 'react' import {StyleSheet, View, Image, TouchableOpacity} from 'react-native' import flattenStyle from 'flattenStyle' import {COLOR} from '../../config' import * as helpers from '../../helpers' import * as components from '../' export default ({playIconVisible = false, duration, onPress, containerStyle, style, playIconStyle, ...props}) => { let child = <Image style={style} {...props} /> if (onPress) { let {width, height} = flattenStyle(style) let {fontSize} = flattenStyle([styles.playIcon, playIconStyle]) let left = Math.floor((width - fontSize) / 2) let top = Math.floor((height - fontSize) / 2) return ( <TouchableOpacity onPress={onPress} style={containerStyle}> {child} {playIconVisible ? <components.Icon name='play-circle-outline' style={[styles.playIcon, playIconStyle, {top, left}]} /> : null} {duration ? <components.Text style={styles.durationText}> {helpers.durationText(duration)} </components.Text> : null} </TouchableOpacity> ) } else { return ( <View style={containerStyle}> {child} </View> ) } } const styles = StyleSheet.create({ playIcon: { position: 'absolute', top: 0, left: 0, color: COLOR.textLightNormal, opacity: 0.8, backgroundColor: 'transparent', fontSize: 36 }, durationText: { position: 'absolute', bottom: 0, right: 0, color: COLOR.textLightNormal, fontSize: 12, padding: 5 } })
react/gameday2/components/embeds/EmbedDacast.js
fangeugene/the-blue-alliance
import React from 'react' import { webcastPropType } from '../../utils/webcastUtils' const EmbedDacast = (props) => { const channel = props.webcast.channel const file = props.webcast.file const iframeSrc = `https://iframe.dacast.com/b/${channel}/c/${file}` return ( <iframe src={iframeSrc} width="100%" height="100%" frameBorder="0" scrolling="no" player="vjs5" autoPlay="true" allowFullScreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen /> ) } EmbedDacast.propTypes = { webcast: webcastPropType.isRequired, } export default EmbedDacast
app/components/CompareImages.js
Kamahl19/image-min-app
import React from 'react'; export default React.createClass({ displayName: 'CompareImages', propTypes: { images: React.PropTypes.array.isRequired, }, getInitialState() { return { sliderCss: {}, leftImageCss: {}, imgCss: {}, enableMouseMoveListener: false, }; }, componentDidMount() { window.addEventListener('resize', this.initSlider); }, componentWillUnmount() { window.removeEventListener('resize', this.initSlider); }, onImgLoad(e) { this.imgWidth = e.target.naturalWidth; this.imgHeight = e.target.naturalHeight; this.initSlider(); }, initSlider() { if (!this.imgWidth || !this.imgHeight) { return; } let imgWidth; let imgHeight; let sliderWidth; let sliderHeight; const viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); const viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); if (this.imgWidth >= this.imgHeight) { imgWidth = '90vw'; imgHeight = 'auto'; sliderWidth = '90vw'; sliderHeight = Math.floor((1 - ((this.imgWidth - viewportWidth * 0.8) / this.imgWidth)) * this.imgHeight); } else { imgWidth = 'auto'; imgHeight = '90vh'; sliderWidth = Math.floor((1 - ((this.imgHeight - viewportHeight * 0.8) / this.imgHeight)) * this.imgWidth); sliderHeight = '90vh'; } this.setState({ imgCss: Object.assign({}, this.state.imgCss, { width: imgWidth, height: imgHeight, }), sliderCss: Object.assign({}, this.state.sliderCss, { width: sliderWidth, height: sliderHeight, }), leftImageCss: Object.assign({}, this.state.leftImageCss, { width: Math.floor(sliderWidth * 0.5), maxWidth: sliderWidth - 2, }), }); }, slideResize(e) { e.preventDefault(); if (this.state.enableMouseMoveListener) { const width = (e.offsetX === undefined) ? e.pageX - e.currentTarget.offsetLeft : e.offsetX; this.setState({ leftImageCss: Object.assign({}, this.state.leftImageCss, { width }) }); } }, enableSliderDrag(e) { e.preventDefault(); this.setState({ sliderCss: Object.assign({}, this.state.sliderCss, { cursor: 'ew-resize' }), enableMouseMoveListener: true, }); }, disableSliderDrag(e) { e.preventDefault(); this.setState({ sliderCss: Object.assign({}, this.state.sliderCss, { cursor: 'normal' }), enableMouseMoveListener: false, }); }, render() { return ( <div className="slider" ref="slider" style={this.state.sliderCss} onMouseMove={this.slideResize} onMouseDown={this.enableSliderDrag} onMouseUp={this.disableSliderDrag} > <div className="left image" style={this.state.leftImageCss}> <img src={this.props.images[0]} style={this.state.imgCss} onLoad={this.onImgLoad} /> </div> <div className="right image"> <img src={this.props.images[1]} style={this.state.imgCss} /> </div> </div> ); } });
src/dots.js
sanbornmedia/react-slick
'use strict'; import React from 'react'; import classnames from 'classnames'; var getDotCount = function (spec) { var dots; dots = Math.ceil(spec.slideCount / spec.slidesToScroll); return dots; }; export var Dots = React.createClass({ clickHandler: function (options, e) { // In Autoplay the focus stays on clicked button even after transition // to next slide. That only goes away by click somewhere outside e.preventDefault(); this.props.clickHandler(options); }, render: function () { var dotCount = getDotCount({ slideCount: this.props.slideCount, slidesToScroll: this.props.slidesToScroll }); // Apply join & split to Array to pre-fill it for IE8 // // Credit: http://stackoverflow.com/a/13735425/1849458 var dots = Array.apply(null, Array(dotCount + 1).join('0').split('')).map((x, i) => { var leftBound = (i * this.props.slidesToScroll); var rightBound = (i * this.props.slidesToScroll) + (this.props.slidesToScroll - 1); var className = classnames({ 'slick-active': (this.props.currentSlide >= leftBound) && (this.props.currentSlide <= rightBound) }); var dotOptions = { message: 'dots', index: i, slidesToScroll: this.props.slidesToScroll, currentSlide: this.props.currentSlide }; var onClick = this.clickHandler.bind(this, dotOptions); return ( <li key={i} className={className}> {React.cloneElement(this.props.customPaging(i), {onClick})} </li> ); }); return ( <ul className={this.props.dotsClass} style={{display: 'block'}}> {dots} </ul> ); } });
src/Announcer.js
thinkcompany/react-a11y-announcer
import React, { Component } from 'react'; import PropTypes from 'prop-types'; class Announcer extends Component { constructor(props) { super(props); this.state = { text: '' } } static propTypes = { text: PropTypes.string, politeness: PropTypes.string } static defaultProps = { className: '', politeness: 'polite' } UNSAFE_componentWillReceiveProps(nextProps) { const currentAnnouncement = this.state.text; let nextAnnouncement = nextProps.text; if (nextAnnouncement === currentAnnouncement) { nextAnnouncement = nextAnnouncement + '\u00A0'; } this.setState(prevState => ({ text: nextAnnouncement })); } defaultStyles = { position: 'absolute', visibility: 'visible', overflow: 'hidden', display: 'block', width: '1px', height: '1px', margin: '-1px', border: '0', padding: '0', clip: 'rect(0px, 0px, 0px, 0px)', clipPath: 'polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px)', whiteSpace: 'nowrap' } render() { const { className, text, politeness, ...props } = this.props; const styles = className ? {} : this.defaultStyles; return ( <div aria-atomic aria-live={politeness} style={styles} className={className} {...props} > { this.state.text.length ? <p>{this.state.text}</p> : null } </div> ) } } export default Announcer;
app/components/hello/hello.js
dfmcphee/express-react
import React from 'react'; export default class Hello extends React.Component { constructor(props) { super(props); this.state = { message: 'Loading...' }; this.fetchMessage(); } fetchMessage() { fetch('/message.json') .then((response) => response.json()) .then((data) => this.setState({ message: data.message })); } render() { return ( <div className="hello"> <h1 className="hello__message">{this.state.message}</h1> </div> ); } }
src/components/common/svg-icons/action/delete.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionDelete = (props) => ( <SvgIcon {...props}> <path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/> </SvgIcon> ); ActionDelete = pure(ActionDelete); ActionDelete.displayName = 'ActionDelete'; ActionDelete.muiName = 'SvgIcon'; export default ActionDelete;
examples/huge-apps/routes/Course/routes/Assignments/components/Sidebar.js
skevy/react-router
import React from 'react'; import { Link } from 'react-router'; class Sidebar extends React.Component { render () { var assignments = COURSES[this.props.params.courseId].assignments return ( <div> <h3>Sidebar Assignments</h3> <ul> {assignments.map(assignment => ( <li key={assignment.id}> <Link to={`/course/${this.props.params.courseId}/assignments/${assignment.id}`}> {assignment.title} </Link> </li> ))} </ul> </div> ); } } export default Sidebar;
packages/ringcentral-widgets-docs/src/app/pages/Components/PresenceSettingSection/index.js
u9520107/ringcentral-js-widget
import React from 'react'; import { parse } from 'react-docgen'; import CodeExample from '../../../components/CodeExample'; import ComponentHeader from '../../../components/ComponentHeader'; import PropTypeDescription from '../../../components/PropTypeDescription'; import Demo from './Demo'; // eslint-disable-next-line import demoCode from '!raw-loader!./Demo'; // eslint-disable-next-line import componentCode from '!raw-loader!ringcentral-widgets/components/PresenceSettingSection'; const PresenceSettingSectionPage = () => { const info = parse(componentCode); return ( <div> <ComponentHeader name="PresenceSettingSection" description={info.description} /> <CodeExample code={demoCode} title="PresenceSettingSection Example" > <Demo /> </CodeExample> <PropTypeDescription componentInfo={info} /> </div> ); }; export default PresenceSettingSectionPage;
frontend/src/app/components/ExperimentRowCard.js
dannycoates/testpilot
import React from 'react'; import { Link } from 'react-router'; import classnames from 'classnames'; import { experimentL10nId } from '../lib/utils'; const ONE_DAY = 24 * 60 * 60 * 1000; const ONE_WEEK = 7 * ONE_DAY; const MAX_JUST_LAUNCHED_PERIOD = 2 * ONE_WEEK; const MAX_JUST_UPDATED_PERIOD = 2 * ONE_WEEK; export default class ExperimentRowCard extends React.Component { l10nId(pieces) { return experimentL10nId(this.props.experiment, pieces); } render() { const { hasAddon, experiment, enabled, isAfterCompletedDate } = this.props; const { description, title, thumbnail, subtitle, slug } = experiment; const installation_count = (experiment.installation_count) ? experiment.installation_count : 0; const isCompleted = isAfterCompletedDate(experiment); return ( <Link id="show-detail" to={`/experiments/${slug}`} onClick={(evt) => this.openDetailPage(evt)} className={classnames('experiment-summary', { enabled, 'just-launched': this.justLaunched(), 'just-updated': this.justUpdated(), 'has-addon': hasAddon })} > <div className="experiment-actions"> {enabled && <div data-l10n-id="experimentListEnabledTab" className="tab enabled-tab"></div>} {this.justLaunched() && <div data-l10n-id="experimentListJustLaunchedTab" className="tab just-launched-tab"></div>} {this.justUpdated() && <div data-l10n-id="experimentListJustUpdatedTab" className="tab just-updated-tab"></div>} </div> <div className="experiment-icon-wrapper" style={{ backgroundColor: experiment.gradient_start, backgroundImage: `linear-gradient(135deg, ${experiment.gradient_start}, ${experiment.gradient_stop}` }}> <div className="experiment-icon" style={{ backgroundImage: `url(${thumbnail})` }}></div> </div> <div className="experiment-information"> <header> <h3>{title}</h3> {subtitle && <h4 data-l10n-id={this.l10nId('subtitle')} className="subtitle">{subtitle}</h4>} <h4>{this.statusMsg()}</h4> </header> <p data-l10n-id={this.l10nId('description')}>{description}</p> { this.renderInstallationCount(installation_count, isCompleted) } { this.renderManageButton(enabled, hasAddon, isCompleted) } </div> </Link> ); } // this is set to 100, to accomodate Tracking Protection // which has been sending telemetry pings via installs from dev // TODO: figure out a non-hack way to toggle user counts when we have // telemetry data coming in from prod renderInstallationCount(installation_count, isCompleted) { if (installation_count <= 100 || isCompleted) return ''; return ( <span className="participant-count" data-l10n-id="participantCount" data-l10n-args={JSON.stringify({ installation_count })}>{installation_count}</span> ); } renderManageButton(enabled, hasAddon, isCompleted) { if (enabled && hasAddon) { return ( <div className="button card-control secondary" data-l10n-id="experimentCardManage">Manage</div> ); } else if (isCompleted) { return ( <div className="button card-control secondary" data-l10n-id="experimentCardLearnMore">Learn More</div> ); } return ( <div className="button card-control default" data-l10n-id="experimentCardGetStarted">Get Started</div> ); } justUpdated() { const { experiment, enabled, getExperimentLastSeen } = this.props; // Enabled trumps launched. if (enabled) { return false; } // If modified awhile ago, don't consider it "just" updated. const now = Date.now(); const modified = (new Date(experiment.modified)).getTime(); if ((now - modified) > MAX_JUST_UPDATED_PERIOD) { return false; } // If modified since the last time seen, *do* consider it updated. if (modified > getExperimentLastSeen(experiment)) { return true; } // All else fails, don't consider it updated. return false; } justLaunched() { const { experiment, enabled, getExperimentLastSeen } = this.props; // Enabled & updated trumps launched. if (enabled || this.justUpdated()) { return false; } // If created awhile ago, don't consider it "just" launched. const now = Date.now(); const created = (new Date(experiment.created)).getTime(); if ((now - created) > MAX_JUST_LAUNCHED_PERIOD) { return false; } // If never seen, *do* consider it "just" launched. if (!getExperimentLastSeen(experiment)) { return true; } // All else fails, don't consider it launched. return false; } statusMsg() { const { experiment } = this.props; if (experiment.completed) { const delta = (new Date(experiment.completed)).getTime() - Date.now(); if (delta < 0) { return ''; } else if (delta < ONE_DAY) { return <span className="eol-message" data-l10n-id="experimentListEndingTomorrow">Ending Tomorrow</span>; } else if (delta < ONE_WEEK) { return <span className="eol-message" data-l10n-id="experimentListEndingSoon">Ending Soon</span>; } } return ''; } openDetailPage(evt) { const { navigateTo, eventCategory, experiment, sendToGA } = this.props; const { title } = experiment; evt.preventDefault(); sendToGA('event', { eventCategory, eventAction: 'Open detail page', eventLabel: title }); navigateTo(`/experiments/${experiment.slug}`); } } ExperimentRowCard.propTypes = { experiment: React.PropTypes.object.isRequired, hasAddon: React.PropTypes.bool.isRequired, enabled: React.PropTypes.bool.isRequired, eventCategory: React.PropTypes.string.isRequired, getExperimentLastSeen: React.PropTypes.func.isRequired, sendToGA: React.PropTypes.func.isRequired, navigateTo: React.PropTypes.func.isRequired, isAfterCompletedDate: React.PropTypes.func };
src/routes/y-axis-assembly/YAxisAssembly.js
bigearth/www.clone.earth
import React from 'react'; import PropTypes from 'prop-types'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './YAxisAssembly.css'; import { Grid, Row, Col, Image } from 'react-bootstrap'; import DocsTOC from '../../components/DocsTOC'; class YAxisAssembly extends React.Component { render() { return ( <Grid fluid> <Row className={s.root}> <Col xs={12} sm={12} md={2} lg={2} > <DocsTOC selected="/y-axis-assembly" /> </Col> <Col xs={12} sm={12} md={10} lg={10}> <Row> <Col xs={12} md={6}> <h2>Y Axis Assembly</h2> <h3 id='step1'>Step 1 Gather materials</h3> <h4>Tools</h4> <ul> <li>Adjustable wrench x2</li> <li>Needle nose pliers x1</li> <li>2 and 1.5mm Hex keys</li> </ul> <h4>3D printed parts</h4> <ul> <li>Y axis corners x4</li> <li>Y motor holder x1</li> <li>Y idler x1</li> <li>Y belt holder x1</li> </ul> <h4>Hardware</h4> <ul> <li> Rods <ul> <li>M10 threaded rod 35 cm x2</li> <li>M8 Chrome rod 33 cm x2</li> <li>M8 threaded rod 20 cm x4</li> </ul> </li> <li> Nuts &amp; Bolts <ul> <li>M3x10 screw x2</li> <li>M3x12 screw x2</li> <li>M3x16 screw x2</li> <li>M3x25 screw x1</li> <li>M10 nuts x14</li> <li>M10 washers x12</li> <li>M8 nuts x22</li> <li>M8 washers x22</li> <li>Idler Bearing x1 </li> <li>M3 locknut x3</li> <li>M3 washer x2</li> <li>GT2 pulley x1</li> <li>Linear bearings x3</li> </ul> </li> <li> Electronics <ul> <li>Y axis endstop x1</li> <li>Nema 17 stepper motor x1</li> </ul> </li> <li> Miscellaneous <ul> <li>Y axis carriage x1</li> <li>Zip tie 10 cm x4</li> <li>GT2 belt 97 cm x1</li> </ul> </li> </ul> </Col> <Col xs={12} md={6}> <p> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/hardware.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/hardware.jpg' /> </a> </p> <p>Watch how this is assembled.</p> <ul> <li> <a href='https://www.youtube.com/watch?v=dEyroKoFHkw'>Clone Y Axis Assembly pt 1</a> </li> <li> <a href='https://www.youtube.com/watch?v=lSSVv5N3OVk'>Clone Y Axis Assembly pt 2</a> </li> <li> <a href='https://www.youtube.com/watch?v=mc5PCTaUUeY'>Clone Y Axis Assembly pt 3</a> </li> <li> <a href='https://www.youtube.com/watch?v=De_r0noNFU'>Clone Y Axis Assembly pt 4</a> </li> <li> <a href='https://www.youtube.com/watch?v=UCKhUHuvsJs'>Clone Y Axis Assembly pt 5</a> </li> <li> <a href='https://www.youtube.com/watch?v=WLLdzBGMX2A'>Clone Y Axis Assembly pt 6</a> </li> </ul> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step2'>Step 2 Assemble the Y-axis rods</h3> <h4>Hardware</h4> <ul> <li>M10 threaded rod 35 cm x2</li> <li>M10 washers x12</li> <li>M10 nuts x14</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-2-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-2-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Place the nuts, washers and y corners on the threaded rod.</li> <li className={s.blueHighlight}>Tighten the 2 nuts against each other counter-nut.</li> <li className={s.redHighlight}>Confirm that there is 10 cm distance between the counter nuts and the y axis corner.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-2-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-2-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step3'>Step 3 Assemble the Y-axis stage rear</h3> <h4>Hardware</h4> <ul> <li>M8 threaded rod 20 cm x2</li> <li>M8 washers x8</li> <li>M8 nuts x4</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-3-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-3-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Screw the nuts and place washers and Y-motor-holder on threaded rod.</li> <li>Y-motor-mount should be somewhere in the middle of the threaded rod. The precise position doesn&rsquo;t matter at this time.</li> <li>Ensure the correct orientation of Y-motor-holder.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-3-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-3-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step4'>Step 4 Assemble the Y-axis stage front</h3> <h4>Hardware</h4> <ul> <li>M8 threaded rod x2</li> <li>M8 washers x8</li> <li>M8 nuts x6</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-4-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-4-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Screw the nuts and place washers and Y-idler on threaded rod.</li> <li>Y-idler should be somewhere in the middle of the threaded rod. The precise position doesn&rsquo;t matter at this time.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-4-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-4-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step5'>Step 5 Fully assemble the Y-axis stage</h3> <h4>Hardware</h4> <ul> <li>M8 washers x8</li> <li>M8 nuts x8</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-5-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-5-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Insert Y-axis stage front and back into Y-axis side elements and lock it with washers and nuts.</li> <li>Ensure the correct placement. Y-axis rear stage has to be closer to the double-nuts.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-5-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-5-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step6'>Step 6 Prepare for the Y-axis stage</h3> <h4>Hardware</h4> <ul> <li>Aluminum Frame x1</li> <li>Y axis stage from previous steps</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-6-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-6-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Insert the Y-axis stage into the frame as close to Y-corners as possible.</li> <li>Adjust and tighten the M8n nuts.</li> <li>Rotate the Y-axis stage and repeat.</li> <li>After adjusting, the Y-axis stage should cause minimum movement while inserted into the frame.</li> <li>Tighten the M8n nuts gently or you&squo;ll risk damaging the 3D printed parts.</li> <li>It is incredibly important that the axis is perfectly rectangular at this stage of construction, all rods need to be perfectly straight and level. If not, you&rsquo;ll have troubles calibrating later on.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-6-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-6-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step7'>Step 7 Assemble the Y carriage</h3> <h4>Hardware</h4> <ul> <li>Y Carriage x1</li> <li>Zip ties x3</li> <li>Linear bearings x3</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-7-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-7-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Insert zipties into the Y-carriage as shown on the picture.</li> <li>Place the linear bearings in cutouts.</li> <li>On side with two bearings slide bearings to the center, towards each other as close as possible.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-7-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-7-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step8'>Step 8 Assemble the Y idler</h3> <h4>Hardware</h4> <ul> <li>M3x25 screw x1</li> <li>M3 washer x2</li> <li>bearing housing x1</li> <li>M3 lock nut x1</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-8-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-8-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>To tighten the Y-idler, use the pliers and 2mm Hex key.</li> <li>Tighten the screw gently, just half turn max after the washers touch the 3D printed part.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-8-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-8-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step9'>Step 9 Y axis motor</h3> <h4>Hardware</h4> <ul> <li>Stepper motor x1</li> <li>M3x10 screw x2</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-9-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-9-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Using the 2mm Hex key, secure the motor to the 3D printed part. Motor cables must be facing threaded rods.</li> <li>Tighten the motor gently to avoid damage to the 3D printed part.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-9-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-9-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step10'>Step 10 Y Endstop</h3> <h4>Hardware</h4> <ul> <li>M3x16 screw x2</li> <li>Endstop x1</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-10-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-10-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>To tighten the Y-endstop use 1.5mm Hex key.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-10-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-10-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step11'>Step 11 Y belt holder</h3> <h4>Hardware</h4> <ul> <li>M3x12 screw x2</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-11-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-11-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Place Y-belt holder on the Y-carriage.</li> <li>Be aware of the orientation of Y-belt holder (belt entry should face towards single bearing).</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-11-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-11-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step12'>Step 12 Y carriage rods</h3> <h4>Hardware</h4> <ul> <li>Chrome rod 33 cm x2</li> </ul> </Col> <Col xs={12} md={6}> <a href=''> </a> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-12-a.jpg' /> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Insert the 8mm smooth rods into the linear bearings on Y-carriage.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-12-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-12-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step13'>Step 13 Assemble the Y axis stage</h3> <h4>Hardware</h4> <ul> <li>Assembled y carriage</li> <li>Assembled y stage</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-13-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-13-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Insert the assembled Y-carriage into the Y-axis stage.</li> <li>Insert zipties into holes in Y-corners.</li> <li>Using pliers, tighten the zipties as shown in the picture.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-13-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-13-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step14'>Step 14 Add Y motor pulley</h3> <h4>Hardware</h4> <ul> <li>Assembled y motor</li> <li>GT2 pulley x1</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-14-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-14-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Add pulley to motor shaft and tighten.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-14-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-14-b.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='step15'>Step 15 Add belt to y axis</h3> <h4>Hardware</h4> <ul> <li>Pulley timing belt x1</li> </ul> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-15-a.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-15-a.jpg' /> </a> </Col> </Row> <Row className={s.root}> <Col xs={12} md={6}> <ol> <li>Run around y idler.</li> <li>Run around y motor</li> <li>Loop around y carriage holder.</li> </ol> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-15-b.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-15-b.jpg' /> </a> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-15-c.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/step-15-c.jpg' /> </a> </Col> </Row> <hr /> <Row className={s.root}> <Col xs={12} md={6}> <h3 id='allDone'>All Done!</h3> <p>Congratulations! Now on to the next step.</p> </Col> <Col xs={12} md={6}> <a href='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/done.jpg'> <Image src='https://s3-us-west-1.amazonaws.com/www-clone-earth-assets/y-axis/done.jpg' /> </a> </Col> </Row> </Col> </Row> </Grid> ); } } export default withStyles(s)(YAxisAssembly);
src/svg-icons/image/timer-3.js
kasra-co/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageTimer3 = (props) => ( <SvgIcon {...props}> <path d="M11.61 12.97c-.16-.24-.36-.46-.62-.65-.25-.19-.56-.35-.93-.48.3-.14.57-.3.8-.5.23-.2.42-.41.57-.64.15-.23.27-.46.34-.71.08-.24.11-.49.11-.73 0-.55-.09-1.04-.28-1.46-.18-.42-.44-.77-.78-1.06-.33-.28-.73-.5-1.2-.64-.45-.13-.97-.2-1.53-.2-.55 0-1.06.08-1.52.24-.47.17-.87.4-1.2.69-.33.29-.6.63-.78 1.03-.2.39-.29.83-.29 1.29h1.98c0-.26.05-.49.14-.69.09-.2.22-.38.38-.52.17-.14.36-.25.58-.33.22-.08.46-.12.73-.12.61 0 1.06.16 1.36.47.3.31.44.75.44 1.32 0 .27-.04.52-.12.74-.08.22-.21.41-.38.57-.17.16-.38.28-.63.37-.25.09-.55.13-.89.13H6.72v1.57H7.9c.34 0 .64.04.91.11.27.08.5.19.69.35.19.16.34.36.44.61.1.24.16.54.16.87 0 .62-.18 1.09-.53 1.42-.35.33-.84.49-1.45.49-.29 0-.56-.04-.8-.13-.24-.08-.44-.2-.61-.36-.17-.16-.3-.34-.39-.56-.09-.22-.14-.46-.14-.72H4.19c0 .55.11 1.03.32 1.45.21.42.5.77.86 1.05s.77.49 1.24.63.96.21 1.48.21c.57 0 1.09-.08 1.58-.23.49-.15.91-.38 1.26-.68.36-.3.64-.66.84-1.1.2-.43.3-.93.3-1.48 0-.29-.04-.58-.11-.86-.08-.25-.19-.51-.35-.76zm9.26 1.4c-.14-.28-.35-.53-.63-.74-.28-.21-.61-.39-1.01-.53s-.85-.27-1.35-.38c-.35-.07-.64-.15-.87-.23-.23-.08-.41-.16-.55-.25-.14-.09-.23-.19-.28-.3-.05-.11-.08-.24-.08-.39s.03-.28.09-.41c.06-.13.15-.25.27-.34.12-.1.27-.18.45-.24s.4-.09.64-.09c.25 0 .47.04.66.11.19.07.35.17.48.29.13.12.22.26.29.42.06.16.1.32.1.49h1.95c0-.39-.08-.75-.24-1.09-.16-.34-.39-.63-.69-.88-.3-.25-.66-.44-1.09-.59-.43-.15-.92-.22-1.46-.22-.51 0-.98.07-1.39.21-.41.14-.77.33-1.06.57-.29.24-.51.52-.67.84-.16.32-.23.65-.23 1.01s.08.68.23.96c.15.28.37.52.64.73.27.21.6.38.98.53.38.14.81.26 1.27.36.39.08.71.17.95.26s.43.19.57.29c.13.1.22.22.27.34.05.12.07.25.07.39 0 .32-.13.57-.4.77-.27.2-.66.29-1.17.29-.22 0-.43-.02-.64-.08-.21-.05-.4-.13-.56-.24-.17-.11-.3-.26-.41-.44-.11-.18-.17-.41-.18-.67h-1.89c0 .36.08.71.24 1.05.16.34.39.65.7.93.31.27.69.49 1.15.66.46.17.98.25 1.58.25.53 0 1.01-.06 1.44-.19.43-.13.8-.31 1.11-.54.31-.23.54-.51.71-.83.17-.32.25-.67.25-1.06-.02-.4-.09-.74-.24-1.02z"/> </SvgIcon> ); ImageTimer3 = pure(ImageTimer3); ImageTimer3.displayName = 'ImageTimer3'; ImageTimer3.muiName = 'SvgIcon'; export default ImageTimer3;
docs/app/Examples/collections/Form/FieldVariations/FormExampleRequiredFieldShorthand.js
shengnian/shengnian-ui-react
import React from 'react' import { Form } from 'shengnian-ui-react' const FormExampleRequiredFieldShorthand = () => ( <Form> <Form.Checkbox inline label='I agree to the terms and conditions' required /> </Form> ) export default FormExampleRequiredFieldShorthand
examples/js/selection/select-hook-table.js
dana2208/react-bootstrap-table
/* eslint max-len: 0 */ /* eslint no-alert: 0 */ /* eslint guard-for-in: 0 */ import React from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; const products = []; function addProducts(quantity) { const startId = products.length; for (let i = 0; i < quantity; i++) { const id = startId + i; products.push({ id: id, name: 'Item name ' + id, price: 2100 + i }); } } addProducts(5); function onRowSelect(row, isSelected) { let rowStr = ''; for (const prop in row) { rowStr += prop + ': "' + row[prop] + '"'; } alert(`is selected: ${isSelected}, ${rowStr}`); } function onSelectAll(isSelected, currentDisplayAndSelectedData) { alert(`is select all: ${isSelected}`); alert('Current display and selected data: '); for (let i = 0; i < currentDisplayAndSelectedData.length; i++) { alert(currentDisplayAndSelectedData[i]); } } const selectRowProp = { mode: 'checkbox', clickToSelect: true, onSelect: onRowSelect, onSelectAll: onSelectAll }; export default class SelectHookTable extends React.Component { render() { return ( <BootstrapTable data={ products } selectRow={ selectRowProp }> <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> </BootstrapTable> ); } }
app/containers/UpgradeDialog/index.js
VonIobro/ab-web
import React from 'react'; import { Receipt } from 'poker-helper'; import { createStructuredSelector } from 'reselect'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Form, Field, SubmissionError, reduxForm } from 'redux-form/immutable'; import { makeSelectAccountData } from '../../containers/AccountProvider/selectors'; import { getWeb3 } from '../../containers/AccountProvider/utils'; import NoWeb3Message from '../../containers/Web3Alerts/NoWeb3'; import UnsupportedNetworkMessage from '../../containers/Web3Alerts/UnsupportedNetwork'; import SubmitButton from '../../components/SubmitButton'; import FormGroup from '../../components/Form/FormGroup'; import { CheckBox } from '../../components/Input'; import Label from '../../components/Label'; import H2 from '../../components/H2'; import A from '../../components/A'; import { Icon } from '../../containers/Dashboard/styles'; import { accountUnlocked } from '../AccountProvider/actions'; import { ABI_PROXY } from '../../app.config'; import { waitForTx } from '../../utils/waitForTx'; import { promisifyWeb3Call } from '../../utils/promisifyWeb3Call'; import * as accountService from '../../services/account'; const validate = (values) => { const errors = {}; if (!values.get('accept')) { errors.accept = 'Required'; } return errors; }; /* eslint-disable react/prop-types */ const renderCheckBox = ({ input, label, type }) => ( <FormGroup> <Label> <CheckBox {...input} placeholder={label} type={type} /> {label} </Label> </FormGroup> ); /* eslint-enable react/prop-types */ class UpgradeDialog extends React.Component { constructor(props) { super(props); this.state = { success: false, }; this.handleSubmit = this.handleSubmit.bind(this); } componentWillReceiveProps(nextProps) { if (nextProps.submitting === false && this.props.submitting === true && !nextProps.invalid) { this.setState({ success: true }); this.props.accountUnlocked(); } } async handleSubmit() { const { account } = this.props; const proxyContract = getWeb3(true).eth.contract(ABI_PROXY).at(account.proxy); const unlockTx = promisifyWeb3Call(proxyContract.unlock); try { const unlockRequest = new Receipt().unlockRequest(account.injected).sign(`0x${account.privKey}`); const unlock = await accountService.unlock(unlockRequest); const txHash = await unlockTx( ...Receipt.parseToParams(unlock), { from: account.injected }, ); await waitForTx(getWeb3(), txHash); } catch (e) { setImmediate(() => this.props.change('accept', false)); throw new SubmissionError({ _error: `Error: ${e.message || e}` }); } } render() { const { success } = this.state; const { invalid, submitting, handleSubmit, onSuccessButtonClick, account, } = this.props; return ( <div> <H2> Unlock your account &nbsp; <A href="http://help.acebusters.com/quick-guide-to-acebusters/winning-the-pots/how-to-upgrade-to-a-shark-account" target="_blank" > <Icon className="fa fa-info-circle" aria-hidden="true" /> </A> </H2> {!account.injected && <NoWeb3Message /> } {account.injected && !account.onSupportedNetwork && <UnsupportedNetworkMessage /> } <Form onSubmit={handleSubmit(this.handleSubmit)}> {account.injected && !submitting && !success && <div> <p>This will unlock your account</p> <Field name="accept" type="checkbox" component={renderCheckBox} label="I understand that it will be my sole responsible to secure my account and balance" /> </div> } {submitting && <p>Account unlock tx pending...</p> } {success && <p>Account unlocked successful</p>} {!success && <SubmitButton disabled={!account.injected || !account.onSupportedNetwork || invalid} submitting={submitting} > Unlock </SubmitButton> } {success && <SubmitButton type="button" onClick={onSuccessButtonClick}> Ok </SubmitButton> } </Form> </div> ); } } UpgradeDialog.propTypes = { account: PropTypes.object, invalid: PropTypes.bool, submitting: PropTypes.bool, handleSubmit: PropTypes.func, accountUnlocked: PropTypes.func, change: PropTypes.func, onSuccessButtonClick: PropTypes.func, }; UpgradeDialog.defaultProps = { }; const mapStateToProps = createStructuredSelector({ account: makeSelectAccountData(), }); export default connect(mapStateToProps, { accountUnlocked })( reduxForm({ form: 'upgrade', validate, })(UpgradeDialog) );
features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/components/Apis/Details/Permission.js
sambaheerathan/carbon-apimgt
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import React from 'react' import {Row, Col} from 'antd'; class Permission extends React.Component { constructor(props) { super(props); this.state = { api: props.api } } render() { return ( <div> <div> <div className="wrapper wrapper-content"> <h2> API Name : {this.state.api.name} </h2> <div className="divTable"> <div className="divTableBody"> <div className="gutter-example"> <Row gutter={16}> <Col className="gutter-row" span={6}> <div className="gutter-box">Group Name</div> </Col> <Col className="gutter-row" span={6}> <div className="gutter-box">Read</div> </Col> <Col className="gutter-row" span={6}> <div className="gutter-box">Update</div> </Col> <Col className="gutter-row" span={6}> <div className="gutter-box">Delete</div> </Col> </Row> </div> </div> </div> </div> </div> </div> ) } } export default Permission
src/index.js
melihberberolu/yemeksepeti-task
import React from 'react'; import { render } from "react-dom"; import App from './App'; import registerServiceWorker from './registerServiceWorker'; require("./assets/sass/main.scss"); render( <App />, document.getElementById("app") ); registerServiceWorker();
src/TabPane.js
roderickwang/react-bootstrap
import React from 'react'; import deprecationWarning from './utils/deprecationWarning'; import Tab from './Tab'; const TabPane = React.createClass({ componentWillMount() { deprecationWarning( 'TabPane', 'Tab', 'https://github.com/react-bootstrap/react-bootstrap/pull/1091' ); }, render() { return ( <Tab {...this.props} /> ); } }); export default TabPane;
packages/react-ui-components/src/Dialog/index.story.js
mstruebing/PackageFactory.Guevara
import React from 'react'; import {storiesOf, action} from '@storybook/react'; import {withKnobs, text, boolean} from '@storybook/addon-knobs'; import {StoryWrapper} from './../_lib/storyUtils'; import Dialog from '.'; import Button from './../Button'; storiesOf('Dialog', module) .addDecorator(withKnobs) .addWithInfo( 'default', 'Dialog', () => ( <StoryWrapper> <Dialog isOpen={boolean('Is opened?', true)} title={text('Title', 'Hello title!')} onRequestClose={action('onRequestClose')} actions={[ <Button key="foo">An action button</Button> ]} style="wide" > {text('Inner content', 'Hello world!')} </Dialog> </StoryWrapper> ), {inline: true, source: false} ) .addWithInfo( 'narrow', 'Dialog', () => ( <StoryWrapper> <Dialog isOpen={boolean('Is opened?', true)} title={text('Title', 'Hello title!')} onRequestClose={action('onRequestClose')} actions={[ <Button key="foo">An action button</Button> ]} style="narrow" > {text('Inner content', 'Hello world!')} </Dialog> </StoryWrapper> ), {inline: true, source: false} );
app/components/FullRoster.js
BeAce/react-babel-webpack-eslint-boilerplate
import React from 'react'; const FullRoster = () => (<div> <ul>api12</ul> </div>); export default FullRoster;
app/components/users/UserForm.js
MakingSense/mern-seed
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router'; import Formsy from 'formsy-react'; import autoBind from '../../lib/autoBind'; import { Input, Textarea } from 'formsy-react-components'; class UserForm extends Component { constructor(props, context) { super(props, context); this.state = { canSubmit: false }; autoBind(this, { bindOnly: ['enableButton', 'disableButton', 'submit', 'resetForm'] }); } enableButton() { this.setState({ canSubmit: true }); } disableButton() { this.setState({ canSubmit: false }); } submit(model) { this.props.onSave(model); } resetForm() { this.refs.form.reset(); } render() { return ( <div> <Formsy.Form ref="form" className="horizontal" onValidSubmit={this.submit} onValid={this.enableButton} onInvalid={this.disableButton}> <Input formNoValidate required name="name" label="Name" placeholder="Name" value={this.props.user.name || ''} /> <Input formNoValidate required name="email" label="Email" placeholder="Email" value={this.props.user.email || ''} validations="isEmail" validationError="This is not a valid email" /> <div> <button type="button" onClick={this.resetForm}>Reset</button> &nbsp; <input type="submit" disabled={!this.state.canSubmit} value={this.props.saving ? 'Saving... ' : 'Save'} /> &nbsp; <Link to="/app/users">Cancel</Link> </div> </Formsy.Form> </div> ); } } UserForm.propTypes = { onSave: PropTypes.func.isRequired, saving: PropTypes.bool.isRequired, user: PropTypes.object.isRequired }; export default UserForm;
src/components/UI/Tabs/Tabs.js
bocasfx/Q
import React from 'react'; import './Tabs.css'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { setSelection } from '../../../actions/Selection'; import PropTypes from 'prop-types'; class Tabs extends React.Component { static propTypes = { selection: PropTypes.object, children: PropTypes.node, setSelection: PropTypes.func, } constructor(props) { super(props); this.state = { selected: 0, }; this.renderTitles = this.renderTitles.bind(this); } componentWillReceiveProps(nextProps) { if (nextProps.selection.objType === 'streams') { this.setState({ selected: 1, }); } else { this.setState({ selected: 0, }); } } onClick(idx, event) { event.preventDefault(); this.setState({ selected: idx, }); this.props.setSelection(this.props.children[idx].props.label.toLowerCase()); } renderTitles() { return this.props.children.map((child, idx) => { let selectedClass = idx === this.state.selected ? 'tabs-selected' : null; return ( <a href="#" onClick={this.onClick.bind(this, idx)} key={idx}> <div className={selectedClass}> {child.props.label} </div> </a> ); }); } render() { return ( <div className="tabs-container"> <div className="tabs-labels"> {this.renderTitles()} </div> <div className="tabs-content"> {this.props.children[this.state.selected]} </div> </div> ); } } const mapStateToProps = (state) => { return { selection: state.selection, }; }; const mapDispatchToProps = (dispatch) => { return { setSelection: bindActionCreators(setSelection, dispatch), }; }; export default connect(mapStateToProps, mapDispatchToProps)(Tabs);
web/portal/src/components/Form/Radio/index.js
trendmicro/serverless-survey-forms
import React, { Component } from 'react'; import Question from '../Question'; class Radio extends Component { render() { const { data, onClick } = this.props; return ( <div className="question" onClick={onClick} > <Question id={data.order} text={data.label} required={data.required} /> <div className="radioGrp"> {this._renderRadioItem()} </div> </div> ); } _renderRadioItem() { const { data } = this.props; const items = data.data.map((itm, idx) => { const label = itm.label; const input = itm.input; return ( <div className="radioItem ut-radio" key={idx} > <input type="radio" /> <label> {label} </label> { itm.hasOwnProperty('input') ? <input type="text" className="input input--medium ut-input" placeholder={input} /> : '' } <div className="subdescription">{itm.example || ''}</div> </div> ); }); return items; } } export default Radio;
components/header.js
waigo/waigo.github.io
import React from 'react'; import { Link } from 'react-router'; import { prefixLink } from 'gatsby-helpers'; import Headroom from 'react-headroom'; import { config } from 'config'; import Classnames from 'classnames'; const NAV = [ { label: 'Guide', title: 'Documentation guide', link: prefixLink(config.docsLink), tag: 'guide', }, { label: 'API', title: 'API docs', link: prefixLink(config.apiLink), tag: 'api', }, { label: <i className="twitter" />, title: 'Twitter', link: config.twitterUrl, tag: 'twitter', type: 'social', external: true, }, { label: <i className="github" />, title: 'Github', link: config.githubUrl, tag: 'github', type: 'social', external: true, }, { label: <i className="discuss" />, title: 'Discuss', link: config.discussUrl, tag: 'discuss', type: 'social', external: true, }, ]; export default class Header extends React.Component { constructor (props) { super(props); this.state = { mobileActive: null, }; _.bindAll(this, '_toggleMobileMenu'); } render () { const activeNav = this.props.activeNav; let header = null; if (this.props.show) { const navItems = NAV.map((item) => { let lnk; if (item.external) { lnk = (<a title={item.title} href={item.link} className={Classnames({active: activeNav === item.tag})}> {item.label} </a>); } else { lnk = (<Link title={item.title} to={item.link} className={Classnames({active: activeNav === item.tag})}> {item.label} </Link>); } return ( <li key={item.tag} className={Classnames(item.type)}>{lnk}</li> ); }); header = ( <header> <section className="brand"> <Link to={prefixLink('/')}> Waigo.js </Link> </section> <button className="mobile-toggle" onClick={this._toggleMobileMenu}> <i className={Classnames('menu', {open: this.state.mobileActive})} /> </button> <ul className={Classnames('nav', { active: this.state.mobileActive})}> {navItems} </ul> </header> ); } return ( <Headroom> {header} </Headroom> ); } _toggleMobileMenu (e) { e.preventDefault(); this.setState({ mobileActive: !this.state.mobileActive, }); } } Header.propTypes = { activeNav: React.PropTypes.string, show: React.PropTypes.bool, }; Header.defaultProps = { activeNav: null, show: true, };
react/src/containers/Login/Login.js
hnquang112/laradock
import React from 'react'; import {Btn} from '../../components/Controls/Button/Button'; import History from '../../routes/History'; class Login extends React.Component { // this method is only to trigger route guards , remove and use your own logic handleLogin = () => { localStorage.setItem('token','token'); History.push('/') } render(){ return( <div className="container my-5"> <h1>Login Page</h1> <Btn text='Login' handleClick={this.handleLogin}/> </div> ) } } export default Login;
07/src/App.js
viddamao/front-end-demo
import React, { Component } from 'react'; import './App.css'; class App extends Component { render() { return ( <div className="wrapper"> <h1 className="todo-title">React-Todos</h1> <p>implements a todo list with React</p> <div className="App"> </div> </div> ); } } export default App;
imports/ui/components/resident-details/accounts/transaction/transaction-pa.js
gagpmr/app-met
import React from 'react'; import * as Styles from '/imports/modules/styles.js'; import { UpdateResident } from '/imports/api/residents/methods.js'; export class TransactionPa extends React.Component { constructor(props) { super(props); } removeBill(e) { e.preventDefault(); var resid = e.currentTarget.dataset.resid; var billId = e.currentTarget.dataset.billid; var data = { ResidentId: resid, DeleteTransactionPaBill: true, BillId: billId } UpdateResident.call({ data: data }, (error, result) => { if (error) { Bert.alert(error, 'danger'); } }); } render() { if (this.props.resident.TxnPaBills) { return ( <table style={ Styles.TableHeader } className="table table-bordered table-condensed table-striped"> <thead> <tr> <td style={ Styles.PaddingThreeCenterBold }> Sr </td> <td style={ Styles.PaddingThreeCenterBold }> Span </td> <td style={ Styles.PaddingThreeCenterBold }> R-Rent </td> <td style={ Styles.PaddingThreeCenterBold }> Water </td> <td style={ Styles.PaddingThreeCenterBold }> Electricity </td> <td style={ Styles.PaddingThreeCenterBold }> FSMD </td> <td style={ Styles.PaddingThreeCenterBold }> Misc </td> <td style={ Styles.PaddingThreeCenterBold }> Admn </td> <td style={ Styles.PaddingThreeCenterBold }> Total </td> <td colSpan="2" style={ Styles.PaddingThreeCenterBold }> Actions </td> </tr> </thead> <tbody> { this.props.resident.TxnPaBills.map((doc) => <tr key={ doc._id }> <td style={ Styles.PaddingThreeCenter }> { doc.SrNo } </td> <td style={ Styles.PaddingThreeCenter }> { doc.BillPeriod } </td> <td style={ Styles.PaddingThreeCenter }> { doc.RoomRent } </td> <td style={ Styles.PaddingThreeCenter }> { doc.WaterCharges } </td> <td style={ Styles.PaddingThreeCenter }> { doc.ElectricityCharges } </td> <td style={ Styles.PaddingThreeCenter }> { doc.FoodSubsidyMesDevChrgs } </td> <td style={ Styles.PaddingThreeCenter }> { doc.Miscellaneous } </td> <td style={ Styles.PaddingThreeCenter }> { doc.Admission } </td> <td style={ Styles.PaddingThreeCenter }> { doc.Total } </td> <td style={ Styles.PaddingThreeCenterBold }> <a onClick={ this.removeBill } data-resid={ this.props.resident._id } data-billid={ doc._id } data-toggle="tooltip" title="Delete From Transaction" href=""> <i className="fa fa-trash-o" aria-hidden="true"></i> </a> </td> </tr>) } </tbody> </table> ); } else { return null; } } }; TransactionPa.propTypes = { resident: React.PropTypes.object };
src/svg-icons/social/notifications-paused.js
w01fgang/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialNotificationsPaused = (props) => ( <SvgIcon {...props}> <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.93 6 11v5l-2 2v1h16v-1l-2-2zm-3.5-6.2l-2.8 3.4h2.8V15h-5v-1.8l2.8-3.4H9.5V8h5v1.8z"/> </SvgIcon> ); SocialNotificationsPaused = pure(SocialNotificationsPaused); SocialNotificationsPaused.displayName = 'SocialNotificationsPaused'; SocialNotificationsPaused.muiName = 'SvgIcon'; export default SocialNotificationsPaused;
src/index.js
sebastiandeutsch/react-redux-starter
import React from 'react'; import ReactDOM from 'react-dom'; import App from './containers/App'; ReactDOM.render( <App />, document.getElementById('application') );
examples/dyno/app.js
chentsulin/react-tabs
import React from 'react'; import ReactDOM from 'react-dom'; import Modal from 'react-modal'; import { Tab, Tabs, TabList, TabPanel } from '../../lib/main'; Modal.setAppElement(document.getElementById('example')); Modal.injectCSS(); const App = React.createClass({ getInitialState() { return { isModalOpen: false, selectedIndex: -1, tabs: [ {label: 'Foo', content: 'This is foo'}, {label: 'Bar', content: 'This is bar'}, {label: 'Baz', content: 'This is baz'}, {label: 'Zap', content: 'This is zap'} ] }; }, render() { return ( <div style={{padding: 50}}> <p> <button onClick={this.openModal}>+ Add</button> </p> <Tabs selectedIndex={this.state.selectedIndex}> <TabList> {this.state.tabs.map((tab, i) => { return ( <Tab key={i}> {tab.label} <a href="#" onClick={this.removeTab.bind(this, i)}>✕</a> </Tab> ); })} </TabList> {this.state.tabs.map((tab, i) => { return <TabPanel key={i}>{tab.content}</TabPanel>; })} </Tabs> <Modal isOpen={this.state.isModalOpen} onRequestClose={this.closeModal} style={{width: 400, height: 350, margin: '0 auto'}} > <h2>Add a Tab</h2> <label htmlFor="label">Label:</label><br/> <input id="label" type="text" ref="label"/><br/><br/> <label htmlFor="content">Content:</label><br/> <textarea id="content" ref="content" rows="10" cols="50"></textarea><br/><br/> <button onClick={this.addTab}>OK</button>{' '} <button onClick={this.closeModal}>Cancel</button> </Modal> </div> ); }, openModal() { this.setState({ isModalOpen: true }); }, closeModal() { this.setState({ isModalOpen: false }); }, addTab() { const label = this.refs.label.value; const content = this.refs.content.value; this.state.tabs.push({ label: label, content: content }); this.setState({ selectedIndex: this.state.tabs.length - 1 }); this.closeModal(); }, removeTab(index) { this.state.tabs.splice(index, 1); this.forceUpdate(); } }); ReactDOM.render(<App/>, document.getElementById('example'));
node_modules/react-bootstrap/es/Label.js
vitorgomateus/NotifyMe
import _Object$values from 'babel-runtime/core-js/object/values'; 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 { bsClass, bsStyles, getClassSet, splitBsProps } from './utils/bootstrapUtils'; import { State, Style } from './utils/StyleConfig'; var Label = function (_React$Component) { _inherits(Label, _React$Component); function Label() { _classCallCheck(this, Label); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Label.prototype.hasContent = function hasContent(children) { var result = false; React.Children.forEach(children, function (child) { if (result) { return; } if (child || child === 0) { result = true; } }); return result; }; Label.prototype.render = function render() { var _props = this.props, className = _props.className, children = _props.children, props = _objectWithoutProperties(_props, ['className', 'children']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = _extends({}, getClassSet(bsProps), { // Hack for collapsing on IE8. hidden: !this.hasContent(children) }); return React.createElement( 'span', _extends({}, elementProps, { className: classNames(className, classes) }), children ); }; return Label; }(React.Component); export default bsClass('label', bsStyles([].concat(_Object$values(State), [Style.DEFAULT, Style.PRIMARY]), Style.DEFAULT, Label));
fields/types/color/ColorField.js
helloworld3q3q/keystone
import { SketchPicker } from 'react-color'; import { css, StyleSheet } from 'aphrodite/no-important'; import Field from '../Field'; import React from 'react'; import { Button, FormInput, InputGroup } from 'elemental'; import transparentSwatch from './transparent-swatch'; import theme from '../../../admin/client/theme'; const ColorField = Field.create({ displayName: 'ColorField', statics: { type: 'Color', }, propTypes: { onChange: React.PropTypes.func, path: React.PropTypes.string, value: React.PropTypes.string, }, getInitialState () { return { displayColorPicker: false, }; }, updateValue (value) { this.props.onChange({ path: this.props.path, value: value, }); }, handleInputChange (event) { var newValue = event.target.value; if (/^([0-9A-F]{3}){1,2}$/.test(newValue)) { newValue = '#' + newValue; } if (newValue === this.props.value) return; this.updateValue(newValue); }, handleClick () { this.setState({ displayColorPicker: !this.state.displayColorPicker }); }, handleClose () { this.setState({ displayColorPicker: false }); }, handlePickerChange (color) { var newValue = color.hex; if (newValue === this.props.value) return; this.updateValue(newValue); }, renderSwatch () { const className = `${css(classes.swatch)} e2e-type-color__swatch`; return (this.props.value) ? ( <span className={className} style={{ backgroundColor: this.props.value }} /> ) : ( <span className={className} dangerouslySetInnerHTML={{ __html: transparentSwatch }} /> ); }, renderField () { const { displayColorPicker } = this.state; const blockoutClassName = `${css(classes.blockout)} e2e-type-color__blockout`; const popoverClassName = `${css(classes.popover)} e2e-type-color__popover`; return ( <div className="e2e-type-color__wrapper" style={{ position: 'relative' }}> <InputGroup> <InputGroup.Section grow> <FormInput autoComplete="off" name={this.getInputName(this.props.path)} onChange={this.valueChanged} ref="field" value={this.props.value} /> </InputGroup.Section> <InputGroup.Section> <Button onClick={this.handleClick} className={`${css(classes.button)} e2e-type-color__button`}> {this.renderSwatch()} </Button> </InputGroup.Section> </InputGroup> {displayColorPicker && ( <div> <div className={blockoutClassName} onClick={this.handleClose} /> <div className={popoverClassName} onClick={e => e.stopPropagation()}> <SketchPicker color={this.props.value} onChangeComplete={this.handlePickerChange} onClose={this.handleClose} /> </div> </div> )} </div> ); }, }); /* eslint quote-props: ["error", "as-needed"] */ const classes = StyleSheet.create({ button: { background: 'white', padding: 4, width: theme.component.height, ':hover': { background: 'white', }, }, blockout: { bottom: 0, left: 0, position: 'fixed', right: 0, top: 0, zIndex: 1, }, popover: { marginTop: 10, position: 'absolute', right: 0, zIndex: 2, }, swatch: { borderRadius: 1, boxShadow: 'inset 0 0 0 1px rgba(0,0,0,0.1)', display: 'block', height: '100%', width: '100%', }, }); module.exports = ColorField;
src/svg-icons/action/explore.js
matthewoates/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionExplore = (props) => ( <SvgIcon {...props}> <path d="M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1c.61 0 1.1-.49 1.1-1.1s-.49-1.1-1.1-1.1zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm2.19 12.19L6 18l3.81-8.19L18 6l-3.81 8.19z"/> </SvgIcon> ); ActionExplore = pure(ActionExplore); ActionExplore.displayName = 'ActionExplore'; ActionExplore.muiName = 'SvgIcon'; export default ActionExplore;
packages/mineral-ui-icons/src/IconRemoveCircle.js
mineral-ui/mineral-ui
/* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconRemoveCircle(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z"/> </g> </Icon> ); } IconRemoveCircle.displayName = 'IconRemoveCircle'; IconRemoveCircle.category = 'content';
showcase/examples/candlestick/candlestick.js
Apercu/react-vis
// Copyright (c) 2016 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import React from 'react'; import {AbstractSeries} from 'index'; const predefinedClassName = 'rv-xy-plot__series rv-xy-plot__series--candlestick'; class CandlestickSeries extends AbstractSeries { render() { const {className, data, marginLeft, marginTop} = this.props; if (!data) { return null; } const xFunctor = this._getAttributeFunctor('x'); const yFunctor = this._getAttributeFunctor('y'); const strokeFunctor = this._getAttributeFunctor('stroke') || this._getAttributeFunctor('color'); const fillFunctor = this._getAttributeFunctor('fill') || this._getAttributeFunctor('color'); const opacityFunctor = this._getAttributeFunctor('opacity'); const distance = Math.abs(xFunctor(data[1]) - xFunctor(data[0])) * 0.2; return ( <g className={`${predefinedClassName} ${className}`} ref="container" transform={`translate(${marginLeft},${marginTop})`}> {data.map((d, i) => { const xTrans = xFunctor(d); // Names of values borrowed from here https://en.wikipedia.org/wiki/Candlestick_chart const yHigh = yFunctor({...d, y: d.yHigh}); const yOpen = yFunctor({...d, y: d.yOpen}); const yClose = yFunctor({...d, y: d.yClose}); const yLow = yFunctor({...d, y: d.yLow}); const lineAttrs = { stroke: strokeFunctor && strokeFunctor(d) }; const xWidth = distance * 2; return ( <g transform={`translate(${xTrans})`} opacity={opacityFunctor ? opacityFunctor(d) : 1} key={i} onClick={e => this._valueClickHandler(d, e)} onMouseOver={e => this._valueMouseOverHandler(d, e)} onMouseOut={e => this._valueMouseOutHandler(d, e)}> <line x1={-xWidth} x2={xWidth} y1={yHigh} y2={yHigh} {...lineAttrs} /> <line x1={0} x2={0} y1={yHigh} y2={yLow} {...lineAttrs} /> <line x1={-xWidth} x2={xWidth} y1={yLow} y2={yLow} {...lineAttrs} /> <rect x={-xWidth} width={Math.max(xWidth * 2, 0)} y={yOpen} height={Math.abs(yOpen - yClose)} fill={fillFunctor && fillFunctor(d)} /> </g>); })} </g> ); } } CandlestickSeries.displayName = 'CandlestickSeries'; export default CandlestickSeries;
src/svg-icons/av/replay-30.js
rhaedes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvReplay30 = (props) => ( <SvgIcon {...props}> <path d="M12 5V1L7 6l5 5V7c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6H4c0 4.4 3.6 8 8 8s8-3.6 8-8-3.6-8-8-8zm-2.4 8.5h.4c.2 0 .4-.1.5-.2s.2-.2.2-.4v-.2s-.1-.1-.1-.2-.1-.1-.2-.1h-.5s-.1.1-.2.1-.1.1-.1.2v.2h-1c0-.2 0-.3.1-.5s.2-.3.3-.4.3-.2.4-.2.4-.1.5-.1c.2 0 .4 0 .6.1s.3.1.5.2.2.2.3.4.1.3.1.5v.3s-.1.2-.1.3-.1.2-.2.2-.2.1-.3.2c.2.1.4.2.5.4s.2.4.2.6c0 .2 0 .4-.1.5s-.2.3-.3.4-.3.2-.5.2-.4.1-.6.1c-.2 0-.4 0-.5-.1s-.3-.1-.5-.2-.2-.2-.3-.4-.1-.4-.1-.6h.8v.2s.1.1.1.2.1.1.2.1h.5s.1-.1.2-.1.1-.1.1-.2v-.5s-.1-.1-.1-.2-.1-.1-.2-.1h-.6v-.7zm5.7.7c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1.3.2.5.3.2.3.3.6.1.5.1.8v.7zm-.8-.8v-.5c0-.1-.1-.2-.1-.3s-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5z"/> </SvgIcon> ); AvReplay30 = pure(AvReplay30); AvReplay30.displayName = 'AvReplay30'; export default AvReplay30;
actor-apps/app-web/src/app/components/Main.react.js
allengaller/actor-platform
import React from 'react'; import requireAuth from 'utils/require-auth'; import VisibilityActionCreators from 'actions/VisibilityActionCreators'; import ActivitySection from 'components/ActivitySection.react'; import SidebarSection from 'components/SidebarSection.react'; import ToolbarSection from 'components/ToolbarSection.react'; import DialogSection from 'components/DialogSection.react'; const visibilitychange = 'visibilitychange'; var onVisibilityChange = () => { if (!document.hidden) { VisibilityActionCreators.createAppVisible(); } else { VisibilityActionCreators.createAppHidden(); } }; class Main extends React.Component { componentWillMount() { document.addEventListener(visibilitychange, onVisibilityChange); if (!document.hidden) { VisibilityActionCreators.createAppVisible(); } } constructor() { super(); } render() { return ( <div className="app row"> <SidebarSection/> <section className="main col-xs"> <ToolbarSection/> <DialogSection/> </section> <ActivitySection/> </div> ); } } export default requireAuth(Main);
app/components/ItemThumbnail/ItemThumbnail.js
zhrkian/SolarDataApp
// @flow import React, { Component } from 'react'; import { Link } from 'react-router'; import s from './ItemThumbnail.css'; export default class ItemThumbnail extends Component { static contextTypes = { router: React.PropTypes.object.isRequired } componentWillMount() { const { FITS } = window.astro const { item } = this.props new FITS(item.path, response => { console.log(response) const { hdus } = response const FIST_DATA = hdus[0] const bitpix = FIST_DATA.header.get('BITPIX') const bzero = FIST_DATA.header.get('BZERO') const bscale = FIST_DATA.header.get('BSCALE') const { buffer } = FIST_DATA.data console.log( FIST_DATA, FIST_DATA.header.get('BITPIX'), FIST_DATA.header.get('BZERO'), FIST_DATA.header.get('BSCALE'), FIST_DATA.data._getFrame(buffer, bitpix, bzero, bscale) ) }) } render() { return ( <div> <div className={s.container}> <h2>Solar Data Application</h2> </div> </div> ); } }
src/components/Header.js
teamstrobe/mancreact-client
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { groupURI } from '../config/urls'; import apiFetch from '../apiFetch'; import LoginLink from './LoginLink'; import LogoutBtn from './LogoutBtn'; class Header extends Component { state = { group: null, }; componentWillMount() { this.fetchData(); } async fetchData() { const group = await this.getGroup(); this.setState({ group, }); } async getGroup() { return await apiFetch(groupURI()); } render() { const { group } = this.state; const { me, onLoginClick, onLogoutClick, pathname } = this.props; return ( <header className="header"> <div className="container"> <div className="row"> {group != null && <Link to="/" className="logo"> <div> <img src="/mancreact512.png" alt={group.name} width="100" /> </div> <div className="logo-title">{group.name}</div> </Link>} {group != null && <div className="members"> <strong>{group.members}</strong> members </div>} <div className="signin"> {!me ? <LoginLink onClick={onLoginClick} pathname={pathname} /> : <div> <img className="avatar" src={me.photo.thumb_link} alt={me.name} /> <span className="account-name"> Hello, {me.name}! </span> <LogoutBtn onClick={onLogoutClick} /> </div>} </div> </div> </div> </header> ); } } export default Header;
src/js/components/navigation/Navigation.js
csepreghy/VR-Cinema-Website-with-React.js
import {Entity} from 'aframe-react'; import React from 'react'; import Back from './buttons/Back'; import BookSeat from './buttons/BookSeat'; import ChangeSeat from './buttons/ChangeSeat'; export default class Navigation extends React.Component { opacity = { x: 0 }; constructor(props) { super(props); this.state = { opacity: { x: 0 }, navBackTextOpacity: { x: 0 }, navBackTextVisible: false }; this.fadeIn = this.fadeIn.bind(this); this.fadeOut = this.fadeOut.bind(this); this.tweenUpdate = this.tweenUpdate.bind(this); } fadeIn() { let newOpacity = { x: 1 }; let tween = new TWEEN.Tween(this.opacity).to(newOpacity, 300); tween.start(); tween.onUpdate(this.tweenUpdate); } fadeOut() { let newOpacity = { x: 0 }; let tween = new TWEEN.Tween(this.opacity).to(newOpacity, 300); tween.start(); tween.onUpdate(this.tweenUpdate); } tweenUpdate() { this.setState({ opacity: this.opacity }); } render() { return ( <Entity> <Back Opacity={ this.state.opacity.back } fadeIn={ this.fadeIn } fadeOut={ this.fadeOut } /> <BookSeat Opacity={ this.state.opacity.bookseat } fadeIn={ this.fadeIn } fadeOut={ this.fadeOut } handleBookSeatClick={ this.props.handleBookSeatClick }/> <ChangeSeat handleChangeSeatClick={ this.props.handleChangeSeatClick } Opacity={ this.state.opacity.x } fadeIn={ this.fadeIn } fadeOut={ this.fadeOut }/> </Entity> ); } }
src/docs/examples/MyHelloWorld/ExampleMyHelloWorld.js
Mikhail2k15/ps-react-michael
import React from 'react'; import MyHelloWorld from 'ps-react/MyHelloWorld'; export default function ExampleMyHelloWorld(){ return <MyHelloWorld message="Pluralsight viewers"/> }
client/src/app/app.layout.js
Thiht/docktor
// React import React from 'react'; // Components import NavBar from './navBar.component.js'; import Footer from './footer.component.js'; import Toasts from '../toasts/toasts.component.js'; import Modal from '../modal/modal.component.js'; // JS dependancies import 'jquery'; import form from 'semantic/dist/semantic.js'; $.form = form; // Style import 'semantic/dist/semantic.css'; import './common.scss'; import './flex.scss'; // App Component class App extends React.Component { render() { return ( <div className='layout vertical start-justified fill'> <NavBar /> <div className='flex main layout vertical'> {this.props.children} </div> <Toasts /> <Modal /> </div> ); } } App.propTypes = { children: React.PropTypes.object }; export default App;
components/GuestContainer.js
flyingant/tedxguanggu.org
/** * Created by FlyingAnt on 3/23/16. */ import React from 'react' import { Link } from 'react-router' import { connect } from 'react-redux' import styles from '../less/main.less' import cn from 'classnames'; //component import Navigator from '../components/navigator/Navigator' import ListItemBox from '../components/common/ListItemBox' import ListItemBoxWithDate from '../components/common/ListItemBoxWithDate' import ListItemDetailBox from '../components/common/ListItemDetailBox' const guest_data = [ { avatarURL: "http://flyingant.oss-cn-hangzhou.aliyuncs.com/a0fec466-96d7-41b0-8a44-c1961f74f620.png", name: "张鹏", addon: "", date: "May 8, 2015", description: "毕业于中国政法大学社会学、法学专业,获哲学、法学学士学位。现为青少年阅读推广人,忆空间阅读体验馆馆长。北京青联委员,北京博物馆学会志愿者专业委员会秘书长,四月公益博物馆志愿者协会创始人。国家博物馆、世界艺术馆义务讲解员十二年。于他,这是抗拒浮躁,传递博物之美的逆流而上。" + "<br/>“志愿者本可以也应该是一种生活方式。”" + "<br/>“即使爱好和理想在短期内不能实现,也要让它以另一种方式活着。”" }, { avatarURL: "http://flyingant.oss-cn-hangzhou.aliyuncs.com/21ed7f5f-d996-4252-aa70-94ddcf4d3793.png", name: "葛磊", addon: "", date: "May 8, 2015", description: "公益旅人,致力于青少年成长的公益服务,在清华、北大、北航、西藏大学等全国60多所高校举办过公益讲座。曾在担任中青旅社会责任总监时,策划发起国内首个系列盲人公益旅行团“听海”、“听风”、“听城”,以及面向乡村教师的“梦想旅行团”。2014年出版畅销书《台湾单车环岛笔记》。葛磊是行者,也是分享者,更是旅游与公益的嫁接者。于他,这是异想天开,又恪守本心的潇洒壮游。" + "<br/>风自磊落光明的心中来," + "<br/>自这珍贵的人间来," + "<br/>或有阻挡,或是曲折," + "<br/>但从未停歇。" + "<br/>“人生最疯狂的事情,就是相信自己。”" }, { avatarURL: "http://flyingant.oss-cn-hangzhou.aliyuncs.com/c1c045fa-a306-4ff2-8699-472a908cb700.png", name: "杜帆", addon: "", date: "May 8, 2015", description: "武汉市小动物保护协会负责人,武汉市第十三届青联委员,武汉市生命关怀人道教育幼儿公益讲师,在武汉专注动物保护工作长达九年,用自己的行动影响、感召着身边的朋友和千千万万的武汉市民,对动物给予更多的关爱和对生命的尊重。提倡人与动物,相信人与自然是相互关联,不可分割的。" + "<br/>杜帆以个人微小的坚持为开头,渐渐汇聚众人之力,细细书写了一封给流浪宠物的朴素情书。2015年,正值志愿生涯的第十年,他仍在继续,一字一句,点点心血,不敢辜负。" + "<br/>于他,这是穿行于琐杂与热忱的天真守护。" + "<br/>“救助流浪狗狗会教会我们很多事,而最重要的是,这是人类灵魂的最后良药。”" }, { avatarURL: "http://flyingant.oss-cn-hangzhou.aliyuncs.com/5c4c93a6-4285-463a-8efc-cbdb5064ec5b.png", name: "马人人", addon: "", date: "May 8, 2015", description: "上层传媒董事,副总经理,《上层》杂志主编,新媒体品牌What创始人。他文艺与毒舌齐飞,逼格共颜值一色。他是执拗专情的武汉控,他是任性诗意的生活家。在学成归汉以后的六年时间,全力以赴地与这座城市相处,更了解武汉的过程中,他慢慢发现, 武汉在他身上留下了的温度、空气、阳光和水的痕迹。" + "<br/>马人人,带你重新阅读武汉,静下心或是躁起来,都可以带你找到,与这座城市更好的,相处相知的方式。于他,这是剪烛共饮,浓谈相宜的江湖夜话。" }, { avatarURL: "http://flyingant.oss-cn-hangzhou.aliyuncs.com/47d74108-8597-4e01-9590-409f54798ec4.png", name: "刘文祥", addon: "", date: "May 8, 2015", description: "武汉大学历史学院博士研究生,数年来参与保护汉口福新第五面粉厂旧址、基督教救世堂、生活书店汉口分店旧址、汉口辅义里瞿秋白旧居、黄石下陆老火车站、宝鸡申新纱厂旧址等历史建筑。2010年拍摄纪录片《汉口,汉口》,关注武汉城市文化遗产消亡和保护问题。" + "<br/>一声来自民间的呐喊,一次追寻城市记忆的对话,一同思考,想要看到的过去与未来。于他,这是叩问工业遗产未来的素履之往。" }, { avatarURL: "http://flyingant.oss-cn-hangzhou.aliyuncs.com/e16da1ec-cba7-415e-a492-8619bd61f79e.png", name: "黄睿", addon: "", date: "May 8, 2015", description: "于2004年开始涂鸦创作,如今已是第11年,是中国涂鸦圈元老级人物,也是华中地区涂鸦代表人物。现经营一家自己的工作室,并且担任湖北美术学院涂鸦课程讲师。曾担任全国各大型涂鸦比赛评委;活动嘉宾。接受各地媒体专访、采访。作品遍布武汉三镇、全国各地(北京·上海·广州·深圳·重庆·杭州·乌鲁木齐·香港等)。" + "<br/>他思考涂鸦中的中国元素,地方特色,于是有了青铜器图腾,楚国玉器纹和疯狂的521路公交车。思考自然与城市,居民的关系,于是有了消失的松鼠,猫头鹰和江豚再现画中,隐秘批判。" + "<br/>然而,经过十一年的沉淀,反省和探索,他还想要告诉你——涂鸦不仅仅是叛逆,占领和反抗的代名词。在好的环境里,它可以是与这座城市,与这条街道的一个开诚布公的大拥抱。" + "<br/>于他,这是以创意唤醒街头的色彩交响乐。" }, ] class GuestContainer extends React.Component { constructor(props) { super(props); this.state = { overlayDisplayStatus: true, selectedGuest: null } } render() { return ( <div> <Navigator current={"guest"}/> <div className={styles.guest_container}> { guest_data.map((item, index)=> { return <ListItemBoxWithDate key={index} display={true} index={index} avatarURL={item.avatarURL} name={item.name} addon={item.addon} date={item.date} description={item.description} onSelect={this.onSelect.bind(this)}/> }) } </div> { this.state.overlayDisplayStatus && this.state.selectedGuest != null ? <div className={styles.overlay}> <div className={styles.overlay_container}> <ListItemDetailBox avatarURL={this.state.selectedGuest.avatarURL} name={this.state.selectedGuest.name} addon={this.state.selectedGuest.addon} description={this.state.selectedGuest.description}/> </div> <div className={styles.hide} onClick={this.onHideOverlay.bind(this)}> &times; </div> </div> : null } </div> ) } onSelect(index) { this.setState({ selectedGuest: guest_data[index], overlayDisplayStatus: true }) } onHideOverlay() { this.setState({ overlayDisplayStatus: false }) } } let componentState = (state) => ({ app: state.app, status: state.app.get("status") }); module.exports = connect(componentState)(GuestContainer);
example/data.js
dancormier/react-native-swipeout
import React from 'react'; import {Image} from 'react-native'; var btnsDefault = [ { text: 'Button' } ]; var btnsTypes = [ { text: 'Primary', type: 'primary', }, { text: 'Secondary', type: 'secondary', }, { text: 'Delete', type: 'delete', } ]; var rows = [ { text: "Basic Example", right: btnsDefault, }, { text: "onPress Callback", right: [ { text: 'Press Me', onPress: function(){ alert('button pressed') }, type: 'primary', } ], }, { text: "Button Types", right: btnsTypes, }, { text: "Button with custom styling", right: [ { text: 'Button', backgroundColor: '#4fba8a', color: '#17807a', underlayColor: "#006fff", } ], }, { text: "Overswipe background color (drag me far)", right: btnsDefault, backgroundColor: '#006fff', }, { text: "Swipeout autoClose={true}", right: btnsDefault, autoClose: true, }, { text: "Five buttons (full-width) + autoClose={true}", right: [ { text: 'One'}, { text: 'Two'}, { text: 'Three' }, { text: 'Four' }, { text: 'Five' } ], autoClose: true, }, { text: "Custom button component", right: [ { component: <Image style={{flex: 1}} source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}} /> } ], }, { text: "Swipe me right (buttons on left side)", left: btnsDefault, }, { text: "Buttons on both sides", left: btnsTypes, right: btnsTypes, }, ]; export default rows;
example/v9.x.x/reactnative-expo/App.js
i18next/react-i18next
import React from 'react'; import { withNamespaces } from 'react-i18next'; import { createStackNavigator, createAppContainer } from 'react-navigation'; import i18n from './js/i18n'; import Home from './js/pages/Home'; import Page2 from './js/pages/Page2'; const Stack = createStackNavigator({ Home: { screen: Home }, Page2: { screen: Page2 }, }); // Wrapping a stack with translation hoc asserts we get new render on language change // the hoc is set to only trigger rerender on languageChanged class WrappedStack extends React.Component { static router = Stack.router; render() { const { t } = this.props; return <Stack screenProps={{ t }} {...this.props} />; } } const ReloadAppOnLanguageChange = withNamespaces('common', { bindI18n: 'languageChanged', bindStore: false, })(createAppContainer(WrappedStack)); // The entry point using a react navigation stack navigation // gets wrapped by the I18nextProvider enabling using translations // https://github.com/i18next/react-i18next#i18nextprovider export default class App extends React.Component { render() { return <ReloadAppOnLanguageChange />; } }
components/front/routes.js
wi2/sails-isomorphic-react-admin-example
"use strict"; import React from 'react' import {RouteHandler, Route} from 'react-router' module.exports = ( <Route handler={RouteHandler}> <Route name="home" path="/" handler={require('./pages/home')} /> </Route> );
src/svg-icons/maps/local-pizza.js
ngbrown/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let MapsLocalPizza = (props) => ( <SvgIcon {...props}> <path d="M12 2C8.43 2 5.23 3.54 3.01 6L12 22l8.99-16C18.78 3.55 15.57 2 12 2zM7 7c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2zm5 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/> </SvgIcon> ); MapsLocalPizza = pure(MapsLocalPizza); MapsLocalPizza.displayName = 'MapsLocalPizza'; MapsLocalPizza.muiName = 'SvgIcon'; export default MapsLocalPizza;
src/common/components/img/component.js
gravitron07/brentayersV6
import React from 'react'; export default class Img extends React.Component { render() { // let path = require(this.props.source); return ( <img src="" /> ); } }
modules/IndexRoute.js
davertron/react-router
import React from 'react' import invariant from 'invariant' import warning from 'warning' import { createRouteFromReactElement } from './RouteUtils' import { component, components, falsy } from './PropTypes' const { bool, func } = React.PropTypes /** * An <IndexRoute> is used to specify its parent's <Route indexRoute> in * a JSX route config. */ const IndexRoute = React.createClass({ statics: { createRouteFromReactElement(element, parentRoute) { if (parentRoute) { parentRoute.indexRoute = createRouteFromReactElement(element) } else { warning( false, 'An <IndexRoute> does not make sense at the root of your route config' ) } } }, propTypes: { path: falsy, ignoreScrollBehavior: bool, component, components, getComponents: func }, render() { invariant( false, '<IndexRoute> elements are for router configuration only and should not be rendered' ) } }) export default IndexRoute
admin-frontend/src/app.js
BarcampBangalore/hashbeam
import React from 'react'; import { Route, Switch } from 'react-router-dom'; import Login from './components/login'; import MainScreen from './components/main-screen'; import PrivateRoute from './components/private-route'; const App = () => ( <Switch> <PrivateRoute path="/" exact component={MainScreen} /> <Route path="/login" exact component={Login} /> </Switch> ); export default App;
src/app/icons/github.js
Eric-Vandenberg/react-redux-weatherapp.io
import React from 'react'; const GithubIcon = () => ( <svg viewBox="0 0 284 277"> <g> <path fill="#fff" d="M141.888675,0.0234927555 C63.5359948,0.0234927555 0,63.5477395 0,141.912168 C0,204.6023 40.6554239,257.788232 97.0321356,276.549924 C104.12328,277.86336 106.726656,273.471926 106.726656,269.724287 C106.726656,266.340838 106.595077,255.16371 106.533987,243.307542 C67.0604204,251.890693 58.7310279,226.56652 58.7310279,226.56652 C52.2766299,210.166193 42.9768456,205.805304 42.9768456,205.805304 C30.1032937,196.998939 43.9472374,197.17986 43.9472374,197.17986 C58.1953153,198.180797 65.6976425,211.801527 65.6976425,211.801527 C78.35268,233.493192 98.8906827,227.222064 106.987463,223.596605 C108.260955,214.426049 111.938106,208.166669 115.995895,204.623447 C84.4804813,201.035582 51.3508808,188.869264 51.3508808,134.501475 C51.3508808,119.01045 56.8936274,106.353063 65.9701981,96.4165325 C64.4969882,92.842765 59.6403297,78.411417 67.3447241,58.8673023 C67.3447241,58.8673023 79.2596322,55.0538738 106.374213,73.4114319 C117.692318,70.2676443 129.83044,68.6910512 141.888675,68.63701 C153.94691,68.6910512 166.09443,70.2676443 177.433682,73.4114319 C204.515368,55.0538738 216.413829,58.8673023 216.413829,58.8673023 C224.13702,78.411417 219.278012,92.842765 217.804802,96.4165325 C226.902519,106.353063 232.407672,119.01045 232.407672,134.501475 C232.407672,188.998493 199.214632,200.997988 167.619331,204.510665 C172.708602,208.913848 177.243363,217.54869 177.243363,230.786433 C177.243363,249.771339 177.078889,265.050898 177.078889,269.724287 C177.078889,273.500121 179.632923,277.92445 186.825101,276.531127 C243.171268,257.748288 283.775,204.581154 283.775,141.912168 C283.775,63.5477395 220.248404,0.0234927555 141.888675,0.0234927555" /> </g> </svg> ); export default GithubIcon;
frontend/src/containers/DevTools/DevTools.js
chriswk/repoindexer
import React from 'react'; import { createDevTools } from 'redux-devtools'; import LogMonitor from 'redux-devtools-log-monitor'; import DockMonitor from 'redux-devtools-dock-monitor'; export default createDevTools( <DockMonitor toggleVisibilityKey="H" changePositionKey="Q"> <LogMonitor /> </DockMonitor> );
node_modules/case-sensitive-paths-webpack-plugin/demo/src/init.js
Oritechnology/pubApp
import AppRoot from './AppRoot.component.js'; import React from 'react'; import ReactDOM from 'react-dom'; const app = { initialize() { ReactDOM.render(<AppRoot/>, document.getElementById('react-app-hook')); } }; app.initialize();
app/javascript/mastodon/features/standalone/public_timeline/index.js
pixiv/mastodon
import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import StatusListContainer from '../../ui/containers/status_list_container'; import { expandPublicTimeline } from '../../../actions/timelines'; import Column from '../../../components/column'; import { defineMessages, injectIntl } from 'react-intl'; import { connectPublicStream } from '../../../actions/streaming'; import ColumnHeader from '../../../../pawoo/components/animated_timeline_column_header'; const messages = defineMessages({ title: { id: 'standalone.public_title', defaultMessage: 'A look inside...' }, }); @connect() @injectIntl export default class PublicTimeline extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; handleHeaderClick = () => { this.column.scrollTop(); } setRef = c => { this.column = c; } componentDidMount () { const { dispatch } = this.props; dispatch(expandPublicTimeline()); this.disconnect = dispatch(connectPublicStream()); } componentWillUnmount () { if (this.disconnect) { this.disconnect(); this.disconnect = null; } } handleLoadMore = maxId => { this.props.dispatch(expandPublicTimeline({ maxId })); } render () { const { intl } = this.props; return ( <Column ref={this.setRef}> <ColumnHeader icon='globe' title={intl.formatMessage(messages.title)} onClick={this.handleHeaderClick} timelineId='public' /> <StatusListContainer timelineId='public' onLoadMore={this.handleLoadMore} scrollKey='standalone_public_timeline' trackScroll={false} /> </Column> ); } }
client/components/settingsCard/index.js
DeadPackets/HackPi
import React, { Component } from 'react'; import { StyleSheet, View, Text, Dimensions, Switch, TextInput } from 'react-native' const {width, height} = Dimensions.get('window') export class SwitchSetting extends Component { constructor() { super() this.state = { value: true } } render() { return( <View style={styles.card}> <Text style={styles.setting}>{this.props.setting.title}</Text> <Switch tintColor="#094B81" onTintColor="#094B81" value={this.state.value} onChange={(e)=>{this.setState({value: !this.state.value})}}/> </View> ) } } export class TextSetting extends Component { constructor() { super() this.state = { value: '' } } render() { return( <View style={styles.card}> <Text style={styles.setting}>{this.props.setting.title}</Text> <TextInput style={styles.textInput} placeholder={this.props.setting.placeholder || ""} value={this.state.value} onChangeText={(t)=>{this.setState({value: t})}} /> </View> ) } } const styles = StyleSheet.create({ card: { paddingLeft: 15, paddingRight: 15, paddingTop: 10, paddingBottom: 15, backgroundColor: '#01223E', justifyContent: 'space-between', alignItems: 'center', flexDirection: 'row', borderBottomWidth: 1, borderBottomColor: '#00111F', width: width-30, height: 65 }, textInput: { height: 40, borderColor: '#094B81', borderWidth: 1, width: width-150, backgroundColor: '#094B81' }, setting: { fontSize: 20, color: '#094B81' }, switch: {} })
packages/icons/src/md/maps/Directions.js
suitejs/suitejs
import React from 'react'; import IconBase from '@suitejs/icon-base'; function MdDirections(props) { return ( <IconBase viewBox="0 0 48 48" {...props}> <path d="M43.405 22.585c.79.78.79 2.04.01 2.83l-18 18c-.78.78-2.05.78-2.83 0v-.01l-18-17.99c-.78-.78-.78-2.05 0-2.83l18-18c.77-.78 2.04-.78 2.82 0l18 18zm-15.41 6.41l7-7-7-7v5h-10c-1.11 0-2 .89-2 2v8h4v-6h8v5z" /> </IconBase> ); } export default MdDirections;
pnpm-cached/.pnpm-store/1/registry.npmjs.org/react-bootstrap/0.31.0/es/ModalBody.js
Akkuma/npm-cache-benchmark
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import elementType from 'react-prop-types/lib/elementType'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { componentClass: elementType }; var defaultProps = { componentClass: 'div' }; var ModalBody = function (_React$Component) { _inherits(ModalBody, _React$Component); function ModalBody() { _classCallCheck(this, ModalBody); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } ModalBody.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, props = _objectWithoutProperties(_props, ['componentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) })); }; return ModalBody; }(React.Component); ModalBody.propTypes = propTypes; ModalBody.defaultProps = defaultProps; export default bsClass('modal-body', ModalBody);
src/routes/system/ModifyPassword/index.js
daizhen256/i5xwxdoctor-web
import React from 'react' import PropTypes from 'prop-types' import {connect} from 'dva' import ModifyForm from './ModifyForm' import { Link } from 'dva/router' function ModifyPassword({ dispatch, systemModifyPassword, loading }) { const modifyFormProps = { loading, onOk(data) { dispatch({ type: `systemModifyPassword/update`, payload: data }) } } return ( <div> <ModifyForm {...modifyFormProps}></ModifyForm> </div> ) } ModifyPassword.propTypes = { systemModifyPwd: PropTypes.object, dispatch: PropTypes.func } function mapStateToProps({ systemModifyPassword, loading }) { return { systemModifyPassword, loading: loading.models.systemModifyPassword } } export default connect(mapStateToProps)(ModifyPassword)
src/icons/CheckBoxIcon.js
kiloe/ui
import React from 'react'; import Icon from '../Icon'; export default class CheckBoxIcon extends Icon { getSVG(){return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M38 6H10c-2.21 0-4 1.79-4 4v28c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM20 34L10 24l2.83-2.83L20 28.34l15.17-15.17L38 16 20 34z"/></svg>;} };
demo/react-app/src/App.js
BigFatDog/parcoords-es
import React from 'react'; import Chart from './chart'; import './App.css'; function App() { return ( <div className="App"> <Chart/> </div> ); } export default App;
app/components/Preview/Header/HeaderButton/HeaderButton.js
realgvard/telegram_theme_customizer
import React, { Component } from 'react'; import reactCSS, { hover } from 'reactcss'; import ReactDOM from 'react-dom'; class HeaderButton extends Component { // _onHintTextClick() { // const component = ReactDOM.findDOMNode(this.refs.ButtonComponent); // // console.dir(component) // // component.mouseenter(); // } // // componentDidMount() { // this.refs.container.addEventListener('mouseenter', ::this._onHintTextClick, false); // } // // componentWillUnmount() { // this.refs.container.removeEventListener('mouseenter', this._onHintTextClick); // } render() { const ButtonComponent = this.props.component; const styles = reactCSS({ 'hover': { button: { background: this.props.backgroundColor, }, }, }, this.props, this.state); const { className, style, iconStyle, ownProps } = this.props; return ( <div ref="container" className={className} style={{ transition: 'all 450ms cubic-bezier(0.23, 1, 0.32, 1)', ...style, ...styles.button }} > <ButtonComponent ref="ButtonComponent" style={iconStyle} {...ownProps} /> </div> ); } } export default hover(HeaderButton);
templates/rubix/rubix-bootstrap/src/ProgressBar.js
jeffthemaximum/Teachers-Dont-Pay-Jeff
import React from 'react'; import BProgressBar from './BProgressBar'; export default class ProgressBar extends React.Component { static propTypes = { value: React.PropTypes.number }; render() { let props = { ...this.props }; if (props.value) { props.now = props.value; delete props.value; } return <BProgressBar {...props} />; } }
packages/wix-style-react/src/AreaChart/docs/index.story.js
wix/wix-style-react
import React from 'react'; import { header, tabs, tab, description, importExample, title, divider, example, code, playground, api, testkit, } from 'wix-storybook-utils/Sections'; import { storySettings } from '../test/storySettings'; import { simpleUsage, collapsedLabelsUsage, combinedData, standardData, } from './examples'; import AreaChart from '..'; export default { category: storySettings.category, storyName: storySettings.storyName, component: AreaChart, componentPath: '..', componentProps: { data: combinedData, tooltipContent: (item, index) => [ `${item.label}`, `${item.value}$ from your orders`, ], }, exampleProps: { // Put here presets of props, for more info: // https://github.com/wix/wix-ui/blob/master/packages/wix-storybook-utils/docs/usage.md#using-list }, sections: [ header({ sourceUrl: `https://github.com/wix/wix-style-react/tree/master/src/${AreaChart.displayName}/`, component: ( <AreaChart data={standardData} tooltipContent={(item, index) => { return [`${item.label}`, `${item.value}$ from your orders`]; }} /> ), }), tabs([ tab({ title: 'Description', sections: [ description({ title: 'Description', text: 'An area chart is a way of plotting data points on a line. Often, it is used to show trend data.', }), importExample(), divider(), title('Examples'), example({ title: 'Simple Usage', text: 'A simple example with compact preview', source: simpleUsage, }), example({ title: 'Collapsed values', text: 'A simple example of collapsed values (hover on a point between some x labels)', source: collapsedLabelsUsage, }), code({ title: 'Full Interactive Preview', description: 'A non compact version of same code example as above', source: simpleUsage, }), ], }), ...[ { title: 'API', sections: [api()] }, { title: 'Testkit', sections: [testkit()] }, { title: 'Playground', sections: [playground()] }, ].map(tab), ]), ], };
src/application/App/FindSongs/FindSongs.js
AoDev/kaiku-music-player
import PropTypes from 'prop-types' import React from 'react' export default function FindSongs (props) { return ( <div className="text-center"> <h1>Your library is empty!</h1> <button className="btn-default" onClick={props.showSettings}> Start looking for songs </button> </div> ) } FindSongs.propTypes = { showSettings: PropTypes.func.isRequired }
lib/widgets/ModelEditor/views/ModelMetaArrayField.js
ExtPoint/yii2-gii
import React from 'react'; import PropTypes from 'prop-types'; import {html} from 'components'; import ModelMetaRow from './ModelMetaRow'; import './ModelMetaArrayField.less'; const bem = html.bem('ModelMetaArrayField'); class ModelMetaArrayField extends React.Component { static formId = 'ModelEditor'; static propTypes = { fields: PropTypes.object, appTypes: PropTypes.arrayOf(PropTypes.shape({ name: PropTypes.string })), isAR: PropTypes.bool, onKeyDown: PropTypes.func, }; render() { const isAR = this.props.isAR; return ( <div className={bem(bem.block(), 'form-inline')}> <div className='pull-right text-muted'> <small> Используйте&nbsp; <span className='label label-default'>Shift</span> &nbsp;+&nbsp; <span className='label label-default'>↑↓</span> &nbsp;для перехода по полям </small> </div> <h3> {isAR ? 'Attributes meta information' : 'Form fields'} </h3> <table className='table table-striped table-hover'> <thead> <tr> <th>#</th> <th>Name</th> <th>Label</th> <th>Hint</th> <th className={bem.element('th-app-types')}> Type </th> {isAR && ( <th className={bem(bem.element('th-small'), bem.element('th-default-value'))}> Default value </th> )} <th className={bem.element('th-small')}> Required </th> {isAR && ( <th className={bem(bem.element('th-small'), bem.element('th-publish'))}> Publish to frontend </th> )} <th /> </tr> </thead> <tbody> {this.props.fields.map((attribute, index) => ( <ModelMetaRow key={index} attribute={attribute} index={index} appTypes={this.props.appTypes} onKeyDown={this.props.onKeyDown} onRemove={() => this.props.fields.remove(index)} isAR={isAR} > </ModelMetaRow> ))} </tbody> </table> <div> <a className='btn btn-sm btn-default' href='javascript:void(0)' onClick={() => this.props.fields.push()} > <span className='glyphicon glyphicon-plus'/> Добавить </a> </div> </div> ); } } export default ModelMetaArrayField;
src/svg-icons/av/album.js
kasra-co/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvAlbum = (props) => ( <SvgIcon {...props}> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 14.5c-2.49 0-4.5-2.01-4.5-4.5S9.51 7.5 12 7.5s4.5 2.01 4.5 4.5-2.01 4.5-4.5 4.5zm0-5.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1z"/> </SvgIcon> ); AvAlbum = pure(AvAlbum); AvAlbum.displayName = 'AvAlbum'; AvAlbum.muiName = 'SvgIcon'; export default AvAlbum;
client/src/components/Repos/ReposConfirmDeleteAll.js
vfeskov/win-a-beer
import React from 'react' import PropTypes from 'prop-types' import Button from '@material-ui/core/Button' import DialogTitle from '@material-ui/core/DialogTitle' import DialogActions from '@material-ui/core/DialogActions' import Dialog from '@material-ui/core/Dialog' import withTheme from '@material-ui/core/styles/withTheme' function ReposConfirmDeleteAll ({ open, onClose, theme }) { return <Dialog maxWidth="xs" aria-labelledby="delete-all-confirmation-dialog-title" open={open} onClose={() => onClose(false)} > <DialogTitle id="delete-all-confirmation-dialog-title">Are you sure you want to remove all repos?</DialogTitle> <DialogActions> <Button onClick={() => onClose(false)}> No </Button> <Button onClick={() => onClose(true)} style={{ color: theme.palette.error.main }}> Yes, remove </Button> </DialogActions> </Dialog> } ReposConfirmDeleteAll.propTypes = { open: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired, theme: PropTypes.object.isRequired } export default withTheme(ReposConfirmDeleteAll)
docs/src/app/components/pages/components/Dialog/Page.js
ichiohta/material-ui
import React from 'react'; import Title from 'react-title-component'; import CodeExample from '../../../CodeExample'; import PropTypeDescription from '../../../PropTypeDescription'; import MarkdownElement from '../../../MarkdownElement'; import dialogReadmeText from './README'; import DialogExampleSimple from './ExampleSimple'; import dialogExampleSimpleCode from '!raw!./ExampleSimple'; import DialogExampleModal from './ExampleModal'; import dialogExampleModalCode from '!raw!./ExampleModal'; import DialogExampleCustomWidth from './ExampleCustomWidth'; import dialogExampleCustomWidthCode from '!raw!./ExampleCustomWidth'; import DialogExampleDialogDatePicker from './ExampleDialogDatePicker'; import dialogExampleDialogDatePickerCode from '!raw!./ExampleDialogDatePicker'; import DialogExampleScrollable from './ExampleScrollable'; import DialogExampleScrollableCode from '!raw!./ExampleScrollable'; import DialogExampleAlert from './ExampleAlert'; import DialogExampleAlertCode from '!raw!./ExampleAlert'; import dialogCode from '!raw!material-ui/Dialog/Dialog'; const DialogPage = () => ( <div> <Title render={(previousTitle) => `Dialog - ${previousTitle}`} /> <MarkdownElement text={dialogReadmeText} /> <CodeExample title="Simple dialog" code={dialogExampleSimpleCode} > <DialogExampleSimple /> </CodeExample> <CodeExample title="Modal dialog" code={dialogExampleModalCode} > <DialogExampleModal /> </CodeExample> <CodeExample title="Styled dialog" code={dialogExampleCustomWidthCode} > <DialogExampleCustomWidth /> </CodeExample> <CodeExample title="Nested dialogs" code={dialogExampleDialogDatePickerCode} > <DialogExampleDialogDatePicker /> </CodeExample> <CodeExample title="Scrollable dialog" code={DialogExampleScrollableCode} > <DialogExampleScrollable /> </CodeExample> <CodeExample title="Alert dialog" code={DialogExampleAlertCode} > <DialogExampleAlert /> </CodeExample> <PropTypeDescription code={dialogCode} /> </div> ); export default DialogPage;
test/test_helper.js
RaneWallin/FCCLeaderboard
import _$ from 'jquery'; import React from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-addons-test-utils'; import jsdom from 'jsdom'; import chai, { expect } from 'chai'; import chaiJquery from 'chai-jquery'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducers from '../src/reducers'; global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); global.window = global.document.defaultView; global.navigator = global.window.navigator; const $ = _$(window); chaiJquery(chai, chai.util, $); function renderComponent(ComponentClass, props = {}, state = {}) { const componentInstance = TestUtils.renderIntoDocument( <Provider store={createStore(reducers, state)}> <ComponentClass {...props} /> </Provider> ); return $(ReactDOM.findDOMNode(componentInstance)); } $.fn.simulate = function(eventName, value) { if (value) { this.val(value); } TestUtils.Simulate[eventName](this[0]); }; export {renderComponent, expect};
frontend/src/Settings/Notifications/Notifications/AddNotificationModalContent.js
geogolem/Radarr
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import Button from 'Components/Link/Button'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import ModalBody from 'Components/Modal/ModalBody'; import ModalContent from 'Components/Modal/ModalContent'; import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import translate from 'Utilities/String/translate'; import AddNotificationItem from './AddNotificationItem'; import styles from './AddNotificationModalContent.css'; class AddNotificationModalContent extends Component { // // Render render() { const { isSchemaFetching, isSchemaPopulated, schemaError, schema, onNotificationSelect, onModalClose } = this.props; return ( <ModalContent onModalClose={onModalClose}> <ModalHeader> {translate('AddNotification')} </ModalHeader> <ModalBody> { isSchemaFetching && <LoadingIndicator /> } { !isSchemaFetching && !!schemaError && <div> {translate('UnableToAddANewNotificationPleaseTryAgain')} </div> } { isSchemaPopulated && !schemaError && <div> <div className={styles.notifications}> { schema.map((notification) => { return ( <AddNotificationItem key={notification.implementation} implementation={notification.implementation} {...notification} onNotificationSelect={onNotificationSelect} /> ); }) } </div> </div> } </ModalBody> <ModalFooter> <Button onPress={onModalClose} > {translate('Close')} </Button> </ModalFooter> </ModalContent> ); } } AddNotificationModalContent.propTypes = { isSchemaFetching: PropTypes.bool.isRequired, isSchemaPopulated: PropTypes.bool.isRequired, schemaError: PropTypes.object, schema: PropTypes.arrayOf(PropTypes.object).isRequired, onNotificationSelect: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired }; export default AddNotificationModalContent;
node_modules/react-bootstrap/es/MediaBody.js
CallumRocks/ReduxSimpleStarter
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 'prop-types-extra/lib/elementType'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { componentClass: elementType }; var defaultProps = { componentClass: 'div' }; var MediaBody = function (_React$Component) { _inherits(MediaBody, _React$Component); function MediaBody() { _classCallCheck(this, MediaBody); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } MediaBody.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, props = _objectWithoutProperties(_props, ['componentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) })); }; return MediaBody; }(React.Component); MediaBody.propTypes = propTypes; MediaBody.defaultProps = defaultProps; export default bsClass('media-body', MediaBody);
src/components/Trend/Trend.js
Zoomdata/nhtsa-dashboard
import flowRight from 'lodash.flowright'; import React, { Component } from 'react'; import TrendChart from '../TrendChart/TrendChart'; import { observer, inject } from 'mobx-react'; import { toJS } from 'mobx'; class Trend extends Component { render() { const { store } = this.props; const data = toJS(store.chartData.yearData); const filterStatus = store.chartFilters.get('filterStatus'); return ( <div id="trend"> <TrendChart data={data} filterStatus={filterStatus} onBrushEnd={this.onBrushEnd} /> </div> ); } onBrushEnd = (selectedYears, changeFilterStatus) => { const { store } = this.props; store.queries.gridDataQuery.set(['offset'], 0); const filter = { path: 'year_string', operation: 'IN', value: selectedYears, }; store.chartFilters.set('year', selectedYears); store.queries.componentDataQuery.filters.remove(filter.path); store.queries.componentDataQuery.filters.add(filter); store.queries.metricDataQuery.filters.remove(filter.path); store.queries.metricDataQuery.filters.add(filter); store.queries.stateDataQuery.filters.remove(filter.path); store.queries.stateDataQuery.filters.add(filter); store.queries.gridDataQuery.filters.remove(filter.path); store.queries.gridDataQuery.filters.add(filter); if (changeFilterStatus) { store.chartFilters.set('filterStatus', 'FILTERS_APPLIED'); } }; } export default flowRight(inject('store'), observer)(Trend);
packages/material-ui-icons/src/GetApp.js
dsslimshaddy/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let GetApp = props => <SvgIcon {...props}> <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" /> </SvgIcon>; GetApp = pure(GetApp); GetApp.muiName = 'SvgIcon'; export default GetApp;
packages/nova-core/lib/modules/containers/withCurrentUser.js
HelloMeets/HelloMakers
import React, { Component } from 'react'; import { getFragment } from 'meteor/nova:lib'; import { graphql } from 'react-apollo'; import gql from 'graphql-tag'; const withCurrentUser = component => { return graphql( gql` query getCurrentUser { currentUser { ...UsersCurrent } } ${getFragment('UsersCurrent')} `, { alias: 'withCurrentUser', props(props) { const {data: {loading, currentUser}} = props; return { loading, currentUser, }; }, } )(component); } export default withCurrentUser;
app/javascript/mastodon/features/compose/components/upload_form.js
haleyashleypraesent/ProjectPrionosuchus
import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import IconButton from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import UploadProgressContainer from '../containers/upload_progress_container'; import Motion from 'react-motion/lib/Motion'; import spring from 'react-motion/lib/spring'; const messages = defineMessages({ undo: { id: 'upload_form.undo', defaultMessage: 'Undo' }, }); class UploadForm extends React.PureComponent { static propTypes = { media: ImmutablePropTypes.list.isRequired, onRemoveFile: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; onRemoveFile = (e) => { const id = Number(e.currentTarget.parentElement.getAttribute('data-id')); this.props.onRemoveFile(id); } render () { const { intl, media } = this.props; const uploads = media.map(attachment => <div className='compose-form__upload' key={attachment.get('id')}> <Motion defaultStyle={{ scale: 0.8 }} style={{ scale: spring(1, { stiffness: 180, damping: 12 }) }}> {({ scale }) => <div className='compose-form__upload-thumbnail' data-id={attachment.get('id')} style={{ transform: `translateZ(0) scale(${scale})`, backgroundImage: `url(${attachment.get('preview_url')})` }}> <IconButton icon='times' title={intl.formatMessage(messages.undo)} size={36} onClick={this.onRemoveFile} /> </div> } </Motion> </div> ); return ( <div className='compose-form__upload-wrapper'> <UploadProgressContainer /> <div className='compose-form__uploads-wrapper'>{uploads}</div> </div> ); } } export default injectIntl(UploadForm);
assets/javascripts/kitten/components/structure/tables/list-table/stories.js
KissKissBankBank/kitten
import React from 'react' import { createGlobalStyle } from 'styled-components' import { ListTable } from './index' import { ScreenConfig, VisuallyHidden, pxToRem, COLORS, TYPOGRAPHY, StatusWithBullet, Text, Checkbox, DropdownSelect, } from 'kitten' import { DocsPage } from 'storybook/docs-page' import { ToggleableStory } from './stories/toggleable' export default { title: 'Structure/Tables/ListTable', component: ListTable, parameters: { docs: { page: () => <DocsPage filepath={__filename} importString="ListTable" />, }, }, decorators: [story => <div className="story-Container">{story()}</div>], } const ListTableStyles = createGlobalStyle` #CustomListTable { ${TYPOGRAPHY.fontStyles.light} .k-ListTable__HeaderList { height: ${pxToRem(50)}; background-color: ${COLORS.background3}; color: ${COLORS.font1}; } } .customCol_1 { text-align: center; @media (max-width: ${pxToRem(ScreenConfig.S.max)}) { flex-basis: ${pxToRem(40)}; } @media (min-width: ${pxToRem(ScreenConfig.M.min)}) { flex-basis: ${pxToRem(60)}; } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: ${pxToRem(90)}; } } .customCol_2 { @media (max-width: ${pxToRem(ScreenConfig.S.max)}) { flex-basis: calc(90% - ${pxToRem(150)}); } @media (min-width: ${pxToRem(ScreenConfig.M.min)}) { flex-basis: calc(50% - ${pxToRem(170)}); } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: 15%; } } .customCol_3 { @media (max-width: ${pxToRem(ScreenConfig.M.max)}) { display: none; } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: 25%; } } .customCol_4 { text-align: right; @media (max-width: ${pxToRem(ScreenConfig.S.max)}) { flex-basis: 110px; } @media (min-width: ${pxToRem(ScreenConfig.M.min)}) { flex-basis: 110px; } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: 8%; } } .customCol_5 { @media (max-width: ${pxToRem(ScreenConfig.S.max)}) { flex-basis: 20%; } @media (min-width: ${pxToRem(ScreenConfig.M.min)}) { flex-basis: 20%; } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: 15%; } } .customCol_6 { @media (max-width: ${pxToRem(ScreenConfig.M.max)}) { display: none; } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: calc(33% - ${pxToRem(200)}); } } .customCol_7 { @media (max-width: ${pxToRem(ScreenConfig.S.max)}) { display: none; } @media (min-width: ${pxToRem(ScreenConfig.M.min)}) { flex-basis: 20%; } @media (min-width: ${pxToRem(ScreenConfig.L.min)}) { flex-basis: 12%; } } ` export const Default = () => ( <> <ListTableStyles /> <ListTable id="CustomListTable"> <ListTable.Header className="customHeaderClass k-u-weight-regular" listProps={{ className: 'customListClass' }} > <ListTable.Col className="customCol_1"> <VisuallyHidden>Sélection</VisuallyHidden> <Checkbox aria-label="Sélectionner toutes les contributions de la liste" /> </ListTable.Col> <ListTable.Col className="customCol_2"> <Text weight="regular" color="font1" size="small" className="k-u-hidden@s-down k-u-hidden@m" > Date </Text> <Text weight="regular" color="font1" size="small" className="k-u-hidden@l-up" > Contributeur </Text> </ListTable.Col> <ListTable.Col className="customCol_3"> <Text weight="regular" color="font1" size="small"> Contributeur </Text> </ListTable.Col> <ListTable.Col className="customCol_4"> <Text weight="regular" color="font1" size="small"> Montant </Text> </ListTable.Col> <ListTable.Col className="customCol_5"> <Text weight="regular" color="font1" size="small"> Statut </Text> </ListTable.Col> <ListTable.Col className="customCol_6"> <Text weight="regular" color="font1" size="small"> Mode de livraison </Text> </ListTable.Col> <ListTable.Col className="customCol_7"> <Text weight="regular" color="font1" size="small"> Statut livraison </Text> </ListTable.Col> </ListTable.Header> <ListTable.Body> <ListTable.Row isHighlighted> <ListTable.Col className="customCol_1"> <VisuallyHidden> <h2>Contribution #888888 par Prénom NOM le 12 septembre 2019</h2> <button>Voir plus d'informations sur cette contribution</button> </VisuallyHidden> <Checkbox aria-label="Sélectionner toutes les contributions de la liste" /> </ListTable.Col> <ListTable.Col className="customCol_2"> <div> <Text size="small" weight="regular"> <time dateTime="2019-09-12">12/09/2019</time> </Text> <br /> <Text size="micro" className="k-u-hidden@m-down" lineHeight="1"> #88888888 </Text> <Text size="micro" className="k-u-hidden@l-up" lineHeight="1"> Prénom NOM </Text> <br /> <Text size="micro" weight="regular" lineHeight="1" as="a" href="#" className="k-u-link k-u-link-primary1" > Détails </Text> </div> </ListTable.Col> <ListTable.Col className="customCol_3"> <div> <Text weight="bold">Prénom Nom</Text> <br /> <Text size="micro" weight="light"> Prenom-Nom </Text> </div> </ListTable.Col> <ListTable.Col className="customCol_4"> <Text size="small" weight="regular"> 72&nbsp;€ </Text> </ListTable.Col> <ListTable.Col className="customCol_5"> <StatusWithBullet statusType="success">Valid</StatusWithBullet> </ListTable.Col> <ListTable.Col className="customCol_6"> <Text size="small" weight="regular"> Livraison </Text> </ListTable.Col> <ListTable.Col className="customCol_7"> <DropdownSelect id="DropdownSelect_1" hideLabel labelText="Sélectionnez le statut de livraison" options={[ { label: 'À expédier', value: 1 }, { label: 'Expédié', value: 2 }, ]} /> </ListTable.Col> </ListTable.Row> <ListTable.Row className="customRowClass" listProps={{ className: 'customListClass' }} > <ListTable.Col className="customCol_1"> <VisuallyHidden> <h2>Contribution #44654 par Prénom NOM le 12 septembre 2019</h2> <button>Voir plus d'informations sur cette contribution</button> </VisuallyHidden> <Checkbox aria-label="Sélectionner toutes les contributions de la liste" /> </ListTable.Col> <ListTable.Col className="customCol_2"> <div> <Text size="small" weight="regular"> <time dateTime="2019-09-12">12/09/2019</time> </Text> <br /> <Text size="micro" className="k-u-hidden@m-down" lineHeight="1"> #44654 </Text> <Text size="micro" className="k-u-hidden@l-up" lineHeight="1"> Prénom NOM </Text> <br /> <Text size="micro" weight="regular" lineHeight="1" as="a" href="#" className="k-u-link k-u-link-primary1" > Détails </Text> </div> </ListTable.Col> <ListTable.Col className="customCol_3"> <div> <Text weight="bold">Prénom Nom</Text> <br /> <Text size="micro">Prenom-Nom</Text> </div> </ListTable.Col> <ListTable.Col className="customCol_4"> <Text size="small" weight="regular"> 72&nbsp;€ </Text> </ListTable.Col> <ListTable.Col className="customCol_5"> <StatusWithBullet statusType="warning">Invalid</StatusWithBullet> </ListTable.Col> <ListTable.Col className="customCol_6"> <Text size="small" weight="regular"> Livraison </Text> </ListTable.Col> <ListTable.Col className="customCol_7"> <DropdownSelect id="DropdownSelect_2" hideLabel labelText="Sélectionnez le statut de livraison" options={[ { label: 'À expédier', value: 1 }, { label: 'Expédié', value: 2 }, ]} /> </ListTable.Col> </ListTable.Row> </ListTable.Body> </ListTable> </> ) export const Toggleable = () => <ToggleableStory /> Toggleable.decorators = [ story => <div className="story-Container">{story()}</div>, ]
app/components/Footer/FooterStudio.js
dedywahyudi/lilly-contentful
import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router'; class RepoContributorsItem extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function render() { const item = this.props.item; const peopleLink = `/design/` + item.slug; // eslint-disable-line // console.log(item.question); // Put together the content of the repository const content = ( <li> <Link to={peopleLink}>{item.name}</Link> </li> ); // Render the content into a list item return ( <ContributorsItem key={`repo-list-item-${item.slug}`} item={content} /> ); } } RepoContributorsItem.propTypes = { item: PropTypes.any, }; class Contributors extends React.PureComponent { // eslint-disable-line render() { const items = this.props.items; const ComponentToRender = this.props.component; let content = (<div></div>); // If we have items, render them if (items) { content = items.map((item, index) => ( <ComponentToRender key={`item-${index}`} item={item} /> )); } else { // Otherwise render a single component content = (<ComponentToRender />); } // Render the content into a list item return ( <ul> {content} </ul> ); } } Contributors.propTypes = { component: PropTypes.func.isRequired, items: PropTypes.any, }; function ContributorsItem(props) { return ( (props.item) ); } ContributorsItem.propTypes = { item: PropTypes.any, }; function ContributorsList({ error, repos }) { // if (loading) { // return <Loader active />; // } if (error !== false) { const ErrorComponent = () => ( <ContributorsItem item={'Something went wrong, please try again!'} /> ); return <Contributors component={ErrorComponent} />; } if (repos !== false) { return ( <Contributors items={repos} component={RepoContributorsItem} /> ); } return null; } ContributorsList.propTypes = { error: PropTypes.any, repos: PropTypes.any, }; export default ContributorsList;
app/components/Toggle/index.js
fascinating2000/productFrontend
/** * * LocaleToggle * */ import React from 'react'; import Select from './Select'; import ToggleOption from '../ToggleOption'; function Toggle(props) { let content = (<option>--</option>); // If we have items, render them if (props.values) { content = props.values.map((value) => ( <ToggleOption key={value} value={value} message={props.messages[value]} /> )); } return ( <Select value={props.value} onChange={props.onToggle}> {content} </Select> ); } Toggle.propTypes = { onToggle: React.PropTypes.func, values: React.PropTypes.array, value: React.PropTypes.string, messages: React.PropTypes.object, }; export default Toggle;
fields/types/boolean/BooleanField.js
matthewstyers/keystone
import React from 'react'; import Field from '../Field'; import Checkbox from '../../components/Checkbox'; import { FormField } from '../../../admin/client/App/elemental'; const NOOP = () => {}; module.exports = Field.create({ displayName: 'BooleanField', statics: { type: 'Boolean', }, propTypes: { indent: React.PropTypes.bool, label: React.PropTypes.string, onChange: React.PropTypes.func.isRequired, path: React.PropTypes.string.isRequired, value: React.PropTypes.bool, }, valueChanged (value) { this.props.onChange({ path: this.props.path, value: value, }); }, renderFormInput () { if (!this.shouldRenderField()) return; return ( <input name={this.getInputName(this.props.path)} type="hidden" value={!!this.props.value} /> ); }, renderUI () { const { indent, value, label, path } = this.props; return ( <div data-field-name={path} data-field-type="boolean"> <FormField offsetAbsentLabel={indent}> <label style={{ height: '2.3em' }}> {this.renderFormInput()} <Checkbox checked={value} onChange={(this.shouldRenderField() && this.valueChanged) || NOOP} readonly={!this.shouldRenderField()} /> <span style={{ marginLeft: '.75em' }}> {label} </span> </label> {this.renderNote()} </FormField> </div> ); }, });
app/MnmNewsList.js
alvaromb/mnm
import React from 'react' import { Platform, StyleSheet, View, ListView, ActivityIndicatorIOS, ProgressBarAndroid, InteractionManager, RefreshControl, Dimensions } from 'react-native' import MnmNewsRow from './MnmNewsRow' import ThumborURLBuilder from 'thumbor-url-builder' import { THUMBOR_KEY, THUMBOR_URL} from './ThumborConfig' const screen = Dimensions.get('window') var moment = require('moment') require('moment/locale/es') moment.locale('es') class MnmPublicadas extends React.Component { getPublicadas: Function; constructor(props) { super(props) const dataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1.id !== r2.id }) this.state = { dataSource: dataSource.cloneWithRows([]), published: [], isFetching: false, } this.getPublicadas = this._getPublicadas.bind(this) } componentDidMount () { this.getPublicadas() } _getPublicadas() { InteractionManager.runAfterInteractions(() => { this.setState({isFetching: true}) fetch(this.props.url) .then(response => response.json()) .then(response => { var thumborURL = new ThumborURLBuilder(THUMBOR_KEY, THUMBOR_URL) var entries = response.objects.map((entry) => { entry.dateFromNow = moment.unix(entry.date).fromNow() if (entry.thumb) { const imagePath = escape(entry.thumb.substr(8, entry.thumb.length)) entry.mediaPublished = thumborURL.setImagePath(imagePath).resize(screen.width * screen.scale, 310).smartCrop(true).buildUrl() } return entry }); this.setState({ dataSource: this.state.dataSource.cloneWithRows(entries), published: entries, isFetching: false, }) }) .catch(() => this.setState({isFetching: false})) }) } renderRow (rowData, sectionID, rowID, highlightRow) { return ( <MnmNewsRow key={`news${rowID}`} entry={rowData} navigator={this.props.navigator} /> ) } _renderList() { if (this.state.published.length > 0) { return ( <ListView style={styles.list} initialListSize={5} dataSource={this.state.dataSource} renderRow={this.renderRow.bind(this)} automaticallyAdjustContentInsets={false} refreshControl={ <RefreshControl refreshing={this.state.isFetching} onRefresh={this.getPublicadas} /> } /> ) } else { if (Platform.OS === 'ios') { return ( <ActivityIndicatorIOS style={styles.centering} animating={true} color="#262626" size="large" /> ) } return ( <View style={styles.centering}> <ProgressBarAndroid style={styles.progressBar} color="#d35400" /> </View> ) } } render() { return ( <View style={styles.container}> {this._renderList()} </View> ) } } const styles = StyleSheet.create({ progressBar: { width: 50, height: 50, }, centering: { flex: 1, alignItems: 'center', justifyContent: 'center', }, container: { flex: 1, backgroundColor: '#FAFAFA', }, list: { flex: 1, backgroundColor: '#FAFAFA', } }) module.exports = MnmPublicadas
frontend/src/admin/common/forms/FormHeaderWithSave.js
rabblerouser/core
import React from 'react'; import { SpacedLayout } from 'layabout'; import styled from 'styled-components'; import { Button } from '../../common'; const HeaderText = styled.span` font-size: 1.1em; font-weight: bold; `; const FormHeaderWithSave = ({ children }) => ( <SpacedLayout container="header"> <HeaderText>{children}</HeaderText> <Button type="submit">Save</Button> </SpacedLayout> ); export default FormHeaderWithSave;