path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
src/svg-icons/image/looks.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageLooks = (props) => (
<SvgIcon {...props}>
<path d="M12 10c-3.86 0-7 3.14-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.86-3.14-7-7-7zm0-4C5.93 6 1 10.93 1 17h2c0-4.96 4.04-9 9-9s9 4.04 9 9h2c0-6.07-4.93-11-11-11z"/>
</SvgIcon>
);
ImageLooks = pure(ImageLooks);
ImageLooks.displayName = 'ImageLooks';
ImageLooks.muiName = 'SvgIcon';
export default ImageLooks;
|
src/components/index.js | Vision100IT/v100it-template | import React from 'react';
import PropTypes from 'prop-types';
import TransitionGroup from 'react-transition-group/TransitionGroup';
import CSSTransition from 'react-transition-group/CSSTransition';
import content from '../content';
import Header from './header';
import SearchBar from './search-bar';
import MainMenu from './main-menu';
import MobileMenu from './mobile-menu';
import styles from './Index.scss';
class Index extends React.Component {
constructor(props) {
super(props);
this.state = {
showSearch: false
};
this.handleOpenSearch = this.handleOpenSearch.bind(this);
this.handleCloseSearch = this.handleCloseSearch.bind(this);
}
handleOpenSearch(event) {
event.preventDefault();
this.setState({showSearch: true});
}
handleCloseSearch() {
this.setState({showSearch: false});
}
render() {
return (
<div className={styles.content}>
<Header size={this.props.headerSize}>
<MobileMenu onOpenSearch={this.handleOpenSearch}/>
<MainMenu menuItems={this.props.menuItems} onOpenSearch={this.handleOpenSearch}/>
</Header>
{this.props.children}
<TransitionGroup>
{this.state.showSearch && (
<CSSTransition timeout={300} classNames={styles}>
<SearchBar onClose={this.handleCloseSearch}/>
</CSSTransition>
)}
</TransitionGroup>
</div>
);
}
}
Index.defaultProps = {
headerSize: 'full',
menuItems: content.clientmenu.links
};
Index.propTypes = {
headerSize: Header.propTypes.size,
children: PropTypes.node.isRequired,
menuItems: MainMenu.propTypes.menuItems
};
export default Index;
|
app/components/icons/twitter.js | flocks/deeprun-front | import React from 'react';
const Twitter = () => {
const text = 'Check your chances on @Deeprun_Poker before you call';
const url = 'https://twitter.com/intent/tweet?text=' + text;
return (
<div>
<a className="twitter-share-button"
href={url}
>
share
</a>
<span>Talk about deeprun to your friends!</span>
</div>
);
};
export default Twitter;
|
src/www/js/forms/race-form.js | nickolusroy/react_dnd | import React from 'react';
import raceData from '../../json/races.json';
import * as utilities from "../utilities.js";
import { DropDown } from '../form-fields/drop-down.js';
import { TextInput } from '../form-fields/text-input.js';
import { CheckBoxGroup } from '../form-fields/checkbox-group.js';
import { SubmitButton } from '../form-fields/submit-button.js';
import { SkillsForm } from './skills-form.js';
export class RaceForm extends React.Component {
constructor(props) {
super(props);
this.state = {};
this.onChange = this.onChange.bind(this);
this.setLanguageChoice = this.setLanguageChoice.bind(this);
this.setDraconicAncestry = this.setDraconicAncestry.bind(this);
this.skillsForm = new SkillsForm(props);
};
onChange(e) {
this.setState({
race : document.querySelector('[name=select_race]').value,
});
//this.resetRaceData();
this.skillsForm.setSkillChoices(e);
this.props.onUpdate(e);
}
setLanguageChoice(e) {
let languageElems = document.querySelectorAll('[name=select_extra_language]') || [];
let l = languageElems.length;
let index = 0;
let i = 0;
this.props.charData.selected_languages = this.props.charData.selected_languages || [];
this.props.charData.proficiencies = this.props.charData.proficiencies || {};
this.props.charData.proficiencies.languages = this.props.charData.proficiencies.languages || [];
if (l > 0) {
for (i=0; i<l; i += 1) {
this.props.charData.selected_languages.push(languageElems[i].value)
this.props.charData.proficiencies.languages.push(languageElems[i].value);
}
} else {
if (this.props.charData.selected_languages) {
l = this.props.charData.selected_languages.length;
for (i=0; i<l; i+=1) {
index = this.props.charData.proficiencies.languages.indexOf(this.props.charData.selected_languages[i]);
if (index > -1) {
this.props.charData.proficiencies.languages.splice(index, 1);
}
this.props.charData.proficiencies.languages.push('choice');
}
}
this.props.charData.selected_languages = [];
}
this.props.onUpdate(e);
}
resetRaceData(e) {
this.props.charData.proficiencies = {}
this.props.charData.selected_languages = [];
this.props.charData.feats = [];
if (e && e.target && e.target.getAttribute('name') === "select_race") {
this.props.charData.ability_score_increase = {};
}
}
getRaceNames() {
let raceNames = [];
let race = "";
for (race in raceData) {
raceNames.push(raceData[race])
}
return raceNames;
}
setDraconicAncestry(e) {
let i = 0;
let l = 0;
if (this.props.charData) {
this.props.charData.feats = this.props.charData.feats || [];
l = this.props.charData.feats.length;
for (i = 0; i < l; i+= 1) {
if (this.props.charData.feats && this.props.charData.feats[i] && this.props.charData.feats[i].indexOf("draconic_ancestry_") > -1) {
this.props.charData.feats.splice(i, 1)
}
}
this.props.charData.feats.push("draconic_ancestry_"+e.target.value.toLowerCase());
}
this.props.onUpdate(e);
}
getDraconicAncestryForm(thisRaceData) {
let raceName = this.props.charData.select_race;
let draconicAncestryForm = "";
let draconicAncestryChoices = [];
let item = "";
if (raceName === "Dragonborn") {
for (item in thisRaceData.draconic_ancestry) {
draconicAncestryChoices.push({
id : thisRaceData.draconic_ancestry[item].name,
label : thisRaceData.draconic_ancestry[item].name+" | "+thisRaceData.draconic_ancestry[item].damage_type+" | "+thisRaceData.draconic_ancestry[item].breath_weapon,
name : thisRaceData.draconic_ancestry[item].name
});
}
return <DropDown name="select_draconic_ancestry" className="select-race" label="Select Draconic Ancestry" choices={draconicAncestryChoices} onUpdate={this.setDraconicAncestry}/>;
}
return false;
}
getAbilityScoreChoiceForm (thisRaceData) {
let raceName = this.props.charData.select_race;
let abilityScores = [
{label : "Strength", name : "ability_score_increase_str", value : 1, id : "str"},
{label : "Constitution", name : "ability_score_increase_con", value : 1, id : "con"},
{label : "Dexterity", name : "ability_score_increase_dex", value : 1, id : "dex"},
{label : "Wisdom", name : "ability_score_increase_wis", value : 1, id : "wis"},
{label : "Intelligence", name : "ability_score_increase_int", value : 1, id : "int"}
];
if (raceName === "Half-Elf") {
return <CheckBoxGroup name="half_elf_abilities" label="Select Abilities" choices={abilityScores} groupLabel="Select Two Abilities" groupName="halfelf_ability_score" optionsLimit={thisRaceData.ability_score_choices} onUpdate={this.props.onUpdate} />;
}
}
getLanguageChoiceForm (thisRaceData) {
let raceName = this.props.charData.select_race;
let subRaceName = this.props.charData.select_subrace;
let thisSubRaceData = utilities.getObjectByName(thisRaceData.subraces,subRaceName);;
let languageChoiceForm = "";
let raceIndex = 0;
let subraceIndex = 0;
if (thisRaceData) {
raceIndex = thisRaceData.proficiencies.languages.indexOf("choice")
if (thisRaceData.proficiencies.languages && raceIndex > -1) {
languageChoiceForm = <div><TextInput type="text" label="Extra Language" name="select_extra_language" /><SubmitButton label="Choose" onUpdate={this.setLanguageChoice} /></div>
} else if (this.props.charData && this.props.charData.proficiences && this.props.charData.proficiences.languages && this.props.charData.proficiences.languages.indexOf('choice') > -1) {
languageChoiceForm = <div><TextInput type="text" label="Extra Language" name="select_extra_language" /><SubmitButton label="Choose" onUpdate={this.setLanguageChoice} /></div>
}
if (thisSubRaceData && thisSubRaceData.proficiencies && thisSubRaceData.proficiencies.languages) {
subraceIndex = thisSubRaceData.proficiencies.languages.indexOf("choice");
if (subraceIndex > -1) {
languageChoiceForm = <div><TextInput type="text" label="Extra Language" name="select_extra_language" /><SubmitButton label="Choose" onUpdate={this.setLanguageChoice} /></div>
}
}
if (this.props.charData.selected_languages && this.props.charData.selected_languages.length > 0) {
languageChoiceForm = <div><SubmitButton label="Choose a different language" onUpdate={this.setLanguageChoice} /></div>
}
}
return languageChoiceForm
}
getSubraceForm(thisRaceData) {
let raceName = this.props.charData.select_race;
let subRaceName = this.props.charData.select_subrace;
let thisSubRaceData = utilities.getObjectByName(thisRaceData.subraces,subRaceName);;
let subraces = thisRaceData.subraces;
let subRaceForm = "";
if (thisRaceData) {
if (subraces && subraces.length) {
subRaceForm = <DropDown name="select_subrace" label="Select Subrace" choices={subraces} onUpdate={this.props.onUpdate}/>;
}
}
return subRaceForm;
}
getThisRaceData() {
let raceName = this.props.charData.select_race;
let thisRaceData = utilities.getObjectByName(raceData,raceName);
return thisRaceData;
}
render() {
let thisRaceData = this.getThisRaceData();
return <div className="form-field race-form">
<h2>Race</h2>
<DropDown name="select_race" className="select-race" label="Select Race" choices={this.getRaceNames()} onUpdate={this.onChange}/>
{this.getSubraceForm(thisRaceData)}
{this.getLanguageChoiceForm(thisRaceData)}
{this.getAbilityScoreChoiceForm(thisRaceData)}
{this.getDraconicAncestryForm(thisRaceData)}
</div>
}
}
|
src/components/PostList/index.js | tomasz-szymanek/yet-another-boilerplate | import React from 'react';
import PostLink from '../PostLink';
const PostList = ({ posts, children }) => (
<div className="content">
<div className="posts-list">
{ posts.map(
(post, index) => (<PostLink key={index} nr={index} text={post} />)
) }
</div>
<div><br /><br />
{children}
</div>
</div>
);
PostList.propTypes = {
posts: React.PropTypes.array,
children: React.PropTypes.object,
};
export default PostList;
|
docs/src/app/components/pages/components/Slider/ExampleDisabled.js | kittyjumbalaya/material-components-web | import React from 'react';
import Slider from 'material-ui/Slider';
const SliderExampleDisabled = () => (
<div>
<Slider disabled={true} />
<Slider disabled={true} value={0.5} />
<Slider disabled={true} value={1} />
</div>
);
export default SliderExampleDisabled;
|
docs/build.js | HPate-Riptide/react-bootstrap | /* eslint no-console: 0 */
import fsp from 'fs-promise';
import path from 'path';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import {match, RouterContext} from 'react-router';
import Root from './src/Root';
import routes from './src/Routes';
import metadata from './generate-metadata';
import {copy} from '../tools/fs-utils';
import {exec} from '../tools/exec';
const repoRoot = path.resolve(__dirname, '../');
const docsBuilt = path.join(repoRoot, 'docs-built');
const license = path.join(repoRoot, 'LICENSE');
const readmeSrc = path.join(__dirname, 'README.docs.md');
const readmeDest = path.join(docsBuilt, 'README.md');
/**
* Generates HTML code for `fileName` page.
*
* @param {string} fileName Path for Router.Route
* @return {Promise} promise
* @internal
*/
function generateHTML(fileName) {
return new Promise( resolve => {
const location = fileName === 'index.html' ? '/' : `/${fileName}`;
match({routes, location}, (error, redirectLocation, renderProps) => {
let html = ReactDOMServer.renderToString(
<RouterContext {...renderProps} />
);
html = '<!doctype html>' + html;
let write = fsp.writeFile(path.join(docsBuilt, fileName), html);
resolve(write);
});
});
}
export default function BuildDocs({dev}) {
console.log('Building: '.cyan + 'docs'.green + (dev ? ' [DEV]'.grey : ''));
const devOption = dev ? '' : '-p';
return exec(`rimraf ${docsBuilt}`)
.then(() => fsp.mkdir(docsBuilt))
.then(metadata)
.then(propData => {
Root.assetBaseUrl = '';
Root.propData = propData;
const pagesGenerators = Root.getPages().map(generateHTML);
return Promise.all(pagesGenerators.concat([
exec(`webpack --config webpack.docs.js --bail ${devOption}`),
copy(license, docsBuilt),
copy(readmeSrc, readmeDest)
]));
})
.then(() => console.log('Built: '.cyan + 'docs'.green + (dev ? ' [DEV]'.grey : '')));
}
|
client/src/utils/index.js | kat09kat09/GigRTC | import React from 'react';
import ReactDOM from 'react-dom';
export function createReducer(initialState,allSwitches){
return (state = initialState,action) =>{
const reduceSelection = allSwitches[action.type];
return reduceSelection ? reduceSelection(state,action.payload) : state;
}
}
export function createConstants(...constants) {
return constants.reduce((acc, constant) => {
acc[constant] = constant;
return acc;
}, {});
}
export function checkHttpStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response
} else {
var error = new Error(response.statusText)
error.response = response
throw error
}
}
export function parseJSON(response) {
return response.json()
}
|
web/src/server/frontend/render.js | Brainfock/este | import DocumentTitle from 'react-document-title';
import Html from './html.react';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import config from '../config';
import createLocation from 'history/lib/createLocation';
import createRoutes from '../../client/createRoutes';
import createStore from './createStore';
import useragent from 'useragent';
import {HOT_RELOAD_PORT} from '../../../webpack/constants';
import {IntlProvider} from 'react-intl';
import {Provider} from 'react-redux';
import {RoutingContext, match} from 'react-router';
export default function render(req, res, next) {
createStore(req)
.then(store => renderPage(store, req, res, next))
.catch(next);
}
function renderPage(store, req, res, next) {
const routes = createRoutes(() => store.getState());
const location = createLocation(req.url);
match({routes, location}, (error, redirectLocation, renderProps) => {
if (redirectLocation) {
res.redirect(301, redirectLocation.pathname + redirectLocation.search);
return;
}
if (error) {
next(error);
return;
}
if (renderProps == null) {
res.status(404).end();
return;
}
const ua = useragent.is(req.headers['user-agent']);
const appHtml = getAppHtml(store, renderProps);
const clientState = store.getState();
const html = getPageHtml(appHtml, clientState, req.hostname, ua);
res.send(html);
});
}
function getAppHtml(store, renderProps) {
return ReactDOMServer.renderToString(
<Provider store={store}>
<IntlProvider>
<RoutingContext {...renderProps} />
</IntlProvider>
</Provider>
);
}
function getPageHtml(appHtml, clientState, hostname, ua) {
let scriptHtml = '';
const needIntlPolyfill = ua.safari || (ua.ie && ua.version < '11');
if (needIntlPolyfill) {
scriptHtml += `
<script src="/node_modules/intl/dist/Intl.min.js"></script>
<script src="/node_modules/intl/locale-data/jsonp/en-US.js"></script>`;
}
const appScriptSrc = config.isProduction
? '/_assets/app.js?' + config.assetsHashes.appJs
: `//${hostname}:${HOT_RELOAD_PORT}/build/app.js`;
scriptHtml += `
<script>
window.__INITIAL_STATE__ = ${JSON.stringify(clientState)};
</script>
<script src="${appScriptSrc}"></script>
`;
const title = DocumentTitle.rewind();
return '<!DOCTYPE html>' + ReactDOMServer.renderToStaticMarkup(
<Html
appCssHash={config.assetsHashes.appCss}
bodyHtml={`<div id="app">${appHtml}</div>` + scriptHtml}
googleAnalyticsId={config.googleAnalyticsId}
isProduction={config.isProduction}
title={title}
/>
);
}
|
src/svg-icons/notification/sync-problem.js | xmityaz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NotificationSyncProblem = (props) => (
<SvgIcon {...props}>
<path d="M3 12c0 2.21.91 4.2 2.36 5.64L3 20h6v-6l-2.24 2.24C5.68 15.15 5 13.66 5 12c0-2.61 1.67-4.83 4-5.65V4.26C5.55 5.15 3 8.27 3 12zm8 5h2v-2h-2v2zM21 4h-6v6l2.24-2.24C18.32 8.85 19 10.34 19 12c0 2.61-1.67 4.83-4 5.65v2.09c3.45-.89 6-4.01 6-7.74 0-2.21-.91-4.2-2.36-5.64L21 4zm-10 9h2V7h-2v6z"/>
</SvgIcon>
);
NotificationSyncProblem = pure(NotificationSyncProblem);
NotificationSyncProblem.displayName = 'NotificationSyncProblem';
NotificationSyncProblem.muiName = 'SvgIcon';
export default NotificationSyncProblem;
|
src/app/utils/createElement.js | zalmoxisus/remotedev-app | import React from 'react';
const createElement = (originalProps) => (ChildComponent, props) => (
<ChildComponent {...props} {...originalProps} />
);
export default createElement;
|
app/app.js | ASH-khan/advanced-react | /**
* 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/components/InfiniteCarouselArrow.js | leaffm/react-infinite-carousel | import React from 'react';
import PropTypes from 'prop-types';
import './InfiniteCarousel.css';
const InfiniteCarouselArrow = function ({ carouselName, next, onClick }) {
const arrowClassName = 'InfiniteCarouselArrow';
let typeClassName;
if (next) {
typeClassName = 'InfiniteCarouselArrowNext';
} else {
typeClassName = 'InfiniteCarouselArrowPrev';
}
const iconClassName = 'InfiniteCarouselArrowIcon';
let iconTypeClassName;
if (next) {
iconTypeClassName = 'InfiniteCarouselArrowNextIcon';
} else {
iconTypeClassName = 'InfiniteCarouselArrowPrevIcon';
}
const className = `${arrowClassName} ${typeClassName}`;
const classNameIcon = `${iconClassName} ${iconTypeClassName}`;
const buttonName = `${carouselName}-button-${next ? 'next' : 'previous'}`;
return (
<button
name={buttonName}
data-testid={buttonName}
className={className}
onClick={onClick}
type="button"
>
<i className={classNameIcon} />
</button>
);
};
InfiniteCarouselArrow.propTypes = {
carouselName: PropTypes.string.isRequired,
next: PropTypes.bool,
onClick: PropTypes.func.isRequired,
};
InfiniteCarouselArrow.defaultProps = {
next: true,
};
export default InfiniteCarouselArrow;
|
src/components/LoadingContainer/LoadingContainer.js | eunvanz/handpokemon2 | import React from 'react'
import PropTypes from 'prop-types'
import Loading from '../Loading'
import ContentContainer from '../ContentContainer'
import CenterMidContainer from '../CenterMidContainer'
class LoadingContainer extends React.PureComponent {
render () {
const { text } = this.props
return (
<ContentContainer
style={{ marginTop: '63px' }}
body={
<CenterMidContainer
bodyComponent={
<Loading text={text} />
}
/>
}
/>
)
}
}
LoadingContainer.propTypes = {
text: PropTypes.string.isRequired
}
export default LoadingContainer
|
app/components/List/index.js | itimofeev/hustlesa-ui | import React from 'react';
import styles from './styles.css';
function List(props) {
const ComponentToRender = props.component;
let content = (<div></div>);
// If we have items, render them
if (props.items) {
content = props.items.map((item, index) => (
<ComponentToRender key={`item-${index}`} item={item} />
));
} else {
// Otherwise render a single component
content = (<ComponentToRender />);
}
return (
<div className={styles.listWrapper}>
<ul className={styles.list}>
{content}
</ul>
</div>
);
}
List.propTypes = {
component: React.PropTypes.func.isRequired,
items: React.PropTypes.array,
};
export default List;
|
src/common/components/Page.js | barolab/razzle-complete-example | import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import { TransitionGroup } from 'react-transition-group';
import { Container, Segment, Image } from 'semantic-ui-react';
import Error from './Error';
import Block from './Block';
import Pop from '../animations/Pop';
import './Page.css';
export const PageComponent = ({ page, loading, error }) => {
if (error && error.status && error.message) {
return <Error status={error.status} message={error.message} />;
}
if (!page || loading) {
return (
<Container text>
<Segment vertical loading={loading}>
<Image src="/img/paragraph.png" />
</Segment>
</Container>
);
}
const { title, description, blocks } = page;
return (
<Container className="page-content" text>
<Helmet>
<title>{title}</title>
<meta name="description" content={description} />
</Helmet>
<TransitionGroup component="article" appear enter exit>
{blocks.map(b => (
<Pop key={b.key} in appear>
<Block block={b} />
</Pop>
))}
</TransitionGroup>
</Container>
);
};
PageComponent.propTypes = {
loading: PropTypes.bool,
page: PropTypes.shape({
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
blocks: PropTypes.array.isRequired,
}),
error: PropTypes.shape({
status: PropTypes.string.isRequired,
message: PropTypes.string.isRequired,
}),
};
PageComponent.defaultProps = {
page: null,
error: null,
loading: false,
};
export default PageComponent;
|
src/ModalHeader.js | wjb12/react-bootstrap | import React from 'react';
import classNames from 'classnames';
class ModalHeader extends React.Component {
render() {
return (
<div
{...this.props}
className={classNames(this.props.className, this.props.modalClassName)}>
{ this.props.closeButton &&
<button
className="close"
onClick={this.props.onHide}>
<span aria-hidden="true">
×
</span>
</button>
}
{ this.props.children }
</div>
);
}
}
// used in liue of parent contexts right now to auto wire the close button
ModalHeader.__isModalHeader = true;
ModalHeader.propTypes = {
/**
* The 'aria-label' attribute is used to define a string that labels the current element.
* It is used for Assistive Technology when the label text is not visible on screen.
*/
'aria-label': React.PropTypes.string,
/**
* A css class applied to the Component
*/
modalClassName: React.PropTypes.string,
/**
* Specify whether the Component should contain a close button
*/
closeButton: React.PropTypes.bool,
/**
* A Callback fired when the close button is clicked. If used directly inside a Modal component, the onHide will automatically
* be propagated up to the parent Modal `onHide`.
*/
onHide: React.PropTypes.func
};
ModalHeader.defaultProps = {
'aria-label': 'Close',
modalClassName: 'modal-header',
closeButton: false
};
export default ModalHeader;
|
client/extensions/woocommerce/woocommerce-services/views/service-settings/settings-form/settings-item.js | Automattic/woocommerce-connect-client | /** @format */
/**
* External dependencies
*/
import React from 'react';
import PropTypes from 'prop-types';
import { localize } from 'i18n-calypso';
/**
* Internal dependencies
*/
import NumberField from 'woocommerce/woocommerce-services/components/number-field';
import Text from 'woocommerce/woocommerce-services/components/text';
import TextField from 'woocommerce/woocommerce-services/components/text-field';
import RadioButtons from 'woocommerce/woocommerce-services/components/radio-buttons';
import ShippingClassesField from 'woocommerce/woocommerce-services/components/shipping-classes-field';
import getPackagingManagerLink from 'woocommerce/woocommerce-services/lib/utils/get-packaging-manager-link';
import ShippingServiceGroups from '../shipping-services';
import FormLegend from 'components/forms/form-legend';
const SettingsItem = ( {
formData,
layout,
schema,
formValueActions,
storeOptions,
errors,
translate,
site,
shippingClasses,
} ) => {
const id = layout.key ? layout.key : layout;
const updateValue = value => formValueActions.updateField( id, value );
const updateSubValue = ( key, val ) => formValueActions.updateField( [ id ].concat( key ), val );
const fieldValue = formData[ id ];
const fieldSchema = schema.properties[ id ];
const fieldType = layout.type || fieldSchema.type || '';
const fieldError = errors[ '' ] ? errors[ '' ].value || layout.validation_hint || '' : false;
switch ( fieldType ) {
case 'radios':
return (
<RadioButtons
valuesMap={ layout.titleMap }
title={ fieldSchema.title }
description={ fieldSchema.description }
value={ fieldValue }
setValue={ updateValue }
error={ fieldError }
/>
);
case 'shipping_services':
return (
<ShippingServiceGroups
services={ schema.definitions.services }
title={ fieldSchema.title }
description={ fieldSchema.description }
settings={ fieldValue }
currencySymbol={ storeOptions.currency_symbol }
updateValue={ updateSubValue }
settingsKey={ id }
errors={ errors }
generalError={ fieldError }
/>
);
case 'packages':
return (
<div>
<FormLegend>{ translate( 'Saved Packages' ) }</FormLegend>
{ translate( 'Add and edit saved packages using the {{a}}Packaging Manager{{/a}}.', {
components: {
a: <a href={ getPackagingManagerLink( site ) } />,
},
} ) }
</div>
);
case 'text':
return (
<Text
id={ id }
title={ layout.title }
className={ layout.class }
value={ fieldValue || layout.description }
/>
);
case 'number':
return (
<NumberField
id={ id }
title={ fieldSchema.title }
description={ fieldSchema.description }
value={ fieldValue }
placeholder={ layout.placeholder }
updateValue={ updateValue }
error={ fieldError }
/>
);
case 'shipping_classes':
return (
<ShippingClassesField
id={ id }
title={ fieldSchema.title }
description={ fieldSchema.description }
value={ fieldValue }
options={ shippingClasses }
updateValue={ updateValue }
/>
);
default:
return (
<TextField
id={ id }
title={ fieldSchema.title }
description={ fieldSchema.description }
value={ fieldValue }
placeholder={ layout.placeholder }
updateValue={ updateValue }
error={ fieldError }
/>
);
}
};
SettingsItem.propTypes = {
layout: PropTypes.oneOfType( [ PropTypes.string.isRequired, PropTypes.object.isRequired ] )
.isRequired,
schema: PropTypes.object.isRequired,
storeOptions: PropTypes.object.isRequired,
formValueActions: PropTypes.object.isRequired,
errors: PropTypes.object,
};
export default localize( SettingsItem );
|
website/src/pages/bar/canvas.js | plouc/nivo | import React from 'react'
import { ResponsiveBarCanvas } from '@nivo/bar'
import { ComponentTemplate } from '../../components/components/ComponentTemplate'
import meta from '../../data/components/bar/meta.yml'
import { generateHeavyDataSet } from '../../data/components/bar/generator'
import mapper from '../../data/components/bar/mapper'
import { groups } from '../../data/components/bar/props'
import { graphql, useStaticQuery } from 'gatsby'
const Tooltip = data => {
/* return custom tooltip */
}
const initialProperties = {
indexBy: 'country',
margin: {
top: 50,
right: 60,
bottom: 50,
left: 60,
},
pixelRatio:
typeof window !== 'undefined' && window.devicePixelRatio ? window.devicePixelRatio : 1,
padding: 0.15,
innerPadding: 0,
minValue: 'auto',
maxValue: 'auto',
groupMode: 'stacked',
layout: 'horizontal',
reverse: false,
valueScale: { type: 'linear' },
indexScale: { type: 'band', round: true },
valueFormat: { format: '', enabled: false },
colors: { scheme: 'red_blue' },
colorBy: 'id',
borderWidth: 0,
borderRadius: 0,
borderColor: {
from: 'color',
modifiers: [['darker', 1.6]],
},
axisTop: {
enable: true,
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: '',
legendOffset: 36,
},
axisRight: {
enable: false,
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: '',
legendOffset: 0,
},
axisBottom: {
enable: true,
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: 'country',
legendPosition: 'middle',
legendOffset: 36,
},
axisLeft: {
enable: true,
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: 'food',
legendPosition: 'middle',
legendOffset: -40,
},
enableGridX: true,
enableGridY: false,
enableLabel: true,
labelSkipWidth: 12,
labelSkipHeight: 12,
labelTextColor: {
from: 'color',
modifiers: [['darker', 1.6]],
},
isInteractive: true,
'custom tooltip example': false,
tooltip: null,
legends: [],
}
const BarCanvas = () => {
const {
image: {
childImageSharp: { gatsbyImageData: image },
},
} = useStaticQuery(graphql`
query {
image: file(absolutePath: { glob: "**/src/assets/captures/bar-canvas.png" }) {
childImageSharp {
gatsbyImageData(layout: FIXED, width: 700, quality: 100)
}
}
}
`)
return (
<ComponentTemplate
name="BarCanvas"
meta={meta.BarCanvas}
icon="bar"
flavors={meta.flavors}
currentFlavor="canvas"
properties={groups}
initialProperties={initialProperties}
propertiesMapper={mapper}
codePropertiesMapper={(properties, data) => ({
keys: data.keys,
...properties,
tooltip: properties.tooltip ? Tooltip : undefined,
})}
generateData={generateHeavyDataSet}
getTabData={data => data.data}
image={image}
>
{(properties, data, theme, logAction) => {
return (
<ResponsiveBarCanvas
data={data.data}
keys={data.keys}
{...properties}
theme={theme}
onClick={node =>
logAction({
type: 'click',
label: `[bar] ${node.id} - ${node.indexValue}: ${node.value}`,
color: node.color,
data: node,
})
}
/>
)
}}
</ComponentTemplate>
)
}
export default BarCanvas
|
src/pages/GoldIRA.js | numieco/patriot-trading | import React from 'react'
import Header from '../components/Header'
import SideBar from './../components/SideBar'
import Footer from './../components/Footer'
export default class GoldIRA extends React.Component {
render () {
return (
<div>
<Header />
<div className='wrapper'>
<div className='container goldira-container'>
<div className='page-title goldira-title'>
<h1> Gold IRA </h1>
</div>
<div className='static-text'>
<div className='header-line'>
<h3>CALL PTG for GOLD IRA</h3>: <a href='tel:800-951-0592'><b>800-951-0592</b></a>
</div>
<div className='header-line'>
<h3>GOLD STAR TRUST</h3>: <a href='http://goldstartrust.com/PDFs/Precious%20Metals%20Forms/PM%20Investment%20Guide%20-%20Roth.pdf' target='_blank'><b>Precious Metals ROTH IRA Investment Guid (PDF)</b></a>
</div>
<div className='header-line'>
<h3>GOLD STAR TRUST</h3>: <a href='http://www.goldstartrust.com/PDFs/Roth%20IRA%20Forms/Roth%20IRA%20Simplifier.pdf' target='_blank'><b>ROTH Individual Retirement Account Application (PDF)</b></a>
</div>
<p>
<b>Gold Star Trust Company</b> was formed in 1983 to serve as Registrar,
Paying Agent and Trustee for churches and other non-profit organizations that issue bonds for
long term financing. As a natural step in serving their customer base,
GST began accepting self-directed IRA accounts in 1990. GST now serves 750 active bond
issues and over 9,000 IRA accounts with assets including church bonds,
gold and silver coins, mutual funds, stocks, bonds, treasury securities, notes,
and other types of investments.
</p>
<p>
The total value of assets in all GST accounts is over $125,000,000.
GST is recognized throughout the country as the leading provider of precious metals IRAs.
GST is regulated by the Texas Department of Banking, and their offices are located in Houston, Texas.
The officers and directors of GST are specialists in the fields of law, accounting, banking, motivation,
fund raising, sales and computer technology.
</p>
<p>
In the past, only Gold or Silver Eagles qualified for IRA accounts. Recent legislation expanded the rules regarding
Individual Retirement Accounts, beginning on January 1st of 1998. For the first time,
platinum is now eligible for inclusion IRA portfolios, not only through the Platinum American Eagle
bullion coins but through Australian Koalas and Canadian Platinum Maple Leafs.
</p>
<p>
<b>Question</b>: Could you list the type of precious metals products that qualify for this program?
</p>
<p>
<b>GST</b>: As of January 1, 1998, the Internal Revenue Code allows IRA investment in a wider range
of precious metals. Investment is permitted in both coins and bullion of platinum, palladium,
gold and silver, provided they meet stringent fineness requirements. These requirements are that
the product be essentially 100% pure precious metal.The IRA trustee or custodian, who must store and
account for the precious metals, may have further restrictions. Gold Star Trust Company (GST),
for example, must limit the investments to broadly traded, fungible products which can be
recorded and stored at our depository, Republic National Bank of New York.
</p>
<p>
<b>Question</b>: Could you walk us through the process of how an investor would open a precious metals IRA account?
</p>
<p>
<b>GST</b>: There are really three phases to getting platinum into an IRA. These are:
</p>
<div className='hasTab'>
<div>1. Establishing the IRA Account</div>
<div>2. Funding the IRA with cash</div>
<div>3. Investing the IRA funds in precious metals</div>
</div>
<p>
First, the IRA must be established at a financial institution that is willing to make an investment
for the customer in platinum. Second, the IRA must be funded by an annual contribution,
a transfer or a rollover. Finally, The IRA custodian must purchase the platinum and hold it in
safekeeping for the customer. Gold Star Trust provides the forms necessary to open the account,
as well as forms to effect a transfer or rollover. Once the account is opened and funded,
the customer gives the IRA Custodian specific instructions regarding the platinum to purchase,
the price and the dealer. The Custodian makes the purchase, and the platinum is shipped to
Republic National Bank of New York.
</p>
<p>
<b>Question</b>: What if the investor already has an IRA account?
</p>
<p>
<b>GST</b>: An existing IRA may be used to invest in platinum, provided the IRA Trustee or
Custodian will allow the investment and will agree to store the platinum. Usually a
Self-Directed account is required. In this type of account, the customer gets to select the investments,
rather than just taking whatever the IRA Trustee is selling. Most banks, mutual funds and other
types of institutions that sell a financial product will not allow the customer to direct
the investments, beyond choosing among the offerings of the institution.
</p>
<p>
<b>GST does not sell any products</b>, and acts strictly as Custodian for Self-Directed IRA accounts.
Customers may direct investments in platinum, other precious metals, CDs, stocks, bonds,
U.S. Government securities, notes, and several other types of investments.
</p>
<p>
<b>Question</b>: Are contributions made after January 1, 1998 the only amounts available for investment in platinum?
</p>
<p>
<b>GST</b>: People often confuse the funding of the IRA with the investments made with the IRA funds.
The new tax law allows expanded options for investments in precious metals held by any IRA beginning
January 1, 1998. It doesn't matter when or how the cash went into the IRA, as long as the purchase of
the newly allowed metals is made after January 1, 1998
</p>
<p>
<b>Question</b>: What is Gold Star Trust's role in this type of IRA?
</p>
<p>
<b>GST</b>: ACT serves as Custodian for Self-Directed IRA accounts. We have no investment authority
for the accounts, and work strictly from instructions given by the customer. In a precious metals IRA,
we invest in metals as directed by the customer, hold the investments, send semi-annual statements
to the customer, and file the required reports to the IRS. We do not give or receive any compensation
to or from the precious metals dealers, and we do not sell our customer lists.
</p>
<p>
ACT does not provide financial or tax planning advice, but we can assist with compliance with IRA rules
and regulations. Of course, investors should always work with appropriate legal and tax advisors to
manage their IRA investments.
</p>
<p>
<b>Question</b>: Where are the metals physically stored?
</p>
<p>
<b>GST</b>: GST uses Delaware Depository Service Company in Wilmington, DE, for storage of precious metals.
</p>
<p>
<b>Question</b>: How do investors sell their metal when they are ready to take distribution?
</p>
<p>
<b>GST</b>: Again, there is often confusion regarding selling assets and taking distributions.
Assets may be sold by the IRA at any time, regardless of whether a distribution is planned.
Likewise, a distribution may be taken regardless of whether not assets are sold.
</p>
<p>
When an asset is sold, Gold Star Trust simply holds the cash in the IRA until the customer directs
another investment or requests a distribution. Selling platinum works the same way as purchasing.
The customer gives written instructions to Gold Star Trust regarding what to sell, at what price
and through which dealer. Gold Star Trust makes the sale, and waits for further instructions.
</p>
<p>
When customers take a distribution from their IRA at Gold Star Trust, they have two choices.
The assets in the account may be liquidated and distributed in cash, or they may be withdrawn "in kind,"
which means the actual asset itself is sent to the investor. This allows the investor to decide
if it is better to sell at the current market price, or take a distribution in kind and
sell at a later date, outside of the IRA. The amount reported to the IRS as a distribution is
the cash amount distributed, or the fair market value of the asset taken in kind. Of course,
the customer may not wish to take the entire account balance all at once.
A Required Minimum Distribution for a person over age 70 will only be a portion of the total account
value, so it may be that the customer will take a cash distribution in some years and in other years,
take a distribution in kind.
</p>
<p>
<b>Question</b>: What are the advantages to investors in this type of IRA? What are the costs?
</p>
<p>
<b>GST</b>: A Self-Directed IRA at GST has several advantages. We are one of the few financial
institutions in the country to handle precious metals accounts, which allows investors to hold hard
assets in their IRAs. However, since we also allow many other types of investments, customers can
have one IRA account, with one consolidated statement showing all investments.
</p>
<p>
Any charges, fees or commissions on investments directed by the customer will be charged to the account.
Gold Star Trust fees are billed on the anniversary date of the account, storage fees are billed on a
calendar year basis.
</p>
<p>
To establish a Self-Directed IRA at Gold Star Trust, simply complete the (get a copy from us) IRA Request
Form and return it to Gold Star Trust Company.
</p>
<p>
<b>Question</b>: What are the advantages to dealers in recommending this type of IRA?
</p>
<p>
<b>GST</b>: There are several advantages to precious metals dealers who recommend this type of IRA
to their customers. Perhaps the greatest is the fact that the average person has much more money
available for investment in his/her IRA than in a checking account. The past several years have seen
a large number of people laid off or given early retirement as corporations cut back or "downsize"
their operations. There are billions of dollars in retirement accounts that may be eligible for
rollover to IRA accounts. Gold Star Trust is in the IRA business, so the dealer doesn't have to be.
Once the dealer determines that the customer has funds available for investment in an IRA or other
retirement plan, he can simply supply the GST toll-free phone number and wait for the paperwork to
be completed. Payment to the dealer is usually made by wire the day after funds are received by
Gold Star Trust.
</p>
<p>
Finally, our people are knowledgeable, courteous, efficient and friendly, and are always ready to
answer a question or help a dealer solve a problem.
</p>
<p>
For more information on how you can balance your IRA with gold, <b>Call PTG today</b> to set up your precious
metals backed IRA: <a href='tel:800-951-0592'><b>800-951-0592</b></a>. <b>We sell gold, siver, and other applicable US precious metals coins
for your IRA.</b>
</p>
</div>
</div>
<div className='sidebar-container'>
<SideBar />
</div>
</div>
<Footer />
</div>
)
}
}
|
app/containers/HomePage/index.js | gerbilsinspace/babynames | /*
* HomePage
*
* This is the first thing users see of our App, at the '/' route
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a necessity for you then you can refactor it and remove
* the linting exception.
*/
import React from 'react';
import PersonChooser from 'containers/PersonChooser';
import Menu from 'containers/Menu';
import BabyName from 'containers/BabyName';
import ArticleContainer from 'containers/ArticleContainer';
import AppContainer from 'components/AppContainer';
import HeaderContainer from 'containers/HeaderContainer';
export default class HomePage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<AppContainer>
<HeaderContainer />
<ArticleContainer>
<Menu />
<BabyName />
</ArticleContainer>
</AppContainer>
);
}
}
|
ui/src/js/backOffice/articleManager/ArticleEditor.js | Dica-Developer/weplantaforest | import axios from 'axios';
import React, { Component } from 'react';
import DatePicker from 'react-16-bootstrap-date-picker';
import FileChooser from '../../common/components/FileChooser';
import IconButton from '../../common/components/IconButton';
import Notification from '../../common/components/Notification';
import RadioButton from '../../common/components/RadioButton';
import TextEditor from '../../common/components/TextEditor';
import { getConfig } from '../../common/RestHelper';
require('./article-manager.less');
class Paragraph extends Component {
constructor(props) {
super(props);
this.state = {
imageFile: null,
paragraph: this.props.paragraph
};
}
updateValue(toUpdate, value) {
this.state.paragraph[toUpdate] = value;
this.forceUpdate();
}
handleTextChange(e) {
var updatedParagraph = this.state.paragraph;
updatedParagraph.text = e.target.getContent();
this.setState({ paragraph: updatedParagraph });
}
updateImage(imageName, file) {
this.state.paragraph.imageFileName = imageName;
this.state.imageFile = file;
this.forceUpdate();
}
getParagraph() {
return this.state.paragraph;
}
getImageFile() {
return this.state.imageFile;
}
render() {
var imgUrl;
var imgContent;
if (this.state.paragraph.imageFileName != null && this.state.paragraph.imageFileName != '' && this.state.imageFile == null) {
imgUrl = 'http://localhost:8082/article/image/' + this.props.articleId + '/' + this.state.paragraph.imageFileName + '/300/300';
imgContent = <img src={imgUrl} />;
} else {
imgContent = '';
}
if (this.state.paragraph.imageDescription == null) {
this.state.paragraph.imageDescription = '';
}
return (
<div>
<div className="row content-row">
<div className="col-md-12">
<h4>Paragraph {this.props.paragraphNumber}:</h4>
</div>
</div>
<div className="row content-row">
<div className="col-md-2">Titel:</div>
<div className="col-md-10 title">
<input
type="text"
value={this.state.paragraph.title}
onChange={event => {
this.updateValue('title', event.target.value);
}}
/>
</div>
</div>
<div className="row content-row">
<div className="col-md-2">Inhalt:</div>
<div className="col-md-10">
<TextEditor content={this.state.paragraph.text} handleContentChange={this.handleTextChange.bind(this)} />
</div>
</div>
<div className="row image-row">
<div className="col-md-2">Bild:</div>
<div className="col-md-10">
<FileChooser updateFile={this.updateImage.bind(this)} /> {imgContent}
</div>
</div>
<div className="row image-row">
<div className="col-md-2">Bildunterschrift:</div>
<div className="col-md-10">
<input
type="text"
value={this.state.paragraph.imageDescription}
onChange={event => {
this.updateValue('imageDescription', event.target.value);
}}
/>
</div>
</div>
</div>
);
}
}
export default class ArticleEditor extends Component {
constructor() {
super();
this.state = {
articleTypes: [],
imageFile: null,
article: {
id: 0,
title: '',
articleType: 'HOME',
intro: '',
paragraphs: [],
lang: 'DEUTSCH',
visible: false,
imageFileName: '',
imageDescription: '',
createdOn: new Date().getTime()
},
paragraphCount: 0,
articleImageChanged: false
};
}
componentDidMount() {
var that = this;
axios
.get('http://localhost:8082/articleTypes')
.then(function(response) {
var result = response.data;
that.setState({ articleTypes: result });
})
.catch(function(response) {
if (response instanceof Error) {
console.error('Error', response.message);
} else {
console.error(response.data);
console.error(response.status);
console.error(response.headers);
console.error(response.config);
}
});
var restConfig = getConfig();
axios
.get('http://localhost:8082/backOffice/article?articleId=' + encodeURIComponent(this.props.params.articleId), restConfig)
.then(function(response) {
var result = response.data;
that.setState({ article: result });
if (result.paragraphs.length == 0) {
that.setState({ paragraphCount: 1 });
} else {
that.setState({ paragraphCount: result.paragraphs.length });
}
that.setArticleTypeSelection();
that.setLanguageSelection();
that.refs['editor'].refreshEditor();
})
.catch(function(response) {
if (response instanceof Error) {
console.error('Error', response.message);
} else {
console.error(response.data);
console.error(response.status);
console.error(response.headers);
console.error(response.config);
}
});
}
setArticleTypeSelection() {
for (var i = 0; i < this.refs['type-select'].options.length; i++) {
if (this.refs['type-select'].options[i].value === this.state.article.articleType) {
this.refs['type-select'].options[i].selected = true;
break;
}
}
}
setLanguageSelection() {
for (var i = 0; i < this.refs['language-select'].options.length; i++) {
if (this.refs['language-select'].options[i].value === this.state.article.lang) {
this.refs['language-select'].options[i].selected = true;
break;
}
}
}
updateValue(toUpdate, value) {
this.state.article[toUpdate] = value;
this.forceUpdate();
}
updateArticleType(event) {
this.state.article.articleType = event.target.value;
this.forceUpdate();
}
updateLanguage(event) {
this.state.article.lang = event.target.value;
this.forceUpdate();
}
updateVisibility(event) {
var value;
if (event.target.value == '1') {
value = true;
} else {
value = false;
}
this.state.article.visible = value;
this.forceUpdate();
}
updateImage(imageName, file) {
this.state.imageFile = file;
if (file != null) {
this.state.articleImageChanged = true;
} else {
this.state.articleImageChanged = false;
}
this.forceUpdate();
}
editArticle() {
var that = this;
var restConfig = getConfig();
this.state.article.paragraphs = [];
this.forceUpdate();
for (var paragraph = 0; paragraph < this.state.paragraphCount; paragraph++) {
this.state.article.paragraphs.push(this.refs['paragraph_' + paragraph].getParagraph());
}
axios
.post('http://localhost:8082/backOffice/article/edit?userName=' + localStorage.getItem('username'), this.state.article, restConfig)
.then(function(response) {
var article = response.data;
if (that.state.articleImageChanged) {
var data = new FormData();
data.append('articleId', article.id);
data.append('file', that.state.imageFile);
axios
.post('http://localhost:8082/article/upload/image', data, restConfig)
.then(function(response) {})
.catch(function(response) {
that.refs.notification.addNotification('Oh nein!', 'Beim Hochladen des Bildes für den Artikel ist ein Fehler aufgetreten.', 'error');
if (response instanceof Error) {
console.error('Error', response.message);
} else {
console.error(response.data);
console.error(response.status);
console.error(response.headers);
console.error(response.config);
}
});
}
for (var paragraph = 0; paragraph < that.state.paragraphCount; paragraph++) {
if (that.refs['paragraph_' + paragraph].getImageFile() != null) {
var paragraphId = article.paragraphs[paragraph].id;
var data = new FormData();
data.append('articleId', article.id);
data.append('paragraphId', paragraphId);
data.append('file', that.refs['paragraph_' + paragraph].getImageFile());
axios
.post('http://localhost:8082/paragraph/upload/image', data, restConfig)
.then(function(response) {})
.catch(function(response) {
that.refs.notification.addNotification('Oh nein!', 'Beim Hochladen des Bildes für den Artikel ist ein Fehler aufgetreten.', 'error');
if (response instanceof Error) {
console.error('Error', response.message);
} else {
console.error(response.data);
console.error(response.status);
console.error(response.headers);
console.error(response.config);
}
});
}
}
that.refs.notification.addNotification('Geschafft!', 'Der Artikel wurde erfolgreich bearbeitet.', 'success');
})
.catch(function(response) {
that.refs.notification.addNotification('Oh nein!', 'Beim Hochladen ist ein Fehler aufgetreten, wahrscheinlich ist beim Speichern etwas schief gelaufen.', 'error');
if (response instanceof Error) {
console.error('Error', response.message);
} else {
console.error(response.data);
console.error(response.status);
console.error(response.headers);
console.error(response.config);
}
});
}
handleIntroContentChange(e) {
var updatedArticle = this.state.article;
updatedArticle.intro = e.target.getContent();
this.setState({ article: updatedArticle });
}
addParagraph() {
this.state.paragraphCount++;
this.forceUpdate();
}
updateCreationDate(value) {
this.state.article.createdOn = Date.parse(value);
this.forceUpdate();
}
resetCreationDate() {
this.state.article.createdOn = null;
this.forceUpdate();
}
render() {
var that = this;
var articleImgUrl = 'http://localhost:8082/article/image/' + this.state.article.id + '/' + this.state.article.imageFileName + '/380/253';
var imageContent;
if (!this.state.articleImageChanged && this.state.article.id != 0) {
imageContent = <img src={articleImgUrl} />;
} else {
imageContent = '';
}
var paragraphObjects = [];
for (var paragraph = 0; paragraph < this.state.paragraphCount; paragraph++) {
paragraphObjects.push(paragraph);
}
return (
<div className="container paddingTopBottom15 article-manager">
<div className="row ">
<div className="col-md-12">
<h1>Artikel bearbeiten</h1>
</div>
</div>
<div className="row settings-row">
<div className="col-md-2">Artikel-typ:</div>
<div className="col-md-2">
<select onChange={this.updateArticleType.bind(this)} ref="type-select">
{this.state.articleTypes.map(function(articleType, i) {
return (
<option value={articleType} key={i}>
{articleType}
</option>
);
})}
</select>
</div>
<div className="col-md-2">Sprache:</div>
<div className="col-md-2">
<select ref="language-select" onChange={this.updateLanguage.bind(this)}>
<option value="DEUTSCH">DEUTSCH</option>
<option value="ENGLISH">ENGLISH</option>
</select>
</div>
<div className="col-md-2">sichtbar:</div>
<div className="col-md-2">
<RadioButton id="radio-c-1" value="1" checked={this.state.article.visible} onChange={this.updateVisibility.bind(this)} text=" ja " />
<RadioButton id="radio-c-0" value="0" checked={!this.state.article.visible} onChange={this.updateVisibility.bind(this)} text=" nein" />
</div>
</div>
<div className="row content-row">
<div className="col-md-2">Titel:</div>
<div className="col-md-5 title">
<input
type="text"
value={this.state.article.title}
onChange={event => {
this.updateValue('title', event.target.value);
}}
/>
</div>
<div className="col-md-1">Datum:</div>
<div className="col-md-4">
<DatePicker
value={new Date(this.state.article.createdOn).toISOString()}
onChange={this.updateCreationDate.bind(this)}
onClear={this.resetCreationDate.bind(this)}
dateFormat="DD.MM.YYYY"
calendarPlacement="right"
/>
</div>
</div>
<div className="row content-row">
<div className="col-md-2">Intro:</div>
<div className="col-md-10">
<TextEditor ref="editor" content={this.state.article.intro} handleContentChange={this.handleIntroContentChange.bind(this)} />
</div>
</div>
<div className="row image-row">
<div className="col-md-2">Bild:</div>
<div className="col-md-10">
<FileChooser updateFile={this.updateImage.bind(this)} /> {imageContent}
</div>
</div>
<div className="row image-row">
<div className="col-md-2">Bildunterschrift:</div>
<div className="col-md-10">
<input
type="text"
value={this.state.article.imageDescription}
onChange={event => {
this.updateValue('imageDescription', event.target.value);
}}
/>
</div>
</div>
{paragraphObjects.map(function(p, i) {
if (i < that.state.article.paragraphs.length) {
return <Paragraph ref={'paragraph_' + i} key={i} articleId={that.state.article.id} paragraphNumber={i + 1} paragraph={that.state.article.paragraphs[i]} />;
} else {
var paragraph = {
id: null,
title: '',
text: '',
imageFileName: '',
imageDescription: ''
};
return <Paragraph ref={'paragraph_' + i} key={i} articleId={that.state.article.id} paragraphNumber={i + 1} paragraph={paragraph} />;
}
})}
<div className="row">
<div className="col-md-12 align-right">
<IconButton glyphIcon="glyphicon-plus" text="PARAGRAPH HINZUFÜGEN" onClick={this.addParagraph.bind(this)} />
</div>
</div>
<div className="row align-center">
<IconButton glyphIcon="glyphicon-floppy-open" text="ARTIKEL bearbeiten" onClick={this.editArticle.bind(this)} />
</div>
<Notification ref="notification" />
</div>
);
}
}
/* vim: set softtabstop=2:shiftwidth=2:expandtab */
|
src/app/shared/header/index.js | kristjanpikk/things-to-do | import React from 'react';
import {Link} from 'react-router';
import Icon from '~shared/icon';
import Logo from '~images/logo';
import './header.scss';
// Create Header component
export default class Header extends React.Component{
render() {
return(
<header className="header" role="banner">
<Link to={'/'} className="header__logo"><Icon glyph={Logo} width="105" height="28" /></Link>
<nav className="header__nav">
<ul className="header__nav-list">
<li className="header__nav-list-item"><Link to={'/projects'} className="header__nav-item" activeClassName="header__nav-item--active">Your Projects</Link></li>
<li className="header__nav-list-item"><Link to={'/projects/finished'} className="header__nav-item" activeClassName="header__nav-item--active">Finished Projects</Link></li>
</ul>
</nav>
<ul className="header__auth">
<li className="header__auth-item header__auth-item--authenticated">Kristjan Pikk</li>
<li className="header__auth-item"><Link to={'/'} className="header__auth-item-link header__auth-item-link--auth">Log out</Link></li>
</ul>
</header>
);
} // Render
}; |
app/vue/src/client/manager/provider.js | jribeiro/storybook | /* global location */
import qs from 'qs';
import React from 'react';
import { Provider } from '@storybook/ui';
import addons from '@storybook/addons';
import createChannel from '@storybook/channel-postmessage';
import Preview from './preview';
export default class ReactProvider extends Provider {
constructor() {
super();
this.channel = createChannel({ page: 'manager' });
addons.setChannel(this.channel);
}
getPanels() {
return addons.getPanels();
}
renderPreview(selectedKind, selectedStory) {
const queryParams = {
selectedKind,
selectedStory,
};
// Add the react-perf query string to the iframe if that present.
if (/react_perf/.test(location.search)) {
queryParams.react_perf = '1';
}
const queryString = qs.stringify(queryParams);
const url = `iframe.html?${queryString}`;
return <Preview url={url} />;
}
handleAPI(api) {
api.onStory((kind, story) => {
this.channel.emit('setCurrentStory', { kind, story });
});
this.channel.on('setStories', data => {
api.setStories(data.stories);
});
this.channel.on('selectStory', data => {
api.selectStory(data.kind, data.story);
});
this.channel.on('applyShortcut', data => {
api.handleShortcut(data.event);
});
addons.loadAddons(api);
}
}
|
src/Parser/RestoDruid/Modules/Traits/Grovewalker.js | mwwscott0/WoWAnalyzer | import React from 'react';
import Module from 'Parser/Core/Module';
import Combatants from 'Parser/Core/Modules/Combatants';
import calculateEffectiveHealing from 'Parser/Core/calculateEffectiveHealing';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import SpellLink from 'common/SpellLink';
import { formatPercentage } from 'common/format';
import {HEALS_MASTERY_STACK} from '../../Constants';
const GROVEWALKER_HEALING_INCREASE = 0.01;
/**
* Grovewalker (Artifact Trait)
* Increases all healing over time you do by 1%
*/
class Grovewalker extends Module {
static dependencies = {
combatants: Combatants,
};
rank = 0;
healing = 0;
on_initialized() {
this.rank = this.combatants.selected.traitsBySpellId[SPELLS.GROVEWALKER.id];
this.active = this.rank > 0;
}
on_byPlayer_heal(event) {
const spellId = event.ability.guid;
if(!HEALS_MASTERY_STACK.includes(spellId) || (SPELLS.REGROWTH.id === spellId && !event.tick)) {
return;
}
this.healing += calculateEffectiveHealing(event, GROVEWALKER_HEALING_INCREASE * this.rank) / this.rank;
}
subStatistic() {
return (
<div className="flex">
<div className="flex-main">
<SpellLink id={SPELLS.GROVEWALKER.id}>
<SpellIcon id={SPELLS.GROVEWALKER.id} noLink /> Grovewalker
</SpellLink>
</div>
<div className="flex-sub text-right">
{formatPercentage(this.owner.getPercentageOfTotalHealingDone(this.healing))} %
</div>
</div>
);
}
}
export default Grovewalker;
|
src/components/Footer/Footer.js | machix/mm-inventory | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Footer.css';
import Link from '../Link';
class Footer extends React.Component {
render() {
return (
<div className={s.root}>
<div className={s.container}>
<span className={s.text}>© Your Company</span>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/">Home</Link>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/admin">Admin</Link>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/privacy">Privacy</Link>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/not-found">Not Found</Link>
</div>
</div>
);
}
}
export default withStyles(s)(Footer);
|
src/Badge.js | pieter-lazzaro/react-bootstrap | import React from 'react';
import ValidComponentChildren from './utils/ValidComponentChildren';
import classNames from 'classnames';
const Badge = React.createClass({
propTypes: {
pullRight: React.PropTypes.bool
},
getDefaultProps() {
return {
pullRight: false
};
},
hasContent() {
return ValidComponentChildren.hasValidComponent(this.props.children) ||
(React.Children.count(this.props.children) > 1) ||
(typeof this.props.children === 'string') ||
(typeof this.props.children === 'number');
},
render() {
let classes = {
'pull-right': this.props.pullRight,
'badge': this.hasContent()
};
return (
<span
{...this.props}
className={classNames(this.props.className, classes)}>
{this.props.children}
</span>
);
}
});
export default Badge;
|
src/components/meteor/plain/MeteorPlain.js | fpoumian/react-devicon | import React from 'react'
import PropTypes from 'prop-types'
import SVGDeviconInline from '../../_base/SVGDeviconInline'
import iconSVG from './MeteorPlain.svg'
/** MeteorPlain */
function MeteorPlain({ width, height, className }) {
return (
<SVGDeviconInline
className={'MeteorPlain' + ' ' + className}
iconSVG={iconSVG}
width={width}
height={height}
/>
)
}
MeteorPlain.propTypes = {
className: PropTypes.string,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}
export default MeteorPlain
|
src/app/AppBar.js | DictumMortuum/dictum | import React from 'react'
import AppBar from 'material-ui/AppBar'
import DatePicker from 'material-ui/DatePicker'
const styles = {
title: {
cursor: 'pointer',
},
}
export default class DictumAppBar extends React.Component {
constructor(props) {
super(props)
this.state = {open: false}
}
render() {
return (
<div>
<AppBar
title={<span style={styles.title}>Dictum</span>}
onLeftIconButtonTouchTap={this.props.toggle}
zDepth={1}
iconElementRight={
<div style={{display:'flex'}}>
<DatePicker
style={{paddingRight: 10}}
inputStyle={{color: 'white'}}
hintText="From"
locale="el-GR"
DateTimeFormat={global.Intl.DateTimeFormat}
autoOk={true}
container="inline"
onChange={this.props.from}
/>
<DatePicker
inputStyle={{color: 'white'}}
hintText="To"
locale="el-GR"
DateTimeFormat={global.Intl.DateTimeFormat}
autoOk={true}
container="inline"
onChange={this.props.to}
/>
</div>}
/>
</div>
)
}
}
DictumAppBar.propTypes = {
from: React.PropTypes.func,
to: React.PropTypes.func,
toggle: React.PropTypes.func,
}
|
packages/lore-react-forms-material-ui/src/actions/flat.js | lore/lore-forms | import React from 'react';
import { FlatButton } from 'material-ui';
export default function(form, props) {
return (
<FlatButton
{...props}
/>
)
}
|
www/imports/mapPage/shortlist/BarChartPres.js | terraswat/hexagram | /*
* Presentational component for the bar chart in the shortlist.
*/
import React from 'react';
import PropTypes from 'prop-types';
import {
XYPlot,
VerticalBarSeries,
} from 'react-vis';
const BarChartPres = ({ data }) => (
<div>
<XYPlot
xDomain={[0, 2]}
width={240}
height={40}
margin={{left: 0, right: 0, top: 10, bottom: 10}}
>
<VerticalBarSeries
data={data}
colorType="literal"
/>
</XYPlot>
</div>
)
BarChartPres.propTypes = {
data: PropTypes.array,
};
export default BarChartPres;
|
app/assets/scripts/components/ticket-duplication-modal.js | ASL-19/civicdr | 'use strict';
import React from 'react';
var TicketDuplicationModal = React.createClass({
propTypes: {
onClose: React.PropTypes.func,
onSubmit: React.PropTypes.func,
implementingPartners: React.PropTypes.array
},
render: function () {
return (
<section className='modal modal--medium'>
<div className='modal__inner modal__form'>
<div className='modal__body'>
<form>
<div className='form__group'>
<h2 className='inpage__title'>Select a partner to create a duplicate ticket.</h2>
<div className='style-select button drop__toggle drop__toggle--caret'>
<select ref={el => { this.ipSelect = el; }}>
{this.props.implementingPartners
.map(ip => <option key={ip.id} value={ip.id}>{ip.name}</option>)
}
</select>
</div>
</div>
<footer className='form__footer'>
<ul className='form__actions'>
<li className='form__actions-item'><button className='button button--large button--base' onClick={e => { e.preventDefault(); this.props.onSubmit(this.ipSelect.value); }}>Duplicate</button></li>
<li className='form__actions-item'><button className='button button--large button--primary' onClick={this.props.onClose}>Cancel</button></li>
</ul>
</footer>
</form>
</div>
<button className='modal__button-dismiss' title='close' onClick={this.props.onClose}></button>
</div>
</section>
);
}
});
module.exports = TicketDuplicationModal;
|
react/lib/app.js | tomarus/gosyslogd | console.log('Launching app..')
import React from 'react'
import ReactDOM from 'react-dom'
import {Route, Router} from 'react-router'
import {Provider} from 'react-redux'
import store from 'lib/store/store'
import Homepage from 'lib/home'
import 'css/main.less!less'
import { useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
ReactDOM.render(
<Provider store={store}>
<Router history={appHistory}>
<Route path='/' component={Homepage}/>
</Router>
</Provider>, document.getElementById('react-div'))
|
main.js | mastermoo/rn-emoji-feedback | import Exponent from 'exponent';
import React from 'react';
import App from './src/app';
Exponent.registerRootComponent(App);
|
app/addons/documents/mangolayout.js | michellephung/couchdb-fauxton | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
import React, { Component } from 'react';
import { connect } from 'react-redux';
import app from "../../app";
import { Breadcrumbs } from '../components/header-breadcrumbs';
import NotificationCenterButton from '../fauxton/notifications/components/NotificationCenterButton';
import MangoComponents from "./mango/mango.components";
import * as MangoAPI from "./mango/mango.api";
import IndexResultsContainer from './index-results/containers/IndexResultsContainer';
import PaginationContainer from './index-results/containers/PaginationContainer';
import ApiBarContainer from './index-results/containers/ApiBarContainer';
import FauxtonAPI from "../../core/api";
import Constants from './constants';
export const RightHeader = ({ docURL, endpoint }) => {
const apiBar = <ApiBarContainer docURL={docURL} endpoint={endpoint} includeQueryOptionsParams={false}/>;
return (
<div className="right-header-wrapper flex-layout flex-row flex-body">
<div id="right-header" className="flex-body">
</div>
{apiBar}
<div id='notification-center-btn'>
<NotificationCenterButton />
</div>
</div>
);
};
export const MangoFooter = ({databaseName, fetchUrl, queryDocs}) => {
return (
<div id="footer">
<PaginationContainer
databaseName={databaseName}
fetchUrl={fetchUrl}
queryDocs={queryDocs} />
</div>
);
};
export const MangoHeader = ({ crumbs, docURL, endpoint }) => {
return (
<div className="header-wrapper flex-layout flex-row">
<div className='flex-body faux__breadcrumbs-mango-header'>
<Breadcrumbs crumbs={crumbs} />
</div>
<RightHeader
docURL={docURL}
endpoint={endpoint}
/>
</div>
);
};
MangoHeader.defaultProps = {
crumbs: []
};
export const MangoContent = ({ edit, designDocs, explainPlan, databaseName, fetchUrl, queryDocs, docType }) => {
const leftContent = edit ?
<MangoComponents.MangoIndexEditorContainer
description={app.i18n.en_US['mango-descripton-index-editor']}
databaseName={databaseName}
/> :
<MangoComponents.MangoQueryEditorContainer
description={app.i18n.en_US['mango-descripton']}
editorTitle={app.i18n.en_US['mango-title-editor']}
additionalIndexesText={app.i18n.en_US['mango-additional-indexes-heading']}
databaseName={databaseName}
/>;
let resultsPage = <IndexResultsContainer
fetchUrl={fetchUrl}
designDocs={designDocs}
ddocsOnly={false}
databaseName={databaseName}
fetchAtStartup={false}
queryDocs={queryDocs}
docType={docType} />;
let mangoFooter = <MangoFooter
databaseName={databaseName}
fetchUrl={fetchUrl}
queryDocs={queryDocs} />;
if (explainPlan) {
resultsPage = <MangoComponents.ExplainPage explainPlan={explainPlan} />;
mangoFooter = null;
}
return (
<div id="two-pane-content" className="flex-layout flex-row flex-body">
<div id="left-content" className="flex-body">
{leftContent}
</div>
<div id="right-content" className="flex-body flex-layout flex-col">
<div id="dashboard-lower-content" className="flex-body">
{resultsPage}
</div>
{mangoFooter}
</div>
</div>
);
};
class MangoLayout extends Component {
constructor(props) {
super(props);
}
render() {
const { database, edit, docURL, crumbs, designDocs, fetchUrl, databaseName, queryFindCode } = this.props;
let endpoint = this.props.endpoint;
if (this.props.explainPlan) {
endpoint = FauxtonAPI.urls('mango', 'explain-apiurl', encodeURIComponent(database));
}
let queryFunction = (params) => { return MangoAPI.mangoQueryDocs(databaseName, queryFindCode, params); };
let docType = Constants.INDEX_RESULTS_DOC_TYPE.MANGO_QUERY;
if (edit) {
queryFunction = (params) => { return MangoAPI.fetchIndexes(databaseName, params); };
docType = Constants.INDEX_RESULTS_DOC_TYPE.MANGO_INDEX;
}
return (
<div id="dashboard" className="two-pane flex-layout flex-col">
<MangoHeader
docURL={docURL}
endpoint={endpoint}
crumbs={crumbs}
/>
<MangoContent
edit={edit}
designDocs={designDocs}
explainPlan={this.props.explainPlan}
databaseName={databaseName}
fetchUrl={fetchUrl}
queryDocs={queryFunction}
docType={docType}
/>
</div>
);
}
}
const mapStateToProps = ({ mangoQuery }) => {
return {
explainPlan: mangoQuery.explainPlan,
queryFindCode: mangoQuery.queryFindCode
};
};
export const MangoLayoutContainer = connect(
mapStateToProps
)(MangoLayout);
|
app/utils/map-utils.js | pandemic-1707/pandemic-1707 | import React from 'react'
import cities from '../../functions/data/cities'
import L, { divIcon } from 'leaflet'
import { Marker, Polyline, Tooltip } from 'react-leaflet'
export function mapDataToMarkers(cities) {
return Object.keys(cities).map(key => {
const city = cities[key]
// only render a number of the infection rate is non-zero
const html = city.infectionRate ? city.infectionRate : ''
// assign a city marker or research station marker accordingly
const cityMarker = divIcon({className: `city-marker ${city.color} ${city.color}-shadow`, html: html})
const researchStationMarker = divIcon({className: `research-station-marker ${city.color}-shadow`, html: html})
const marker = city.research ? researchStationMarker : cityMarker
// draw a line between location and real location with the color of the city if they're different
let locationIndicator = ''
if (city.location[0] !== city.realLocation[0] || city.location[1] !== city.realLocation[1]) {
const color = (city.color === 'blue') ? 'steelblue' : city.color
locationIndicator = <Polyline key={`${key}-indicator`} positions={[city.location, city.realLocation]} color={color} weight="1"/>
}
return <div>
<Marker key={key} position={[city.location[0], city.location[1]]} icon={marker} zIndexOffset={1000}>
<Tooltip key={`tooltip-${key}`} direction='top' offset={[-8, -2]} opacity={1}>
<span>{key.split('-').join(' ')}</span>
</Tooltip>
</Marker>
{ locationIndicator }
</div>
})
}
export function mapDataToPieces(players) {
const icons = { pinkPawn: L.icon({ iconUrl: '/pinkPawn.png', iconSize: [20, 30], iconAnchor: [10, 30] }),
bluePawn: L.icon({ iconUrl: '/bluePawn.png', iconSize: [20, 30], iconAnchor: [10, 30] }),
yellowPawn: L.icon({ iconUrl: '/yellowPawn.png', iconSize: [20, 30], iconAnchor: [10, 30] }),
greenPawn: L.icon({ iconUrl: '/greenPawn.png', iconSize: [20, 30], iconAnchor: [10, 30] })
}
return Object.keys(players).map(key => {
const player = players[key]
const pawn = `${player.color.name}Pawn`
const pieceLat = player.position.location[0] + player.offset[0]
const pieceLng = player.position.location[1] + player.offset[1]
return <Marker key={pawn} position={[pieceLat, pieceLng]} icon={icons[pawn]} />
})
}
export function drawLines() {
const connections = []
const added = {}
Object.keys(cities).forEach(origin => {
const start = cities[origin].location
cities[origin].connections.forEach(destination => {
const end = cities[destination].location
// make up a silly stringified key to keep track of whether you drew this line already
// sorting guarantees order doesn't mastter
const key = [start, end].sort().toString()
if (!added[key]) {
added[key] = true
// if the absolute value of the difference of the longitudes is >= 180
// then line needs to be wrapped
if (Math.abs(start[1] - end[1]) >= 180) {
const segments = wrapLine(start, end)
connections.push(<Polyline key={`${origin}-${destination}-1`} positions={segments[0]} color="white" weight="1"/>)
connections.push(<Polyline key={`${origin}-${destination}-2`} positions={segments[1]} color="white" weight="1"/>)
} else {
connections.push(<Polyline key={`${origin}-${destination}`} positions={[start, end]} color="white" weight="1"/>)
}
}
})
})
return connections
}
function wrapLine(start, end) {
// convert locations to latitude and longitude
let segment0 = []
let segment1 = []
const lat0 = start[0]
const lng0 = start[1]
const lat1 = end[0]
const lng1 = end[1]
// average latitudes of start and end to find breakpoint
const midpoint = (lat0 + lat1) / 2
// create first segment
if (lng0 < 0) {
segment0 = [[lat0, lng0], [midpoint, -179.999999]]
} else {
segment0 = [[lat0, lng0], [midpoint, 179.999999]]
}
// create second segment
if (lng1 < 0) {
segment1 = [[midpoint, -179.999999], [lat1, lng1]]
} else {
segment1 = [[midpoint, 179.999999], [lat1, lng1]]
}
return [segment0, segment1]
}
|
docs/app/Examples/collections/Table/Variations/index.js | ben174/Semantic-UI-React | import React from 'react'
import { Message } from 'semantic-ui-react'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
const Variations = () => {
return (
<ExampleSection title='Variations'>
<ComponentExample
title='Single Line'
description='A table can specify that its cell contents should remain on a single line, and not wrap.'
examplePath='collections/Table/Variations/TableExampleSingleLine'
/>
<ComponentExample
title='Attached'
description='A table can be attached to other content on a page.'
examplePath='collections/Table/Variations/TableExampleAttached'
/>
<ComponentExample
title='Fixed'
description={
[
'A table can use fixed a special faster form of table rendering that does not resize table cells based on',
'content.',
].join(' ')
}
examplePath='collections/Table/Variations/TableExampleFixed'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleFixedLine'>
<Message info>
Fixed "single line" tables will automatically ensure content that does not fit in a single line will receive
"..." ellipsis.
</Message>
</ComponentExample>
<ComponentExample
title='Stacking'
description='A table can specify how it stacks table content responsively.'
examplePath='collections/Table/Variations/TableExampleUnstackable'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleStackable' />
<ComponentExample
title='Selectable Row'
description='A table can have its rows appear selectable.'
examplePath='collections/Table/Variations/TableExampleSelectable'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleSelectableInverted' />
<ComponentExample
title='Vertical Alignment'
description='A table header, row or cell can adjust its vertical alignment.'
examplePath='collections/Table/Variations/TableExampleVerticalAlign'
/>
<ComponentExample
title='Text Alignment'
description='A table header, row, or cell can adjust its text alignment.'
examplePath='collections/Table/Variations/TableExampleTextAlign'
/>
<ComponentExample
title='Striped'
description='A table can stripe alternate rows of content with a darker color to increase contrast.'
examplePath='collections/Table/Variations/TableExampleStriped'
/>
<ComponentExample
title='Celled'
description='A table may be divided each row into separate cells.'
examplePath='collections/Table/Variations/TableExampleCelled'
/>
<ComponentExample
title='Basic'
description='A table can reduce its complexity to increase readability.'
examplePath='collections/Table/Variations/TableExampleBasic'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleVeryBasic' />
<ComponentExample
title='Collapsing Cell'
description='A cell can be collapsing so that it only uses as much space as required.'
examplePath='collections/Table/Variations/TableExampleCollapsingCell'
/>
<ComponentExample
title='Column Count'
description='A table can specify its column count to divide its content evenly.'
examplePath='collections/Table/Variations/TableExampleColumnCount'
/>
<ComponentExample
title='Column Width'
description='A table can specify the width of individual columns independently.'
examplePath='collections/Table/Variations/TableExampleColumnWidth'
/>
<ComponentExample
title='Collapsing'
description='A table can be collapsing, taking up only as much space as its rows.'
examplePath='collections/Table/Variations/TableExampleCollapsing'
/>
<ComponentExample
title='Colored'
description='A table can be given a color to distinguish it from other table.'
examplePath='collections/Table/Variations/TableExampleColors'
/>
<ComponentExample
title='Inverted'
description="A table's colors can be inverted."
examplePath='collections/Table/Variations/TableExampleInverted'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleInvertedColors' />
<ComponentExample
title='Full-Width Header / Footer'
description={
'A definition table can have a full width header or footer, filling in the gap left by the first column.'
}
examplePath='collections/Table/Variations/TableExampleFullWidth'
/>
<ComponentExample
title='Padded'
description='A table may sometimes need to be more padded for legibility.'
examplePath='collections/Table/Variations/TableExamplePadded'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleVeryPadded' />
<ComponentExample
title='Compact'
description='A table may sometimes need to be more compact to make more rows visible at a time.'
examplePath='collections/Table/Variations/TableExampleCompact'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleVeryCompact' />
<ComponentExample
title='Size'
description='A table can also be small or large.'
examplePath='collections/Table/Variations/TableExampleSmall'
/>
<ComponentExample examplePath='collections/Table/Variations/TableExampleLarge' />
</ExampleSection>
)
}
export default Variations
|
src/templates/tags-list-template.js | bapti/blog | // @flow strict
import React from 'react';
import { Link } from 'gatsby';
import kebabCase from 'lodash/kebabCase';
import Layout from '../components/Layout';
import Sidebar from '../components/Sidebar';
import Page from '../components/Page';
import { useSiteMetadata, useTagsList } from '../hooks';
const TagsListTemplate = () => {
const { title, subtitle } = useSiteMetadata();
const tags = useTagsList();
return (
<Layout title={`Tags - ${title}`} description={subtitle}>
<Sidebar />
<Page title="Tags">
<ul>
{tags.map((tag) => (
<li key={tag.fieldValue}>
<Link to={`/tag/${kebabCase(tag.fieldValue)}/`}>
{tag.fieldValue} ({tag.totalCount})
</Link>
</li>
))}
</ul>
</Page>
</Layout>
);
};
export default TagsListTemplate;
|
src/client/components/EventList/index.js | mweslander/veery | // Imports
import React from 'react';
import PropTypes from 'prop-types';
// Components
import Event from '../Event';
import Footer from '../Footer';
// CSS
import './index.scss';
// PropTypes
const propTypes = {
events: PropTypes.array,
focusedVenue: PropTypes.object,
updateFocusedVenue: PropTypes.func
};
/*
EventList
<EventList/>
*/
function EventList({ events, focusedVenue, updateFocusedVenue }) {
return (
<div className="c-event-list__container">
<button className="c-event-list__toggle">All</button>
<ul className="c-event-list element" id="containerElement">
<li className="c-event-list__item">
{events.map((event) => {
return (
<Event
event={event}
focusedVenue={focusedVenue}
key={event._id}
updateFocusedVenue={updateFocusedVenue}
/>
);
})}
</li>
</ul>
<Footer />
</div>
);
}
EventList.propTypes = propTypes;
export default EventList;
|
src/svg-icons/action/list.js | skarnecki/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionList = (props) => (
<SvgIcon {...props}>
<path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"/>
</SvgIcon>
);
ActionList = pure(ActionList);
ActionList.displayName = 'ActionList';
export default ActionList;
|
src/svg-icons/action/assignment-turned-in.js | owencm/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionAssignmentTurnedIn = (props) => (
<SvgIcon {...props}>
<path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-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-1zm-2 14l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"/>
</SvgIcon>
);
ActionAssignmentTurnedIn = pure(ActionAssignmentTurnedIn);
ActionAssignmentTurnedIn.displayName = 'ActionAssignmentTurnedIn';
ActionAssignmentTurnedIn.muiName = 'SvgIcon';
export default ActionAssignmentTurnedIn;
|
src/icons/WifiLockIcon.js | kiloe/ui | import React from 'react';
import Icon from '../Icon';
export default class WifiLockIcon extends Icon {
getSVG(){return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M41 19c.56 0 1.09.08 1.63.16L48 12c-6.69-5.02-15-8-24-8S6.69 6.98 0 12l24 32 7-9.33V29c0-5.52 4.48-10 10-10zm5 13v-3c0-2.76-2.24-5-5-5s-5 2.24-5 5v3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm-2 0h-6v-3c0-1.66 1.34-3 3-3s3 1.34 3 3v3z"/></svg>;}
}; |
app/src/js/components/settings/button.js | tahnik/devRantron | import React from 'react';
import PropTypes from 'prop-types';
const Button = props => (
<div className="setting button">
<span className="setting_label">{props.setting.text}</span>
<div className="setting_option">
<button
onClick={() => props.handleChange()}
disabled={!props.setting.value}
style={{
backgroundColor: props.theme.backgroundColor,
color: props.theme.item_card.color,
}}
>{props.setting.buttonText}
</button>
</div>
</div>
);
Button.propTypes = {
setting: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
handleChange: PropTypes.func.isRequired,
};
export default Button;
|
src/components/Weui/dialog/confirm.js | ynu/res-track-wxe | /**
* Created by jf on 15/10/27.
*/
import React from 'react';
import classNames from 'classnames';
import Mask from '../mask/index';
class Confirm extends React.Component {
static propTypes = {
buttons: React.PropTypes.array,
show: React.PropTypes.bool,
title: React.PropTypes.string
};
static defaultProps = {
buttons: [],
show: false,
title: ''
};
renderButtons() {
return this.props.buttons.map((action, idx) => {
const {type, label, ...others} = action;
const className = classNames({
'weui-dialog__btn': true,
'weui-dialog__btn_default': type === 'default',
'weui-dialog__btn_primary': type === 'primary'
});
return (
<a key={idx} href="javascript:;" {...others} className={className}>{label}</a>
);
});
}
render() {
const {title, show, children} = this.props;
return (
<div className="weui_dialog_confirm" style={{display: show ? 'block' : 'none'}}>
<Mask/>
<div className="weui-dialog">
<div className="weui-dialog__hd">
<strong className="weui-dialog__title">{title}</strong>
</div>
<div className="weui-dialog__bd">
{children}
</div>
<div className="weui-dialog__ft">
{this.renderButtons()}
</div>
</div>
</div>
);
}
}
export default Confirm;
|
examples/browserify-gulp-example/src/app/Main.js | xmityaz/material-ui | /**
* In this file, we create a React component
* which incorporates components providedby material-ui.
*/
import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import Dialog from 'material-ui/Dialog';
import {deepOrange500} from 'material-ui/styles/colors';
import FlatButton from 'material-ui/FlatButton';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
const styles = {
container: {
textAlign: 'center',
paddingTop: 200,
},
};
const muiTheme = getMuiTheme({
palette: {
accent1Color: deepOrange500,
},
});
class Main extends React.Component {
constructor(props, context) {
super(props, context);
this.handleRequestClose = this.handleRequestClose.bind(this);
this.handleTouchTap = this.handleTouchTap.bind(this);
this.state = {
open: false,
};
}
handleRequestClose() {
this.setState({
open: false,
});
}
handleTouchTap() {
this.setState({
open: true,
});
}
render() {
const standardActions = (
<FlatButton
label="Ok"
secondary={true}
onTouchTap={this.handleRequestClose}
/>
);
return (
<MuiThemeProvider muiTheme={muiTheme}>
<div style={styles.container}>
<Dialog
open={this.state.open}
title="Super Secret Password"
actions={standardActions}
onRequestClose={this.handleRequestClose}
>
1-2-3-4-5
</Dialog>
<h1>material-ui</h1>
<h2>example project</h2>
<RaisedButton
label="Super Secret Password"
primary={true}
onTouchTap={this.handleTouchTap}
/>
</div>
</MuiThemeProvider>
);
}
}
export default Main;
|
src/containers/settings/SettingsBase.js | mikebarkmin/react-to-everything | import React from 'react';
import { List, ListItem } from 'material-ui/List';
import Toggle from 'material-ui/Toggle';
import I18n from '../../locales/I18n';
export default class Base extends React.Component {
render() {
return (
<div>
<List>
<ListItem
primaryText={I18n.t('settings.settings1')}
rightToggle={
<Toggle
onToggle={(e, value) => this.onSettings1Change(value)}
value={this.props.settings.settings1}
/>
}
/>
<ListItem
primaryText={I18n.t('settings.settings2')}
rightToggle={
<Toggle
onToggle={(e, value) => this.onSettings2Change(value)}
value={this.props.settings.settings2}
/>
}
/>
</List>
</div>
);
}
}
|
src/svg-icons/av/videocam-off.js | pradel/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvVideocamOff = (props) => (
<SvgIcon {...props}>
<path d="M21 6.5l-4 4V7c0-.55-.45-1-1-1H9.82L21 17.18V6.5zM3.27 2L2 3.27 4.73 6H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.21 0 .39-.08.54-.18L19.73 21 21 19.73 3.27 2z"/>
</SvgIcon>
);
AvVideocamOff = pure(AvVideocamOff);
AvVideocamOff.displayName = 'AvVideocamOff';
export default AvVideocamOff;
|
src/components/Footer.js | maria-robobug/resume_viewer | import React from 'react';
class Footer extends React.Component {
render () {
return (
<footer>
<div className="row">
<div className="twelve columns">
<ul className="social-links">
<li><a href="#"><i className="fa fa-facebook"></i></a></li>
<li><a href="#"><i className="fa fa-twitter"></i></a></li>
<li><a href="#"><i className="fa fa-google-plus"></i></a></li>
<li><a href="#"><i className="fa fa-linkedin"></i></a></li>
<li><a href="#"><i className="fa fa-instagram"></i></a></li>
<li><a href="#"><i className="fa fa-dribbble"></i></a></li>
<li><a href="#"><i className="fa fa-skype"></i></a></li>
</ul>
<ul className="copyright">
<li>© Copyright 2014 CeeVee</li>
<li>Design by <a title="Styleshout" href="http://www.styleshout.com/">Styleshout</a></li>
</ul>
</div>
<div id="go-top"><a className="smoothscroll" title="Back to Top" href="#home"><i className="icon-up-open"></i></a></div>
</div>
</footer>
);
}
}
export default Footer;
|
actor-apps/app-web/src/app/components/modals/invite-user/InviteByLink.react.js | dut3062796s/actor-platform | import { assign } from 'lodash';
import React from 'react';
import Modal from 'react-modal';
import addons from 'react/addons';
import ReactMixin from 'react-mixin';
import { IntlMixin, FormattedMessage } from 'react-intl';
import { Styles, FlatButton, Snackbar } from 'material-ui';
import ReactZeroClipboard from 'react-zeroclipboard';
import classnames from 'classnames';
import { KeyCodes } from 'constants/ActorAppConstants';
import ActorTheme from 'constants/ActorTheme';
import InviteUserByLinkActions from 'actions/InviteUserByLinkActions';
import InviteUserActions from 'actions/InviteUserActions';
import InviteUserStore from 'stores/InviteUserStore';
const ThemeManager = new Styles.ThemeManager();
const appElement = document.getElementById('actor-web-app');
Modal.setAppElement(appElement);
const {addons: { PureRenderMixin }} = addons;
const getStateFromStores = () => {
return {
isShown: InviteUserStore.isInviteWithLinkModalOpen(),
group: InviteUserStore.getGroup(),
inviteUrl: InviteUserStore.getInviteUrl()
};
};
@ReactMixin.decorate(IntlMixin)
@ReactMixin.decorate(PureRenderMixin)
class InviteByLink extends React.Component {
static childContextTypes = {
muiTheme: React.PropTypes.object
};
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
constructor(props) {
super(props);
this.state = assign({
isCopyButtonEnabled: false
}, getStateFromStores());
ThemeManager.setTheme(ActorTheme);
ThemeManager.setComponentThemes({
button: {
minWidth: 60
}
});
InviteUserStore.addChangeListener(this.onChange);
document.addEventListener('keydown', this.onKeyDown, false);
}
componentWillUnmount() {
InviteUserStore.removeChangeListener(this.onChange);
document.removeEventListener('keydown', this.onKeyDown, false);
}
render() {
const { group } = this.state;
const { inviteUrl, isShown, isCopyButtonEnabled } = this.state;
const snackbarStyles = ActorTheme.getSnackbarStyles();
let groupName;
if (group !== null) {
groupName = <b>{group.name}</b>;
}
const copyButtonClassname = classnames('button button--blue pull-right', {
'hide': !isCopyButtonEnabled
});
return (
<Modal className="modal-new modal-new--invite-by-link"
closeTimeoutMS={150}
isOpen={isShown}
style={{width: 400}}>
<header className="modal-new__header">
<svg className="modal-new__header__icon icon icon--blue"
dangerouslySetInnerHTML={{__html: '<use xlink:href="assets/sprite/icons.svg#back"/>'}}
onClick={this.onBackClick}/>
<h3 className="modal-new__header__title">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalTitle')}/>
</h3>
<div className="pull-right">
<FlatButton hoverColor="rgba(81,145,219,.17)"
label="Done"
labelStyle={{padding: '0 8px'}}
onClick={this.onClose}
secondary={true}
style={{marginTop: -6}}/>
</div>
</header>
<div className="modal-new__body">
<FormattedMessage groupName={groupName} message={this.getIntlMessage('inviteByLinkModalDescription')}/>
<textarea className="invite-url" onClick={this.onInviteLinkClick} readOnly row="3" value={inviteUrl}/>
</div>
<footer className="modal-new__footer">
<button className="button button--light-blue pull-left hide">
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalRevokeButton')}/>
</button>
<ReactZeroClipboard onCopy={this.onInviteLinkCopied} onReady={this.onZeroclipboardReady} text={inviteUrl}>
<button className={copyButtonClassname}>
<FormattedMessage message={this.getIntlMessage('inviteByLinkModalCopyButton')}/>
</button>
</ReactZeroClipboard>
</footer>
<Snackbar autoHideDuration={3000}
message={this.getIntlMessage('inviteLinkCopied')}
ref="inviteLinkCopied"
style={snackbarStyles}/>
</Modal>
);
}
onClose = () => {
InviteUserByLinkActions.hide();
};
onBackClick = () => {
this.onClose();
InviteUserActions.show(this.state.group);
};
onInviteLinkClick = event => {
event.target.select();
};
onChange = () => {
this.setState(getStateFromStores());
};
onKeyDown = (event) => {
if (event.keyCode === KeyCodes.ESC) {
event.preventDefault();
this.onClose();
}
};
onInviteLinkCopied = () => {
this.refs.inviteLinkCopied.show();
};
onZeroclipboardReady = () => {
this.setState({isCopyButtonEnabled: true});
};
}
export default InviteByLink;
|
platform/viewer/src/components/SidePanel.js | OHIF/Viewers | import './SidePanel.css';
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
const SidePanel = ({ from, isOpen, children, width }) => {
const fromSideClass = from === 'right' ? 'from-right' : 'from-left';
const styles = width
? {
maxWidth: width,
marginRight: isOpen ? '0' : Number.parseInt(width) * -1,
}
: {};
return (
<section
style={styles}
className={classNames('sidepanel', fromSideClass, {
'is-open': isOpen,
})}
>
{children}
</section>
);
};
SidePanel.propTypes = {
from: PropTypes.string.isRequired,
isOpen: PropTypes.bool.isRequired,
children: PropTypes.node,
width: PropTypes.string,
};
export default SidePanel;
|
client/components/Post.js | raymestalez/vertex | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { Panel, Label } from 'react-bootstrap';
import Remarkable from 'remarkable';
/* import FontAwesome from 'react-fontawesome';*/
import { deletePost, fetchSettings } from '../actions/index';
import { } from '../actions/index';
import config from '../../config/config.js';
class Post extends Component {
componentWillMount() {
/* Fetch settings if there aren't any.
Not sure if this does anything, maybe Im just fetching them from header.*/
if (!this.props.settings.metaTitle){
this.props.fetchSettings();
}
}
renderPostHeader () {
/* Return post header */
if (this.props.link ) {
/* PostList will use this component, and pass a link to it
so you can click on the title and view it */
return (
<h1>
<Link to={this.props.link}>
{this.props.title}
</Link>
</h1>
);
} else {
/* Post detail does not pass a link. */
return (
<h1>
{this.props.title}
</h1>
);
}
}
renderDraftLabel () {
if (!this.props.published) {
/* Show "Draft" label on non-published posts */
return (
<Label bsStyle="default" className="label-draft">
Draft
</Label>
);
} else {return (null);}
}
renderBody () {
var body = this.props.body;
/* Truncate the post to the number of words passed as a truncate prop. */
var truncated = body.split(" ").splice(0,this.props.truncate).join(" ");
if (this.props.truncate && body > truncated) {
body = truncated;
}
/* Turn markdown into html */
const md = new Remarkable({html: true});
const html = md.render(body);
/* If the first line is header, turn it into a link to the post */
if (this.props.link) {
var firstline = html.split('\n')[0];
var rest = html.split('\n').slice(1).join("");
/* console.log("rest " + rest);*/
if (firstline.indexOf('<h1>') > -1) {
return (
<div>
<Link to={this.props.link}
dangerouslySetInnerHTML={{__html:firstline}}
></Link>
<div dangerouslySetInnerHTML={{__html:rest}} />
</div>
);
}
}
return (
<div dangerouslySetInnerHTML={{__html:html}} />
);
}
renderReadMore () {
/* Add "read more..." link at the end of truncated posts. */
var body = this.props.body;
var truncated = body.split(" ").splice(0,this.props.truncate).join(" ");
if (this.props.truncate && body > truncated) {
return (
<div>
<Link to={this.props.link}
className="readMore"> Read more...</Link>
</div>
);
}
}
renderFooter () {
const { tags, settings } = this.props;
var tagItems = "";
/* If there are some tags - generate tag labels */
if (tags && tags.length > 0) {
tagItems = tags.map((tag) => {
return (
<span key={tag}>
<Link to={`${config.domain}/tag/` + tag}>
<Label bsStyle="default">
{tag}
</Label>
</Link>
</span>
);
});
}
return (
<div className="post-footer">
{ tagItems }
<div className="right">
<Link className="black" to={settings.userurl} >
@{ settings.username }
</Link>
{/*
<span className="icon">
<i className="fa fa-retweet"></i> 3
</span>
<Link to={this.props.link} className="icon">
<i className="fi-comment"></i> 12
</Link>
<span className="icon">
<i className="fi-arrow-up"></i> 3
</span>
*/}
{ !this.props.published ?
<Label bsStyle="default" className="label-draft">
Draft
</Label>
: null }
{ this.props.authenticated ?
<Link to={`${config.domain}/post/`+this.props.slug+"/edit"} className="icon">
<i className="fa fa-pencil"></i>
</Link>
: null }
{ this.props.authenticated ?
<a onClick={()=>this.props.deletePost(this.props.slug)}
className="icon">
<i className="fa fa-trash"></i>
</a>
: null }
{ this.props.link ?
<Link to={this.props.link} className="icon">
<i className="fa fa-link"></i>
</Link>
: null }
</div>
<div className="clearfix"></div>
</div>
);
}
render() {
return (
<div>
<article className="post panel panel-default">
<div>
{this.renderBody()}
{this.renderReadMore()}
</div>
<br/>
{this.renderFooter()}
</article>
</div>
);
}
}
// Actions required to provide data for this component to render in sever side.
Post.need = [() => { return fetchSettings(); }];
function mapStateToProps(state) {
return {
settings: state.settings,
authenticated: state.auth.authenticated
};
}
export default connect(mapStateToProps, { deletePost, fetchSettings })(Post);
|
node_modules/react-taco-table/site/src/components/ExampleRowClassName.js | premcool/getmydeal | import React from 'react';
import { TacoTable, DataType, SortDirection, Formatters } from 'react-taco-table';
import cellLinesData from '../data/cell_lines.json';
import './ExampleRowClassName.scss';
/**
* An example demonstrating how to use rowClassName
*/
const columns = [
{
id: 'name',
value: rowData => rowData.cellLine,
header: 'Cell Line',
renderer: cellData => <b>{cellData.label}</b>,
sortValue: cellData => cellData.label,
type: DataType.String,
width: 250,
},
{
id: 'receptorStatus',
header: 'Receptor Status',
renderer: cellData => cellData.label,
sortValue: cellData => cellData.label,
type: DataType.String,
},
{
id: 'MLL3',
type: DataType.String,
},
{
id: 'value',
type: DataType.Number,
renderer: Formatters.plusMinusFormat(1),
firstSortDirection: SortDirection.Ascending,
},
{
id: 'rating',
type: DataType.Number,
renderer: Formatters.plusMinusFormat(2),
},
{
id: 'level',
type: DataType.NumberOrdinal,
},
];
function rowClassName(rowData, rowNumber) {
if (rowData.MLL3 === 'MUT') {
return 'special-row';
}
return undefined;
}
class ExampleRowClassName extends React.Component {
render() {
return (
<TacoTable
className="example-row-class-name"
columns={columns}
data={cellLinesData}
rowClassName={rowClassName}
striped
sortable
/>
);
}
}
export default ExampleRowClassName;
|
js/jqwidgets/demos/react/app/datatable/pagingapi/app.js | luissancheza/sice | import React from 'react';
import ReactDOM from 'react-dom';
import JqxDataTable from '../../../jqwidgets-react/react_jqxdatatable.js';
import JqxDropDownList from '../../../jqwidgets-react/react_jqxdropdownlist.js';
import JqxInput from '../../../jqwidgets-react/react_jqxinput.js';
import JqxButton from '../../../jqwidgets-react/react_jqxbuttons.js';
import JqxPanel from '../../../jqwidgets-react/react_jqxpanel.js';
class App extends React.Component {
componentDidMount() {
this.refs.pagerModeDropDownList.on('select', (event) => {
if (event.args.index == 0) {
this.refs.myDataTable.pagerMode('default');
}
else {
this.refs.myDataTable.pagerMode('advanced');
}
});
this.refs.pagerPositionDropDownList.on('select', (event) => {
if (event.args.index == 0) {
this.refs.myDataTable.pagerPosition('top');
}
else if (event.args.index == 1) {
this.refs.myDataTable.pagerPosition('bottom');
}
else {
this.refs.myDataTable.pagerPosition('both');
}
});
this.refs.applyPage.on('click', () => {
let page = parseInt(this.refs.gotopage.val());
if (!isNaN(page)) {
page--;
if (page < 0) page = 0;
this.refs.myDataTable.goToPage(page);
}
});
this.refs.myDataTable.on('pageChanged', (event) => {
let panel = document.getElementsByClassName('myPanel')[0];
let count = panel.getElementsByClassName('logged');
if (count.length >= 5) {
this.refs.events.clearcontent();
}
let args = event.args;
let eventData = '<div>Page:' + (1 + args.pagenum) + ', Page Size: ' + args.pageSize + '</div>';
this.refs.events.prepend('<div class="logged" style="margin-top: 5px;">' + eventData + '</div>');
});
this.refs.myDataTable.on('pageSizeChanged', (event) => {
this.refs.events.clearcontent();
let args = event.args;
let eventData = '<div>Page:' + (1 + args.pagenum) + ', Page Size: ' + args.pageSize + ', Old Page Size: ' + args.oldPageSize + '</div>';
this.refs.events.prepend('<div style="margin-top: 5px;">' + eventData + '</div>');
});
}
render() {
let source =
{
localData: generatedata(200),
dataType: 'array',
datafields:
[
{ name: 'firstname', type: 'string' },
{ name: 'lastname', type: 'string' },
{ name: 'productname', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'price', type: 'number' },
{ name: 'total', type: 'number' }
]
};
let dataAdapter = new $.jqx.dataAdapter(source);
let columns =
[
{ text: 'Name', dataField: 'firstname', width: 200 },
{ text: 'Last Name', dataField: 'lastname', width: 200 },
{ text: 'Product', editable: false, dataField: 'productname', width: 180 },
{ text: 'Quantity', dataField: 'quantity', width: 80, cellsalign: 'right' },
{ text: 'Unit Price', dataField: 'price', width: 80, cellsalign: 'right', cellsFormat: 'c2' },
{ text: 'Total', dataField: 'total', width: 80, cellsalign: 'right', cellsFormat: 'c2' }
];
return (
<div>
<JqxDataTable ref='myDataTable' style={{ float: 'left' }}
width={650} source={dataAdapter} altRows={true}
pageable={true} pagerPosition={'both'} columns={columns}
/>
<div style={{ fontSize: 13, fontFamily: 'Verdana', float: 'left', marginLeft: 30 }}>
<div><strong>Settings</strong></div>
<div style={{ marginTop: 10 }}>
<div>Pager Mode:</div>
<JqxDropDownList ref='pagerModeDropDownList' style={{ marginTop: 5 }}
width={120} height={25} selectedIndex={0}
source={['default', 'advanced']} autoDropDownHeight={true}
/>
<div style={{ marginTop: 10 }}>Pager Position:</div>
<JqxDropDownList ref='pagerPositionDropDownList' style={{ marginTop: 5 }}
width={120} height={25} selectedIndex={2}
source={['top', 'bottom', 'both']} autoDropDownHeight={true}
/>
<div style={{ marginTop: 10 }}>Go to Page:</div>
<JqxInput ref='gotopage' style={{ marginTop: 5, float: 'left', marginRight: 5 }}
value='1' width={120} height={25}
/>
<JqxButton ref='applyPage' value='Apply' height={25} style={{ marginTop: 6 }} />
</div>
<div style={{ marginTop: 10 }}>
<div>Event Log:</div>
<JqxPanel ref='events' className='myPanel' style={{ marginTop: 5 }}
width={150} height={150}
/>
</div>
</div>
</div>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
imports/ui/components/CourseListToRegister.js | hanstest/hxgny | import React from 'react'
import { Grid, Table, Icon, Message, Header, Button } from 'semantic-ui-react'
const renderCourse = (course, removeCourse) => (
<Table.Row textAlign='center' key={course._id}>
<Table.Cell>{course.course}</Table.Cell>
<Table.Cell>{course.teacher}</Table.Cell>
<Table.Cell>{course.session}</Table.Cell>
<Table.Cell>{course.term}</Table.Cell>
<Table.Cell>${course.tuition}</Table.Cell>
<Table.Cell>${course.bookFee}</Table.Cell>
<Table.Cell>${course.regFee}</Table.Cell>
<Table.Cell>${course.extraFee}</Table.Cell>
<Table.Cell><Icon link name='trash' onClick={() => removeCourse(course._id)} /></Table.Cell>
</Table.Row>
)
class CourseList extends React.Component {
calculateBalance = () => {
let balance = 0.0
this.props.courses.forEach((course) => {
balance += course.tuition
balance += course.bookFee
balance += course.regFee
balance += course.extraFee
})
return balance
}
render() {
return (
<Grid.Column width={16}>
<Header as='h4'>Courses selected to register:</Header>
{this.props.courses.length > 0 && <Table size='small' celled selectable singleLine>
<Table.Header>
<Table.Row textAlign='center'>
<Table.HeaderCell>课程名称</Table.HeaderCell>
<Table.HeaderCell>教师姓名</Table.HeaderCell>
<Table.HeaderCell>上课时间</Table.HeaderCell>
<Table.HeaderCell>学制</Table.HeaderCell>
<Table.HeaderCell>学费</Table.HeaderCell>
<Table.HeaderCell>书本费</Table.HeaderCell>
<Table.HeaderCell>注册费</Table.HeaderCell>
<Table.HeaderCell>其它费用</Table.HeaderCell>
<Table.HeaderCell>删除</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{this.props.courses.map((course) => {
return renderCourse(course, this.props.removeCourse)
})}
</Table.Body>
<Table.Footer fullWidth>
<Table.Row>
<Table.HeaderCell colSpan='9'>
<Button floated='right' primary size='small'>
Checkout
</Button>
<Button floated='right' size='small'>
Subtotal ({this.props.courses.length} courses): ${this.calculateBalance()}
</Button>
</Table.HeaderCell>
</Table.Row>
</Table.Footer>
</Table>}
{this.props.courses.length === 0 && <Message info>No courses are selected to register yet!</Message>}
</Grid.Column>
)
}
}
CourseList.propTypes = {
courses: React.PropTypes.array,
removeCourse: React.PropTypes.func,
}
export default CourseList
|
app/client.js | shilu89757/redux-blog-example | /* eslint-env browser */
/* global process */
import 'babel/polyfill';
import React from 'react';
import BrowserHistory from 'react-router/lib/BrowserHistory';
import HashHistory from 'react-router/lib/HashHistory';
import Root from './Root';
const history = (process.env.NODE_ENV === 'production')
? new BrowserHistory()
: new HashHistory();
React.render(
<Root {...{ history }} />,
document.getElementById('app')
);
|
app/main.js | pt-br/faustosbomb2 | // import React from 'react';
// import ReactDOM from 'react-dom';
// import App from './App.js';
// ReactDOM.render(<App />, document.getElementById('root'));
|
admin/client/components/ItemsTable/ItemsTableDragDrop.js | tony2cssc/keystone | import React from 'react';
import { DragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import { Sortable } from './ItemsTableRow';
import DropZone from './ItemsTableDragDropZone';
var ItemsTableDragDrop = React.createClass({
displayName: 'ItemsTableDragDrop',
propTypes: {
columns: React.PropTypes.array,
id: React.PropTypes.any,
index: React.PropTypes.number,
items: React.PropTypes.object,
list: React.PropTypes.object,
},
render () {
return (
<tbody >
{this.props.items.results.map((item, i) => {
return (
<Sortable key={item.id}
index={i}
sortOrder={item.sortOrder || 0}
id={item.id}
item={item}
{ ...this.props }
/>
);
})}
<DropZone { ...this.props } />
</tbody>
);
},
});
module.exports = DragDropContext(HTML5Backend)(ItemsTableDragDrop);
|
client/src/components/App.js | uramen/apartments | import React from 'react';
import Navbar from '../containers/NavbarContainer';
import Sidebar from '../containers/SidebarContainer';
export default ({authenticated, children, pathname }) => (
<div className={authenticated ? 'without-bg' : 'with-bg'}>
<div className={authenticated ? '' : 'black-bg'}>
{authenticated ? null : <Navbar />}
<div className="container-fluid">
{
authenticated
? <div className="row">
<div className="col-md-3">
<Sidebar />
</div>
<div className={`col-md-9 ${pathname === '/map' ? 'delete-padding' : null}`}>
{children}
</div>
</div>
: <div className="row">
<div className="col-md-8 offset-md-2">
{children}
</div>
</div>
}
</div>
</div>
</div>
);
|
assets/javascripts/main.js | simonhildebrandt/redact | import $ from 'jquery'
import React from 'react'
import ReactDOM from 'react-dom'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import {teal700} from 'material-ui/styles/colors';
import FontIcon from 'material-ui/FontIcon'
import IconMenu from 'material-ui/IconMenu'
import Paper from 'material-ui/Paper'
import Navigation from './navigation'
import DataTable from './data_table'
import Models from './models'
import Navigo from 'navigo'
import listenTo from 'element-resize-detector'
import InjectTap from 'react-tap-event-plugin'
InjectTap()
const muiTheme = getMuiTheme({
palette: {
primary1Color: teal700
}
})
class App extends React.Component {
constructor(props) {
super(props)
this.config = null
this.userData = null
this.state = {
configured: false,
model: null
}
this.router = new Navigo(null, true)
this.getConfig()
}
getChildContext() {
return {
config: this.state.config
}
}
loggedIn() {
return this.userData
}
checkUser() {
$.get(this.config.user_path)
.done((data) => {
this.setState({userData: data})
this.setState({configured: true})
})
.fail(() => {
// redirect to login
})
}
getConfig() {
$.get(this.props.config_path)
.done((data) => {
this.configApp(data)
})
}
configApp(data) {
this.config = data
this.models = new Models(this.config.models)
this.router.resolve()
this.checkUser()
}
chooseModel(name) {
this.router.navigate(this.findModel(name).root)
}
models() {
return this.config.models || []
}
title() {
if (this.state.model) {
return "Redact > " + this.state.model.label
} else {
return 'Redact'
}
}
render () {
if(!this.state.configured) {
return <div>Loading configuration</div>
}
if(!this.state.userData) {
return <div>Loading user data</div>
}
return <MuiThemeProvider muiTheme={muiTheme}>
<div>
<Navigation
title={this.title()}
configData={this.config}
userData={this.state.userData}
chooseModel={name => this.chooseModel(name)}
/>
<div className="app-body">
{this.currentContent()}
</div>
</div>
</MuiThemeProvider>
}
currentContent() {
if (this.state.model) {
return <DataTable model={this.state.model} />
} else {
return <div>Select a model</div>
}
}
}
App.childContextTypes = {
config: React.PropTypes.object,
}
$(() => {
let target = $('#container')
ReactDOM.render(<App config_path={target.data('config-path')} />, target.get(0))
})
|
1l_React_ET_Lynda/Ex_Files_React_EssT/Ch03/03_03/finish/src/components/SkiDayCount.js | yevheniyc/Autodidact | import React from 'react'
import '../stylesheets/ui.scss'
export const SkiDayCount = React.createClass({
render() {
return (
<div className="ski-day-count">
<div className="total-days">
<span>{this.props.total}</span>
<span>days</span>
</div>
<div className="powder-days">
<span>{this.props.powder}</span>
<span>days</span>
</div>
<div className="backcountry-days">
<span>{this.props.backcountry}</span>
<span>days</span>
</div>
<div>
<span>{this.props.goal}</span>
</div>
</div>
)
}
}) |
app/ErrorPage.js | jamesburton/newsappreactnative | import React from 'react';
import styles from './styles';
import { Text, View } from 'react-native';
export var ErrorPage = (props) => <View style={styles.container}><Text style={styles.welcome} style={{color: '#f00'}}>News App (React-Native)</Text><Text>Error: {props.ex}</Text></View>;
module.exports = ErrorPage; |
docs/src/sections/PageHeaderSection.js | apkiernan/react-bootstrap | import React from 'react';
import Anchor from '../Anchor';
import PropTable from '../PropTable';
import ReactPlayground from '../ReactPlayground';
import Samples from '../Samples';
export default function PageHeaderSection() {
return (
<div className="bs-docs-section">
<h2 className="page-header">
<Anchor id="page-header">Page header</Anchor> <small>PageHeader</small>
</h2>
<p>A simple shell for an <code>h1</code> to appropriately space out and segment sections of content on a page. It can utilize the <code>h1</code>’s default <code>small</code> element, as well as most other components (with additional styles).</p>
<ReactPlayground codeText={Samples.PageHeader} />
<h3><Anchor id="page-header-props">Props</Anchor></h3>
<PropTable component="PageHeader"/>
</div>
);
}
|
example/src/pages/Catalog.js | ethanselzer/react-lazy-tree | import React, { Component } from 'react';
import {
Col,
Grid,
Jumbotron,
Row
} from 'react-bootstrap';
import SyntaxHighlighter, { registerLanguage } from 'react-syntax-highlighter/dist/light';
import solarized from 'react-syntax-highlighter/dist/styles/solarized-light';
import js from 'highlight.js/lib/languages/javascript';
import css from 'highlight.js/lib/languages/css';
import Helmet from 'react-helmet';
import Catalog from '../components/Catalog';
import Header from '../components/Header';
import codeString from '../code-examples/catalog';
import cssString from '../code-examples/catalog-css';
import 'bootstrap/dist/css/bootstrap.css';
import '../styles/app.css';
registerLanguage('javascript', js);
registerLanguage('css', css);
class CatalogPage extends Component {
render() {
return (
<div>
<Helmet title="Category Menu | React Lazy Tree" />
<Header {...this.props}/>
<Jumbotron>
<Grid>
<Row>
<Col sm={12}>
<h2>Category Menu Example</h2>
</Col>
</Row>
<Row>
<Col sm={5}>
<ul className="examples__summary-list">
<li>Sidebar category navigation use case</li>
<li>Interactivity constrained to third level and below</li>
<li>Hidden nodes lazily rendered when becoming visible</li>
</ul>
</Col>
<Col sm={5}>
<ul className="examples__summary-list">
<li>Information relationship expressed through typography</li>
<li>Initial node selection of deep links</li>
<li>
Code:
<a href="https://github.com/ethanselzer/react-lazy-tree/blob/master/example/src/components/Catalog.js">
JS
</a>
<a href="https://github.com/ethanselzer/react-lazy-tree/blob/master/example/styles/catalog.css">
CSS
</a>
</li>
</ul>
</Col>
</Row>
</Grid>
</Jumbotron>
<Grid>
<Row>
<Col sm={6} md={4} lg={4}>
<Catalog {...this.props}/>
</Col>
<Col sm={6} md={8} lg={8}>
<a
className="highlighter"
href="https://github.com/ethanselzer/react-lazy-tree/blob/master/example/src/components/Catalog.js"
>
<SyntaxHighlighter language='javascript' style={solarized}>
{codeString}
</SyntaxHighlighter>
</a>
<a
className="highligher"
href="https://github.com/ethanselzer/react-lazy-tree/blob/master/example/styles/catalog.css"
>
<SyntaxHighlighter language='css' style={solarized}>
{cssString}
</SyntaxHighlighter>
</a>
</Col>
</Row>
</Grid>
</div>
);
}
}
export default CatalogPage;
|
src/components/FormButton/FormButton.react.js | 6congyao/CGB-Dashboard | /*
* Copyright (c) 2016-present, Parse, LLC
* All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import Button from 'components/Button/Button.react';
import PropTypes from 'lib/PropTypes';
import React from 'react';
import styles from 'components/FormButton/FormButton.scss';
let FormButton = (props) => (
<div className={styles.input}>
<Button {...props} primary={true} width='80%' />
</div>
);
let { primary, width, ...otherPropTypes } = Button.propTypes;
FormButton.propTypes = otherPropTypes;
export default FormButton;
|
src/interface/others/Feeding.js | FaideWW/WoWAnalyzer | import React from 'react';
import PropTypes from 'prop-types';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import Icon from 'common/Icon';
// import Toggle from 'react-toggle';
function formatThousands(number) {
return (`${Math.round(number || 0)}`).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
}
function formatNumber(number) {
if (number > 1000000) {
return `${(number / 1000000).toFixed(2)}m`;
}
if (number > 10000) {
return `${Math.round(number / 1000)}k`;
}
return formatThousands(number);
}
class Feeding extends React.Component {
static propTypes = {
cooldownThroughputTracker: PropTypes.object,
};
constructor() {
super();
this.state = {
expand: false,
};
}
render() {
const { cooldownThroughputTracker } = this.props;
return (
<div>
{([
{
name: 'Cloudburst Totem',
feed: cooldownThroughputTracker.cbtFeed,
spell: SPELLS.CLOUDBURST_TOTEM_TALENT,
totals: cooldownThroughputTracker.cbtTotals,
},
{
name: 'Ascendance',
feed: cooldownThroughputTracker.ascFeed,
spell: SPELLS.ASCENDANCE_TALENT_RESTORATION,
totals: cooldownThroughputTracker.ascTotals,
},
]).map((category) => {
category.max = category.feed.reduce((a, b) => {
const aHealing = this.state.expand ? a.mergedHealing : a.healing;
const bHealing = this.state.expand ? b.mergedHealing : b.healing;
return (aHealing > bHealing) ? a : b;
}, 0).healing;
return category;
})
.filter(category => category.totals.total > 0)
.map(category => (
<table className="data-table" key={category.name} style={{ marginTop: 10, marginBottom: 10 }}>
<thead>
<tr>
<th style={{ fontSize: '1.25em' }}>
<SpellLink id={category.spell.id} style={{ color: '#fff' }}>
{category.name}
</SpellLink>
</th>
<th className="text-center" colSpan="3"><dfn data-tip={`The amount of healing done by spells that feed into ${category.name} while it was up.`}>Feeding done per spell</dfn></th>
<th className="text-center"><dfn data-tip={`The approximated effective healing each of the spells feeding into ${category.name} did, accounting for overhealing. This should roughly at up to the total effective healing of ${category.name}.`}>Approx. effective healing</dfn></th>
<th />
</tr>
</thead>
<tbody>
{Object.keys(category.feed)
.sort((a, b) => {
const healingA = category.feed[a].healing;
const healingB = category.feed[b].healing;
return healingA > healingB ? -1 : (healingB > healingA ? 1 : 0);
})
.filter(spellId => (!this.state.expand) || category.feed[spellId].mergedHealing > 0)
.map((spellId) => {
const ability = category.feed[spellId];
const healing = this.state.expand ? ability.mergedHealing : ability.healing;
const effectiveHealing = this.state.expand ? ability.mergedEffectiveHealing : ability.effectiveHealing;
const totalHealing = this.state.expand ? category.totals.mergedTotal : category.totals.total;
return (
<tr key={`${category.name} ${ability.name}`}>
<td style={{ width: '30%' }}>
<Icon icon={ability.icon} alt={ability.name} /> {ability.name}
</td>
<td className="text-right" style={{ width: '10%' }}>
{(healing / totalHealing * 100).toFixed(2)}%
</td>
<td style={{ width: '30%' }}>
<div
className="performance-bar"
style={{ width: `${Math.min(healing / category.max * 100, 100)}%`, backgroundColor: '#70b570' }}
/>
</td>
<td style={{ width: '10%' }}>
{formatNumber(healing)}
</td>
<td className="text-center" style={{ width: '20%' }}>
{formatNumber(effectiveHealing)}
</td>
</tr>
);
})}
<tr key={`${category.name}Summary`}>
<td />
<td />
<td className="text-right"><b>Total:</b></td>
<td className="text-left">
<b>{formatNumber(this.state.expand ? category.totals.mergedTotal : category.totals.total)}</b>
</td>
<td className="text-center">
<b>{formatNumber(this.state.expand ? category.totals.mergedTotalEffective : category.totals.totalEffective)}</b>
</td>
</tr>
</tbody>
</table>
))
}
</div>
);
}
}
export default Feeding;
|
app/containers/App/index.js | scribeklio/audora-io | /**
*
* App.react.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
*/
import React from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
export default class App extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
static propTypes = { children: React.PropTypes.node };
static childContextTypes = { muiTheme: React.PropTypes.object };
getChildContext()
{
var theme = getMuiTheme();
return { muiTheme: theme }
};
render() {
return (
<div>
{React.Children.toArray(this.props.children)}
</div>
);
}
}
|
packages/material-ui-icons/src/Theaters.js | dsslimshaddy/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let Theaters = props =>
<SvgIcon {...props}>
<path d="M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3h-2zM8 17H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V7h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V7h2v2z" />
</SvgIcon>;
Theaters = pure(Theaters);
Theaters.muiName = 'SvgIcon';
export default Theaters;
|
src/components/app/app.js | HendrikThePendric/webpack-demo | import React, { Component } from 'react';
import './app.scss';
import AddContact from '../add-contact/add-contact';
import SortContacts from '../sort-contacts/sort-contacts';
import FilterContacts from '../filter-contacts/filter-contacts';
import FavoritesToggler from '../favorites-toggler/favorites-toggler';
import ContactList from '../contact-list/contact-list';
export default class App extends Component {
render() {
return (
<main className="app">
<div className="add-wrap">
<AddContact />
</div>
<div className="list-wrap">
<h2>Contact list</h2>
<FavoritesToggler />
<FilterContacts />
<SortContacts />
<ContactList />
</div>
</main>
);
}
} |
project-my-demos/src/pages/Home.js | renhongl/Summary |
import React from 'react';
import { view as Header } from '../header';
import { view as Navigation } from '../navigation';
import { view as Breadcrumb } from '../breadcrumb';
import { view as Content } from '../content';
import Layout from 'antd/lib/layout';
export default () => {
return (
<Layout className="container">
<Header />
<Layout className="main-content">
<Navigation/>
<Layout style={{padding: '0 24px 24px'}}>
<Breadcrumb />
<Content />
</Layout>
</Layout>
</Layout>
)
} |
src/svg-icons/navigation/first-page.js | frnk94/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NavigationFirstPage = (props) => (
<SvgIcon {...props}>
<path d="M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"/>
</SvgIcon>
);
NavigationFirstPage = pure(NavigationFirstPage);
NavigationFirstPage.displayName = 'NavigationFirstPage';
NavigationFirstPage.muiName = 'SvgIcon';
export default NavigationFirstPage;
|
app/components/AvailabilityBox/index.js | seanng/web-server | import React from 'react';
// import styled from 'styled-components';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
import Button from '../Button'
import InputSelector from '../InputSelector'
export default class AvailabilityBox extends React.Component {
constructor (props) {
super(props)
this.state = {
value: props.value
}
}
increaseValue () {
this.setState({value: this.state.value + 1})
}
decreaseValue () {
this.setState({value: this.state.value - 1})
}
editValue(evt) {
this.setState({value: (evt.target.value)*1})
}
updateAvailability() {
this.props.updateAvailability(this.state.value)
}
render() {
return (
<div className="overviewBox">
<FormattedMessage {...messages.header} />
<InputSelector
editValue={this.editValue.bind(this)}
increaseValue={this.increaseValue.bind(this)}
decreaseValue={this.decreaseValue.bind(this)}
value={this.state.value}
/>
<Button onClick={this.updateAvailability.bind(this)}>
<FormattedMessage {...messages.update} />
</Button>
</div>
)
}
} |
src/plot/series/bar-series.js | Apercu/react-vis | // Copyright (c) 2016 - 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import React from 'react';
import PropTypes from 'prop-types';
import Animation from 'animation';
import {ANIMATED_SERIES_PROPS, getStackParams} from 'utils/series-utils';
import AbstractSeries from './abstract-series';
const predefinedClassName = 'rv-xy-plot__series rv-xy-plot__series--bar';
class BarSeries extends AbstractSeries {
static get propTypes() {
return {
... AbstractSeries.propTypes,
linePosAttr: PropTypes.string,
valuePosAttr: PropTypes.string,
lineSizeAttr: PropTypes.string,
valueSizeAttr: PropTypes.string,
cluster: PropTypes.string
};
}
render() {
const {
animation,
className,
data,
linePosAttr,
lineSizeAttr,
marginLeft,
marginTop,
style,
valuePosAttr,
valueSizeAttr
} = this.props;
if (!data) {
return null;
}
if (animation) {
return (
<Animation {...this.props} animatedProps={ANIMATED_SERIES_PROPS}>
<BarSeries {...this.props} animation={null}/>
</Animation>
);
}
const {sameTypeTotal, sameTypeIndex} = getStackParams(this.props);
const distance = this._getScaleDistance(linePosAttr);
const lineFunctor = this._getAttributeFunctor(linePosAttr);
const valueFunctor = this._getAttributeFunctor(valuePosAttr);
const value0Functor = this._getAttr0Functor(valuePosAttr);
const fillFunctor = this._getAttributeFunctor('fill') ||
this._getAttributeFunctor('color');
const strokeFunctor = this._getAttributeFunctor('stroke') ||
this._getAttributeFunctor('color');
const opacityFunctor = this._getAttributeFunctor('opacity');
const itemSize = (distance / 2) * 0.85;
return (
<g className={`${predefinedClassName} ${className}`}
ref="container"
transform={`translate(${marginLeft},${marginTop})`}>
{data.map((d, i) => {
const attrs = {
style: {
opacity: opacityFunctor && opacityFunctor(d),
stroke: strokeFunctor && strokeFunctor(d),
fill: fillFunctor && fillFunctor(d),
...style
},
[linePosAttr]: lineFunctor(d) - itemSize +
(itemSize * 2 / sameTypeTotal * sameTypeIndex),
[lineSizeAttr]: itemSize * 2 / sameTypeTotal,
[valuePosAttr]: Math.min(value0Functor(d), valueFunctor(d)),
[valueSizeAttr]: Math.abs(-value0Functor(d) + valueFunctor(d)),
onClick: e => this._valueClickHandler(d, e),
onContextMenu: e => this._valueRightClickHandler(d, e),
onMouseOver: e => this._valueMouseOverHandler(d, e),
onMouseOut: e => this._valueMouseOutHandler(d, e),
key: i
};
return (<rect {...attrs} />);
})}
</g>
);
}
}
BarSeries.displayName = 'BarSeries';
export default BarSeries;
|
src/components/FlexItem.js | bhargav175/react-layouts | /**
* Flex Item
*/
import React from 'react';
export default class FlexItem extends React.Component{
render(){
let {style,flexVal} = this.props;
let defaultStyle = {
flex : flexVal || '1'
}
style = Object.assign({},defaultStyle,style || {});
return <div style={style} className="flex-box__flex-item">{this.props.children}</div>; }
}; |
test/fixtures/react/pureComponent-react-fragment/actual.js | davesnx/babel-plugin-transform-react-qa-classes | import React from 'react';
class PureComponentName extends React.PureComponent {
render() {
return <React.Fragment>
<h1>Hello world</h1>
</React.Fragment>;
}
}
export default PureComponentName;
|
public/app/components/player/play-button.js | feedm3/unhypem | /**
* @author Fabian Dietenberger
*/
'use strict';
import React from 'react';
import songDispatcher from '../../dispatcher/song-dispatcher';
import ACTION from '../../constants/action';
import SONG_STATE from '../../constants/song-state';
import SvgIcon from '../common/svg-icon';
export default class PlayButton extends React.Component {
constructor(props) {
super(props);
this.state = {
songState: SONG_STATE.PAUSED
};
}
handleClick() {
switch (this.state.songState) {
case SONG_STATE.PAUSED:
songDispatcher.dispatch(ACTION.PLAY);
break;
case SONG_STATE.PLAYING:
songDispatcher.dispatch(ACTION.PAUSE);
break;
}
}
handleCurrentSongUpdate(songInfo) {
this.setState({
songState: songInfo.state
});
}
shouldComponentUpdate(nextProps, nextState) {
return this.state.songState !== nextState.songState;
}
render() {
let playOrPauseIcon = 'ic_play_circle_filled_black_24px';
let playIconClass = 'clr-primary';
if (this.state.songState === SONG_STATE.PLAYING) {
playOrPauseIcon = 'ic_pause_circle_filled_black_24px';
playIconClass = '';
}
return (
<SvgIcon
id={playOrPauseIcon}
title='Play'
width='48'
height='48'
className={playIconClass}
onClick={() => this.handleClick() }/>
);
}
componentDidMount() {
songDispatcher.registerOnCurrentSongUpdate('PlayButton', this.handleCurrentSongUpdate.bind(this));
}
}
|
app/config/routes.js | betofigueiredo/base-jump-logbook | import React from 'react';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { Provider } from 'react-redux';
import store, { history } from '../store';
// Import Components
import App from '../components/App';
import Jumps from '../components/Jumps';
import Jump from '../components/Jump';
import NewJump from '../components/NewJump';
const routes = (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Jumps}></IndexRoute>
<Route path="/jumps" component={Jumps}></Route>
<Route path="/jump/:jumpNumber" component={Jump}></Route>
<Route path="/new/jump" component={NewJump}></Route>
</Route>
</Router>
</Provider>
);
// <Route path="/new/location" component={NewLocation}></Route>
export default routes;
|
src/components/Home/Home.js | danagilliann/travel_log | import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Home.scss';
import Login from '../Login';
class Home extends React.Component {
constructor(props) {
super();
}
render() {
return (
<div>
<Login />
<p>If you don't have an account, register here</p>
</div>
)
}
}
export default withStyles(Home, s);
|
RNApp/app/routes/Home/HomeContainer.js | abhaytalreja/react-native-telescope | import React from 'react';
import Home from './Home';
import Routes from '../../config/routes';
const HomeContainer = (props) => {
return (
<Home
onDetailsPress={() => props.navigator.push(Routes.getDetailsRoute())}
/>
);
};
HomeContainer.propTypes = {
navigator: React.PropTypes.object,
};
export default HomeContainer;
|
src/components/Call.react.js | EaglesoftZJ/iGem_Web | /*
* Copyright (C) 2015-2016 Actor LLC. <https://actor.im>
*/
import React, { Component } from 'react';
import { shouldComponentUpdate } from 'react-addons-pure-render-mixin';
import { Container } from 'flux/utils';
import { PeerTypes } from '../constants/ActorAppConstants';
import PeerUtils from '../utils/PeerUtils';
import CallActionCreators from '../actions/CallActionCreators';
import CallStore from '../stores/CallStore';
import DialogStore from '../stores/DialogStore';
import UserStore from '../stores/UserStore';
import GroupStore from '../stores/GroupStore';
import CallBody from './call/CallBody.react';
import CallControls from './call/CallControls.react';
import ContactDetails from './common/ContactDetails.react';
class Call extends Component {
static getStores() {
return [CallStore, DialogStore];
}
static calculatePeerInfo(peer) {
if (peer) {
if (peer.type === PeerTypes.USER) {
return UserStore.getUser(peer.id);
}
if (peer.type === PeerTypes.GROUP) {
return GroupStore.getGroup(peer.id);
}
}
return null;
}
static calculateState() {
const call = CallStore.getState();
if (!call.isOpen || call.isFloating) {
return { isOpen: false };
}
const dialogPeer = DialogStore.getCurrentPeer();
const isSameDialog = PeerUtils.equals(dialogPeer, call.peer);
if (!isSameDialog) {
return { isOpen: false };
}
return {
call,
isOpen: true,
peerInfo: Call.calculatePeerInfo(call.peer)
};
}
constructor(props) {
super(props);
this.onAnswer = this.onAnswer.bind(this);
this.onEnd = this.onEnd.bind(this);
this.onMuteToggle = this.onMuteToggle.bind(this);
this.onClose = this.onClose.bind(this);
this.onFullscreen = this.onFullscreen.bind(this);
this.onUserAdd = this.onUserAdd.bind(this);
this.onVideo = this.onVideo.bind(this);
this.shouldComponentUpdate = shouldComponentUpdate.bind(this);
}
onAnswer() {
CallActionCreators.answerCall(this.state.call.id);
}
onEnd() {
CallActionCreators.endCall(this.state.call.id);
}
onMuteToggle() {
CallActionCreators.toggleCallMute(this.state.call.id);
}
onClose() {
CallActionCreators.hide();
}
onFullscreen() {
console.debug('onFullscreen');
}
onUserAdd() {
console.debug('onUserAdd');
}
onVideo() {
console.debug('onVideo');
}
renderContactInfo() {
const { call, peerInfo } = this.state;
if (!peerInfo || call.peer.type === PeerTypes.GROUP) return null;
return (
<section className="call__info">
<ContactDetails peerInfo={peerInfo}/>
</section>
)
}
render() {
const { isOpen, call, peerInfo } = this.state;
if (!isOpen) {
return <section className="activity" />;
}
return (
<section className="activity activity--shown">
<div className="activity__body call">
<section className="call__container">
<CallBody peerInfo={peerInfo} callState={call.state}/>
<CallControls
callState={call.state}
isOutgoing={call.isOutgoing}
isMuted={call.isMuted}
onEnd={this.onEnd}
onAnswer={this.onAnswer}
onMuteToggle={this.onMuteToggle}
onFullscreen={this.onFullscreen}
onUserAdd={this.onUserAdd}
onVideo={this.onVideo}
onClose={this.onClose}
/>
</section>
{this.renderContactInfo()}
</div>
</section>
);
}
}
export default Container.create(Call);
|
node_modules/react-bootstrap/es/ModalFooter.js | FoxMessenger/nyt-react | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import elementType from 'react-prop-types/lib/elementType';
import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
var propTypes = {
componentClass: elementType
};
var defaultProps = {
componentClass: 'div'
};
var ModalFooter = function (_React$Component) {
_inherits(ModalFooter, _React$Component);
function ModalFooter() {
_classCallCheck(this, ModalFooter);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
ModalFooter.prototype.render = function render() {
var _props = this.props,
Component = _props.componentClass,
className = _props.className,
props = _objectWithoutProperties(_props, ['componentClass', 'className']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var classes = getClassSet(bsProps);
return React.createElement(Component, _extends({}, elementProps, {
className: classNames(className, classes)
}));
};
return ModalFooter;
}(React.Component);
ModalFooter.propTypes = propTypes;
ModalFooter.defaultProps = defaultProps;
export default bsClass('modal-footer', ModalFooter); |
packages/material-ui-icons/src/AlarmAdd.js | cherniavskii/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<g><path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-11h-2v3H8v2h3v3h2v-3h3v-2h-3V9z" /></g>
, 'AlarmAdd');
|
src/components/SchedulePage/MeetingPanel/MeetingEditor/MeetingEditor.js | deltaidea/planning-app | import React, { Component } from 'react';
import classNames from 'classnames';
import { parseDate } from '../../../../redux/calendar';
import BleedContainer from '../../../BleedContainer';
import { ContentPanel, PanelHeader, PanelContent } from '../../../ContentPanel';
import { PrimaryButton, SecondaryButton, IconButton } from '../../../Button';
import './MeetingEditor.css';
import cancelIcon from './cancel.png';
export default class MeetingEditor extends Component {
getReadableDate() {
return parseDate(this.props.date).format('MMMM DD');
}
getParticipantName(id) {
if (id == null) return '';
return this.props.possibleParticipants.find(x => x.id === id).name;
}
getParticipantId(name) {
const p = this.props.possibleParticipants.find(x => x.name === name);
return p ? p.id : null
}
goToMeetingList() {
this.props.history.push(`/meetings/${this.props.date}`);
}
changeParticipant(name) {
const isValid = this.getParticipantId(name) !== null;
this.props.changeValues({
participant: name,
isValidParticipant: isValid
});
}
changeDescription(description) {
const isValid = description.trim() !== '';
this.props.changeValues({
description,
isValidDescription: isValid
});
}
save() {
let allValid = true;
if (this.getParticipantId(this.props.currentParticipant) === null) {
this.props.changeValues({ isValidParticipant: false });
allValid = false;
}
if (this.props.currentDescription.trim() === '') {
this.props.changeValues({ isValidDescription: false });
allValid = false;
}
if (allValid) {
this.props.onSave(
this.props.currentDescription,
this.getParticipantId(this.props.currentParticipant)
);
this.goToMeetingList();
}
}
componentWillMount() {
this.props.changeValues({
description: this.props.description || '',
participant: this.getParticipantName(this.props.participantId),
isValidDescription: true,
isValidParticipant: true
});
}
render() {
return (
<BleedContainer className="meeting-editor">
<ContentPanel>
<PanelHeader>
<span>{this.props.isNew ? 'New' : 'Edit'} meeting on {this.getReadableDate()}</span>
<IconButton onClick={() => this.goToMeetingList()} src={cancelIcon} alt="Cancel"/>
</PanelHeader>
<PanelContent>
<label>
<div>Participant</div>
<input
type="text"
value={this.props.currentParticipant}
onChange={event => this.changeParticipant(event.target.value)}
className={classNames({
invalid: !this.props.isValidParticipant
})}
/>
<div className="error-message">{this.props.isValidParticipant ? '' : 'Participant is required'}</div>
</label>
<label>
<div>Description</div>
<textarea
rows="3"
value={this.props.currentDescription}
onChange={event => this.changeDescription(event.target.value)}
className={classNames({
invalid: !this.props.isValidDescription
})}
></textarea>
<div className="error-message">{this.props.isValidDescription ? '' : 'Description is required'}</div>
</label>
<div className="form-buttons">
<SecondaryButton onClick={() => this.goToMeetingList()}>Cancel</SecondaryButton>
<PrimaryButton onClick={() => this.save()}>Save</PrimaryButton>
</div>
</PanelContent>
</ContentPanel>
</BleedContainer>
);
}
}
|
local-cli/generator/templates/index.android.js | mrspeaker/react-native | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
class <%= name %> extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('<%= name %>', () => <%= name %>);
|
modules/gui/src/app/home/body/process/saveRecipe.js | openforis/sepal | import {Form, form} from 'widget/form/form'
import {Layout} from 'widget/layout'
import {Panel} from 'widget/panel/panel'
import {activatable} from 'widget/activation/activatable'
import {closeRecipe} from './recipe'
import {compose} from 'compose'
import {msg} from 'translate'
import {saveRecipe} from './recipe'
import React from 'react'
import styles from './saveRecipe.module.css'
const fields = {
name: new Form.Field()
.notBlank('process.saveRecipe.form.name.required'),
}
const mapStateToProps = (state, ownProps) => ({
values: {
name: ownProps.activatable.recipe.placeholder
}
})
class SaveRecipe extends React.Component {
saveRecipe() {
const {inputs: {name}, activatable} = this.props
const title = name.value.replace(/[^\w-.]/g, '_')
this.saveUpdatedRecipe({...activatable.recipe, title})
}
saveUpdatedRecipe(recipe) {
const {onSave, activatable} = this.props
saveRecipe(recipe)
onSave && onSave(recipe)
activatable.deactivate()
if (activatable.closeTabOnSave) {
closeRecipe(recipe.id)
}
}
renderPanel() {
const {form, inputs: {name}, activatable} = this.props
const save = () => this.saveRecipe()
const cancel = () => activatable.deactivate()
return <React.Fragment>
<Panel.Content>
<Layout>
<Form.Input
label={msg('process.saveRecipe.form.name.label')}
autoFocus
input={name}
errorMessage
/>
</Layout>
</Panel.Content>
<Panel.Buttons onEnter={save} onEscape={cancel}>
<Panel.Buttons.Main>
<Panel.Buttons.Cancel onClick={cancel}/>
<Panel.Buttons.Save
disabled={form.isInvalid()}
onClick={save}/>
</Panel.Buttons.Main>
</Panel.Buttons>
</React.Fragment>
}
render() {
const {form} = this.props
return (
<Form.Panel
className={styles.panel}
form={form}
isActionForm={true}
modal>
<Panel.Header
icon='save'
title={msg('process.saveRecipe.title')}/>
{this.renderPanel()}
</Form.Panel>
)
}
}
SaveRecipe.propTypes = {}
const policy = () => ({
_: 'allow'
})
export default compose(
SaveRecipe,
form({fields, mapStateToProps}),
activatable({id: 'saveRecipeDialog', policy})
)
|
src/js/components/icons/base/Upload.js | odedre/grommet-final | /**
* @description Upload SVG Icon.
* @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon.
* @property {string} colorIndex - The color identifier to use for the stroke color.
* If not specified, this component will default to muiTheme.palette.textColor.
* @property {xsmall|small|medium|large|xlarge|huge} size - The icon size. Defaults to small.
* @property {boolean} responsive - Allows you to redefine what the coordinates.
* @example
* <svg width="24" height="24" ><path d="M1,17 L1,23 L23,23 L23,17 M12,2 L12,19 M5,9 L12,2 L19,9"/></svg>
*/
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import CSSClassnames from '../../../utils/CSSClassnames';
import Intl from '../../../utils/Intl';
import Props from '../../../utils/Props';
const CLASS_ROOT = CSSClassnames.CONTROL_ICON;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class Icon extends Component {
render () {
const { className, colorIndex } = this.props;
let { a11yTitle, size, responsive } = this.props;
let { intl } = this.context;
const classes = classnames(
CLASS_ROOT,
`${CLASS_ROOT}-upload`,
className,
{
[`${CLASS_ROOT}--${size}`]: size,
[`${CLASS_ROOT}--responsive`]: responsive,
[`${COLOR_INDEX}-${colorIndex}`]: colorIndex
}
);
a11yTitle = a11yTitle || Intl.getMessage(intl, 'upload');
const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));
return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M1,17 L1,23 L23,23 L23,17 M12,2 L12,19 M5,9 L12,2 L19,9"/></svg>;
}
};
Icon.contextTypes = {
intl: PropTypes.object
};
Icon.defaultProps = {
responsive: true
};
Icon.displayName = 'Upload';
Icon.icon = true;
Icon.propTypes = {
a11yTitle: PropTypes.string,
colorIndex: PropTypes.string,
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),
responsive: PropTypes.bool
};
|
20161210/RN-test/src01/index.android-02.js | fengnovo/react-native | import React, { Component } from 'react';
import { Text, View, TouchableHighlight, StyleSheet, AppRegistry } from 'react-native';
import { createMemoryHistory, Router, IndexRoute, Route } from 'react-router';
import { createNavigatorRouter } from 'react-native-navigator-router';
class Home extends Component {
static contextTypes = {
router: React.PropTypes.object.isRequired,
};
static defaultProps() {
return {
key: 'home',
};
}
componentDidMount() {
console.log('Main mount');
}
componentWillUnmount() {
console.log('Main unmount');
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={() => this.context.router.push('/about')}>
<Text style={styles.welcome}>
This is Home, go to About.
</Text>
</TouchableHighlight>
</View>
);
}
}
class About extends Component {
static contextTypes = {
router: React.PropTypes.object.isRequired,
};
static defaultProps() {
return {
key: 'about',
};
}
componentDidMount() {
console.log('About mount');
}
componentWillUnmount() {
console.log('About unmount');
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={() => this.context.router.push('/detail')}>
<Text style={styles.welcome}>
This is About, go to detail.
</Text>
</TouchableHighlight>
<TouchableHighlight onPress={() => this.context.router.goBack()}>
<Text style={styles.welcome}>
Press here to go back home.
</Text>
</TouchableHighlight>
</View>
);
}
}
class Detail extends Component {
static contextTypes = {
router: React.PropTypes.object.isRequired,
};
static defaultProps() {
return {
key: 'detail',
};
}
componentDidMount() {
console.log('About detail');
}
componentWillUnmount() {
console.log('About detail');
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={() => this.context.router.go(-2)}>
<Text style={styles.welcome}>
This is detail, Press here to go back home.
</Text>
</TouchableHighlight>
</View>
);
}
}
class RNTest extends Component {
render() {
return (
<Router history={createMemoryHistory('/')}>
<Route path='/' component={createNavigatorRouter()}>
<IndexRoute component={Home} />
<Route path="/about" component={About} />
<Route path="/detail" component={Detail} />
</Route>
</Router>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
// export default App;
AppRegistry.registerComponent('RNTest', () => RNTest); |
src/components/antd/progress/progress.js | hyd378008136/olymComponents | var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
import PropTypes from 'prop-types';
import React from 'react';
import Icon from '../icon';
import { Circle } from 'rc-progress';
import classNames from 'classnames';
const statusColorMap = {
normal: '#108ee9',
exception: '#ff5500',
success: '#87d068',
};
export default class Progress extends React.Component {
render() {
const props = this.props;
const { prefixCls, className, percent = 0, status, format, trailColor, type, strokeWidth, width, showInfo, gapDegree = 0, gapPosition } = props, restProps = __rest(props, ["prefixCls", "className", "percent", "status", "format", "trailColor", "type", "strokeWidth", "width", "showInfo", "gapDegree", "gapPosition"]);
const progressStatus = parseInt(percent.toString(), 10) >= 100 && !('status' in props) ?
'success' : (status || 'normal');
let progressInfo;
let progress;
const textFormatter = format || (percentNumber => `${percentNumber}%`);
if (showInfo) {
let text;
const iconType = (type === 'circle' || type === 'dashboard') ? '' : '-circle';
if (progressStatus === 'exception') {
text = format ? textFormatter(percent) : React.createElement(Icon, { type: `cross${iconType}` });
}
else if (progressStatus === 'success') {
text = format ? textFormatter(percent) : React.createElement(Icon, { type: `check${iconType}` });
}
else {
text = textFormatter(percent);
}
progressInfo = React.createElement("span", { className: `${prefixCls}-text` }, text);
}
if (type === 'line') {
const percentStyle = {
width: `${percent}%`,
height: strokeWidth || 10,
};
progress = (React.createElement("div", null,
React.createElement("div", { className: `${prefixCls}-outer` },
React.createElement("div", { className: `${prefixCls}-inner` },
React.createElement("div", { className: `${prefixCls}-bg`, style: percentStyle }))),
progressInfo));
}
else if (type === 'circle' || type === 'dashboard') {
const circleSize = width || 132;
const circleStyle = {
width: circleSize,
height: circleSize,
fontSize: circleSize * 0.16 + 6,
};
const circleWidth = strokeWidth || 6;
const gapPos = gapPosition || type === 'dashboard' && 'bottom' || 'top';
const gapDeg = gapDegree || type === 'dashboard' && 75;
progress = (React.createElement("div", { className: `${prefixCls}-inner`, style: circleStyle },
React.createElement(Circle, { percent: percent, strokeWidth: circleWidth, trailWidth: circleWidth, strokeColor: statusColorMap[progressStatus], trailColor: trailColor, prefixCls: prefixCls, gapDegree: gapDeg, gapPosition: gapPos }),
progressInfo));
}
const classString = classNames(prefixCls, {
[`${prefixCls}-${type === 'dashboard' && 'circle' || type}`]: true,
[`${prefixCls}-status-${progressStatus}`]: true,
[`${prefixCls}-show-info`]: showInfo,
}, className);
return (React.createElement("div", Object.assign({}, restProps, { className: classString }), progress));
}
}
Progress.defaultProps = {
type: 'line',
percent: 0,
showInfo: true,
trailColor: '#f3f3f3',
prefixCls: 'ant-progress',
};
Progress.propTypes = {
status: PropTypes.oneOf(['normal', 'exception', 'active', 'success']),
type: PropTypes.oneOf(['line', 'circle', 'dashboard']),
showInfo: PropTypes.bool,
percent: PropTypes.number,
width: PropTypes.number,
strokeWidth: PropTypes.number,
trailColor: PropTypes.string,
format: PropTypes.func,
gapDegree: PropTypes.number,
};
|
packages/utils/src/client.js | jcua1/numenta-web | // Numenta Web Platform and Sites source code
// MIT License (see LICENSE.txt)
// Copyright © 2005—2017 Numenta <http://numenta.com>
import browserSize from 'browser-size'
import root from 'window-or-global'
import url from 'url'
import React from 'react'
import {prefixLink} from 'gatsby-helpers'
/**
* Utils for the Clientside
*/
/**
* Get current width of browser via DOM API, default to 640px.
* @returns {Number} - Width of browser in pixels or default.
*/
export function getBrowserWidth() {
const min = 640
if (global.window) {
const {width} = browserSize()
return width || min
}
return min
}
/**
* Check if browser has SessionStorage feature.
* @returns {Boolean} - True for SessionStorage in browser, False if not.
*/
export function hasSessionStorage() {
const {sessionStorage} = root
const mod = '_'
try {
sessionStorage.setItem(mod, mod)
sessionStorage.removeItem(mod)
return true
}
catch (error) {
return false
}
}
/**
* Scroll to same height on browser screen as DOM element via DOM API.
* @param {Object} element - Scroll to top of this element vertically.
* @param {Number} [pad=-60] - Extra padding for precision, default -60 for
* static header component.
*/
export function scrollToSection(element, pad = -60) {
const {scroll, setTimeout} = root
if (element && 'getBoundingClientRect' in element) {
const {top} = element.getBoundingClientRect()
if (top) {
setTimeout(() => scroll(0, top + pad), 0)
}
}
}
/**
* Send GoogleAnalytics custom event triggers.
* @param {String} href - Target URL event for tracking in GAnalytics
* @requires react-g-analytics (or equivalent)
*/
export function triggerGAnalyticsEvent(href) {
if (!href) return
const {ga} = root
const uri = url.parse(href)
// g-analytics universal tracking (non-pageview)
if (uri.protocol === 'mailto:') {
// mailto links
const email = uri.href.match(/^mailto:(.*?)$/)[1]
ga('send', 'event', 'Mailto', email)
}
else if (uri.hostname === 'numenta.com' || !uri.hostname) {
// internal asset links
const ext = uri.pathname.split(/\./).pop()
if (ext === 'pdf') {
ga('send', 'event', 'Download', ext, uri.href)
}
}
else {
// external link
ga('send', 'event', 'Outbound', uri.host, uri.path)
}
}
/**
* Collect metadata tags
* @param {Object} data The object to collect meta data from.
* The fields 'title', 'description' and 'meta' are used.
* @param {String} baseUrl Optional Base URL to use
* @param {String} overrides Optional values to override objects meta data
* @return {Array} Array of <meta> tags
*/
export function getMetadataTags(data, baseUrl, overrides) {
const path = baseUrl ? baseUrl + data.path : data.path
const twitterImg = prefixLink(data.image ? path + data.image
: '/assets/img/logo.png')
const metaDict = Object.assign({
title: data.title,
keywords: data.keywords,
description: data.description || data.header || data.title,
'twitter:image': twitterImg,
'twitter:title': data.title,
'twitter:description': data.description || data.header || data.title,
}, data.meta, overrides)
/* eslint-disable */
return Object.entries(metaDict)
.map((meta, idx) => React.createElement('meta', {
key: idx, name: meta[0], content: meta[1]}))
}
|
js/jqwidgets/demos/react/app/scheduler/contextmenu/app.js | luissancheza/sice | import React from 'react';
import ReactDOM from 'react-dom';
import JqxScheduler from '../../../jqwidgets-react/react_jqxscheduler.js';
class App extends React.Component {
componentDidMount() {
this.refs.myScheduler.ensureAppointmentVisible('id1');
}
render() {
let appointments = new Array();
let appointment1 = {
id: 'id1',
description: 'George brings projector for presentations.',
location: '',
subject: 'Quarterly Project Review Meeting',
calendar: 'Room 1',
start: new Date(2016, 10, 23, 9, 0, 0),
end: new Date(2016, 10, 23, 16, 0, 0)
}
let appointment2 = {
id: 'id2',
description: '',
location: '',
subject: 'IT Group Mtg.',
calendar: 'Room 2',
start: new Date(2016, 10, 24, 10, 0, 0),
end: new Date(2016, 10, 24, 15, 0, 0)
}
let appointment3 = {
id: 'id3',
description: '',
location: '',
subject: 'Course Social Media',
calendar: 'Room 3',
start: new Date(2016, 10, 27, 11, 0, 0),
end: new Date(2016, 10, 27, 13, 0, 0)
}
let appointment4 = {
id: 'id4',
description: '',
location: '',
subject: 'New Projects Planning',
calendar: 'Room 2',
start: new Date(2016, 10, 23, 16, 0, 0),
end: new Date(2016, 10, 23, 18, 0, 0)
}
let appointment5 = {
id: 'id5',
description: '',
location: '',
subject: 'Interview with James',
calendar: 'Room 1',
start: new Date(2016, 10, 25, 15, 0, 0),
end: new Date(2016, 10, 25, 17, 0, 0)
}
let appointment6 = {
id: 'id6',
description: '',
location: '',
subject: 'Interview with Nancy',
calendar: 'Room 4',
start: new Date(2016, 10, 26, 14, 0, 0),
end: new Date(2016, 10, 26, 16, 0, 0)
}
appointments.push(appointment1);
appointments.push(appointment2);
appointments.push(appointment3);
appointments.push(appointment4);
appointments.push(appointment5);
appointments.push(appointment6);
// prepare the data
let source =
{
dataType: 'array',
dataFields: [
{ name: 'id', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'location', type: 'string' },
{ name: 'subject', type: 'string' },
{ name: 'calendar', type: 'string' },
{ name: 'start', type: 'date' },
{ name: 'end', type: 'date' }
],
id: 'id',
localData: appointments
};
let adapter = new $.jqx.dataAdapter(source);
let resources =
{
colorScheme: 'scheme02',
dataField: 'calendar',
source: new $.jqx.dataAdapter(source)
};
let appointmentDataFields =
{
from: 'start',
to: 'end',
id: 'id',
description: 'description',
location: 'place',
subject: 'subject',
resourceId: 'calendar'
};
let views =
[
'dayView',
'weekView',
'monthView'
];
/**
* called when the context menu is created.
* @param {Object} menu - jqxMenu's jQuery object.
* @param {Object} settings - Object with the menu's initialization settings.
*/
let contextMenuCreate = (menu, settings) => {
var source = settings.source;
source.push({ id: 'delete', label: 'Delete Appointment' });
source.push({
id: 'status', label: 'Set Status', items:
[
{ label: 'Free', id: 'free' },
{ label: 'Out of Office', id: 'outOfOffice' },
{ label: 'Tentative', id: 'tentative' },
{ label: 'Busy', id: 'busy' }
]
});
};
/**
* called when the user clicks an item in the Context Menu. Returning true as a result disables the built-in Click handler.
* @param {Object} menu - jqxMenu's jQuery object.
* @param {Object} the selected appointment instance or NULL when the menu is opened from cells selection.
* @param {jQuery.Event Object} the jqxMenu's itemclick event object.
*/
let contextMenuItemClick = (menu, appointment, event) => {
var args = event.args;
switch (args.id) {
case 'delete':
this.refs.myScheduler.deleteAppointment(appointment.id);
return true;
case 'free':
this.refs.myScheduler.setAppointmentProperty(appointment.id, 'status', 'free');
return true;
case 'outOfOffice':
this.refs.myScheduler.setAppointmentProperty(appointment.id, 'status', 'outOfOffice');
return true;
case 'tentative':
this.refs.myScheduler.setAppointmentProperty(appointment.id, 'status', 'tentative');
return true;
case 'busy':
this.refs.myScheduler.setAppointmentProperty(appointment.id, 'status', 'busy');
return true;
}
};
/**
* called when the menu is opened.
* @param {Object} menu - jqxMenu's jQuery object.
* @param {Object} the selected appointment instance or NULL when the menu is opened from cells selection.
* @param {jQuery.Event Object} the open event.
*/
let contextMenuOpen = (menu, appointment, event) => {
if (!appointment) {
menu.jqxMenu('hideItem', 'delete');
menu.jqxMenu('hideItem', 'status');
}
else {
menu.jqxMenu('showItem', 'delete');
menu.jqxMenu('showItem', 'status');
}
};
/**
* called when the menu is closed.
* @param {Object} menu - jqxMenu's jQuery object.
* @param {Object} the selected appointment instance or NULL when the menu is opened from cells selection.
* @param {jQuery.Event Object} the close event.
*/
let contextMenuClose = () => {
};
return (
<JqxScheduler ref='myScheduler'
date={new $.jqx.date(2016, 11, 23)}
width={850}
height={600}
source={adapter}
view={1}
showLegend={true}
contextMenuCreate={contextMenuCreate}
contextMenuItemClick={contextMenuItemClick}
contextMenuOpen={contextMenuOpen}
contextMenuClose={contextMenuClose}
resources={resources}
views={views}
appointmentDataFields={appointmentDataFields}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
src/client/containers/HeroesListContainer.js | alexandrebodin/graphql-heroes-app | import React from 'react';
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
import HeroesList from '../components/HeroesList';
const HeroesListContainer = ({ data, onHeroClick }) => {
if (data.loading || data.error)
return (
<p style={{ color: 'white', textAlign: 'center' }}> Loading heroes... </p>
);
return <HeroesList heroes={data.heroes} onHeroClick={onHeroClick} />;
};
const heroesQuery = gql`
query FilterHeroes($search: String) {
heroes(search: $search) {
id
alias
picture
}
}
`;
export default graphql(heroesQuery, {
options: ({ search }) => ({ search })
})(HeroesListContainer);
|
src/pages/linny.js | vitorbarbosa19/ziro-online | import React from 'react'
import BrandGallery from '../components/BrandGallery'
export default () => (
<BrandGallery brand='Linny' />
)
|
src/svg-icons/action/stars.js | mtsandeep/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionStars = (props) => (
<SvgIcon {...props}>
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"/>
</SvgIcon>
);
ActionStars = pure(ActionStars);
ActionStars.displayName = 'ActionStars';
ActionStars.muiName = 'SvgIcon';
export default ActionStars;
|
admin/client/index.js | webteckie/keystone | /**
* This is the main entry file, which we compile the main JS bundle from. It
* only contains the client side routing setup.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, browserHistory, IndexRoute } from 'react-router';
import { Provider } from 'react-redux';
import { syncHistoryWithStore } from 'react-router-redux';
import App from './App';
import Home from './App/screens/Home';
import Item from './App/screens/Item';
import List from './App/screens/List';
import store from './App/store';
// Sync the browser history to the Redux store
const history = syncHistoryWithStore(browserHistory, store);
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path={Keystone.adminPath} component={App}>
<IndexRoute component={Home} />
<Route path=":listId" component={List} />
<Route path=":listId/:itemId" component={Item} />
</Route>
</Router>
</Provider>,
document.getElementById('react-root')
);
|
src/modules/notfound/index.js | mtrabelsi/universal-javascript-boilerplate | import React from 'react'
export default React.createClass({
render() {
return <div>Page not Found!</div>
}
})
|
components/AppView.js | sdumetz/sam | import React from 'react';
import AppIcon from './AppIcon';
import AppTitle from './AppTitle';
export default class AppView extends React.Component{
constructor(props){
super(props)
}
render() {
var divStyle={
width:"25%",
margin: 2,
cursor:"pointer"
}
if(this.props.active){
divStyle.backgroundColor = "#bbb";
divStyle.boxShadow= "3px 3px 3px #444";
}
return (
<div style={divStyle} className='appview' onClick={this.props.onClick}>
<AppIcon file={this.props.entry["Icon"]} active={this.props.active}/>
<AppTitle title={this.props.entry["Name"]} active={this.props.active}>{this.props.entry["Description"]}</AppTitle>
</div>
);
}
};
|
website/modules/examples/Basic.js | d-oliveros/react-router | import React from 'react'
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom'
const BasicExample = () => (
<Router>
<div>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/about">About</Link></li>
<li><Link to="/topics">Topics</Link></li>
</ul>
<hr/>
<Route exact path="/" component={Home}/>
<Route path="/about" component={About}/>
<Route path="/topics" component={Topics}/>
</div>
</Router>
)
const Home = () => (
<div>
<h2>Home</h2>
</div>
)
const About = () => (
<div>
<h2>About</h2>
</div>
)
const Topics = ({ match }) => (
<div>
<h2>Topics</h2>
<ul>
<li>
<Link to={`${match.url}/rendering`}>
Rendering with React
</Link>
</li>
<li>
<Link to={`${match.url}/components`}>
Components
</Link>
</li>
<li>
<Link to={`${match.url}/props-v-state`}>
Props v. State
</Link>
</li>
</ul>
<Route path={`${match.url}/:topicId`} component={Topic}/>
<Route exact path={match.url} render={() => (
<h3>Please select a topic.</h3>
)}/>
</div>
)
const Topic = ({ match }) => (
<div>
<h3>{match.params.topicId}</h3>
</div>
)
export default BasicExample
|
examples/with-scss-options/src/client.js | jaredpalmer/razzle | import React from 'react';
import { hydrate } from 'react-dom';
import App from './App';
hydrate(<App />, document.getElementById('root'));
if (module.hot) {
module.hot.accept();
}
|
src/user/LoginPage.js | whitescape/react-admin-components | import React from 'react'
import PageMeta from '../pages/PageMeta'
import LoginForm from './LoginForm'
export default React.createClass({
render() {
return <PageMeta title="Вход">
<div style={{ margin: '0 auto', width: 400 }}>
<h1>Вход</h1>
<div style={{ padding: 20 }} className="mdl-shadow--2dp">
<LoginForm />
</div>
</div>
</PageMeta>
}
})
|
webclient/src/about/AboutView.js | jadiego/bloom | import React, { Component } from 'react';
import { Header, Container, Segment, Image, Grid, Menu, Divider } from 'semantic-ui-react';
import ScrollToTop from '../components/ScrollToTop';
import { NavLink } from 'react-router-dom';
import './About.css';
import { Route } from 'react-router-dom';
import lotus from '../img/lotus.svg';
import About from './About';
import Privacy from './Privacy';
import Tos from './Tos';
class AboutView extends Component {
render() {
return (
<Container className="aboutcontainer">
<ScrollToTop />
<Grid>
<Grid.Column width={4} stretched>
<Menu fluid vertical tabular style={{ marginTop: "10vh" }}>
<Menu.Item as={NavLink} to='/about' name='About' />
<Menu.Item as={NavLink} to='/tos' name='Terms of Service' />
<Menu.Item as={NavLink} to='/privacy' name='Privacy Policy' />
</Menu>
</Grid.Column>
<Grid.Column stretched width={12}>
<Route exact strict path="/about" component={About} />
<Route exact path="/tos" component={Tos} />
<Route exact path="/privacy" component={Privacy} />
</Grid.Column>
</Grid>
</Container>
);
}
}
export default AboutView |
src/App.js | kmark1625/Game-of-Life | import React, { Component } from 'react';
import './App.css';
import Game from './components/game';
class App extends Component {
render() {
return (
<div className="App">
<h2>The Game of Life</h2>
<Game></Game>
</div>
);
}
}
export default App;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.