path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
docs/app/Examples/collections/Menu/States/index.js | mohammed88/Semantic-UI-React | import React from 'react'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
const States = () => {
return (
<ExampleSection title='States'>
<ComponentExample
title='Hover'
description='A menu item can be hovered.'
examplePath='collections/Menu/States/MenuExampleHover'
/>
<ComponentExample
title='Active'
description='A menu item can be active.'
examplePath='collections/Menu/States/MenuExampleActive'
/>
</ExampleSection>
)
}
export default States
|
definitions/npm/redux-form_v5.x.x/test_redux-form_v5.js | gaborsar/flow-typed | /** @flow */
import { reduxForm, reducer } from 'redux-form';
import type { InputProps } from 'redux-form';
import React from 'react';
const Input = (props: InputProps) => {
(props.onChange: (v: string) => mixed);
(props.onChange: (v: SyntheticEvent) => mixed);
(props.onUpdate: (v: string) => mixed);
(props.onUpdate: (v: SyntheticEvent) => mixed);
(props.onBlur: (v: string) => mixed);
(props.onBlur: (v: SyntheticEvent) => mixed);
// $ExpectError
(props.onChange: (v: number) => mixed);
// $ExpectError
(props.onUpdate: (v: number) => void);
// $ExpectError
(props.onBlur: (v: number) => void);
(props.onDragStart: Function);
(props.onDrop: Function);
(props.onFocus: Function);
// $ExpectError
(props.onDragStart: void);
// $ExpectError
(props.onDrop: void);
// $ExpectError
(props.onFocus: void);
return (
<input {...props}/>
)
}
const form = (): React$Element<any> => (
<form name="name">
<input name="foobar" />
</form>
);
const connected: typeof React.Component = reduxForm({
form: 'name',
fields: ['foobar']
})(form);
// $ExpectError
reduxForm({})(React.Component);
// $ExpectError
reducer({}, null)
|
src/components/video_list.js | immunity20/Youtube-Search-App | import React from 'react';
import VideoListItem from './video_list_item';
const VideoList = (props) => {
const videoItems = props.videos.map((video) => {
return (
<VideoListItem
onVideoSelect={props.onVideoSelect}
key={video.etag}
video={video}
/>
);
});
return (
<ul className="col-md-4 list-group">
{videoItems}
</ul>
);
};
export default VideoList;
|
src/components/common/CardSection.js | dougsleite/talk2go | import React from 'react';
import { View } from 'react-native';
const CardSection = (props) => {
return (
<View style={[styles.containerStyle, props.style]}>
{props.children}
</View>
);
};
const styles = {
containerStyle: {
borderBottomWidth: 1,
padding: 5,
backgroundColor: '#fff',
justifyContent: 'flex-start',
flexDirection: 'row',
borderColor: '#ddd',
position: 'relative'
}
};
export { CardSection };
|
src/components/Test/index.js | scimusmn/app-template | import React from 'react';
function Test() {
return <h1>TESTING</h1>;
}
export default Test;
|
client/app/components/Settings.js | jfanderson/KIM | import React from 'react';
import s from '../services/settingsService.js';
import sign from '../services/sign.js';
import ContractorSettings from './Settings.Contractors.js';
import VendorSettings from './Settings.Vendors.js';
import TypeSettings from './Settings.Types.js';
class Settings extends React.Component {
constructor() {
super();
this.state = {
isPieceTypeFormOpen: false,
isMaterialTypeFormOpen: false,
laborCost: 0,
materialTypeRemoveMode: false,
materialTypes: [],
pieceTypeRemoveMode: false,
pieceTypes: []
};
}
//-----------------------------------
// LIFECYCLE
//-----------------------------------
componentDidMount() {
s.getSettings().then(settings => {
this.setState({ laborCost: settings.laborCost });
}).catch(() => {
sign.setError('Failed to retrieve settings. Try refreshing.');
});
}
//-----------------------------------
// RENDERING
//-----------------------------------
render() {
let state = this.state;
return (
<div className="content settings">
<div className="container-50">
<div>
<h2>Labor Cost</h2>
<input className="labor-cost" type="text" value={state.laborCost} onChange={this._handleLaborCostChange.bind(this)} />
<button className="save" type="button" onClick={this._handleLaborCostButtonClick.bind(this)}>Save</button>
</div>
<ContractorSettings />
<VendorSettings />
<TypeSettings type="piece" />
<TypeSettings type="material" />
</div>
</div>
);
}
//-----------------------------------
// PRIVATE METHODS
//-----------------------------------
_handleLaborCostButtonClick() {
s.modifyLaborCost(this.state.laborCost).then(() => {
sign.setMessage('Labor cost saved.');
}).catch(() => {
sign.setError('Failed to save labor cost.');
});
}
_handleLaborCostChange(event) {
this.setState({ laborCost: event.target.value });
}
}
export default Settings;
|
src/routes/dashboard/components/completed.js | zhangjingge/sse-antd-admin | import React from 'react'
import PropTypes from 'prop-types'
import styles from './completed.less'
import classnames from 'classnames'
import { color } from '../../../utils'
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'
function Completed ({ data }) {
return (
<div className={styles.sales}>
<div className={styles.title}>TEAM TOTAL COMPLETED</div>
<ResponsiveContainer minHeight={360}>
<AreaChart data={data}>
<Legend verticalAlign="top"
content={prop => {
const { payload } = prop
return (<ul className={classnames({ [styles.legend]: true, clearfix: true })}>
{payload.map((item, key) => <li key={key}><span className={styles.radiusdot} style={{ background: item.color }} />{item.value}</li>)}
</ul>)
}}
/>
<XAxis dataKey="name" axisLine={{ stroke: color.borderBase, strokeWidth: 1 }} tickLine={false} />
<YAxis axisLine={false} tickLine={false} />
<CartesianGrid vertical={false} stroke={color.borderBase} strokeDasharray="3 3" />
<Tooltip
wrapperStyle={{ border: 'none', boxShadow: '4px 4px 40px rgba(0, 0, 0, 0.05)' }}
content={content => {
const list = content.payload.map((item, key) => <li key={key} className={styles.tipitem}><span className={styles.radiusdot} style={{ background: item.color }} />{`${item.name}:${item.value}`}</li>)
return <div className={styles.tooltip}><p className={styles.tiptitle}>{content.label}</p><ul>{list}</ul></div>
}}
/>
<Area type="monotone" dataKey="Task complete" stroke={color.grass} fill={color.grass} strokeWidth={2} dot={{ fill: '#fff' }} activeDot={{ r: 5, fill: '#fff', stroke: color.green }} />
<Area type="monotone" dataKey="Cards Complete" stroke={color.sky} fill={color.sky} strokeWidth={2} dot={{ fill: '#fff' }} activeDot={{ r: 5, fill: '#fff', stroke: color.blue }} />
</AreaChart>
</ResponsiveContainer>
</div>
)
}
Completed.propTypes = {
data: PropTypes.array,
}
export default Completed
|
website/src/app.js | CrisDan1905/text-mask | import './styles.scss'
import React from 'react'
import ReactDOM from 'react-dom'
import MaskedInput from '../../react/src/reactTextMask'
import classnames from 'classnames'
import appStyles from './app.scss'
import choices from './choices'
import {Row, DemoTop, DemoBottom, OnOffSwitch} from './partials'
import {connect} from 'react-redux'
import {actionCreators, selectors} from './redux'
import HelpPanel from './helpPanel'
const App = React.createClass({
componentDidUpdate() {
if (this.props.shouldFocusMaskedInput) {
this.focusMaskedInput()
}
},
render() {
const {props} = this
return (
<div className={classnames(appStyles.mainContainer, 'container')}>
<DemoTop/>
<div>
<form className='form-horizontal'>
<Row name='Masked input' value='maskedInput' noHelpLink>
<MaskedInput
value={props.value}
style={props.textMaskComponentStyle}
key={props.textMaskComponentUniqueKey}
placeholder={props.placeholder}
placeholderChar={props.placeholderChar}
pipe={props.pipe}
keepCharPositions={props.keepCharPositions}
ref='maskedInput'
mask={props.mask}
guide={props.guide}
onChange={({target: {value}}) => props.setValue(value)}
className='form-control'
id='maskedInput'
/>
</Row>
{props.rejectionMessage && (
<Row><p className='alert alert-warning' style={{margin: 0}}>{props.rejectionMessage}</p></Row>
)}
<Row name='Mask' value='mask'>
<select
className='form-control'
value={props.name}
onChange={({target: {value}}) => props.populateFromChoice(value)}
ref='maskSelect'
>
{choices.map((choice, index) => <option key={index} value={choice.name}>{choice.name}</option>)}
</select>
<input
style={{
display: (props.isMaskFunction) ? 'none' : null,
marginTop: 12,
fontFamily: 'monospace',
cursor: 'default'
}}
ref='mask'
type='text'
disabled
onChange={({target: {value: mask}}) => props.setMask(mask)}
value={convertMaskForDisplay(props.mask)}
className='form-control'
id='mask'
/>
</Row>
<HelpPanel/>
<Row name='Guide' value='guide' small>
<OnOffSwitch
name='guide'
value={props.guide}
onChange={(value) => props.setGuide(value)}
/>
</Row>
<Row name='Keep character positions' value='keepcharpositions' small>
<OnOffSwitch
name='keepCharPositions'
value={props.keepCharPositions}
onChange={(value) => props.setKeepCharPositions(value)}
/>
</Row>
<Row name='Placeholder character' value='placeholderchar'>
<select
id='placeholderChar'
className='form-control'
value={props.placeholderChar}
onChange={({target: {value: placeholderChar}}) => props.setPlaceholderChar(placeholderChar)}
>
<option value={'\u2000'}>\u2000 (white space)</option>
<option value='_'>_ (underscore)</option>
</select>
</Row>
</form>
<hr/>
<DemoBottom/>
</div>
</div>
)
},
focusMaskedInput() {
const {refs: {maskedInput}} = this
ReactDOM.findDOMNode(maskedInput).focus()
}
})
export default connect(
(state) => ({
...state,
textMaskComponentStyle: selectors.getTextMaskComponentStyle(state),
textMaskComponentUniqueKey: selectors.getTextMaskComponentUniqueKey(state),
isMaskFunction: selectors.isMaskFunction(state)
}),
actionCreators
)(App)
function convertMaskForDisplay(mask) {
let displayMask = mask
.toString()
.split(',')
.map((element) => {
return (element[0] === '/' && element.length > 1) ? element : `'${element}'`
})
.join(', ')
return `[${displayMask}]`
}
|
packages/vx-glyph/src/glyphs/Diamond.js | Flaque/vx | import React from 'react';
import cx from 'classnames';
import { symbol, symbolDiamond } from 'd3-shape';
import Glyph from './Glyph';
import additionalProps from '../util/additionalProps';
export default function GlyphDiamond({
children,
className,
top,
left,
size,
...restProps
}) {
const path = symbol();
path.type(symbolDiamond);
if (size) path.size(size);
return (
<Glyph top={top} left={left}>
<path
className={cx('vx-glyph-diamond', className)}
d={path()}
{...additionalProps(restProps)}
/>
{children}
</Glyph>
);
}
|
examples/react-redux/src/components/navigator/NavigatorItem.js | rangle/redux-segment | import React from 'react';
const NavigatorItem = ({ children, isVisible = true, className = '' }) => {
const visibleClass = isVisible ? 'block' : 'hide';
return (
<div
className={ `${ visibleClass } ${ className }` }
style={ styles.base }>
{ children }
</div>
);
};
const styles = {
base: {},
};
export default NavigatorItem;
|
src/containers/Asians/_components/ViewLockedRound/Ballots/LargeBallots/index.js | westoncolemanl/tabbr-web | import React from 'react'
import { connect } from 'react-redux'
import Instance from './Instance'
export default connect(mapStateToProps)(({
round,
rooms
}) => {
const filterRooms = roomToMatch => roomToMatch.round === round._id
const roomsThisRound = rooms.filter(filterRooms)
return (
<div>
{roomsThisRound.sort((a, b) => a.rank - b.rank).map(room =>
<Instance
key={room._id}
room={room}
/>
)}
</div>
)
})
function mapStateToProps (state, ownProps) {
return {
rooms: Object.values(state.rooms.data)
}
}
|
ui/js/pages/library/LibrarySectionEdit.js | ericsoderberg/pbc-web |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { loadCategory, unloadCategory } from '../../actions';
import FormField from '../../components/FormField';
import FormState from '../../utils/FormState';
import SectionEdit from '../../components/SectionEdit';
class LibrarySectionEdit extends Component {
constructor(props) {
super(props);
const { section, onChange } = props;
this.state = { formState: new FormState(section, onChange) };
}
componentDidMount() {
const { dispatch } = this.props;
dispatch(loadCategory('libraries', { sort: 'name' }));
}
componentWillReceiveProps(nextProps) {
this.setState({
formState: new FormState(nextProps.section, nextProps.onChange),
});
}
componentWillUnmount() {
const { dispatch } = this.props;
dispatch(unloadCategory('libraries'));
}
render() {
const { libraries } = this.props;
const { formState } = this.state;
const section = formState.object;
const options = libraries.map(library => (
<option key={library._id} label={library.name} value={library._id} />
));
let value = '';
if (section.libraryId) {
if (typeof section.libraryId === 'string') {
value = section.libraryId;
} else {
value = section.libraryId._id;
}
}
return (
<SectionEdit formState={formState}>
<FormField label="Library">
<select name="libraryId"
value={value}
onChange={formState.change('libraryId')}>
{options}
</select>
</FormField>
</SectionEdit>
);
}
}
LibrarySectionEdit.propTypes = {
dispatch: PropTypes.func.isRequired,
libraries: PropTypes.array,
onChange: PropTypes.func.isRequired,
section: PropTypes.object.isRequired,
};
LibrarySectionEdit.defaultProps = {
libraries: [],
};
const select = state => ({
libraries: (state.libraries || {}).items || [],
});
export default connect(select)(LibrarySectionEdit);
|
src/components/AddButton.js | fwonkas/minecraft-enchanted-item-generator | import React, { Component } from 'react';
class AddButton extends Component {
render() {
const { onClick } = this.props;
return <button onClick={ onClick }>+</button>;
}
}
export default AddButton;
|
src/components/App/AppComponent.js | bibleexchange/be-front-new | import React from 'react'
import { Route, Link } from 'react-router'
import MainNavigation from '../Navbar/NavbarComponent'
import Footer from './FooterComponent'
import UserMessage from './UserMessage'
import {
createFragmentContainer,
graphql,
} from 'react-relay/compat'
import auth from './auth'
import LoginUserMutation from '../../mutations/Session/Create'
import SignUpUserMutation from '../../mutations/User/Create'
import NoteUpdateMutation from '../..//mutations/Note/Update'
import NoteCreateMutation from '../../mutations/Note/Create'
import NoteDestroyMutation from '../../mutations/Note/Destroy'
import CourseCreateMutation from '../../mutations/Course/Create'
import CourseUpdateMutation from '../../mutations/Course/Update'
import CourseDestroyMutation from '../../mutations/Course/Destroy'
import LessonCreateMutation from '../../mutations/Lesson/Create'
import LessonUpdateMutation from '../../mutations/Lesson/Update'
import LessonDestroyMutation from '../../mutations/Lesson/Destroy'
import Dock from '../Dock/Dock'
import Audio from '../Audio/AudioIndex'
import Bible from '../Bible/BibleComponent'
import CourseLesson from '../Course/CourseLesson'
import CourseEditor from '../CourseEditor/CourseEditor'
import LessonEditor from '../LessonEditor/LessonEditor'
import CoursePrint from '../Course/CoursePrint'
import CourseIndex from '../Course/CourseIndex'
import Dashboard from '../Dashboard/Dashboard'
import NotesIndex from '../Note/NotesIndex'
import Library from '../Course/CoursesIndex'
import NotePageComponent from '../Note/NotePageComponent'
import NotePrintComponent from '../Note/NotePrintPageComponent'
import './App.scss'
import './Print.scss'
import './Typography.scss'
class App extends React.Component {
constructor(props) {
super(props);
let onLine = false;
if (navigator.onLine && this.props.viewer.error.code !== 500) {
onLine = true;
} else {
onLine = false;
}
let token = false
if(auth.getToken() !== undefined){token = auth.getToken()}
let user = this.props.viewer.user ? this.props.viewer.user : { name: 'Guest' }
let dockStatus = {
main: false,
login: true,
signup: false,
soundcloud: false,
notepad: false,
share: false,
verse: false,
notes: false,
bookmark: false
}
let notesfilter = '';
let notesCurrentPage = 1;
if (this.props.viewer.notes !== undefined && this.props.viewer.notes.currentPage !== undefined) {
notesCurrentPage = this.props.viewer.notes.currentPage;
}
let lang = "eng"
if(localStorage.getItem('language') !== null){
lang = localStorage.getItem('language')
}
let navs = []
if(localStorage.getItem('navs') !== null && localStorage.getItem('navs') !== ""){
navs = this.uniques(JSON.parse(localStorage.getItem('navs')))
}
localStorage.setItem('navs', navs)
this.state = {
oembed: {},
online: onLine,
email:null,
password:null,
user: user,
language: lang,
signup: {},
player: {
playStatus: false,
currentSoundId: null
},
dockStatus: dockStatus,
bibleStatus: 'both',
error: this.props.viewer.error,
token: token,
myNotesWidget: {
// TODO props.relay.* APIs do not exist on compat containers
filter: this.props.relay.variables.myNotesFilter,
status: null
},
notesWidget: {
showModal: false,
// TODO props.relay.* APIs do not exist on compat containers
filter: this.props.relay.variables.noteFilter,
notesCurrentPage: notesCurrentPage,
status: null
},
coursesWidget: {
// TODO props.relay.* APIs do not exist on compat containers
filter: this.props.relay.variables.coursesFilter,
status: null
},
navs: navs
};
}
componentWillMount() {
if(this.props.params.reference !== undefined && this.props.params.reference !== null ){
this.handleUpdateReferenceForAll(this.props.params.reference);
}
if(this.props.params.userCourseId !== undefined && this.props.params.userCourseId !== null ){
this.handleUpdateUserCourse(this.props.params.userCourseId);
}
if(this.props.params.userLessonId !== undefined && this.props.params.userLessonId !== null ){
this.handleUpdateUserLesson(this.props.params.userLessonId);
}
if(this.props.params.noteId !== undefined && this.props.params.noteId !== null ){
this.handleLoadThisNote(this.props.params.noteId);
}
if(this.props.params.courseId !== undefined && this.props.params.courseId !== null){
this.handleUpdateCourse(this.props.params.courseId)
}
if(this.props.params.lessonCursor !== undefined ){
this.handleUpdateLesson(this.props.params.lessonCursor)
}
}
componentWillReceiveProps(newProps) {
let newState = this.state
if (navigator.onLine && this.props.viewer.error.code !== 500 ) {
newState. online = true
} else {
newState. online = false
}
if(newProps.viewer.user !== undefined && newProps.viewer.user.authenticated === true && this.props.viewer.user.authenticated === false){
newState.dockStatus.login = true
newState.dockStatus.signup = false
}
if (JSON.stringify(this.props.viewer.user) !== JSON.stringify(newProps.viewer.user)) {
newState.user = newProps.viewer.user;
}
if(newProps.params.reference !== this.props.params.reference && newProps.params.reference !== undefined){
this.handleUpdateReferenceForAll(newProps.params.reference)
}
if(newProps.params.noteId !== this.props.params.noteId && newProps.params.noteId !== undefined){
this.handleLoadThisNote(newProps.params.noteId)
}
if (JSON.stringify(this.state) !== JSON.stringify(newState)) {
this.setState(newState)
}
if(newProps.params.courseId !== this.props.params.courseId && newProps.params.courseId !== undefined){
this.handleUpdateCourse(newProps.params.courseId)
}
if(newProps.params.userCourseId !== undefined && newProps.params.userCourseId !== this.props.params.userCourseId ){
this.handleUpdateUserCourse(newProps.params.userCourseId);
}
if(newProps.params.userLessonId !== undefined && this.props.params.userLessonId !== newProps.params.userLessonId ){
this.handleUpdateUserLesson(newProps.params.userLessonId);
}
if(newProps.params.lessonCursor !== undefined && this.props.params.lessonCursor !== newProps.params.lessonCursor ){
this.handleUpdateLesson(newProps.params.lessonCursor);
}
}
render() {
let user = this.state.user;
let navs = this.state.navs
let children = null;
localStorage.setItem('navs', JSON.stringify(navs));
if (this.props.children !== null) {
children = React.cloneElement(this.props.children, { online: this.state.online });
}
let dock = null
if(this.state.dockStatus.main) {
dock = <section id="dock-section">
<Dock
status={this.state.dockStatus}
player={this.state.player}
handleCloseAudio={this.handleCloseAudio.bind(this)}
user={user}
notes={this.props.viewer.notes? this.props.viewer.notes:null}
handleUpdateNote={this.handleUpdateNote.bind(this)}
online={this.state.online}
handleEditThisNote={this.handleEditThisNote.bind(this)}
note = {this.props.viewer.note? this.props.viewer.note:null}
showInDockMenu={this.showInDockMenu.bind(this)}
location={this.props.location}
notesWidget={this.state.notesWidget}
bibleVerse={this.props.viewer.bibleVerse? this.props.viewer.bibleVerse:null}
crossReferences={this.props.viewer.crossReferences? this.props.viewer.crossReferences:null}
handleUpdateNoteFilter = {this.handleUpdateNoteFilter.bind(this)}
handleNextNotePage={this.handleNextNotePage.bind(this)}
/>
</section>
}
return (
<div className='container'>
<MainNavigation
location={this.props.location}
updateIt={this.state}
route={this.props.route}
user={user}
online={this.state.online}
handleOpenCloseDock = {this.handleOpenCloseDock.bind(this)}
dockStatus={this.state.dockStatus.main}
message={this.state.error.message}
/>
<div className="sections">
{dock}
<section>
<main>
{React.cloneElement(children, {
key: this.props.location.pathname,
handlePlayAudio: this.handlePlayAudio.bind(this),
handleEditThisNote: this.handleEditThisNote.bind(this),
viewer: this.props.viewer,
bibles: this.props.viewer.bibles,
courses: this.props.viewer.courses,
course: this.props.viewer.course,
note: this.props.viewer.note,
notes: this.props.viewer.notes,
verses: this.props.viewer.search? this.props.viewer.search.verses:null,
user: user,
handleChangeReference: this.handleChangeReference.bind(this),
handleUpdateReferenceForAll: this.handleUpdateReferenceForAll.bind(this),
handleChangeNoteFilter: this.handleChangeNoteFilter.bind(this),
bibleChapter: this.props.viewer.bibleChapter? this.props.viewer.bibleChapter:null,
bibleStatus: this.state.bibleStatus,
handleToggleBible: this.handleToggleBible.bind(this),
language: this.state.languge,
handleLogout: this.handleLogout.bind(this),
handleLogin: this.handleLogin.bind(this),
UpdateLoginEmail: this.UpdateLoginEmail.bind(this),
UpdateLoginPassword: this.UpdateLoginPassword.bind(this),
handleLoginStatus: this.handleLoginStatus.bind(this),
handleSignUp: this.handleSignUp.bind(this),
handleEditSignUpEmail: this.handleEditSignUpEmail.bind(this),
handleEditSignUpPassword: this.handleEditSignUpPassword.bind(this),
handleEditSignUpPasswordConfirm: this.handleEditSignUpPasswordConfirm.bind(this),
handleLogout: this.handleLogout.bind(this),
handleSignUpStatus: this.handleSignUpStatus.bind(this),
signup: this.state.signup,
toggleLogin: this.toggleLogin.bind(this),
status: this.state.dockStatus,
handleUpdateNoteFilter: this.handleUpdateNoteFilter.bind(this),
handleNextNotePage: this.handleNextNotePage.bind(this),
handleApplyNoteFilter: this.handleApplyNoteFilter.bind(this),
handleNotesAreReady: this.notesAreReady.bind(this),
coursesWidget: this.state.coursesWidget,
handleUpdateCoursesFilter:this.handleUpdateCoursesFilter.bind(this),
handleNextCoursesPage: this.handleNextCoursesPage.bind(this),
handleLanguage: this.handleLanguage.bind(this),
// TODO props.relay.* APIs do not exist on compat containers
reference: this.props.relay.variables.reference? this.props.relay.variables.reference:"",
handleSearchBibleReference: this.handleSearchBibleReference.bind(this),
handleMoreSearch: this.handleMoreSearch.bind(this),
notesWidget: this.state.notesWidget,
myNotesWidget: this.state.myNotesWidget,
userNotes: this.props.viewer.userNotes? this.props.viewer.userNotes:null,
userNote: this.props.viewer.userNote? this.props.viewer.userNote:null,
handleUpdateMyNoteFilter: this.handleUpdateMyNoteFilter.bind(this),
handleMoreMyNotes: this.handleMoreMyNotes.bind(this),
userCourse: this.props.viewer.userCourse? this.props.viewer.userCourse:null,
userCourses: this.props.viewer.userCourses? this.props.viewer.userCourses:null,
handleMoreMyCourses: this.handleMoreMyCourses.bind(this),
handleUpdateMyCoursesFilter: this.handleUpdateMyCoursesFilter.bind(this),
handleMyCourseMutation: this.handleMyCourseMutation.bind(this),
handleMyLessonMutation: this.handleMyLessonMutation.bind(this),
userLesson: this.props.viewer.userLesson,
handleBookmark: this.handleBookmark.bind(this),
deleteBookmark: this.deleteNav.bind(this),
bookmarks: navs
})}
</main>
</section>
</div>
<UserMessage error={this.state.error} />
<footer id='footer' className='push'><Footer user={user} /></footer>
</div>
);
}
handleChangeNote(event) {
event.preventDefault();
console.log('change note please...');
let inputs = event.target.getElementsByTagName('input');
let data = [];
let i = 0;
while (i < inputs.length) {
let x = { key: inputs[i].getAttribute('name'), value: inputs[i].getAttribute('value') };
data.push(x);
i++;
}
}
handleLogout(redirectURL) {
console.log('Logging user out...');
let that = this;
this.setState({
user:{},
error: {message:"You are Logged out!", code:200}
})
auth.logout();
if(redirectURL !== "undefined"){
this.props.history.push(redirectURL)
}
}
handleLogin(e) {
let that = this
var onSuccess = (Login) => {
let error = {}
let tokenCreate = Login.tokenCreate
let token = tokenCreate.token? tokenCreate.token:"";
console.log('Mutation completed!', Login);
if(tokenCreate.code === "200" || tokenCreate.code === 200 || tokenCreate.code === null){
error = { message: 'Login Successful', code: 200 };
auth.login(token);
that.setState({
error: error,
token: token,
user: tokenCreate.user
});
}else{
console.log(tokenCreate)
that.setState({
error: { message: tokenCreate.message, code: tokenCreate.code }
});
}
};
var onFailure = (transaction) => {
var error = transaction.getError() || new Error('Mutation failed.');
console.error(error);
};
let details = {
email: this.state.email,
password: this.state.password
};
Relay.Store.commitUpdate(
new LoginUserMutation({ input: details, viewer: this.props.viewer }), { onFailure, onSuccess }
)
}
handleSignUp(e) {
var onSuccess = (Login) => {
console.log('Mutation successful!', Login, ' Stored token: ', Login.signUpUser.user.token);
localStorage.setItem('be_token', Login.signUpUser.user.token);
this.setState({ token: Login.signUpUser.user.token });
auth.login();
this.setState({ signup: {} });
console.log('Signup and Login Successful!');
};
var onFailure = (transaction) => {
var error = transaction.getError() || new Error('Sign Up failed.');
console.error('Signup failed', error);
};
let details = {
email: this.state.signup.email,
password: this.state.signup.password
};
Relay.Store.commitUpdate(
new SignUpUserMutation({ input: details, user: this.props.viewer.user }), { onFailure, onSuccess }
);
}
UpdateLoginEmail(e) {
this.state.email = e.target.value;
}
UpdateLoginPassword(e) {
this.state.password = e.target.value;
}
handleEditSignUpEmail(e) {
let newSignup = this.state.signup;
console.log(e.target.value);
newSignup.email = e.target.value;
this.setState({ signup: newSignup });
}
handleEditSignUpPassword(e) {
let newSignup = this.state.signup;
newSignup.password = e.target.value;
this.setState({ signup: newSignup });
}
handleEditSignUpPasswordConfirm(e) {
let newSignup = this.state.signup;
newSignup.password_confirmation = e.target.value;
if (e.target.value !== this.state.signup.password) {
newSignup.message = 'passwords do not match :(';
} else {
newSignup.message = 'passwords match :)';
}
this.setState({ signup: newSignup });
}
uniques(array) {
return Array.from(new Set(array));
}
handleBookmark(e) {
e.preventDefault();
if (this.props.location.pathname !== null) {
console.log("book mark it ...")
let navs = []
if (this.state.navs !== null) {
navs = this.state.navs;
}
navs.unshift(this.props.location.pathname);
localStorage.setItem('navs', JSON.stringify(navs));
let newState = this.state
newState.error = { message: 'Bookmark saved! ' + this.props.location.pathname, code: 221 }
newState.navs = navs
this.setState(newState)
}
}
deleteNav(e){
let index = e.target.dataset.id
let newState = this.state
newState.navs.splice(index,1)
this.setState(newState)
localStorage.setItem('navs', JSON.stringify(newState.navs));
}
handlePlayAudio(e){
console.log("new sound selected...")
this.setState({ player: { dockStatus: true, playStatus: true, currentSoundId: e.target.dataset.id}})
}
handleCloseAudio(){
this.setState({ player: { playStatus: false, currentSoundId: null}})
}
handleOpenCloseDock(e){
let nState = this.state
nState.dockStatus.main = !nState.dockStatus.main
this.setState(nState)
}
handleEditThisNote(e){
e.preventDefault()
console.log("editing: " + e.target.dataset.id)
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
noteId: e.target.dataset.id
});
}
handleLoginStatus() {
let status = this.state.loginStatus;
this.setState({ loginStatus: !status, signUpStatus: false });
}
handleSignUpStatus() {
let status = this.state.signUpStatus;
this.setState({ signUpStatus: !status, closed: true });
}
handleMoreMyNotes(e){
e.preventDefault()
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
// TODO props.relay.* APIs do not exist on compat containers
myNotesPageSize: this.props.relay.variables.myNotesPageSize + 15
});
let newState = this.state
this.setState(newState);
}
handleUpdateNote(note) {
this.setState({status: 'saving'});
if (note.id === "newNoteEdge" || note.id === "") {
console.log('creating note...')
Relay.Store.commitUpdate(new NoteCreateMutation({
newNoteEdge: note,
notes: this.props.viewer.user.notes
}));
} else {
console.log('updating note...', note)
Relay.Store.commitUpdate(new NoteUpdateMutation({
changedNote: note,
note: this.props.viewer.note
}));
}
}
handleLoadThisNote(noteId){
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
noteId: noteId
});
}
toggleLogin() {
let s = this.state
s.dockStatus.login = !s.dockStatus.login
s.dockStatus.signup = !s.dockStatus.signup
this.setState(s)
}
showInDockMenu(e){
let s = this.state
let name = e.target.dataset.name
if(name === "login"){
if(s.dockStatus.login === false && s.dockStatus.signup === false){
s.dockStatus['login'] = true
s.dockStatus['signup'] = false
}else if(s.login === true && s.signup === false){
s.dockStatus['login'] = false
s.dockStatus['signup'] = false
}else{
s.dockStatus['login'] = false
s.dockStatus['signup']= false
}
}else{
s.dockStatus[name] = !s.dockStatus[name]
}
this.setState(s)
}
handleChangeNoteFilter(e){
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
noteFilter: e.target.dataset.reference
});
let s = this.state
s.notesWidget.filter = e.target.dataset.reference
this.setState(s)
}
handleToggleBible(e) {
let n = this.state
n.bibleStatus = !this.state.bibleStatus
this.setState(n);
}
handleUpdateNoteFilter(string) {
if (string !== undefined) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
noteFilter: string.toLowerCase(),
notesStartCursor: null
});
let s = this.state
s.notesWidget.status = null
s.notesWidget.filter = string.toLowerCase()
s.notesWidget.notesCurrentPage = 1
this.setState(s);
}
}
handleUpdateMyNoteFilter(e) {
let string = e.target.value
if (string !== undefined) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
myNotesFilter: string.toLowerCase(),
myNotesStartCursor: undefined
});
let s = this.state
s.myNotesWidget.status = null
s.myNotesWidget.notesCurrentPage = 1
s.myNotesWidget.filter = string.toLowerCase()
this.setState(s);
}
}
notesAreReady(e){
let s = this.state
s.notesWidget.status = null
this.setState(s)
}
handleApplyNoteFilter(e) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
noteFilter: this.state.notesWidget.filter? this.state.notesWidget.filter.toLowerCase():"",
notesStartCursor: undefined
});
let s = this.state
s.notesWidget.status = null
s.notesWidget.notesCurrentPage = 1
this.setState(s);
}
handleNextNotePage() {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
notesStartCursor: this.props.viewer.notes.pageInfo.endCursor
});
let newState = this.state
newState.notesWidget.notesCurrentPage = this.state.notesWidget.notesCurrentPage + 1
this.setState(newState);
}
handleApplyCoursesFilter(e) {
e.preventDefault()
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
coursesFilter: this.state.coursesWidget.filter,
coursesCursor: undefined
});
}
handleUpdateCoursesFilter(string) {
let newState = this.state
newState.coursesWidget.filter = string
this.setState(newState)
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
coursesFilter: string,
coursesCursor: undefined
});
}
handleUpdateCourse(courseId) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
courseId: courseId
});
}
handleUpdateUserLesson(lessonId) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
userLessonId: lessonId
});
}
handleUpdateLesson(lessonCursor) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
lessonCursor: lessonCursor
});
}
handleNextCoursesPage(e) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
coursesCursor: this.props.viewer.courses.pageInfo.endCursor
});
}
handleLanguage(lang){
localStorage.setItem('language',lang)
let s = this.state
s.languge = lang
this.setState(s)
}
handleSearchBibleReference(term) {
console.log('search submitted...');
this.setState({ search: term });
let url = term.replace(/\W+/g, '_');
this.props.history.push('/bible/' + url.toLowerCase());
}
handleChangeReference(e){
console.log('changing reference',e)
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
reference: e.target.dataset.reference
});
}
handleUpdateReferenceForAll(ref){
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
noteFilter: ref.toLowerCase(),
notesStartCursor: null,
reference: ref,
searchCursor:undefined
});
let s = this.state
s.notesWidget.status = null
s.notesWidget.notesCurrentPage = 1
s.notesWidget.filter = ref
this.setState(s);
}
handleMoreSearch(e) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
searchCursor: this.props.viewer.search.verses.pageInfo.endCursor
});
}
handleMoreMyCourses(e){
e.preventDefault()
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
// TODO props.relay.* APIs do not exist on compat containers
myCoursesPageSize: this.props.relay.variables.myCoursesPageSize + 15
});
}
handleUpdateMyCoursesFilter(e) {
let string = e.target.value
if (string !== undefined) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
myCoursesFilter: string.toLowerCase(),
myCoursesStartCursor: undefined
});
}
}
handleUpdateUserCourse(courseId) {
// TODO props.relay.* APIs do not exist on compat containers
// TODO needs manual handling
this.props.relay.setVariables({
userCourseId: courseId
});
}
handleMyCourseMutation(userCourse, action) {
let Mutation = null
switch(action) {
case "create":
console.log('creating course...')
Mutation = CourseCreateMutation
break;
case "update":
console.log('updating course...')
Mutation = CourseUpdateMutation
break;
case "destroy":
console.log('destroying course...')
Mutation = CourseDestroyMutation
break;
case "create_lesson":
console.log('creating lesson...')
Mutation = LessonCreateMutation
break;
default:
console.log("no actions matched a course mutation:(", action)
}
var onSuccess = (Course) => {
console.log('Mutation successful!', Course);
};
var onFailure = (transaction) => {
var error = transaction.getError() || new Error('Course Mutation failed.');
console.error('Course Mutation failed', error);
};
Relay.Store.commitUpdate(new Mutation({
userCourse: userCourse,
viewer: this.props.viewer
}), { onFailure, onSuccess });
}
handleMyLessonMutation(userLesson, action) {
let Mutation = null
switch(action) {
case "update":
console.log('updating lesson...')
Mutation = LessonUpdateMutation
break;
case "destroy":
console.log('destroying lesson...')
Mutation = LessonDestroyMutation
break;
default:
console.log("no actions matched a lesson mutation:(", action)
}
var onSuccess = (Lesson) => {
console.log('Mutation successful!', Lesson);
};
var onFailure = (transaction) => {
var error = transaction.getError() || new Error('Lesson Mutation failed.');
console.error('Lesson Mutation failed', error);
};
Relay.Store.commitUpdate(new Mutation({
userLesson: userLesson,
viewer: this.props.viewer
}), { onFailure, onSuccess });
}
}
App.contextTypes = {
router: React.PropTypes.object.isRequired
};
App.propTypes = {
children: React.PropTypes.object.isRequired,
viewer: React.PropTypes.object.isRequired
};
App.defaultProps = {
viewer: {}
}
/* TODO manually deal with:
initialVariables: {
noteId: undefined,
noteFilter: undefined,
reference: 'John 1',
notesStartCursor: undefined,
pageSize: 5,
bibleVersion: 'kjv',
versesPageSize: 200,
courseId: undefined,
coursesFilter: undefined,
coursesPageSize: 6,
coursesCursor:undefined,
crPageSize: 20,
myNotesFilter:null,
myNotesPageSize: 15,
myNotesStartCursor: undefined,
myCoursesFilter:null,
myCoursesPageSize: 15,
myCoursesStartCursor: undefined,
userCourseId: undefined,
userLessonId: undefined,
userNoteId: undefined,
searchLimit:10,
searchCursor:undefined,
lessonCursor: undefined
}
*/
export default createFragmentContainer(App, {
todo: graphql`
fragment App_note on Note (){
id
}
`,
viewer: graphql`
fragment App_viewer on Viewer {
token
error{message, code}
bibleChapter (filter: $reference){
...Bible_bibleChapter
}
bibleVerse (filter:$reference) {
...Dock_bibleVerse
}
note(id:$noteId){
...Dock_note
...NotePageComponent_note
...NotePrintComponent_note
}
crossReferences(first: $crPageSize, filter: $reference) {
...Dock_crossReferences
}
bibles (first:1, filter:$bibleVersion) {
...Bible_bibles
}
user{
...Audio_user
...Bible_user
...CourseLesson_user
...CourseIndex_user
...Dashboard_user
...Dock_user
...MainNavigation_user
...Footer_user
...NotesIndex_user
...NotePageComponent_user
...NotePrintComponent_user
id
authenticated
}
userCourse(id:$userCourseId){
...Dashboard_userCourse
}
userCourses(filter: $myCoursesFilter, first:$myCoursesPageSize, after:$myCoursesStartCursor){
...Dashboard_userCourses
pageInfo{startCursor}
}
userNote(id:$userNoteId){
id
}
userNotes(filter: $myNotesFilter, first:$myNotesPageSize, after:$myNotesStartCursor){
...Dashboard_userNotes
pageInfo{endCursor, startCursor}
}
userLesson (id:$userLessonId){
...Dashboard_userLesson
}
notes (filter: $noteFilter, first:$pageSize, after:$notesStartCursor){
...Dock_notes
...NotesIndex_notes
pageInfo{endCursor, startCursor}
}
course(id:$courseId){
...CouorseLesson_course
...CoursePrint_course
...CourseIndex_course
}
courses(filter:$coursesFilter, first:$coursesPageSize, after:$coursesCursor){
totalCount
pageInfo{endCursor, startCursor}
...Library_courses
}
search(filter: $reference){
verses(first:$searchLimit, after:$searchCursor){
pageInfo{endCursor, startCursor}
...Bible_verses
}
}
}
`,
}) |
src/message/MessageList.js | p0o/react-redux-firebase-chat | import React, { Component } from 'react';
import { retrieveMessage } from './messageActions';
export default class MessageList extends Component {
componentDidMount() {
this._firebaseRef = firebase.database().ref('messages');
this._firebaseRef.on('child_added', (snapshot) => {
const { uid, displayName, message } = snapshot.val();
this.props.dispatch( retrieveMessage({ uid, displayName, message }) );
});
}
render() {
const { messages } = this.props;
return (
<ul>
{ messages.map(msg => <li>{ msg.displayName + ': ' + msg.message }</li>)}
</ul>
);
}
componentWillUnmount() {
this._firebaseRef.off();
}
}
|
src/link_button.js | offenesdresden/annotieren | import React from 'react'
import Route from 'react-route'
import { RaisedButton, FlatButton, IconButton } from 'react-md/lib/Buttons'
/// Applies props.href but prevents loading of another document,
/// instead uses Route.go()
export class RaisedLinkButton extends React.Component {
render() {
return (
<RaisedButton {...this.props}
onClick={ev => this.handleClick(ev)}
/>
)
}
handleClick(ev) {
// Don't let the browser navigate away itself
ev.preventDefault()
if (this.props.onBeforeRoute) {
try {
this.props.onBeforeRoute()
} catch (e) {
console.error(e.stack)
}
}
Route.go(this.props.href)
}
}
|
admin/client/views/list.js | qwales1/keystone | 'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import classnames from 'classnames';
import CurrentListStore from '../stores/CurrentListStore';
import ConfirmationDialog from '../components/Forms/ConfirmationDialog';
import CreateForm from '../components/Forms/CreateForm';
import FlashMessages from '../components/FlashMessages';
import Footer from '../components/Footer';
import ItemsTable from '../components/ItemsTable/ItemsTable';
import ListColumnsForm from '../components/List/ListColumnsForm';
import ListDownloadForm from '../components/List/ListDownloadForm';
import ListFilters from '../components/List/ListFilters';
import ListFiltersAdd from '../components/List/ListFiltersAdd';
import ListSort from '../components/List/ListSort';
import MobileNavigation from '../components/Navigation/MobileNavigation';
import PrimaryNavigation from '../components/Navigation/PrimaryNavigation';
import SecondaryNavigation from '../components/Navigation/SecondaryNavigation';
import UpdateForm from '../components/Forms/UpdateForm';
import { BlankState, Button, Container, FormInput, InputGroup, Pagination, Spinner } from 'elemental';
import { plural } from '../utils';
const ListView = React.createClass({
getInitialState () {
return {
confirmationDialog: {
isOpen: false,
},
checkedItems: {},
constrainTableWidth: true,
manageMode: false,
searchString: '',
showCreateForm: window.location.search === '?create' || Keystone.createFormErrors,
showUpdateForm: false,
...this.getStateFromStore(),
};
},
componentDidMount () {
CurrentListStore.addChangeListener(this.updateStateFromStore);
},
componentWillUnmount () {
CurrentListStore.removeChangeListener(this.updateStateFromStore);
},
updateStateFromStore () {
this.setState(this.getStateFromStore());
},
getStateFromStore () {
var state = {
columns: CurrentListStore.getActiveColumns(),
currentPage: CurrentListStore.getCurrentPage(),
filters: CurrentListStore.getActiveFilters(),
items: CurrentListStore.getItems(),
list: CurrentListStore.getList(),
loading: CurrentListStore.isLoading(),
pageSize: CurrentListStore.getPageSize(),
ready: CurrentListStore.isReady(),
search: CurrentListStore.getActiveSearch(),
rowAlert: CurrentListStore.rowAlert(),
};
if (!this._searchTimeout) {
state.searchString = state.search;
}
state.showBlankState = (state.ready && !state.loading && !state.items.results.length && !state.search && !state.filters.length);
return state;
},
// ==============================
// HEADER
// ==============================
updateSearch (e) {
clearTimeout(this._searchTimeout);
this.setState({
searchString: e.target.value,
});
var delay = e.target.value.length > 1 ? 150 : 0;
this._searchTimeout = setTimeout(() => {
delete this._searchTimeout;
CurrentListStore.setActiveSearch(this.state.searchString);
}, delay);
},
handleSearchClear () {
CurrentListStore.setActiveSearch('');
this.setState({ searchString: '' });
ReactDOM.findDOMNode(this.refs.listSearchInput).focus();
},
handleSearchKey (e) {
// clear on esc
if (e.which === 27) {
this.handleSearchClear();
}
},
handlePageSelect (i) {
CurrentListStore.setCurrentPage(i);
},
toggleManageMode (filter = !this.state.manageMode) {
this.setState({
manageMode: filter,
checkedItems: {},
});
},
toggleUpdateModal (filter = !this.state.showUpdateForm) {
this.setState({
showUpdateForm: filter,
});
},
massUpdate () {
// TODO: Implement update multi-item
console.log('Update ALL the things!');
},
massDelete () {
const { checkedItems, list } = this.state;
const itemCount = plural(checkedItems, ('* ' + list.singular.toLowerCase()), ('* ' + list.plural.toLowerCase()));
const itemIds = Object.keys(checkedItems);
this.setState({
confirmationDialog: {
isOpen: true,
label: 'Delete',
body: `Are you sure you want to delete ${itemCount}?<br /><br />This cannot be undone.`,
onConfirmation: () => {
CurrentListStore.deleteItems(itemIds);
this.toggleManageMode();
this.removeConfirmationDialog();
},
},
});
},
handleManagementSelect (selection) {
if (selection === 'all') this.checkAllTableItems();
if (selection === 'none') this.uncheckAllTableItems();
if (selection === 'visible') this.checkAllTableItems();
return false;
},
renderSearch () {
var searchClearIcon = classnames('ListHeader__search__icon octicon', {
'is-search octicon-search': !this.state.searchString.length,
'is-clear octicon-x': this.state.searchString.length,
});
return (
<InputGroup.Section grow className="ListHeader__search">
<FormInput ref="listSearchInput" value={this.state.searchString} onChange={this.updateSearch} onKeyUp={this.handleSearchKey} placeholder="Search" className="ListHeader__searchbar-input" />
<button ref="listSearchClear" type="button" title="Clear search query" onClick={this.handleSearchClear} disabled={!this.state.searchString.length} className={searchClearIcon} />
</InputGroup.Section>
);
},
renderCreateButton () {
if (this.state.list.nocreate) return null;
var props = { type: 'success' };
if (this.state.list.autocreate) {
props.href = '?new' + Keystone.csrf.query;
} else {
props.onClick = () => this.toggleCreateModal(true);
}
return (
<InputGroup.Section className="ListHeader__create">
<Button {...props} title={'Create ' + this.state.list.singular}>
<span className="ListHeader__create__icon octicon octicon-plus" />
<span className="ListHeader__create__label">
Create
</span>
<span className="ListHeader__create__label--lg">
Create {this.state.list.singular}
</span>
</Button>
</InputGroup.Section>
);
},
renderConfirmationDialog () {
const props = this.state.confirmationDialog;
return (
<ConfirmationDialog
isOpen={props.isOpen}
body={props.body}
confirmationLabel={props.label}
onCancel={this.removeConfirmationDialog}
onConfirmation={props.onConfirmation}
/>
);
},
renderManagement () {
// WIP: Management mode currently under development, so the UI is disabled
// unless the KEYSTONE_DEV environment variable is set
if (!Keystone.devMode) return;
const { checkedItems, items, list, manageMode, pageSize } = this.state;
if (!items.count || (list.nodelete && list.noedit)) return;
const checkedItemCount = Object.keys(checkedItems).length;
const buttonNoteStyles = { color: '#999', fontWeight: 'normal' };
// action buttons
const actionUpdateButton = !list.noedit ? (
<InputGroup.Section>
<Button onClick={this.toggleUpdateModal} disabled={!checkedItemCount}>Update</Button>
</InputGroup.Section>
) : null;
const actionDeleteButton = !list.nodelete ? (
<InputGroup.Section>
<Button onClick={this.massDelete} disabled={!checkedItemCount}>Delete</Button>
</InputGroup.Section>
) : null;
const actionButtons = manageMode ? (
<InputGroup.Section>
<InputGroup contiguous>
{actionUpdateButton}
{actionDeleteButton}
</InputGroup>
</InputGroup.Section>
) : null;
// select buttons
const selectAllButton = items.count > pageSize ? (
<InputGroup.Section>
<Button onClick={() => this.handleManagementSelect('all')} title="Select all rows (including those not visible)">All <small style={buttonNoteStyles}>({items.count})</small></Button>
</InputGroup.Section>
) : null;
const selectButtons = manageMode ? (
<InputGroup.Section>
<InputGroup contiguous>
{selectAllButton}
<InputGroup.Section>
<Button onClick={() => this.handleManagementSelect('visible')} title="Select all rows">{items.count > pageSize ? 'Page' : 'All'} <small style={buttonNoteStyles}>({items.results.length})</small></Button>
</InputGroup.Section>
<InputGroup.Section>
<Button onClick={() => this.handleManagementSelect('none')} title="Deselect all rows">None</Button>
</InputGroup.Section>
</InputGroup>
</InputGroup.Section>
) : null;
// selected count text
const selectedCountText = manageMode ? (
<InputGroup.Section grow>
<span style={{ color: '#666', display: 'inline-block', lineHeight: '2.4em', margin: 1 }}>{checkedItemCount} selected</span>
</InputGroup.Section>
) : null;
// put it all together
return (
<InputGroup style={{ float: 'left', marginRight: '.75em' }}>
<InputGroup.Section>
<Button isActive={manageMode} onClick={() => this.toggleManageMode(!manageMode)}>Manage</Button>
</InputGroup.Section>
{selectButtons}
{actionButtons}
{selectedCountText}
</InputGroup>
);
},
renderPagination () {
const { currentPage, items, list, manageMode, pageSize } = this.state;
if (manageMode || !items.count) return;
return (
<Pagination
className="ListHeader__pagination"
currentPage={currentPage}
onPageSelect={this.handlePageSelect}
pageSize={pageSize}
plural={list.plural}
singular={list.singular}
style={{ marginBottom: 0 }}
total={items.count}
limit={10}
/>
);
},
renderHeader () {
const { items, list } = this.state;
return (
<div className="ListHeader">
<Container>
<h2 className="ListHeader__title">
{plural(items.count, ('* ' + list.singular), ('* ' + list.plural))}
<ListSort
handleSortSelect={this.handleSortSelect}
/>
</h2>
<InputGroup className="ListHeader__bar">
{this.renderSearch()}
<ListFiltersAdd className="ListHeader__filter" />
<ListColumnsForm className="ListHeader__columns" />
<ListDownloadForm className="ListHeader__download" />
<InputGroup.Section className="ListHeader__expand">
<Button isActive={!this.state.constrainTableWidth} onClick={this.toggleTableWidth} title="Expand table width">
<span className="octicon octicon-mirror" />
</Button>
</InputGroup.Section>
{this.renderCreateButton()}
</InputGroup>
<ListFilters />
<div style={{ height: 34, marginBottom: '2em' }}>
{this.renderManagement()}
{this.renderPagination()}
<span style={{ clear: 'both', display: 'table' }} />
</div>
</Container>
</div>
);
},
// ==============================
// TABLE
// ==============================
checkTableItem (item, e) {
e.preventDefault();
const newCheckedItems = { ...this.state.checkedItems };
const itemId = item.id;
if (this.state.checkedItems[itemId]) {
delete newCheckedItems[itemId];
} else {
newCheckedItems[itemId] = true;
}
this.setState({
checkedItems: newCheckedItems,
});
},
checkAllTableItems () {
const checkedItems = {};
this.state.items.results.forEach(item => {
checkedItems[item.id] = true;
});
this.setState({
checkedItems: checkedItems,
});
},
uncheckAllTableItems () {
this.setState({
checkedItems: {},
});
},
deleteTableItem (item, e) {
if (e.altKey) {
return CurrentListStore.deleteItem(item.id);
}
e.preventDefault();
this.setState({
confirmationDialog: {
isOpen: true,
label: 'Delete',
body: `Are you sure you want to delete <strong>${item.name}</strong>?<br /><br />This cannot be undone.`,
onConfirmation: () => {
CurrentListStore.deleteItem(item.id);
this.removeConfirmationDialog();
},
},
});
},
removeConfirmationDialog () {
this.setState({
confirmationDialog: {
isOpen: false,
},
});
},
toggleTableWidth () {
this.setState({
constrainTableWidth: !this.state.constrainTableWidth,
});
},
// ==============================
// COMMON
// ==============================
handleSortSelect (path, inverted) {
if (inverted) path = '-' + path;
CurrentListStore.setActiveSort(path);
},
toggleCreateModal (visible) {
this.setState({
showCreateForm: visible,
});
},
renderBlankStateCreateButton () {
var props = { type: 'success' };
if (this.state.list.nocreate) return null;
if (this.state.list.autocreate) {
props.href = '?new' + this.props.csrfQuery;
} else {
props.onClick = () => this.toggleCreateModal(true);
}
return (
<Button {...props}>
<span className="octicon octicon-plus" />
Create {this.state.list.singular}
</Button>
);
},
renderBlankState () {
if (!this.state.showBlankState) return null;
return (
<Container>
<FlashMessages messages={this.props.messages} />
<BlankState style={{ marginTop: 40 }}>
<BlankState.Heading>No {this.state.list.plural.toLowerCase()} found…</BlankState.Heading>
{this.renderBlankStateCreateButton()}
</BlankState>
</Container>
);
},
renderActiveState () {
if (this.state.showBlankState) return null;
const containerStyle = {
transition: 'max-width 160ms ease-out',
msTransition: 'max-width 160ms ease-out',
MozTransition: 'max-width 160ms ease-out',
WebkitTransition: 'max-width 160ms ease-out',
};
if (!this.state.constrainTableWidth) {
containerStyle.maxWidth = '100%';
}
return (
<div>
{this.renderHeader()}
<Container style={containerStyle}>
<FlashMessages messages={this.props.messages} />
<ItemsTable
checkedItems={this.state.checkedItems}
checkTableItem={this.checkTableItem}
columns={this.state.columns}
deleteTableItem={this.deleteTableItem}
handleSortSelect={this.handleSortSelect}
items={this.state.items}
list={this.state.list}
manageMode={this.state.manageMode}
rowAlert={this.state.rowAlert}
/>
{this.renderNoSearchResults()}
</Container>
</div>
);
},
renderNoSearchResults () {
if (this.state.items.results.length) return null;
let matching = this.state.search;
if (this.state.filters.length) {
matching += (matching ? ' and ' : '') + plural(this.state.filters.length, '* filter', '* filters');
}
matching = matching ? ' found matching ' + matching : '.';
return (
<BlankState style={{ marginTop: 20, marginBottom: 20 }}>
<span className="octicon octicon-search" style={{ fontSize: 32, marginBottom: 20 }} />
<BlankState.Heading>No {this.state.list.plural.toLowerCase()}{matching}</BlankState.Heading>
</BlankState>
);
},
render () {
return !this.state.ready ? (
<div className="view-loading-indicator"><Spinner size="md" /></div>
) : (
<div className="keystone-wrapper">
<header className="keystone-header">
<MobileNavigation
brand={this.props.brand}
currentListKey={this.state.list.path}
currentSectionKey={this.props.nav.currentSection.key}
sections={this.props.nav.sections}
signoutUrl={this.props.signoutUrl}
/>
<PrimaryNavigation
brand={this.props.brand}
currentSectionKey={this.props.nav.currentSection.key}
sections={this.props.nav.sections}
signoutUrl={this.props.signoutUrl} />
<SecondaryNavigation
currentListKey={this.state.list.path}
lists={this.props.nav.currentSection.lists} />
</header>
<div className="keystone-body">
{this.renderBlankState()}
{this.renderActiveState()}
</div>
<Footer
appversion={this.props.appversion}
backUrl={this.props.backUrl}
brand={this.props.brand}
User={this.props.User}
user={this.props.user}
version={this.props.version} />
<CreateForm
err={this.props.createFormErrors}
isOpen={this.state.showCreateForm}
list={this.state.list}
onCancel={() => this.toggleCreateModal(false)}
values={this.props.createFormData} />
<UpdateForm
isOpen={this.state.showUpdateForm}
itemIds={Object.keys(this.state.checkedItems)}
list={this.state.list}
onCancel={() => this.toggleUpdateModal(false)} />
{this.renderConfirmationDialog()}
</div>
);
},
});
ReactDOM.render(
<ListView
appversion={Keystone.appversion}
backUrl={Keystone.backUrl}
brand={Keystone.brand}
createFormData={Keystone.createFormData}
createFormErrors={Keystone.createFormErrors}
csrfQuery={Keystone.csrf.query}
messages={Keystone.messages}
nav={Keystone.nav}
signoutUrl={Keystone.signoutUrl}
user={Keystone.user}
User={Keystone.User}
version={Keystone.version}
/>,
document.getElementById('list-view')
);
|
src/svg-icons/editor/format-indent-increase.js | ArcanisCz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorFormatIndentIncrease = (props) => (
<SvgIcon {...props}>
<path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/>
</SvgIcon>
);
EditorFormatIndentIncrease = pure(EditorFormatIndentIncrease);
EditorFormatIndentIncrease.displayName = 'EditorFormatIndentIncrease';
EditorFormatIndentIncrease.muiName = 'SvgIcon';
export default EditorFormatIndentIncrease;
|
src/components/tooltip/Tooltip.js | ipfs/webui | import React from 'react'
import PropTypes from 'prop-types'
export default class Tool extends React.Component {
static propTypes = {
children: PropTypes.element.isRequired,
text: PropTypes.string.isRequired
}
state = {
show: false,
overflow: true
}
onResize = () => {
if (this.state.overflow !== (this.el.offsetWidth < this.el.scrollWidth)) {
this.setState((s) => ({ overflow: !s.overflow }))
}
}
componentDidMount () {
window.addEventListener('resize', this.onResize)
this.onResize()
}
componentWillUnmount () {
window.removeEventListener('resize', this.onResize)
}
onMouseOver = () => {
this.setState({ show: true })
}
onMouseLeave = () => {
this.setState({ show: false })
}
render () {
const { children, text, ...props } = this.props
const { show, overflow } = this.state
return (
<div className='relative' {...props}>
<div onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave} onFocus={this.onMouseOver} onBlur={this.onMouseLeave} className='overflow-hidden'>
{React.Children.map(children, c => React.cloneElement(c, { ref: (n) => { this.el = n } }))}
</div>
<div style={{
bottom: '-10px',
left: '50%',
transform: 'translate(-50%, 100%)',
wordWrap: 'break-word',
width: '100%'
}} className={`white z-max bg-navy-muted br2 pa1 f6 absolute ${(show && overflow) ? 'db' : 'dn'}`}>
<span style={{
width: '17px',
height: '17px',
transform: 'translate(-50%, -50%) rotate(45deg)',
borderRadius: '2px 0px 0px',
left: '50%',
zIndex: -1
}} className='db bg-navy-muted absolute' />
{text}
</div>
</div>
)
}
}
|
src/index.js | leonardoelias/social-media-profile | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import store from './store';
import Application from 'components/Application';
ReactDOM.render(
<Provider store={store}>
<Application />
</Provider>,
document.getElementById('root')
);
|
src/server/frontend/render.js | AlesJiranek/este | import DocumentTitle from 'react-document-title';
import Html from './Html.react';
import Promise from 'bluebird';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import config from '../config';
import configureStore from '../../common/configureStore';
import createRoutes from '../../client/createRoutes';
import initialState from '../initialState';
import serialize from 'serialize-javascript';
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';
import {createMemoryHistory} from 'history';
import {fromJS} from 'immutable';
export default function render(req, res, next) {
const state = fromJS(initialState).mergeDeep({
device: {
isMobile: ['phone', 'tablet'].indexOf(req.device.type) > -1
}
}).toJS();
const store = configureStore({initialState: state});
// Fetch logged in user here because routes may need it. Remember we can use
// store.dispatch method.
const routes = createRoutes(() => store.getState());
const location = createMemoryHistory().createLocation(req.url);
match({routes, location}, (error, redirectLocation, renderProps) => {
if (redirectLocation) {
res.redirect(301, redirectLocation.pathname + redirectLocation.search);
return;
}
if (error) {
next(error);
return;
}
// // Not possible with * route.
// if (renderProps == null) {
// res.send(404, 'Not found');
// return;
// }
fetchComponentData(store.dispatch, req, renderProps)
.then(() => renderPage(store, renderProps, req))
.then(html => res.send(html))
.catch(next);
});
}
function fetchComponentData(dispatch, req, {components, location, params}) {
const fetchActions = components.reduce((actions, component) => {
return actions.concat(component.fetchAction || []);
}, []);
const promises = fetchActions.map(action => dispatch(action({
location,
params,
req
})));
return Promise.all(promises);
}
function renderPage(store, renderProps, req) {
const clientState = store.getState();
const {headers, hostname} = req;
const appHtml = getAppHtml(store, renderProps);
const scriptHtml = getScriptHtml(clientState, headers, hostname);
return '<!DOCTYPE html>' + ReactDOMServer.renderToStaticMarkup(
<Html
appCssHash={config.assetsHashes.appCss}
bodyHtml={`<div id="app">${appHtml}</div>${scriptHtml}`}
googleAnalyticsId={config.googleAnalyticsId}
isProduction={config.isProduction}
title={DocumentTitle.rewind()}
/>
);
}
function getAppHtml(store, renderProps) {
return ReactDOMServer.renderToString(
<Provider store={store}>
<IntlProvider>
<RoutingContext {...renderProps} />
</IntlProvider>
</Provider>
);
}
function getScriptHtml(clientState, headers, hostname) {
let scriptHtml = '';
const ua = useragent.is(headers['user-agent']);
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`;
// Note how clientState is serialized. JSON.stringify is anti-pattern.
// https://github.com/yahoo/serialize-javascript#user-content-automatic-escaping-of-html-characters
return scriptHtml + `
<script>
window.__INITIAL_STATE__ = ${serialize(clientState)};
</script>
<script src="${appScriptSrc}"></script>
`;
}
|
wrappers/html.js | subvisual/blog | import React from 'react'
import Helmet from 'react-helmet'
import { config } from 'config'
import Meta from '../components/meta';
module.exports = React.createClass({
propTypes () {
return {
router: React.PropTypes.object,
}
},
render () {
const page = this.props.route.page.data
return (
<div>
<Helmet>
<Meta base route={this.props.route} />
</Helmet>
<div dangerouslySetInnerHTML={{ __html: page.body }} />
</div>
)
},
})
|
Docker/KlusterKiteMonitoring/klusterkite-web/src/components/UserEdit/ResetPassword.js | KlusterKite/KlusterKite | import React from 'react';
import { Input } from 'formsy-react-components';
import Form from '../Form/Form';
import './styles.css';
export default class ResetPassword extends React.Component {
constructor(props) {
super(props);
this.submit = this.submit.bind(this);
}
static propTypes = {
onSubmit: React.PropTypes.func.isRequired,
initialValues: React.PropTypes.object,
saving: React.PropTypes.bool,
saved: React.PropTypes.bool,
saveError: React.PropTypes.string,
saveErrors: React.PropTypes.arrayOf(React.PropTypes.string),
canEdit: React.PropTypes.bool,
};
submit(model) {
this.props.onSubmit(model, this.props.initialValues.uid);
}
render() {
return (
<div>
<h3>Reset Password</h3>
<Form
onSubmit={this.submit}
onDelete={this.props.onDelete ? this.props.onDelete : null}
className="form-horizontal form-margin"
saving={this.props.saving}
deleting={this.props.deleting}
saved={this.props.saved}
saveError={this.props.saveError}
saveErrors={this.props.saveErrors}
savedText="Password reset!"
buttonText="Reset password"
forbidEdit={!this.props.canEdit}
>
<fieldset>
<Input
name="password"
label="New password"
type="password"
elementWrapperClassName="col-sm-3"
value=""
/>
<Input
name="passwordCopy"
label="New password (repeat)"
type="password"
elementWrapperClassName="col-sm-3"
validations="equalsField:password"
value=""
/>
</fieldset>
</Form>
</div>
);
}
}
|
node_modules/babel-plugin-react-transform/test/fixtures/code-class-extends-component-with-render-method/expected.js | RahulDesai92/PHR | import _transformLib from 'transform-lib';
const _components = {
Foo: {
displayName: 'Foo'
}
};
const _transformLib2 = _transformLib({
filename: '%FIXTURE_PATH%',
components: _components,
locals: [],
imports: []
});
function _wrapComponent(id) {
return function (Component) {
return _transformLib2(Component, id);
};
}
import React, { Component } from 'react';
const Foo = _wrapComponent('Foo')(class Foo extends Component {
render() {}
});
|
src/demo/index.js | adamwade2384/react-parallax-mousemove | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
|
node_modules/semantic-ui-react/src/collections/Table/TableHeaderCell.js | mowbell/clickdelivery-fed-test | import cx from 'classnames'
import PropTypes from 'prop-types'
import React from 'react'
import {
customPropTypes,
getUnhandledProps,
META,
useValueAndKey,
} from '../../lib'
import TableCell from './TableCell'
/**
* A table can have a header cell.
*/
function TableHeaderCell(props) {
const { as, className, sorted } = props
const classes = cx(
useValueAndKey(sorted, 'sorted'),
className
)
const rest = getUnhandledProps(TableHeaderCell, props)
return <TableCell {...rest} as={as} className={classes} />
}
TableHeaderCell._meta = {
name: 'TableHeaderCell',
type: META.TYPES.COLLECTION,
parent: 'Table',
}
TableHeaderCell.propTypes = {
/** An element type to render as (string or function). */
as: customPropTypes.as,
/** Additional classes. */
className: PropTypes.string,
/** A header cell can be sorted in ascending or descending order. */
sorted: PropTypes.oneOf(['ascending', 'descending']),
}
TableHeaderCell.defaultProps = {
as: 'th',
}
export default TableHeaderCell
|
src/js/containers/MadLibber/MadLibberApp.js | mathjoy/simpleReact | import React, { Component } from 'react';
import MadLibbedText from './MadLibbedText';
import UploadButton from './UploadButton';
import PlaceholderInput from './placeholder_input';
export default class MadLibberApp extends Component {
constructor(props){
super(props);
this.state = { original_text: "" };
}
setOriginalText(json) {
console.log(json.text_block[0].text);
//const blanks = 2;
const root_url = 'http://libberfy.herokuapp.com/?html_form=1';
var url = root_url + "&blanks=4" + "&q=" + json.text_block[0].text;
// console.log(url);
fetch(url)
.then(function(response) {
console.log(response);
return response.json()
}).then((json) => {
this.setState({ original_text: json.madlib });
//console.log(this.state.text);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
}
render() {
return (
<div>
<div className="top-bar grooveBorder">
<div className="columns medium-centered">
<h1 className="website-title"><strong>Mad Libber</strong></h1>
</div>
</div>
<div className="row">
<div className="medium-9 medium-centered columns">
<UploadButton onUploadPhoto={this.setOriginalText.bind(this)}/>
<hr/>
<MadLibbedText text={this.state.original_text}/>;
</div>
</div>
</div>
);
}
/* we tried
renderMadlibText()
{
if (!this.state.original_text) {
return;
}
var str = this.state.original_text.split(' ');
console.log(str);
str.map((word) => {
if (word.startsWith('<')) {
console.log("hello");
return <PlaceholderInput placeholder={word} />;
}
else {
return <p>{word}</p>;
}
})
}*/
}
|
packages/react-scripts/fixtures/kitchensink/src/features/syntax/DestructuringAndAwait.js | HelpfulHuman/helpful-react-scripts | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
async function load() {
return {
users: [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
],
};
}
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const { users } = await load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-destructuring-and-await">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
</div>
);
}
}
|
src/containers/organizations/components/StyledListGroupComponents.js | dataloom/gallery | import React from 'react';
import FontAwesome from 'react-fontawesome';
import styled from 'styled-components';
import StyledFlexContainer from '../../../components/flex/StyledFlexContainer';
export const StyledListItem = styled(StyledFlexContainer)`
background-color: #ffffff;
border: 1px solid #cfd8dc;
flex: 1 0 auto;
margin-top: -1px;
padding: 0 5px;
&:first-child {
margin: 0;
}
`;
export const StyledElement = styled.span`
background: none;
border: none;
display: flex;
flex: 1 0 auto;
margin: auto 5px;
padding: 10px 0;
`;
export const StyledIcon = styled.span`
background: none;
border: none;
display: flex;
flex: 0;
margin: auto 5px;
padding: 10px 0;
`;
export const StyledInput = styled.input`
background: none;
border: none;
display: flex;
flex: 1 0 auto;
margin: auto 5px;
padding: 10px 0;
&:focus {
outline: none;
}
`;
export const StyledButton = styled.button`
background: none;
border: none;
display: flex;
flex: 0;
margin: auto 5px;
&:focus {
outline: none;
}
`;
const StyledAddButton = styled(StyledButton)`
color: #39de9d;
`;
const StyledRemoveButton = styled(StyledButton)`
color: #e91e63;
`;
const StyledSearchIcon = styled(StyledIcon)`
padding: 0;
`;
export const AddButton = ({ onClick }) => (
<StyledAddButton onClick={onClick}>
<FontAwesome name="plus" />
</StyledAddButton>
);
export const RemoveButton = ({ onClick }) => (
<StyledRemoveButton onClick={onClick}>
<FontAwesome name="minus" />
</StyledRemoveButton>
);
export const SearchIcon = () => (
<StyledSearchIcon>
<FontAwesome name="search" />
</StyledSearchIcon>
);
|
src/svg-icons/device/battery-20.js | jacklam718/react-svg-iconx | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceBattery20 = (props) => (
<SvgIcon {...props}>
<path d="M7 17v3.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V17H7z"/><path fillOpacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V17h10V5.33z"/>
</SvgIcon>
);
DeviceBattery20 = pure(DeviceBattery20);
DeviceBattery20.displayName = 'DeviceBattery20';
DeviceBattery20.muiName = 'SvgIcon';
export default DeviceBattery20;
|
src/app/minibar/packlist/PackList.js | hiubers/pick | import React from 'react'
import Pack from './pack/Pack'
class PackList extends React.Component {
render() {
return (
<ul>
<Pack />
</ul>
)
}
}
export default PackList |
dashboard/components/FeatureDetail.js | dbrabera/laika | import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import Toggle from './Toggle';
import Section from './Section';
import './FeatureDetail.css';
function capitalize(s) {
return s[0].toUpperCase() + s.slice(1);
}
export default function FeatureDetail({ feature, onToggle }) {
const environments = Object.keys(feature.status).map(name =>
<div key={name}>
<span className="lk-feature-details__environment-name">
{capitalize(name)} <span>({name})</span>
</span>
<span className="lk-feature-details__environment-control">
<Toggle name={name} value={feature.status[name]} onChange={onToggle} />
</span>
</div>,
);
return (
<div className="lk-feature-detail">
<div className="lk-feature-detail__header">
<h2>{feature.name}</h2>
<div>Created {moment(feature.created_at).fromNow()}</div>
</div>
<Section title="Environments">
{environments}
</Section>
</div>
);
}
FeatureDetail.propTypes = {
feature: PropTypes.shape({
name: PropTypes.string,
}).isRequired,
onToggle: PropTypes.func.isRequired,
};
|
src/Utils/LoadingAnimation.js | tommartensen/arion-frontend | import React, { Component } from 'react';
import { css } from 'aphrodite';
import CircularProgress from 'material-ui/CircularProgress';
import AppStyles from "../AppStyles";
class LoadingAnimation extends Component {
render() {
return (
<div className={css(AppStyles.dFlex, AppStyles.justifyContentCenter)}>
<CircularProgress size={80} thickness={5} />
</div>
);
}
}
export default LoadingAnimation; |
app/javascript/mastodon/features/status/components/action_bar.js | koba-lab/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import IconButton from '../../../components/icon_button';
import ImmutablePropTypes from 'react-immutable-proptypes';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import { me, isStaff } from '../../../initial_state';
import classNames from 'classnames';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
redraft: { id: 'status.redraft', defaultMessage: 'Delete & re-draft' },
edit: { id: 'status.edit', defaultMessage: 'Edit' },
direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' },
mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' },
reply: { id: 'status.reply', defaultMessage: 'Reply' },
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
reblog_private: { id: 'status.reblog_private', defaultMessage: 'Boost with original visibility' },
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Unboost' },
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' },
more: { id: 'status.more', defaultMessage: 'More' },
mute: { id: 'status.mute', defaultMessage: 'Mute @{name}' },
muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' },
unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' },
block: { id: 'status.block', defaultMessage: 'Block @{name}' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' },
share: { id: 'status.share', defaultMessage: 'Share' },
pin: { id: 'status.pin', defaultMessage: 'Pin on profile' },
unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' },
embed: { id: 'status.embed', defaultMessage: 'Embed' },
admin_account: { id: 'status.admin_account', defaultMessage: 'Open moderation interface for @{name}' },
admin_status: { id: 'status.admin_status', defaultMessage: 'Open this status in the moderation interface' },
copy: { id: 'status.copy', defaultMessage: 'Copy link to status' },
blockDomain: { id: 'account.block_domain', defaultMessage: 'Block domain {domain}' },
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unblock domain {domain}' },
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
});
const mapStateToProps = (state, { status }) => ({
relationship: state.getIn(['relationships', status.getIn(['account', 'id'])]),
});
export default @connect(mapStateToProps)
@injectIntl
class ActionBar extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
relationship: ImmutablePropTypes.map,
onReply: PropTypes.func.isRequired,
onReblog: PropTypes.func.isRequired,
onFavourite: PropTypes.func.isRequired,
onBookmark: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired,
onEdit: PropTypes.func.isRequired,
onDirect: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
onMute: PropTypes.func,
onUnmute: PropTypes.func,
onBlock: PropTypes.func,
onUnblock: PropTypes.func,
onBlockDomain: PropTypes.func,
onUnblockDomain: PropTypes.func,
onMuteConversation: PropTypes.func,
onReport: PropTypes.func,
onPin: PropTypes.func,
onEmbed: PropTypes.func,
intl: PropTypes.object.isRequired,
};
handleReplyClick = () => {
this.props.onReply(this.props.status);
}
handleReblogClick = (e) => {
this.props.onReblog(this.props.status, e);
}
handleFavouriteClick = () => {
this.props.onFavourite(this.props.status);
}
handleBookmarkClick = (e) => {
this.props.onBookmark(this.props.status, e);
}
handleDeleteClick = () => {
this.props.onDelete(this.props.status, this.context.router.history);
}
handleRedraftClick = () => {
this.props.onDelete(this.props.status, this.context.router.history, true);
}
handleEditClick = () => {
this.props.onEdit(this.props.status, this.context.router.history);
}
handleDirectClick = () => {
this.props.onDirect(this.props.status.get('account'), this.context.router.history);
}
handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router.history);
}
handleMuteClick = () => {
const { status, relationship, onMute, onUnmute } = this.props;
const account = status.get('account');
if (relationship && relationship.get('muting')) {
onUnmute(account);
} else {
onMute(account);
}
}
handleBlockClick = () => {
const { status, relationship, onBlock, onUnblock } = this.props;
const account = status.get('account');
if (relationship && relationship.get('blocking')) {
onUnblock(account);
} else {
onBlock(status);
}
}
handleBlockDomain = () => {
const { status, onBlockDomain } = this.props;
const account = status.get('account');
onBlockDomain(account.get('acct').split('@')[1]);
}
handleUnblockDomain = () => {
const { status, onUnblockDomain } = this.props;
const account = status.get('account');
onUnblockDomain(account.get('acct').split('@')[1]);
}
handleConversationMuteClick = () => {
this.props.onMuteConversation(this.props.status);
}
handleReport = () => {
this.props.onReport(this.props.status);
}
handlePinClick = () => {
this.props.onPin(this.props.status);
}
handleShare = () => {
navigator.share({
text: this.props.status.get('search_index'),
url: this.props.status.get('url'),
});
}
handleEmbed = () => {
this.props.onEmbed(this.props.status);
}
handleCopy = () => {
const url = this.props.status.get('url');
const textarea = document.createElement('textarea');
textarea.textContent = url;
textarea.style.position = 'fixed';
document.body.appendChild(textarea);
try {
textarea.select();
document.execCommand('copy');
} catch (e) {
} finally {
document.body.removeChild(textarea);
}
}
render () {
const { status, relationship, intl } = this.props;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const pinnableStatus = ['public', 'unlisted', 'private'].includes(status.get('visibility'));
const mutingConversation = status.get('muted');
const account = status.get('account');
const writtenByMe = status.getIn(['account', 'id']) === me;
let menu = [];
if (publicStatus) {
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
menu.push(null);
}
if (writtenByMe) {
if (pinnableStatus) {
menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick });
menu.push(null);
}
menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick });
menu.push(null);
// menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick });
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
menu.push({ text: intl.formatMessage(messages.redraft), action: this.handleRedraftClick });
} else {
menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick });
menu.push({ text: intl.formatMessage(messages.direct, { name: status.getIn(['account', 'username']) }), action: this.handleDirectClick });
menu.push(null);
if (relationship && relationship.get('muting')) {
menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.handleMuteClick });
} else {
menu.push({ text: intl.formatMessage(messages.mute, { name: account.get('username') }), action: this.handleMuteClick });
}
if (relationship && relationship.get('blocking')) {
menu.push({ text: intl.formatMessage(messages.unblock, { name: account.get('username') }), action: this.handleBlockClick });
} else {
menu.push({ text: intl.formatMessage(messages.block, { name: account.get('username') }), action: this.handleBlockClick });
}
menu.push({ text: intl.formatMessage(messages.report, { name: status.getIn(['account', 'username']) }), action: this.handleReport });
if (account.get('acct') !== account.get('username')) {
const domain = account.get('acct').split('@')[1];
menu.push(null);
if (relationship && relationship.get('domain_blocking')) {
menu.push({ text: intl.formatMessage(messages.unblockDomain, { domain }), action: this.handleUnblockDomain });
} else {
menu.push({ text: intl.formatMessage(messages.blockDomain, { domain }), action: this.handleBlockDomain });
}
}
if (isStaff) {
menu.push(null);
menu.push({ text: intl.formatMessage(messages.admin_account, { name: status.getIn(['account', 'username']) }), href: `/admin/accounts/${status.getIn(['account', 'id'])}` });
menu.push({ text: intl.formatMessage(messages.admin_status), href: `/admin/accounts/${status.getIn(['account', 'id'])}/statuses?id=${status.get('id')}` });
}
}
const shareButton = ('share' in navigator) && publicStatus && (
<div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShare} /></div>
);
let replyIcon;
if (status.get('in_reply_to_id', null) === null) {
replyIcon = 'reply';
} else {
replyIcon = 'reply-all';
}
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';
let reblogTitle;
if (status.get('reblogged')) {
reblogTitle = intl.formatMessage(messages.cancel_reblog_private);
} else if (publicStatus) {
reblogTitle = intl.formatMessage(messages.reblog);
} else if (reblogPrivate) {
reblogTitle = intl.formatMessage(messages.reblog_private);
} else {
reblogTitle = intl.formatMessage(messages.cannot_reblog);
}
return (
<div className='detailed-status__action-bar'>
<div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /></div>
<div className='detailed-status__button' ><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div>
<div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div>
{shareButton}
<div className='detailed-status__button'><IconButton className='bookmark-icon' active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>
<div className='detailed-status__action-bar-dropdown'>
<DropdownMenuContainer size={18} icon='ellipsis-h' status={status} items={menu} direction='left' title={intl.formatMessage(messages.more)} />
</div>
</div>
);
}
}
|
client/src/components/Profile/ProfileDashboard.js | wolnewitz/raptor-ads | import React from 'react';
import { Grid, Image, Header, Card, Divider } from 'semantic-ui-react';
import { Link } from 'react-router';
import StarRatingComponent from 'react-star-rating-component';
import getAverageRating from '../helpers/getAverageRating';
import makeNamePossessive from '../helpers/makeNamePossessive';
const listings = [1,2,3,4,5,6];
const ProfileDashboard = ({ user, userListings, onListingClick, isLoggedInUser }) =>
<Grid width={16} >
<Grid.Column width={3} textAlign="center" className="profileContainer">
<Card style={{ width: '200px' }}>
<Image src={user.profile_img_path || '/client/src/assets/blankProfile.png'} />
<Header>
{ `${user.firstName} ${user.lastName}` }
</Header>
<Card.Content>
<Header className="dateHeader">
Member since:
</Header>
{ new Date(user.createdAt).toLocaleDateString() }
</Card.Content>
</Card>
<Card>
<Card.Content>
<Header className="dateHeader" style={{ marginBottom: '7px' }}>
{makeNamePossessive(user.firstName)} rating:
</Header>
{user.ratings && user.ratings.length === 0 ? <p style={{ marginTop: '0', marginBottom: '7px' }}>None</p> :
<StarRatingComponent
name={'average'}
value={getAverageRating(user.ratings)}
starColor="#31b234"
editing={false}
textAlign="center"
/>
}
<Link className="ratingsHeader" to={`/user/${user.id}/ratings`}>
<Header className="ratingsHeader">
View {makeNamePossessive(user.firstName)} ratings
</Header>
</Link>
{ isLoggedInUser ? '' :
<Link className="ratingsHeader" to={`/user/${user.id}/ratings/new`}>
<Header className="ratingsHeader">
Write a Review for { user.firstName }
</Header>
</Link>
}
</Card.Content>
</Card>
</Grid.Column>
<Grid.Column width={13}>
<Header>{makeNamePossessive(user.firstName)} listings:</Header>
<Card.Group itemsPerRow={1} stackable>
{userListings && userListings.map(listing => {
let picturePath;
if (listing.pictures[0]) {
picturePath = listing.pictures[0].img_path;
} else {
picturePath = '/client/src/assets/noImageAvailable.jpg';
}
return (
<Card
className="dashboardCard"
onClick={() => onListingClick(listing.id)}
>
<Card.Header>
<Image
floated="left"
style={{ height: '160px', width: '160px' }}
src={picturePath}
/>
<Header style={{ marginTop: '6px', marginBottom: '0' }} as={'h3'} color="green">
{listing.title}
</Header>
<Divider/>
<Card.Content style={{ color: 'black' }}>
{listing.body}
</Card.Content>
<Card.Content style={{ marginTop: '63px', float: 'right', marginRight: '5px', color: 'black' }}>
{listing.city}, {listing.state}
</Card.Content>
</Card.Header>
</Card>
);
})}
</Card.Group>
</Grid.Column>
</Grid>;
export default ProfileDashboard;
|
src/index.js | Amous-th/gallery-by-react | import 'core-js/fn/object/assign';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/Main';
// Render the main component into the dom
ReactDOM.render(<App />, document.getElementById('app'));
|
packages/react-dom/src/test-utils/ReactTestUtils.js | prometheansacrifice/react | /**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import {findCurrentFiberUsingSlowPath} from 'react-reconciler/reflection';
import * as ReactInstanceMap from 'shared/ReactInstanceMap';
import {
ClassComponent,
FunctionalComponent,
HostComponent,
HostText,
} from 'shared/ReactTypeOfWork';
import SyntheticEvent from 'events/SyntheticEvent';
import invariant from 'fbjs/lib/invariant';
import * as DOMTopLevelEventTypes from '../events/DOMTopLevelEventTypes';
const {findDOMNode} = ReactDOM;
const {
EventPluginHub,
EventPluginRegistry,
EventPropagators,
ReactControlledComponent,
ReactDOMComponentTree,
ReactDOMEventListener,
} = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function Event(suffix) {}
/**
* @class ReactTestUtils
*/
/**
* Simulates a top level event being dispatched from a raw event that occurred
* on an `Element` node.
* @param {number} topLevelType A number from `TopLevelEventTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
ReactDOMEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
}
/**
* Simulates a top level event being dispatched from a raw event that occurred
* on the `ReactDOMComponent` `comp`.
* @param {Object} topLevelType A type from `BrowserEventConstants.topLevelTypes`.
* @param {!ReactDOMComponent} comp
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
function simulateNativeEventOnDOMComponent(
topLevelType,
comp,
fakeNativeEvent,
) {
simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
}
function findAllInRenderedFiberTreeInternal(fiber, test) {
if (!fiber) {
return [];
}
const currentParent = findCurrentFiberUsingSlowPath(fiber);
if (!currentParent) {
return [];
}
let node = currentParent;
let ret = [];
while (true) {
if (
node.tag === HostComponent ||
node.tag === HostText ||
node.tag === ClassComponent ||
node.tag === FunctionalComponent
) {
const publicInst = node.stateNode;
if (test(publicInst)) {
ret.push(publicInst);
}
}
if (node.child) {
node.child.return = node;
node = node.child;
continue;
}
if (node === currentParent) {
return ret;
}
while (!node.sibling) {
if (!node.return || node.return === currentParent) {
return ret;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
}
/**
* Utilities for making it easy to test React components.
*
* See https://reactjs.org/docs/test-utils.html
*
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
const ReactTestUtils = {
renderIntoDocument: function(element) {
const div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
return ReactDOM.render(element, div);
},
isElement: function(element) {
return React.isValidElement(element);
},
isElementOfType: function(inst, convenienceConstructor) {
return React.isValidElement(inst) && inst.type === convenienceConstructor;
},
isDOMComponent: function(inst) {
return !!(inst && inst.nodeType === 1 && inst.tagName);
},
isDOMComponentElement: function(inst) {
return !!(inst && React.isValidElement(inst) && !!inst.tagName);
},
isCompositeComponent: function(inst) {
if (ReactTestUtils.isDOMComponent(inst)) {
// Accessing inst.setState warns; just return false as that'll be what
// this returns when we have DOM nodes as refs directly
return false;
}
return (
inst != null &&
typeof inst.render === 'function' &&
typeof inst.setState === 'function'
);
},
isCompositeComponentWithType: function(inst, type) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return false;
}
const internalInstance = ReactInstanceMap.get(inst);
const constructor = internalInstance.type;
return constructor === type;
},
findAllInRenderedTree: function(inst, test) {
if (!inst) {
return [];
}
invariant(
ReactTestUtils.isCompositeComponent(inst),
'findAllInRenderedTree(...): instance must be a composite component',
);
const internalInstance = ReactInstanceMap.get(inst);
return findAllInRenderedFiberTreeInternal(internalInstance, test);
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
* @return {array} an array of all the matches.
*/
scryRenderedDOMComponentsWithClass: function(root, classNames) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
if (ReactTestUtils.isDOMComponent(inst)) {
let className = inst.className;
if (typeof className !== 'string') {
// SVG, probably.
className = inst.getAttribute('class') || '';
}
const classList = className.split(/\s+/);
if (!Array.isArray(classNames)) {
invariant(
classNames !== undefined,
'TestUtils.scryRenderedDOMComponentsWithClass expects a ' +
'className as a second argument.',
);
classNames = classNames.split(/\s+/);
}
return classNames.every(function(name) {
return classList.indexOf(name) !== -1;
});
}
return false;
});
},
/**
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithClass: function(root, className) {
const all = ReactTestUtils.scryRenderedDOMComponentsWithClass(
root,
className,
);
if (all.length !== 1) {
throw new Error(
'Did not find exactly one match (found: ' +
all.length +
') ' +
'for class:' +
className,
);
}
return all[0];
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
* @return {array} an array of all the matches.
*/
scryRenderedDOMComponentsWithTag: function(root, tagName) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
return (
ReactTestUtils.isDOMComponent(inst) &&
inst.tagName.toUpperCase() === tagName.toUpperCase()
);
});
},
/**
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithTag: function(root, tagName) {
const all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error(
'Did not find exactly one match (found: ' +
all.length +
') ' +
'for tag:' +
tagName,
);
}
return all[0];
},
/**
* Finds all instances of components with type equal to `componentType`.
* @return {array} an array of all the matches.
*/
scryRenderedComponentsWithType: function(root, componentType) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
},
/**
* Same as `scryRenderedComponentsWithType` but expects there to be one result
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
findRenderedComponentWithType: function(root, componentType) {
const all = ReactTestUtils.scryRenderedComponentsWithType(
root,
componentType,
);
if (all.length !== 1) {
throw new Error(
'Did not find exactly one match (found: ' +
all.length +
') ' +
'for componentType:' +
componentType,
);
}
return all[0];
},
/**
* Pass a mocked component module to this method to augment it with
* useful methods that allow it to be used as a dummy React component.
* Instead of rendering as usual, the component will become a simple
* <div> containing any provided children.
*
* @param {object} module the mock function object exported from a
* module that defines the component to be mocked
* @param {?string} mockTagName optional dummy root tag name to return
* from render method (overrides
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
mockComponent: function(module, mockTagName) {
mockTagName = mockTagName || module.mockTagName || 'div';
module.prototype.render.mockImplementation(function() {
return React.createElement(mockTagName, null, this.props.children);
});
return this;
},
nativeTouchData: function(x, y) {
return {
touches: [{pageX: x, pageY: y}],
};
},
Simulate: null,
SimulateNative: {},
};
/**
* Exports:
*
* - `ReactTestUtils.Simulate.click(Element)`
* - `ReactTestUtils.Simulate.mouseMove(Element)`
* - `ReactTestUtils.Simulate.change(Element)`
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
return function(domNode, eventData) {
invariant(
!React.isValidElement(domNode),
'TestUtils.Simulate expected a DOM node as the first argument but received ' +
'a React element. Pass the DOM node you wish to simulate the event on instead. ' +
'Note that TestUtils.Simulate will not work if you are using shallow rendering.',
);
invariant(
!ReactTestUtils.isCompositeComponent(domNode),
'TestUtils.Simulate expected a DOM node as the first argument but received ' +
'a component instance. Pass the DOM node you wish to simulate the event on instead.',
);
const dispatchConfig =
EventPluginRegistry.eventNameDispatchConfigs[eventType];
const fakeNativeEvent = new Event();
fakeNativeEvent.target = domNode;
fakeNativeEvent.type = eventType.toLowerCase();
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
const targetInst = ReactDOMComponentTree.getInstanceFromNode(domNode);
const event = new SyntheticEvent(
dispatchConfig,
targetInst,
fakeNativeEvent,
domNode,
);
// Since we aren't using pooling, always persist the event. This will make
// sure it's marked and won't warn when setting additional properties.
event.persist();
Object.assign(event, eventData);
if (dispatchConfig.phasedRegistrationNames) {
EventPropagators.accumulateTwoPhaseDispatches(event);
} else {
EventPropagators.accumulateDirectDispatches(event);
}
ReactDOM.unstable_batchedUpdates(function() {
// Normally extractEvent enqueues a state restore, but we'll just always
// do that since we we're by-passing it here.
ReactControlledComponent.enqueueStateRestore(domNode);
EventPluginHub.runEventsInBatch(event, true);
});
ReactControlledComponent.restoreStateIfNeeded();
};
}
function buildSimulators() {
ReactTestUtils.Simulate = {};
let eventType;
for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
/**
* @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
}
}
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
const oldInjectEventPluginOrder =
EventPluginHub.injection.injectEventPluginOrder;
EventPluginHub.injection.injectEventPluginOrder = function() {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
const oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
EventPluginHub.injection.injectEventPluginsByName = function() {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
buildSimulators();
/**
* Exports:
*
* - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
* - ... (All keys from `BrowserEventConstants.topLevelTypes`)
*
* Note: Top level event types are a subset of the entire set of handler types
* (which include a broader set of "synthetic" events). For example, onDragDone
* is a synthetic event. Except when testing an event plugin or React's event
* handling code specifically, you probably want to use ReactTestUtils.Simulate
* to dispatch synthetic events.
*/
function makeNativeSimulator(eventType, topLevelType) {
return function(domComponentOrNode, nativeEventData) {
const fakeNativeEvent = new Event(eventType);
Object.assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
simulateNativeEventOnDOMComponent(
topLevelType,
domComponentOrNode,
fakeNativeEvent,
);
} else if (domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
simulateNativeEventOnNode(
topLevelType,
domComponentOrNode,
fakeNativeEvent,
);
}
};
}
[
[DOMTopLevelEventTypes.TOP_ABORT, 'abort'],
[DOMTopLevelEventTypes.TOP_ANIMATION_END, 'animationEnd'],
[DOMTopLevelEventTypes.TOP_ANIMATION_ITERATION, 'animationIteration'],
[DOMTopLevelEventTypes.TOP_ANIMATION_START, 'animationStart'],
[DOMTopLevelEventTypes.TOP_BLUR, 'blur'],
[DOMTopLevelEventTypes.TOP_CAN_PLAY_THROUGH, 'canPlayThrough'],
[DOMTopLevelEventTypes.TOP_CAN_PLAY, 'canPlay'],
[DOMTopLevelEventTypes.TOP_CANCEL, 'cancel'],
[DOMTopLevelEventTypes.TOP_CHANGE, 'change'],
[DOMTopLevelEventTypes.TOP_CLICK, 'click'],
[DOMTopLevelEventTypes.TOP_CLOSE, 'close'],
[DOMTopLevelEventTypes.TOP_COMPOSITION_END, 'compositionEnd'],
[DOMTopLevelEventTypes.TOP_COMPOSITION_START, 'compositionStart'],
[DOMTopLevelEventTypes.TOP_COMPOSITION_UPDATE, 'compositionUpdate'],
[DOMTopLevelEventTypes.TOP_CONTEXT_MENU, 'contextMenu'],
[DOMTopLevelEventTypes.TOP_COPY, 'copy'],
[DOMTopLevelEventTypes.TOP_CUT, 'cut'],
[DOMTopLevelEventTypes.TOP_DOUBLE_CLICK, 'doubleClick'],
[DOMTopLevelEventTypes.TOP_DRAG_END, 'dragEnd'],
[DOMTopLevelEventTypes.TOP_DRAG_ENTER, 'dragEnter'],
[DOMTopLevelEventTypes.TOP_DRAG_EXIT, 'dragExit'],
[DOMTopLevelEventTypes.TOP_DRAG_LEAVE, 'dragLeave'],
[DOMTopLevelEventTypes.TOP_DRAG_OVER, 'dragOver'],
[DOMTopLevelEventTypes.TOP_DRAG_START, 'dragStart'],
[DOMTopLevelEventTypes.TOP_DRAG, 'drag'],
[DOMTopLevelEventTypes.TOP_DROP, 'drop'],
[DOMTopLevelEventTypes.TOP_DURATION_CHANGE, 'durationChange'],
[DOMTopLevelEventTypes.TOP_EMPTIED, 'emptied'],
[DOMTopLevelEventTypes.TOP_ENCRYPTED, 'encrypted'],
[DOMTopLevelEventTypes.TOP_ENDED, 'ended'],
[DOMTopLevelEventTypes.TOP_ERROR, 'error'],
[DOMTopLevelEventTypes.TOP_FOCUS, 'focus'],
[DOMTopLevelEventTypes.TOP_INPUT, 'input'],
[DOMTopLevelEventTypes.TOP_KEY_DOWN, 'keyDown'],
[DOMTopLevelEventTypes.TOP_KEY_PRESS, 'keyPress'],
[DOMTopLevelEventTypes.TOP_KEY_UP, 'keyUp'],
[DOMTopLevelEventTypes.TOP_LOAD_START, 'loadStart'],
[DOMTopLevelEventTypes.TOP_LOAD_START, 'loadStart'],
[DOMTopLevelEventTypes.TOP_LOAD, 'load'],
[DOMTopLevelEventTypes.TOP_LOADED_DATA, 'loadedData'],
[DOMTopLevelEventTypes.TOP_LOADED_METADATA, 'loadedMetadata'],
[DOMTopLevelEventTypes.TOP_MOUSE_DOWN, 'mouseDown'],
[DOMTopLevelEventTypes.TOP_MOUSE_MOVE, 'mouseMove'],
[DOMTopLevelEventTypes.TOP_MOUSE_OUT, 'mouseOut'],
[DOMTopLevelEventTypes.TOP_MOUSE_OVER, 'mouseOver'],
[DOMTopLevelEventTypes.TOP_MOUSE_UP, 'mouseUp'],
[DOMTopLevelEventTypes.TOP_PASTE, 'paste'],
[DOMTopLevelEventTypes.TOP_PAUSE, 'pause'],
[DOMTopLevelEventTypes.TOP_PLAY, 'play'],
[DOMTopLevelEventTypes.TOP_PLAYING, 'playing'],
[DOMTopLevelEventTypes.TOP_PROGRESS, 'progress'],
[DOMTopLevelEventTypes.TOP_RATE_CHANGE, 'rateChange'],
[DOMTopLevelEventTypes.TOP_SCROLL, 'scroll'],
[DOMTopLevelEventTypes.TOP_SEEKED, 'seeked'],
[DOMTopLevelEventTypes.TOP_SEEKING, 'seeking'],
[DOMTopLevelEventTypes.TOP_SELECTION_CHANGE, 'selectionChange'],
[DOMTopLevelEventTypes.TOP_STALLED, 'stalled'],
[DOMTopLevelEventTypes.TOP_SUSPEND, 'suspend'],
[DOMTopLevelEventTypes.TOP_TEXT_INPUT, 'textInput'],
[DOMTopLevelEventTypes.TOP_TIME_UPDATE, 'timeUpdate'],
[DOMTopLevelEventTypes.TOP_TOGGLE, 'toggle'],
[DOMTopLevelEventTypes.TOP_TOUCH_CANCEL, 'touchCancel'],
[DOMTopLevelEventTypes.TOP_TOUCH_END, 'touchEnd'],
[DOMTopLevelEventTypes.TOP_TOUCH_MOVE, 'touchMove'],
[DOMTopLevelEventTypes.TOP_TOUCH_START, 'touchStart'],
[DOMTopLevelEventTypes.TOP_TRANSITION_END, 'transitionEnd'],
[DOMTopLevelEventTypes.TOP_VOLUME_CHANGE, 'volumeChange'],
[DOMTopLevelEventTypes.TOP_WAITING, 'waiting'],
[DOMTopLevelEventTypes.TOP_WHEEL, 'wheel'],
].forEach(([topLevelType, eventType]) => {
/**
* @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
ReactTestUtils.SimulateNative[eventType] = makeNativeSimulator(
eventType,
topLevelType,
);
});
export default ReactTestUtils;
|
src/server.js | deslee/deslee-react-flux | /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import 'babel/polyfill';
import _ from 'lodash';
import fs from 'fs';
import path from 'path';
import express from 'express';
import React from 'react';
import './core/Dispatcher';
import './stores/AppStore';
import db from './core/Database';
import App from './components/App';
const server = express();
server.set('port', (process.env.PORT || 5000));
server.use(express.static(path.join(__dirname, 'public')));
//
// Register API middleware
// -----------------------------------------------------------------------------
server.use('/api/query', require('./api/query'));
//
// Register server-side rendering middleware
// -----------------------------------------------------------------------------
// The top-level React component + HTML template for it
const templateFile = path.join(__dirname, 'templates/index.html');
const template = _.template(fs.readFileSync(templateFile, 'utf8'));
server.get('*', async (req, res, next) => {
try {
await db.getPage(req.path).catch(async (err) => {
if (err.code !== 'ENOENT') {
console.error('Error: ', err);
}
await db.getPage('/');
});
let notFound = false;
let css = [];
let data = {description: ''};
let app = (<App
path={req.path}
context={{
onInsertCss: value => css.push(value),
onSetTitle: value => data.title = value,
onSetMeta: (key, value) => data[key] = value,
onPageNotFound: () => notFound = true
}} />);
data.body = React.renderToString(app);
data.css = css.join('');
let html = template(data);
if (notFound) {
res.status(404);
}
res.send(html);
} catch (err) {
next(err);
}
});
//
// Launch the server
// -----------------------------------------------------------------------------
server.listen(server.get('port'), () => {
if (process.send) {
process.send('online');
} else {
console.log('The server is running at http://localhost:' + server.get('port'));
}
});
|
jenkins-design-language/src/js/components/material-ui/svg-icons/social/location-city.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const SocialLocationCity = (props) => (
<SvgIcon {...props}>
<path d="M15 11V5l-3-3-3 3v2H3v14h18V11h-6zm-8 8H5v-2h2v2zm0-4H5v-2h2v2zm0-4H5V9h2v2zm6 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V9h2v2zm0-4h-2V5h2v2zm6 12h-2v-2h2v2zm0-4h-2v-2h2v2z"/>
</SvgIcon>
);
SocialLocationCity.displayName = 'SocialLocationCity';
SocialLocationCity.muiName = 'SvgIcon';
export default SocialLocationCity;
|
src/Context.js | ProAI/react-essentials | import React from 'react';
const Context = React.createContext();
export default Context;
|
pages/blog/test-article-two.js | Code4Newark/newark-viz | /**
* React Static Boilerplate
* https://github.com/koistya/react-static-boilerplate
* Copyright (c) Konstantin Tarkus (@koistya) | MIT license
*/
import React, { Component } from 'react';
export default class extends Component {
render() {
return (
<div>
<h1>Test Article 2</h1>
<p>Coming soon.</p>
</div>
);
}
}
|
src/Grid.js | bbc/react-bootstrap | import React from 'react';
import classNames from 'classnames';
import elementType from 'react-prop-types/lib/elementType';
const Grid = React.createClass({
propTypes: {
/**
* Turn any fixed-width grid layout into a full-width layout by this property.
*
* Adds `container-fluid` class.
*/
fluid: React.PropTypes.bool,
/**
* You can use a custom element for this component
*/
componentClass: elementType
},
getDefaultProps() {
return {
componentClass: 'div',
fluid: false
};
},
render() {
let ComponentClass = this.props.componentClass;
let className = this.props.fluid ? 'container-fluid' : 'container';
return (
<ComponentClass
{...this.props}
className={classNames(this.props.className, className)}>
{this.props.children}
</ComponentClass>
);
}
});
export default Grid;
|
springboot/GReact/src/main/resources/static/app/routes/ui/containers/icons/Glyphicons.js | ezsimple/java | import React from 'react'
import {Stats, BigBreadcrumbs, WidgetGrid, JarvisWidget} from '../../../../components'
export default class Glyphicons extends React.Component {
state = {
search: ''
};
shouldComponentUpdate(nextProps, nextState) {
if (this.state.search != nextState.search) {
let $container = $(this.refs.demoContainer);
if (nextState.search) {
$("li", $container).hide();
$("li .glyphicon", $container)
.filter(function () {
var r = new RegExp(nextState.search, 'i');
return r.test($(this).attr('class') + $(this).attr('alt'))
})
.closest("li").show();
$(".alert, h2", $container).hide()
} else {
$("li", $container).show();
$(".alert, h2", $container).show()
}
}
return true
}
onSearchChange = (value)=> {
this.setState({
search: value
})
};
render() {
return (
<div id="content">
<div className="row">
<BigBreadcrumbs items={['UI Elements', 'Icons', 'Glyph Icons']} icon="fa fa-fw fa-desktop"
className="col-xs-12 col-sm-7 col-md-7 col-lg-4"/>
<Stats />
</div>
{/* widget grid */}
<WidgetGrid>
<div className="well well-sm">
<div className="input-group">
<input className="form-control input-lg"
value={this.state.search}
onChange={event => this.onSearchChange(event.target.value)}
placeholder="Search for an icon..."/>
<span className="input-group-addon"><i className="fa fa-fw fa-lg fa-search"/></span>
</div>
</div>
{/* row */}
{/* row */}
<div className="row">
{/* NEW WIDGET START */}
<article className="col-sm-12">
{/* Widget ID (each widget will need unique ID)*/}
<JarvisWidget colorbutton={false} editbutton={false} togglebutton={false} deletebutton={false}
color="purple">
<header>
<h2>Glyph Icons </h2>
</header>
{/* widget div*/}
<div>
{/* widget content */}
<div className="widget-body" ref='demoContainer'>
<ul className="bs-glyphicons">
<li>
<span className="glyphicon glyphicon-adjust"/>
<span className="glyphicon-class">.glyphicon .glyphicon-adjust</span>
</li>
<li>
<span className="glyphicon glyphicon-align-center"/>
<span className="glyphicon-class">.glyphicon .glyphicon-align-center</span>
</li>
<li>
<span className="glyphicon glyphicon-align-justify"/>
<span className="glyphicon-class">.glyphicon .glyphicon-align-justify</span>
</li>
<li>
<span className="glyphicon glyphicon-align-left"/>
<span className="glyphicon-class">.glyphicon .glyphicon-align-left</span>
</li>
<li>
<span className="glyphicon glyphicon-align-right"/>
<span className="glyphicon-class">.glyphicon .glyphicon-align-right</span>
</li>
<li>
<span className="glyphicon glyphicon-arrow-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-arrow-down</span>
</li>
<li>
<span className="glyphicon glyphicon-arrow-left"/>
<span className="glyphicon-class">.glyphicon .glyphicon-arrow-left</span>
</li>
<li>
<span className="glyphicon glyphicon-arrow-right"/>
<span className="glyphicon-class">.glyphicon .glyphicon-arrow-right</span>
</li>
<li>
<span className="glyphicon glyphicon-arrow-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-arrow-up</span>
</li>
<li>
<span className="glyphicon glyphicon-asterisk"/>
<span className="glyphicon-class">.glyphicon .glyphicon-asterisk</span>
</li>
<li>
<span className="glyphicon glyphicon-backward"/>
<span className="glyphicon-class">.glyphicon .glyphicon-backward</span>
</li>
<li>
<span className="glyphicon glyphicon-ban-circle"/>
<span className="glyphicon-class">.glyphicon .glyphicon-ban-circle</span>
</li>
<li>
<span className="glyphicon glyphicon-barcode"/>
<span className="glyphicon-class">.glyphicon .glyphicon-barcode</span>
</li>
<li>
<span className="glyphicon glyphicon-bell"/>
<span className="glyphicon-class">.glyphicon .glyphicon-bell</span>
</li>
<li>
<span className="glyphicon glyphicon-bold"/>
<span className="glyphicon-class">.glyphicon .glyphicon-bold</span>
</li>
<li>
<span className="glyphicon glyphicon-book"/>
<span className="glyphicon-class">.glyphicon .glyphicon-book</span>
</li>
<li>
<span className="glyphicon glyphicon-bookmark"/>
<span className="glyphicon-class">.glyphicon .glyphicon-bookmark</span>
</li>
<li>
<span className="glyphicon glyphicon-briefcase"/>
<span className="glyphicon-class">.glyphicon .glyphicon-briefcase</span>
</li>
<li>
<span className="glyphicon glyphicon-bullhorn"/>
<span className="glyphicon-class">.glyphicon .glyphicon-bullhorn</span>
</li>
<li>
<span className="glyphicon glyphicon-calendar"/>
<span className="glyphicon-class">.glyphicon .glyphicon-calendar</span>
</li>
<li>
<span className="glyphicon glyphicon-camera"/>
<span className="glyphicon-class">.glyphicon .glyphicon-camera</span>
</li>
<li>
<span className="glyphicon glyphicon-certificate"/>
<span className="glyphicon-class">.glyphicon .glyphicon-certificate</span>
</li>
<li>
<span className="glyphicon glyphicon-check"/>
<span className="glyphicon-class">.glyphicon .glyphicon-check</span>
</li>
<li>
<span className="glyphicon glyphicon-chevron-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-chevron-down</span>
</li>
<li>
<span className="glyphicon glyphicon-chevron-left"/>
<span className="glyphicon-class">.glyphicon .glyphicon-chevron-left</span>
</li>
<li>
<span className="glyphicon glyphicon-chevron-right"/>
<span className="glyphicon-class">.glyphicon .glyphicon-chevron-right</span>
</li>
<li>
<span className="glyphicon glyphicon-chevron-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-chevron-up</span>
</li>
<li>
<span className="glyphicon glyphicon-circle-arrow-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-circle-arrow-down</span>
</li>
<li>
<span className="glyphicon glyphicon-circle-arrow-left"/>
<span className="glyphicon-class">.glyphicon .glyphicon-circle-arrow-left</span>
</li>
<li>
<span className="glyphicon glyphicon-circle-arrow-right"/>
<span className="glyphicon-class">.glyphicon .glyphicon-circle-arrow-right</span>
</li>
<li>
<span className="glyphicon glyphicon-circle-arrow-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-circle-arrow-up</span>
</li>
<li>
<span className="glyphicon glyphicon-cloud"/>
<span className="glyphicon-class">.glyphicon .glyphicon-cloud</span>
</li>
<li>
<span className="glyphicon glyphicon-cloud-download"/>
<span className="glyphicon-class">.glyphicon .glyphicon-cloud-download</span>
</li>
<li>
<span className="glyphicon glyphicon-cloud-upload"/>
<span className="glyphicon-class">.glyphicon .glyphicon-cloud-upload</span>
</li>
<li>
<span className="glyphicon glyphicon-cog"/>
<span className="glyphicon-class">.glyphicon .glyphicon-cog</span>
</li>
<li>
<span className="glyphicon glyphicon-collapse-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-collapse-down</span>
</li>
<li>
<span className="glyphicon glyphicon-collapse-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-collapse-up</span>
</li>
<li>
<span className="glyphicon glyphicon-comment"/>
<span className="glyphicon-class">.glyphicon .glyphicon-comment</span>
</li>
<li>
<span className="glyphicon glyphicon-compressed"/>
<span className="glyphicon-class">.glyphicon .glyphicon-compressed</span>
</li>
<li>
<span className="glyphicon glyphicon-copyright-mark"/>
<span className="glyphicon-class">.glyphicon .glyphicon-copyright-mark</span>
</li>
<li>
<span className="glyphicon glyphicon-credit-card"/>
<span className="glyphicon-class">.glyphicon .glyphicon-credit-card</span>
</li>
<li>
<span className="glyphicon glyphicon-cutlery"/>
<span className="glyphicon-class">.glyphicon .glyphicon-cutlery</span>
</li>
<li>
<span className="glyphicon glyphicon-dashboard"/>
<span className="glyphicon-class">.glyphicon .glyphicon-dashboard</span>
</li>
<li>
<span className="glyphicon glyphicon-download"/>
<span className="glyphicon-class">.glyphicon .glyphicon-download</span>
</li>
<li>
<span className="glyphicon glyphicon-download-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-download-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-earphone"/>
<span className="glyphicon-class">.glyphicon .glyphicon-earphone</span>
</li>
<li>
<span className="glyphicon glyphicon-edit"/>
<span className="glyphicon-class">.glyphicon .glyphicon-edit</span>
</li>
<li>
<span className="glyphicon glyphicon-eject"/>
<span className="glyphicon-class">.glyphicon .glyphicon-eject</span>
</li>
<li>
<span className="glyphicon glyphicon-envelope"/>
<span className="glyphicon-class">.glyphicon .glyphicon-envelope</span>
</li>
<li>
<span className="glyphicon glyphicon-euro"/>
<span className="glyphicon-class">.glyphicon .glyphicon-euro</span>
</li>
<li>
<span className="glyphicon glyphicon-exclamation-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-exclamation-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-expand"/>
<span className="glyphicon-class">.glyphicon .glyphicon-expand</span>
</li>
<li>
<span className="glyphicon glyphicon-export"/>
<span className="glyphicon-class">.glyphicon .glyphicon-export</span>
</li>
<li>
<span className="glyphicon glyphicon-eye-close"/>
<span className="glyphicon-class">.glyphicon .glyphicon-eye-close</span>
</li>
<li>
<span className="glyphicon glyphicon-eye-open"/>
<span className="glyphicon-class">.glyphicon .glyphicon-eye-open</span>
</li>
<li>
<span className="glyphicon glyphicon-facetime-video"/>
<span className="glyphicon-class">.glyphicon .glyphicon-facetime-video</span>
</li>
<li>
<span className="glyphicon glyphicon-fast-backward"/>
<span className="glyphicon-class">.glyphicon .glyphicon-fast-backward</span>
</li>
<li>
<span className="glyphicon glyphicon-fast-forward"/>
<span className="glyphicon-class">.glyphicon .glyphicon-fast-forward</span>
</li>
<li>
<span className="glyphicon glyphicon-file"/>
<span className="glyphicon-class">.glyphicon .glyphicon-file</span>
</li>
<li>
<span className="glyphicon glyphicon-film"/>
<span className="glyphicon-class">.glyphicon .glyphicon-film</span>
</li>
<li>
<span className="glyphicon glyphicon-filter"/>
<span className="glyphicon-class">.glyphicon .glyphicon-filter</span>
</li>
<li>
<span className="glyphicon glyphicon-fire"/>
<span className="glyphicon-class">.glyphicon .glyphicon-fire</span>
</li>
<li>
<span className="glyphicon glyphicon-flag"/>
<span className="glyphicon-class">.glyphicon .glyphicon-flag</span>
</li>
<li>
<span className="glyphicon glyphicon-flash"/>
<span className="glyphicon-class">.glyphicon .glyphicon-flash</span>
</li>
<li>
<span className="glyphicon glyphicon-floppy-disk"/>
<span className="glyphicon-class">.glyphicon .glyphicon-floppy-disk</span>
</li>
<li>
<span className="glyphicon glyphicon-floppy-open"/>
<span className="glyphicon-class">.glyphicon .glyphicon-floppy-open</span>
</li>
<li>
<span className="glyphicon glyphicon-floppy-remove"/>
<span className="glyphicon-class">.glyphicon .glyphicon-floppy-remove</span>
</li>
<li>
<span className="glyphicon glyphicon-floppy-save"/>
<span className="glyphicon-class">.glyphicon .glyphicon-floppy-save</span>
</li>
<li>
<span className="glyphicon glyphicon-floppy-saved"/>
<span className="glyphicon-class">.glyphicon .glyphicon-floppy-saved</span>
</li>
<li>
<span className="glyphicon glyphicon-folder-close"/>
<span className="glyphicon-class">.glyphicon .glyphicon-folder-close</span>
</li>
<li>
<span className="glyphicon glyphicon-folder-open"/>
<span className="glyphicon-class">.glyphicon .glyphicon-folder-open</span>
</li>
<li>
<span className="glyphicon glyphicon-font"/>
<span className="glyphicon-class">.glyphicon .glyphicon-font</span>
</li>
<li>
<span className="glyphicon glyphicon-forward"/>
<span className="glyphicon-class">.glyphicon .glyphicon-forward</span>
</li>
<li>
<span className="glyphicon glyphicon-fullscreen"/>
<span className="glyphicon-class">.glyphicon .glyphicon-fullscreen</span>
</li>
<li>
<span className="glyphicon glyphicon-gbp"/>
<span className="glyphicon-class">.glyphicon .glyphicon-gbp</span>
</li>
<li>
<span className="glyphicon glyphicon-gift"/>
<span className="glyphicon-class">.glyphicon .glyphicon-gift</span>
</li>
<li>
<span className="glyphicon glyphicon-glass"/>
<span className="glyphicon-class">.glyphicon .glyphicon-glass</span>
</li>
<li>
<span className="glyphicon glyphicon-globe"/>
<span className="glyphicon-class">.glyphicon .glyphicon-globe</span>
</li>
<li>
<span className="glyphicon glyphicon-hand-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-hand-down</span>
</li>
<li>
<span className="glyphicon glyphicon-hand-left"/>
<span className="glyphicon-class">.glyphicon .glyphicon-hand-left</span>
</li>
<li>
<span className="glyphicon glyphicon-hand-right"/>
<span className="glyphicon-class">.glyphicon .glyphicon-hand-right</span>
</li>
<li>
<span className="glyphicon glyphicon-hand-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-hand-up</span>
</li>
<li>
<span className="glyphicon glyphicon-hd-video"/>
<span className="glyphicon-class">.glyphicon .glyphicon-hd-video</span>
</li>
<li>
<span className="glyphicon glyphicon-hdd"/>
<span className="glyphicon-class">.glyphicon .glyphicon-hdd</span>
</li>
<li>
<span className="glyphicon glyphicon-header"/>
<span className="glyphicon-class">.glyphicon .glyphicon-header</span>
</li>
<li>
<span className="glyphicon glyphicon-headphones"/>
<span className="glyphicon-class">.glyphicon .glyphicon-headphones</span>
</li>
<li>
<span className="glyphicon glyphicon-heart"/>
<span className="glyphicon-class">.glyphicon .glyphicon-heart</span>
</li>
<li>
<span className="glyphicon glyphicon-heart-empty"/>
<span className="glyphicon-class">.glyphicon .glyphicon-heart-empty</span>
</li>
<li>
<span className="glyphicon glyphicon-home"/>
<span className="glyphicon-class">.glyphicon .glyphicon-home</span>
</li>
<li>
<span className="glyphicon glyphicon-import"/>
<span className="glyphicon-class">.glyphicon .glyphicon-import</span>
</li>
<li>
<span className="glyphicon glyphicon-inbox"/>
<span className="glyphicon-class">.glyphicon .glyphicon-inbox</span>
</li>
<li>
<span className="glyphicon glyphicon-indent-left"/>
<span className="glyphicon-class">.glyphicon .glyphicon-indent-left</span>
</li>
<li>
<span className="glyphicon glyphicon-indent-right"/>
<span className="glyphicon-class">.glyphicon .glyphicon-indent-right</span>
</li>
<li>
<span className="glyphicon glyphicon-info-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-info-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-italic"/>
<span className="glyphicon-class">.glyphicon .glyphicon-italic</span>
</li>
<li>
<span className="glyphicon glyphicon-leaf"/>
<span className="glyphicon-class">.glyphicon .glyphicon-leaf</span>
</li>
<li>
<span className="glyphicon glyphicon-link"/>
<span className="glyphicon-class">.glyphicon .glyphicon-link</span>
</li>
<li>
<span className="glyphicon glyphicon-list"/>
<span className="glyphicon-class">.glyphicon .glyphicon-list</span>
</li>
<li>
<span className="glyphicon glyphicon-list-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-list-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-lock"/>
<span className="glyphicon-class">.glyphicon .glyphicon-lock</span>
</li>
<li>
<span className="glyphicon glyphicon-log-in"/>
<span className="glyphicon-class">.glyphicon .glyphicon-log-in</span>
</li>
<li>
<span className="glyphicon glyphicon-log-out"/>
<span className="glyphicon-class">.glyphicon .glyphicon-log-out</span>
</li>
<li>
<span className="glyphicon glyphicon-magnet"/>
<span className="glyphicon-class">.glyphicon .glyphicon-magnet</span>
</li>
<li>
<span className="glyphicon glyphicon-map-marker"/>
<span className="glyphicon-class">.glyphicon .glyphicon-map-marker</span>
</li>
<li>
<span className="glyphicon glyphicon-minus"/>
<span className="glyphicon-class">.glyphicon .glyphicon-minus</span>
</li>
<li>
<span className="glyphicon glyphicon-minus-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-minus-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-move"/>
<span className="glyphicon-class">.glyphicon .glyphicon-move</span>
</li>
<li>
<span className="glyphicon glyphicon-music"/>
<span className="glyphicon-class">.glyphicon .glyphicon-music</span>
</li>
<li>
<span className="glyphicon glyphicon-new-window"/>
<span className="glyphicon-class">.glyphicon .glyphicon-new-window</span>
</li>
<li>
<span className="glyphicon glyphicon-off"/>
<span className="glyphicon-class">.glyphicon .glyphicon-off</span>
</li>
<li>
<span className="glyphicon glyphicon-ok"/>
<span className="glyphicon-class">.glyphicon .glyphicon-ok</span>
</li>
<li>
<span className="glyphicon glyphicon-ok-circle"/>
<span className="glyphicon-class">.glyphicon .glyphicon-ok-circle</span>
</li>
<li>
<span className="glyphicon glyphicon-ok-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-ok-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-open"/>
<span className="glyphicon-class">.glyphicon .glyphicon-open</span>
</li>
<li>
<span className="glyphicon glyphicon-paperclip"/>
<span className="glyphicon-class">.glyphicon .glyphicon-paperclip</span>
</li>
<li>
<span className="glyphicon glyphicon-pause"/>
<span className="glyphicon-class">.glyphicon .glyphicon-pause</span>
</li>
<li>
<span className="glyphicon glyphicon-pencil"/>
<span className="glyphicon-class">.glyphicon .glyphicon-pencil</span>
</li>
<li>
<span className="glyphicon glyphicon-phone"/>
<span className="glyphicon-class">.glyphicon .glyphicon-phone</span>
</li>
<li>
<span className="glyphicon glyphicon-phone-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-phone-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-picture"/>
<span className="glyphicon-class">.glyphicon .glyphicon-picture</span>
</li>
<li>
<span className="glyphicon glyphicon-plane"/>
<span className="glyphicon-class">.glyphicon .glyphicon-plane</span>
</li>
<li>
<span className="glyphicon glyphicon-play"/>
<span className="glyphicon-class">.glyphicon .glyphicon-play</span>
</li>
<li>
<span className="glyphicon glyphicon-play-circle"/>
<span className="glyphicon-class">.glyphicon .glyphicon-play-circle</span>
</li>
<li>
<span className="glyphicon glyphicon-plus"/>
<span className="glyphicon-class">.glyphicon .glyphicon-plus</span>
</li>
<li>
<span className="glyphicon glyphicon-plus-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-plus-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-print"/>
<span className="glyphicon-class">.glyphicon .glyphicon-print</span>
</li>
<li>
<span className="glyphicon glyphicon-pushpin"/>
<span className="glyphicon-class">.glyphicon .glyphicon-pushpin</span>
</li>
<li>
<span className="glyphicon glyphicon-qrcode"/>
<span className="glyphicon-class">.glyphicon .glyphicon-qrcode</span>
</li>
<li>
<span className="glyphicon glyphicon-question-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-question-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-random"/>
<span className="glyphicon-class">.glyphicon .glyphicon-random</span>
</li>
<li>
<span className="glyphicon glyphicon-record"/>
<span className="glyphicon-class">.glyphicon .glyphicon-record</span>
</li>
<li>
<span className="glyphicon glyphicon-refresh"/>
<span className="glyphicon-class">.glyphicon .glyphicon-refresh</span>
</li>
<li>
<span className="glyphicon glyphicon-registration-mark"/>
<span className="glyphicon-class">.glyphicon .glyphicon-registration-mark</span>
</li>
<li>
<span className="glyphicon glyphicon-remove"/>
<span className="glyphicon-class">.glyphicon .glyphicon-remove</span>
</li>
<li>
<span className="glyphicon glyphicon-remove-circle"/>
<span className="glyphicon-class">.glyphicon .glyphicon-remove-circle</span>
</li>
<li>
<span className="glyphicon glyphicon-remove-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-remove-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-repeat"/>
<span className="glyphicon-class">.glyphicon .glyphicon-repeat</span>
</li>
<li>
<span className="glyphicon glyphicon-resize-full"/>
<span className="glyphicon-class">.glyphicon .glyphicon-resize-full</span>
</li>
<li>
<span className="glyphicon glyphicon-resize-horizontal"/>
<span className="glyphicon-class">.glyphicon .glyphicon-resize-horizontal</span>
</li>
<li>
<span className="glyphicon glyphicon-resize-small"/>
<span className="glyphicon-class">.glyphicon .glyphicon-resize-small</span>
</li>
<li>
<span className="glyphicon glyphicon-resize-vertical"/>
<span className="glyphicon-class">.glyphicon .glyphicon-resize-vertical</span>
</li>
<li>
<span className="glyphicon glyphicon-retweet"/>
<span className="glyphicon-class">.glyphicon .glyphicon-retweet</span>
</li>
<li>
<span className="glyphicon glyphicon-road"/>
<span className="glyphicon-class">.glyphicon .glyphicon-road</span>
</li>
<li>
<span className="glyphicon glyphicon-save"/>
<span className="glyphicon-class">.glyphicon .glyphicon-save</span>
</li>
<li>
<span className="glyphicon glyphicon-saved"/>
<span className="glyphicon-class">.glyphicon .glyphicon-saved</span>
</li>
<li>
<span className="glyphicon glyphicon-screenshot"/>
<span className="glyphicon-class">.glyphicon .glyphicon-screenshot</span>
</li>
<li>
<span className="glyphicon glyphicon-sd-video"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sd-video</span>
</li>
<li>
<span className="glyphicon glyphicon-search"/>
<span className="glyphicon-class">.glyphicon .glyphicon-search</span>
</li>
<li>
<span className="glyphicon glyphicon-send"/>
<span className="glyphicon-class">.glyphicon .glyphicon-send</span>
</li>
<li>
<span className="glyphicon glyphicon-share"/>
<span className="glyphicon-class">.glyphicon .glyphicon-share</span>
</li>
<li>
<span className="glyphicon glyphicon-share-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-share-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-shopping-cart"/>
<span className="glyphicon-class">.glyphicon .glyphicon-shopping-cart</span>
</li>
<li>
<span className="glyphicon glyphicon-signal"/>
<span className="glyphicon-class">.glyphicon .glyphicon-signal</span>
</li>
<li>
<span className="glyphicon glyphicon-sort"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort</span>
</li>
<li>
<span className="glyphicon glyphicon-sort-by-alphabet"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort-by-alphabet</span>
</li>
<li>
<span className="glyphicon glyphicon-sort-by-alphabet-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort-by-alphabet-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-sort-by-attributes"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort-by-attributes</span>
</li>
<li>
<span className="glyphicon glyphicon-sort-by-attributes-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort-by-attributes-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-sort-by-order"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort-by-order</span>
</li>
<li>
<span className="glyphicon glyphicon-sort-by-order-alt"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sort-by-order-alt</span>
</li>
<li>
<span className="glyphicon glyphicon-sound-5-1"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sound-5-1</span>
</li>
<li>
<span className="glyphicon glyphicon-sound-6-1"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sound-6-1</span>
</li>
<li>
<span className="glyphicon glyphicon-sound-7-1"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sound-7-1</span>
</li>
<li>
<span className="glyphicon glyphicon-sound-dolby"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sound-dolby</span>
</li>
<li>
<span className="glyphicon glyphicon-sound-stereo"/>
<span className="glyphicon-class">.glyphicon .glyphicon-sound-stereo</span>
</li>
<li>
<span className="glyphicon glyphicon-star"/>
<span className="glyphicon-class">.glyphicon .glyphicon-star</span>
</li>
<li>
<span className="glyphicon glyphicon-star-empty"/>
<span className="glyphicon-class">.glyphicon .glyphicon-star-empty</span>
</li>
<li>
<span className="glyphicon glyphicon-stats"/>
<span className="glyphicon-class">.glyphicon .glyphicon-stats</span>
</li>
<li>
<span className="glyphicon glyphicon-step-backward"/>
<span className="glyphicon-class">.glyphicon .glyphicon-step-backward</span>
</li>
<li>
<span className="glyphicon glyphicon-step-forward"/>
<span className="glyphicon-class">.glyphicon .glyphicon-step-forward</span>
</li>
<li>
<span className="glyphicon glyphicon-stop"/>
<span className="glyphicon-class">.glyphicon .glyphicon-stop</span>
</li>
<li>
<span className="glyphicon glyphicon-subtitles"/>
<span className="glyphicon-class">.glyphicon .glyphicon-subtitles</span>
</li>
<li>
<span className="glyphicon glyphicon-tag"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tag</span>
</li>
<li>
<span className="glyphicon glyphicon-tags"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tags</span>
</li>
<li>
<span className="glyphicon glyphicon-tasks"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tasks</span>
</li>
<li>
<span className="glyphicon glyphicon-text-height"/>
<span className="glyphicon-class">.glyphicon .glyphicon-text-height</span>
</li>
<li>
<span className="glyphicon glyphicon-text-width"/>
<span className="glyphicon-class">.glyphicon .glyphicon-text-width</span>
</li>
<li>
<span className="glyphicon glyphicon-th"/>
<span className="glyphicon-class">.glyphicon .glyphicon-th</span>
</li>
<li>
<span className="glyphicon glyphicon-th-large"/>
<span className="glyphicon-class">.glyphicon .glyphicon-th-large</span>
</li>
<li>
<span className="glyphicon glyphicon-th-list"/>
<span className="glyphicon-class">.glyphicon .glyphicon-th-list</span>
</li>
<li>
<span className="glyphicon glyphicon-thumbs-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-thumbs-down</span>
</li>
<li>
<span className="glyphicon glyphicon-thumbs-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-thumbs-up</span>
</li>
<li>
<span className="glyphicon glyphicon-time"/>
<span className="glyphicon-class">.glyphicon .glyphicon-time</span>
</li>
<li>
<span className="glyphicon glyphicon-tint"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tint</span>
</li>
<li>
<span className="glyphicon glyphicon-tower"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tower</span>
</li>
<li>
<span className="glyphicon glyphicon-transfer"/>
<span className="glyphicon-class">.glyphicon .glyphicon-transfer</span>
</li>
<li>
<span className="glyphicon glyphicon-trash"/>
<span className="glyphicon-class">.glyphicon .glyphicon-trash</span>
</li>
<li>
<span className="glyphicon glyphicon-tree-conifer"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tree-conifer</span>
</li>
<li>
<span className="glyphicon glyphicon-tree-deciduous"/>
<span className="glyphicon-class">.glyphicon .glyphicon-tree-deciduous</span>
</li>
<li>
<span className="glyphicon glyphicon-unchecked"/>
<span className="glyphicon-class">.glyphicon .glyphicon-unchecked</span>
</li>
<li>
<span className="glyphicon glyphicon-upload"/>
<span className="glyphicon-class">.glyphicon .glyphicon-upload</span>
</li>
<li>
<span className="glyphicon glyphicon-usd"/>
<span className="glyphicon-class">.glyphicon .glyphicon-usd</span>
</li>
<li>
<span className="glyphicon glyphicon-user"/>
<span className="glyphicon-class">.glyphicon .glyphicon-user</span>
</li>
<li>
<span className="glyphicon glyphicon-volume-down"/>
<span className="glyphicon-class">.glyphicon .glyphicon-volume-down</span>
</li>
<li>
<span className="glyphicon glyphicon-volume-off"/>
<span className="glyphicon-class">.glyphicon .glyphicon-volume-off</span>
</li>
<li>
<span className="glyphicon glyphicon-volume-up"/>
<span className="glyphicon-class">.glyphicon .glyphicon-volume-up</span>
</li>
<li>
<span className="glyphicon glyphicon-warning-sign"/>
<span className="glyphicon-class">.glyphicon .glyphicon-warning-sign</span>
</li>
<li>
<span className="glyphicon glyphicon-wrench"/>
<span className="glyphicon-class">.glyphicon .glyphicon-wrench</span>
</li>
<li>
<span className="glyphicon glyphicon-zoom-in"/>
<span className="glyphicon-class">.glyphicon .glyphicon-zoom-in</span>
</li>
<li>
<span className="glyphicon glyphicon-zoom-out"/>
<span className="glyphicon-class">.glyphicon .glyphicon-zoom-out</span>
</li>
</ul>
</div>
{/* end widget content */}
</div>
{/* end widget div */}
</JarvisWidget>
{/* end widget */}
</article>
{/* WIDGET END */}
</div>
</WidgetGrid>
</div>
)
}
} |
docs/app/Examples/elements/Header/Variations/HeaderExampleInverted.js | mohammed88/Semantic-UI-React | import React from 'react'
import { Header, Segment } from 'semantic-ui-react'
const HeaderExampleInverted = () => (
<Segment inverted>
<Header as='h4' inverted color='red'>Red</Header>
<Header as='h4' inverted color='orange'>Orange</Header>
<Header as='h4' inverted color='yellow'>Yellow</Header>
<Header as='h4' inverted color='olive'>Olive</Header>
<Header as='h4' inverted color='green'>Green</Header>
<Header as='h4' inverted color='teal'>Teal</Header>
<Header as='h4' inverted color='blue'>Blue</Header>
<Header as='h4' inverted color='purple'>Purple</Header>
<Header as='h4' inverted color='violet'>Violet</Header>
<Header as='h4' inverted color='pink'>Pink</Header>
<Header as='h4' inverted color='brown'>Brown</Header>
<Header as='h4' inverted color='grey'>Grey</Header>
</Segment>
)
export default HeaderExampleInverted
|
node_modules/react-router/es/IndexRedirect.js | ivanhristov92/bookingCalendar | import React from 'react';
import warning from './routerWarning';
import invariant from 'invariant';
import Redirect from './Redirect';
import { falsy } from './InternalPropTypes';
var _React$PropTypes = React.PropTypes,
string = _React$PropTypes.string,
object = _React$PropTypes.object;
/**
* An <IndexRedirect> is used to redirect from an indexRoute.
*/
/* eslint-disable react/require-render-return */
var IndexRedirect = React.createClass({
displayName: 'IndexRedirect',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = Redirect.createRouteFromReactElement(element);
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'An <IndexRedirect> does not make sense at the root of your route config') : void 0;
}
}
},
propTypes: {
to: string.isRequired,
query: object,
state: object,
onEnter: falsy,
children: falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : invariant(false) : void 0;
}
});
export default IndexRedirect; |
components/animals/kajmanekTrpaslici.child.js | marxsk/zobro | import React, { Component } from 'react';
import { Text } from 'react-native';
import styles from '../../styles/styles';
import InPageImage from '../inPageImage';
import AnimalText from '../animalText';
import AnimalTemplate from '../animalTemplate';
const IMAGES = [
require('../../images/animals/kajmanekTrpaslici/01.jpg'),
require('../../images/animals/kajmanekTrpaslici/02.jpg'),
require('../../images/animals/kajmanekTrpaslici/03.jpg'),
];
const THUMBNAILS = [
require('../../images/animals/kajmanekTrpaslici/01-thumb.jpg'),
require('../../images/animals/kajmanekTrpaslici/02-thumb.jpg'),
require('../../images/animals/kajmanekTrpaslici/03-thumb.jpg'),
];
var AnimalDetail = React.createClass({
render() {
return (
<AnimalTemplate firstIndex={[0]} thumbnails={THUMBNAILS} images={IMAGES} navigator={this.props.navigator}>
<AnimalText>
Vážení a milí, vítám vás u terária kajmánků trpasličích. Jestli si myslíte, že před vámi budou proskakovat obručemi, musím vás zklamat. Když totiž tihle plazi zjistili, jak moc je návštěvníci obdivují, samou radostí strnuli.
</AnimalText>
<AnimalText>
Vypadají skoro jako exponáty v muzeu, viďte? Pojďte si je prohlédnout trochu lépe. Nejprve se podívejte na jejich velikost. Kajmánci trpasličí svojí délkou obyčejně nepřekročí ani 150 cm, což z nich dělá jeden z nejmenších druhů krokodýlů.
</AnimalText>
<InPageImage indexes={[1]} thumbnails={THUMBNAILS} images={IMAGES} navigator={this.props.navigator} />
<AnimalText>
Dále se zaměřte na typické rysy kajmánků, kterými jsou hnědé oční duhovky a zkostnatělá oční víčka, jimž podobná nalezli archeologové jen u některých dinosaurů. Krokodýli kdysi opravdu obývali planetu současně s dinosaury, a proto se jim někdy říká živoucí fosilie. Kajmánci mají dokonce ve svém latinském názvu slovo <Text style={styles.italic}>paleosuchus</Text>, které znamená něco jako prastarý krokodýl.
</AnimalText>
<AnimalText>
Stále zoufáte, že se kajmánci moc nehýbou? Buďte rádi, že máte příležitost je vůbec vidět. V rodné Jižní Americe se často schovávají do podzemních doupat v okolí zalesněných řek a jezer. Sotva byste našli jiný druh krokodýla, který by se tak rád zdržoval jinde než ve vodě.
</AnimalText>
<InPageImage indexes={[2]} thumbnails={THUMBNAILS} images={IMAGES} navigator={this.props.navigator} />
<AnimalText>
Prohlídka terária se pomalu chýlí ke konci. Nezbývá než konstatovat, že přes všechny spojitosti s dinosaury nejsou kajmánci žádné vykopávky. Chovat je doma mohou jen ti nejotrlejší. Na zádech i ocasu se kajmánci vyzbrojili kostěnými šupinami. Když se rozhodnou zaútočit, dost to bolí. Kořist, jíž jsou většinou ryby, polykají celou nebo po velkých kusech. Možná se teď ptáte, proč tady v zoo nesežerou kajmánci piraně, které s nimi sdílí terárium. Odpověď je jednoduchá – piraně jsou moc velké, mrštné a kajmánci pravidelně dostávají o dost lepší pochutiny.
</AnimalText>
</AnimalTemplate>
);
}
});
module.exports = AnimalDetail;
|
src/components/VideoList.js | godfredcs/youtube-project | import React from 'react';
import VideoListItem from './VideoListItem';
const VideoList = (props) => {
const videoItems = props.videos.map(
video => <VideoListItem
key={video.etag}
video={video}
onVideoSelect={props.onVideoSelect}
/>
);
return (
<ul className="col-md-4 list-group">
{ videoItems }
</ul>
);
};
export default VideoList; |
src/components/Footer/index.js | cowback/charcode-client | import React from 'react'
import Panel from 'components/Panel'
import './footer.css'
const Footer = () => (
<Panel
tag="footer"
className="footer"
>
<Panel
tag="section"
className="footer__content"
inset="l"
between="m"
row
justify="space-around"
>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/cowback/ABOUT_US.MD">Sobre nós</a>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/cowback/">GitHub</a>
<a target="_blank" rel="noopener noreferrer" href="https://darksky.net/poweredby/">Powered By DarkSky</a>
</Panel>
</Panel>
)
export default Footer
|
app/javascript/mastodon/components/short_number.js | abcang/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers';
import { FormattedMessage, FormattedNumber } from 'react-intl';
// @ts-check
/**
* @callback ShortNumberRenderer
* @param {JSX.Element} displayNumber Number to display
* @param {number} pluralReady Number used for pluralization
* @returns {JSX.Element} Final render of number
*/
/**
* @typedef {object} ShortNumberProps
* @property {number} value Number to display in short variant
* @property {ShortNumberRenderer} [renderer]
* Custom renderer for numbers, provided as a prop. If another renderer
* passed as a child of this component, this prop won't be used.
* @property {ShortNumberRenderer} [children]
* Custom renderer for numbers, provided as a child. If another renderer
* passed as a prop of this component, this one will be used instead.
*/
/**
* Component that renders short big number to a shorter version
*
* @param {ShortNumberProps} param0 Props for the component
* @returns {JSX.Element} Rendered number
*/
function ShortNumber({ value, renderer, children }) {
const shortNumber = toShortNumber(value);
const [, division] = shortNumber;
// eslint-disable-next-line eqeqeq
if (children != null && renderer != null) {
console.warn('Both renderer prop and renderer as a child provided. This is a mistake and you really should fix that. Only renderer passed as a child will be used.');
}
// eslint-disable-next-line eqeqeq
const customRenderer = children != null ? children : renderer;
const displayNumber = <ShortNumberCounter value={shortNumber} />;
// eslint-disable-next-line eqeqeq
return customRenderer != null
? customRenderer(displayNumber, pluralReady(value, division))
: displayNumber;
}
ShortNumber.propTypes = {
value: PropTypes.number.isRequired,
renderer: PropTypes.func,
children: PropTypes.func,
};
/**
* @typedef {object} ShortNumberCounterProps
* @property {import('../utils/number').ShortNumber} value Short number
*/
/**
* Renders short number into corresponding localizable react fragment
*
* @param {ShortNumberCounterProps} param0 Props for the component
* @returns {JSX.Element} FormattedMessage ready to be embedded in code
*/
function ShortNumberCounter({ value }) {
const [rawNumber, unit, maxFractionDigits = 0] = value;
const count = (
<FormattedNumber
value={rawNumber}
maximumFractionDigits={maxFractionDigits}
/>
);
let values = { count, rawNumber };
switch (unit) {
case DECIMAL_UNITS.THOUSAND: {
return (
<FormattedMessage
id='units.short.thousand'
defaultMessage='{count}K'
values={values}
/>
);
}
case DECIMAL_UNITS.MILLION: {
return (
<FormattedMessage
id='units.short.million'
defaultMessage='{count}M'
values={values}
/>
);
}
case DECIMAL_UNITS.BILLION: {
return (
<FormattedMessage
id='units.short.billion'
defaultMessage='{count}B'
values={values}
/>
);
}
// Not sure if we should go farther - @Sasha-Sorokin
default: return count;
}
}
ShortNumberCounter.propTypes = {
value: PropTypes.arrayOf(PropTypes.number),
};
export default React.memo(ShortNumber);
|
app/components/POReqTransButton.js | robogroves/Ashley | import ProgressButton from 'react-progress-button'
import React, { Component } from 'react';
const POReqTransButton = React.createClass({
getInitialState () {
return {
buttonState: ''
}
},
render () {
if ('development'==process.env.NODE_ENV) {
console.log('button render =' + this.props.POReqTrans.goButton);
}
return (
<div>
<ProgressButton onClick={this.handleClick}
state={this.props.POReqTrans.goButton}>
Go!
</ProgressButton>
</div>
)
},
handleClick () {
if ('development'==process.env.NODE_ENV) {
console.log('handleClick');
}
this.props.startPORT(true);
// make asynchronous call
// setTimeout(function() {
// POReqTrans.call(this);
// // this.props.setCheck1('failure');
// // this.setState({buttonState: 'success'})
// }.bind(this), 3000)
}
})
export default POReqTransButton; |
plugins/react/frontend/components/controls/advanced/IntegerControl/index.js | carteb/carte-blanche | /**
* IntegerControl
*
* Renders an input which allows you to modify a certain property of type integer
*/
import React from 'react';
import ConstraintsForm from './ConstraintsForm';
import randomValue from './randomValue';
import Row from '../../../form/Grid/Row';
import LeftColumn from '../../../form/Grid/LeftColumn';
import RightColumn from '../../../form/Grid/RightColumn';
import CarteBlancheInput from '../../../form/CarteBlancheInput';
import Label from '../../../form/Label';
import isUndefined from 'lodash/isUndefined';
import isNull from 'lodash/isNull';
const IntegerControl = (props) => {
const {
label,
value,
onUpdate,
secondaryLabel,
nestedLevel,
required,
customMetaData = {},
} = props;
const onChange = (data) => {
const val = data.value;
const parsedValue = isUndefined(val) || isNull(val) ? val : parseInt(val, 10);
onUpdate({ value: parsedValue });
};
return (
<Row>
<LeftColumn nestedLevel={nestedLevel}>
<Label
type={secondaryLabel}
propKey={label}
/>
</LeftColumn>
<RightColumn>
<div style={{ padding: '0 0.5rem' }}>
<CarteBlancheInput
value={value}
fallbackValue={0}
onChange={onChange}
hasRandomButton
hasSettings={!required}
type="number"
onRandomButtonClick={() => onUpdate({
value: IntegerControl.randomValue({
...props,
constraints: customMetaData.constraints,
}),
})}
/>
</div>
</RightColumn>
</Row>
);
};
/**
* Generates a random integer
*/
IntegerControl.randomValue = randomValue;
/**
* The form to manage the types of the constraints.
*/
IntegerControl.ConstraintsForm = ConstraintsForm;
export default IntegerControl;
|
docs/src/app/components/pages/components/RadioButton/Page.js | xmityaz/material-ui | import React from 'react';
import Title from 'react-title-component';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';
import radioButtonReadmeText from './README';
import RadioButtonExampleSimple from './ExampleSimple';
import radioButtonExampleSimpleCode from '!raw!./ExampleSimple';
import radioButtonCode from '!raw!material-ui/RadioButton/RadioButton';
import radioButtonGroupCode from '!raw!material-ui/RadioButton/RadioButtonGroup';
const description = 'The second button is selected by default using the `defaultSelected` property of ' +
'`RadioButtonGroup`. The third button is disabled using the `disabled` property of `RadioButton`. The final ' +
'example uses the `labelPosition` property to position the label on the left. ';
const RadioButtonPage = () => (
<div>
<Title render={(previousTitle) => `Radio Button - ${previousTitle}`} />
<MarkdownElement text={radioButtonReadmeText} />
<CodeExample
title="Examples"
description={description}
code={radioButtonExampleSimpleCode}
>
<RadioButtonExampleSimple />
</CodeExample>
<PropTypeDescription header="### RadioButton Properties" code={radioButtonCode} />
<PropTypeDescription header="### RadioButtonGroup Properties" code={radioButtonGroupCode} />
</div>
);
export default RadioButtonPage;
|
docs/app/Examples/collections/Message/States/MessageHiddenExample.js | jamiehill/stardust | import React from 'react'
import { Message } from 'stardust'
const MessageHiddenExample = () => (
<Message hidden>
You can always see me
</Message>
)
export default MessageHiddenExample
|
src/components/bitbucket/original-wordmark/BitbucketOriginalWordmark.js | fpoumian/react-devicon | import React from 'react'
import PropTypes from 'prop-types'
import SVGDeviconInline from '../../_base/SVGDeviconInline'
import iconSVG from './BitbucketOriginalWordmark.svg'
/** BitbucketOriginalWordmark */
function BitbucketOriginalWordmark({ width, height, className }) {
return (
<SVGDeviconInline
className={'BitbucketOriginalWordmark' + ' ' + className}
iconSVG={iconSVG}
width={width}
height={height}
/>
)
}
BitbucketOriginalWordmark.propTypes = {
className: PropTypes.string,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}
export default BitbucketOriginalWordmark
|
admin/client/App/screens/List/components/ListControl.js | everisARQ/keystone | import React from 'react';
import classnames from 'classnames';
var ListControl = React.createClass({
propTypes: {
dragSource: React.PropTypes.func,
onClick: React.PropTypes.func,
type: React.PropTypes.oneOf(['check', 'delete', 'sortable']).isRequired,
},
renderControl () {
var icon = 'octicon octicon-';
var className = classnames('ItemList__control ItemList__control--' + this.props.type, {
'is-active': this.props.active,
});
var tabindex = this.props.type === 'sortable' ? -1 : null;
if (this.props.type === 'check') {
icon += 'check';
}
if (this.props.type === 'delete') {
icon += 'trashcan';
}
if (this.props.type === 'sortable') {
icon += 'three-bars';
}
var renderButton = (
<button type="button" onClick={this.props.onClick} className={className} tabIndex={tabindex}>
<span className={icon} />
</button>
);
if (this.props.dragSource) {
return this.props.dragSource(renderButton);
} else {
return renderButton;
}
},
render () {
var className = 'ItemList__col--control ItemList__col--' + this.props.type;
return (
<td className={className}>
{this.renderControl()}
</td>
);
},
});
module.exports = ListControl;
|
src/styles/icons.js | tallessa/tallessa-frontend | import React from 'react';
import DevicesOtherIcon from 'material-ui-icons/DevicesOther';
import PlaceIcon from 'material-ui-icons/Place';
import MoveToInboxIcon from 'material-ui-icons/MoveToInbox';
const icons = {
stuff: <DevicesOtherIcon />,
places: <PlaceIcon />,
loans: <MoveToInboxIcon />,
};
export default icons;
|
code/workspaces/web-app/src/containers/adminListUsers/Sites.js | NERC-CEH/datalab | import React from 'react';
import ResourceStackCards from './ResourceStackCards';
import { SITE_TYPE_NAME, SITE_TYPE_NAME_PLURAL } from '../sites/siteTypeName';
function Sites({ sites }) {
return (
<ResourceStackCards resources={sites} typeName={SITE_TYPE_NAME} typeNamePlural={SITE_TYPE_NAME_PLURAL} />
);
}
export default Sites;
|
src/parser/paladin/holy/modules/Overhealing.js | fyruna/WoWAnalyzer | import React from 'react';
import { Trans, t } from '@lingui/macro';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import { formatPercentage } from 'common/format';
import { i18n } from 'interface/RootLocalizationProvider';
import Analyzer from 'parser/core/Analyzer';
import AbilityTracker from 'parser/shared/modules/AbilityTracker';
import HealingDone from 'parser/shared/modules/throughput/HealingDone';
import DivinePurpose from './talents/DivinePurpose';
class Overhealing extends Analyzer {
static dependencies = {
abilityTracker: AbilityTracker,
healingDone: HealingDone,
divinePurpose: DivinePurpose,
};
getRawHealing(ability) {
return ability.healingEffective + ability.healingAbsorbed + ability.healingOverheal;
}
getOverhealingPercentage(spellId) {
const ability = this.abilityTracker.getAbility(spellId);
return ability.healingOverheal / this.getRawHealing(ability);
}
get lightOfDawnOverhealing() {
return this.getOverhealingPercentage(SPELLS.LIGHT_OF_DAWN_HEAL.id);
}
get lightOfDawnSuggestionThresholds() {
const base = this.divinePurpose.active ? 0.45 : 0.4;
return {
actual: this.lightOfDawnOverhealing,
isGreaterThan: {
minor: base,
average: base + 0.1,
major: base + 0.2,
},
style: 'percentage',
};
}
get holyShockOverhealing() {
return this.getOverhealingPercentage(SPELLS.HOLY_SHOCK_HEAL.id);
}
get holyShockSuggestionThresholds() {
const base = this.divinePurpose.active ? 0.4 : 0.35;
return {
actual: this.holyShockOverhealing,
isGreaterThan: {
minor: base,
average: base + 0.1,
major: base + 0.2,
},
style: 'percentage',
};
}
get flashOfLightOverhealing() {
return this.getOverhealingPercentage(SPELLS.FLASH_OF_LIGHT.id);
}
get flashOfLightSuggestionThresholds() {
return {
actual: this.flashOfLightOverhealing,
isGreaterThan: {
minor: 0.25,
average: 0.4,
major: 0.5,
},
style: 'percentage',
};
}
get bestowFaithOverhealing() {
return this.getOverhealingPercentage(SPELLS.BESTOW_FAITH_TALENT.id);
}
get bestowFaithSuggestionThresholds() {
return {
actual: this.bestowFaithOverhealing,
isGreaterThan: {
minor: 0.4,
average: 0.5,
major: 0.6,
},
style: 'percentage',
};
}
suggestions(when) {
when(this.lightOfDawnSuggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(
<Trans>
Try to avoid overhealing with <SpellLink id={SPELLS.LIGHT_OF_DAWN_CAST.id} />. Save it for when people are missing health.
</Trans>
)
.icon(SPELLS.LIGHT_OF_DAWN_CAST.icon)
.actual(i18n._(t`${formatPercentage(actual)}% overhealing`))
.recommended(i18n._(t`<${formatPercentage(recommended)}% is recommended`));
});
when(this.holyShockSuggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(
<Trans>
Try to avoid overhealing with <SpellLink id={SPELLS.HOLY_SHOCK_CAST.id} />. Save it for when people are missing health.
</Trans>
)
.icon(SPELLS.HOLY_SHOCK_HEAL.icon)
.actual(i18n._(t`${formatPercentage(actual)}% overhealing`))
.recommended(i18n._(t`<${formatPercentage(recommended)}% is recommended`));
});
when(this.flashOfLightSuggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(
<Trans>
Try to avoid overhealing with <SpellLink id={SPELLS.FLASH_OF_LIGHT.id} />. If Flash of Light would overheal it is generally advisable to cast a <SpellLink id={SPELLS.HOLY_LIGHT.id} /> instead.
</Trans>
)
.icon(SPELLS.FLASH_OF_LIGHT.icon)
.actual(i18n._(t`${formatPercentage(actual)}% overhealing`))
.recommended(i18n._(t`<${formatPercentage(recommended)}% is recommended`));
});
when(this.bestowFaithSuggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(
<Trans>
Try to avoid overhealing with <SpellLink id={SPELLS.BESTOW_FAITH_TALENT.id} />. Cast it just before someone is about to take damage and consider casting it on targets other than tanks.
</Trans>
)
.icon(SPELLS.BESTOW_FAITH_TALENT.icon)
.actual(i18n._(t`${formatPercentage(actual)}% overhealing`))
.recommended(i18n._(t`<${formatPercentage(recommended)}% is recommended`));
});
}
}
export default Overhealing;
|
webpack/fills_index.js | mccun934/katello | import React from 'react';
import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
import { registerReducer } from 'foremanReact/common/MountingService';
import SystemStatuses from './components/extensions/about';
import extendReducer from './components/extensions/reducers';
registerReducer('katelloExtends', extendReducer);
addGlobalFill('aboutFooterSlot', '[katello]AboutSystemStatuses', <SystemStatuses key="katello-system-statuses" />, 100);
|
src/pages/documentation/template/index.js | Vision100IT/v100it-template | import React from 'react';
import PropTypes from 'prop-types';
import fm from 'front-matter';
import classNames from 'classnames';
import {StickyContainer, Sticky} from 'react-sticky';
import reformed from 'react-reformed';
import compose from 'react-reformed/lib/compose';
import validateSchema from 'react-reformed/lib/validateSchema';
import FaAngleDown from 'react-icons/lib/fa/angle-down';
import Popover from '../../../components/popover';
import Index from '../../../components';
import {Markdown, Toc} from '../../../components/markdown';
import {Form, util, InputEmail, InputTextArea} from '../../../components/form';
import styles from './template.scss';
const documentation = {
get context() {
return require.context('../../../documentation', true, /^.*\.md$/);
},
get documents() {
return this.context.keys();
},
document(id) {
const doc = this.context(this.documents.find(x => x === `./${id}.md`));
const {body, attributes} = fm(doc);
return {body, ...attributes};
}
};
const fields = {
message: {
component: InputTextArea,
rows: '2',
label: 'Message',
placeholder: 'What could make this documentation clearer?',
required: true
},
email: {
component: InputEmail,
label: 'Contact email',
placeholder: 'Contact email',
required: true
}
};
class DocumentationFeedbackFrom extends React.Component {
handleSubmit = event => {
event.preventDefault();
this.props.onSubmit(this.props.model);
};
render() {
const {
bindInput,
schema,
onToggleFeedback
} = this.props;
return (
<div className={styles.form}>
<Form schema={schema} fields={fields} bindInput={bindInput} onSubmit={this.handleSubmit}>
<div className="form-group">
<button type="submit" className="btn btn-default">Submit</button>
<button type="cancel" className="btn btn-default" onClick={onToggleFeedback}>Cancel</button>
</div>
</Form>
</div>
);
}
}
DocumentationFeedbackFrom.propTypes = {
bindInput: PropTypes.func.isRequired,
model: PropTypes.object.isRequired,
onSubmit: PropTypes.func.isRequired,
schema: PropTypes.object.isRequired,
onToggleFeedback: PropTypes.func.isRequired
};
const DocumentationFeedbackFromContainer = compose(reformed(), validateSchema(fields), util.submitted)(DocumentationFeedbackFrom);
class Template extends React.Component {
constructor(props) {
super(props);
this.state = {
openFeedback: false,
isModalOpen: false
};
this.setFormRef = this.setFormRef.bind(this);
this.handleOpen = this.handleOpen.bind(this);
this.handleClose = this.handleClose.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleToggleFeedback = this.handleToggleFeedback.bind(this);
}
get document() {
return documentation.document(this.props.match.params.documentId) || {};
}
set formRef(ref) {
this._formRef = ref;
}
get formRef() {
return this._formRef;
}
setFormRef(ref) {
this.formRef = ref;
}
handleOpen() {
this.setState({isModalOpen: true});
}
handleClose() {
this.setState({isModalOpen: false});
this.formRef.resetModel();
}
handleSubmit(model) {
return fetch('https://serverless.newfrontdoor.org/give-feedback', {
method: 'post',
mode: 'cors',
body: JSON.stringify({
url: window.location.toString(),
email: model.email,
message: model.message
}),
headers: new Headers({
'Content-Type': 'application/json'
})
}).catch(this.handleOpen).then(this.handleOpen);
}
handleToggleFeedback(event) {
event.preventDefault();
this.setState({
openFeedback: !this.state.openFeedback
});
}
render() {
const {isModalOpen} = this.state;
const docTOC = classNames(styles.toc, {
[styles.tocVisible]: !this.state.openFeedback
});
const docFeedback = classNames(styles.feedback, {
[styles.feedbackVisible]: this.state.openFeedback
});
return (
<Index>
<StickyContainer>
<div className={styles.wrapper}>
<div className={styles.content}>
<h1>{this.document.title}</h1>
<h1>
<small>{this.document.sub_title}</small>
</h1>
<Markdown>
{this.document.body}
</Markdown>
</div>
<div className={styles.sidebar}>
<Sticky topOffset={-144} bottomOffset={168}>
{
({style}) => (
<div style={{marginTop: 144, ...style}}>
<div className={docTOC}>
<h3>Contents</h3>
<Toc>
{this.document.body}
</Toc>
</div>
<div className={docFeedback}>
{this.state.openFeedback ? (
<DocumentationFeedbackFromContainer getFormRef={this.setFormRef} onSubmit={this.handleSubmit} onToggleFeedback={this.handleToggleFeedback}/>
) : (
<span>
<h3>Give feedback</h3>
<a href="#" onClick={this.handleToggleFeedback}>
<span>Suggest a revision to this document.</span>
<FaAngleDown height="1.5em" width="1.5em"/>
</a>
</span>
)}
</div>
</div>
)
}
</Sticky>
</div>
</div>
</StickyContainer>
{isModalOpen && (
<Popover onClose={this.handleClose}>
<div className={styles.modal}>
<h2>Thanks for your feedback.</h2>
<p>We’ll review what you’ve submitted and make edits as required. We’ll let you know via email when we’ve processed the revision of this document.</p>
<p><button className={styles.button} onClick={this.handleClose}>Great</button></p>
</div>
</Popover>
)}
</Index>
);
}
}
Template.propTypes = {
match: PropTypes.shape({
params: PropTypes.shape({
documentId: PropTypes.string.isRequired
}).isRequired
}).isRequired
};
export default Template;
|
src/Components/AvailableCharacters.js | jefferydutra/TestableModularReactTalk | import React from 'react';
import AvailableCharacter from './HeroCard';
import isFavoriteCharacter from '../isFavoriteCharacter';
function addToFavoriteWithCharacter(addToFavorite, character) {
return () => addToFavorite(character);
}
function renderCharacter(character, addToFavoriteCharacters, myFavoriteCharacters) {
return (
<AvailableCharacter
key={character.name}
isFavorite={isFavoriteCharacter(myFavoriteCharacters, character)}
addToFavoriteCharacters={addToFavoriteWithCharacter(addToFavoriteCharacters, character)}
character={character}
/>
);
}
const AvailableCharacters = ({ availableCharacters, addToFavoriteCharacters, myFavoriteCharacters }) =>
<div className="heroMenu">
{availableCharacters.map(character => renderCharacter(
character,
addToFavoriteCharacters,
myFavoriteCharacters))}
</div>;
AvailableCharacters.propTypes = {
availableCharacters: React.PropTypes.array.isRequired,
myFavoriteCharacters: React.PropTypes.object.isRequired,
addToFavoriteCharacters: React.PropTypes.func.isRequired
};
export default AvailableCharacters;
|
source/components/GeographySelector.js | PitchInteractiveInc/hexagon-cartograms | import React from 'react'
import GeographyResource from '../resources/GeographyResource'
export default function GeographySelector(props) {
const selectGeography = (event) => {
props.selectGeography(event.target.value)
}
const options = GeographyResource.getGeographies().map((geography, geographyIndex) => {
return (
<option
key={geographyIndex}
value={geography.label}
>
{geography.label}
</option>
)
})
return (
<div className='geographySelector'>
Select base map
<fieldset>
<select onChange={selectGeography}>
{options}
</select>
</fieldset>
</div>
)
}
GeographySelector.propTypes = {
selectedGeography: React.PropTypes.string,
selectGeography: React.PropTypes.func,
}
|
app/containers/SelectMinorAbilitiesTableStep.js | mzanini/DeeMemory | import React from 'react'
import MinorAbilitiesTableSelector from './MinorAbilitiesTableSelector'
import TableSelectStep from '../components/TableSelectStep'
import CurrentMinorAbilitiesTable from './CurrentMinorAbilitiesTable'
const SelectMinorAbilitiesTableStep = () => (
<TableSelectStep helpText = 'Please select the file that contains the minor abilities you want to import'>
<MinorAbilitiesTableSelector/>
<CurrentMinorAbilitiesTable/>
</TableSelectStep>
)
export default SelectMinorAbilitiesTableStep
|
devtools/src/lib.js | clarus/redux-ship-devtools | // @flow
import React from 'react';
import ReactDOM from 'react-dom';
import * as Ship from 'redux-ship';
import * as Controller from './controller';
import Index from './view';
import store from './store';
type Control<Action, Effect, Commit, State> =
(action: Action) => Ship.Ship<Effect, Commit, State, void>;
export function mount<Action, Effect, Commit, State>(
domId: string
): (control: Control<Action, Effect, Commit, State>) => Control<Action, Effect, Commit, State> {
function dispatch(action: Controller.Action): void {
Ship.run(() => {}, store, Controller.control(action));
}
function render() {
ReactDOM.render(
React.createElement(Index, {dispatch, state: store.getState()}),
document.getElementById(domId)
);
}
store.subscribe(render);
render();
return control => function* (action) {
const {snapshot} = yield* Ship.snap(control(action));
dispatch({
type: 'AddLog',
action,
snapshot,
});
};
}
|
src/svg-icons/content/add-circle-outline.js | barakmitz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ContentAddCircleOutline = (props) => (
<SvgIcon {...props}>
<path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
</SvgIcon>
);
ContentAddCircleOutline = pure(ContentAddCircleOutline);
ContentAddCircleOutline.displayName = 'ContentAddCircleOutline';
ContentAddCircleOutline.muiName = 'SvgIcon';
export default ContentAddCircleOutline;
|
src/admin/components/Motd/index.js | welovekpop/uwave-web-welovekpop.club | import React from 'react';
import PropTypes from 'prop-types';
import compose from 'recompose/compose';
import withState from 'recompose/withState';
import withProps from 'recompose/withProps';
import withHandlers from 'recompose/withHandlers';
import Card from '@material-ui/core/Card';
import CardHeader from '@material-ui/core/CardHeader';
import CardContent from '@material-ui/core/CardContent';
import CardActions from '@material-ui/core/CardActions';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import Collapse from '@material-ui/core/Collapse';
import EditIcon from '@material-ui/icons/Edit';
import parse from 'u-wave-parse-chat-markup';
import compile from '../../../components/Chat/Markup/compile';
const enhance = compose(
withState('newMotd', 'setMotd', ({ motd }) => motd),
withState('expanded', 'setExpanded', false),
withProps((props) => {
const {
newMotd, compileOptions, expanded, setExpanded,
} = props;
return {
parsedMotd: compile(parse(newMotd), compileOptions),
onExpand: () => setExpanded(!expanded),
};
}),
withHandlers({
onChange: ({ setMotd }) => (event) => {
setMotd(event.target.value);
},
onSubmit: props => (event) => {
const { onSetMotd, newMotd, setExpanded } = props;
event.preventDefault();
onSetMotd(newMotd);
setExpanded(false);
},
}),
);
function autoFocus(el) {
if (el) el.focus();
}
const Motd = ({
canChangeMotd,
newMotd,
parsedMotd,
expanded,
onChange,
onSubmit,
onExpand,
}) => (
<Card className="AdminMotd">
<CardHeader
title="Message of the Day"
action={canChangeMotd && (
<IconButton onClick={onExpand}>
<EditIcon />
</IconButton>
)}
/>
<CardContent>{parsedMotd}</CardContent>
<Collapse in={expanded} unmountOnExit>
<form onSubmit={onSubmit}>
<CardContent style={{ paddingTop: 0 }}>
<textarea
className="AdminMotd-field"
rows={4}
onChange={onChange}
value={newMotd}
ref={autoFocus}
/>
</CardContent>
<CardActions>
<Button
type="submit"
variant="raised"
color="primary"
>
Save
</Button>
</CardActions>
</form>
</Collapse>
</Card>
);
Motd.propTypes = {
canChangeMotd: PropTypes.bool,
newMotd: PropTypes.string.isRequired,
parsedMotd: PropTypes.array.isRequired,
expanded: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onExpand: PropTypes.func.isRequired,
};
Motd.defaultProps = {
canChangeMotd: false,
};
export default enhance(Motd);
|
src/RootContainer/index.js | DarthVictor/bank-chat | import { Provider } from 'react-redux'
import React from 'react'
import App from '../App'
import store from '../store'
export default class RootContainer extends React.Component {
render() {
return <Provider store={store}>
<App></App>
</Provider>
}
} |
step9-redux/node_modules/react-router/es6/Link.js | jintoppy/react-training | 'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import warning from './routerWarning';
var _React$PropTypes = React.PropTypes;
var bool = _React$PropTypes.bool;
var object = _React$PropTypes.object;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
var oneOfType = _React$PropTypes.oneOfType;
function isLeftClickEvent(event) {
return event.button === 0;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
function isEmptyObject(object) {
for (var p in object) {
if (object.hasOwnProperty(p)) return false;
}return true;
}
function createLocationDescriptor(to, _ref) {
var query = _ref.query;
var hash = _ref.hash;
var state = _ref.state;
if (query || hash || state) {
return { pathname: to, query: query, hash: hash, state: state };
}
return to;
}
/**
* A <Link> is used to create an <a> element that links to a route.
* When that route is active, the link gets the value of its
* activeClassName prop.
*
* For example, assuming you have the following route:
*
* <Route path="/posts/:postID" component={Post} />
*
* You could use the following component to link to that route:
*
* <Link to={`/posts/${post.id}`} />
*
* Links may pass along location state and/or query string parameters
* in the state/query props, respectively.
*
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
*/
var Link = React.createClass({
displayName: 'Link',
contextTypes: {
router: object
},
propTypes: {
to: oneOfType([string, object]).isRequired,
query: object,
hash: string,
state: object,
activeStyle: object,
activeClassName: string,
onlyActiveOnIndex: bool.isRequired,
onClick: func
},
getDefaultProps: function getDefaultProps() {
return {
onlyActiveOnIndex: false,
className: '',
style: {}
};
},
handleClick: function handleClick(event) {
var allowTransition = true;
if (this.props.onClick) this.props.onClick(event);
if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
if (event.defaultPrevented === true) allowTransition = false;
// If target prop is set (e.g. to "_blank") let browser handle link.
/* istanbul ignore if: untestable with Karma */
if (this.props.target) {
if (!allowTransition) event.preventDefault();
return;
}
event.preventDefault();
if (allowTransition) {
var _props = this.props;
var to = _props.to;
var query = _props.query;
var hash = _props.hash;
var state = _props.state;
var _location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
this.context.router.push(_location);
}
},
render: function render() {
var _props2 = this.props;
var to = _props2.to;
var query = _props2.query;
var hash = _props2.hash;
var state = _props2.state;
var activeClassName = _props2.activeClassName;
var activeStyle = _props2.activeStyle;
var onlyActiveOnIndex = _props2.onlyActiveOnIndex;
var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
process.env.NODE_ENV !== 'production' ? warning(!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : undefined;
// Ignore if rendered outside the context of router, simplifies unit testing.
var router = this.context.router;
if (router) {
var _location2 = createLocationDescriptor(to, { query: query, hash: hash, state: state });
props.href = router.createHref(_location2);
if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
if (router.isActive(_location2, onlyActiveOnIndex)) {
if (activeClassName) props.className += props.className === '' ? activeClassName : ' ' + activeClassName;
if (activeStyle) props.style = _extends({}, props.style, activeStyle);
}
}
}
return React.createElement('a', _extends({}, props, { onClick: this.handleClick }));
}
});
export default Link; |
actor-apps/app-web/src/app/components/activity/UserProfileContactInfo.react.js | boyley/actor-platform | import _ from 'lodash';
import React from 'react';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
const {addons: { PureRenderMixin }} = addons;
@ReactMixin.decorate(PureRenderMixin)
class UserProfileContactInfo extends React.Component {
static propTypes = {
phones: React.PropTypes.array
};
constructor(props) {
super(props);
}
render() {
let phones = this.props.phones;
let contactPhones = _.map(phones, (phone, i) => {
return (
<li className="profile__list__item row" key={i}>
<i className="material-icons">call</i>
<div className="col-xs">
<span className="contact">+{phone.number}</span>
<span className="title">{phone.title}</span>
</div>
</li>
);
});
return (
<ul className="profile__list profile__list--contacts">
{contactPhones}
</ul>
);
}
}
export default UserProfileContactInfo;
|
cdap-ui/app/cdap/services/WizardConfigs/UploadDataWizardConfig.js | caskdata/cdap | /*
* Copyright © 2016 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
import React from 'react';
import T from 'i18n-react';
import ViewDataStep from 'components/CaskWizards/UploadData/ViewDataStep';
import SelectDestination from 'components/CaskWizards/UploadData/SelectDestination';
const UploadDataWizardConfig = {
steps: [
{
id: 'viewdata',
shorttitle: T.translate('features.Wizard.UploadData.Step1.shorttitle'),
title: T.translate('features.Wizard.UploadData.Step1.title'),
description: T.translate('features.Wizard.UploadData.Step1.description'),
content: (<ViewDataStep />),
},
{
id: 'selectdestination',
shorttitle: T.translate('features.Wizard.UploadData.Step2.shorttitle'),
title: T.translate('features.Wizard.UploadData.Step2.title'),
description: T.translate('features.Wizard.UploadData.Step2.description'),
content: (<SelectDestination />),
requiredFields: ['name', 'type']
}
]
};
export default UploadDataWizardConfig;
|
src/components/Header.js | bobrown101/phi-tau | import React from 'react';
const Header = React.createClass({
render () {
return (
<div id="header-container" className="animated fadeIn">
{/*<div id="background-image"></div>*/}
<div id="header" className="text-center">
<h1 className="header-large-text animated fadeInDown">PHI KAPPA TAU</h1>
<h2 className="header-small-text animated fadeIn">Building Men of Character Since 1966</h2>
<h1 className="header-large-text animated fadeInUp fadeIn">GAMMA NU</h1>
</div>
</div>
);
}
});
export default Header;
|
src/outputs/bike-index.js | bikeindex/stolen_bikes_widget_html | import React from 'react';
import ReactDOM from 'react-dom';
import StolenWidget from '../components/StolenWidget';
import { defaultElementId } from '../utility';
export default class BikeIndexWidget {
static el;
static init(options) {
const { elementId = defaultElementId, ...rest } = options;
const widget = <StolenWidget {...rest} />;
function doRender() {
if (BikeIndexWidget.el) {
throw new Error('BikeIndex is already mounted');
}
const el = document.getElementById(elementId);
ReactDOM.render(widget, el);
BikeIndexWidget.el = el;
}
if (document.readyState === 'complete') {
doRender();
} else {
window.addEventListener('load', () => {
doRender();
});
}
}
}
|
node_modules/react-native/local-cli/generator/templates/index.android.js | leechuanjun/TLReactNativeProject | /**
* 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}>
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 %>);
|
assets/jqwidgets/demos/react/app/navigationbar/disabled/app.js | juannelisalde/holter | import React from 'react';
import ReactDOM from 'react-dom';
import JqxNavigationBar from '../../../jqwidgets-react/react_jqxnavigationbar.js';
class App extends React.Component {
render () {
let innerHtml =
'<div>' +
'Early History of the Internet</div>' +
'</div>' +
'<div>' +
'<ul>' +
'<li>1961 First packet-switching papers</li>' +
'<li>1966 Merit Network founded</li>' +
'<li>1966 ARPANET planning starts</li>' +
'<li>1969 ARPANET carries its first packets</li>' +
'<li>1970 Mark I network at NPL (UK)</li>' +
'<li>1970 Network Information Center (NIC)</li>' +
'<li>1971 Merit Network\'s packet-switched network operational</li>' +
'<li>1971 Tymnet packet-switched network</li>' +
'<li>1972 Internet Assigned Numbers Authority (IANA) established</li>' +
'<li>1973 CYCLADES network demonstrated</li>' +
'<li>1974 Telenet packet-switched network</li>' +
'<li>1976 X.25 protocol approved</li>' +
'<li>1979 Internet Activities Board (IAB)</li>' +
'<li>1980 USENET news using UUCP</li>' +
'<li>1980 Ethernet standard introduced</li>' +
'<li>1981 BITNET established</li>' +
'</ul>' +
'</div>' +
'<div>' +
'Merging the networks and creating the Internet</div>' +
'<div>' +
'<ul>' +
'<li>1981 Computer Science Network (CSNET)</li>' +
'<li>1982 TCP/IP protocol suite formalized</li>' +
'<li>1982 Simple Mail Transfer Protocol (SMTP)</li>' +
'<li>1983 Domain Name System (DNS)</li>' +
'<li>1983 MILNET split off from ARPANET</li>' +
'<li>1986 NSFNET with 56 kbit/s links</li>' +
'<li>1986 Internet Engineering Task Force (IETF)</li>' +
'<li>1987 UUNET founded</li>' +
'<li>1988 NSFNET upgraded to 1.5 Mbit/s (T1)</li>' +
'<li>1988 OSI Reference Model released</li>' +
'<li>1988 Morris worm</li>' +
'<li>1989 Border Gateway Protocol (BGP)</li>' +
'<li>1989 PSINet founded, allows commercial traffic</li>' +
'<li>1989 Federal Internet Exchanges (FIXes)</li>' +
'<li>1990 GOSIP (without TCP/IP)</li>' +
'<li>1990 ARPANET decommissioned</li>' +
'</ul>' +
'</div>' +
'<div>' +
'Popular Internet services</div>' +
'<div>' +
'<ul>' +
'<li>1990 IMDb Internet movie database</li>' +
'<li>1995 Amazon.com online retailer</li>' +
'<li>1995 eBay online auction and shopping</li>' +
'<li>1995 Craigslist classified advertisements</li>' +
'<li>1996 Hotmail free web-based e-mail</li>' +
'<li>1997 Babel Fish automatic translation</li>' +
'<li>1998 Google Search</li>' +
'<li>1999 Napster peer-to-peer file sharing</li>' +
'<li>2001 Wikipedia, the free encyclopedia</li>' +
'<li>2003 LinkedIn business networking</li>' +
'<li>2003 Myspace social networking site</li>' +
'<li>2003 Skype Internet voice calls</li>' +
'<li>2003 iTunes Store</li>' +
'<li>2004 Facebook social networking site</li>' +
'<li>2004 Podcast media file series</li>' +
'<li>2004 Flickr image hosting</li>' +
'<li>2005 YouTube video sharing</li>' +
'<li>2005 Google Earth virtual globe</li>' +
'</ul>' +
'</div>';
return (
<JqxNavigationBar template={innerHtml} width={400} height={430} expandMode={'singleFitHeight'} disabled={true} />
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
examples/Cube/Picture.js | Traviskn/react-router-native-stack | import React, { Component } from 'react';
import { Dimensions, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import one from './assets/1.jpg';
import two from './assets/2.jpg';
import three from './assets/3.jpg';
import four from './assets/4.jpg';
import five from './assets/5.jpg';
import six from './assets/6.jpg';
export default class Picture extends Component {
render() {
const { height, width } = Dimensions.get('window');
const imageIndex = parseInt(this.props.match.params.id || 1, 10);
let image = one;
if (imageIndex === 2) {
image = two;
} else if (imageIndex === 3) {
image = three;
} else if (imageIndex === 4) {
image = four;
} else if (imageIndex === 5) {
image = five;
} else if (imageIndex === 6) {
image = six;
}
return (
<View style={StyleSheet.absoluteFill}>
<Image source={image} style={{ height, width }} />
{imageIndex < 6 && (
<TouchableOpacity
style={{ position: 'absolute', top: 20, right: 10, backgroundColor: 'transparent' }}
onPress={() => this.props.history.push(`/${imageIndex + 1}`)}>
<Text style={{ fontWeight: 'bold', color: 'white' }}>Next ></Text>
</TouchableOpacity>
)}
</View>
);
}
}
|
src/components/App.js | aengl/sector4-website | import React from 'react';
import { Subscribe } from './Subscribe';
import { Header } from './Header';
import { Footer } from './Footer';
import './App.css';
export class App extends React.Component {
render() {
return (
<div className='App'>
<Header />
<h1 className='App-title'>
Be your label
</h1>
<h2 className='App-subtitle'>
Launch February 23
</h2>
<div className='App-image'>
</div>
<p className='App-about'>A unique bodywear brand, designed by creative minds from the world of dance, taking stage on the platform THE UNKNOWN ARTISTS.</p>
<Subscribe />
<Footer />
</div>
);
}
}
|
src/js/components/ui/forms/HorizontalNumberInput.js | knowncitizen/tripleo-ui | /**
* Copyright 2017 Red Hat Inc.
*
* 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 ClassNames from 'classnames';
import { withFormsy } from 'formsy-react';
import PropTypes from 'prop-types';
import React from 'react';
import InputDescription from './InputDescription';
import InputErrorMessage from './InputErrorMessage';
class HorizontalNumberInput extends React.Component {
changeValue(event) {
event.stopPropagation(); // https://github.com/christianalfoni/formsy-react/issues/203
this.props.setValue(
isNaN(parseInt(event.target.value))
? undefined
: parseInt(event.target.value)
);
}
// https://github.com/christianalfoni/formsy-react/issues/332
getValue() {
if (this.props.getValue()) {
return this.props.getValue();
}
return 0;
}
render() {
let divClasses = ClassNames({
'form-group': true,
'has-error': this.props.showError(),
required: this.props.isRequired()
});
return (
<div className={divClasses}>
<label
htmlFor={this.props.name}
className={`${this.props.labelColumnClasses} control-label`}
>
{this.props.title}
</label>
<div className={this.props.inputColumnClasses}>
<input
type="number"
name={this.props.name}
ref={this.props.name}
id={this.props.name}
className="form-control"
onChange={this.changeValue.bind(this)}
value={this.getValue()}
placeholder={this.props.placeholder}
min={this.props.min}
max={this.props.max}
disabled={this.props.disabled}
/>
<InputErrorMessage getErrorMessage={this.props.getErrorMessage} />
<InputDescription description={this.props.description} />
</div>
</div>
);
}
}
HorizontalNumberInput.propTypes = {
description: PropTypes.string,
disabled: PropTypes.bool,
getErrorMessage: PropTypes.func,
getValue: PropTypes.func,
inputColumnClasses: PropTypes.string.isRequired,
isRequired: PropTypes.func,
isValid: PropTypes.func,
labelColumnClasses: PropTypes.string.isRequired,
max: PropTypes.number,
min: PropTypes.number,
name: PropTypes.string.isRequired,
placeholder: PropTypes.string,
setValue: PropTypes.func,
showError: PropTypes.func,
title: PropTypes.string.isRequired
};
HorizontalNumberInput.defaultProps = {
inputColumnClasses: 'col-sm-10',
labelColumnClasses: 'col-sm-2'
};
export default withFormsy(HorizontalNumberInput);
|
src/controls/FormGroup.js | amvmdev/amvm-ui | import React from 'react';
const FormGroup = (props) => {
const {
success,
error,
warning,
children,
...sourceProps
} = props;
let className = "";
if (success)
className = "has-success";
else if (warning)
className = "has-warning";
else if (error)
className = "has-error";
if(sourceProps.className) {
className += ' ' + sourceProps.className;
delete sourceProps.className;
}
return (
<div className={"form-group " + className} {...sourceProps}>{children}</div>
);
}
FormGroup.propTypes = {
success: React.PropTypes.bool,
warning: React.PropTypes.bool,
error: React.PropTypes.bool
};
FormGroup.defaultProps = {
success: false,
warning: false,
error: false
};
export default FormGroup; |
app/app.js | MaleSharker/Qingyan | /**
* 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 FontFaceObserver from 'fontfaceobserver';
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-webpack-loader-syntax */
import '!file-loader?name=[name].[ext]!./favicon.ico';
import '!file-loader?name=[name].[ext]!./manifest.json';
import 'file-loader?name=[name].[ext]!./.htaccess'; // eslint-disable-line import/extensions
/* eslint-enable import/no-webpack-loader-syntax */
import configureStore from './store';
// Import i18n messages
import { translationMessages } from './i18n';
// Import CSS reset and Global Styles
import './global-styles';
// Import routes
import createRoutes from './routes';
// Observe loading of Open Sans (to remove open sans, remove the <link> tag in
// the index.html file and this observer)
const openSansObserver = new FontFaceObserver('Open Sans', {});
// When Open Sans is loaded, add a font-family using Open Sans to the body
openSansObserver.load().then(() => {
document.body.classList.add('fontLoaded');
}, () => {
document.body.classList.remove('fontLoaded');
});
// 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'),
import('intl/locale-data/jsonp/de.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/ProposalActions/ProposalActions.js | nambawan/g-old | // @flow
import React from 'react';
import { connect } from 'react-redux';
import withStyles from 'isomorphic-style-loader/withStyles';
import { defineMessages, FormattedMessage, FormattedDate } from 'react-intl';
import s from './ProposalActions.css';
import KeyValueRow from './KeyValueRow';
import {
getProposal,
getProposalUpdates,
getSessionUser,
} from '../../reducers';
import Box from '../Box';
import Button from '../Button';
import Accordion from '../Accordion';
import AccordionPanel from '../AccordionPanel';
import Notification from '../Notification';
import Label from '../Label';
import PollState from '../PollState';
import Heading from '../Heading';
import PhaseTwoWizard from './PhaseTwoWizard';
import type { PollTypeTypes, PollSettingsShape } from '../ProposalInput';
import withPollSettings from '../ProposalInput/withPollSettings';
const WizardWithSettings = withPollSettings(PhaseTwoWizard, ['voting']);
const messages = defineMessages({
confirmation: {
id: 'confirmation',
defaultMessage: 'Are you sure?',
description: 'Ask for confirmation',
},
open: {
id: 'manager.open',
defaultMessage: 'Open voting',
description: 'Starts the voting process',
},
revokeShort: {
id: 'manager.revokeShort',
defaultMessage: 'Revoke',
description: 'Revoke proposal, short',
},
revoke: {
id: 'manager.revoke',
defaultMessage: 'Revoke proposal',
description: 'Revoke proposal',
},
close: {
id: 'command.close',
defaultMessage: 'Close',
description: 'Close',
},
empty: {
id: 'form.error-empty',
defaultMessage: "You can't leave this empty",
description: 'Help for empty fields',
},
past: {
id: 'form.error-past',
defaultMessage: 'Time already passed',
description: 'Help for wrong time settings',
},
});
const isThresholdPassed = poll => {
let ref;
if (poll.extended) {
return false;
}
const tRef = poll.mode.thresholdRef;
const upvotes = poll.options[0].numVotes;
const downvotes = poll.options[1] ? poll.options[1].numVotes : 0;
switch (tRef) {
case 'voters':
ref = upvotes + downvotes;
break;
case 'all':
ref = poll.allVoters;
break;
default:
throw Error(
`Threshold reference not implemented: ${tRef || 'undefined'}`,
);
}
ref *= poll.threshold / 100;
return upvotes ? upvotes >= ref : false;
};
type Props = {
updateProposal: () => Promise<boolean>,
pollOptions: PollTypeTypes[],
updates: {
isFetching: boolean,
errorMessage?: string,
success: boolean,
},
onFinish: () => void,
proposal: ProposalShape,
defaultPollSettings: { [PollTypeTypes]: PollSettingsShape },
availablePolls: PollTypeTypes[],
user: UserShape,
};
type State = {
error: boolean,
};
class ProposalActions extends React.Component<Props, State> {
static defaultProps = {
error: null,
pending: false,
success: false,
};
constructor(props) {
super(props);
this.handleStateChange = this.handleStateChange.bind(this);
this.state = {
error: false,
};
}
componentDidUpdate(prevProps) {
const { updates, onFinish } = this.props;
if (prevProps.updates !== updates) {
if (updates.success) {
onFinish();
} else if (updates.errorMessage) {
// eslint-disable-next-line react/no-did-update-set-state
this.setState({ error: !!updates.errorMessage });
}
}
}
handleStateChange: () => void;
handleStateChange() {
const {
proposal: { id, workTeamId, state },
updateProposal,
} = this.props;
updateProposal({
id,
state: state === 'survey' ? 'survey' : 'revoked',
...(workTeamId && {
workTeamId,
}),
});
}
renderPollState() {
const {
proposal: { state, pollOne, pollTwo },
} = this.props;
const result = [];
if (state === 'survey') {
result.push(<Label>Survey</Label>);
} else {
result.push(<Label>{pollTwo ? 'VOTING' : 'PROPOSAL'}</Label>);
}
const poll = pollTwo || pollOne;
if (poll) {
result.push(
<div>
<PollState
compact
allVoters={poll.allVoters}
upvotes={poll.options[0].numVotes}
downvotes={poll.options[1] && poll.options[1].numVotes}
thresholdRef={poll.mode.thresholdRef}
threshold={poll.threshold}
unipolar={poll.mode.unipolar}
/>
</div>,
);
}
return result;
}
renderActions() {
const {
updates = {},
proposal: { pollOne, pollTwo, state, id, workTeamId },
updateProposal,
user,
} = this.props;
const poll = pollTwo || pollOne;
const actions = [];
if (!poll.closedAt) {
actions.push(
<AccordionPanel
heading={
<FormattedMessage
{...messages[state === 'survey' ? 'close' : 'revoke']}
/>
}
>
<Box pad column justify>
<Button
disabled={updates.isFetching}
onClick={this.handleStateChange}
primary
label={
<FormattedMessage
{...messages[state === 'survey' ? 'close' : 'revokeShort']}
/>
}
/>
</Box>
</AccordionPanel>,
);
}
if (state === 'proposed') {
actions.push(
<AccordionPanel heading={<FormattedMessage {...messages.open} />}>
<Box column>
<WizardWithSettings
workTeamId={workTeamId}
proposalId={id}
defaultPollType="voting"
user={user}
onUpdate={updateProposal}
/>
</Box>
</AccordionPanel>,
);
}
return actions.length ? <Accordion>{actions}</Accordion> : [];
}
renderNotifications() {
const {
proposal: { state, pollOne },
} = this.props;
let result;
if (
pollOne &&
state === 'proposed' &&
(pollOne.closedAt || isThresholdPassed(pollOne))
) {
result = <Notification type="alert" message="Ready for voting" />;
}
return result;
}
renderDetails() {
const {
proposal: { pollOne, state, pollTwo },
} = this.props;
const poll = pollTwo || pollOne;
const details = [];
poll.options.forEach(option => {
details.push(
<KeyValueRow
name={option.title || option.description}
value={option.numVotes}
/>,
);
});
if (state === 'proposed') {
const numVotersForThreshold = Math.ceil(
(poll.allVoters * poll.threshold) / 100,
);
details.push(
<KeyValueRow name="Threshold (votes)" value={numVotersForThreshold} />,
<KeyValueRow
name="Votes left for threshold"
value={numVotersForThreshold - poll.options[0].numVotes}
/>,
);
}
if (!poll.closedAt) {
details.push(
<KeyValueRow
name="Endtime"
value={
<FormattedDate
value={poll.endTime}
day="numeric"
month="numeric"
year="numeric"
hour="numeric"
minute="numeric"
/>
}
/>,
);
}
return (
<table className={s.keyValue}>
<tbody>{details}</tbody>
</table>
);
}
render() {
const {
updates: { errorMessage },
proposal,
} = this.props;
const { error } = this.state;
return (
<Box column fill className={s.root}>
<Box pad>
<Heading tag="h3">{proposal.title}</Heading>
</Box>
<Box flex align justify column fill>
<Box column fill>
{error && <Notification type="error" message={errorMessage} />}
{this.renderPollState()}
{this.renderDetails()}
{this.renderNotifications()}
</Box>
{this.renderActions()}
</Box>
</Box>
);
}
}
const mapStateToProps = (state, { id }) => ({
updates: getProposalUpdates(state, id),
proposal: getProposal(state, id),
user: getSessionUser(state),
});
export default connect(mapStateToProps)(withStyles(s)(ProposalActions));
|
src/App.js | HaileHuang/todolist | import React, { Component } from 'react';
import './App.css';
import { connect } from 'dva';
import { Spin } from 'antd';
import Add from './components/Add';
import Lists from './components/Lists';
import { Button } from 'antd';
class App extends Component {
constructor(props) {
super(props);
}
add = (value) => {
this.props.dispatch({
type: 'todoitems/create',
payload: {
title: value,
checked: false,
}
})
}
del = (currentItem) => {
this.props.dispatch({
type: 'todoitems/remove',
payload: currentItem._id,
});
}
changeState = (currentItem) => {
this.props.dispatch({
type: 'todoitems/update',
payload: {
id: currentItem._id,
title: currentItem.title,
checked: !currentItem.checked,
}
});
}
render() {
let doingLists = [], doneLists = [];
this.props.list.forEach((item) => {
if (item.checked) {
doneLists.push(item);
} else {
doingLists.push(item);
}
})
return (
<div className="App">
<div className="App-header">
<h2>Welcome to React</h2>
</div>
{
this.props.loading ?
<div className="spain-load">
<Spin />
</div> :
<div className="content">
<Add add={this.add} />
<h1 style={{textAlign: "left", marginTop: 30}}>Doing</h1>
<Lists
lists={doingLists}
onClick={this.changeState}
del={this.del}
/>
<h1 style={{textAlign: "left", marginTop: 30}}>Done</h1>
<Lists
lists={doneLists}
onClick={this.changeState}
del={this.del}
/>
</div>
}
</div>
);
}
}
function mapStateToProps(state) {
const { list } = state.todoitems;
return {
loading: state.loading.models.todoitems,
list,
};
}
function mapDispatchToProps(dispatch) {
return {dispatch,};
}
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
src/components/compact/CompactColor.js | JedWatson/react-color | 'use strict' /* @flow */
import React from 'react'
import ReactCSS from 'reactcss'
export class CompactColor extends ReactCSS.Component {
constructor() {
super()
this.handleClick = this.handleClick.bind(this)
}
classes(): any {
return {
'default': {
color: {
background: this.props.color,
width: '15px',
height: '15px',
float: 'left',
marginRight: '5px',
marginBottom: '5px',
position: 'relative',
cursor: 'pointer',
},
dot: {
Absolute: '5px 5px 5px 5px',
background: '#fff',
borderRadius: '50%',
opacity: '0',
},
},
'active': {
dot: {
opacity: '1',
},
},
'color-#FFFFFF': {
color: {
boxShadow: 'inset 0 0 0 1px #ddd',
},
dot: {
background: '#000',
},
},
}
}
handleClick() {
this.props.onClick({ hex: this.props.color })
}
render(): any {
return (
<div is="color" ref="color" onClick={ this.handleClick }>
<div is="dot" />
</div>
)
}
}
export default CompactColor
|
src/ReactBoilerplate/Scripts/components/ForgotPasswordForm/ForgotPasswordForm.js | pauldotknopf/react-aspnet-boilerplate | import React from 'react';
import Form from 'components/Form';
import { reduxForm } from 'redux-form';
import { Input } from 'components';
import { forgotPassword } from 'redux/modules/account';
class ForgotPasswordForm extends Form {
constructor(props) {
super(props);
this.success = this.success.bind(this);
this.state = { success: false };
}
success() {
this.setState({ success: true });
}
render() {
const {
fields: { email }
} = this.props;
const {
success
} = this.state;
return (
<div>
{success &&
<p>
Please check your email to reset your password.
</p>
}
{!success &&
<form
onSubmit={this.handleApiSubmit(forgotPassword, this.success)}
className="form-horizontal">
{this.renderGlobalErrorList()}
<Input field={email} label="Email" />
<div className="form-group">
<div className="col-md-offset-2 col-md-10">
<button type="submit" className="btn btn-default">Submit</button>
</div>
</div>
</form>
}
</div>
);
}
}
ForgotPasswordForm = reduxForm({
form: 'forgotPassword',
fields: ['email']
},
(state) => state,
{ }
)(ForgotPasswordForm);
export default ForgotPasswordForm;
|
src/client/index.js | jaimerosales/visual-reports-bim360dc | import AppContainer from './containers/AppContainer'
import createStore from './store/createStore'
import ReactDOM from 'react-dom'
import 'font-awesome-webpack'
import config from 'c0nfig'
import 'bootstrap-webpack'
import React from 'react'
//Services
import ServiceManager from 'SvcManager'
import StorageSvc from 'StorageSvc'
import SocketSvc from 'SocketSvc'
import EventSvc from 'EventSvc'
import ForgeSvc from 'ForgeSvc'
//import TreeSvc from 'TreeSvc'
// ========================================================
// Services Initialization
// ========================================================
const storageSvc = new StorageSvc({
storageKey: 'Autodesk.Forge.Storage'
})
const socketSvc = new SocketSvc({
host: config.client.host,
port: config.client.port
})
socketSvc.connect().then((socket) => {
console.log('client socket connected')
}, (error) => {
console.log('error connecting client socket ...')
console.log(error)
})
const eventSvc = new EventSvc()
const forgeSvc = new ForgeSvc({
apiUrl: '/api/forge'
})
// const treeSvc = new TreeSvc({
// apiUrl: '/api/forge/tree'
// })
// ========================================================
// Services Registration
// ========================================================
ServiceManager.registerService(storageSvc)
ServiceManager.registerService(socketSvc)
ServiceManager.registerService(eventSvc)
ServiceManager.registerService(forgeSvc)
//ServiceManager.registerService(treeSvc)
// ========================================================
// Store Instantiation
// ========================================================
const initialState = window.___INITIAL_STATE__
const store = createStore(initialState)
// ========================================================
// Render Setup
// ========================================================
const MOUNT_NODE = document.getElementById('root')
let render = () => {
const routes = require('./routes/index').default(store)
ReactDOM.render(
<AppContainer store={store} routes={routes} />,
MOUNT_NODE
)
}
// ========================================================
// This code is excluded from production bundle
// ========================================================
if (config.env === 'development') {
if (window.devToolsExtension) {
window.devToolsExtension.open()
}
if (module.hot) {
// Development render functions
const renderApp = render
const renderError = (error) => {
const RedBox = require('redbox-react').default
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE)
}
// Wrap render in try/catch
render = () => {
try {
renderApp()
} catch (error) {
renderError(error)
}
}
// Setup hot module replacement
module.hot.accept('./routes/index', () =>
setImmediate(() => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE)
render()
})
)
}
}
// ========================================================
// Go!
// ========================================================
render()
|
src/navigation/tabs.js | Jenny-L/lumohacks2017 | /**
* Tabs Scenes
*
* React Native Starter App
* https://github.com/mcnamee/react-native-starter-app
*/
import React from 'react';
import { Scene } from 'react-native-router-flux';
// Consts and Libs
import { AppConfig } from '@constants/';
import { AppStyles, AppSizes } from '@theme/';
// Components
import { TabIcon } from '@ui/';
import { NavbarMenuButton } from '@containers/ui/NavbarMenuButton/NavbarMenuButtonContainer';
// Scenes
import Placeholder from '@components/general/Placeholder';
import Error from '@components/general/Error';
import StyleGuide from '@containers/StyleGuideView';
import Recipes from '@containers/recipes/Browse/BrowseContainer';
import RecipeView from '@containers/recipes/RecipeView';
const navbarPropsTabs = {
...AppConfig.navbarProps,
renderLeftButton: () => <NavbarMenuButton />,
sceneStyle: {
...AppConfig.navbarProps.sceneStyle,
paddingBottom: AppSizes.tabbarHeight,
},
};
/* Routes ==================================================================== */
const scenes = (
<Scene key={'tabBar'} tabs tabBarIconContainerStyle={AppStyles.tabbar} pressOpacity={0.95}>
<Scene
{...navbarPropsTabs}
key={'recipes'}
title={'Recipes'}
icon={props => TabIcon({ ...props, icon: 'search' })}
>
<Scene
{...navbarPropsTabs}
key={'recipesListing'}
component={Recipes}
title={'Recipes'}
analyticsDesc={'Recipes: Browse Recipes'}
/>
<Scene
{...AppConfig.navbarProps}
key={'recipeView'}
component={RecipeView}
getTitle={props => ((props.title) ? props.title : 'View Recipe')}
analyticsDesc={'RecipeView: View Recipe'}
/>
</Scene>
<Scene
key={'timeline'}
{...navbarPropsTabs}
title={'Coming Soon'}
component={Placeholder}
icon={props => TabIcon({ ...props, icon: 'timeline' })}
analyticsDesc={'Placeholder: Coming Soon'}
/>
<Scene
key={'error'}
{...navbarPropsTabs}
title={'Example Error'}
component={Error}
icon={props => TabIcon({ ...props, icon: 'error' })}
analyticsDesc={'Error: Example Error'}
/>
<Scene
key={'styleGuide'}
{...navbarPropsTabs}
title={'Style Guide'}
component={StyleGuide}
icon={props => TabIcon({ ...props, icon: 'speaker-notes' })}
analyticsDesc={'StyleGuide: Style Guide'}
/>
</Scene>
);
export default scenes;
|
src/pages/hermes/HermesPage.js | Synchro-TEC/site-apollo-11 | import React from 'react';
import { Hermes } from 'syntec-apollo-11';
import { PrismCode } from 'react-prism';
import ShowCode from '../../components/ShowCode';
var addMessage = () => {
Hermes.addMessage(`Mensagem ${Date.now()}`, true);
};
var changeTitle = () => {
Hermes.setTitle(`Novo titulo ${Date.now()}`);
};
var setContext = (context) => {
Hermes.setContext(context);
};
const HermesPage = (props) => {
return (
<div className='dm-content'>
<Hermes />
<h3>Hermes</h3>
<p>
É um componente para notificações, com temas (contextos) e uma API para
manipular mensagens.
</p>
<h5 className='bold'> Adicionando uma mensagem e/ou um titulo</h5>
<p>
Para adicionar uma mensagem utilize o método <b>addMessage </b> da API. Por padrão,
a mensagem vem com o contexto de informação (info) e sem título.
Para adicionar ou alterar o titulo, utilize o método <b>setTitle</b>.
</p>
<div className='sv-vertical-marged-25'/>
<div className='sv-text-center'>
<button className='sv-button small default marged' onClick={() => addMessage()}>Adicionar mensagem</button>
<button className='sv-button small default marged' onClick={() => changeTitle()}>Adicionar/Alterar Titulo</button>
</div>
<div className='sv-vertical-marged-25'/>
<ShowCode>
<PrismCode className='language-js'>
{require('!raw-loader!./exemploAdicionarMensagemETitulo.js')}
</PrismCode>
</ShowCode>
<h5 className='bold'> Modificando um contexto e/ou uma posição</h5>
<p>
Para alterar o contexto, utilize o método <b> setContext </b> da API passando
uma das opções: <b> success </b> (sucesso), <b> info </b> (informativo),
<b> warning </b> (aviso), <b> error </b> (erro).
Para alterar a posição, utilize o método <b> setPosition </b> passando
a opção <b> top </b> (cima) ou <b> bottom </b> (baixo).
</p>
<div className='sv-vertical-marged-25'/>
<div className='sv-text-center'>
<button className='sv-button small primary marged' onClick={() => {addMessage(); setContext('success')}}>Contexto Sucesso</button>
<button className='sv-button small info marged' onClick={() => {addMessage(); setContext('info')}}>Contexto Informativo</button>
<button className='sv-button small warning marged' onClick={() => {addMessage(); setContext('warning')}}>Contexto Aviso</button>
<button className='sv-button small danger marged' onClick={() => {addMessage(); setContext('error')}}>Contexto Erro</button>
<button className='sv-button small default marged' onClick={() => Hermes.setPosition('top')}>Superior</button>
<button className='sv-button small default marged' onClick={() => Hermes.setPosition('bottom')}>Inferior</button>
</div>
<div className='sv-vertical-marged-25'/>
<ShowCode>
<PrismCode className='language-js'>
{require('!raw-loader!./exemploContextosEPosicao.js')}
</PrismCode>
</ShowCode>
</div>
);
};
HermesPage.displayName = 'HermesPage';
export default HermesPage;
|
src/svg-icons/maps/local-car-wash.js | mmrtnz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalCarWash = (props) => (
<SvgIcon {...props}>
<path d="M17 5c.83 0 1.5-.67 1.5-1.5 0-1-1.5-2.7-1.5-2.7s-1.5 1.7-1.5 2.7c0 .83.67 1.5 1.5 1.5zm-5 0c.83 0 1.5-.67 1.5-1.5 0-1-1.5-2.7-1.5-2.7s-1.5 1.7-1.5 2.7c0 .83.67 1.5 1.5 1.5zM7 5c.83 0 1.5-.67 1.5-1.5C8.5 2.5 7 .8 7 .8S5.5 2.5 5.5 3.5C5.5 4.33 6.17 5 7 5zm11.92 3.01C18.72 7.42 18.16 7 17.5 7h-11c-.66 0-1.21.42-1.42 1.01L3 14v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 18c-.83 0-1.5-.67-1.5-1.5S5.67 15 6.5 15s1.5.67 1.5 1.5S7.33 18 6.5 18zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 13l1.5-4.5h11L19 13H5z"/>
</SvgIcon>
);
MapsLocalCarWash = pure(MapsLocalCarWash);
MapsLocalCarWash.displayName = 'MapsLocalCarWash';
MapsLocalCarWash.muiName = 'SvgIcon';
export default MapsLocalCarWash;
|
src/svg-icons/device/signal-wifi-4-bar-lock.js | andrejunges/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceSignalWifi4BarLock = (props) => (
<SvgIcon {...props}>
<path d="M23 16v-1.5c0-1.4-1.1-2.5-2.5-2.5S18 13.1 18 14.5V16c-.5 0-1 .5-1 1v4c0 .5.5 1 1 1h5c.5 0 1-.5 1-1v-4c0-.5-.5-1-1-1zm-1 0h-3v-1.5c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5V16zm-6.5-1.5c0-2.8 2.2-5 5-5 .4 0 .7 0 1 .1L23.6 7c-.4-.3-4.9-4-11.6-4C5.3 3 .8 6.7.4 7L12 21.5l3.5-4.4v-2.6z"/>
</SvgIcon>
);
DeviceSignalWifi4BarLock = pure(DeviceSignalWifi4BarLock);
DeviceSignalWifi4BarLock.displayName = 'DeviceSignalWifi4BarLock';
DeviceSignalWifi4BarLock.muiName = 'SvgIcon';
export default DeviceSignalWifi4BarLock;
|
src/svg-icons/action/bookmark-border.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionBookmarkBorder = (props) => (
<SvgIcon {...props}>
<path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"/>
</SvgIcon>
);
ActionBookmarkBorder = pure(ActionBookmarkBorder);
ActionBookmarkBorder.displayName = 'ActionBookmarkBorder';
ActionBookmarkBorder.muiName = 'SvgIcon';
export default ActionBookmarkBorder;
|
src/parser/ui/StatisticListBoxItem.js | anom0ly/WoWAnalyzer | import { TooltipElement } from 'interface';
import PropTypes from 'prop-types';
import React from 'react';
/**
* @deprecated Use `parser/ui/Statistic` instead.
*/
const StatisticListBoxItem = ({ title, value, titleTooltip, valueTooltip }) => (
<div className="flex">
<div className="flex-main">
{titleTooltip ? <TooltipElement content={titleTooltip}>{title}</TooltipElement> : title}
</div>
<div className="flex-sub text-right">
{valueTooltip ? <TooltipElement content={valueTooltip}>{value}</TooltipElement> : value}
</div>
</div>
);
StatisticListBoxItem.propTypes = {
title: PropTypes.node.isRequired,
value: PropTypes.node.isRequired,
titleTooltip: PropTypes.node,
valueTooltip: PropTypes.node,
};
export default StatisticListBoxItem;
|
assets/jqwidgets/demos/react/app/chart/spiderchart/app.js | juannelisalde/holter | import React from 'react';
import ReactDOM from 'react-dom';
import JqxChart from '../../../jqwidgets-react/react_jqxchart.js';
import JqxDropDownList from '../../../jqwidgets-react/react_jqxdropdownlist.js';
import JqxSlider from '../../../jqwidgets-react/react_jqxslider.js';
import JqxCheckBox from '../../../jqwidgets-react/react_jqxcheckbox.js';
class App extends React.Component {
componentDidMount() {
this.refs.sliderStartAngle.on('change', (event) => {
let value = event.args.value;
this.refs.myChart.seriesGroups()[0].startAngle = value;
this.refs.myChart.seriesGroups()[0].endAngle = value + 360;
this.refs.myChart.update();
});
this.refs.sliderRadius.on('change', (event) => {
let value = event.args.value;
this.refs.myChart.seriesGroups()[0].radius = value;
this.refs.myChart.update();
});
this.refs.dropDownListColor.on('change', (event) => {
let value = event.args.item.value;
this.refs.myChart.colorScheme(value);
});
this.refs.dropDownListSeries.on('select', (event) => {
let value = event.args.item.value;
this.refs.myChart.seriesGroups()[0].type = value;
this.refs.myChart.update();
});
this.refs.checkBoxTicksBetween.on('change', (event) => {
this.refs.myChart.xAxis().valuesOnTicks = !event.args.checked;
this.refs.myChart.update();
})
this.refs.checkBoxAutoRotateLabels.on('change', (event) => {
this.refs.myChart.xAxis().labels.autoRotate = event.args.checked;
this.refs.myChart.valueAxis().labels.autoRotate = event.args.checked;
this.refs.myChart.update();
})
}
render() {
let data = [
{
type: 'Organic Search',
month1: 1725090,
month2: 3136190
},
{
type: 'Paid Search',
month1: 925090,
month2: 2136190
},
{
type: 'Direct',
month1: 425090,
month2: 936190
},
{
type: 'Referral',
month1: 1250900,
month2: 2536190
},
{
type: 'Twitter',
month1: 350900,
month2: 681900
},
{
type: 'Facebook',
month1: 381900,
month2: 831500
}
];
let padding = { left: 5, top: 5, right: 5, bottom: 5 };
let titlePadding = { left: 0, top: 0, right: 0, bottom: 5 };
let xAxis =
{
dataField: 'type',
displayText: 'Traffic source',
valuesOnTicks: true,
labels: { autoRotate: false }
};
let valueAxis =
{
unitInterval: 1000000,
labels: {
formatSettings: { decimalPlaces: 0 },
formatFunction: (value, itemIndex, serieIndex, groupIndex) => {
return Math.round(value / 1000) + ' K';
}
}
};
let seriesGroups =
[
{
spider: true,
startAngle: 0,
endAngle: 360,
radius: 120,
type: 'spline',
series: [
{ dataField: 'month1', displayText: 'January 2014', opacity: 0.7, radius: 2, lineWidth: 2, symbolType: 'circle' },
{ dataField: 'month2', displayText: 'February 2014', opacity: 0.7, radius: 2, lineWidth: 2, symbolType: 'square' }
]
}
];
let colorsSchemesList = ['scheme01', 'scheme02', 'scheme03', 'scheme04', 'scheme05', 'scheme06', 'scheme07', 'scheme08'];
let seriesList = ['splinearea', 'spline', 'column', 'scatter', 'stackedcolumn', 'stackedsplinearea', 'stackedspline'];
let chartCSS = { width: 850, height: 500, marginBottom: 1 };
let pCSS = { fontFamily: 'Verdana', fontSize: 12 };
return (
<div>
<JqxChart ref='myChart' style={{ width: 850, height: 500 }}
title={'Website audience acquision by source'}
description={'Month over month comparison'} valueAxis={valueAxis}
showLegend={true} enableAnimations={false} padding={padding}
titlePadding={titlePadding} source={data} xAxis={xAxis}
colorScheme={'scheme05'} seriesGroups={seriesGroups}
/>
<table style={{ width: 850 }}>
<tbody>
<tr>
<td style={{ paddingLeft: 50 }}>
<p style={pCSS}>Move the slider to rotate:</p>
<JqxSlider ref='sliderStartAngle'
width={240} min={0} max={360} step={1}
ticksFrequency={20} mode={'fixed'}
/>
</td>
<td>
<p style={pCSS}>Select the series type:</p>
<JqxDropDownList ref='dropDownListSeries'
width={200} height={25} source={seriesList}
selectedIndex={2} dropDownHeight={100}
/>
</td>
</tr>
<tr>
<td style={{ paddingLeft: 50 }}>
<p style={pCSS}>Move the slider to change the radius:</p>
<JqxSlider ref='sliderRadius'
width={240} min={80} max={140} step={1}
ticksFrequency={20} mode={'fixed'} value={120}
/>
</td>
<td>
<p style={pCSS}>Select color scheme:</p>
<JqxDropDownList ref='dropDownListColor'
width={200} height={25} source={colorsSchemesList}
selectedIndex={0} dropDownHeight={100}
/>
</td>
</tr>
<tr>
<td style={{ paddingLeft: 50 }}>
<JqxCheckBox ref="checkBoxAutoRotateLabels" style={{ paddingTop: 15 }} value='Auto-rotate labels'
width={220} height={25} hasThreeStates={false} checked={false}
/>
</td>
<td>
<JqxCheckBox ref="checkBoxTicksBetween" style={{ paddingTop: 15 }} value='Ticks between values'
width={220} height={25} hasThreeStates={false} checked={false}
/>
</td>
</tr>
</tbody>
</table>
</div>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
fixtures/packaging/systemjs-builder/dev/input.js | TheBlasfem/react | import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
React.createElement('h1', null, 'Hello World!'),
document.getElementById('container')
);
|
client/containers/Users/Users.js | joshjg/explore | import React from 'react';
import { connect } from 'react-redux';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
import TextField from 'material-ui/TextField';
import Checkbox from 'material-ui/Checkbox';
import RaisedButton from 'material-ui/RaisedButton';
import { FETCH_USERS_REQUEST } from './constants';
import { setUserField, putUser } from './actions';
class Users extends React.Component {
static propTypes = {
users: React.PropTypes.arrayOf(React.PropTypes.object),
status: React.PropTypes.object,
requestUsers: React.PropTypes.func,
editUser: React.PropTypes.func,
handleChange: React.PropTypes.func,
}
constructor(props) {
super(props);
props.requestUsers();
}
render = () => (
<Table selectable={false}>
<TableHeader
displaySelectAll={false}
adjustForCheckbox={false}
>
<TableHeaderColumn>ID</TableHeaderColumn>
<TableHeaderColumn>Email</TableHeaderColumn>
<TableHeaderColumn>Permission</TableHeaderColumn>
<TableHeaderColumn>Submit</TableHeaderColumn>
</TableHeader>
<TableBody displayRowCheckbox={false}>
{this.props.users.map(user => (
<TableRow key={user.id}>
<TableRowColumn>{user.id}</TableRowColumn>
<TableRowColumn>
<TextField
id={user.id.toString()}
value={user.email || ''}
onChange={e => this.props.handleChange(user.id, 'email', e.target.value)}
/>
</TableRowColumn>
<TableRowColumn>
<Checkbox
checked={!!user.canCreate}
onCheck={(e, checked) => this.props.handleChange(user.id, 'canCreate', checked)}
/>
</TableRowColumn>
<TableRowColumn>
<RaisedButton
label="Submit"
primary
onTouchTap={() => this.props.editUser(user.id, user.email, user.canCreate)}
/>
{this.props.status[user.id] ? this.props.status[user.id] : ''}
</TableRowColumn>
</TableRow>
))}
</TableBody>
</Table>
)
}
const mapStateToProps = state => ({
users: state.users.users,
status: state.users.status,
});
const mapDispatchToProps = dispatch => ({
requestUsers: () => dispatch({ type: FETCH_USERS_REQUEST }),
handleChange: (id, field, value) => dispatch(setUserField(id, field, value)),
editUser: (id, email, canCreate) => dispatch(putUser(id, email.toLowerCase(), !!canCreate)),
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(Users);
|
geonode/monitoring/frontend/monitoring/src/components/organisms/geoserver-status/index.js | tomkralidis/geonode | /*
#########################################################################
#
# Copyright (C) 2019 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import HoverPaper from '../../atoms/hover-paper';
import CPU from '../../cels/cpu';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
import Memory from '../../cels/memory';
import styles from './styles';
import actions from './actions';
const mapStateToProps = (state) => ({
cpu: state.geoserverCpuSequence.response,
memory: state.geoserverMemorySequence.response,
interval: state.interval.interval,
services: state.services.hostgeoserver,
timestamp: state.interval.timestamp,
});
@connect(mapStateToProps, actions)
class GeoserverStatus extends React.Component {
static propTypes = {
cpu: PropTypes.object,
getCpu: PropTypes.func.isRequired,
getMemory: PropTypes.func.isRequired,
memory: PropTypes.object,
services: PropTypes.array,
resetCpu: PropTypes.func.isRequired,
resetMemory: PropTypes.func.isRequired,
timestamp: PropTypes.instanceOf(Date),
interval: PropTypes.number,
half: PropTypes.bool,
}
static defaultProps = {
half: true,
}
constructor(props) {
super(props);
this.state = {
host: '',
};
this.get = (
host = this.state.host,
interval = this.props.interval,
) => {
this.props.getCpu(host, interval);
this.props.getMemory(host, interval);
};
this.reset = () => {
this.props.resetCpu();
this.props.resetMemory();
};
}
componentWillMount() {
this.setHost(this.props);
}
componentWillReceiveProps(nextProps) {
this.setHost(nextProps);
}
componentWillUnmount() {
this.reset();
}
render() {
let cpuData = [];
let memoryData = [];
if (
this.props.cpu
&& this.props.cpu.data
&& this.props.cpu.data.data
) {
cpuData = this.props.cpu.data.data.map(element => ({
name: element.valid_from,
'CPU used': element.data.length > 0 ? Math.floor(element.data[0].val) : 0,
}));
}
if (
this.props.memory
&& this.props.memory.data
&& this.props.memory.data.data
) {
memoryData = this.props.memory.data.data.map(element => ({
name: element.valid_from,
'MEM used': element.data.length > 0 ? Math.floor(element.data[0].val) : 0,
}));
}
const contentStyle = this.props.half
? styles.content
: { ...styles.content, width: '100%' };
const hosts = this.props.services
? this.props.services.map((host) =>
<MenuItem
key={host.name}
value={host.name}
primaryText={ `${host.name} [${host.host}]`}
/>
)
: undefined;
return (
<HoverPaper style={contentStyle}>
<h3>GeoServer status</h3>
<SelectField
floatingLabelText="Host"
value={this.state.host}
onChange={this.handleChange}
>
{hosts}
</SelectField>
<div style={styles.stat}>
<CPU data={cpuData} />
<Memory data={memoryData} />
</div>
</HoverPaper>
);
}
setHost = (props) => {
if (props && props.services && props.timestamp) {
let host = props.services[0].name;
let firstTime = false;
if (this.state.host === '') {
firstTime = true;
this.setState({ host });
} else {
host = this.state.host;
}
if (firstTime || props.timestamp !== this.props.timestamp) {
this.get(host, props.interval);
}
}
}
}
export default GeoserverStatus;
|
src/static/containers/Home/index.js | KarimJedda/django-react-setup | import React from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';
import './style.scss';
import reactLogo from './images/react-logo.png';
import reduxLogo from './images/redux-logo.png';
class HomeView extends React.Component {
static propTypes = {
statusText: React.PropTypes.string
};
render() {
return (
<div className="container">
<div className="margin-top-medium text-center">
<img className="page-logo margin-bottom-medium"
src={reactLogo}
alt="ReactJs"
/>
<img className="page-logo margin-bottom-medium"
src={reduxLogo}
alt="Redux"
/>
</div>
<div className="text-center">
<h1>Django React Redux Demo</h1>
<h4>Hi, {this.props.userName || 'guest'}.</h4>
</div>
<div className="margin-top-medium text-center">
<p>Try some stuff <Link to="/protected"><b>protected content</b></Link>.</p>
</div>
<div className="margin-top-medium">
{this.props.statusText ?
<div className="alert alert-info">
{this.props.statusText}
</div>
:
null
}
</div>
</div>
);
}
}
const mapStateToProps = (state) => {
return {
userName: state.auth.userName,
statusText: state.auth.statusText
};
};
export default connect(mapStateToProps)(HomeView);
export { HomeView as HomeViewNotConnected };
|
examples/dynamic-segments/app.js | Sirlon/react-router | import React from 'react';
import { history } from 'react-router/lib/HashHistory';
import { Router, Route, Link, Redirect } from 'react-router';
var App = React.createClass({
render() {
return (
<div>
<ul>
<li><Link to="/user/123">Bob</Link></li>
<li><Link to="/user/abc">Sally</Link></li>
</ul>
{this.props.children}
</div>
);
}
});
var User = React.createClass({
render() {
var { userID } = this.props.params;
return (
<div className="User">
<h1>User id: {userID}</h1>
<ul>
<li><Link to={`/user/${userID}/tasks/foo`}>foo task</Link></li>
<li><Link to={`/user/${userID}/tasks/bar`}>bar task</Link></li>
</ul>
{this.props.children}
</div>
);
}
});
var Task = React.createClass({
render() {
var { userID, taskID } = this.props.params;
return (
<div className="Task">
<h2>User ID: {userID}</h2>
<h3>Task ID: {taskID}</h3>
</div>
);
}
});
React.render((
<Router history={history}>
<Route path="/" component={App}>
<Route path="user/:userID" component={User}>
<Route path="tasks/:taskID" component={Task}/>
<Redirect from="todos/:taskID" to="task"/>
</Route>
</Route>
</Router>
), document.getElementById('example'));
|
src/Accordion.js | HPate-Riptide/react-bootstrap | import React from 'react';
import PanelGroup from './PanelGroup';
class Accordion extends React.Component {
render() {
return (
<PanelGroup {...this.props} accordion>
{this.props.children}
</PanelGroup>
);
}
}
export default Accordion;
|
js/components/blankPage - Copy/index.js | phamngoclinh/PetOnline_vs2 |
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { actions } from 'react-native-navigation-redux-helpers';
import { Container, Header, Title, Content, Text, Button, Icon } from 'native-base';
import { openDrawer } from '../../actions/drawer';
import styles from './styles';
const {
popRoute,
} = actions;
class BlankPage extends Component {
static propTypes = {
name: React.PropTypes.string,
index: React.PropTypes.number,
list: React.PropTypes.arrayOf(React.PropTypes.string),
openDrawer: React.PropTypes.func,
popRoute: React.PropTypes.func,
navigation: React.PropTypes.shape({
key: React.PropTypes.string,
}),
}
popRoute() {
this.props.popRoute(this.props.navigation.key);
}
render() {
const { props: { name, index, list } } = this;
return (
<Container style={styles.container}>
<Header>
<Button transparent onPress={() => this.popRoute()}>
<Icon name="ios-arrow-back" />
</Button>
<Title>{(name) ? this.props.name : 'Blank Page'}</Title>
<Button transparent onPress={this.props.openDrawer}>
<Icon name="ios-menu" />
</Button>
</Header>
<Content padder>
<Text>
{(!isNaN(index)) ? list[index] : 'Create Something Awesome . . .'}
</Text>
</Content>
</Container>
);
}
}
function bindAction(dispatch) {
return {
openDrawer: () => dispatch(openDrawer()),
popRoute: key => dispatch(popRoute(key)),
};
}
const mapStateToProps = state => ({
navigation: state.cardNavigation,
name: state.user.name,
index: state.list.selectedIndex,
list: state.list.list,
});
export default connect(mapStateToProps, bindAction)(BlankPage);
|
frontend/src/components/dashboard/partnerDashboard/listOfPendingOffers.js | unicef/un-partner-portal | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Typography from 'material-ui/Typography';
import { TableCell } from 'material-ui/Table';
import HeaderList from '../../common/list/headerList';
import { loadPendingOffers } from '../../../reducers/pendingOffers';
import PaginatedList from '../../common/list/paginatedList';
import TableWithLocalState from '../../common/hoc/tableWithLocalState';
import EoiCountryCell from '../../eois/cells/eoiCountryCell';
import EoiSectorCell from '../../eois/cells/eoiSectorCell';
import ApplicationIDCell from './applicationId';
const messages = {
title: 'List of Pending Offers',
};
const columns = [
{ name: 'cn_id', title: 'Application ID' },
{ name: 'project_title', title: 'Project Title', width: 250 },
{ name: 'cfei_type', title: 'Offer Type' },
{ name: 'agency_name', title: 'UN Agency' },
{ name: 'countries', title: 'Country' },
{ name: 'specializations', title: 'Sector & Area of Specialization' },
];
const renderCells = ({ row, column, value }) => {
if (column.name === 'cn_id') {
return (<ApplicationIDCell type={row.cfei_type} eoiId={row.eoi_id} cnId={row.cn_id} />);
} else if (column.name === 'countries') {
return (
<TableCell >
{row.countries.map((code, index) =>
(<span key={code}>
<EoiCountryCell code={code} />
{(index === row.countries.length - 1) ? '' : ', '}
</span>),
)}
</TableCell>);
} else if (column.name === 'specializations') {
return (
<TableCell >
<EoiSectorCell data={row.specializations} id={row.id} />
</TableCell>);
}
return <TableCell><Typography>{value}</Typography></TableCell>;
};
renderCells.propTypes = {
row: PropTypes.object,
column: PropTypes.object,
};
const ListOfPendingOffers = (props) => {
const { loading, data = [], loadOffers, itemsCount } = props;
return (
<HeaderList
header={<Typography style={{ margin: 'auto 0' }} type="headline" >{messages.title}</Typography>}
loading={loading}
>
<TableWithLocalState
component={PaginatedList}
items={data}
itemsCount={itemsCount}
columns={columns}
loading={loading}
templateCell={renderCells}
loadingFunction={loadOffers}
/>
</HeaderList>
);
};
ListOfPendingOffers.propTypes = {
loading: PropTypes.bool,
data: PropTypes.array,
loadOffers: PropTypes.func,
itemsCount: PropTypes.number,
};
const mapStateToProps = state => ({
loading: state.pendingOffers.status.loading,
data: state.pendingOffers.data.pendingOffers,
itemsCount: state.pendingOffers.data.count,
});
const mapDispatchToProps = dispatch => ({
loadOffers: params => dispatch(loadPendingOffers(params)),
});
export default connect(mapStateToProps, mapDispatchToProps)(ListOfPendingOffers);
|
src/svg-icons/action/swap-vert.js | spiermar/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionSwapVert = (props) => (
<SvgIcon {...props}>
<path d="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"/>
</SvgIcon>
);
ActionSwapVert = pure(ActionSwapVert);
ActionSwapVert.displayName = 'ActionSwapVert';
ActionSwapVert.muiName = 'SvgIcon';
export default ActionSwapVert;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.