path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
demo/app.js
jide/react-classnames
/*global document:false*/ import React from 'react'; import classNames from '../src/classNames'; @classNames class App extends React.Component { render() { return ( <div> <div classNames='Demo'/> <div classNames={ ['main', false && 'hidden', true && 'visible'] } className='other-class'/> </div> ); } } const content = document.getElementById('content'); React.render(<App/>, content);
alcarin_frontend/src/router/App/App.js
alcarin-org/alcarin-elixir
// @flow import './App.css'; import React from 'react'; import { Route, Link } from 'react-router-dom'; import { CharacterDashboardPage } from '../../character_dashboard'; import { Socket } from '../../connection'; export default class App extends React.PureComponent<{}> { render() { return ( <Socket.SocketContext.Consumer> {socket => ( <div className="alcarin-app"> <Link to="/">Go to main page</Link> <br /> <Link to="/character-feed">Go to demo feed page</Link> <Route path="/character-feed" render={() => <CharacterDashboardPage socket={socket} />} /> </div> )} </Socket.SocketContext.Consumer> ); } }
main.js
argelius/react-onsenui-kitchensink
import React from 'react'; import ReactDOM from 'react-dom'; import ons from 'onsenui'; import { Page, Tabbar, Tab, Navigator } from 'react-onsenui'; import Home from './components/Home'; import Dialogs from './components/Dialogs'; import Forms from './components/Forms'; import Animations from './components/Animations'; class Tabs extends React.Component { renderTabs() { return [ { content: <Home key="home" navigator={this.props.navigator} />, tab: <Tab key="home" label="Home" icon="ion-ios-home-outline" /> }, { content: <Dialogs key="dialogs" navigator={this.props.navigator} />, tab: <Tab key="dialogs" label="Dialogs" icon="ion-ios-albums-outline" /> }, { content: <Forms key="forms" />, tab: <Tab key="forms" label="Forms" icon="ion-edit" /> }, { content: <Animations key="animations" navigator={this.props.navigator} />, tab: <Tab key="animations" label="Animations" icon="ion-film-marker" /> } ]; } render() { return ( <Page> <Tabbar renderTabs={this.renderTabs.bind(this)} /> </Page> ); } } class App extends React.Component { renderPage(route, navigator) { route.props = route.props || {}; route.props.navigator = navigator; return React.createElement(route.comp, route.props); } render() { return ( <Navigator initialRoute={{comp: Tabs, props: { key: 'tabs' }}} renderPage={this.renderPage} /> ); } } ReactDOM.render(<App />, document.getElementById('app'));
src/components/UserOrientationLeads.js
vitorbarbosa19/ziro-online
import React from 'react' import { Image } from 'cloudinary-react' export default () => ( <div style={{ marginBottom: '40px' }}> <Image style={{ margin: '20px 0' }} cloudName='ziro' width='40' publicId='ok-icon_bskbxm' version='1508212647' format='png' secure='true' /> <p>Seu CNPJ foi validado com sucesso!</p> <p>Agora, termine de preencher o formulário abaixo para acessar o aplicativo. É rapidinho ;)</p> </div> )
src/svg-icons/action/turned-in-not.js
pancho111203/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionTurnedInNot = (props) => ( <SvgIcon {...props}> <path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"/> </SvgIcon> ); ActionTurnedInNot = pure(ActionTurnedInNot); ActionTurnedInNot.displayName = 'ActionTurnedInNot'; ActionTurnedInNot.muiName = 'SvgIcon'; export default ActionTurnedInNot;
src/svg-icons/image/timer.js
pancho111203/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageTimer = (props) => ( <SvgIcon {...props}> <path d="M15 1H9v2h6V1zm-4 13h2V8h-2v6zm8.03-6.61l1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM12 20c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/> </SvgIcon> ); ImageTimer = pure(ImageTimer); ImageTimer.displayName = 'ImageTimer'; ImageTimer.muiName = 'SvgIcon'; export default ImageTimer;
examples/huge-apps/routes/Course/routes/Assignments/routes/Assignment/components/Assignment.js
chunwei/react-router
import React from 'react'; class Assignment extends React.Component { render () { var { courseId, assignmentId } = this.props.params; var { title, body } = COURSES[courseId].assignments[assignmentId] return ( <div> <h4>{title}</h4> <p>{body}</p> </div> ); } } export default Assignment;
app/js/components/ui/containers/shell.js
blockstack/blockstack-portal
import React from 'react' import { Type } from '@ui/components/typography' import { StyledShell } from '@ui/components/shell' import { ActionButtons } from '@ui/containers/button' import { FormContainer } from '@ui/containers/form' import { withShellContext } from '@blockstack/ui/common/withOnboardingState' import { Spring } from 'react-spring' import { Spinner } from '@ui/components/spinner' import { colors } from '@components/styled/theme' import PropTypes from 'prop-types' import { Flex, Box } from '@components/ui/components/primitives' const Shell = props => <StyledShell {...props} /> const Subtitle = ({ variant = 'h3', ...rest }) => { const SubtitleComponent = Type[variant] return <SubtitleComponent {...rest} /> } const Title = ({ children, title, subtitle, icon, variant = 'h1', ...rest }) => { const TitleComponent = Type[variant] return ( <StyledShell.Title {...rest}> {icon && <StyledShell.Title.Section>{icon}</StyledShell.Title.Section>} <StyledShell.Title.Section style={icon && { maxWidth: 'calc(100% - 40px)' }} > <StyledShell.Title.Animated> <TitleComponent>{children || title}</TitleComponent> </StyledShell.Title.Animated> {subtitle && <Subtitle {...subtitle} />} </StyledShell.Title.Section> </StyledShell.Title> ) } const Loading = ({ message = 'Loading...', children, ...rest }) => { const Content = () => ( <Box> {children || ( <Type fontSize="16px" pt={3} fontWeight={500}> {message} </Type> )} </Box> ) return ( <Spring native from={{ opacity: 0 }} to={{ opacity: 1 }}> {styles => ( <StyledShell.Loading {...rest} style={styles}> <Flex pt={3} flexDirection="column" alignItems="center" justifyContent="center" > <Spinner color={colors.blue} size={42} stroke={3} /> <Content /> </Flex> </StyledShell.Loading> )} </Spring> ) } Loading.propTypes = { message: PropTypes.node, children: PropTypes.node } Shell.Title = Title Shell.Loading = Loading Shell.Main = StyledShell.Main Shell.Content = StyledShell.Content Shell.Wrapper = StyledShell.Wrapper Shell.Actions = StyledShell.Actions Shell.Sidebar = StyledShell.Sidebar Shell.Content.Container = StyledShell.Content.Container const Content = ({ children, form, ...rest }) => ( <StyledShell.Content {...rest}> {form && <FormContainer {...form} />} {children} </StyledShell.Content> ) Content.defaultProps = { grow: 1 } Content.propTypes = { children: PropTypes.node, form: PropTypes.object, grow: PropTypes.oneOf([0, 1]).isRequired } const ShellScreenContainer = ({ title, actions, content, ...rest }) => ( <Shell.Wrapper {...rest}> {title ? <Shell.Title {...title} /> : null} <Content {...content} /> {actions ? ( <Shell.Actions> <ActionButtons {...actions} /> </Shell.Actions> ) : null} </Shell.Wrapper> ) ShellScreenContainer.propTypes = { actions: PropTypes.object, title: PropTypes.object, loading: PropTypes.object, content: PropTypes.object, titleVariation: PropTypes.oneOf(['h1', 'h2']) } Subtitle.propTypes = { variant: PropTypes.string } Title.propTypes = { children: PropTypes.node, icon: PropTypes.node, title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), variant: PropTypes.oneOf(['h1', 'h2']) } const ShellScreen = withShellContext(ShellScreenContainer) export { Shell, ShellScreen }
src/packages/recompose/__tests__/utils.js
acdlite/recompose
import React from 'react' import setDisplayName from '../setDisplayName' import wrapDisplayName from '../wrapDisplayName' export const countRenders = BaseComponent => { class CountRenders extends React.Component { renderCount = 0 render() { this.renderCount += 1 return <BaseComponent renderCount={this.renderCount} {...this.props} /> } } return setDisplayName(wrapDisplayName(BaseComponent, 'countRenders'))( CountRenders ) }
internals/templates/app.js
hieubq90/react-boilerplate-3.4.0
/** * app.js * * This is the entry file for the application, only setup and boilerplate * code. */ // Needed for redux-saga es6 generator support import 'babel-polyfill'; // Import all the third party stuff import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { applyRouterMiddleware, Router, browserHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import { useScroll } from 'react-router-scroll'; import 'sanitize.css/sanitize.css'; // Import root app import App from 'containers/App'; // Import selector for `syncHistoryWithStore` import { makeSelectLocationState } from 'containers/App/selectors'; // Import Language Provider import LanguageProvider from 'containers/LanguageProvider'; // Load the favicon, the manifest.json file and the .htaccess file /* eslint-disable import/no-unresolved, import/extensions */ import '!file-loader?name=[name].[ext]!./favicon.ico'; import '!file-loader?name=[name].[ext]!./manifest.json'; import 'file-loader?name=[name].[ext]!./.htaccess'; /* eslint-enable import/no-unresolved, import/extensions */ import configureStore from './store'; // Import i18n messages import { translationMessages } from './i18n'; // Import CSS reset and Global Styles import './global-styles'; // Import root routes import createRoutes from './routes'; // Create redux store with history // this uses the singleton browserHistory provided by react-router // Optionally, this could be changed to leverage a created history // e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();` const initialState = {}; const store = configureStore(initialState, browserHistory); // Sync history and store, as the react-router-redux reducer // is under the non-default key ("routing"), selectLocationState // must be provided for resolving how to retrieve the "route" in the state const history = syncHistoryWithStore(browserHistory, store, { selectLocationState: makeSelectLocationState(), }); // Set up the router, wrapping all Routes in the App component const rootRoute = { component: App, childRoutes: createRoutes(store), }; const render = messages => { ReactDOM.render( <Provider store={store}> <LanguageProvider messages={messages}> <Router history={history} routes={rootRoute} render={// Scroll to top when going to a new page, imitating default browser // behaviour applyRouterMiddleware(useScroll())} /> </LanguageProvider> </Provider>, document.getElementById('app') ); }; // Hot reloadable translation json files if (module.hot) { // modules.hot.accept does not accept dynamic dependencies, // have to be constants at compile-time module.hot.accept('./i18n', () => { render(translationMessages); }); } // Chunked polyfill for browsers without Intl support if (!window.Intl) { new Promise(resolve => { resolve(import('intl')); }) .then(() => Promise.all([import('intl/locale-data/jsonp/en.js')])) .then(() => render(translationMessages)) .catch(err => { throw err; }); } else { render(translationMessages); } // Install ServiceWorker and AppCache in the end since // it's not most important operation and if main code fails, // we do not want it installed if (process.env.NODE_ENV === 'production') { require('offline-plugin/runtime').install(); // eslint-disable-line global-require }
src/apps/DataObjects/DataObjectsTable/DataObjectsTableTextCell.js
Syncano/syncano-dashboard
import React from 'react'; import Truncate from '../../../common/Truncate'; const DataObjectsTableTextCell = ({ content }) => ( <Truncate text={content} title={content} /> ); export default DataObjectsTableTextCell;
HealthAndFitness.Mobile/src/app.android.js
DennisAikara/HealthAndFitness
import React from 'react'; import { Provider } from 'react-redux'; import { Navigation } from 'react-native-navigation'; import { registerScreens } from './screens'; import configureStore from './store'; import { LoadIcons, Icons } from './global/IconCache'; LoadIcons.then(() => { const store = configureStore(); registerScreens(store, Provider); const navigatorStyle = { statusBarColor: '#444', statusBarTextColorScheme: 'light', navBarHideOnScroll: false, topBarElevationShadowEnabled: false }; Navigation.startSingleScreenApp({ screen: { screen: 'DashboardScreen', title: 'Dashboard', navigatorStyle, leftButtons: [ { id: 'sideMenu' } ] }, appStyle: { orientation: 'portrait' }, drawer: { left: { screen: 'DrawerScreen' } } }); } );
src/icons/IosCart.js
fbfeix/react-icons
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class IosCart extends React.Component { render() { if(this.props.bare) { return <g> <g> <path d="M160,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S173.248,400,160,400z"></path> <path d="M384.5,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S397.748,400,384.5,400z"></path> <path d="M448,128L123.177,95.646c-1.628-6.972-4.369-14.66-11.838-20.667C102.025,67.489,86.982,64,64,64v16.001 c18.614,0,31.167,2.506,37.312,7.447c4.458,3.585,5.644,8.423,7.165,15.989l-0.024,0.004l42.052,233.638 c2.413,14.422,7.194,25.209,13.291,32.986C171.043,379.312,180.533,384,192,384h240v-16H192c-4.727,0-19.136,0.123-25.749-33.755 l-5.429-30.16L432,256L448,128z"></path> </g> </g>; } return <IconBase> <g> <path d="M160,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S173.248,400,160,400z"></path> <path d="M384.5,400c-13.248,0-24,10.752-24,24s10.752,24,24,24s24-10.752,24-24S397.748,400,384.5,400z"></path> <path d="M448,128L123.177,95.646c-1.628-6.972-4.369-14.66-11.838-20.667C102.025,67.489,86.982,64,64,64v16.001 c18.614,0,31.167,2.506,37.312,7.447c4.458,3.585,5.644,8.423,7.165,15.989l-0.024,0.004l42.052,233.638 c2.413,14.422,7.194,25.209,13.291,32.986C171.043,379.312,180.533,384,192,384h240v-16H192c-4.727,0-19.136,0.123-25.749-33.755 l-5.429-30.16L432,256L448,128z"></path> </g> </IconBase>; } };IosCart.defaultProps = {bare: false}
src/svg-icons/device/screen-lock-portrait.js
ngbrown/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceScreenLockPortrait = (props) => ( <SvgIcon {...props}> <path d="M10 16h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2v1h-2.4v-1zM17 1H7c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 18H7V5h10v14z"/> </SvgIcon> ); DeviceScreenLockPortrait = pure(DeviceScreenLockPortrait); DeviceScreenLockPortrait.displayName = 'DeviceScreenLockPortrait'; DeviceScreenLockPortrait.muiName = 'SvgIcon'; export default DeviceScreenLockPortrait;
assets/jqwidgets/demos/react/app/kanban/headertemplate/app.js
juannelisalde/holter
import React from 'react'; import ReactDOM from 'react-dom'; import JqxKanban from '../../../jqwidgets-react/react_jqxkanban.js'; import JqxInput from '../../../jqwidgets-react/react_jqxinput.js'; class App extends React.Component { componentDidMount() { this.refs.myKanban.on('itemAttrClicked', (event) => { let args = event.args; if (args.attribute == 'template') { this.refs.myKanban.removeItem(args.item.id); } }); let itemIndex = 0; this.refs.myKanban.on('columnAttrClicked', (event) => { let args = event.args; if (args.attribute == 'button') { args.cancelToggle = true; if (!args.column.collapsed) { let colors = ['#f19b60', '#5dc3f0', '#6bbd49', '#dddddd']; this.refs.myKanban.addItem({ status: args.column.dataField, text: '<div id="newItem' + itemIndex + '"/>', tags: 'new task', color: colors[Math.floor(Math.random() * 4)], resourceId: Math.floor(Math.random() * 4) }); let container = document.getElementById('newItem' + itemIndex); let myInput = ReactDOM.render( <JqxInput width={'96%'} height={20} placeHolder={'(No Title)'} />, container); container.addEventListener('keydown', (event) => { if (event.keyCode == 13) { const element = <span>{myInput.val()}</span>; ReactDOM.render(element, container); } }, true); myInput.focus(); itemIndex++; } } }); } render() { let fields = [ { name: 'id', type: 'string' }, { name: 'status', map: 'state', type: 'string' }, { name: 'text', map: 'label', type: 'string' }, { name: 'tags', type: 'string' }, { name: 'color', map: 'hex', type: 'string' }, { name: 'resourceId', type: 'number' } ]; let source = { localData: [ { id: '1161', state: 'new', label: 'Make a new Dashboard', tags: 'dashboard', hex: '#36c7d0', resourceId: 3 }, { id: '1645', state: 'work', label: 'Prepare new release', tags: 'release', hex: '#ff7878', resourceId: 1 }, { id: '9213', state: 'new', label: 'One item added to the cart', tags: 'cart', hex: '#96c443', resourceId: 3 }, { id: '6546', state: 'done', label: 'Edit Item Price', tags: 'price, edit', hex: '#ff7878', resourceId: 4 }, { id: '9034', state: 'new', label: 'Login 404 issue', tags: 'issue, login', hex: '#96c443' } ], dataType: 'array', dataFields: fields }; let dataAdapter = new $.jqx.dataAdapter(source); let resourcesAdapterFunc = () => { let resourcesSource = { localData: [ { id: 0, name: 'No name', image: '../../jqwidgets/styles/images/common.png', common: true }, { id: 1, name: 'Andrew Fuller', image: '../../images/andrew.png' }, { id: 2, name: 'Janet Leverling', image: '../../images/janet.png' }, { id: 3, name: 'Steven Buchanan', image: '../../images/steven.png' }, { id: 4, name: 'Nancy Davolio', image: '../../images/nancy.png' }, { id: 5, name: 'Michael Buchanan', image: '../../images/Michael.png' }, { id: 6, name: 'Margaret Buchanan', image: '../../images/margaret.png' }, { id: 7, name: 'Robert Buchanan', image: '../../images/robert.png' }, { id: 8, name: 'Laura Buchanan', image: '../../images/Laura.png' }, { id: 9, name: 'Laura Buchanan', image: '../../images/Anne.png' } ], dataType: 'array', dataFields: [ { name: 'id', type: 'number' }, { name: 'name', type: 'string' }, { name: 'image', type: 'string' }, { name: 'common', type: 'boolean' } ] }; let resourcesDataAdapter = new $.jqx.dataAdapter(resourcesSource); return resourcesDataAdapter; } let getIconClassName = () => { switch (theme) { case 'darkblue': case 'black': case 'shinyblack': case 'ui-le-frog': case 'metrodark': case 'orange': case 'darkblue': case 'highcontrast': case 'ui-sunny': case 'ui-darkness': return 'jqx-icon-plus-alt-white '; } return 'jqx-icon-plus-alt'; } let template = '<div class="jqx-kanban-item" id="">' + '<div class="jqx-kanban-item-color-status"></div>' + '<div style="display: none;" class="jqx-kanban-item-avatar"></div>' + '<div class="jqx-icon jqx-icon-close jqx-kanban-item-template-content jqx-kanban-template-icon"></div>' + '<div class="jqx-kanban-item-text"></div>' + '<div style="display: none;" class="jqx-kanban-item-footer"></div>' + '</div>'; let columns = [ { text: 'Backlog', iconClassName: getIconClassName(), dataField: 'new', maxItems: 4 }, { text: 'In Progress', iconClassName: getIconClassName(), dataField: 'work', maxItems: 2 }, { text: 'Done', iconClassName: getIconClassName(), dataField: 'done', maxItems: 5 } ]; let itemRenderer = (element, item, resource) => { element[0].getElementsByClassName('jqx-kanban-item-color-status')[0].innerHTML = '<span style="line-height: 23px; margin-left: 5px;">' + resource.name + '</span>'; element[0].getElementsByClassName('jqx-kanban-item-text')[0].style.background = item.color; }; let columnRenderer = (element, collapsedElement, column) => { setTimeout(() => { let columnItems = this.refs.myKanban.getColumnItems(column.dataField).length; // update header's status. element.find('.jqx-kanban-column-header-status').html(' (' + columnItems + '/' + column.maxItems + ')'); // update collapsed header's status. collapsedElement.find('.jqx-kanban-column-header-status').html(' (' + columnItems + '/' + column.maxItems + ')'); }); }; return ( <JqxKanban ref='myKanban' template={template} height={600} resources={resourcesAdapterFunc()} source={dataAdapter} columns={columns} columnRenderer={columnRenderer} itemRenderer={itemRenderer} /> ) } } ReactDOM.render(<App />, document.getElementById('app'));
src/components/Articles/List.js
mcnamee/react-native-starter-app
import React from 'react'; import PropTypes from 'prop-types'; import { Actions } from 'react-native-router-flux'; import { FlatList, TouchableOpacity, Image } from 'react-native'; import { Container, Card, CardItem, Body, Text, Button, } from 'native-base'; import { Error, Spacer } from '../UI'; import { errorMessages } from '../../constants/messages'; const ArticlesList = ({ error, loading, listFlat, reFetch, meta, }) => { if (error) { return <Error content={error} tryAgain={reFetch} />; } if (listFlat.length < 1) { return <Error content={errorMessages.articlesEmpty} />; } return ( <Container style={{ padding: 10 }}> <FlatList data={listFlat} onRefresh={() => reFetch({ forceSync: true })} refreshing={loading} renderItem={({ item }) => ( <Card style={{ opacity: item.placeholder ? 0.3 : 1 }}> <TouchableOpacity activeOpacity={0.8} onPress={() => ( !item.placeholder ? Actions.articlesSingle({ id: item.id, title: item.name }) : null )} style={{ flex: 1 }} > <CardItem cardBody> {!!item.image && ( <Image source={{ uri: item.image }} style={{ height: 100, width: null, flex: 1, overflow: 'hidden', borderRadius: 5, borderBottomLeftRadius: 0, borderBottomRightRadius: 0, }} /> )} </CardItem> <CardItem cardBody> <Body style={{ paddingHorizontal: 15 }}> <Spacer size={10} /> <Text style={{ fontWeight: '800' }}>{item.name}</Text> <Spacer size={15} /> {!!item.excerpt && <Text>{item.excerpt}</Text>} <Spacer size={5} /> </Body> </CardItem> </TouchableOpacity> </Card> )} keyExtractor={(item) => `${item.id}-${item.name}`} ListFooterComponent={(meta && meta.page && meta.lastPage && meta.page < meta.lastPage) ? () => ( <React.Fragment> <Spacer size={20} /> <Button block bordered onPress={() => reFetch({ incrementPage: true })} > <Text>Load More</Text> </Button> </React.Fragment> ) : null} /> <Spacer size={20} /> </Container> ); }; ArticlesList.propTypes = { error: PropTypes.string, loading: PropTypes.bool, listFlat: PropTypes.arrayOf( PropTypes.shape({ placeholder: PropTypes.bool, id: PropTypes.number, name: PropTypes.string, date: PropTypes.string, content: PropTypes.string, excerpt: PropTypes.string, image: PropTypes.string, }), ), reFetch: PropTypes.func, meta: PropTypes.shape({ page: PropTypes.number, lastPage: PropTypes.number }), }; ArticlesList.defaultProps = { listFlat: [], error: null, reFetch: null, meta: { page: null, lastPage: null }, loading: false, }; export default ArticlesList;
js/jqwidgets/jqwidgets-react/react_jqxtreemap.js
luissancheza/sice
/* jQWidgets v5.3.2 (2017-Sep) Copyright (c) 2011-2017 jQWidgets. License: http://jqwidgets.com/license/ */ import React from 'react'; const JQXLite = window.JQXLite; export const jqx = window.jqx; export default class JqxTreeMap extends React.Component { componentDidMount() { let options = this.manageAttributes(); this.createComponent(options); }; manageAttributes() { let properties = ['baseColor','colorRanges','colorRange','colorMode','displayMember','height','hoverEnabled','headerHeight','legendLabel','legendPosition','legendScaleCallback','renderCallbacks','selectionEnabled','showLegend','source','theme','valueMember','width']; let options = {}; for(let item in this.props) { if(item === 'settings') { for(let itemTwo in this.props[item]) { options[itemTwo] = this.props[item][itemTwo]; } } else { if(properties.indexOf(item) !== -1) { options[item] = this.props[item]; } } } return options; }; createComponent(options) { if(!this.style) { for (let style in this.props.style) { JQXLite(this.componentSelector).css(style, this.props.style[style]); } } if(this.props.className !== undefined) { let classes = this.props.className.split(' '); for (let i = 0; i < classes.length; i++ ) { JQXLite(this.componentSelector).addClass(classes[i]); } } JQXLite(this.componentSelector).css('margin-left', '1px'); if(!this.template) { JQXLite(this.componentSelector).html(this.props.template); } JQXLite(this.componentSelector).jqxTreeMap(options); }; setOptions(options) { JQXLite(this.componentSelector).jqxTreeMap('setOptions', options); }; getOptions() { if(arguments.length === 0) { throw Error('At least one argument expected in getOptions()!'); } let resultToReturn = {}; for(let i = 0; i < arguments.length; i++) { resultToReturn[arguments[i]] = JQXLite(this.componentSelector).jqxTreeMap(arguments[i]); } return resultToReturn; }; on(name,callbackFn) { JQXLite(this.componentSelector).on(name,callbackFn); }; off(name) { JQXLite(this.componentSelector).off(name); }; baseColor(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('baseColor', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('baseColor'); } }; colorRanges(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('colorRanges', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('colorRanges'); } }; colorRange(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('colorRange', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('colorRange'); } }; colorMode(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('colorMode', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('colorMode'); } }; displayMember(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('displayMember', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('displayMember'); } }; height(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('height', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('height'); } }; hoverEnabled(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('hoverEnabled', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('hoverEnabled'); } }; headerHeight(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('headerHeight', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('headerHeight'); } }; legendLabel(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('legendLabel', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('legendLabel'); } }; legendPosition(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('legendPosition', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('legendPosition'); } }; legendScaleCallback(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('legendScaleCallback', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('legendScaleCallback'); } }; renderCallbacks(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('renderCallbacks', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('renderCallbacks'); } }; selectionEnabled(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('selectionEnabled', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('selectionEnabled'); } }; showLegend(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('showLegend', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('showLegend'); } }; source(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('source', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('source'); } }; theme(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('theme', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('theme'); } }; valueMember(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('valueMember', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('valueMember'); } }; width(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxTreeMap('width', arg) } else { return JQXLite(this.componentSelector).jqxTreeMap('width'); } }; destroy() { JQXLite(this.componentSelector).jqxTreeMap('destroy'); }; performRender() { JQXLite(this.componentSelector).jqxTreeMap('render'); }; render() { let id = 'jqxTreeMap' + JQXLite.generateID(); this.componentSelector = '#' + id; return ( <div id={id}>{this.props.value}{this.props.children}</div> ) }; };
src/components/Icons/Share.js
bogas04/SikhJS
import React from 'react'; import SVG from './SVG'; export default props => ( <SVG viewBox="0 0 507.45 507.45" enableBackground="new 0 0 507.45 507.45" fill="black" {...props} > <g> <g id="share-alt"> <path d="M408,178.5c-20.4,0-38.25,7.65-51,20.4L175.95,94.35c2.55-5.1,2.55-12.75,2.55-17.85C178.5,33.15,145.35,0,102,0 S25.5,33.15,25.5,76.5S58.65,153,102,153c20.4,0,38.25-7.65,51-20.4l181.05,104.55c-2.55,5.1-2.55,12.75-2.55,17.85 c0,5.1,0,12.75,2.55,17.85L153,379.95c-12.75-12.75-30.6-20.4-51-20.4c-40.8,0-73.95,33.15-73.95,73.95S61.2,507.45,102,507.45 s73.95-33.15,73.95-73.95c0-5.1,0-10.2-2.55-17.85L354.45,308.55c12.75,12.75,30.6,20.4,51,20.4c43.35,0,76.5-33.15,76.5-76.5 C481.95,209.1,451.35,178.5,408,178.5z" /> </g> </g> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> <g/> </SVG> );
src/parser/shared/modules/items/bfa/GildedLoaFigurine.js
ronaldpereira/WoWAnalyzer
import React from 'react'; import SPELLS from 'common/SPELLS/index'; import ITEMS from 'common/ITEMS/index'; import Analyzer from 'parser/core/Analyzer'; import UptimeIcon from 'interface/icons/Uptime'; import PrimaryStatIcon from 'interface/icons/PrimaryStat'; import ItemStatistic from 'interface/statistics/ItemStatistic'; import BoringItemValueText from 'interface/statistics/components/BoringItemValueText'; import { formatPercentage, formatNumber } from 'common/format'; import { calculatePrimaryStat } from 'common/stats'; /** * Gilded Loa Figurine - * Equip: Your spells and abilities have a chance to increase your primary stat by 814 for 10 sec. * * Test Log(int): https://www.warcraftlogs.com/reports/7Bzx2VWX9TPtYGdK#fight=48&type=damage-done&source=6 * Test Log(agi): https://www.warcraftlogs.com/reports/JRYakMh4PyVtBxFq#fight=8&type=damage-done&source=270 * Test log(str): https://www.warcraftlogs.com/reports/rw2H3AKDfN1ghv4B#fight=3&type=damage-done&source=24 */ class GildedLoaFigurine extends Analyzer { statBuff = 0; constructor(...args) { super(...args); this.active = this.selectedCombatant.hasTrinket(ITEMS.GILDED_LOA_FIGURINE.id); if(this.active) { this.statBuff = calculatePrimaryStat(280, 676, this.selectedCombatant.getItem(ITEMS.GILDED_LOA_FIGURINE.id).itemLevel); } } get buffTriggerCount() { return this.selectedCombatant.getBuffTriggerCount(SPELLS.WILL_OF_THE_LOA.id); } get totalBuffUptime() { return this.selectedCombatant.getBuffUptime(SPELLS.WILL_OF_THE_LOA.id) / this.owner.fightDuration; } statistic() { return ( <ItemStatistic size="flexible" tooltip={`Procced ${this.buffTriggerCount} times`} > <BoringItemValueText item={ITEMS.GILDED_LOA_FIGURINE}> <UptimeIcon /> {formatPercentage(this.totalBuffUptime)}% uptime<br /> <PrimaryStatIcon stat={this.selectedCombatant.spec.primaryStat} /> {formatNumber(this.totalBuffUptime * this.statBuff)} <small>average {this.selectedCombatant.spec.primaryStat} gained</small> </BoringItemValueText> </ItemStatistic> ); } } export default GildedLoaFigurine;
frontend/src/System/Tasks/Scheduled/ScheduledTasks.js
geogolem/Radarr
import PropTypes from 'prop-types'; import React from 'react'; import FieldSet from 'Components/FieldSet'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import Table from 'Components/Table/Table'; import TableBody from 'Components/Table/TableBody'; import translate from 'Utilities/String/translate'; import ScheduledTaskRowConnector from './ScheduledTaskRowConnector'; const columns = [ { name: 'name', label: translate('Name'), isVisible: true }, { name: 'interval', label: translate('Interval'), isVisible: true }, { name: 'lastExecution', label: translate('LastExecution'), isVisible: true }, { name: 'lastDuration', label: translate('LastDuration'), isVisible: true }, { name: 'nextExecution', label: translate('NextExecution'), isVisible: true }, { name: 'actions', isVisible: true } ]; function ScheduledTasks(props) { const { isFetching, isPopulated, items } = props; return ( <FieldSet legend={translate('Scheduled')}> { isFetching && !isPopulated && <LoadingIndicator /> } { isPopulated && <Table columns={columns} > <TableBody> { items.map((item) => { return ( <ScheduledTaskRowConnector key={item.id} {...item} /> ); }) } </TableBody> </Table> } </FieldSet> ); } ScheduledTasks.propTypes = { isFetching: PropTypes.bool.isRequired, isPopulated: PropTypes.bool.isRequired, items: PropTypes.array.isRequired }; export default ScheduledTasks;
frontend/src/Components/MonitorToggleButton.js
geogolem/Radarr
import classNames from 'classnames'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; import { icons } from 'Helpers/Props'; import styles from './MonitorToggleButton.css'; function getTooltip(monitored, isDisabled) { if (isDisabled) { return 'Cannot toggle monitored state when movie is unmonitored'; } if (monitored) { return 'Monitored, click to unmonitor'; } return 'Unmonitored, click to monitor'; } class MonitorToggleButton extends Component { // // Listeners onPress = (event) => { const shiftKey = event.nativeEvent.shiftKey; this.props.onPress(!this.props.monitored, { shiftKey }); } // // Render render() { const { className, monitored, isDisabled, isSaving, size, ...otherProps } = this.props; const iconName = monitored ? icons.MONITORED : icons.UNMONITORED; return ( <SpinnerIconButton className={classNames( className, isDisabled && styles.isDisabled )} name={iconName} size={size} title={getTooltip(monitored, isDisabled)} isDisabled={isDisabled} isSpinning={isSaving} {...otherProps} onPress={this.onPress} /> ); } } MonitorToggleButton.propTypes = { className: PropTypes.string.isRequired, monitored: PropTypes.bool.isRequired, size: PropTypes.number, isDisabled: PropTypes.bool.isRequired, isSaving: PropTypes.bool.isRequired, onPress: PropTypes.func.isRequired }; MonitorToggleButton.defaultProps = { className: styles.toggleButton, isDisabled: false, isSaving: false }; export default MonitorToggleButton;
packages/material-ui-icons/src/MoveToInbox.js
cherniavskii/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <g><path d="M19 3H4.99c-1.11 0-1.98.9-1.98 2L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19v10zm-3-5h-2V7h-4v3H8l4 4 4-4z" /></g> , 'MoveToInbox');
src/app.js
CyberKronos/social-trading-web-app
import React from 'react' import ReactDOM from 'react-dom' import 'bootstrap/dist/css/bootstrap.css' import './app.css' import App from 'containers/App/App' import {browserHistory} from 'react-router' import makeRoutes from './routes' import firebase from 'firebase'; import config from '../config.json'; const fbConfig = { apiKey: config.firebase.apiKey, authDomain: config.firebase.authDomain, databaseURL: config.firebase.databaseURL, storageBucket: config.firebase.storageBucket, }; firebase.initializeApp(fbConfig); const routes = makeRoutes() const mountNode = document.querySelector('#root'); ReactDOM.render( <App history={browserHistory} routes={routes} />, mountNode);
src/components/main/OrderForm.js
samihda/pizza
/* eslint-disable react/no-set-state */ import React from 'react'; import assign from 'object-assign'; const sizeOpts = [20, 30, 40]; const ingredientOpts = ['Tomato Sauce', 'Mozzarella', 'Cheese', 'Salami', 'Mushrooms', 'Spinach']; export default class OrderForm extends React.Component { constructor(props) { super(props); this.state = { size: props.form.size, ingredients: props.form.ingredients, selectedIngredient: '', rand: props.form.rand }; this.handleSizeChange = this.handleSizeChange.bind(this); this.handleIngredientChange = this.handleIngredientChange.bind(this); this.addIngredient = this.addIngredient.bind(this); this.removeIngredient = this.removeIngredient.bind(this); this.handleRandChange = this.handleRandChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } handleSizeChange(e) { this.setState({ size: e.target.value }); } handleIngredientChange(e) { this.setState({ selectedIngredient: e.target.value }); } addIngredient() { const state = this.state; if (state.selectedIngredient === '') { return; } else if (state.ingredients.find((ing) => ing === state.selectedIngredient)) { return; } const newArr = [...state.ingredients, state.selectedIngredient]; this.setState({ ingredients: newArr }); } removeIngredient(e) { const newArr = this.state.ingredients.slice(); newArr.splice(newArr.indexOf(e.target.value), 1); this.setState({ ingredients: newArr }); } handleRandChange(e) { this.setState({ rand: e.target.checked }); } handleSubmit(e) { e.preventDefault(); const obj = assign({}, { size: parseInt(this.state.size, 10), ingredients: this.state.ingredients, rand: this.state.rand }); this.props.updateForm(obj); this.props.onNextClick(); } render() { return ( <main> <form onSubmit={this.handleSubmit} className="pure-form pure-form-stacked"> <div className="paper-white"> <h1>Your Order</h1> <strong>Choose Pizza size in cm</strong> <div className="pizza-container"> {sizeOpts.map((size, i) => ( <div key={i} className="pizza-child"> <label> <input name="size" type="radio" value={size} checked={size == this.state.size} onChange={this.handleSizeChange} /> <div className={'pizza-size-' + size}> <strong>{size}</strong> </div> </label> </div> ))} </div> <label> <strong>Ingredients</strong> <div className="pure-g"> <div className="pure-u-5-6"> <select id="ingredients" value={this.state.selectedIngredient} onChange={this.handleIngredientChange} className="pure-input-1" > <option value="">Choose Ingredients</option> {ingredientOpts.map((str, i) => ( <option key={i} value={str}>{str}</option> ))} </select> </div> <div className="pure-u-1-6"> <button type="button" onClick={this.addIngredient} className="pure-input-1 plus-button pure-button"> <img src={require('../../assets/icons/add_icon.png')} /> </button> </div> </div> <div className="ingredient-container"> {this.state.ingredients.map((ing, i) => ( <button type="button" key={i} value={ing} onClick={this.removeIngredient} className="ingredient pure-button"> <span>{ing}</span> <img className="icon-right" src={require('../../assets/icons/cancel_small.png')} /> </button> ))} </div> </label> <label> <strong>Cheese rand? </strong> <input id="rand" type="checkbox" checked={this.state.rand} onChange={this.handleRandChange} /> <div className="rand-switch"> <div className="rand-switch-inner"></div> </div> </label> </div> <div className="paper-white"> <button className="button-red pure-button"> <span>Next</span> <img className="icon-right" src={require('../../assets/icons/next_icon.png')} /> </button> </div> </form> </main> ); } } OrderForm.propTypes = { onNextClick: React.PropTypes.func.isRequired, updateForm: React.PropTypes.func.isRequired, form: React.PropTypes.shape({ size: React.PropTypes.number.isRequired, ingredients: React.PropTypes.arrayOf(React.PropTypes.string).isRequired, rand: React.PropTypes.bool.isRequired, firstName: React.PropTypes.string.isRequired, lastName: React.PropTypes.string.isRequired, street: React.PropTypes.string.isRequired, houseNumber: React.PropTypes.string.isRequired, postCode: React.PropTypes.string.isRequired, city: React.PropTypes.string.isRequired }).isRequired };
docs/src/examples/collections/Grid/Variations/GridExampleTextAlignmentRight.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Grid, Menu } from 'semantic-ui-react' const GridExampleTextAlignmentRight = () => ( <Grid textAlign='right' columns={3}> <Grid.Row> <Grid.Column> <Menu fluid vertical> <Menu.Item className='header'>Cats</Menu.Item> </Menu> </Grid.Column> <Grid.Column> <Menu fluid vertical> <Menu.Item className='header'>Dogs</Menu.Item> <Menu.Item>Poodle</Menu.Item> <Menu.Item>Cockerspaniel</Menu.Item> </Menu> </Grid.Column> <Grid.Column> <Menu fluid vertical> <Menu.Item className='header'>Monkeys</Menu.Item> </Menu> </Grid.Column> </Grid.Row> </Grid> ) export default GridExampleTextAlignmentRight
react-dev/containers/header.js
WDTAnyMore/WDTAnyMore.github.io
import React, { Component } from 'react'; import classnames from 'classnames'; import { connect } from 'react-redux'; import AppBar from 'material-ui/AppBar'; import { fetchSiteInfo } from '../actions/index'; import Menu from '../components/menu'; import { RightBar } from '../components/right_menu_bar'; class Header extends Component { constructor(props) { super(props); this.state = { open: false, width: 1200, height: null }; } //push out menu for static post content toggleStaticPostContent = () => { const staticContent = document.getElementById('single-post-content'); if (staticContent) { staticContent.classList.toggle('expanded'); } } // items for the menu, add or remove depending on your routes handleToggle = () => { this.setState({ open: !this.state.open }); this.toggleStaticPostContent(); }; hideMenuButton = () => { if (this.state.open) { return false; } return true; } render() { return ( <div> <AppBar className='app-bar' onLeftIconButtonTouchTap={this.handleToggle} showMenuIconButton={this.hideMenuButton()} iconElementRight={ <RightBar config={this.props.config} handleThemeSwitch={this.props.handleThemeSwitch} />} /> <Menu open={this.state.open} handleToggle={this.handleToggle} config={this.props.config} location={this.props.location} /> {<div className={classnames('app-content', { expanded: this.state.open })}> { this.props.children } </div>} </div> ); } } function mapStateToProps(state) { return { config: state.siteInfo.all }; } export default connect(mapStateToProps, { fetchSiteInfo })(Header);
src/components/header.js
ak1103dev/ak1103dev.github.io
import { Link } from 'gatsby' import PropTypes from 'prop-types' import React from 'react' const Header = ({ siteTitle }) => ( <div style={{ background: `rebeccapurple`, marginBottom: `1.45rem`, }} > <div style={{ margin: `0 auto`, maxWidth: 960, padding: `1.45rem 1.0875rem`, }} > <h1 style={{ margin: 0 }}> <Link to="/" style={{ color: `white`, textDecoration: `none`, }} > {siteTitle} </Link> </h1> </div> </div> ) Header.propTypes = { siteTitle: PropTypes.string, } Header.defaultProps = { siteTitle: ``, } export default Header
ui/modules/www/router.js
sinemetu1/chronos
// import import React from 'react'; import {Provider} from 'react-redux'; import {syncHistoryWithStore} from 'react-router-redux'; import {Router, Route, Redirect, browserHistory} from 'react-router'; import store from './store'; // routes import AppRoute from './AppRoute/AppRoute.js'; import JobUpdateRoute from './JobUpdateRoute/JobUpdateRoute.js'; import JobCreateRoute from './JobCreateRoute/JobCreateRoute.js'; import JobsRoute from './JobsRoute/JobsRoute.js'; // export export const routes = ( <Route component={AppRoute}> <Redirect path="/" to="/jobs"/> <Redirect path="/job" to="/jobs"/> <Route path="/jobs" component={JobsRoute}/> <Route path="/job/create" component={JobCreateRoute}/> <Route path="/job/:id" components={JobUpdateRoute}/> <Redirect path="/*" to="/jobs"/> </Route> ); export default ( <Provider store={store}> <Router history={syncHistoryWithStore(browserHistory, store)} routes={routes}/> </Provider> );
src/svg-icons/toggle/star.js
mtsandeep/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ToggleStar = (props) => ( <SvgIcon {...props}> <path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/> </SvgIcon> ); ToggleStar = pure(ToggleStar); ToggleStar.displayName = 'ToggleStar'; ToggleStar.muiName = 'SvgIcon'; export default ToggleStar;
src/client/components/todos/newtodo.js
fabriciocolombo/este
import PureComponent from '../../../lib/purecomponent'; import React from 'react'; import immutable from 'immutable'; import {addTodo, onNewTodoFieldChange} from '../../todos/actions'; import {addons} from 'react/addons'; import {msg} from '../../intl/store'; export default class NewTodo extends PureComponent { addTodoOnEnter(e) { if (e.key === 'Enter') addTodo(this.props.todo); } render() { return ( <input autoFocus className="new-todo" name="title" onChange={onNewTodoFieldChange} onKeyDown={(e) => this.addTodoOnEnter(e)} placeholder={msg('todos.newTodoPlaceholder')} value={this.props.todo.get('title')} /> ); } } NewTodo.propTypes = { todo: React.PropTypes.instanceOf(immutable.Map) };
src/navigation/tabs.js
LancCJ/react-native-cyber-police
/** * Tabs Scenes * * React Native Starter App * https://github.com/mcnamee/react-native-starter-app */ import React from 'react'; import { Scene } from 'react-native-router-flux'; // Consts and Libs import { AppConfig } from '@constants/'; import { AppStyles, AppSizes } from '@theme/'; // Components import { TabIcon } from '@ui/'; import { NavbarMenuButton } from '@containers/ui/NavbarMenuButton/NavbarMenuButtonContainer'; // Scenes import Placeholder from '@components/general/Placeholder'; import StyleGuide from '@containers/StyleGuideView'; import Recipes from '@containers/recipes/Browse/BrowseContainer'; import RecipeView from '@containers/recipes/RecipeView'; //Police业务 import Home from '@police/home/HomeContainer'; import Talk from '@police/talk/TalkContainer'; import State from '@police/state/StateContainer'; const navbarPropsTabs = { ...AppConfig.navbarProps, renderLeftButton: () => <NavbarMenuButton />, sceneStyle: { ...AppConfig.navbarProps.sceneStyle, paddingBottom: AppSizes.tabbarHeight, }, }; /* Routes ==================================================================== */ const scenes = ( <Scene key={'tabBar'} tabs tabBarIconContainerStyle={AppStyles.tabbar} pressOpacity={0.95}> {/*======Police业务=========*/} {/*首页*/} <Scene key={'firstPage'} {...navbarPropsTabs} title={'首页'} component={Home} icon={props => TabIcon({ ...props, icon: 'home' })} analyticsDesc={'首页: Coming Soon'} /> <Scene key={'timeline'} {...navbarPropsTabs} title={'数据警规'} component={Placeholder} icon={props => TabIcon({ ...props, icon: 'timeline' })} analyticsDesc={'数据警规: 建设中'} /> <Scene key={'syncstate'} {...navbarPropsTabs} title={'上传状态'} component={State} icon={props => TabIcon({ ...props, icon: 'backup' })} analyticsDesc={'上传状态: 建设中'} /> <Scene key={'message'} {...navbarPropsTabs} title={'警务对话'} component={Talk} icon={props => TabIcon({ ...props, icon: 'speaker-notes' })} analyticsDesc={'警务对话: 建设中'} /> {/*======Start Kit框架示例=========*/} <Scene {...navbarPropsTabs} key={'recipes'} title={'Recipes'} icon={props => TabIcon({ ...props, icon: 'search' })} > <Scene {...navbarPropsTabs} key={'recipesListing'} component={Recipes} title={AppConfig.appName} analyticsDesc={'Recipes: Browse Recipes'} /> <Scene {...AppConfig.navbarProps} key={'recipeView'} component={RecipeView} getTitle={props => ((props.title) ? props.title : 'View Recipe')} analyticsDesc={'RecipeView: View Recipe'} /> </Scene> <Scene key={'styleGuide'} {...navbarPropsTabs} title={'Style Guide'} component={StyleGuide} icon={props => TabIcon({ ...props, icon: 'speaker-notes' })} analyticsDesc={'StyleGuide: Style Guide'} /> </Scene> ); export default scenes;
src/routes.js
redux-china/react-redux-universal-hot-example
import React from 'react'; import {Route} from 'react-router'; import { App, Home, Widgets, About, Login, RequireLogin, LoginSuccess, Survey, NotFound, } from 'containers'; export default function(store) { return ( <Route component={App}> <Route path="/" component={Home}/> <Route path="/widgets" component={Widgets}/> <Route path="/about" component={About}/> <Route path="/login" component={Login}/> <Route component={RequireLogin} onEnter={RequireLogin.onEnter(store)}> <Route path="/loginSuccess" component={LoginSuccess}/> </Route> <Route path="/survey" component={Survey}/> <Route path="*" component={NotFound}/> </Route> ); }
app/javascript/mastodon/features/compose/components/search.js
codl/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Overlay from 'react-overlays/lib/Overlay'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; const messages = defineMessages({ placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }, }); class SearchPopout extends React.PureComponent { static propTypes = { style: PropTypes.object, }; render () { const { style } = this.props; return ( <div style={{ ...style, position: 'absolute', width: 285 }}> <Motion defaultStyle={{ opacity: 0, scaleX: 0.85, scaleY: 0.75 }} style={{ opacity: spring(1, { damping: 35, stiffness: 400 }), scaleX: spring(1, { damping: 35, stiffness: 400 }), scaleY: spring(1, { damping: 35, stiffness: 400 }) }}> {({ opacity, scaleX, scaleY }) => ( <div className='search-popout' style={{ opacity: opacity, transform: `scale(${scaleX}, ${scaleY})` }}> <h4><FormattedMessage id='search_popout.search_format' defaultMessage='Advanced search format' /></h4> <ul> <li><em>#example</em> <FormattedMessage id='search_popout.tips.hashtag' defaultMessage='hashtag' /></li> <li><em>@username@domain</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li> <li><em>URL</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li> <li><em>URL</em> <FormattedMessage id='search_popout.tips.status' defaultMessage='status' /></li> </ul> <FormattedMessage id='search_popout.tips.text' defaultMessage='Simple text returns matching display names, usernames and hashtags' /> </div> )} </Motion> </div> ); } } @injectIntl export default class Search extends React.PureComponent { static propTypes = { value: PropTypes.string.isRequired, submitted: PropTypes.bool, onChange: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; state = { expanded: false, }; handleChange = (e) => { this.props.onChange(e.target.value); } handleClear = (e) => { e.preventDefault(); if (this.props.value.length > 0 || this.props.submitted) { this.props.onClear(); } } handleKeyDown = (e) => { if (e.key === 'Enter') { e.preventDefault(); this.props.onSubmit(); } else if (e.key === 'Escape') { document.querySelector('.ui').parentElement.focus(); } } noop () { } handleFocus = () => { this.setState({ expanded: true }); this.props.onShow(); } handleBlur = () => { this.setState({ expanded: false }); } render () { const { intl, value, submitted } = this.props; const { expanded } = this.state; const hasValue = value.length > 0 || submitted; return ( <div className='search'> <label> <span style={{ display: 'none' }}>{intl.formatMessage(messages.placeholder)}</span> <input className='search__input' type='text' placeholder={intl.formatMessage(messages.placeholder)} value={value} onChange={this.handleChange} onKeyUp={this.handleKeyDown} onFocus={this.handleFocus} onBlur={this.handleBlur} /> </label> <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}> <i className={`fa fa-search ${hasValue ? '' : 'active'}`} /> <i aria-label={intl.formatMessage(messages.placeholder)} className={`fa fa-times-circle ${hasValue ? 'active' : ''}`} /> </div> <Overlay show={expanded && !hasValue} placement='bottom' target={this}> <SearchPopout /> </Overlay> </div> ); } }
src/svg-icons/action/settings-input-component.js
ruifortes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionSettingsInputComponent = (props) => ( <SvgIcon {...props}> <path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v6h6V6H5V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2H9v2zm-8 0c0 1.3.84 2.4 2 2.82V23h2v-4.18C6.16 18.4 7 17.3 7 16v-2H1v2zM21 6V2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6V6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4H9v6h6V6h-2V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"/> </SvgIcon> ); ActionSettingsInputComponent = pure(ActionSettingsInputComponent); ActionSettingsInputComponent.displayName = 'ActionSettingsInputComponent'; ActionSettingsInputComponent.muiName = 'SvgIcon'; export default ActionSettingsInputComponent;
fluxArchitecture/src/js/components/product/app-catalogdetail.js
wandarkaf/React-Bible
import React from 'react'; import AppStore from '../../stores/app-store'; import StoreWatchMixin from '../../mixins/StoreWatchMixin'; import AppActions from '../../actions/app-actions' import CartButton from '../cart/app-cart-button'; import { Link } from 'react-router'; function getCatalogItem( props ){ let item = AppStore.getCatalog().find( ({ id }) => id === props.params.item ) return {item} } const CatalogDetail = (props) => { return ( <div> <h4>{ props.item.title }</h4> <img src="http://placehold.it/250x250" /> <p>{ props.item.description }</p> <p>${ props.item.cost } <span className="text-success"> { props.item.qty && `(${props.item.qty} in cart)`} </span> </p> <div className="btn-group"> <Link to="/" className="btn btn-default btn-sm">Continue Shopping</Link> <CartButton handler={ AppActions.addItem.bind(null, props.item) } txt="Add To Cart" /> </div> </div> ) } export default StoreWatchMixin( CatalogDetail, getCatalogItem )
imports/client/components/Project/ProjectInfoList.js
evancorl/skate-scenes
import React from 'react'; class ProjectInfoList extends React.Component { shouldComponentUpdate() { return false; } render() { const { subtitle, list } = this.props; return ( <div className="project-info-list-container"> <h3 className="project-subtitle">{subtitle}:</h3> <ul className="project-info-list"> {list.map((item, i) => ( <li key={i} className="project-info-list-item">{item}</li> ))} </ul> </div> ); } } ProjectInfoList.propTypes = { subtitle: React.PropTypes.string.isRequired, list: React.PropTypes.array.isRequired, }; export default ProjectInfoList;
shared/components/Common/Content/NavRight.js
kizzlebot/music_dev
import React from 'react' export default class NavRight extends React.Component { render() { return ( <div className="content__right"> <div className="social"> <div className="friends"> <a href="#" className="friend"> <i className="ion-android-person" /> Sam Smith </a> </div> <button className="button-light">Find Friends</button> </div> </div> ); } }
examples/src/components/CustomRenderField.js
jakeland/react-select
import React from 'react'; import Select from 'react-select'; function logChange() { console.log.apply(console, [].concat(['Select value changed:'], Array.prototype.slice.apply(arguments))); } var CustomRenderField = React.createClass({ displayName: 'CustomRenderField', propTypes: { delimiter: React.PropTypes.string, label: React.PropTypes.string, multi: React.PropTypes.bool, }, renderOption (option) { return <span style={{ color: option.hex }}>{option.label} ({option.hex})</span>; }, renderValue (option) { return <strong style={{ color: option.hex }}>{option.label}</strong>; }, render () { var ops = [ { label: 'Red', value: 'red', hex: '#EC6230' }, { label: 'Green', value: 'green', hex: '#4ED84E' }, { label: 'Blue', value: 'blue', hex: '#6D97E2' } ]; return ( <div className="section"> <h3 className="section-heading">{this.props.label}</h3> <Select delimiter={this.props.delimiter} multi={this.props.multi} allowCreate={true} placeholder="Select your favourite" options={ops} optionRenderer={this.renderOption} valueRenderer={this.renderValue} onChange={logChange} /> </div> ); } }); module.exports = CustomRenderField;
website/irulez/src/components/admin_menu/Administrator.js
deklungel/iRulez
import React, { Component } from 'react'; import AuthService from '../AuthService'; import SideBar from '../SideBar'; import { Route } from 'react-router-dom'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { withStyles } from '@material-ui/core/styles'; import withAuth from './../withAuth'; import { SnackbarProvider } from 'notistack'; import Admin from './Dashboard'; import Users from './users/Users'; import Devices from './devices/Devices'; import Actions from './actions/Actions'; import Outputs from './outputs/Outputs'; import Inputs from './inputs/Inputs'; import Menus from './menus/Menus'; import DimmerActions from './actions/DimmerActions'; import Processes from './processes/Processes'; import { BrowserView, MobileView, isBrowser, isMobile } from 'react-device-detect'; import Groups from './users/Groups'; const Auth = new AuthService(); const drawerWidth = 240; const styles = theme => ({ drawerHeader: { display: 'flex', alignItems: 'center', padding: '0 8px', ...theme.mixins.toolbar, justifyContent: 'flex-end' }, content: { flexGrow: 1, //padding: theme.spacing.unit * 3, transition: theme.transitions.create('margin', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen }), marginLeft: 0 }, contentShift: { transition: theme.transitions.create('margin', { easing: theme.transitions.easing.easeOut, duration: theme.transitions.duration.enteringScreen }), marginLeft: +drawerWidth } }); class Administrator extends Component { user = Auth.getProfile(); state = { sidebarOpen: false, MenuOpen: '' }; componentWillMount() { if (!this.user.admin) { this.props.history.replace('/'); } } sideBarToggle = value => { this.setState({ sidebarOpen: value }); }; ToggleCollapse = menu => { if (this.state.MenuOpen === menu) { this.setState({ MenuOpen: '' }); } else { this.setState({ MenuOpen: menu }); } }; SetCollapse = menu => { this.setState({ MenuOpen: menu }); }; checkSidebarState = () => { if (isMobile) { this.sideBarToggle(false); } else { this.sideBarToggle(true); } }; render() { const { classes } = this.props; return ( <div> <SideBar Auth={Auth} sidebarToggle={this.sideBarToggle} ToggleCollapse={this.ToggleCollapse} MenuOpen={this.state.MenuOpen} open={this.state.sidebarOpen} /> <SnackbarProvider maxSnack={3}> <main className={classNames(classes.content, { [classes.contentShift]: this.state.sidebarOpen })} > <div className={classes.drawerHeader} /> <Route exact path='/administrator' render={props => <Admin {...props} Collapse={this.SetCollapse} />} /> <Route path='/administrator/actions/relais' render={props => ( <Actions {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/actions/dimmer' render={props => ( <DimmerActions {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/user/users' render={props => ( <Users {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/user/groups' render={props => ( <Groups {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/menus' render={props => ( <Menus {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/devices' render={props => ( <Devices {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/outputs' render={props => ( <Outputs {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/inputs' render={props => ( <Inputs {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> <Route exact path='/administrator/processes' render={props => ( <Processes {...props} checkSidebarState={this.checkSidebarState} Collapse={this.SetCollapse} /> )} /> </main> </SnackbarProvider> </div> ); } } Administrator.propTypes = { classes: PropTypes.object.isRequired, theme: PropTypes.object.isRequired }; export default withStyles(styles, { withTheme: true })(withAuth(Administrator));
es/ExpansionPanel/ExpansionPanelActions.js
uplevel-technology/material-ui-next
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } import React from 'react'; import classNames from 'classnames'; import withStyles from '../styles/withStyles'; import { cloneChildrenWithClassName } from '../utils/reactHelpers'; export const styles = theme => ({ root: { display: 'flex', justifyContent: 'flex-end', alignItems: 'center', padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit}px` }, action: { marginLeft: theme.spacing.unit } }); function ExpansionPanelActions(props) { const { children, classes, className } = props, other = _objectWithoutProperties(props, ['children', 'classes', 'className']); return React.createElement( 'div', _extends({ className: classNames(classes.root, className) }, other), cloneChildrenWithClassName(children, classes.action) ); } export default withStyles(styles, { name: 'MuiExpansionPanelActions' })(ExpansionPanelActions);
ui/src/main/js/components/InstanceViz.js
rdelval/aurora
import React from 'react'; import { Link } from 'react-router-dom'; export default function InstanceViz({ instances, jobKey }) { const {job: {role, environment, name}} = jobKey; const className = (instances.length > 1000) ? 'small' : (instances.length > 100) ? 'medium' : 'big'; return (<ul className={`instance-grid ${className}`}> {instances.map((i) => { return (<Link key={i.instanceId} to={`/scheduler/${role}/${environment}/${name}/${i.instanceId}`}> <li className={i.className} title={i.title} /> </Link>); })} </ul>); }
docs/src/pages/components/icons/SvgIconsSize.js
lgollut/material-ui
import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import SvgIcon from '@material-ui/core/SvgIcon'; const useStyles = makeStyles((theme) => ({ root: { '& > svg': { margin: theme.spacing(2), }, }, })); function HomeIcon(props) { return ( <SvgIcon {...props}> <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> </SvgIcon> ); } export default function SvgIconsSize() { const classes = useStyles(); return ( <div className={classes.root}> <HomeIcon fontSize="small" /> <HomeIcon /> <HomeIcon fontSize="large" /> <HomeIcon style={{ fontSize: 40 }} /> </div> ); }
src/App.js
qf3/card-games-vocabulary
import React from 'react' import { connect } from 'react-redux' import ScoreBoard from './components/ScoreBoard' import ReportCard from './components/ReportCard' import Confirm from './components/Confirm' import CardsBoard from './container/CardTransition' import CountDown from './components/CountDown' const App = ({progress,completion,restart}) => ( <div> { completion === true ? <div> <Confirm/> <ScoreBoard/> <CardsBoard/> </div>: <CountDown/> } </div> ) /*const App = ({progress,completion}) => ( <ReportCard/> )*/ /*container*/ const mapStateToProps = state => ({ progress:state.cardsAndBoradState.progress/2, completion:state.cardsCompleted.completion, restart:state.cardsCompleted.restart }) export default connect(mapStateToProps)(App)
frontend/component/TopicList.js
wangmuming/node-forum
import React from 'react'; import { Router, Route, Link, browserHistory } from 'react-router'; import {getTopicList} from '../lib/client'; export default class TopicList extends React.Component { constructor(pros){ super(pros); this.state = {}; } componentDidMount() { this.updateList({ // 路由上的参数 tags: this.props.location.query.tags, pageNo: this.props.location.query.pageNo }); } // 参数变化时调用 componentWillReceiveProps(nextProps) { this.updateList({ tags: nextProps.location.query.tags, pageNo: nextProps.location.query.pageNo }); } updateList(query) { getTopicList(query) .then(ret => this.setState(ret)) .catch(err => console.log(err)); } render() { const list = Array.isArray(this.state.list) ? this.state.list : []; // 当前的页码 let pageNo = parseInt(this.state.pageNo, 10); if(!(pageNo > 1)) pageNo = 1; let prevPage = pageNo - 1; if(prevPage < 1) prevPage = 1; let nextPage = pageNo + 1; return ( <div> <ul className="list-group"> {list.map((item, i) => { return ( <Link to={`/topic/${item._id}`} className="list-group-item" key={i}> {item.title} <span className="pull-right"> {item.author && item.author.nickname || '佚名'} 发表于 {item.createdAt} 阅读量:{item.pageView || 0} </span> </Link> ); })} </ul> <nav> <ul className="pagination"> <li> <Link to={`/?pageNo=${prevPage}`} aria-label="Previous"> <span aria-hidden="true">&laquo;</span> </Link> </li> <li> <Link to={`/?pageNo=${nextPage}`} aria-label="Next"> <span aria-hidden="true">&raquo;</span> </Link> </li> </ul> </nav> </div> ); } }
app/sources/js/components/dialog/setting_dialog.react.js
ixui/sirusu
// Library import connectToStores from 'alt/utils/connectToStores' import React from 'react' // Alt - Flux // Actions import NotebooksActions from '../../actions/notebooks' import SettingActions from '../../actions/setting' import ErrorsActions from '../../actions/errors' // Stores import SettingStore from '../../stores/setting' import BrowserStore from '../../stores/browser' // Design import TextField from 'material-ui/lib/text-field' import Colors from 'material-ui/lib/styles/colors' import Dialog from 'material-ui/lib/dialog' import FlatButton from 'material-ui/lib/flat-button' let dialog = remote.require('dialog') let browserWindow = remote.require('browser-window') // ****************************************************************** // Styles // ****************************************************************** const settingFieldStyle = { inputStyle: { color: Colors.grey800, padding: 5, }, underlineStyle: { borderColor: Colors.cyan700, }, underlineFocusStyle: { borderColor: Colors.cyan300, }, } class SettingDialog extends React.Component { // Alt Store との連結設定 - ここに設定したStoreから変更通知を受け取る static getStores() { return [SettingStore, BrowserStore] } // Alt を使用した場合の Props の生成ルール - ここで返す結果がPropsに設定される static getPropsFromStores() { return _.merge(SettingStore.getState(), BrowserStore.getState()) } showDirectorySelectDialog() { let focusedWindow = browserWindow.getFocusedWindow(); dialog.showOpenDialog(focusedWindow, {properties: ['openDirectory', 'createDirectory']}, function(directories) { if (directories) { SettingActions.save(directories[0]) NotebooksActions.fetch() } }.bind(this)) } hideSettingView() { let dataPath = this.refs.dataPath.getValue() if (!dataPath){ ErrorsActions.push("データの保存先を選択してください") return } SettingActions.hideSettingView() } render() { let actions = [ <FlatButton label="OK" primary={true} onClick={this.hideSettingView.bind(this)}></FlatButton>, ] return ( <Dialog title="設定" actions={actions} modal={true} open={this.props.visibleSettingView} onRequestClose={this.hideSettingView.bind(this)}> <TextField hintText=" データの保存先 " inputStyle={settingFieldStyle.inputStyle} underlineStyle={settingFieldStyle.underlineStyle} underlineFocusStyle={settingFieldStyle.underlineFocusStyle} onClick={this.showDirectorySelectDialog.bind(this)} value={this.props.dataPath} ref="dataPath" fullWidth /> </Dialog> ) } } export default connectToStores(SettingDialog)
packages/web/src/lib/apollo.js
dvaJi/ReaderFront
import React from 'react'; import Head from 'next/head'; import { ApolloProvider, ApolloClient, InMemoryCache, HttpLink } from '@apollo/client'; import fetch from 'isomorphic-unfetch'; let globalApolloClient = null; /** * Creates and provides the apolloContext * to a next.js PageTree. Use it by wrapping * your PageComponent via HOC pattern. * @param {Function|Class} PageComponent * @param {Object} [config] * @param {Boolean} [config.ssr=true] */ export function withApollo(PageComponent, { ssr = true } = {}) { const WithApollo = ({ apolloClient, apolloState, ...pageProps }) => { const client = apolloClient || initApolloClient(apolloState); return ( <ApolloProvider client={client}> <PageComponent {...pageProps} /> </ApolloProvider> ); }; // Set the correct displayName in development if (process.env.NODE_ENV !== 'production') { const displayName = PageComponent.displayName || PageComponent.name || 'Component'; if (displayName === 'App') { console.warn('This withApollo HOC only works with PageComponents.'); } WithApollo.displayName = `withApollo(${displayName})`; } if (ssr || PageComponent.getInitialProps) { WithApollo.getInitialProps = async ctx => { const { AppTree } = ctx; // Initialize ApolloClient, add it to the ctx object so // we can use it in `PageComponent.getInitialProp`. const apolloClient = (ctx.apolloClient = initApolloClient()); // Run wrapped getInitialProps methods let pageProps = {}; if (PageComponent.getInitialProps) { pageProps = await PageComponent.getInitialProps(ctx); } // Only on the server: if (typeof window === 'undefined') { // When redirecting, the response is finished. // No point in continuing to render if (ctx.res && ctx.res.finished) { return pageProps; } // Only if ssr is enabled if (ssr) { try { // Run all GraphQL queries const { getDataFromTree } = await import( '@apollo/client/react/ssr' ); await getDataFromTree( <AppTree pageProps={{ ...pageProps, apolloClient }} /> ); } catch (error) { // Prevent Apollo Client GraphQL errors from crashing SSR. // Handle them in components via the data.error prop: // https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-query-data-error console.error('Error while running `getDataFromTree`', error); } // getDataFromTree does not call componentWillUnmount // head side effect therefore need to be cleared manually Head.rewind(); } } // Extract query data from the Apollo store const apolloState = apolloClient.cache.extract(); return { ...pageProps, apolloState }; }; } return WithApollo; } /** * Always creates a new apollo client on the server * Creates or reuses apollo client in the browser. * @param {Object} initialState */ function initApolloClient(initialState) { // Make sure to create a new client for every server-side request so that data // isn't shared between connections (which would be bad) if (typeof window === 'undefined') { return createApolloClient(initialState); } // Reuse client on the client-side if (!globalApolloClient) { globalApolloClient = createApolloClient(initialState); } return globalApolloClient; } /** * Creates and configures the ApolloClient * @param {Object} [initialState={}] */ function createApolloClient(initialState = {}) { return new ApolloClient({ ssrMode: typeof window === 'undefined', link: new HttpLink({ uri: process.env.REACT_APP_READER_PATH, credentials: 'same-origin', fetch }), cache: new InMemoryCache().restore(initialState) }); }
src/Fade.js
jakubsikora/react-bootstrap
import React from 'react'; import Transition from 'react-overlays/lib/Transition'; import CustomPropTypes from './utils/CustomPropTypes'; import deprecationWarning from './utils/deprecationWarning'; class Fade extends React.Component { render() { let timeout = this.props.timeout || this.props.duration; return ( <Transition {...this.props} timeout={timeout} className='fade' enteredClassName='in' enteringClassName='in' > {this.props.children} </Transition> ); } } // Explicitly copied from Transition for doc generation. // TODO: Remove duplication once #977 is resolved. Fade.propTypes = { /** * Show the component; triggers the fade in or fade out animation */ in: React.PropTypes.bool, /** * Unmount the component (remove it from the DOM) when it is faded out */ unmountOnExit: React.PropTypes.bool, /** * Run the fade in animation when the component mounts, if it is initially * shown */ transitionAppear: React.PropTypes.bool, /** * Duration of the fade animation in milliseconds, to ensure that finishing * callbacks are fired even if the original browser transition end events are * canceled */ timeout: React.PropTypes.number, /** * duration * @private */ duration: CustomPropTypes.all([ React.PropTypes.number, (props)=> { if (props.duration != null){ deprecationWarning('Fade `duration`', 'the `timeout` prop'); } return null; } ]), /** * Callback fired before the component fades in */ onEnter: React.PropTypes.func, /** * Callback fired after the component starts to fade in */ onEntering: React.PropTypes.func, /** * Callback fired after the has component faded in */ onEntered: React.PropTypes.func, /** * Callback fired before the component fades out */ onExit: React.PropTypes.func, /** * Callback fired after the component starts to fade out */ onExiting: React.PropTypes.func, /** * Callback fired after the component has faded out */ onExited: React.PropTypes.func }; Fade.defaultProps = { in: false, timeout: 300, unmountOnExit: false, transitionAppear: false }; export default Fade;
src/components/transactions/amount.js
slaweet/lisk-nano
import React from 'react'; import { translate } from 'react-i18next'; import styles from './transactions.css'; import LiskAmount from '../liskAmount'; import { TooltipWrapper } from '../timestamp'; import ClickToSend from '../clickToSend'; import transactionTypes from '../../constants/transactionTypes'; const Amount = (props) => { const params = {}; if (props.value.type === transactionTypes.send && props.value.senderId === props.value.recipientId) { params.className = 'grayButton'; } else if (props.value.senderId !== props.address) { params.className = 'inButton'; } else if (props.value.type !== transactionTypes.send || props.value.recipientId !== props.address) { params.className = 'outButton'; params.tooltipText = props.value.type === transactionTypes.send ? props.t('Repeat the transaction') : undefined; params.clickToSendEnabled = props.value.type === transactionTypes.send; } return <TooltipWrapper tooltip={params.tooltipText}> <ClickToSend rawAmount={props.value.amount} className='amount' recipient={props.value.recipientId} disabled={!params.clickToSendEnabled}> <span id='transactionAmount' className={styles[params.className]}> <LiskAmount val={props.value.amount} /> </span> </ClickToSend> </TooltipWrapper>; }; // <FormattedNumber val={props.value.fee}></FormattedNumber> export default translate()(Amount);
packages/web/src/components/Interface/Interface.js
hengkx/note
import React from 'react'; import PropTypes from 'prop-types'; import moment from 'moment'; import queryString from 'query-string'; import { Card, Table, Button, Modal, Select } from 'antd'; import { Link } from 'react-router-dom'; import './less/interface.less'; const Option = Select.Option; class Interface extends React.Component { static propTypes = { match: PropTypes.object.isRequired, history: PropTypes.object.isRequired, location: PropTypes.object.isRequired, getList: PropTypes.func.isRequired, getListResult: PropTypes.object, groups: PropTypes.array, } constructor(props) { super(props); const { id } = this.props.match.params; this.state = { projectId: id, interfaces: [], ids: [] }; } componentDidMount() { this.getInterfaceList(); } componentWillReceiveProps(nextProps) { const { getListResult } = nextProps; if (getListResult !== this.props.getListResult) { this.setState({ interfaces: getListResult.data }); } } getInterfaceList = (group) => { const { id } = this.props.match.params; if (group) { this.props.getList({ project: id, group }); } else if (group === '') { this.props.getList({ project: id }); } else { const parsed = queryString.parse(this.props.location.search); this.props.getList({ project: id, ...parsed }); } } handleSelectedGroup = (group) => { const { match } = this.props; if (group) { this.props.history.push(`${match.url}?group=${group}`); } else { this.props.history.push(match.url); } this.getInterfaceList(group); } handleSaveGroup = () => { const { projectId, ids } = this.state; // this.props.batchSetGroup({ project: projectId, ids }); } render() { const { match } = this.props; const { interfaces, ids } = this.state; const columns = [ { title: '接口名称', dataIndex: 'name', render: (text, record) => (<Link key={record.id} to={`${match.url}/interface/${record.id}`}>{text}</Link>) }, { title: '请求方式', dataIndex: 'method', }, { title: '请求地址', dataIndex: 'display_url', }, { title: '分组', dataIndex: 'group', render: (text) => (text ? text.name : '') }, { title: '创建时间', dataIndex: 'created_at', render: (text) => (moment.unix(text).format('YYYY-MM-DD HH:mm:ss')) }, { title: '修改时间', dataIndex: 'updated_at', render: (text) => (moment.unix(text).format('YYYY-MM-DD HH:mm:ss')) }, ]; const { groups } = this.props; const rowSelection = { onChange: (selectedRowKeys, selectedRows) => { this.setState({ ids: selectedRowKeys }); console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); }, getCheckboxProps: record => ({ disabled: record.name === 'Disabled User', // Column configuration not to be checked }), }; return ( <Card bordered={false}> <div className="interface"> <ul className="group"> <li onClick={() => this.handleSelectedGroup('')}>所有接口</li> <li onClick={() => this.handleSelectedGroup('-1')}>未分组</li> {groups.map(item => ( <li key={item._id} onClick={() => this.handleSelectedGroup(item._id)}>{item.name}</li> ))} </ul> <div className="list"> {ids.length > 0 && <div className="action"> <Button onClick={() => this.setState({ visible: true })}>修改分组</Button> </div> } <Table rowSelection={rowSelection} rowKey="_id" dataSource={interfaces} columns={columns} /> </div> </div> <Modal title="修改分组" visible={this.state.visible} onOk={this.handleSaveGroup} onCancel={() => this.setState({ visible: false })} > <Select placeholder="选择分组" style={{ width: '100%' }} > <Option value="" >未分组</Option> {groups.map(item => <Option key={item._id} value={item._id}>{item.name}</Option>)} </Select> </Modal> </Card> ); } } export default Interface;
src/common/components/LoadingIndicator.js
algernon/mad-tooter
// @flow /* The Mad Tooter -- A Mastodon client * Copyright (C) 2017 Gergely Nagy * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react'; import { connect } from 'react-redux'; import { LinearProgress } from 'material-ui/Progress'; import { withStyles } from 'material-ui/styles'; const styles = theme => ({ indicator: { position: 'absolute', zIndex: 2000, width: '100%', top: 56, [`${theme.breakpoints.up('xs')} and (orientation: landscape)`]: { top: 48, }, [theme.breakpoints.up('sm')]: { top: 64, }, } }); class LoadingIndicator extends React.Component { render () { if (!this.props.show) return null; return ( <LinearProgress type="query" color="accent" className={this.props.classes.indicator} /> ); } } const stateToProps = (state, props) => ({ show: state.getIn(["loadingIndicator", "show"]), }); export default connect(stateToProps)(withStyles(styles)(LoadingIndicator));
examples/with-unstated/pages/about.js
BlancheXu/test
import React from 'react' import Link from 'next/link' import { Subscribe } from 'unstated' import { ClockContainer, CounterContainer } from '../containers' import { Clock, Counter } from '../components' class About extends React.Component { componentWillUnmount () { clearInterval(this.timer) } render () { return ( <Subscribe to={[ClockContainer, CounterContainer]}> {(clock, counter) => { this.timer = clock.interval return ( <div> <Link href='/index'> <button>go to Index</button> </Link> <div> <Clock clock={clock} /> <Counter counter={counter} /> </div> </div> ) }} </Subscribe> ) } } export default About
src/Jumbotron.js
thealjey/react-bootstrap
import React from 'react'; import classNames from 'classnames'; import CustomPropTypes from './utils/CustomPropTypes'; const Jumbotron = React.createClass({ propTypes: { /** * You can use a custom element for this component */ componentClass: CustomPropTypes.elementType }, getDefaultProps() { return { componentClass: 'div' }; }, render() { const ComponentClass = this.props.componentClass; return ( <ComponentClass {...this.props} className={classNames(this.props.className, 'jumbotron')}> {this.props.children} </ComponentClass> ); } }); export default Jumbotron;
liveExample/src/react-live-editor/patch.js
ArnoSaine/react-link-state-vm
import React from 'react'; import createClass from 'create-react-class'; import PropTypes from 'prop-types'; React.createClass = createClass; React.PropTypes = PropTypes;
src/Avatar.js
escabc/members-search-app
import React from 'react' import PropTypes from 'prop-types' import NoAvatarImage from './assets/default-professional-avatar.svg' const styles = { root: {}, } const Avatar = ({ image }) => ( <div style={styles.root}> <img src={image} alt="no avatar" /> </div> ) Avatar.propTypes = { image: PropTypes.string, } Avatar.defaultProps = { image: NoAvatarImage, } export default Avatar
stories/index.js
wegotpop/prt-client
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; import PRTComponent from 'prt'; storiesOf('PRTComponent', module) .add('null', () => <PRTComponent content={{type : 'PRTDocument', dialect : 'pop', version : '2.0', elements : null }} /> ) .add('string', () => <PRTComponent content={{type : 'PRTDocument', dialect : 'pop', version : '2.0', elements : 'HELLLO WORLD' }} /> ) .add('bold', () => <PRTComponent content={{type : 'PRTDocument', dialect : 'pop', version : '2.0', elements : [[0x01, null, 'HELLO WORLD']]} } /> ) .add('two elements 1 and 2 with a space between', () => <PRTComponent content={{type : 'PRTDocument', dialect : 'pop', version : '2.0', elements : [[0x01, null, 'HELLO WORLD 1'], ' ', [0x02, null, 'HELLO WORLD 2']]} } /> ) .add('bold and code nested', () => <PRTComponent content={{type : 'PRTDocument', dialect : 'pop', version : '2.0', elements : [[0x01, null, [[0x02, null, 'HELLO WORLD 2']]]] }} /> )
src/pages/paper/review/paperReview/reviewQuestions.js
sunway-official/acm-admin
import React from 'react'; import { Col, Row } from 'react-flexbox-grid'; import { Field, reduxForm } from 'redux-form'; import SelectPoint from './selectPoint'; import { RaisedButton } from 'material-ui'; import CustomInput from '../../../../components/CustomInput'; const validate = (values, props) => { const errors = {}; const requiredFields = []; props.questions.forEach(question => { requiredFields.push('point' + question.id); requiredFields.push('input' + question.id); }); requiredFields.forEach(field => { if (!values[field]) { errors[field] = 'This field is required'; } }); return errors; }; // map paper review question const ReviewQuestions = props => { let questions; if (props.questions.length > 0) { questions = props.questions.map( (question, index) => index > 1 ? ( <Row className={'card-detail-row review-row'} key={index}> <Col xs={5} style={{ paddingTop: '24px' }}> <p> {index - 1} . <span /> {question.content} </p> </Col> <Col xs={3}> <SelectPoint id={'point' + (index + 1)} /> </Col> <Col xs={4}> <Field name={'input' + (index + 1)} component={CustomInput} hintText="Enter your comment" multiLine={true} rows={2} rowsMax={3} fullWidth={true} /> </Col> </Row> ) : ( '' ), ); } const { handleSubmit } = props; return ( <form onSubmit={handleSubmit}> <section className="paper-section"> <Row className="paper-card" around="xs"> <Col xs={12} sm={12} md={12} lg={12} className="paper-col"> <Row center="xs" className="card-detail-row first-row"> <b style={{ fontSize: '1.5em' }}>Reviewer Comments</b> </Row> <Row style={{ paddingTop: '24px' }}> <Col xs={5}> <b> Evaluation Category </b> </Col> <Col xs={3}> <b>Point</b> <span> (1 = Poor, 5 = Execellent) </span> </Col> <Col xs={4}> <b>Comment </b> </Col> </Row> {questions} <hr style={{ width: '50%', height: '2px', backgroundColor: 'rgba(0,0,0,0.3)', border: '0', }} /> <Row className={'card-detail-row review-row'} key={1}> <Col xs={12} style={{ paddingTop: '24px' }}> <b> <h2>Detail comment</h2> </b> <br /> {props.questions[0].content} </Col> </Row> <Row> <Field name={'input' + 1} component={CustomInput} hintText="Enter your comment" multiLine={true} rows={2} rowsMax={3} fullWidth={true} style={{ marginLeft: '10px' }} /> </Row> <Row className={'card-detail-row review-row'} key={2}> <Col xs={12} style={{ paddingTop: '24px' }}> <b> <h2>Confidential Comments for Committee</h2> </b> <br /> {props.questions[1].content} </Col> </Row> <Row> <Field name={'input' + 2} component={CustomInput} hintText="Enter your comment" multiLine={true} rows={2} rowsMax={3} fullWidth={true} style={{ marginLeft: '10px' }} /> </Row> <Row center="xs" style={{ paddingBottom: '24px', paddingTop: '24px' }} > <RaisedButton className="btn" label="Submit" primary={true} type="submit" onClick={props.handleSubmit} /> </Row> </Col> </Row> </section> </form> ); }; export default reduxForm({ form: 'ReviewQuestions', // a unique identifier for this form validate, })(ReviewQuestions);
src/components/Quiz.js
scottluptowski/newyorktimesorjennyholzer
import React from 'react'; import Score from './Score'; import PostGame from './PostGame'; import GameLogicStore from '../stores/GameLogicStore'; import TruismActions from '../actions/truism_actions'; import { HOLZER, NYT } from '../constants'; function getUpdatedState() { let state = GameLogicStore.getState(); return { truism: state.currentQuestion(), score: state.score, gameOver: state.gameOver } } export default class App extends React.Component { constructor(props) { super(props); this.state = getUpdatedState(); this._onChange = this._onChange.bind(this); this.nyt = this.nyt.bind(this); this.holzer = this.holzer.bind(this); } componentDidMount() { GameLogicStore.listen(this._onChange); } componentDidUnMount() { GameLogicStore.unlisten(this._onChange); } _onChange() { this.setState(getUpdatedState()); } /* change this so we don't have the truism locally */ answer(event, guess) { TruismActions.answerQuestion({ truism: this.state.truism.text, guess: guess }); } startNewGame(event) { TruismActions.startNewGame(); } nyt(event) { this.answer(event, NYT); } holzer(event) { this.answer(event, HOLZER); } render() { if (this.state.gameOver) { return (<PostGame score={this.state.score} startNew={this.startNewGame.bind(this)}/>); } return ( <div> <Score points={this.state.score}></Score> <p> Choose: <a className="choice" onClick={this.nyt}>New York Times</a> <span> or </span> <a className="choice" onClick={this.holzer}>Jenny Holzer</a> </p> <p className="truism">{this.state.truism.text}</p> </div> ); } }
packages/reactor-kitchensink/src/NavTree.js
sencha/extjs-reactor
import React, { Component } from 'react'; import { Panel, SearchField, Toolbar, TreeList } from '@extjs/ext-react'; export default class NavTree extends Component { filterNav = (field, value) => { const { store } = this.props; this.filterRegex = new RegExp(`(${Ext.String.escapeRegex(value)})`, 'i'); store.filterBy(record => this.containsMatches(record)); } containsMatches(node) { const found = node.data.name.match(this.filterRegex) || node.childNodes.some(child => this.containsMatches(child)); if (found) node.expand(); node.data.text = node.data.name.replace(this.filterRegex, '<span style="color:#2196F3;font-weight:bold">$1</span>') return found; } render() { const { onSelectionChange, store, selection, ...props } = this.props; return ( <Panel {...props} scrollable="y" shadow style={{zIndex: 100, backgroundColor: 'white'}} header={false} collapsible={{ direction: 'left' }} > <SearchField flex={1} docked="top" ui="faded" onChange={this.filterNav} margin="7" /> <TreeList ui="nav" store={store} expanderFirst={false} expanderOnly={false} onSelectionChange={onSelectionChange} selection={selection} /> </Panel> ) } }
src/components/UsersList/UsersList.js
fkn/ndo
import PropTypes from 'prop-types'; import React from 'react'; import { ListGroup, ListGroupItem } from 'react-bootstrap'; import User from '../User'; import Action from './Action'; class UsersList extends React.Component { static propTypes = { onClick: PropTypes.func.isRequired, users: PropTypes.arrayOf( PropTypes.shape({ id: PropTypes.string, email: PropTypes.string, role: PropTypes.string, }), ).isRequired, children: PropTypes.arrayOf(PropTypes.element), actionsTitle: PropTypes.string, }; static defaultProps = { children: [], actionsTitle: '', }; render() { const { users = [], children, actionsTitle, onClick } = this.props; const actionsRenderer = Action.actionsRenderer(children, actionsTitle); return ( <ListGroup> {users.map(user => ( <ListGroupItem key={user.id} onClick={() => onClick(user)}> <User user={user} link={false} /> {actionsRenderer(user)} </ListGroupItem> ))} </ListGroup> ); } } UsersList.Action = Action; export default UsersList;
src/svg-icons/image/filter-2.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageFilter2 = (props) => ( <SvgIcon {...props}> <path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V7c0-1.11-.9-2-2-2h-4v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z"/> </SvgIcon> ); ImageFilter2 = pure(ImageFilter2); ImageFilter2.displayName = 'ImageFilter2'; ImageFilter2.muiName = 'SvgIcon'; export default ImageFilter2;
src/Layout.js
txwkx/grime-map
import React, { Component } from 'react'; import axios from 'axios'; import Sidebar from './components/Sidebar'; import MapContainer from './components/MapContainer'; import './css/general.css'; class Layout extends Component { constructor(props) { super(props); this.state = { districtsList: [], isLoaded: false }; } componentWillMount() { axios.get(`https://cdn.rawgit.com/txwkx/df5841a21eea32834aaf35b4d4676f3b/raw/7f537117a3bc299f17df71acf3cf644018d7ae91/grime-map.json`) .then(res => { const districtsList = res.data; this.setState({districtsList, isLoaded: true}); }); } getCenter(district){ switch (district) { case 'north': return { lat: 51.616, lng: -0.127 } case 'south': return { lat: 51.403, lng: -0.127 } case 'east': return { lat: 51.506, lng: 0.07 } case 'west': return { lat: 51.506, lng: -0.33 } default: return { lat: 51.506, lng: -0.127 } } } render(){ const { district } = this.props.match.params; const { isLoaded, districtsList } = this.state; const center = this.getCenter(district); if(!isLoaded) return(<div className='loader'></div>); return ( <div> <Sidebar district={district} districtsList={districtsList} /> <MapContainer center={center} districtsList={districtsList} /> </div> ) } } export default Layout;
src/svg-icons/action/android.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionAndroid = (props) => ( <SvgIcon {...props}> <path d="M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h1c.55 0 1-.45 1-1V8H6v10zM3.5 8C2.67 8 2 8.67 2 9.5v7c0 .83.67 1.5 1.5 1.5S5 17.33 5 16.5v-7C5 8.67 4.33 8 3.5 8zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48C13.85 1.23 12.95 1 12 1c-.96 0-1.86.23-2.66.63L7.85.15c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31C6.97 3.26 6 5.01 6 7h12c0-1.99-.97-3.75-2.47-4.84zM10 5H9V4h1v1zm5 0h-1V4h1v1z"/> </SvgIcon> ); ActionAndroid = pure(ActionAndroid); ActionAndroid.displayName = 'ActionAndroid'; ActionAndroid.muiName = 'SvgIcon'; export default ActionAndroid;
packages/editor/src/components/Icons/Paragraph.js
boldr/boldr
import React from 'react'; import Icon from './Icon'; const Paragraph = props => ( <Icon viewBox="0 0 384 512" {...props}> <path d="M372 32H165.588C74.935 32 .254 104.882.001 195.535-.252 286.177 73.415 360 164 360v108c0 6.627 5.373 12 12 12h32c6.627 0 12-5.373 12-12V88h40v380c0 6.627 5.373 12 12 12h32c6.627 0 12-5.373 12-12V88h56c6.627 0 12-5.373 12-12V44c0-6.627-5.373-12-12-12zM164 304c-59.552 0-108-48.449-108-108S104.448 88 164 88v216z" /> </Icon> ); Paragraph.defaultProps = { name: 'Paragraph' }; export default Paragraph;
src/components/Post/index.js
RyszardRzepa/React-Redux-Firebase-Boilerplate
import React from 'react'; import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card'; import FlatButton from 'material-ui/FlatButton'; import { Flex, Box } from 'reflexbox' import s from './styles'; const Post = (props) => { return ( <div> <Flex align="center" justify="center" > <Box px={3}> <p style={s.headLine} > Head line for the posts content </p> </Box> </Flex> <Flex align="center"> <Box auto p={2} > <Card zDepth={3} > <CardMedia overlay={<CardTitle title="Overlay title" subtitle="Overlay subtitle" />} > <img style={s.img} src="http://img15.hostingpics.net/pics/326464dnblandoceanice20121200.jpg"/> </CardMedia> <CardTitle title="Card title this is for new people" /> <CardActions> <FlatButton label="Action1" /> </CardActions> </Card> </Box> <Box auto p={2} > <Card zDepth={3} > <CardMedia overlay={<CardTitle title="Overlay title" subtitle="Overlay subtitle" />} > <img style={s.img} src="http://img15.hostingpics.net/pics/326464dnblandoceanice20121200.jpg"/> </CardMedia> <CardTitle title="Card title this is for new people" /> <CardActions> <FlatButton label="Action1" /> </CardActions> </Card> </Box> <Box auto p={2} > <Card zDepth={3} > <CardMedia overlay={<CardTitle title="Overlay title" subtitle="Overlay subtitle" />} > <img style={s.img} src="http://img15.hostingpics.net/pics/326464dnblandoceanice20121200.jpg"/> </CardMedia> <CardTitle title="Card title this is for new people" /> <CardActions> <FlatButton label="Action1" /> </CardActions> </Card> </Box> </Flex> </div> ) }; export default Post;
docs/app/Examples/elements/Step/Types/index.js
vageeshb/Semantic-UI-React
import React from 'react' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' const StepTypesExamples = () => ( <ExampleSection title='Types'> <ComponentExample title='Step' description='A single step.' examplePath='elements/Step/Types/StepExampleBasic' /> </ExampleSection> ) export default StepTypesExamples
src/components/CropBox/index.js
lapanoid/redux-cropper
import React from 'react'; import PureComponent from 'react-pure-render/component'; import ViewBox from '../ViewBox' import CropperFace from '../CropperFace' import { ACTION_SOUTH, ACTION_EAST, ACTION_SOUTH_WEST, ACTION_NORTH, ACTION_WEST, ACTION_NORTH_WEST, ACTION_NORTH_EAST, ACTION_SOUTH_EAST } from '../../constants/direction'; import CSSModules from "react-css-modules"; import styles from './styles.module.scss'; class CropBox extends PureComponent { constructor(props, context) { super(props, context); } render() { const {cropBox} = this.props; const options = cropBox.get('options'); const viewBox = cropBox.get('viewBox'); const cropBoxData = cropBox.get('cropBox'); const { guides, center, cropBoxResizable } = options.toJS(); return <div styleName="cropper-crop-box" style={{...cropBoxData.get('size').getSize(), ...cropBoxData.get('offset').getOffset()}}> <ViewBox viewBox={viewBox}/> {guides ? (<div> <span styleName="cropper-dashed dashed-h"/> <span styleName="cropper-dashed dashed-v"/> </div>) : null} {center ? <span styleName="cropper-center"/> : null} <CropperFace/> {cropBoxResizable ? (<div> <span styleName="cropper-line line-e" data-action={ACTION_EAST}/> <span styleName="cropper-line line-n" data-action={ACTION_NORTH}/> <span styleName="cropper-line line-w" data-action={ACTION_WEST}/> <span styleName="cropper-line line-s" data-action={ACTION_SOUTH}/> <span styleName="cropper-point point-e" data-action={ACTION_EAST}/> <span styleName="cropper-point point-n" data-action={ACTION_NORTH}/> <span styleName="cropper-point point-w" data-action={ACTION_WEST}/> <span styleName="cropper-point point-s" data-action={ACTION_SOUTH}/> <span styleName="cropper-point point-ne" data-action={ACTION_NORTH_EAST}/> <span styleName="cropper-point point-nw" data-action={ACTION_NORTH_WEST}/> <span styleName="cropper-point point-sw" data-action={ACTION_SOUTH_WEST}/> <span styleName="cropper-point point-se" data-action={ACTION_SOUTH_EAST}/> </div>) : null } </div> } } export default CSSModules(CropBox, styles, {allowMultiple: true})
docs/src/examples/elements/Input/Usage/index.js
Semantic-Org/Semantic-UI-React
import React from 'react' import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection' const InputUsageExamples = () => ( <ExampleSection title='Usage'> <ComponentExample title='Focus' description='An input can be focused via a ref.' examplePath='elements/Input/Usage/InputExampleRefFocus' /> <ComponentExample title='Input Element' description='You can pass props (specially data attributes) to input by including an input element in children.' examplePath='elements/Input/Usage/InputExampleInputElementProps' /> <ComponentExample title='Datalist' description={ <span> An input can be used with a <code>datalist</code>. </span> } examplePath='elements/Input/Usage/InputExampleDatalist' /> </ExampleSection> ) export default InputUsageExamples
pyxis/views/beacon/home.js
gtkatakura/furb-desenvolvimento-plataformas-moveis
import React from 'react'; import { Text, View, Button, StyleSheet, ScrollView } from 'react-native'; import Components from './../../components'; const styles = StyleSheet.create({ base: { padding: 24, flex: 1 }, name: { fontSize: 24 }, header: { flexWrap: 'wrap', flexDirection: 'row' } }); class BeaconScreen extends Components.PyxisComponent { constructor(props) { super(props); } get beacon() { return this.props.navigation.state.params.beacon; } render() { return ( <View style={styles.base}> <View style={styles.header}> <Text style={styles.title}>{this.beacon.name}</Text> <View style={styles.header_actions}> { // <Components.PButton title="Excluir" onPress={() => this.remove()}></Components.PButton> } </View> </View> <ScrollView> </ScrollView> <Components.BackButton onPress={() => this.goBack()}></Components.BackButton> </View> ); } } export default BeaconScreen;
app/components/pages/Workshop/index.js
romainquellec/cuistot
/* * * Workshop * */ import React from 'react'; import Container from '../../genericComponents/Container'; import Header from '../../genericComponents/Header'; import WorkshopCarousel from '../../specificComponents/WorkshopCarousel'; import Main from './Main'; import Sider from './Sider'; // eslint-disable-next-line react/prefer-stateless-function export class Workshop extends React.PureComponent { render() { return ( <Container> <Header /> <WorkshopCarousel /> <Main>test</Main> <Sider>test</Sider> </Container> ); } } export default Workshop;
actor-apps/app-web/src/app/components/SidebarSection.react.js
xiaotaijun/actor-platform
import React from 'react'; //import { Styles, Tabs, Tab } from 'material-ui'; //import ActorTheme from 'constants/ActorTheme'; import HeaderSection from 'components/sidebar/HeaderSection.react'; import RecentSection from 'components/sidebar/RecentSection.react'; //import ContactsSection from 'components/sidebar/ContactsSection.react'; //const ThemeManager = new Styles.ThemeManager(); class SidebarSection extends React.Component { //static childContextTypes = { // muiTheme: React.PropTypes.object //}; // //getChildContext() { // return { // muiTheme: ThemeManager.getCurrentTheme() // }; //} constructor(props) { super(props); //ThemeManager.setTheme(ActorTheme); } render() { return ( <aside className="sidebar"> <HeaderSection/> <RecentSection/> {/* <Tabs className="sidebar__tabs" contentContainerClassName="sidebar__tabs__tab-content" tabItemContainerClassName="sidebar__tabs__tab-items"> <Tab label="Recent"> <RecentSection/> </Tab> <Tab label="Contacts"> <ContactsSection/> </Tab> </Tabs> */} </aside> ); } } export default SidebarSection;
app/components/YourNextApp/scatterPlot.js
mhoffman/CatAppBrowser
import React from 'react'; import _ from 'lodash'; import Grid from 'material-ui/Grid'; import TextField from 'material-ui/TextField'; import Button from 'material-ui/Button'; import Plot from 'react-plotly.js'; export default class ScatterPlot extends React.Component { constructor(props) { super(props); this.state = { xs: [], ys: [], x: 0, y: 0, }; this.handleChange = this.handleChange.bind(this); this.handlePlot = this.handlePlot.bind(this); this.handleClear = this.handleClear.bind(this); } handleChange(name) { return (event) => { this.setState({ [name]: event.target.value, }); }; } handleClear() { this.setState({ xs: [], ys: [], x: 0, y: 0, }); } handlePlot() { const xs = _.concat(this.state.xs, [this.state.x]); const ys = _.concat(this.state.ys, [this.state.y]); this.setState({ xs, ys, }); } render() { return ( <Grid direction="column" justify="flex-start"> <Grid item> <h2>An Interactive Example</h2> </Grid> <Grid item> <Plot data={[{ x: this.state.xs, y: this.state.ys, type: 'scatter', }]} /> </Grid> <Grid item> <Grid container direction="row" justify="space-bwetween"> <Grid item> <TextField value={this.state.x} onChange={this.handleChange('x')} /> </Grid> <Grid item> <TextField value={this.state.y} onChange={this.handleChange('y')} /> </Grid> <Grid item> <Button raised onClick={this.handleClear} > Clear </Button> <Button raised color="primary" onClick={(event) => { this.handlePlot(event); }} >Plot</Button> </Grid> </Grid> </Grid> </Grid> ); } }
src/pages/article/articleDetail.js
ShiChao1996/BlogAdmin
import React, { Component } from 'react'; import { Input, Row, Col, Button, Spin } from 'antd'; import MarkDown from '../../components/markdown'; import './articleDetail.css'; import { connect } from "react-redux"; import { saveContent } from '../../actions/index'; const { TextArea } = Input; class ArticleDetail extends Component { constructor(props) { super(props); this.state = { text: '', loading: false } } componentWillMount() { if (this.props.article.content) { this.setState({ text: this.props.article.content, loading: this.props.loading }) } } componentWillReceiveProps(props){ this.setState({ text: props.article.content || '', loading: props.loading }) } saveArticle() { this.props.dispatch(saveContent(this.state.text)); this.props.closeModal && this.props.closeModal(); } render() { return ( <div className='detailContainer'> <div className="content"> <Row> <Col span={12}> { this.state.loading ? <div> <Spin size="large"/> </div> : null } <TextArea rows={30} value={this.state.text} onChange={(e) => this.setState({ text: e.target.value })}/> </Col> <Col span={12}> <div className='markDownContainer'> <MarkDown text={this.state.text}/> </div> </Col> </Row> </div> <Button onClick={() => this.saveArticle()} className='saveBtn'>save content</Button> </div> ) } } function select(store) { return { token: store.admin.token, article: store.article.article } } export default connect(select)(ArticleDetail);
packages/material-ui-icons/src/ContentPaste.js
AndriusBil/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let ContentPaste = props => <SvgIcon {...props}> <path d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z" /> </SvgIcon>; ContentPaste = pure(ContentPaste); ContentPaste.muiName = 'SvgIcon'; export default ContentPaste;
form/MoneyField.js
ExtPoint/yii2-frontend
import React from 'react'; import PropTypes from 'prop-types'; import {view} from 'components'; export default class MoneyField extends React.Component { static propTypes = { metaItem: PropTypes.object.isRequired, input: PropTypes.shape({ name: PropTypes.string, value: PropTypes.any, onChange: PropTypes.func, }), }; constructor() { super(...arguments); this._onChange = this._onChange.bind(this); } render() { const {input, disabled, placeholder, ...props} = this.props; const MoneyFieldView = this.props.view || view.getFormView('MoneyFieldView'); return ( <MoneyFieldView {...props} inputProps={{ name: input.name, type: 'text', disabled, placeholder, onChange: this._onChange, value: input.value, }} currency={this.props.metaItem.currency} /> ); } _onChange(e) { const value = e.target.value; this.props.input.onChange(value); if (this.props.onChange) { this.props.onChange(value); } } }
fields/types/textarea/TextareaField.js
Tangcuyu/keystone
import Field from '../Field'; import React from 'react'; module.exports = Field.create({ displayName: 'TextareaField', renderField () { var styles = { height: this.props.height, }; return <textarea name={this.props.path} styles={styles} ref="focusTarget" value={this.props.value} onChange={this.valueChanged} autoComplete="off" className="FormInput" />; }, });
src/pages/consultation/index.js
Vision100IT/v100it-template
import React from 'react'; import fm from 'front-matter'; import Index from '../../components'; import {Markdown} from '../../components/markdown'; import content from '../../content/consultation.md'; const {body, attributes} = fm(content); const Consultation = () => ( <Index> <div className="consultation-wrapper"> <div className="consultation-overlay"> <div className="site-wrapper site-wrapper-padding"> <Markdown> {`# ${attributes.title} ${body}`} </Markdown> </div> </div> </div> </Index> ); export default Consultation;
app/javascript/mastodon/features/reblogs/index.js
Ryanaka/mastodon
import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import LoadingIndicator from '../../components/loading_indicator'; import { fetchReblogs } from '../../actions/interactions'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; import ScrollableList from '../../components/scrollable_list'; import Icon from 'mastodon/components/icon'; import ColumnHeader from '../../components/column_header'; const messages = defineMessages({ refresh: { id: 'refresh', defaultMessage: 'Refresh' }, }); const mapStateToProps = (state, props) => ({ accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]), }); export default @connect(mapStateToProps) @injectIntl class Reblogs extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, multiColumn: PropTypes.bool, intl: PropTypes.object.isRequired, }; componentWillMount () { if (!this.props.accountIds) { this.props.dispatch(fetchReblogs(this.props.params.statusId)); } } componentWillReceiveProps(nextProps) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { this.props.dispatch(fetchReblogs(nextProps.params.statusId)); } } handleRefresh = () => { this.props.dispatch(fetchReblogs(this.props.params.statusId)); } render () { const { intl, accountIds, multiColumn } = this.props; if (!accountIds) { return ( <Column> <LoadingIndicator /> </Column> ); } const emptyMessage = <FormattedMessage id='status.reblogs.empty' defaultMessage='No one has boosted this toot yet. When someone does, they will show up here.' />; return ( <Column bindToDocument={!multiColumn}> <ColumnHeader showBackButton multiColumn={multiColumn} extraButton={( <button className='column-header__button' title={intl.formatMessage(messages.refresh)} aria-label={intl.formatMessage(messages.refresh)} onClick={this.handleRefresh}><Icon id='refresh' /></button> )} /> <ScrollableList scrollKey='reblogs' emptyMessage={emptyMessage} bindToDocument={!multiColumn} > {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />, )} </ScrollableList> </Column> ); } }
app/jsx/rubrics/Comments.js
djbender/canvas-lms
/* * Copyright (C) 2018 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import PropTypes from 'prop-types' import {ScreenReaderContent} from '@instructure/ui-a11y' import {Text} from '@instructure/ui-elements' import {Checkbox, Select, TextArea} from '@instructure/ui-forms' import I18n from 'i18n!edit_rubricComments' import {assessmentShape} from './types' const ellipsis = () => I18n.t('…') const truncate = comment => (comment.length > 100 ? [comment.slice(0, 99), ellipsis()] : [comment]) const FreeFormComments = props => { const {allowSaving, savedComments, comments, large, saveLater, setComments, setSaveLater} = props const first = ( <option key="first" value="first"> {I18n.t('[ Select ]')} </option> ) const options = savedComments.map((comment, ix) => ( // eslint-disable-next-line react/no-array-index-key <option key={ix} value={ix.toString()} label={comment}> {truncate(comment)} </option> )) const selector = [ <Select key="select" label={I18n.t('Saved Comments')} assistiveText={I18n.t('Select from saved comments')} onChange={(_unused, el) => { setComments(savedComments[el.value]) }} > {[first, ...options]} </Select>, <br key="br" /> ] const saveBox = () => { if (allowSaving && large) { return ( <Checkbox checked={saveLater} label={I18n.t('Save this comment for reuse')} size="small" onChange={event => setSaveLater(event.target.checked)} /> ) } } const label = I18n.t('Comments') const toScreenReader = el => <ScreenReaderContent>{el}</ScreenReaderContent> const commentClass = `edit-freeform-comments-${large ? 'large' : 'small'}` return ( <div className={commentClass}> {options.length > 0 ? selector : null} <TextArea data-selenium="criterion_comments_text" label={large ? label : toScreenReader(label)} placeholder={large ? undefined : label} maxHeight="50rem" onChange={e => setComments(e.target.value)} resize="vertical" size="small" value={comments} /> {large ? <br /> : null} {saveBox()} </div> ) } FreeFormComments.propTypes = { allowSaving: PropTypes.bool.isRequired, savedComments: PropTypes.arrayOf(PropTypes.string).isRequired, comments: PropTypes.string, large: PropTypes.bool.isRequired, saveLater: PropTypes.bool, setComments: PropTypes.func.isRequired, setSaveLater: PropTypes.func.isRequired } FreeFormComments.defaultProps = { comments: '', saveLater: false } const commentElement = assessment => { if (assessment.comments_html || assessment.comments) { return ( <div> <Text size="small" weight="bold"> {I18n.t('Comments')} </Text> {assessment.comments_html ? ( <div dangerouslySetInnerHTML={{__html: assessment.comments_html}} /> ) : ( <div>{assessment.comments}</div> )} </div> ) } else { return null } } export const CommentText = ({assessment, placeholder, weight}) => ( <span className="react-rubric-break-words"> <Text size="x-small" weight={weight}> {assessment !== null ? commentElement(assessment) : placeholder} </Text> </span> ) CommentText.propTypes = { assessment: PropTypes.shape(assessmentShape), placeholder: PropTypes.string, weight: PropTypes.string.isRequired } CommentText.defaultProps = { assessment: null, placeholder: '' } const Comments = props => { const {editing, assessment, footer, ...commentProps} = props if (!editing || assessment === null) { return ( <div className="rubric-freeform"> <CommentText assessment={assessment} placeholder={I18n.t( 'This area will be used by the assessor to leave comments related to this criterion.' )} weight="normal" /> {footer} </div> ) } else { return ( <FreeFormComments comments={assessment.comments} saveLater={assessment.saveCommentsForLater} {...commentProps} /> ) } } Comments.propTypes = { allowSaving: PropTypes.bool, editing: PropTypes.bool.isRequired, assessment: PropTypes.shape(assessmentShape), footer: PropTypes.node, large: PropTypes.bool, savedComments: PropTypes.arrayOf(PropTypes.string).isRequired, setComments: PropTypes.func.isRequired, setSaveLater: PropTypes.func.isRequired } Comments.defaultProps = { allowSaving: true, footer: null, large: true } export default Comments
src/components/topic/snapshots/foci/builder/nyttheme/EditNytThemeContainer.js
mitmedialab/MediaCloud-Web-Tools
import PropTypes from 'prop-types'; import React from 'react'; import { reduxForm, formValueSelector, Field } from 'redux-form'; import MenuItem from '@material-ui/core/MenuItem'; import { connect } from 'react-redux'; import { FormattedMessage, injectIntl } from 'react-intl'; import { Grid, Row, Col } from 'react-flexbox-grid/lib'; import AppButton from '../../../../../common/AppButton'; import withIntlForm from '../../../../../common/hocs/IntlForm'; import messages from '../../../../../../resources/messages'; import NytThemeCoveragePreviewContainer from './NytThemeCoveragePreviewContainer'; import NytThemeStoryCountsPreviewContainer from './NytThemeStoryCountsPreviewContainer'; const formSelector = formValueSelector('snapshotFocus'); const localMessages = { title: { id: 'focus.create.edit.title', defaultMessage: 'Step 2: Preview Subtopics by NYT Themes' }, about: { id: 'focus.create.edit.about', defaultMessage: 'This will create a set of subtopics as filtered by the NYT Themes you have selected.' }, numberLabel: { id: 'focus.create.edit.number', defaultMessage: '# Top Themes' }, }; const EditNytThemeContainer = (props) => { const { topicId, onPreviousStep, handleSubmit, finishStep, formData, initialValues, renderSelect } = props; const { formatMessage } = props.intl; let numThemes = initialValues.numberSelected; if (formData && formData.values.numberSelected) { numThemes = formData.values.numberSelected; } return ( <Grid> <form className="focus-create-edit-nyt-theme" name="focusCreateEditNytThemeForm" onSubmit={handleSubmit(finishStep.bind(this))}> <Row> <Col lg={8} md={12}> <h1><FormattedMessage {...localMessages.title} /></h1> <p><FormattedMessage {...localMessages.about} /></p> </Col> </Row> <Row> <Field name="numberSelected" component={renderSelect} label={formatMessage(localMessages.numberLabel)} value={5} > <MenuItem value={5}><FormattedMessage {...messages.top5} /></MenuItem> <MenuItem value={10}><FormattedMessage {...messages.top10} /></MenuItem> <MenuItem value={15}><FormattedMessage {...messages.top15} /></MenuItem> <MenuItem value={20}><FormattedMessage {...messages.top20} /></MenuItem> <MenuItem value={25}><FormattedMessage {...messages.top25} /></MenuItem> </Field> </Row> <Row> <Col lg={8} md={12}> <NytThemeCoveragePreviewContainer topicId={topicId} numThemes={numThemes} /> </Col> </Row> <Row> <Col lg={8} md={12}> <NytThemeStoryCountsPreviewContainer topicId={topicId} numThemes={numThemes} /> </Col> </Row> <Row> <Col lg={8} xs={12}> <br /> <AppButton color="secondary" variant="outlined" onClick={onPreviousStep} label={formatMessage(messages.previous)} /> &nbsp; &nbsp; <AppButton type="submit" label={formatMessage(messages.next)} primary /> </Col> </Row> </form> </Grid> ); }; EditNytThemeContainer.propTypes = { // from parent topicId: PropTypes.number.isRequired, initialValues: PropTypes.object, onPreviousStep: PropTypes.func.isRequired, onNextStep: PropTypes.func.isRequired, // from state formData: PropTypes.object, currentKeywords: PropTypes.string, currentFocalTechnique: PropTypes.string, // from dispatch finishStep: PropTypes.func.isRequired, // from compositional helper intl: PropTypes.object.isRequired, handleSubmit: PropTypes.func.isRequired, renderTextField: PropTypes.func.isRequired, renderSelect: PropTypes.func.isRequired, }; const mapStateToProps = state => ({ formData: state.form.snapshotFocus, currentKeywords: formSelector(state, 'keywords'), currentFocalTechnique: formSelector(state, 'focalTechnique'), }); const mapDispatchToProps = (dispatch, ownProps) => ({ finishStep: () => { ownProps.onNextStep({}); }, }); const reduxFormConfig = { form: 'snapshotFocus', // make sure this matches the sub-components and other wizard steps destroyOnUnmount: false, // so the wizard works }; export default injectIntl( withIntlForm( reduxForm(reduxFormConfig)( connect(mapStateToProps, mapDispatchToProps)( EditNytThemeContainer ) ) ) );
src/entry.js
sunya9/follow-manager
import React from 'react'; import { render } from 'react-dom'; import { Router, Route, IndexRoute, browserHistory } from 'react-router'; import Index from './containers/Index'; import NotFound from './components/NotFound'; import { syncHistoryWithStore } from 'react-router-redux'; import { Provider } from 'react-redux'; import '../scss/main.scss'; import configureStore, { DevTools } from './store/configureStore'; import App from './containers/App'; import 'bootstrap'; const store = configureStore(); const history = syncHistoryWithStore(browserHistory, store); render( <Provider store={store}> <div> <Router history={history}> <Route path="/" component={App}> <IndexRoute component={Index} /> <Route path="*" component={NotFound} /> </Route> </Router> <DevTools /> </div> </Provider> , document.getElementById('app')); if (module.hot) { module.hot.accept(); }
src/components/common/svg-icons/action/exit-to-app.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionExitToApp = (props) => ( <SvgIcon {...props}> <path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/> </SvgIcon> ); ActionExitToApp = pure(ActionExitToApp); ActionExitToApp.displayName = 'ActionExitToApp'; ActionExitToApp.muiName = 'SvgIcon'; export default ActionExitToApp;
example/shapefile.js
Charmatzis/react-leaflet-shapefile
import React from 'react'; import { Map, Circle, TileLayer, LayersControl, FeatureGroup } from 'react-leaflet' import JQuery from 'jquery' import {ShapeFile} from '../src' const { BaseLayer, Overlay } = LayersControl; export default class ShapefileExample extends React.Component { constructor() { super(); this.handleFile = this.handleFile.bind(this); this.readerLoad = this.readerLoad.bind(this); this.state = { geodata: null, isadded: false } } readerLoad(e) { this.setState({ geodata: e.target.result }); this.setState({ isadded: true }); } handleFile(e) { var reader = new FileReader(); var file = e.target.files[0]; reader.onload = function(upload) { this.readerLoad(upload); }.bind(this); reader.readAsArrayBuffer(file); } onEachFeature(feature, layer) { if (feature.properties) { layer.bindPopup(Object.keys(feature.properties).map(function(k) { return k + ": " + feature.properties[k]; }).join("<br />"), { maxHeight: 200 }); } } render() { let ShapeLayers = null; if (this.state.isadded === true) { ShapeLayers = (<Overlay checked name='Feature group'> <FeatureGroup color='purple'> <ShapeFile data={this.state.geodata} onEachFeature={this.onEachFeature} isArrayBufer={true}/> </FeatureGroup> </Overlay>); } return ( <div> <div > <input type="file" onChange={this.handleFile.bind(this) } className="inputfile"/> </div> <Map center={[42.09618442380296, -71.5045166015625]} zoom={2} zoomControl={true}> <LayersControl position='topright'> <BaseLayer checked name='OpenStreetMap.Mapnik'> <TileLayer url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"/> </BaseLayer> {ShapeLayers} </LayersControl> </Map> </div> ) } }
app/utils/markdown.js
BeautifulTrouble/beautifulrising-client
import React from 'react'; import { Link } from 'react-router'; import { gaClick, gaTrackedLinks } from 'utils/analytics'; export function RouterLink(props) { if (gaTrackedLinks.hasOwnProperty(props.href)) { return <a href={props.href} target={'_blank'} onClick={()=>gaClick(gaTrackedLinks[props.href])}>{props.children}</a>; } return ( props.href.match(/^(https?:)?\/\//) ? <a href={props.href} target={'_blank'}>{props.children}</a> : <Link to={props.href}>{props.children}</Link> ); }
components/HomeScreen.js
raylenmoore/mind-map-note
import React, { Component } from 'react'; import { View, StyleSheet, Text, } from 'react-native'; class HomeScreen extends React.Component { /** * This is where we can define any route configuration for this * screen. For example, in addition to the navigationBar title we * could add backgroundColor. */ static route = { navigationBar: { title: 'Home', } } render() { return ( <View style={{alignItems: 'center', justifyContent: 'center', flex: 1}}> <Text>HomeScreen!</Text> </View> ) } } module.exports = HomeScreen;
frontend/app/components/VisibilityMinimal/VisibilityMinimalPresentation.js
First-Peoples-Cultural-Council/fv-web-ui
import React from 'react' import PropTypes from 'prop-types' import Dialog from '@material-ui/core/Dialog' import DialogActions from '@material-ui/core/DialogActions' import DialogContent from '@material-ui/core/DialogContent' import DialogContentText from '@material-ui/core/DialogContentText' import IconButton from '@material-ui/core/IconButton' import CloseIcon from '@material-ui/icons/Close' // FPCC import FVButton from 'components/FVButton' import FVLabel from 'components/FVLabel' import FVSnackbar from 'components/FVSnackbar' import VisibilitySelect from 'components/VisibilitySelect' import { VisibilityMinimalStyles } from './VisibilityMinimalStyles' /** * @summary VisibilityMinimalPresentation * @version 1.0.1 * @component * * @param {object} props * * @returns {node} jsx markup */ function VisibilityMinimalPresentation({ computeEntities, dialectName, dialogContent, docVisibility, handleVisibilityChange, handleDialogCancel, handleDialogOk, isDialogOpen, snackbarOpen, handleSnackbarClose, writePrivileges, }) { const classes = VisibilityMinimalStyles() function generateVisibilityLabel(visibility) { switch (visibility) { case 'team': return ( <> {dialectName}&nbsp; <FVLabel transKey="team_only" defaultStr="Team Only" transform="first" /> </> ) case 'members': return ( <> {dialectName}&nbsp; <FVLabel transKey="members" defaultStr="Members" transform="first" /> </> ) case 'public': return <FVLabel transKey="public" defaultStr="Public" transform="first" /> default: return null } } return writePrivileges ? ( <div className={classes.base}> <VisibilitySelect.Container docVisibility={docVisibility} handleVisibilityChange={handleVisibilityChange} computeEntities={computeEntities} dialectName={dialectName} selectLabelText={'Who can see this?'} /> <Dialog fullWidth maxWidth="xs" open={isDialogOpen} aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" > <DialogContent> <DialogContentText id="alert-dialog-description" className={classes.dialogDescription}> Do you want to change who can see this to </DialogContentText> <div className={classes.dialogContent}> <strong>{generateVisibilityLabel(dialogContent)}</strong>? </div> </DialogContent> <DialogActions> <FVButton onClick={handleDialogCancel} variant="text" color="secondary"> <FVLabel transKey="cancel" defaultStr="Cancel" transform="first" /> </FVButton> <FVButton onClick={handleDialogOk} variant="contained" color="secondary" autoFocus> <FVLabel transKey="yes" defaultStr="Yes" transform="first" /> </FVButton> </DialogActions> </Dialog> <FVSnackbar open={snackbarOpen} autoHideDuration={3000} onClose={handleSnackbarClose} message={'Your entry can be seen by the ' + dialectName + ' ' + docVisibility} anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} action={ <IconButton size="small" aria-label="close" color="inherit" onClick={handleSnackbarClose}> <CloseIcon fontSize="small" /> </IconButton> } /> </div> ) : ( <div className={classes.base}> <div className={classes.label}>Who can see this entry?&nbsp;&nbsp;</div> <div className={classes.labelContents}>{generateVisibilityLabel(docVisibility)}</div> </div> ) } // PROPTYPES const { string, object, func, bool } = PropTypes VisibilityMinimalPresentation.propTypes = { computeEntities: object, dialectName: string, dialogContent: string, docVisibility: string, handleVisibilityChange: func, handleDialogCancel: func, handleDialogOk: func, isDialogOpen: bool, snackbarOpen: bool, handleSnackbarClose: func, writePrivileges: bool, } VisibilityMinimalPresentation.defaultProps = { dialectName: '', dialogContent: '', docVisibility: '', handleVisibilityChange: () => {}, handleDialogCancel: () => {}, handleDialogOk: () => {}, isDialogOpen: false, snackbarOpen: false, handleSnackbarClose: () => {}, writePrivileges: false, } export default VisibilityMinimalPresentation
sketch/src/components/Title.js
preciousforever/sketch-data-populator
import React from 'react' import './Title.scss' import classNames from 'classnames' import ReactDOM from 'react-dom' class Title extends React.Component { constructor() { super() this.state = { showTooltip: false, tooltipTop: 0, tooltipLeft: 0 } this.showTooltip = this.showTooltip.bind(this) this.hideTooltip = this.hideTooltip.bind(this) } showTooltip() { let questionMark = ReactDOM.findDOMNode(this.refs.questionMark) let titleContainer = ReactDOM.findDOMNode(this.refs.titleContainer) this.setState({ tooltipTop: titleContainer.offsetTop + questionMark.offsetTop - 7, tooltipLeft: titleContainer.offsetLeft + questionMark.offsetLeft + 16 + 5, showTooltip: true }) } hideTooltip() { this.setState({ showTooltip: false }) } render() { let titleContainerClass = classNames({ 'title-container': true, 'sub-title': this.props.subTitle }) let tooltipClass = classNames({ tooltip: true, show: this.state.showTooltip }) return ( <div ref="titleContainer" className={titleContainerClass} style={this.props.style}> <h1>{this.props.title}</h1> {this.props.description && !this.props.subTitle ? <h2>{this.props.description}</h2> : ''} {this.props.description && this.props.subTitle ? ( <div ref="questionMark" onMouseEnter={this.showTooltip} onMouseLeave={this.hideTooltip} className="question-mark" > <p>?</p> </div> ) : ( '' )} {this.props.description && this.props.subTitle ? ( <div style={{ top: this.state.tooltipTop, left: this.state.tooltipLeft }} className={tooltipClass} > <p>{this.props.description}</p> </div> ) : ( '' )} </div> ) } } export default Title
src/components/ui/Content.js
yuri/notality
import React from 'react'; const Content = ({ children, style = {}, isVisible }) => { return ( <div className={ `flex-auto mt3 p1` } style={{ ...styles.base, style }}> { isVisible ? children : null } </div> ); }; const styles = { base: {}, }; export default Content;
src/pages/Preferences/Volumes/VolumeForm.js
Kitware/HPCCloud
import React from 'react'; import PropTypes from 'prop-types'; import deepClone from 'mout/src/lang/deepClone'; import style from 'HPCCloudStyle/ItemEditor.mcss'; export default class VolumeForm extends React.Component { constructor(props) { super(props); this.formChange = this.formChange.bind(this); this.mergeData = this.mergeData.bind(this); } componentDidMount() { const data = deepClone(this.props.data); if (this.props.profiles.length) { data.profileId = this.props.profiles[0]._id; } if (this.props.onChange) { this.props.onChange(data); } } componentWillReceiveProps(nextProps) { if (this.nameInput && nextProps.data && !nextProps.data._id) { this.nameInput.focus(); } } formChange(event) { const propName = event.target.dataset.key; const value = event.target.value; if (this.props.onChange) { const data = deepClone(this.props.data); data[propName] = value; this.props.onChange(data); } } mergeData(updatedData) { const data = Object.assign({}, this.props.data, updatedData); this.props.onChange(data); } render() { if (!this.props.data) { return null; } return ( <div> <section className={style.group}> <label className={style.label}>Name</label> <input className={style.input} type="text" value={this.props.data.name} data-key="name" onChange={this.formChange} disabled={this.props.data._id} autoFocus required ref={(c) => { this.nameInput = c; }} /> </section> <section className={style.group}> <label className={style.label}>Size</label> <input className={style.input} type="number" min="1" max="16384" value={this.props.data.size} data-key="size" onChange={this.formChange} disabled={this.props.data._id} required /> </section> {/* only valid type on the endpoint is ebs? <section className={style.group}> <label className={style.label}>Type</label> <select className={style.input} data-key="type" onChange={this.formChange} disabled={this.props.data._id} required > { Object.keys(types).map((key, index) => <option key={`${key}_${index}`} value={types[key]}>{key} ({types[key]})</option>) } </select> </section> */} <section className={style.group}> <label className={style.label}>AWS Profile</label> <select className={style.input} data-key="profileId" onChange={this.formChange} disabled={this.props.data._id} defaultValue={ this.props.profiles.length ? this.props.profiles[0]._id : null } required > {this.props.profiles.map((prof) => ( <option key={`${prof._id}`} value={prof._id}> {prof.name} </option> ))} </select> </section> </div> ); } } VolumeForm.propTypes = { data: PropTypes.object, profiles: PropTypes.array, onChange: PropTypes.func, }; VolumeForm.defaultProps = { data: undefined, profiles: undefined, onChange: undefined, };
client/modules/expense/components/.stories/expense_page.js
BitSherpa/expensius
import React from 'react'; import { storiesOf, action } from '@kadira/storybook'; import { setComposerStub } from 'react-komposer'; import ExpensePage from '../expense_page.jsx'; storiesOf('expense.ExpensePage', module) .add('default view', () => { return ( <ExpensePage /> ); })
frontend/src/screens/monitor/widgets/controls/controls.js
linea-it/qlf
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import Popover from '@material-ui/core/Popover'; import FormLabel from '@material-ui/core/FormLabel'; import FormControl from '@material-ui/core/FormControl'; import FormGroup from '@material-ui/core/FormGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Checkbox from '@material-ui/core/Checkbox'; import ConfirmDialog from '../../../../components/dialog/dialog'; const styles = { controls: { minWidth: '5em', width: '30vw', marginLeft: '1vw', display: 'flex', alignItems: 'center', }, button: { fontSize: '1.2vw', marginRight: 12, padding: '0 1vw', minHeight: 0, }, green: { backgroundColor: 'green', color: 'white' }, red: { backgroundColor: 'red', color: 'white' }, clearButtons: { fontSize: '1.2vw', padding: '1.2vw', minHeight: 0 }, clearButton: { fontSize: '1.2vw', marginTop: '0.8vh' }, checkbox: { height: '2.8vh' }, titleText: { fontSize: '1.25vw', }, text: { fontSize: '1.1vw', }, }; class Controls extends Component { constructor(props) { super(props); this.state = { selectedClearDisk: [], confirmDialog: false, }; } static propTypes = { socket: PropTypes.object, daemonRunning: PropTypes.bool, classes: PropTypes.object, resetMonitor: PropTypes.func.isRequired, }; startPipeline = () => { this.props.socket.state.ws.send('startPipeline'); }; stopPipeline = () => { this.props.socket.state.ws.send('stopPipeline'); }; renderStartOrStop = () => { const { classes } = this.props; return this.props.daemonRunning ? ( <Button className={classes.button} classes={{ raised: classes.red }} variant="raised" onMouseDown={this.stopPipeline} > Stop </Button> ) : ( <Button className={classes.button} classes={{ raised: classes.green }} variant="raised" onMouseDown={this.startPipeline} > Start </Button> ); }; renderReset = () => ( <Button className={this.props.classes.button} variant="raised" onMouseDown={this.props.resetMonitor} disabled={this.props.daemonRunning} > Reset </Button> ); renderClear = () => ( <Button className={this.props.classes.button} variant="raised" onMouseDown={this.handleClick} > Clear Disk </Button> ); state = { anchorEl: null, }; handleClick = event => { this.setState({ anchorEl: event.currentTarget, }); }; handleClose = () => { this.setState({ anchorEl: null, }); }; handleChangeCheckbox = name => { const { selectedClearDisk } = this.state; if (!selectedClearDisk.find(c => c === name)) { this.setState({ selectedClearDisk: selectedClearDisk.concat(name), }); } else { this.setState({ selectedClearDisk: selectedClearDisk.filter(tch => tch !== name), }); } }; renderClearPopover = () => { const { anchorEl } = this.state; const { classes } = this.props; return ( <Popover open={Boolean(anchorEl)} anchorEl={anchorEl} onClose={this.handleClose} anchorOrigin={{ vertical: 'bottom', horizontal: 'right', }} transformOrigin={{ vertical: 'top', horizontal: 'left', }} > <div className={classes.clearButtons}> <FormControl component="fieldset"> <FormLabel classes={{ root: this.props.classes.titleText }} component="legend" > Delete Files </FormLabel> <FormGroup> {/* <FormControlLabel control={ <Checkbox checked={this.state.selectedClearDisk.find( c => c === 'raw' )} classes={{ root: classes.checkbox, }} onChange={() => this.handleChangeCheckbox('raw')} /> } label="Raw" /> */} <FormControlLabel control={ <Checkbox checked={this.state.selectedClearDisk.find( c => c === 'reduced' )} classes={{ root: classes.checkbox, }} onChange={() => this.handleChangeCheckbox('reduced')} /> } classes={{ label: this.props.classes.text }} label="Reduced" /> <FormControlLabel control={ <Checkbox checked={this.state.selectedClearDisk.find( c => c === 'logs' )} classes={{ root: classes.checkbox, }} onChange={() => this.handleChangeCheckbox('log')} /> } classes={{ label: this.props.classes.text }} label="Logs" /> </FormGroup> <Button className={classes.clearButton} onMouseDown={this.confirmDeleteFiles} fullWidth variant="raised" disabled={this.state.selectedClearDisk.length === 0} > submit </Button> </FormControl> </div> </Popover> ); }; confirmDeleteFiles = () => { this.setState({ confirmDialog: true, confirmDialogSubtitle: `Are sure you want to delete all ${this.state.selectedClearDisk.join( ', ' )} files?`, }); }; confirmDelete = () => { this.state.selectedClearDisk.forEach(type => { this.props.socket.state.ws.send( `delete${type.charAt(0).toUpperCase() + type.slice(1)}` ); }); this.setState({ anchorEl: null, selectedClearDisk: [] }); }; closeConfirmDialog = () => { this.setState({ confirmDialog: false }); }; render() { return ( <div style={styles.controls}> <ConfirmDialog title={'Confirmation'} subtitle={this.state.confirmDialogSubtitle} open={this.state.confirmDialog} handleClose={this.closeConfirmDialog} onConfirm={this.confirmDelete} /> {this.renderClearPopover()} {this.renderStartOrStop()} {this.renderReset()} {this.renderClear()} </div> ); } } export default withStyles(styles)(Controls);
example/containers/Root.js
ForbesLindesay/redux-wait
import React, { Component } from 'react'; import { Provider } from 'react-redux'; import { Router, Route } from 'react-router'; import App from './App'; import UserPage from './UserPage'; import RepoPage from './RepoPage'; export default class Root extends Component { render() { return ( <div> <Provider store={this.props.store}> {() => <Router history={this.props.history}> <Route path='/' component={App}> <Route path='/:login/:name' component={RepoPage} /> <Route path='/:login' component={UserPage} /> </Route> </Router> } </Provider> </div> ); } }
code/L8-staging/Composing Components/components/movies/movies-page.js
santhoshthepro/reactjs
import React, { Component } from 'react'; import { Link } from 'react-router'; import MovieBox from './movie-box'; export default class MoviesPage extends Component{ constructor(props){ super(props); //Here is where you initialize state this.state ={ movies: [ {key:'1', title: 'Kabali',desc:'Super Star Release',pic:'http://bit.do/movie-pic1'}, {key:'2', title: 'Dangal',desc:'Amir Khan Special Release',pic:'http://bit.do/movie-pic2'}, {key:'3', title: 'Star Wars',desc:'Next Episode',pic:'http://bit.do/movie-pic5'} ] } this.handleBooking = this.handleBooking.bind(this); this.handleReadMore = this.handleReadMore.bind(this); } handleBooking(movie){ console.log("Booking Received!"); console.log("Title: "+ movie.movieTitle); console.log("Desc: "+ movie.desc); } handleReadMore(){ console.log("Read More..."); } render(){ var movieItems = this.state.movies.map(function(movie){ return <MovieBox key={movie.key} desc={movie.desc} title={movie.title} pic={movie.pic} handleBooking={this.handleBooking} handleReadMore={this.handleReadMore}/> }.bind(this)); return ( <div> {/* <h2>This is a Movies Page</h2> */} {movieItems} </div> ); } }
src/route/adminuser/UserRoleTabHeader.js
simors/yjbAdmin
import React from 'react'; import {connect} from 'react-redux'; import {action, selector} from './redux'; class UserRoleTabHeader extends React.Component { constructor(props) { super(props); } onSave = () => { }; render() { return ( <div style={{display: "flex", flexFlow: "column"}}> <div style={{display: "flex", alignItems: "flex-end"}}> <span>用户角色</span> </div> <hr/> </div> ); } } const mapStateToProps = (appState, ownProps) => { const selectedUserIds = selector.selectSelectedUserIds(appState); const checkedUserRoles = selector.selectCheckedUserRoles(appState); return { selectedUserIds, checkedUserRoles, }; }; const mapDispatchToProps = { ...action, }; export default connect(mapStateToProps, mapDispatchToProps)(UserRoleTabHeader);
src/components/common/CardSection.js
brianyamasaki/rideshare
import React from 'react'; import { View } from 'react-native'; const CardSection = (props) => { return ( <View style={[styles.containerStyle, props.style]}> {props.children} </View> ); }; const styles = { containerStyle: { borderBottomWidth: 1, padding: 5, backgroundColor: '#fff', justifyContent: 'flex-start', flexDirection: 'row', borderColor: '#ddd', position: 'relative' } }; export { CardSection };
examples/material-UI-components/src/App.js
react-tools/react-table
import React from 'react' import CssBaseline from '@material-ui/core/CssBaseline' import MaUTable from '@material-ui/core/Table' import TableBody from '@material-ui/core/TableBody' import TableCell from '@material-ui/core/TableCell' import TableHead from '@material-ui/core/TableHead' import TableRow from '@material-ui/core/TableRow' import { useTable } from 'react-table' import makeData from './makeData' function Table({ columns, data }) { // Use the state and functions returned from useTable to build your UI const { getTableProps, headerGroups, rows, prepareRow } = useTable({ columns, data, }) // Render the UI for your table return ( <MaUTable {...getTableProps()}> <TableHead> {headerGroups.map(headerGroup => ( <TableRow {...headerGroup.getHeaderGroupProps()}> {headerGroup.headers.map(column => ( <TableCell {...column.getHeaderProps()}> {column.render('Header')} </TableCell> ))} </TableRow> ))} </TableHead> <TableBody> {rows.map((row, i) => { prepareRow(row) return ( <TableRow {...row.getRowProps()}> {row.cells.map(cell => { return ( <TableCell {...cell.getCellProps()}> {cell.render('Cell')} </TableCell> ) })} </TableRow> ) })} </TableBody> </MaUTable> ) } function App() { const columns = React.useMemo( () => [ { Header: 'Name', columns: [ { Header: 'First Name', accessor: 'firstName', }, { Header: 'Last Name', accessor: 'lastName', }, ], }, { Header: 'Info', columns: [ { Header: 'Age', accessor: 'age', }, { Header: 'Visits', accessor: 'visits', }, { Header: 'Status', accessor: 'status', }, { Header: 'Profile Progress', accessor: 'progress', }, ], }, ], [] ) const data = React.useMemo(() => makeData(20), []) return ( <div> <CssBaseline /> <Table columns={columns} data={data} /> </div> ) } export default App
src/collections/valueMachine/affirm/Affirm.js
michael-eightnine/hometown-advantage-2
import React from 'react' import ThumbsUp from './../../../svg/affirmation/thumbsUp.svg' import CollectionFooter from './../../../grid/extras/CollectionFooter' const Affirm = () => { return ( <div className='affirm-display'> <img src={ThumbsUp} alt='GJ!' className='thumbs-up' /> <h2>!SELF AFFIRMATION! VERY IMPRESSIVE GOOD JOB !GREAT!</h2> <CollectionFooter /> </div> ) } export default Affirm
docs/src/SupportPage.js
johanneshilden/react-bootstrap
import React from 'react'; import NavMain from './NavMain'; import PageHeader from './PageHeader'; import PageFooter from './PageFooter'; export default class Page extends React.Component { render() { return ( <div> <NavMain activePage="support" /> <PageHeader title="Need help?" subTitle="Community resources for answering your React-Bootstrap questions." /> <div className="container bs-docs-container"> <div className="row"> <div className="col-md-9" role="main"> <div className="bs-docs-section"> <p className="lead">Stay up to date on the development of React-Bootstrap and reach out to the community with these helpful resources.</p> <h3>Stack Overflow</h3> <p><a href="http://stackoverflow.com/questions/ask">Ask questions</a> about specific problems you have faced, including details about what exactly you are trying to do. Make sure you tag your question with <code className="js">react-bootstrap</code>. You can also read through <a href="http://stackoverflow.com/questions/tagged/react-bootstrap">existing React-Bootstrap questions</a>.</p> <h3>Live help</h3> <p>Bring your questions and pair with other react-bootstrap users in a <a href="http://start.thinkful.com/react/?utm_source=github&utm_medium=badge&utm_campaign=react-bootstrap">live Thinkful hangout</a>. Hear about the challenges other developers are running into, or screenshare your own code with the group for feedback.</p> <h3>Chat rooms</h3> <p>Discuss questions in the <code className="js">#react-bootstrap</code> channel on the <a href="http://www.reactiflux.com/">Reactiflux Slack</a> or on <a href="https://gitter.im/react-bootstrap/react-bootstrap">Gitter</a>.</p> <h3>GitHub issues</h3> <p>The issue tracker is the preferred channel for bug reports, features requests and submitting pull requests. See more about how we use issues in the <a href="https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md#issues">contribution guidelines</a>.</p> </div> </div> </div> </div> <PageFooter /> </div> ); } shouldComponentUpdate() { return false; } }
src/index.js
lambdablocks/blocks-front-react
import { parse } from 'query-string' import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import LambdaBricksApp from './components/LambdaBricksApp' import configureStore from './store/configureStore' const store = configureStore() const params = parse(location.search) ReactDOM.render( <Provider store={store}> <LambdaBricksApp libraryId={ params['id'] } workspaceType={ params['ws'] } /> </Provider>, document.getElementById('main') )
src/js/components/Image/stories/Fit.js
HewlettPackard/grommet
import React from 'react'; import { Grommet, Box, Image } from 'grommet'; import { grommet } from 'grommet/themes'; export const Fit = () => ( <Grommet theme={grommet}> <Box align="start" gap="medium"> <Box height="small" width="small" border> <Image src="//v2.grommet.io/assets/IMG_4245.jpg" fit="contain" /> </Box> <Box height="small" width="small" border> <Image src="//v2.grommet.io/assets/IMG_4245.jpg" fit="cover" /> </Box> </Box> </Grommet> ); export default { title: 'Media/Image/Fit', };
src/svg-icons/device/dvr.js
ruifortes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceDvr = (props) => ( <SvgIcon {...props}> <path d="M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2zm0 14H3V5h18v12zm-2-9H8v2h11V8zm0 4H8v2h11v-2zM7 8H5v2h2V8zm0 4H5v2h2v-2z"/> </SvgIcon> ); DeviceDvr = pure(DeviceDvr); DeviceDvr.displayName = 'DeviceDvr'; DeviceDvr.muiName = 'SvgIcon'; export default DeviceDvr;