hexsha
stringlengths
40
40
size
int64
3
522k
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
6
191
max_stars_repo_name
stringlengths
6
110
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
list
max_stars_count
int64
1
82k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
6
191
max_issues_repo_name
stringlengths
6
110
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
list
max_issues_count
int64
1
74.7k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
6
191
max_forks_repo_name
stringlengths
6
110
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
list
max_forks_count
int64
1
17.8k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
3
522k
avg_line_length
float64
3
44.5k
max_line_length
int64
3
401k
alphanum_fraction
float64
0.08
1
tabs_spaces.tabs
bool
2 classes
tabs_spaces.spaces
bool
2 classes
react_component.class
bool
2 classes
react_component.function
bool
2 classes
d004cf1e61f9f489b010dec39b80c20a81697966
187
jsx
JSX
src/index.jsx
xMihai/esnext-react-starter
55d52425576957578ebeb2306bb0377946c94cd3
[ "MIT" ]
null
null
null
src/index.jsx
xMihai/esnext-react-starter
55d52425576957578ebeb2306bb0377946c94cd3
[ "MIT" ]
null
null
null
src/index.jsx
xMihai/esnext-react-starter
55d52425576957578ebeb2306bb0377946c94cd3
[ "MIT" ]
null
null
null
import React from 'react' import ReactDOM from 'react-dom' import { compose } from 'recompose' const C = () => <div>Hello</div> ReactDOM.render(<C />, document.getElementById('index'))
23.375
56
0.700535
false
true
false
true
d004cfae8af4c85f02e6bff6896ec042f4f7b10c
118
jsx
JSX
packages/decorator-barebones/src/input/option.jsx
fauxsoup/forml
6e273525a3e3b9bec5ab592df068340ec5ad1163
[ "MIT" ]
1
2021-06-10T13:36:13.000Z
2021-06-10T13:36:13.000Z
packages/decorator-barebones/src/input/option.jsx
fauxsoup/forml
6e273525a3e3b9bec5ab592df068340ec5ad1163
[ "MIT" ]
9
2020-03-31T00:38:03.000Z
2020-11-08T04:27:39.000Z
packages/decorator-barebones/src/input/option.jsx
fauxsoup/rjsf
90d4977920e0ebffe933b967090e013e85435be5
[ "MIT" ]
1
2020-11-24T01:26:46.000Z
2020-11-24T01:26:46.000Z
import React from 'react'; export default ({ value, children }) => ( <option value={value}>{children}</option> );
23.6
45
0.644068
false
true
false
true
d004d38a0e048a34b34a9e048eabfe2c47e982c9
689
jsx
JSX
src/components/Inputs/MultiSelect.jsx
chikoom/ScreenTemp
eb7cf7da8078f7144981c451ae6603ab1f8e17d7
[ "MIT" ]
null
null
null
src/components/Inputs/MultiSelect.jsx
chikoom/ScreenTemp
eb7cf7da8078f7144981c451ae6603ab1f8e17d7
[ "MIT" ]
null
null
null
src/components/Inputs/MultiSelect.jsx
chikoom/ScreenTemp
eb7cf7da8078f7144981c451ae6603ab1f8e17d7
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import { MDBSelect } from 'mdbreact' import { useState } from 'react' const options = [ { text: 'Option nr 1', value: '1', }, { text: 'Option nr 2', value: '2', }, { text: 'Option nr 3', value: '3', }, { text: 'Option nr 4', value: '4', }, { text: 'Option nr 5', value: '5', }, ] const MultiSelect = () => { const [options, setOptions] = useState(options) return ( <div> <MDBSelect color='primary' multiple options={options} selected='Choose your option' label='Example label' /> </div> ) } export default MultiSelect
15.311111
49
0.521045
false
true
false
true
d004d4a0b97e1f6e3dd9f7c80faaa46232d0c4a3
808
jsx
JSX
webclient/components/restaurant/child2.jsx
navinprasadk/zomato
cacb2097184b1a3a48f5fe285f08887a5d31e2c8
[ "Apache-2.0" ]
null
null
null
webclient/components/restaurant/child2.jsx
navinprasadk/zomato
cacb2097184b1a3a48f5fe285f08887a5d31e2c8
[ "Apache-2.0" ]
null
null
null
webclient/components/restaurant/child2.jsx
navinprasadk/zomato
cacb2097184b1a3a48f5fe285f08887a5d31e2c8
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import Cards from './Card.jsx'; import {Card} from 'semantic-ui-react'; class DisplayComponent extends React.Component { constructor() { super(); } render() { let res_data = this.props.handle2.map(function(objs) { return( <Cards name = {objs.restaurant.name} id = {objs.restaurant.id} image = {objs.restaurant.featured_image} location = {objs.restaurant.location.address} cuisines = {objs.restaurant.cuisines} ratings = {objs.restaurant.user_rating.aggregate_rating}/>); }); return ( <div> <Card.Group>{res_data}</Card.Group> </div> ); } } module.exports = DisplayComponent;
29.925926
76
0.548267
false
true
true
false
d004dbf5c870aaa315a92ef4cd346d62a8c880a9
2,850
jsx
JSX
src/pages/EditPlanner/ModalCreate/ModalCreate.jsx
DanielCabral/planner-pw
0f990ca05b589c95f67ddd3d7940251c5b6cdd1e
[ "MIT" ]
null
null
null
src/pages/EditPlanner/ModalCreate/ModalCreate.jsx
DanielCabral/planner-pw
0f990ca05b589c95f67ddd3d7940251c5b6cdd1e
[ "MIT" ]
null
null
null
src/pages/EditPlanner/ModalCreate/ModalCreate.jsx
DanielCabral/planner-pw
0f990ca05b589c95f67ddd3d7940251c5b6cdd1e
[ "MIT" ]
null
null
null
import { useState } from "react"; const ModalCreate = ({ closeModal, savePlanner }) => { const [name, setName] = useState(''); const changeName = (event) => { setName(event.target.value) } return ( <div className="fixed z-10 inset-0 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true"> <div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"> <div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div> <span className="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span> <div className="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"> <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> <div className="sm:flex sm:items-start"> <div className="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-green-100 sm:mx-0 sm:h-10 sm:w-10"> <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /> </svg> </div> <div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"> <h3 className="text-lg leading-6 font-medium text-gray-900" id="modal-title"> Criar Planner </h3> <div className="mt-2"> <input className="border-2 rounded-xl border-stroke focus:border-success px-6 py-2 outline-none focus:outline-none" placeholder="Nome do planner" value={name} onChange={changeName}></input> </div> </div> </div> </div> <div className="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse"> <button type="button" className="btn-fourth w-32" onClick={() => savePlanner(name)}> Salvar </button> <button type="button" className="btn-outlined w-32" onClick={closeModal}> Cancelar </button> </div> </div> </div> </div> ) } export default ModalCreate;
58.163265
225
0.510877
false
true
false
true
d004efc6b2de56c22e1f4adb6e30fe7a3ba0a1a4
1,282
jsx
JSX
src/components/SEUI/views/comment/comment.jsx
gisat/panther-backoffice
5d97caa74a9e2129ccb493a83dfc4732b8d1db04
[ "MIT" ]
1
2017-08-23T21:05:06.000Z
2017-08-23T21:05:06.000Z
src/components/SEUI/views/comment/comment.jsx
gisat/panther-backoffice
5d97caa74a9e2129ccb493a83dfc4732b8d1db04
[ "MIT" ]
1
2020-07-16T00:12:28.000Z
2020-07-16T00:12:28.000Z
src/components/SEUI/views/comment/comment.jsx
gisat/panther-backoffice
5d97caa74a9e2129ccb493a83dfc4732b8d1db04
[ "MIT" ]
1
2018-07-10T13:18:19.000Z
2018-07-10T13:18:19.000Z
import React from 'react'; import { Image, Content } from '../../elements'; import classNames from 'classnames'; function renderChildren(children) { let commentChildren = []; let contentChildren = []; React.Children.forEach(children, child => { // remove the Image default classes if (child.type === Image) { commentChildren.push( React.cloneElement( child, { component: 'a', avatar: true, key: 'commentAvatar', defaultClasses: false }, child.children ) ); } else { return contentChildren.push(child); } }); commentChildren.push( <Content key="commentContent"> {contentChildren} </Content> ); return commentChildren; } let Comment = ({ children, className, component, ...other }) => { other.className = classNames(className, { comment: true }); return React.createElement( component, other, renderChildren(children) ); }; Comment.propTypes = { children: React.PropTypes.node, className: React.PropTypes.any, component: React.PropTypes.oneOfType([ React.PropTypes.element, React.PropTypes.string ]) } Comment.defaultProps = { component: 'div' } exports.Comment = Comment;
20.677419
65
0.616225
true
false
false
true
d0050991db64cf3493371f5a67999551b0869195
1,046
jsx
JSX
app/javascript/client/components/SideMenu/SideMenu.jsx
severest/retrobot
d5a5b048c6d666028efa96682af7fe466cfd5c8a
[ "MIT" ]
6
2017-09-01T18:46:44.000Z
2021-04-28T23:25:12.000Z
app/javascript/client/components/SideMenu/SideMenu.jsx
severest/retrobot
d5a5b048c6d666028efa96682af7fe466cfd5c8a
[ "MIT" ]
25
2017-10-13T18:36:22.000Z
2022-03-08T17:45:25.000Z
app/javascript/client/components/SideMenu/SideMenu.jsx
severest/retrobot
d5a5b048c6d666028efa96682af7fe466cfd5c8a
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import retroBotInsetLogo from '../../assets/logo-dropshadow.png'; const SideMenu = ({ children, onCloseMenu, }) => { return ( <div className="sidebar-menu"> <div className="sidebar-menu--title"> <Link to="/"> <img src={retroBotInsetLogo} /> Retrobot </Link> </div> <div className="sidebar-menu--content"> {children} </div> <div className="sidebar-menu--content sidebar-menu--close"> <div className="sidebar-menu--group"> <button className="btn btn-dark" onClick={onCloseMenu}> <i className="fa fa-chevron-left" aria-hidden="true" /> Close </button> </div> </div> </div> ); }; SideMenu.propTypes = { children: PropTypes.node, onCloseMenu: PropTypes.func, }; SideMenu.defaultProps = { children: null, onCloseMenu: () => {}, }; export default SideMenu;
21.791667
67
0.575526
false
true
false
true
d0050c2c2452455e2eb963a1845534eb92c33cca
6,816
jsx
JSX
src/calendar.jsx
HydrationLabs/react-monthrange-picker
9613c7ee3667f316150e073ac69543b0138c6a67
[ "MIT" ]
1
2017-10-15T20:51:44.000Z
2017-10-15T20:51:44.000Z
src/calendar.jsx
HydrationLabs/react-monthrange-picker
9613c7ee3667f316150e073ac69543b0138c6a67
[ "MIT" ]
null
null
null
src/calendar.jsx
HydrationLabs/react-monthrange-picker
9613c7ee3667f316150e073ac69543b0138c6a67
[ "MIT" ]
null
null
null
import PropTypes from 'prop-types'; import React from 'react'; import $ from 'jquery'; import _ from 'lodash'; import CustomPropTypes from './utils/custom_prop_types'; import { YearStart, YearEnd } from './year'; class Calendar extends React.Component { constructor(props) { super(props); this.selectMonthFn = this.selectMonth.bind(this); let positionWidth; try { positionWidth = props.position.width; } catch (e) { positionWidth = 700; } let positionTop; try { positionTop = props.position.top; } catch (e) { positionTop = 0; } let positionLeft; try { positionLeft = props.position.left; } catch (e) { positionLeft = 0; } this.calStyle = { width: `${positionWidth}px`, top: `${positionTop}px`, left: `${positionLeft}px`, display: props.display || props.static ? 'block' : 'none', }; this.arrowStyle = {}; const { selectedDateRange, restrictionRange } = props; // using state here because on month selection // both yearstart and yearend gets re-rendered // rather than propagating to the App. // App component stores the current select so // that on apply it can just change the state // to the current stored selection. this.state = { selectedDateRange, restrictionRange }; } componentDidMount() { this.$el = $(this.node); this.setStyle(this.props); } setStyle(props) { let positionTop; try { positionTop = props.position.top; } catch (e) { positionTop = 0; } let positionLeft; try { positionLeft = props.position.left; } catch (e) { positionLeft = 0; } const calStyle = _.cloneDeep(this.calStyle); const arrowStyle = _.cloneDeep(this.arrowStyle); const picker = $(this.el).siblings('.picker'); const direction = this.props.direction; const adjustmentConstant = 10; const calDim = { height: $(this.el).height(), width: $(this.el).width(), }; const pickerDim = { height: picker.height(), width: picker.width(), }; if (direction === 'left' || direction === 'right') { calStyle.top = positionTop ? `${calStyle.top}px` : `-${calDim.height / 2}px`; if (direction === 'left') { const leftWidth = calDim.width + adjustmentConstant; calStyle.left = positionLeft ? `${calStyle.left}px` : `-${leftWidth}px`; } else { const rightWidth = pickerDim.width + adjustmentConstant; calStyle.left = positionLeft ? `${calStyle.left}px` : `${rightWidth}px`; } const arrowTop = Math.abs(parseInt(calStyle.top, 10)) + (pickerDim.height / 2); arrowStyle.top = `${arrowTop}px`; } else if (direction === 'top' || direction === 'bottom') { calStyle.left = positionLeft ? `${calStyle.left}px` : `-${(calDim.width - pickerDim.width) / 2}px`; if (direction === 'top') { const top = calDim.height + pickerDim.height; calStyle.top = positionTop ? `${calStyle.top}px` : `-${top}px`; } else { const top = pickerDim.height + adjustmentConstant; calStyle.top = positionTop ? `${calStyle.top}px` : `${top}px`; } const arrowLeft = Math.abs(parseInt(calStyle.left, 10)) + (pickerDim.width / 2); arrowStyle.left = `${arrowLeft}px`; } calStyle.display = props.display ? 'block' : 'none'; Object.assign(calStyle, props.calStyle); this.calStyle = calStyle; this.arrowStyle = arrowStyle; } UNSAFE_componentWillReceiveProps(nextProps) { this.setStyle(nextProps); const { selectedDateRange, restrictionRange } = _.cloneDeep(nextProps); this.state = { selectedDateRange, restrictionRange }; this.setState(this.state); } selectMonth(newDateRange) { const newDateRangeClone = newDateRange.clone(); if (newDateRangeClone.start > newDateRangeClone.end) { newDateRangeClone.end.month(newDateRangeClone.start.month()); newDateRangeClone.end.year(newDateRangeClone.start.year()); } if (this.props.onSelect) { this.props.onSelect(newDateRangeClone); } this.state.selectedDateRange = newDateRangeClone; this.setState(this.state); } render() { const selectedRange = this.state.selectedDateRange.clone(); const startDate = selectedRange.start; const endDate = selectedRange.end; const popOverClass = `${this.props.direction} popover`; return ( <div ref={node => (this.node = node)} className={popOverClass} style={this.calStyle}> {this.props.static || <div className="arrow" style={this.arrowStyle} />} <div className="clearfix sec-wrap"> <div className="calendar col-xs-10" style={this.props.hideButtons ? { width: '100%', paddingRight: '0px' } : null}> <div className="clearfix"> <div className="col-xs-6 year-start year"> <YearStart restrictionRange={this.props.restrictionRange} onYearChange={this.props.onYearChange} onSelect={this.selectMonthFn} currYear={startDate.clone()} selectedDateRange={selectedRange} /> </div> <div className="col-xs-6 year-end year"> <YearEnd restrictionRange={this.props.restrictionRange} onYearChange={this.props.onYearChange} onSelect={this.selectMonthFn} currYear={endDate.clone()} selectedDateRange={selectedRange} /> </div> </div> </div> {this.props.hideButtons || <div className="shortcuts col-xs-2"> <button onClick={this.props.onApply} type="button" className="btn btn-block btn-success" > Apply </button> <button onClick={this.props.onCancel} type="button" className="btn btn-default btn-block" > Cancel </button> </div> } </div> </div> ); } } Calendar.propTypes = { selectedDateRange: CustomPropTypes.MomentRangeType.isRequired, restrictionRange: CustomPropTypes.MomentRangeType.isRequired, direction: PropTypes.oneOf(['top', 'left', 'right', 'bottom']).isRequired, display: PropTypes.bool.isRequired, onSelect: PropTypes.func.isRequired, onApply: PropTypes.func, onCancel: PropTypes.func, onYearChange: PropTypes.func, position: PropTypes.shape({ width: PropTypes.string, top: PropTypes.string, left: PropTypes.string, }), static: PropTypes.bool, hideButtons: PropTypes.bool, }; export default Calendar;
30.565022
125
0.602993
false
true
true
false
d0051364613fb1257d6f9ddb7f22c39a3e456bc1
2,977
jsx
JSX
src/containers/dashboard/pages/OrgasManagement.jsx
ChenFred98/Foyer-Front
8271064e6814144895bc1bf5672cde9967f5cb2c
[ "MIT" ]
null
null
null
src/containers/dashboard/pages/OrgasManagement.jsx
ChenFred98/Foyer-Front
8271064e6814144895bc1bf5672cde9967f5cb2c
[ "MIT" ]
null
null
null
src/containers/dashboard/pages/OrgasManagement.jsx
ChenFred98/Foyer-Front
8271064e6814144895bc1bf5672cde9967f5cb2c
[ "MIT" ]
null
null
null
import React from 'react' import { List, Avatar, Spin, Input, Tooltip } from 'antd' import { connect } from 'react-redux' import { modifyImageDisplay } from '../../../redux/actions/asso' class AssoManagement extends React.Component { constructor(props) { super(props) this.state = { search: '' } } filterAsso = asso => { const { search } = this.state if (asso.name.toLowerCase().indexOf(search.toLowerCase()) >= 0) return true if (asso.login.toLowerCase().indexOf(search.toLowerCase()) >= 0) return true return false } render() { const { allasso } = this.props console.log('allasso:', allasso) if (!allasso) return <Spin /> const displayAsso = allasso.filter(this.filterAsso) return ( <div> <Input value={this.state.search} onChange={e => this.setState({ search: e.target.value })} placeholder='Rechercher une association' /> <List header={<div>Liste des associations :</div>} bordered dataSource={displayAsso} renderItem={item => { return ( <List.Item actions={[ <Tooltip placement='top' title={ item.displayImage ? 'Cacher le logo' : 'Afficher le logo' } > <a onClick={() => this.props.modifyImageDisplay( item.id, !item.displayImage ) } > {item.displayImage ? 'cacher' : 'afficher'} </a> </Tooltip> ]} > <List.Item.Meta avatar={ <Avatar src={`${process.env.REACT_APP_API}/assos/${ item.id }/image`} /> } title={ <a href={`${process.env.REACT_APP_API}/assos/${ item.id }/link`} > {item.name} </a> } description={ item.displayImage ? 'Le logo de cette association est affiché' : "Le logo de cette association n'est pas affiché" } /> </List.Item> ) }} /> </div> ) } } const mapStateToProps = state => ({ allasso: state.asso.assos }) const mapDispatchToProps = dispatch => ({ modifyImageDisplay: (id, displayImage) => dispatch(modifyImageDisplay(id, displayImage)) }) export default connect( mapStateToProps, mapDispatchToProps )(AssoManagement)
28.902913
80
0.437017
false
true
true
false
d00514b3d00f71b39edc1eb4169f5271abeb087c
1,555
jsx
JSX
src/components/Header/HeaderLinks.jsx
shaun86wang/queue-system-react-client
6727fc75e169174a9ffb4ce1a3af9e131810e79c
[ "MIT" ]
1
2021-03-16T05:31:17.000Z
2021-03-16T05:31:17.000Z
src/components/Header/HeaderLinks.jsx
shaun86wang/queue-system-react-client
6727fc75e169174a9ffb4ce1a3af9e131810e79c
[ "MIT" ]
null
null
null
src/components/Header/HeaderLinks.jsx
shaun86wang/queue-system-react-client
6727fc75e169174a9ffb4ce1a3af9e131810e79c
[ "MIT" ]
null
null
null
/*eslint-disable*/ import React from "react"; import { connect } from 'react-redux'; // react components for routing our app without refresh import { Link } from "react-router-dom"; // @material-ui/core components import withStyles from "@material-ui/core/styles/withStyles"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import Tooltip from "@material-ui/core/Tooltip"; // @material-ui/icons import { Apps, CloudDownload } from "@material-ui/icons"; // core components import { Button } from "../"; import headerLinksStyle from "assets/jss/material-kit-react/components/headerLinksStyle.jsx"; function HeaderLinks({ ...props }) { const { classes, user } = props; return ( <List className={classes.list}> <ListItem className={classes.listItem}> {!user && <Button color="transparent" className={classes.navLink} href='/login' > Login </Button>} {user && <div> Welcome, {user.studentName} <Button color="transparent" className={classes.navLink} href='/login' > Log Out </Button> </div> } </ListItem> </List> ); } function mapStateToProps(state) { const { user } = state.authentication; return { user } } let connectedHeaderLinkswithStype = connect(mapStateToProps)(withStyles(headerLinksStyle)(HeaderLinks)); export { connectedHeaderLinkswithStype as HeaderLinks };
26.355932
104
0.62701
false
true
false
true
d0052f15c27554b59a2c2d4a588dba71a4155afa
4,216
jsx
JSX
components/client-side/OpenMap.jsx
kimorkim/covid-2019-dashboard
b8e4259c447cdc888135ca743b6e1289046d7ae2
[ "MIT" ]
null
null
null
components/client-side/OpenMap.jsx
kimorkim/covid-2019-dashboard
b8e4259c447cdc888135ca743b6e1289046d7ae2
[ "MIT" ]
26
2020-02-15T16:29:49.000Z
2022-02-18T20:11:15.000Z
components/client-side/OpenMap.jsx
kimorkim/covid-2019-dashboard
b8e4259c447cdc888135ca743b6e1289046d7ae2
[ "MIT" ]
null
null
null
/** @jsx jsx */ import { jsx, css } from '@emotion/core'; import { Map, View, Feature, style } from 'ol'; import { fromLonLat } from 'ol/proj'; import { Point } from 'ol/geom'; import TileLayer from 'ol/layer/Tile'; import VectorLayer from 'ol/layer/Vector'; import OSM from 'ol/source/OSM'; import VectorSource from 'ol/source/Vector'; import { Circle as CircleStyle, Fill as FillStyle, Stroke as StrokeStyle, Style as OlStyle, } from 'ol/style'; import { useTheme } from 'emotion-theming'; import { useEffect, useRef, useState } from 'react'; import Popup from './popup'; const defaultPosition = [129, 38]; const getRadius = count => { return Math.max(Math.log2(count) * 2, 3); }; /*eslint camelcase: ["error", {allow: ["Province_State", "Country_Region"]}]*/ const createConfirmdMarker = (map, data = [], theme) => { const features = data.map(target => { const { Province_State, Country_Region, Lat, Long_, Confirmed, Deaths, Recovered, } = target; const circleFeature = new Feature({ geometry: new Point(fromLonLat([Long_, Lat])), content: ` 국가 : ${Country_Region} <br /> ${ Province_State ? `지역 : ${Province_State} <br />` : '' } 감염 : ${Confirmed} <br /> 사망 : ${Deaths} <br /> 회복 : ${Recovered}`, }); circleFeature.setStyle( new OlStyle({ image: new CircleStyle({ stroke: new StrokeStyle({ color: 'red', width: 2, }), radius: getRadius(Confirmed), fill: new FillStyle({ color: theme.colors.fontColor4, }), }), }) ); return circleFeature; }); map.addLayer( new VectorLayer({ source: new VectorSource({ features, }), }) ); }; const OpenMap = ({ data }) => { const theme = useTheme(); const mapEl = useRef(null); const [olMap, setOlMap] = useState(); const [popup, setPopup] = useState(); useEffect(() => { const map = new Map({ layers: [ new TileLayer({ className: 'ol-background', source: new OSM(), }), ], target: mapEl.current, view: new View({ center: fromLonLat(defaultPosition), zoom: 3, minZoom: 2, maxZoom: 19, }), }); setOlMap(map); }, [mapEl, setOlMap, setPopup]); useEffect(() => { if (olMap && popup) { olMap.addOverlay(popup); const pointEvent = e => { if (!e.dragging) { var pixel = olMap.getEventPixel(e.originalEvent); var hit = olMap.hasFeatureAtPixel(pixel); olMap.getTarget().style.cursor = hit ? 'pointer' : ''; } }; olMap.on('pointermove', pointEvent); return () => { olMap.removeOverlay(popup); olMap.removeEventListener('pointermove', pointEvent); }; } }, [olMap, popup]); useEffect(() => { if (olMap) { const { cases = {} } = data; createConfirmdMarker(olMap, cases.data, theme); } }, [olMap, data, theme]); return ( <> <div css={css` flex: 1; height: 100%; .ol-background { filter: grayscale(1); } `} ref={mapEl} ></div> <Popup onLoad={setPopup} olMap={olMap} /> </> ); }; export default OpenMap;
27.555556
78
0.433112
false
true
false
true
d005315c74c5ef3e15cb3d1d3cb70195ead1a51d
1,415
jsx
JSX
src/components/basins-tab/filters/slider_style.jsx
greenriver/aqueduct-water-risk
60d14048120f135d484ea54a4117658a33ea187a
[ "MIT" ]
null
null
null
src/components/basins-tab/filters/slider_style.jsx
greenriver/aqueduct-water-risk
60d14048120f135d484ea54a4117658a33ea187a
[ "MIT" ]
3
2021-07-14T15:10:34.000Z
2021-10-11T20:43:34.000Z
src/components/basins-tab/filters/slider_style.jsx
greenriver/aqueduct-water-risk
60d14048120f135d484ea54a4117658a33ea187a
[ "MIT" ]
null
null
null
export const style = ({colors}) => { const height = 14; const bgColors = colors || ['#ffffc1', '#fff063', '#ffc163', '#ff7263', '#c16363']; const gradientStops = bgColors.map((color, i) => { const basePercentage = 100 / bgColors.length; const percentOne = i > 1 ? `${basePercentage * i}%` : `${basePercentage}%`; const percentTwo = i > 0 ? `${basePercentage * (i + 1)}%` : ''; return ` ${color} ${percentOne} ${percentTwo}`; }); const handleStyle = { height: height * 2, width: height * 2, marginTop: (height / 2) * -1, border: 0, boxShadow: '1px 4px 10px 2px rgba(0,0,0,.4)', display: 'flex', justifyContent: 'center', alignItems: 'center', transform: 'translateX(-25%) !important' }; const trackStyle = { height, background: 'rgba(0,0,0,0)' }; const railStyle = { height, background: `linear-gradient(to right, ${gradientStops.join(', ')}` }; const dotStyle = { height: 8, width: 8, top: '-50%', bottom: 'auto', transform: 'translateY(50%)', background: 'rgba(0,0,0,.2)', border: 0, '&:nthChild(odd)': { height: '12px !important', width: '12px !important' }, '&:firstOfType': { transform: 'translateX(100%)' }, '&:lastOfType': { transform: 'translateX(-100%)' } }; return { dotStyle, handleStyle, railStyle, trackStyle }; };
25.727273
85
0.55689
false
true
false
true
d005367321d7a7d378c3a7e335d83a78ffc2eaf1
2,130
jsx
JSX
packages/pwa/app/components/swatch-group/index.jsx
sejal-salesforce/pwa-kit
9b641747886ebf74bd70738fcbf76768e6e67883
[ "BSD-3-Clause" ]
79
2021-09-09T00:27:10.000Z
2022-03-25T11:25:39.000Z
packages/pwa/app/components/swatch-group/index.jsx
sejal-salesforce/pwa-kit
9b641747886ebf74bd70738fcbf76768e6e67883
[ "BSD-3-Clause" ]
205
2021-09-09T15:05:20.000Z
2022-03-31T21:12:51.000Z
packages/pwa/app/components/swatch-group/index.jsx
sejal-salesforce/pwa-kit
9b641747886ebf74bd70738fcbf76768e6e67883
[ "BSD-3-Clause" ]
27
2021-09-09T15:03:40.000Z
2022-03-22T21:18:34.000Z
/* * Copyright (c) 2021, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import React from 'react' import PropTypes from 'prop-types' import {Flex, Box, HStack, useStyleConfig} from '@chakra-ui/react' import {noop} from '../../utils/utils' /** * SwatchGroup allows you to create a list of swatches * Each Swatch is a link with will direct to a href passed to them */ const SwatchGroup = (props) => { const {displayName, children, value, label = '', variant = 'square', onChange = noop} = props const styles = useStyleConfig('SwatchGroup') return ( <Flex {...styles.swatchGroup} role="radiogroup"> <HStack {...styles.swatchLabel}> <Box fontWeight="semibold">{`${label}:`}</Box> <Box>{displayName}</Box> </HStack> <Flex {...styles.swatchesWrapper}> {React.Children.map(children, (child) => { const childValue = child.props.value return React.cloneElement(child, { selected: childValue === value, key: childValue, value, variant, onChange }) })} </Flex> </Flex> ) } SwatchGroup.displayName = 'SwatchGroup' SwatchGroup.propTypes = { /** * The attribute name of the swatch group. E.g color, size */ label: PropTypes.string, /** * The selected Swatch value. */ value: PropTypes.string, /** * The display value of the selected option */ displayName: PropTypes.string, /** * The Swatch options to choose between */ children: PropTypes.array, /** * The shape of the swatches */ variant: PropTypes.oneOf(['square', 'circle']), /** * This function is called when a new option is selected */ onChange: PropTypes.func } export default SwatchGroup
29.178082
111
0.566197
false
true
false
true
d0053d800018fcf49a642dd0810bee84e5b3a227
1,132
jsx
JSX
src/layouts/BusinessServices.jsx
Canfone2209/Website-Gatsby
83f78091da55d194de0acdceeb93a5bf7cc144f9
[ "RSA-MD" ]
null
null
null
src/layouts/BusinessServices.jsx
Canfone2209/Website-Gatsby
83f78091da55d194de0acdceeb93a5bf7cc144f9
[ "RSA-MD" ]
null
null
null
src/layouts/BusinessServices.jsx
Canfone2209/Website-Gatsby
83f78091da55d194de0acdceeb93a5bf7cc144f9
[ "RSA-MD" ]
null
null
null
import React from "react" import FAChat from "../components/fa-chat" import CanMap from "../components/canfone-map" import PageHeader from "../components/page-header" import LandingSection from "components/landing-section" import Business from '../components/business-services'; export default function BusinessServices ({intro, section, lang, business}) { console.log(business.nodes[0].data.business_group[0].business_title[0].text); return <> <div className="header-phone"> <PageHeader title2={business.nodes[0].data.business_group[0].business_title[0].text} title3={business.nodes[0].data.business_group[0].business_desc[0].text} // serviceType={ (lang === "en") ? "Loren Epsum consectetur adipiscing elit" : "Bienvenue à Paris"} // price={"$" + intro.start_price} /> </div> <FAChat lang={lang}/> {/* <CanMap lang={lang}/> */} <Business /> <Business /> <div className="px-4 md:px-8 pt-6 md:pt-16 pb-10 md:pb-24"> {/* <LandingSection type={2} section_data={section[0]} /> */} <div className=""> </div> </div> </> }
30.594595
107
0.64311
false
true
false
true
d00543b4530b0953554894178d6ee5c869e2a0a6
1,485
jsx
JSX
src/components/ui/banners/index.jsx
yuxy000/yuxy-react-admin
f5c1bdd4974ecc7dca9aecc8a7498f159ff215a4
[ "MIT" ]
null
null
null
src/components/ui/banners/index.jsx
yuxy000/yuxy-react-admin
f5c1bdd4974ecc7dca9aecc8a7498f159ff215a4
[ "MIT" ]
null
null
null
src/components/ui/banners/index.jsx
yuxy000/yuxy-react-admin
f5c1bdd4974ecc7dca9aecc8a7498f159ff215a4
[ "MIT" ]
null
null
null
import React from 'react'; import { Row, Col, Card } from 'antd'; import BreadcrumbCustom from '../../Widgets/BreadcrumbCustom'; import Basic from './Basic'; import AutoPlay from './AutoPlay'; import Custom from './Custom'; class Banners extends React.Component { render() { return ( <div className="gutter-example button-demo"> <BreadcrumbCustom first="UI" second="轮播图" /> <Row gutter={16}> <Col className="gutter-row" md={24}> <div className="gutter-box"> <Card title="基本用法" bordered={false}> <Basic /> </Card> </div> </Col> <Col className="gutter-row" md={24}> <div className="gutter-box"> <Card title="自动轮播-默认5秒" bordered={false}> <AutoPlay /> </Card> </div> </Col> <Col className="gutter-row" md={24}> <div className="gutter-box"> <Card title="自定义左右箭头与缩略图" bordered={false}> <Custom /> </Card> </div> </Col> </Row> </div> ); } } export default Banners;
34.534884
71
0.394613
false
true
true
false
d0054462b1d3c178b1ef767e574523c9f3f92a73
2,477
jsx
JSX
assets/js/components/labels/LabelAddChannelModal.jsx
isabella232/console-2
d4a4aca0e11c945c9698f46cb171d4645177038a
[ "Apache-2.0" ]
null
null
null
assets/js/components/labels/LabelAddChannelModal.jsx
isabella232/console-2
d4a4aca0e11c945c9698f46cb171d4645177038a
[ "Apache-2.0" ]
1
2021-04-03T09:29:31.000Z
2021-04-03T09:29:31.000Z
assets/js/components/labels/LabelAddChannelModal.jsx
isabella232/console-2
d4a4aca0e11c945c9698f46cb171d4645177038a
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react' import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import withGql from '../../graphql/withGql' import { addLabelsToChannel } from '../../actions/label' import analyticsLogger from '../../util/analyticsLogger' import { ALL_CHANNELS } from '../../graphql/channels' import { Modal, Button, Select, Typography } from 'antd'; const { Option } = Select const { Text } = Typography class LabelAddChannelModal extends Component { state = { channelId: null } handleSubmit = (e) => { e.preventDefault(); const { channelId } = this.state const labelIds = this.props.labels.map(l => l.id) this.props.addLabelsToChannel(labelIds, channelId) analyticsLogger.logEvent("ACTION_ADD_LABELS_TO_CHANNEL", { labels: labelIds, channel: channelId }) this.props.onClose() } handleSelectOption = (channelId) => { this.setState({ channelId }) } render() { const { open, onClose, labels } = this.props const { allChannels } = this.props.allChannelsQuery return ( <Modal title={`Add Integration to ${labels ? labels.length : 0} Label${labels && labels.length === 1 ? "" : "s"}`} visible={open} centered onCancel={onClose} onOk={this.handleSubmit} footer={[ <Button key="back" onClick={onClose}> Cancel </Button>, <Button key="submit" type="primary" onClick={this.handleSubmit} disabled={!labels || labels.length === 0} > Add Integration </Button>, ]} > <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center'}}> <Text>Select an integration to attach to your selected Label{labels && labels.length === 1 ? "" : "s"}:</Text> <Select onChange={this.handleSelectOption} style={{ width: 200, marginTop: 12 }} > {allChannels && allChannels.map(c => ( <Option value={c.id} key={c.id}>{c.name}</Option> ))} </Select> </div> </Modal> ) } } function mapDispatchToProps(dispatch) { return bindActionCreators({ addLabelsToChannel }, dispatch) } export default connect(null, mapDispatchToProps)( withGql(LabelAddChannelModal, ALL_CHANNELS, props => ({ fetchPolicy: 'cache-and-network', variables: {}, name: 'allChannelsQuery' })) )
30.580247
135
0.599516
false
true
true
false
d0054b5d0a284616df69f62879f9e50d1f938edc
383
jsx
JSX
source/client/components/dashboard.jsx
dodekeract/impequid
af84ef3ddc1b5227c4baacfdb84ec60f04b548ca
[ "MIT" ]
3
2015-09-21T00:30:01.000Z
2016-08-03T04:53:17.000Z
source/client/components/dashboard.jsx
dodekeract/impequid
af84ef3ddc1b5227c4baacfdb84ec60f04b548ca
[ "MIT" ]
2
2016-01-02T01:09:01.000Z
2016-06-19T15:45:55.000Z
source/client/components/dashboard.jsx
impequid/impequid
af84ef3ddc1b5227c4baacfdb84ec60f04b548ca
[ "MIT" ]
1
2016-06-19T15:34:51.000Z
2016-06-19T15:34:51.000Z
import React from 'react'; import Apps from './apps'; export default class Main extends React.Component { render () { const {actions, state} = this.props; return ( <main> <div className="jumbotron custom-noradius"> <div className="container"> <h1>Your Apps</h1> </div> </div> <Apps actions={actions} state={state.apps}/> </main> ); } }
16.652174
51
0.608355
true
false
true
false
d0055c9e010aedabeaaecfc06da307c394295df6
1,408
jsx
JSX
src/Components/Home/New.jsx
kausko/Tic-Tac-Toe-Client
d8aa92b60ef40a8df2ba3090790f5ec9a5a8cba7
[ "MIT" ]
null
null
null
src/Components/Home/New.jsx
kausko/Tic-Tac-Toe-Client
d8aa92b60ef40a8df2ba3090790f5ec9a5a8cba7
[ "MIT" ]
null
null
null
src/Components/Home/New.jsx
kausko/Tic-Tac-Toe-Client
d8aa92b60ef40a8df2ba3090790f5ec9a5a8cba7
[ "MIT" ]
null
null
null
import PopCard from "./PopCard" import { RobotOutlined, UsergroupAddOutlined } from "@ant-design/icons" import { useState } from "react" import { useHistory } from "react-router" import { Button, notification, Space, Typography } from "antd" function New() { const [loading, setLoading] = useState(false) const history = useHistory() const handlePVP = () => { setLoading(true) fetch(process.env.REACT_APP_BASE_URI + "/game", { method: "POST", headers: { "content-type": "application/json", }, }) .then((res) => res.json()) .then((json) => { history.push({ pathname: `/${json.gameID}`, state: json, }) notification.info({ message: ( <Typography.Text copyable={{ text: json.gameID }}> Game {json.gameID} created </Typography.Text> ), duration: 0, }) }) .catch((err) => { setLoading(false) notification.error({ message: err.message }) }) } const handlePVC = () => history.push("/computer") return ( <PopCard title="New Game" content={ <Space> <Button icon={<UsergroupAddOutlined />} onClick={handlePVP} loading={loading} > Vs Player </Button> <Button icon={<RobotOutlined />} onClick={handlePVC} loading={loading} > Vs Computer </Button> </Space> } placement="bottom" /> ) } export default New
20.114286
71
0.587358
true
false
false
true
d00572f313de80c28c654b04677b3c64d276f5ad
3,128
jsx
JSX
public/js/components/Menu.jsx
ryanlfoster/unleash
d3a765c86ac7ed74557333d3335583a4adb9526e
[ "Apache-2.0" ]
null
null
null
public/js/components/Menu.jsx
ryanlfoster/unleash
d3a765c86ac7ed74557333d3335583a4adb9526e
[ "Apache-2.0" ]
null
null
null
public/js/components/Menu.jsx
ryanlfoster/unleash
d3a765c86ac7ed74557333d3335583a4adb9526e
[ "Apache-2.0" ]
1
2018-07-27T16:52:31.000Z
2018-07-27T16:52:31.000Z
var React = require('react'); var User = require('./User'); var Menu = React.createClass({ render: function() { return ( <div className="topbar mbl"> <div className="container"> <div className="page"> <div className="fright-ht768"> <User /> </div> <div className="nav-level1 h4"> <a href="#" className="homelink pln"> <span className="topbar-nav-svg-home"> <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53M y5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MjcuNDExIiBoZWlnaHQ9IjE2OS4z OTgiIHZpZXdCb3g9IjAgMCA1MjcuNDExIDE2OS4zOTgiPjxwYXRoIGZpbGw 9IiNmZmYiIGQ9Ik00NjguNTA3IDBoLTI1Ni4xODdjLTIxLjcwNyAwLTQwLj Y5NSAxMS44MTItNTAuOTEyIDI5LjMzNy0xMC4yMTYtMTcuNTI1LTI5LjIwN C0yOS4zMzctNTAuOTExLTI5LjMzN2gtNTEuNTk1Yy0zMi40NzkgMC01OC45 MDIgMjYuNDI1LTU4LjkwMiA1OC45MDV2NTEuNTg3YzAgMzIuNDgxIDI2LjQ yMyA1OC45MDYgNTguOTAyIDU4LjkwNmg0MDkuNjA1YzMyLjQ3OSAwIDU4Lj kwMy0yNi40MjUgNTguOTAzLTU4LjkwNnYtNTEuNTg3Yy4wMDEtMzIuNDgtM jYuNDIzLTU4LjkwNS01OC45MDMtNTguOTA1eiIvPjxwYXRoIGZpbGw9IiMw OWYiIGQ9Ik00NjguNTA3IDE1My4zODNjMjMuNjg3IDAgNDIuODg4LTE5LjE 5OSA0Mi44ODgtNDIuODl2LTUxLjU4OGMwLTIzLjY5MS0xOS4yMDEtNDIuOD ktNDIuODg4LTQyLjg5aC0yNTYuMTg3Yy0yMy42ODYgMC00Mi44ODcgMTkuM Tk4LTQyLjg4NyA0Mi44OXY5NC40NzhoMjk5LjA3NHoiLz48cGF0aCBmaWxs PSIjMDA2IiBkPSJNMTUzLjM4NCAxNTMuMzgzdi05NC40NzhjMC0yMy42OTE tMTkuMjAxLTQyLjg5LTQyLjg4Ny00Mi44OWgtNTEuNTk1Yy0yMy42ODYgMC 00Mi44ODcgMTkuMTk4LTQyLjg4NyA0Mi44OXY1MS41ODdjMCAyMy42OTEgM TkuMjAxIDQyLjg5IDQyLjg4NyA0Mi44OWg5NC40ODJ6Ii8%2BPHJlY3QgeD 0iMzIwLjE1NiIgeT0iNzUuMjc1IiBmaWxsPSIjZmZmIiB3aWR0aD0iMTkuN jIxIiBoZWlnaHQ9IjUzLjIxMSIvPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0y NjIuOTEyIDg2LjI4MWMwLTUuNTI5IDMuODEzLTExLjAwNiAxMy4wNjktMTE uMDA2aDI4LjQyMXYxNS42MTNoLTE4LjYxMmMtMi40OTggMC0zLjI1NS45OT ItMy4yNTUgMi42NjR2Ny40NzJoMjEuODY3djE1LjYxaC0yMS44Njd2MTEuO DUyaC0xOS42MjN2LTQyLjIwNXpNMzc1LjE2NSA5MS4wOTloMTAuMzk5YzIu NDA5IDAgMy4yNDYuODMyIDMuMjQ2IDMuMjM1bC0uMDA4IDM0LjE1MmgxOS4 2MzJ2LTQxLjk5NmMwLTUuNTI3LTMuODE1LTExLjAwNC0xMy4wNjktMTEuMD A0aC0zOS44MjRsLS4wMSA1M2gxOS42MzR2LTM3LjM4N3pNNDQyLjcxOSA5M S4wOTloMTAuNGMyLjQwOCAwIDMuMjQ1LjgzMiAzLjI0NSAzLjIzNWwtLjAw OSAzNC4xNTJoMTkuNjM0di00MS45OTZjMC01LjUyNy0zLjgxNS0xMS4wMDQ tMTMuMDctMTEuMDA0aC0zOS44MjNsLS4wMSA1M2gxOS42MzN2LTM3LjM4N3 oiLz48L3N2Zz4%3D" width="106" height="34" /> </span> <span className="topbar-nav-svg-caption caption showbydefault hide-lt900"> unleash admin </span> </a> {this.props.children} </div> </div> </div> </div> ); } }); module.exports = Menu;
49.650794
79
0.695332
false
true
false
true
d005740103da26bfaf77da3a4e97d5e845c5b840
721
jsx
JSX
front/src/components/ListOfText.jsx
rgalicia0729/toolbox-challenge
fb3d11e0139527c55435546fd8cb22cbd082b43b
[ "MIT" ]
null
null
null
front/src/components/ListOfText.jsx
rgalicia0729/toolbox-challenge
fb3d11e0139527c55435546fd8cb22cbd082b43b
[ "MIT" ]
null
null
null
front/src/components/ListOfText.jsx
rgalicia0729/toolbox-challenge
fb3d11e0139527c55435546fd8cb22cbd082b43b
[ "MIT" ]
null
null
null
import React from 'react'; import { connect } from 'react-redux'; import InputOfText from './InputOfText'; const ListOfText = ({ palindrome }) => { return ( <div className="row"> <div className="col-md-2" /> <div className="col-md-8"> <div className="card"> <div className="card-body"> { palindrome.texts.map((text) => ( <InputOfText key={text.text} {...text} /> )) } </div> </div> </div> <div className="col-md-2" /> </div> ); }; const mapStateToProps = (state) => { return { palindrome: state.palindrome } } export default connect(mapStateToProps, null)(ListOfText);
21.848485
58
0.527046
false
true
false
true
d0057faab689eadbf3f1d45ee39150a0927d1d81
535
jsx
JSX
app/screens/Local/Local.jsx
Magicalburritos/Shoptestapp
3b42516f8403fd7a97dfea317c8cc7aac7d9ee15
[ "MIT" ]
null
null
null
app/screens/Local/Local.jsx
Magicalburritos/Shoptestapp
3b42516f8403fd7a97dfea317c8cc7aac7d9ee15
[ "MIT" ]
null
null
null
app/screens/Local/Local.jsx
Magicalburritos/Shoptestapp
3b42516f8403fd7a97dfea317c8cc7aac7d9ee15
[ "MIT" ]
null
null
null
import React from 'react'; import { View, Text, StyleSheet } from 'react-native'; import WebView from 'react-native-webview'; import useLocation from './hooks'; const styles = StyleSheet.create({ butts: { flex: 1, backgroundColor: '#fff', }, }); export default function Local() { const [location] = useLocation(); return ( <View style={styles.butts}> <WebView source={{ uri: `https://www.shop.com/shoplocal/search?query=&queryLocation=${location}`, }} /> </View> ); }
20.576923
88
0.611215
false
true
false
true
d0058dd4bbcaf9354557681028611041dcfd947a
832
jsx
JSX
client/src/App.jsx
Dmdv/ReactUrlShortener
d3cb06376f79a0a8fbda210461721b33b3b2e2e5
[ "Apache-2.0" ]
null
null
null
client/src/App.jsx
Dmdv/ReactUrlShortener
d3cb06376f79a0a8fbda210461721b33b3b2e2e5
[ "Apache-2.0" ]
null
null
null
client/src/App.jsx
Dmdv/ReactUrlShortener
d3cb06376f79a0a8fbda210461721b33b3b2e2e5
[ "Apache-2.0" ]
null
null
null
import React from 'react' import { BrowserRouter as Router } from 'react-router-dom' import { useRoutes } from './routes' import { useAuth } from './hooks/auth.hook' import { AuthContext } from './context/AuthContext' import { Navbar } from './components/Navbar' import { Loader } from './components/Loader' import 'materialize-css' function App() { const { token, login, logout, userId, ready } = useAuth() const isAuthenticated = !!token const routes = useRoutes(isAuthenticated) if (!ready) { return <Loader/> } return ( <AuthContext.Provider value={{ token, login, logout, userId, isAuthenticated }}> <Router> {isAuthenticated && <Navbar/>} <div className="container"> {routes} </div> </Router> </AuthContext.Provider> ) } export default App
24.470588
59
0.645433
false
true
false
true
d0058ef72c203d42b91b902ae3e13bf64c5643f9
881
jsx
JSX
frontend/src/Components/LandingPage/LandingPage.jsx
quangngoc8321/Not-Reddit
154e1f94eb2bf81f6c33d169bee56b5fbba74686
[ "MIT" ]
11
2022-01-18T06:19:05.000Z
2022-03-08T13:17:27.000Z
frontend/src/Components/LandingPage/LandingPage.jsx
quangngoc8321/Not-Reddit
154e1f94eb2bf81f6c33d169bee56b5fbba74686
[ "MIT" ]
10
2021-12-05T09:48:04.000Z
2022-03-15T06:22:30.000Z
frontend/src/Components/LandingPage/LandingPage.jsx
quangngoc8321/Not-Reddit
154e1f94eb2bf81f6c33d169bee56b5fbba74686
[ "MIT" ]
5
2022-01-18T06:21:34.000Z
2022-03-15T08:43:32.000Z
import "./landing.css"; import phoneMockup from "../../assets/phone.png"; import { useNavigate } from "react-router-dom"; const LandingPage = () => { const navigate = useNavigate(); const goToSignIn = () => { navigate("/login"); }; const goToSignUp = () => { navigate("/register"); }; return ( <section className="landing-container"> <div className="landing-header"> Reddat <span className="beta"> Beta </span> </div> <div className="landing-sub"> Definitely not Reddit</div> <img src={phoneMockup} className="phone-mockup" alt="phone mockup" /> <div className="button-container"> <button className="login" onClick={goToSignIn}> Sign in </button> <button className="register" onClick={goToSignUp}> Sign up </button> </div> </section> ); }; export default LandingPage;
29.366667
89
0.611805
false
true
false
true
d005c455a9eaf7d4b6539c685b027dd9385dc58c
1,778
jsx
JSX
src/containers/twoResponsibilities/abnormalWarning/subPage/Point_Rodar.jsx
JackDan9/jackdan_react_echarts
db67683f5f871ee0a6a051e6504697c5b73daa8c
[ "MIT" ]
1
2018-03-07T12:21:56.000Z
2018-03-07T12:21:56.000Z
src/containers/twoResponsibilities/abnormalWarning/subPage/Point_Rodar.jsx
JackDan9/jackdan_react_echarts
db67683f5f871ee0a6a051e6504697c5b73daa8c
[ "MIT" ]
4
2020-12-22T08:55:57.000Z
2022-02-12T13:17:47.000Z
src/containers/twoResponsibilities/abnormalWarning/subPage/Point_Rodar.jsx
JackDan9/jackdan_react_echarts
db67683f5f871ee0a6a051e6504697c5b73daa8c
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import Echart from 'echarts'; export default class Point extends Component { constructor(props) { super(props); } componentDidMount(){ this.draw(); } draw = ()=>{ let myChart = Echart.init(document.getElementById('rodar')); let option = { radar: { shape: 'circle', center: ['50%', '50%'], radius: '65%', indicator: [{ name: '指标一', max: 100, min: 1 }, { name: '指标二', max: 100, min: 1 }, { name: '指标三', max: 100, min: 1 }, { name: '指标四', max: 100, min: 1 }, { name: '指标五', max: 100, min: 1 }, ], name: { formatter: function(d, e) { e.nameTextStyle = { color: '#ffffff', fontSize: 14 }; return d; } }, splitArea: { show: false, } }, series: [{ name: '', type: 'radar', //areaStyle: {normal: {}}, // data: _d.data data: [{ value: [15,20,35,50,30], name: '企业详情', areaStyle: { normal: { opacity: 1, color: '#38cad7' } }, }, ], lineStyle: { normal: { color: '#38cad7' } }, itemStyle: { normal: { borderColor: '#ffffff', borderWidth: 3 } }, }] }; myChart.setOption(option); }; render() { return ( <div id="rodar" style={{width:'100%',height:'100%'}}></div> ) } }
18.914894
65
0.369516
false
true
true
false
d005e3829e1ef27f940df98e02da05035e692a30
8,512
jsx
JSX
tests/components/edit_channel_purpose_modal.test.jsx
edify/mattermost-webapp
8baa8d572f018de57787ebaf45a45f4bc98e507d
[ "Apache-2.0" ]
null
null
null
tests/components/edit_channel_purpose_modal.test.jsx
edify/mattermost-webapp
8baa8d572f018de57787ebaf45a45f4bc98e507d
[ "Apache-2.0" ]
null
null
null
tests/components/edit_channel_purpose_modal.test.jsx
edify/mattermost-webapp
8baa8d572f018de57787ebaf45a45f4bc98e507d
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import {RequestStatus} from 'mattermost-redux/constants'; import {shallow} from 'enzyme'; import EditChannelPurposeModal from 'components/edit_channel_purpose_modal/edit_channel_purpose_modal.jsx'; import Constants from 'utils/constants.jsx'; describe('comoponents/EditChannelPurposeModal', () => { const channel = { id: 'fake-id', purpose: 'purpose' }; it('should match on init', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={true} requestStatus={RequestStatus.NOT_STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); expect(wrapper).toMatchSnapshot(); }); it('should match with display name', () => { const channelWithDisplayName = { ...channel, display_name: 'channel name' }; const wrapper = shallow( <EditChannelPurposeModal channel={channelWithDisplayName} ctrlSend={true} requestStatus={RequestStatus.NOT_STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); expect(wrapper).toMatchSnapshot(); }); it('should match for private channel', () => { const privateChannel = { ...channel, type: 'P' }; const wrapper = shallow( <EditChannelPurposeModal channel={privateChannel} ctrlSend={true} requestStatus={RequestStatus.NOT_STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); expect(wrapper).toMatchSnapshot(); }); it('should match submitted', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={true} requestStatus={RequestStatus.STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); expect(wrapper).toMatchSnapshot(); }); it('match with modal error', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={false} requestStatus={RequestStatus.STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); const serverError = { id: 'api.context.invalid_param.app_error', message: 'error' }; wrapper.setProps({ channel, serverError, ctrlSend: false, requestStatus: RequestStatus.FAILURE, onModalDismissed: jest.fn(), actions: {patchChannel: jest.fn()} }); expect(wrapper).toMatchSnapshot(); }); it('match with modal error with fake id', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={false} requestStatus={RequestStatus.STARTED} onModalDismissed={jest.fn()} actions={{patchCHannel: jest.fn()}} />, {disableLifecycleMethods: true} ); const serverError = { id: 'fake-error-id', message: 'error' }; wrapper.setProps({ channel, serverError, ctrlSend: false, requestStatus: RequestStatus.FAILURE, onModalDismissed: jest.fn(), actions: {patchChannel: jest.fn()} }); expect(wrapper).toMatchSnapshot(); }); it('clear error on next', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={false} requestStatus={RequestStatus.STARTED} onModalDismissed={jest.fn()} actions={{patchCHannel: jest.fn()}} />, {disableLifecycleMethods: true} ); const serverError = { id: 'fake-error-id', message: 'error' }; wrapper.setProps({ channel, serverError, ctrlSend: false, requestStatus: RequestStatus.FAILURE, onModalDismissed: jest.fn(), actions: {patchChannel: jest.fn()} }); wrapper.setProps({ channel, serverError, ctrlSend: false, requestStatus: RequestStatus.STARTED, onModalDismissed: jest.fn(), actions: {patchChannel: jest.fn()} }); expect(wrapper).toMatchSnapshot(); }); it('update purpose state', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={true} requestStatus={RequestStatus.STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); wrapper.find('textarea').simulate( 'change', { preventDefault: jest.fn(), target: {value: 'new info'} } ); expect(wrapper.state('purpose')).toBe('new info'); }); it('hide on success', () => { const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={true} requestStatus={RequestStatus.STARTED} onModalDismissed={jest.fn()} actions={{patchChannel: jest.fn()}} />, {disableLifecycleMethods: true} ); wrapper.setProps({ channel, ctrlSend: false, requestStatus: RequestStatus.SUCCESS, onModalDismissed: jest.fn(), actions: {patchChannel: jest.fn()} }); expect(wrapper.state('show')).toBeFalsy(); }); it('submit on save button click', () => { const patchChannel = jest.fn(); const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={true} requestStatus={RequestStatus.NOT_STARTED} onModalDismissed={jest.fn()} actions={{patchChannel}} />, {disableLifecycleMethods: true} ); wrapper.find('.save-button').simulate('click'); expect(patchChannel).toBeCalledWith('fake-id', {purpose: 'purpose'}); }); it('submit on ctrl + enter', () => { const patchChannel = jest.fn(); const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={true} requestStatus={RequestStatus.NOT_STARTED} onModalDismissed={jest.fn()} actions={{patchChannel}} />, {disableLifecycleMethods: true} ); wrapper.find('textarea').simulate('keydown', { preventDefault: jest.fn(), keyCode: Constants.KeyCodes.ENTER, ctrlKey: true }); expect(patchChannel).toBeCalledWith('fake-id', {purpose: 'purpose'}); }); it('submit on enter', () => { const patchChannel = jest.fn(); const wrapper = shallow( <EditChannelPurposeModal channel={channel} ctrlSend={false} requestStatus={RequestStatus.NOT_STARTED} onModalDismissed={jest.fn()} actions={{patchChannel}} />, {disableLifecycleMethods: true} ); wrapper.find('textarea').simulate('keydown', { preventDefault: jest.fn(), keyCode: Constants.KeyCodes.ENTER, ctrlKey: false }); expect(patchChannel).toBeCalledWith('fake-id', {purpose: 'purpose'}); }); });
29.250859
107
0.508459
false
true
false
true
d005e4d3233cd2866820aaa7527cb3dfeb861680
325
jsx
JSX
icons/jsx/Reply.jsx
openedx/paragon
370b558a906d5f1f451c204a0b1f653feccc24ac
[ "Apache-2.0" ]
5
2022-02-16T17:22:51.000Z
2022-03-29T13:50:03.000Z
icons/jsx/Reply.jsx
arizzitano/excalibur
5dc4acfaa731e7d7a4e9f13b492f73891f8ae970
[ "Apache-2.0" ]
196
2022-01-12T19:25:24.000Z
2022-03-31T17:12:27.000Z
icons/jsx/Reply.jsx
arizzitano/excalibur
5dc4acfaa731e7d7a4e9f13b492f73891f8ae970
[ "Apache-2.0" ]
2
2022-01-20T11:50:25.000Z
2022-01-26T17:25:41.000Z
import * as React from "react"; function SvgReply(props) { return ( <svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} viewBox="0 0 24 24" {...props} > <path d="M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z" /> </svg> ); } export default SvgReply;
18.055556
75
0.532308
false
true
false
true
d005f67d1854535ef5fcd4d94f8bd14e47cebb46
868
jsx
JSX
frontend/util/route_util.jsx
ade713/tumblr_clone_fsp
8ba66145c2c1f619d02c3a1c956b7e12496148ad
[ "CC-BY-3.0" ]
null
null
null
frontend/util/route_util.jsx
ade713/tumblr_clone_fsp
8ba66145c2c1f619d02c3a1c956b7e12496148ad
[ "CC-BY-3.0" ]
null
null
null
frontend/util/route_util.jsx
ade713/tumblr_clone_fsp
8ba66145c2c1f619d02c3a1c956b7e12496148ad
[ "CC-BY-3.0" ]
null
null
null
import React from 'react'; import { connect } from 'react-redux'; import { Route, Redirect, withRouter } from 'react-router-dom'; const Auth = ({ component: Component, path, loggedIn }) => ( <Route path={ path } render={ (props) => ( !loggedIn ? ( <Component {...props} /> ) : ( <Redirect to="/dashboard" /> ) )} /> ); const Protected = ({ component: Component, path, loggedIn }) => ( <Route path={ path } render={ (props) => ( loggedIn ? ( <Component {...props} /> ) : ( <Redirect to="/" /> ) )} /> ); const mapStateToProps = state => { return { loggedIn: Boolean(state.session.currentUser)}; }; export const AuthRoute = withRouter( connect(mapStateToProps, null)(Auth) ); export const ProtectedRoute = withRouter( connect(mapStateToProps, null)(Protected) );
22.842105
65
0.572581
false
true
false
true
d005fcfb21571eec90f72a8134333faafb12f04a
670
jsx
JSX
src/components/theme/Footer/index.jsx
ualarm/my_portfolio_netlify
214c80de43ced2485ab403e87af61c3186b3f9b7
[ "MIT" ]
null
null
null
src/components/theme/Footer/index.jsx
ualarm/my_portfolio_netlify
214c80de43ced2485ab403e87af61c3186b3f9b7
[ "MIT" ]
null
null
null
src/components/theme/Footer/index.jsx
ualarm/my_portfolio_netlify
214c80de43ced2485ab403e87af61c3186b3f9b7
[ "MIT" ]
null
null
null
import React from 'react' import { Container } from 'components/common' import { Wrapper, Flex, Links, Details } from './styles' import social from './social.json' export const Footer = () => ( <Wrapper> <Flex as={Container}> <Details> <h2>Shan Mi</h2> <span> Copyright © {new Date().getFullYear()} All rights reserved. </span> </Details> <Links> {social.map(({ id, name, link, icon }) => ( <a key={id} href={link} target="_blank" rel="noopener noreferrer" aria-label={`follow me on ${name}`} > <img width="24" src={icon} alt={name} /> </a> ))} </Links> </Flex> </Wrapper> )
21.612903
64
0.558209
true
false
false
true
d00606430e02420482a16474dcfac379916500f2
536
jsx
JSX
www/src/components/Header.jsx
iverly/pulseheberg-node-tester
f7f62f7c57fbe69e858eabd206dce3da681ae562
[ "MIT" ]
null
null
null
www/src/components/Header.jsx
iverly/pulseheberg-node-tester
f7f62f7c57fbe69e858eabd206dce3da681ae562
[ "MIT" ]
6
2021-03-02T00:55:53.000Z
2022-03-26T00:26:11.000Z
www/src/components/Header.jsx
iverly/pulseheberg-node-tester
f7f62f7c57fbe69e858eabd206dce3da681ae562
[ "MIT" ]
null
null
null
import React from 'react'; const Header = () => { return ( <nav className="navbar navbar-dark bg-primary"> <div className="container"> <div className="navbar-brand mx-auto"> <img src="https://pbs.twimg.com/profile_images/1211317115363434498/KodeXB4k_400x400.jpg" width="30" height="30" className="d-inline-block align-top mr-2" alt="" /> Node tester for Pulseheberg </div> </div> </nav> ) } export default Header;
31.529412
183
0.559701
false
true
false
true
d006285c3deaced60339d214b0aed8afa6546b71
636
jsx
JSX
src/Message.jsx
krl87/chatty-app
ec3d2fe8b0c03a54a9506afd8f0dcf5808170003
[ "MIT" ]
null
null
null
src/Message.jsx
krl87/chatty-app
ec3d2fe8b0c03a54a9506afd8f0dcf5808170003
[ "MIT" ]
4
2020-07-17T04:46:28.000Z
2022-02-26T11:21:59.000Z
src/Message.jsx
krl87/chatty-app
ec3d2fe8b0c03a54a9506afd8f0dcf5808170003
[ "MIT" ]
null
null
null
import React, {Component} from 'react'; class Message extends Component { render() { return ( <div className="messageSystem"> <div className="message"> { this.props.message.type === "incomingMessage" ? <div> <span className="message-username">{this.props.message.username}</span> <span className="message-content">{this.props.message.content}</span> </div> : <span><strong> {this.props.message.content} </strong></span> } </div> <div className="message system"> </div> </div> ) } } export default Message;
27.652174
85
0.56761
false
true
true
false
d00631ad4b0d709b08bb99f9024043218f761cbf
3,372
jsx
JSX
src/js/containers/award/idv/IdvAwardAmountsSectionContainer.jsx
Violet26/usaspending-website
7e083b8cbd1b2aaec179af3dd52f87ac86fd6dfb
[ "CC0-1.0" ]
null
null
null
src/js/containers/award/idv/IdvAwardAmountsSectionContainer.jsx
Violet26/usaspending-website
7e083b8cbd1b2aaec179af3dd52f87ac86fd6dfb
[ "CC0-1.0" ]
null
null
null
src/js/containers/award/idv/IdvAwardAmountsSectionContainer.jsx
Violet26/usaspending-website
7e083b8cbd1b2aaec179af3dd52f87ac86fd6dfb
[ "CC0-1.0" ]
null
null
null
/** * AwardAmountsContainer.jsx * Created by David Trinh 2/8/2019 **/ import React from 'react'; import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { isCancel } from 'axios'; import * as IdvHelper from 'helpers/idvHelper'; import * as awardActions from 'redux/actions/award/awardActions'; import BaseAwardAmounts from 'models/v2/awardsV2/BaseAwardAmounts'; import AggregatedAwardAmounts from 'components/award/idv/amounts/AggregatedAwardAmounts'; const propTypes = { award: PropTypes.object, setCounts: PropTypes.func, jumpToSection: PropTypes.func }; export class IdvAmountsContainer extends React.Component { constructor(props) { super(props); this.awardRequest = null; this.state = { error: false, inFlight: true, awardAmounts: null }; } componentDidMount() { this.getSelectedAward(this.props.award.id); } componentDidUpdate(prevProps) { if (this.props.award.id !== prevProps.award.id) { this.getSelectedAward(this.props.award.id); } } componentWillUnmount() { if (this.awardRequest) { this.awardRequest.cancel(); } } getSelectedAward(id) { if (this.awardRequest) { // A request is currently in-flight, cancel it this.awardRequest.cancel(); } this.awardRequest = IdvHelper.fetchAwardAmounts(id); this.awardRequest.promise .then((res) => { this.parseAward(res.data); // operation has resolved this.awardRequest = null; }) .catch((error) => { console.log(error); if (isCancel(error)) { // Got cancelled } else if (error.response) { this.awardRequest = null; this.setState({ error: true, inFlight: false }); } else { // Request failed this.awardRequest = null; console.log(error); } }); } parseAward(data) { const awardAmounts = Object.create(BaseAwardAmounts); awardAmounts.populate(data, 'idv_aggregated'); this.setState({ awardAmounts, error: false, inFlight: false }); // Store the counts in Redux for use in the referenced awards table // and related awards section this.props.setCounts({ child_awards: data.child_award_count, child_idvs: data.child_idv_count, grandchild_awards: data.grandchild_award_count, total: data.child_idv_count + data.child_award_count + data.grandchild_award_count }); } render() { return ( <div> <AggregatedAwardAmounts {...this.state} jumpToSection={this.props.jumpToSection} /> </div> ); } } IdvAmountsContainer.propTypes = propTypes; export default connect( (state) => ({ award: state.award }), (dispatch) => bindActionCreators(awardActions, dispatch) )(IdvAmountsContainer);
27.867769
99
0.559905
false
true
true
false
d0063471ebd54b37b4508c74781b8b4311411bbc
476
jsx
JSX
src/index.jsx
tchon/yarsk2
615b6f50a3a4fea06acc17b0770f560447a061d7
[ "MIT" ]
null
null
null
src/index.jsx
tchon/yarsk2
615b6f50a3a4fea06acc17b0770f560447a061d7
[ "MIT" ]
null
null
null
src/index.jsx
tchon/yarsk2
615b6f50a3a4fea06acc17b0770f560447a061d7
[ "MIT" ]
null
null
null
// IMPORTANT: This needs to be first (before any other components) // to get around CSS order randomness in webpack. import './css/base'; // Some ES6+ features require the babel polyfill // More info here: https://babeljs.io/docs/usage/polyfill/ // Uncomment the following line to enable the polyfill // require("babel/polyfill"); import React from 'react'; import Application from './components/Application'; React.render(<Application />, document.getElementById('app'));
34
66
0.747899
false
true
false
true
d0064d2a971776eb15886da705e95caef1d292da
224
jsx
JSX
src/applications/terms-and-conditions/routes.jsx
jennilynhowell/vets-website
4edea8aee0c80cdbaa0ff731d5e60dc814ed63b7
[ "CC0-1.0" ]
null
null
null
src/applications/terms-and-conditions/routes.jsx
jennilynhowell/vets-website
4edea8aee0c80cdbaa0ff731d5e60dc814ed63b7
[ "CC0-1.0" ]
null
null
null
src/applications/terms-and-conditions/routes.jsx
jennilynhowell/vets-website
4edea8aee0c80cdbaa0ff731d5e60dc814ed63b7
[ "CC0-1.0" ]
1
2018-09-26T12:02:49.000Z
2018-09-26T12:02:49.000Z
import MhvTermsAndConditions from './containers/MhvTermsAndConditions'; const routes = [ { path: 'health-care/medical-information-terms-conditions', component: MhvTermsAndConditions } ]; export default routes;
20.363636
71
0.754464
false
true
false
true
d0064f12bdf8136284fc73b28b1b8d89699bd85f
1,704
jsx
JSX
spec/javascript/components/forms/pxe-details.test.jsx
mzazrivec/manageiq-providers-redfish
48bee587771344d585540f1cdd14fd7af8b79f5c
[ "Apache-2.0" ]
null
null
null
spec/javascript/components/forms/pxe-details.test.jsx
mzazrivec/manageiq-providers-redfish
48bee587771344d585540f1cdd14fd7af8b79f5c
[ "Apache-2.0" ]
null
null
null
spec/javascript/components/forms/pxe-details.test.jsx
mzazrivec/manageiq-providers-redfish
48bee587771344d585540f1cdd14fd7af8b79f5c
[ "Apache-2.0" ]
1
2020-12-17T11:30:57.000Z
2020-12-17T11:30:57.000Z
import PxeDetails from '../../../../app/javascript/components/forms/pxe-details' let renderComponent; let physicalServers = [1, 2, 3]; let pxeServers = [{value: 'pxe1', label: 'PXE1'}]; let pxeImages = [{value: 'img1', label: 'IMG1'}]; let templates = [{value: 'templ1', label: 'TEMPL1'}]; describe('PxeDetails', () => { beforeAll(() => { renderComponent = (loading = false, physicalServers = [], pxeServers = [], pxeImages = [], templates = []) => shallowRedux( <PxeDetails updateFormState={jest.fn()} loading={loading} physicalServerIds={physicalServers} pxeServers={pxeServers} pxeImages={pxeImages} customizationTemplates={templates} /> ); }); describe('renders', () => { it('spinner', () => { let component = renderComponent(true); expect(toJson(component)).toMatchSnapshot(); }); describe('form', () => { it('without pxe servers', () => { let component = renderComponent(false, physicalServers); expect(toJson(component)).toMatchSnapshot(); }); it('with pxe servers', () => { let component = renderComponent(false, physicalServers, pxeServers); expect(toJson(component)).toMatchSnapshot(); }); it('with pxe servers and pxe images', () => { let component = renderComponent(false, physicalServers, pxeServers, pxeImages); expect(toJson(component)).toMatchSnapshot(); }); it('with pxe servers and pxe images and templates', () => { let component = renderComponent(false, physicalServers, pxeServers, pxeImages, templates); expect(toJson(component)).toMatchSnapshot(); }); }); }); });
33.411765
127
0.611502
false
true
false
true
d0065329d293fbaf218c367a82e5f4a5a421f027
1,860
jsx
JSX
src/components/Control/TripReplaysView/Map/StopsLayer/StopsLayer.jsx
AT-Labs/command_centre
f8e2d45774d872db804015e311fc197a02c387e6
[ "MIT" ]
null
null
null
src/components/Control/TripReplaysView/Map/StopsLayer/StopsLayer.jsx
AT-Labs/command_centre
f8e2d45774d872db804015e311fc197a02c387e6
[ "MIT" ]
null
null
null
src/components/Control/TripReplaysView/Map/StopsLayer/StopsLayer.jsx
AT-Labs/command_centre
f8e2d45774d872db804015e311fc197a02c387e6
[ "MIT" ]
null
null
null
import PropTypes from 'prop-types'; import React from 'react'; import { connect } from 'react-redux'; import { FeatureGroup } from 'react-leaflet'; import _ from 'lodash-es'; import StopMarker from './StopMarker'; import './StopsLayer.scss'; import { getCurrentTripState } from '../../../../../redux/selectors/control/tripReplays/currentTrip'; function StopsLayer(props) { const { stops, selectedKeyEvent, hoveredKeyEvent, selectedKeyEventId, currentTrip, clearSelectedKeyEvent } = props; const handleOnClick = (event) => { clearSelectedKeyEvent(selectedKeyEvent && selectedKeyEvent.id !== _.get(event, 'layer.options.id')); }; return ( <FeatureGroup onClick={ handleOnClick }> { stops.map(stop => (_.has(stop, 'stopLat') ? ( <StopMarker key={ `${stop.stopCode}_${stop.stopSequence}` } selectedKeyEvent={ selectedKeyEvent } openTooltip={ hoveredKeyEvent === `${stop.stopCode}_${stop.stopSequence}` } openPopup={ selectedKeyEvent && selectedKeyEventId === `${stop.stopCode}_${stop.stopSequence}` } stop={ stop } currentTrip={ currentTrip } /> ) : null)) } </FeatureGroup> ); } StopsLayer.propTypes = { stops: PropTypes.array, currentTrip: PropTypes.object.isRequired, selectedKeyEvent: PropTypes.object, hoveredKeyEvent: PropTypes.string, selectedKeyEventId: PropTypes.string, clearSelectedKeyEvent: PropTypes.func.isRequired, }; StopsLayer.defaultProps = { stops: [], selectedKeyEvent: null, hoveredKeyEvent: '', selectedKeyEventId: '', }; export default connect( state => ({ currentTrip: getCurrentTripState(state), }), )(StopsLayer);
35.09434
120
0.615054
false
true
false
true
d00653b8ca50e0a7df91b3b3a392050e113c3d17
160
jsx
JSX
public/javascripts/client.jsx
USF-COT/CVIEW
55acb2651157380995494f01f3df8102e88f1fea
[ "MIT" ]
null
null
null
public/javascripts/client.jsx
USF-COT/CVIEW
55acb2651157380995494f01f3df8102e88f1fea
[ "MIT" ]
null
null
null
public/javascripts/client.jsx
USF-COT/CVIEW
55acb2651157380995494f01f3df8102e88f1fea
[ "MIT" ]
null
null
null
var React = require('react'); var CVIEWApp = require('./components/CVIEWApp.jsx'); React.render( <CVIEWApp />, document.getElementById('cviewapp') );
17.777778
52
0.675
false
true
false
true
d006a25abfcd9b93fc0ca5ca18e2fc45dc61729e
2,417
jsx
JSX
src/stores/connectors.jsx
lucatomassi/lumafi
77ae6298a8d6546e0c3664322c6e8bbc311d0d29
[ "MIT" ]
null
null
null
src/stores/connectors.jsx
lucatomassi/lumafi
77ae6298a8d6546e0c3664322c6e8bbc311d0d29
[ "MIT" ]
null
null
null
src/stores/connectors.jsx
lucatomassi/lumafi
77ae6298a8d6546e0c3664322c6e8bbc311d0d29
[ "MIT" ]
null
null
null
import { InjectedConnector } from "@web3-react/injected-connector"; // import { NetworkConnector } from "@web3-react/network-connector"; import { WalletConnectConnector } from "@web3-react/walletconnect-connector"; import { WalletLinkConnector } from "@web3-react/walletlink-connector"; import { LedgerConnector } from "@web3-react/ledger-connector"; import { TrezorConnector } from "@web3-react/trezor-connector"; import { FrameConnector } from "@web3-react/frame-connector"; import { FortmaticConnector } from "@web3-react/fortmatic-connector"; import { PortisConnector } from "@web3-react/portis-connector"; import { SquarelinkConnector } from "@web3-react/squarelink-connector"; import { TorusConnector } from "@web3-react/torus-connector"; import { AuthereumConnector } from "@web3-react/authereum-connector"; const POLLING_INTERVAL = 12000; const RPC_URLS = { 1: "https://eth-mainnet.alchemyapi.io/v2/EK1NW0oYG9sXJH970wuPLdwrBZDh8Bcd", 4: "https://rinkeby.infura.io/v3/0a7a8304cc374fe084bea683dc310320" }; export const injected = new InjectedConnector({ supportedChainIds: [1, 3, 4, 5, 42] }); // export const network = new NetworkConnector({ // urls: { 1: RPC_URLS[1], 4: RPC_URLS[4] }, // defaultChainId: 1, // pollingInterval: POLLING_INTERVAL // }); export const walletconnect = new WalletConnectConnector({ rpc: { 4: RPC_URLS[4] }, bridge: "https://bridge.walletconnect.org", qrcode: true, pollingInterval: POLLING_INTERVAL }); export const walletlink = new WalletLinkConnector({ url: RPC_URLS[4], appName: "yearn.finance" }); export const ledger = new LedgerConnector({ chainId: 4, url: RPC_URLS[4], pollingInterval: POLLING_INTERVAL }); export const trezor = new TrezorConnector({ chainId: 4, url: RPC_URLS[4], pollingInterval: POLLING_INTERVAL, manifestEmail: "[email protected]", manifestAppUrl: "https://8rg3h.csb.app/" }); export const frame = new FrameConnector({ supportedChainIds: [4] }); export const fortmatic = new FortmaticConnector({ apiKey: "pk_live_F95FEECB1BE324B5", chainId: 4 }); export const portis = new PortisConnector({ dAppId: "5dea304b-33ed-48bd-8f00-0076a2546b60", networks: [1, 100] }); export const squarelink = new SquarelinkConnector({ clientId: "5f2a2233db82b06b24f9", networks: [1, 100] }); export const torus = new TorusConnector({ chainId: 4 }); export const authereum = new AuthereumConnector({ chainId: 4 });
31.802632
77
0.736864
false
true
false
true
d006bc30c8b5c6a3f2cbb6a913aefa7e6b2c9544
6,911
jsx
JSX
bookapp/src/components/search/withFormik/Search.withFormik.jsx
marattm/huit
daee0ab6eddb7791b9a7f5532258743e61032c87
[ "MIT" ]
null
null
null
bookapp/src/components/search/withFormik/Search.withFormik.jsx
marattm/huit
daee0ab6eddb7791b9a7f5532258743e61032c87
[ "MIT" ]
null
null
null
bookapp/src/components/search/withFormik/Search.withFormik.jsx
marattm/huit
daee0ab6eddb7791b9a7f5532258743e61032c87
[ "MIT" ]
null
null
null
import React, { Component, Fragment } from 'react'; import { Jumbotron, Collapse } from 'react-bootstrap'; import { withFormik } from 'formik'; import SearchForm from "./SearchForm.withFormik"; import SearchPagination from '../pagination/SearchPagination'; import SearchResults from './SearchResults.withFormik'; import { validationSearch } from "../../../services/validation.schemas.service"; import { getBooks } from '../../../services/functions' const formikEnhancer = withFormik({ // import validation schema validationSchema: validationSearch, mapPropsToValues: () => ({ query: '', maxResults: '10', type: 'relevance', filter: 'all', printType: 'all', language: 'all', buttonType: '', startIndex: 0 }), handleSubmit: (values, { resetForm, props, setSubmitting }) => { getBooks( values.query, values.startIndex, values.maxResults, values.type, values.filter, values.printType, values.language, values.buttonType) .then((res) => { props.onSuccess({ res, queryData: { query: values.query, startIndex: values.startIndex, maxResults: values.maxResults, type: values.type, filter: values.filter, printType: values.printType, language: values.language } }) }) .catch((err) => { console.log(err) }) resetForm() setSubmitting(false) } }) const MyEnhancedForm = formikEnhancer(SearchForm); class Search extends Component { constructor(props) { super(props); this.state = { title: 'Search books..', books: [], query: '', type: 'relevance', printType: 'all', filter: 'all', language: 'all', maxResults: "10", option: 'title', startIndex: 0, displayDisabled: false, previousButtonDisabled: true, searchMode: false } this.handlePreviousNext = this.handlePreviousNext.bind(this); } handleNextButtonBehavior() { /** * Trigger the getBook() for the next button case. */ let newStartIndex2 = this.state.startIndex + parseInt(this.state.maxResults); getBooks(this.state.query, newStartIndex2, this.state.maxResults, this.state.type, this.state.filter, this.state.printType, this.state.language, "next") .then((res) => { this.setState({ values: res.res.data.items }) }) .catch((err) => { console.log(err); }); this.setState({ startIndex: newStartIndex2 }); } handlePreviousButtonBehavior() { /** * Trigger the getBook() for the previous button case. */ let newStartIndex = Math.abs(this.state.startIndex - parseInt(this.state.maxResults)); getBooks(this.state.query, newStartIndex, this.state.maxResults, this.state.type, this.state.filter, this.state.printType, this.state.language, "prev") .then((res) => { this.setState({ values: res.res.data.items }) }) .catch((err) => { console.log(err); }); this.setState({ startIndex: newStartIndex }); } handlePreviousNext(event) { /** * Redirect to handleNextButtonBehavior or handleNextButtonBehavior depending on the previous and next button case. * @param {object} event - Carry the target name, either prev or next. */ if (event.target.name === "next") { this.handleNextButtonBehavior() } if (event.target.name === "prev") { this.handlePreviousButtonBehavior() } } handleOnSuccess = (value) => { /** * Update the general state. * @param {object} eventKey - Value of the dropdown button. */ this.setState({ values: value.res.res.data.items, displayDisabled: value.res.displayDisabledValue, previousButtonDisabled: value.res.displayDisabledValue, query: value.queryData.query, startIndex: value.queryData.startIndex, maxResults: value.queryData.maxResults, type: value.queryData.type, filter: value.queryData.filter, printType: value.queryData.printType, language: value.queryData.language, searchMode: true }) } render() { return ( <Fragment> {/* SEARCH INPUT */} <Jumbotron style={{ backgroundColor: 'transparent' }}> <h1 style={{ color: 'white' }} className='container'> {this.state.title} </h1> <MyEnhancedForm onSuccess={this.handleOnSuccess} /> </Jumbotron> {/* PAGINATION TOP */} {this.state.values ? <SearchPagination bot={false} displayDisabled={this.state.displayDisabled} startIndex={this.state.startIndex} previousButtonDisabled={this.state.previousButtonDisabled} query={this.state.query} maxResults={this.state.maxResults} handlePreviousNext={this.handlePreviousNext} /> : null} {/* SEARCH RESULTS BLOCK */} {this.state.searchMode ? < SearchResults books={this.state.values} /> : null} {/* PAGINATION BOTTOM */} {this.state.values ? <Collapse in={this.state.displayDisabled}> <SearchPagination bot={true} displayDisabled={this.state.displayDisabled} startIndex={this.state.startIndex} previousButtonDisabled={this.state.previousButtonDisabled} query={this.state.query} maxResults={this.state.maxResults} handlePreviousNext={this.handlePreviousNext} /> </Collapse> : null} </Fragment > ) } } export default Search;
31.413636
160
0.50369
false
true
true
false
d006c0659d4d30f074865dc4b8e5f0e6a129a160
814
jsx
JSX
app/javascript/components/Artists/Artist.jsx
zachariahchow/coldpress-records
153d5f6c0054c052565309b60406949a713b2147
[ "MIT" ]
null
null
null
app/javascript/components/Artists/Artist.jsx
zachariahchow/coldpress-records
153d5f6c0054c052565309b60406949a713b2147
[ "MIT" ]
7
2021-03-10T21:30:12.000Z
2022-03-31T01:28:08.000Z
app/javascript/components/Artists/Artist.jsx
zachariahchow/coldpress-records
153d5f6c0054c052565309b60406949a713b2147
[ "MIT" ]
null
null
null
import React from 'react'; import { Link } from 'react-router-dom'; const Artist = ({ artistData }) => { //CSS Classes // return ( <div className="artist__container my-2 w-full sm:w-auto flex flex-col justify-around items-center"> <div className="artist-name__container"> <p className="artist-name text-center px-2 py-2 border-b-2 mb-2 tracking-wider uppercase hover:text-gray-700 hover:border-gray-600"><Link to={`artists/${artistData.id}`}>{artistData.name}</Link></p> </div> <div className="artist-thumbnail__container mx-4 mb-2 mt-1 w-auto h-auto"> <img className="artist-thumbnail object-cover" src={artistData.thumbnail_img} alt={artistData.name}/> </div> </div> ); } export default Artist;
35.391304
214
0.626536
false
true
false
true
d006ccf16c1b87d85ada48243f1075e7a453a7a6
39
jsx
JSX
src/Components/Footertext/index.jsx
citi-onboarding/ecossistema-ejs-client
0af6c9c054e4d971af0191dc628aa086b9956b66
[ "MIT" ]
null
null
null
src/Components/Footertext/index.jsx
citi-onboarding/ecossistema-ejs-client
0af6c9c054e4d971af0191dc628aa086b9956b66
[ "MIT" ]
null
null
null
src/Components/Footertext/index.jsx
citi-onboarding/ecossistema-ejs-client
0af6c9c054e4d971af0191dc628aa086b9956b66
[ "MIT" ]
null
null
null
export { default } from './Footertext';
39
39
0.692308
false
true
false
true
d006d7dd1aedd04c7b77fa6f5b7ea8aa9cba79cd
2,151
jsx
JSX
ui/pages/vms/index.jsx
hwuerz/steep
fac9d00d2c2c31157638b1e0a3dcfec7dd2d84df
[ "Apache-2.0" ]
18
2020-02-03T08:30:47.000Z
2022-03-28T03:05:01.000Z
ui/pages/vms/index.jsx
steep-wms/steep
5329d61c7362bcf2e2ccc7fbce0e9466bc98bbd6
[ "Apache-2.0" ]
199
2020-05-21T07:34:10.000Z
2022-03-31T05:37:47.000Z
ui/pages/vms/index.jsx
hwuerz/steep
fac9d00d2c2c31157638b1e0a3dcfec7dd2d84df
[ "Apache-2.0" ]
4
2020-06-17T05:18:40.000Z
2021-08-03T14:47:22.000Z
import ListPage from "../../components/layouts/ListPage" import Ago from "../../components/Ago" import ListItem from "../../components/ListItem" import Tooltip from "../../components/Tooltip" import VMContext from "../../components/vms/VMContext" import { useMemo } from "react" import vmToProgress from "../../components/vms/vm-to-progress" import { formatDistanceToNow } from "date-fns" import { formatDate, formatDuration, formatDurationTitle } from "../../components/lib/date-time-utils" const FILTERS = [{ name: "status", title: "Failed VMs only", enabledValue: "ERROR" }, { name: "status", title: "Running VMs only", enabledValue: "RUNNING" }] function formatterToNow(addSuffix) { return (value, unit, suffix, epochSeconds) => formatDistanceToNow(epochSeconds, { addSuffix, includeSeconds: true }) } function VMListItem({ item: vm }) { return useMemo(() => { let href = "/vms/[id]" let as = `/vms/${vm.id}` let progress = vmToProgress(vm) let subtitle if (vm.creationTime && vm.destructionTime) { let agoEndTitle = formatDate(vm.destructionTime) let duration = formatDuration(vm.creationTime, vm.destructionTime) let durationTitle = formatDurationTitle(vm.creationTime, vm.destructionTime) subtitle = (<> Destroyed <Ago date={vm.destructionTime} formatter={formatterToNow(true)} title={agoEndTitle} /> (was up for <Tooltip title={durationTitle}>{duration}</Tooltip>) </>) } else if (vm.creationTime) { let agoTitle = formatDate(vm.creationTime) subtitle = <>Up since <Ago date={vm.creationTime} formatter={formatterToNow(false)} title={agoTitle} /></> } return <ListItem key={vm.id} justAdded={vm.justAdded} deleted={vm.deleted} linkHref={href} linkAs={as} title={vm.id} subtitle={subtitle} startTime={vm.creationTime} endTime={vm.destructionTime} progress={progress} labels={vm.setup.providedCapabilities} /> }, [vm]) } const VMs = () => ( <ListPage title="VMs" Context={VMContext} ListItem={VMListItem} subjects="VMs" path="vms" filters={FILTERS} /> ) export default VMs
34.693548
102
0.675965
false
true
false
true
d006dc07f71ec06ada5d25774ff9053ed44885cd
1,161
jsx
JSX
src/components/Dashboard/Forms/UserProfileForm/ProfileCards/Education/edit/GraduationYearEditable.jsx
PinkmanusRex/frontend
7890251985bf596f0acba3b442d672072ee9db2a
[ "MIT" ]
null
null
null
src/components/Dashboard/Forms/UserProfileForm/ProfileCards/Education/edit/GraduationYearEditable.jsx
PinkmanusRex/frontend
7890251985bf596f0acba3b442d672072ee9db2a
[ "MIT" ]
null
null
null
src/components/Dashboard/Forms/UserProfileForm/ProfileCards/Education/edit/GraduationYearEditable.jsx
PinkmanusRex/frontend
7890251985bf596f0acba3b442d672072ee9db2a
[ "MIT" ]
null
null
null
import React from "react"; import PropTypes from "prop-types"; import {Col} from "reactstrap"; import { AvField } from "availity-reactstrap-validation"; const GraduationYearEditable = (props) => { const {mobile, user, updateUser} = props; return ( <Col xs={(mobile) ? 12 : 4}> <AvField name="gy" label="Graduation Year *" type="number" placeholder="yyyy" value={user.grad_year} onChange={(e) => updateUser({...user, grad_year : e.target.value})} validate={{ required: { value: true, errorMessage: "Invalid graduation year" }, max: { value: 2030, errorMessage: "Graduation year must be between 2020 and 2030" }, min: { value: 2020, errorMessage: "Graduation year must be between 2020 and 2030" } }} /> </Col> ); }; GraduationYearEditable.propTypes = { mobile : PropTypes.bool.isRequired, user : PropTypes.shape({ grad_year : PropTypes.string, }).isRequired, updateUser : PropTypes.func.isRequired, }; export default GraduationYearEditable;
36.28125
109
0.587425
false
true
false
true
d006e3cce931ded81f7357e8380f180f429ff276
798
jsx
JSX
client/src/components/DatePicker/DatePicker.jsx
sjdonado/qr-attendance-app
af025e2b865e7f029a74342e5b5d699c647433d2
[ "MIT" ]
8
2019-11-30T20:35:29.000Z
2020-06-08T15:51:11.000Z
client/src/components/DatePicker/DatePicker.jsx
sjdonado/qr-attendance-app
af025e2b865e7f029a74342e5b5d699c647433d2
[ "MIT" ]
36
2019-11-30T16:15:33.000Z
2020-07-01T20:00:15.000Z
client/src/components/DatePicker/DatePicker.jsx
sjdonado/qr-attendance-app
af025e2b865e7f029a74342e5b5d699c647433d2
[ "MIT" ]
null
null
null
import React from 'react'; import { DateTimePicker } from "@material-ui/pickers"; const DatePicker = ({ id, name, form: { setFieldValue }, field: { value }, placeholder, label, helperText, className, InputProps, InputLabelProps, }) => { //console.log(rest); return ( <DateTimePicker name={name} inputVariant="outlined" id={id} label={label} helperText={helperText} className={className} InputProps={InputProps} InputLabelProps={InputLabelProps} placeholder={placeholder} onChange={value => { console.log("setting value to", value); setFieldValue(id, value); }} value={value} /> ); }; export default DatePicker;
21.567568
54
0.56391
false
true
false
true
d0073854dd57bd0cf74556d3000bd295dd7c1e8a
849
jsx
JSX
src/components/navigation/NavConfig.jsx
tiagoassunc/Portfolio
a2abba7f07c667020164511343ae5843001753f8
[ "MIT" ]
null
null
null
src/components/navigation/NavConfig.jsx
tiagoassunc/Portfolio
a2abba7f07c667020164511343ae5843001753f8
[ "MIT" ]
null
null
null
src/components/navigation/NavConfig.jsx
tiagoassunc/Portfolio
a2abba7f07c667020164511343ae5843001753f8
[ "MIT" ]
null
null
null
/** @jsxImportSource theme-ui */ import Link from "next/link"; import commons from "./../../sass/commons.module.scss"; import { HiCog } from "react-icons/hi"; const NavConfig = () => { return ( <div sx={{ variant: "containers.glass", height: "65px", width: "65px", position: "fixed", bottom: "12px", left: "12px", }} > <div sx={{ position: "absolute", top: "50%", right: "50%", transform: "translate(50%,-43%)", }} > <nav> <Link href="/configurations" as={`/configurations`}> <a className={commons.removeLinkStyle}> <HiCog sx={{ height: 35, width: 35 }} /> </a> </Link> </nav> </div> </div> ); }; export default NavConfig;
21.769231
62
0.46172
false
true
false
true
d007417142cc6f126e592c95f4816794d15816bd
276
jsx
JSX
app/javascript/packs/hello_react.jsx
RuiMochila/sample-react-s3-uploader
72a5d2a81759ba52435ff0d04173870b1034a437
[ "MIT" ]
null
null
null
app/javascript/packs/hello_react.jsx
RuiMochila/sample-react-s3-uploader
72a5d2a81759ba52435ff0d04173870b1034a437
[ "MIT" ]
null
null
null
app/javascript/packs/hello_react.jsx
RuiMochila/sample-react-s3-uploader
72a5d2a81759ba52435ff0d04173870b1034a437
[ "MIT" ]
null
null
null
import React from 'react' import ReactDOM from 'react-dom' const Hello = props => { return ( <h1>Hi {props.name}</h1> ) } document.addEventListener('DOMContentLoaded', () => { ReactDOM.render( <Hello name="React" />, document.getElementById('app'), ) })
17.25
53
0.634058
false
true
false
true
d007484c5841d313184314ad908c4ce7caf768cf
1,944
jsx
JSX
src/Components/prediction-area.jsx
AG-Labs/pokerSite
33bcc23b61d38b862982dbf33a28f80099aeaa5d
[ "MIT" ]
null
null
null
src/Components/prediction-area.jsx
AG-Labs/pokerSite
33bcc23b61d38b862982dbf33a28f80099aeaa5d
[ "MIT" ]
20
2020-03-29T18:51:11.000Z
2021-01-25T18:34:35.000Z
src/Components/prediction-area.jsx
AG-Labs/pokerSite
33bcc23b61d38b862982dbf33a28f80099aeaa5d
[ "MIT" ]
null
null
null
import React, { useState, useContext } from "react"; import { CardContext } from "../cardStore.js"; import { AiOutlineLeftCircle, AiOutlineRightCircle } from "react-icons/ai"; import Prediction from "./prediction.jsx"; import "../Styles/prediction-area.css"; const PredictionArea = (props) => { const context = useContext(CardContext); let [handSelector, setHandSelector] = useState(0); let prev = () => { if (handSelector - 1 < 0) { setHandSelector(context.state.calculations.length - 1); } else { setHandSelector(handSelector - 1); } }; let next = () => { if (handSelector + 1 > context.state.calculations.length - 1) { setHandSelector(0); } else { setHandSelector(handSelector + 1); } }; let message = context.state.calculations.length === 0 ? "Waiting for Table Cards" : context.state.calculations[handSelector].result; let counter = context.state.calculations.length === 0 ? null : `- ${handSelector + 1}/${context.state.calculations.length}`; let prediction = context.state.calculations.length === 0 ? null : ( <Prediction predictions={context.state.calculations[handSelector].hand} /> ); return ( <> <div style={{ display: "flex", justifyContent: "space-evenly", alignItems: "center", }} > <div> <button onClick={() => { prev(); }} > <AiOutlineLeftCircle size="1.5em" /> </button> </div> <p className="predictionTitle">Possible Hands {counter}</p> <div> <button onClick={() => { next(); }} > <AiOutlineRightCircle size="1.5em" /> </button> </div> </div> <div>{message}</div> {prediction} </> ); }; export default PredictionArea;
24.923077
80
0.549897
false
true
false
true
d0074c9a74e60003beaed463a0aa84160e2a9826
10,807
jsx
JSX
web/global/admin/views/StyleGuide.js.jsx
fugitivelabs/flabs-zazk
f30dccacf8c9cab6154132e411d241dc8082561f
[ "MIT" ]
11
2017-03-21T21:26:05.000Z
2020-06-03T14:03:33.000Z
web/global/admin/views/StyleGuide.js.jsx
fugitivelabs/flabs-zazk
f30dccacf8c9cab6154132e411d241dc8082561f
[ "MIT" ]
68
2015-03-09T21:02:16.000Z
2021-09-30T15:19:49.000Z
web/global/admin/views/StyleGuide.js.jsx
fugitivelabs/flabs-zazk
f30dccacf8c9cab6154132e411d241dc8082561f
[ "MIT" ]
7
2020-04-30T17:39:14.000Z
2021-01-05T13:06:02.000Z
/** * Living style-guide for this Yote application * * TODO: This needs a lot of work */ // import primary libraries import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { NavLink } from 'react-router-dom'; // import global components import Binder from '../../../global/components/Binder.js.jsx'; // import module components import AdminLayout from '../components/AdminLayout.js.jsx'; class StyleGuide extends Binder { constructor(props) { super(props); } render() { return ( <AdminLayout> <section className="section"> <div className="style-guide"> <h3> Style Guide </h3> <div className="content"> <div className="main-copy with-eyebrow"> <div className="eyebrow title"> Typography </div> <div className="eyebrow content"> <h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <h4>Heading 4</h4> <h5>Heading 5</h5> <h6>Subhead</h6> <h6><em>Subhead Italics</em></h6> <p className="large">Body Large</p> <p>Body Primary</p> <p> <small>Body Small Caption</small> </p> <p> <small><em>Body Small Caption Italics</em></small> </p> <p> <strong>Strong Body</strong> </p> <p>Content with a <a href="#">Link</a> inside</p> <ul className="top-nav primary"> <li>Primary Navigation</li> </ul> <ul className="top-nav"> <li>Secondary Navigation</li> </ul> </div> </div> </div> <div className="content"> <div className="main-copy with-eyebrow colors-samples "> <div className="eyebrow title">Colors</div> <div className="eyebrow content"> <div className="yt-row"> <div className="yt-col"> <p className="subhead">Colors</p> </div> <div className="yt-col"> <p className="subhead">Hex</p> </div> <div className="yt-col _50"> <p className="subhead">Uses</p> </div> </div> <div className="yt-row center-vert"> <div className="yt-col primary"> <strong> desert sunset </strong> </div> <div className="yt-col primary"> </div> <div className="yt-col _50"> </div> </div> <div className="yt-row center-vert"> <div className="yt-col light-gray-1"> <strong> Light Gray 1 </strong> </div> <div className="yt-col light-gray-1"> #f7f7f7 </div> <div className="yt-col _50"> Background, Input </div> </div> <div className="yt-row center-vert"> <div className="yt-col light-gray-2"> <strong> Light Gray 2 </strong> </div> <div className="yt-col light-gray-2"> #E5E5E5 </div> <div className="yt-col _50"> Lines, Workspace background </div> </div> <div className="yt-row center-vert"> <div className="yt-col gray-1"> <strong> Gray 1 </strong> </div> <div className="yt-col gray-1"> #A1AAB2 </div> <div className="yt-col _50"> Light Text </div> </div> <div className="yt-row center-vert"> <div className="yt-col gray-2"> <strong> Gray 2 </strong> </div> <div className="yt-col gray-2"> #322B48 </div> <div className="yt-col _50"> Primary Text, Dark Lines </div> </div> <div className="yt-row center-vert"> <div className="yt-col black"> <strong> Black </strong> </div> <div className="yt-col black"> #1E2126 </div> <div className="yt-col _50"> Background, Footer </div> </div> <div className="yt-row center-vert"> <div className="yt-col green"> <strong> Green </strong> </div> <div className="yt-col success"> #37CCA5 </div> <div className="yt-col _50"> Buttons </div> </div> </div> </div> </div> </div> </section> <section className="section"> <div className="yt-container style-guide"> <div className="content"> <div className="section-header"><h3>Flex Grid</h3></div> <div className="main-copy with-eyebrow "> <div className="eyebrow title">yt-container</div> <div className="eyebrow content flex-grid-demo"> <div className="yt-container"></div> </div> </div> <div className="main-copy with-eyebrow "> <div className="eyebrow title">yt-container slim</div> <div className="eyebrow content flex-grid-demo"> <div className="yt-container slim"></div> </div> </div> <div className="main-copy with-eyebrow "> <div className="eyebrow title">yt-row</div> <div className="eyebrow content flex-grid-demo"> <div className="yt-container"> <div className="yt-row grid-demo"> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> </div> </div> </div> </div> <div className="main-copy with-eyebrow "> <div className="eyebrow title">yt-row with-gutters</div> <br/> <br/> <div className="eyebrow content flex-grid-demo"> <div className="yt-container"> <div className="yt-row with-gutters grid-demo"> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> <div className="yt-col grid-demo"><div className="card"> yt-col</div> </div> </div> </div> </div> </div> <div className="main-copy with-eyebrow "> <div className="eyebrow title">yt-row with-gutters & fixed columns</div> <br/> <br/> <div className="eyebrow content flex-grid-demo"> <div className="yt-container"> <div className="yt-row with-gutters grid-demo"> <div className="yt-col _50 grid-demo"><div className="card"> yt-col _50</div> </div> <div className="yt-col _20 grid-demo"><div className="card"> yt-col _20</div> </div> <div className="yt-col _30 grid-demo"><div className="card"> yt-col _30</div> </div> <div className="yt-col _40 grid-demo"><div className="card"> yt-col _40</div> </div> <div className="yt-col _60 grid-demo"><div className="card"> yt-col _60</div> </div> </div> </div> </div> </div> <div className="main-copy with-eyebrow "> <div className="eyebrow title">yt-row with-gutters & responsive columns</div> <br/> <br/> <div className="eyebrow content flex-grid-demo"> <div className="yt-container"> <div className="yt-row with-gutters grid-demo"> <div className="yt-col full s_30 m_50 grid-demo"><div className="card"> yt-col full s_30 m_50 </div> </div> <div className="yt-col full s70 m_50 grid-demo"><div className="card"> yt-col full s70 m_50 </div> </div> <div className="yt-col full xs_40 l_75 grid-demo"><div className="card"> yt-col full xs_40 l_75</div> </div> <div className="yt-col full xs_60 l_25 grid-demo"><div className="card"> yt-col full xs_60 l_25 </div> </div> </div> </div> </div> </div> </div> </div> </section> </AdminLayout> ) } } export default StyleGuide;
39.731618
133
0.419913
false
true
false
true
d0075277f9799e911e93dfa72e7e93ddd33df81b
353
jsx
JSX
client/src/Components/Form/logoutForm.jsx
Ammar0ah/SurveyMaster-ReactJS
a3c53f737e33fdaef2262f060c0ac9872b947ad8
[ "MIT" ]
1
2019-07-06T19:18:37.000Z
2019-07-06T19:18:37.000Z
client/src/Components/Form/logoutForm.jsx
Ammar0ah/SurveyMaster-ReactJS
a3c53f737e33fdaef2262f060c0ac9872b947ad8
[ "MIT" ]
null
null
null
client/src/Components/Form/logoutForm.jsx
Ammar0ah/SurveyMaster-ReactJS
a3c53f737e33fdaef2262f060c0ac9872b947ad8
[ "MIT" ]
null
null
null
import { Component } from 'react'; import { Alert } from 'rsuite'; class Signout extends Component { componentDidMount() { localStorage.removeItem('token') Alert.success('Signed out successfully , see you later :D',2000) window.location = '/'; } render() { return ( null ); } } export default Signout;
25.214286
72
0.611898
false
true
true
false
d007538e89020ad1894d8132041854f9f37f1cb2
877
jsx
JSX
src/layout/breadcrumb/index.jsx
codyprashant/googledrive-frontend
4eb5628cad71093dcf27ab2394c21f6cfebbab16
[ "MIT" ]
null
null
null
src/layout/breadcrumb/index.jsx
codyprashant/googledrive-frontend
4eb5628cad71093dcf27ab2394c21f6cfebbab16
[ "MIT" ]
null
null
null
src/layout/breadcrumb/index.jsx
codyprashant/googledrive-frontend
4eb5628cad71093dcf27ab2394c21f6cfebbab16
[ "MIT" ]
1
2020-11-24T08:28:29.000Z
2020-11-24T08:28:29.000Z
import React, { Fragment } from 'react'; import { Container, Row, Col, Breadcrumb, BreadcrumbItem } from 'reactstrap' import { Home } from 'react-feather'; import { Link } from 'react-router-dom' const Breadcrumbs = (props) => { return ( <Fragment> <Container fluid={true}> <div className="page-title"> <Row> <Col xs="6"> <h3>{props.title}</h3> </Col> <Col xs="6"> <Breadcrumb> <BreadcrumbItem><Link to={`${process.env.PUBLIC_URL}/app/file-manager`}><Home /></Link></BreadcrumbItem> <BreadcrumbItem>{props.parent}</BreadcrumbItem> <BreadcrumbItem active>{props.title}</BreadcrumbItem> </Breadcrumb> </Col> </Row> </div> </Container> </Fragment> ); } export default Breadcrumbs;
30.241379
120
0.542759
false
true
false
true
d0075595875652d1edf60a03320c22356bb362ae
3,625
jsx
JSX
.history/src/components/content/message-list/message-content/MessageContent_20210819195640.jsx
tjcages/kryptonite
5eeac4fca9a623dae1eed8231d73560f8dfb0db0
[ "MIT" ]
null
null
null
.history/src/components/content/message-list/message-content/MessageContent_20210819195640.jsx
tjcages/kryptonite
5eeac4fca9a623dae1eed8231d73560f8dfb0db0
[ "MIT" ]
null
null
null
.history/src/components/content/message-list/message-content/MessageContent_20210819195640.jsx
tjcages/kryptonite
5eeac4fca9a623dae1eed8231d73560f8dfb0db0
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { connect } from "react-redux"; import { Redirect, withRouter } from "react-router-dom"; import { bindActionCreators, compose } from "redux"; import { getEmailMessage, modifyMessages } from "../actions/message-list.actions"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faSpinner } from "@fortawesome/free-solid-svg-icons"; import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; import MessageToolbar from "../message-toolbar/MessageToolbar"; import "./messageContent.scss"; export class MessageContent extends Component { constructor(props) { super(props); this.state = { errorMessage: undefined }; this.iframeRef = React.createRef(); this.modifyMessage = this.modifyMessage.bind(this); } componentDidMount(prevProps) { const messageId = this.props.match.params.id; this.props.getEmailMessage(messageId); } componentDidUpdate(prevProps) { const { emailMessageResult } = this.props; if (!emailMessageResult.loading) { if (!emailMessageResult.failed) { if (this.iframeRef.current) { const { body } = this.iframeRef.current.contentWindow.document; body.style.margin = "0px"; body.style.fontFamily = "Arial, Helvetica, sans-serif"; body.style.fontSize = "13px"; body.innerHTML = this.props.emailMessageResult.body; } } else { if (!this.state.errorMessage) { this.setState({ errorMessage: emailMessageResult.error.result.error.message, modal: true }); } } } } renderSpinner() { return ( <div className="d-flex h-100 justify-content-center align-items-center "> <FontAwesomeIcon icon={faSpinner} spin size="5x" /> </div> ); } renderErrorModal() { return <Redirect to="/notfound" />; } modifyMessage(addLabelIds, removeLabelIds) { const id = this.props.emailMessageResult.result.id; const actionParams = { ...(addLabelIds && { addLabelIds }), ...(removeLabelIds && { removeLabelIds }) }; this.props.modifyMessages({ ids: [id], ...actionParams }); this.props.history.goBack(); } render() { if (this.props.emailMessageResult.loading) { return this.renderSpinner(); } console.log(this.props.emailMessageResult) return ( <React.Fragment> <MessageToolbar onClick={this.modifyMessage} messageResult={this.props.emailMessageResult} /> <p>{JSON.stringify(this.props.emailMessageResult)}</p> <div className="d-flex justify-content-center align-items-center message-content"> {this.props.emailMessageResult.loading ? this.renderSpinner() : null} {this.state.errorMessage ? ( this.renderErrorModal() ) : ( <iframe ref={this.iframeRef} title="Message contents" id="message-iframe" style={{ display: this.props.emailMessageResult.loading ? "none" : "block" }} /> )} </div> </React.Fragment> ); } } const mapStateToProps = state => ({ emailMessageResult: state.emailMessageResult }); const mapDispatchToProps = dispatch => bindActionCreators( { getEmailMessage, modifyMessages }, dispatch ); export default compose( withRouter, connect( mapStateToProps, mapDispatchToProps ) )(MessageContent);
26.851852
90
0.619034
false
true
true
false
d00756279eab0736aa97f69c7d3357e18eedb4c2
367
jsx
JSX
src/components/mdRenderers/Link.jsx
dustbringer/dustbringer.github.io
3975a62e99bd894dbadd993a96d3bfad6ab04aa3
[ "MIT" ]
2
2021-03-18T02:29:12.000Z
2022-03-28T10:16:50.000Z
src/components/mdRenderers/Link.jsx
dustbringer/dustbringer.github.io
3975a62e99bd894dbadd993a96d3bfad6ab04aa3
[ "MIT" ]
null
null
null
src/components/mdRenderers/Link.jsx
dustbringer/dustbringer.github.io
3975a62e99bd894dbadd993a96d3bfad6ab04aa3
[ "MIT" ]
1
2021-03-17T18:01:27.000Z
2021-03-17T18:01:27.000Z
import React from "react"; import styled from "styled-components"; import MUILink from "@material-ui/core/Link"; const StyledMUILink = styled(MUILink)` color: #0f6dd8; `; const Link = (props) => { return ( <StyledMUILink href={props.href} target="_blank" rel="noopener noreferrer"> {props.children} </StyledMUILink> ); }; export default Link;
19.315789
79
0.683924
false
true
false
true
d007767b3d0a5635b157d17a12d99301eb561dc8
6,571
jsx
JSX
src/components/keyInfo.jsx
mrled/keyblay
751f4ffd02a1e91f450073a7d6ea13432254a46b
[ "Unlicense" ]
3
2020-08-12T04:44:57.000Z
2021-01-09T19:41:42.000Z
src/components/keyInfo.jsx
mrled/keymap.click
751f4ffd02a1e91f450073a7d6ea13432254a46b
[ "Unlicense" ]
9
2020-10-08T20:24:11.000Z
2022-03-26T18:50:07.000Z
src/components/keyInfo.jsx
mrled/keymap.click
751f4ffd02a1e91f450073a7d6ea13432254a46b
[ "Unlicense" ]
1
2021-01-10T21:36:10.000Z
2021-01-10T21:36:10.000Z
import React, { useContext } from "react"; import { GuidedTourButtons } from "~/components/guidance"; import { KeyGrid, Legend } from "~/components/key"; import { IntraAppLink, Para } from "~/components/prose"; import { keyInfoConnectFromClass, keyInfoConnectFromClassPrefix, keyInfoConnectType, keyInfoConnectTypeClassPrefix, } from "~/lib/keyConnections"; import { KeymapUiStateContext } from "~/hooks/useKeymapUiState"; const GuideInfo = ({ inGuide = false, guideStep = 0, guideLength = 0 }) => { const ordinalGuideStep = guideStep + 1; const duringGuideText = `Guided tour step ${ordinalGuideStep} of ${guideLength}`; const availableGuideText = `Guided tour`; if (guideLength == 0) { return <></>; } else { return ( <> <p className="text-xs"> {inGuide ? duringGuideText : availableGuideText} </p> <GuidedTourButtons /> </> ); } }; const PanelNavBar = ({ tbKeyGrid, title, guideInfo }) => { return ( <div className="border-b"> <div className="flex"> <div className="flex-col px-4">{tbKeyGrid}</div> <div className="flex-col ml-auto px-4"> <h2 className="text-lg md:text-2xl">{title}</h2> </div> </div> <div className="p-1">{guideInfo ? guideInfo : <></>}</div> </div> ); }; /* Text for key info * * Must handle several possible states: * - User selected a regular key * - User selected a key that is unset / blank * - Guide selected a regular key * - Guide selected a key that is unset / blank * - Guide is active but a key is not selected */ const KeyInfoProse = ({ isSet, textLabel, keyInfo, inGuide, noSelectedGuideKey, }) => { let labelHeader; if (inGuide && noSelectedGuideKey) { labelHeader = <></>; } else if (isSet) { labelHeader = ( <Para> The <kbd>{textLabel}</kbd> key </Para> ); } else if (!isSet) { labelHeader = <Para>An unset key</Para>; } return ( <div className="py-5"> {labelHeader} {keyInfo} </div> ); }; /* A legend attribution footnote */ const LegendAttribution = ({ legendData }) => { if (legendData.attrib) { return ( <div className="text-2xs"> <h2>Legend Attribution:</h2> <p>{legendData.attrib}</p> </div> ); } else { return <></>; } }; /* A tiny key grid just for use in the title bar of the info panel */ const TitleBarKeyGrid = ({ keyData, legendMap }) => { const titleKeyId = "title-bar-0-0"; const titleBarKeyDataOverrides = { startPos: [0, 0], reactKey: titleKeyId, id: titleKeyId, }; const modifiedKeyData = Object.assign({}, keyData, titleBarKeyDataOverrides); return ( <KeyGrid gridName="title bar" // Use a constant size so that elements below/right of this one // don't change location when we select different keys cols="3" rows="4" keys={[modifiedKeyData]} legends={legendMap} pressedKey={modifiedKeyData} /> ); }; /* An empty KeyGrid for the title bar. */ const EmptyTitleBarKeyGrid = () => { return <TitleBarKeyGrid keyData={{}} legendMap={{}} />; }; /* A KeyGrid for the title bar which references a key on the keyboard */ const PopulatedTitleBarKeyGrid = ({ keyData, legendMap }) => { const modifiedKeyData = { ...keyData }; modifiedKeyData.keyHandleExtraClasses = [ `${keyInfoConnectFromClass}`, `${keyInfoConnectTypeClassPrefix}${keyInfoConnectType.selected}`, `${keyInfoConnectFromClassPrefix}${keyData.id}`, ].join(" "); return <TitleBarKeyGrid keyData={modifiedKeyData} legendMap={legendMap} />; }; /* An information panel about whatever key/guide we're in, or with an intro */ export const InfoPanel = () => { const { hydratedState, setGuide } = useContext(KeymapUiStateContext); const { keyData, legendMap } = hydratedState; const legend = Legend(legendMap[keyData.legend]); const keyDataTbKeyGrid = keyData.id ? ( <PopulatedTitleBarKeyGrid keyData={keyData} legendMap={legendMap} /> ) : ( <EmptyTitleBarKeyGrid /> ); if (hydratedState.inGuide) { // We are in a guide. There may be a selected key, but maybe not. const guideInfo = ( <GuideInfo guideStep={hydratedState.guideStepIdx} guideLength={hydratedState.guide.steps.length} inGuide={hydratedState.inGuide} /> ); return ( <> <PanelNavBar tbKeyGrid={keyDataTbKeyGrid} title={hydratedState.guideStep.title || "Key information"} guideInfo={guideInfo} /> <KeyInfoProse isSet={!keyData.unset} inGuide={true} noSelectedGuideKey={!hydratedState.guideStep.key} keyInfo={hydratedState.guideStep.text || keyData.info} textLabel={keyData.name || legend.legend || null} /> <LegendAttribution legendData={legend} /> </> ); } else if (hydratedState.keyData.info) { // We are NOT in a guide, but the user has selected a key return ( <> <PanelNavBar tbKeyGrid={keyDataTbKeyGrid} title="Key information" /> <KeyInfoProse isSet={!keyData.unset} keyInfo={keyData.info} textLabel={keyData.name || legend.legend} /> <LegendAttribution legendData={legend} /> </> ); } else { // No key is selected and we are not in a guide return ( <> <PanelNavBar tbKeyGrid={<EmptyTitleBarKeyGrid />} title="Welcome" guideInfo={null} /> {/* <Para>You are viewing the keymap information for: {hydratedState.keyMap.fullName}.</Para> */} <Para> Welcome to <IntraAppLink href="/">keymap.click</IntraAppLink>! I built this site to show how my{" "} <IntraAppLink href="/ergodox">keyboard</IntraAppLink> helped my{" "} <IntraAppLink href="/story">RSI</IntraAppLink>. </Para> <Para>Select a key from the board above to learn more about it.</Para> {hydratedState.keyMap.defaultGuide ? ( <Para> Not sure where to begin? <button className="p-1 m-1 border border-gray-300 rounded-md bg-gray-200" onClick={() => { setGuide(hydratedState.keyMap.defaultGuide); }} disabled={!hydratedState.keyMap.defaultGuide} > Start a guided tour! </button> </Para> ) : ( <></> )} </> ); } };
28.569565
105
0.602191
false
true
false
true
d00791abd1c4237dc435d2b3410a72ab1e3b4e2d
10,430
jsx
JSX
src/components/SignupForm.jsx
Keksike/luuppi50.fi
ae0686bda2e831dbb1d8d2422e92f7219647ae54
[ "MIT" ]
1
2018-10-16T09:34:21.000Z
2018-10-16T09:34:21.000Z
src/components/SignupForm.jsx
Keksike/luuppi50.fi
ae0686bda2e831dbb1d8d2422e92f7219647ae54
[ "MIT" ]
4
2018-07-04T17:29:13.000Z
2018-10-10T14:14:40.000Z
src/components/SignupForm.jsx
Keksike/luuppi50.fi
ae0686bda2e831dbb1d8d2422e92f7219647ae54
[ "MIT" ]
2
2018-06-20T19:53:41.000Z
2018-06-20T19:56:40.000Z
import React from 'react' import styled, { keyframes } from 'styled-components' import PropTypes from 'prop-types' import { Formik, Form, Field } from 'formik' import fetch from 'isomorphic-fetch' import { media } from '../theme' const Separator = styled.div` height: 2px; background: ${props => props.theme.textBlack}; transform: scaleX(0) translateY(-2px); transform-origin: 0; opacity: 0; transition: all 0.15s linear; ` const InputWrapper = styled.div` width: 50%; ${media.mobile` width: 100%; `}; ` const Checkboxes = styled.div` margin-bottom: 1.2rem; label { display: block; padding: 0.2rem 0; input { margin-right: 0.8rem; } } ` const TextInput = styled(Field)` background: transparent; border: 0; border-bottom: 1px solid ${props => props.theme.secondaryGreyLight}; display: block; font-size: 16px; font-weight: 100; padding: 0.5rem 0.8rem; width: 100%; box-sizing: border-box; &:focus { outline: none; } &:focus + ${Separator} { transform: scaleX(1) translateY(-2px); opacity: 1; } ` const RadioWrapper = styled.div` margin-top: 0.5rem; label { display: block; padding: 0.2rem 0; } input { margin-right: 0.8rem; } ` const InputLabel = styled.span` display: block; margin-bottom: 0.2rem; text-transform: uppercase; font-weight: bold; font-size: 0.85rem; ` const errorAnimation = keyframes` 0% { transform: translateX(0.75rem); } 25% { transform: translateX(0rem); } 40% { transform: translateX(0.5rem); } 60% { transform: translateX(0); } 80% { transform: translateX(0.3rem); } 100% { transform: translateX(0); } ` const ErrorBox = styled.div` color: ${props => props.theme.error}; height: 1rem; margin-bottom: 0.5rem; font-size: 0.8rem; text-transform: uppercase; &:not(:empty) { animation: ${errorAnimation} 300ms; } ` const SubmitButton = styled.button` padding: 1.5rem; text-transform: uppercase; background: ${props => props.theme.contrastBackground} radial-gradient( circle, transparent 1%, ${props => props.theme.contrastBackground} 1% ) center/15000%; color: ${props => props.theme.contrastText}; font-size: 1rem; border: 0; transition: background 0.6s; &:active:not(:disabled) { background-color: #bbb; background-size: 100%; transition: background 0s; } &:disabled { cursor: not-allowed; } ` const SmallText = styled.p` font-size: 14px; margin-bottom: 0.5rem; margin-top: 0rem; ` const ErrorText = styled.p` color: red; ` const FormWrapper = ({ submitCallback, error }) => ( <Formik initialValues={{ name: '', email: '', phone: '', organization: '', startingYear: '', cocktail: false, greeting: false, drink: undefined, food: undefined, coffeeAvec: undefined, specialDiet: '', sillis: false, isAvecOfInvitee: false, avec: '', other: '', }} validate={values => { const errors = {} if (!values.name) { errors.name = 'Syötä etu- ja sukunimesi' } if (!values.email) { errors.email = 'Syötä toimiva sähköpostiosoite' } if (!values.drink) { errors.drink = 'Kerro juomatoiveesi' } if (!values.coffeeAvec) { errors.coffeeAvec = 'Kerro kahviavec-toiveesi' } if (!values.food) { errors.food = 'Kerro ruokatoiveesi' } return errors }} onSubmit={(values, { setSubmitting }) => { fetch( 'https://o172ua8qya.execute-api.eu-west-1.amazonaws.com/dev/email/send', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ content: values }), } ) .then(() => { setSubmitting(false) submitCallback(true) }) .catch(e => { console.log(e) setSubmitting(false) submitCallback(false) }) }} > {({ touched, errors, isSubmitting }) => ( <Form> <InputWrapper> <InputLabel>Nimi*</InputLabel> <TextInput type="text" name="name" /> <Separator /> <ErrorBox>{touched.name && errors.name}</ErrorBox> </InputWrapper> <InputWrapper> <InputLabel>Sähköposti*</InputLabel> <TextInput type="email" name="email" /> <Separator /> <ErrorBox>{touched.email && errors.email}</ErrorBox> </InputWrapper> <InputWrapper> <InputLabel>Puhelinnumero</InputLabel> <TextInput type="text" name="phone" /> <Separator /> <ErrorBox /> </InputWrapper> <InputWrapper> <InputLabel>Edustamani taho</InputLabel> <TextInput type="text" name="organization" /> <Separator /> <ErrorBox /> </InputWrapper> <InputWrapper> <InputLabel>Opiskelujen aloitusvuosi</InputLabel> <TextInput type="text" name="startingYear" /> <Separator /> <ErrorBox /> </InputWrapper> <Checkboxes> <label htmlFor="cocktail"> <Field type="checkbox" id="cocktail" name="cocktail" /> Osallistun cocktail-tilaisuuteen </label> <label htmlFor="greeting"> <Field type="checkbox" id="greeting" name="greeting" /> Esitän edustamani tahon tervehdyksen cocktail-tilaisuudessa </label> <label htmlFor="sillis"> <Field type="checkbox" id="sillis" name="sillis" /> Osallistun seuraavan päivän sillikselle </label> </Checkboxes> <> <InputLabel>Juomavaihtoehto*</InputLabel> <RadioWrapper> <label htmlFor="redwine"> <Field type="radio" name="drink" id="redwine" value="redwine" /> Punaviini </label> <label htmlFor="whitewine"> <Field type="radio" name="drink" id="whitewine" value="whitewine" /> Valkoviini </label> <label htmlFor="nonalcoholic"> <Field type="radio" name="drink" id="nonalcoholic" value="nonalcoholic" /> Alkoholiton </label> </RadioWrapper> <ErrorBox>{touched.drink && errors.drink}</ErrorBox> </> <> <InputLabel>Ruokavaihtoehto*</InputLabel> <SmallText> Ruokamenut näet tarkemmin{' '} <a href="/paajuhla" target="_blank"> täältä </a>. </SmallText> <RadioWrapper> <label htmlFor="meat"> <Field type="radio" name="food" id="meat" value="meat" /> Liha </label> <label htmlFor="fish"> <Field type="radio" name="food" id="fish" value="fish" /> Kala </label> <label htmlFor="vegan"> <Field type="radio" name="food" id="vegan" value="vegan" /> Vegaani </label> </RadioWrapper> <ErrorBox>{touched.food && errors.food}</ErrorBox> </> <> <InputLabel>Kahviavec*</InputLabel> <RadioWrapper> <label htmlFor="liqour"> <Field type="radio" name="coffeeAvec" id="liqour" value="liqour" /> Likööri </label> <label htmlFor="jaloviina"> <Field type="radio" name="coffeeAvec" id="jaloviina" value="jaloviina" /> Jaloviina </label> <label htmlFor="nonalcoholic"> <Field type="radio" name="coffeeAvec" id="nonalcoholic" value="nonalcoholic" /> Alkoholiton </label> </RadioWrapper> <ErrorBox>{touched.drink && errors.drink}</ErrorBox> </> <InputWrapper> <InputLabel>Erityisruokavaliot</InputLabel> <TextInput type="text" name="specialDiet" /> <Separator /> <ErrorBox /> </InputWrapper> <InputWrapper> <InputLabel>Avec / pöytäseuratoive</InputLabel> <TextInput type="text" name="avec" /> <Separator /> <Separator /> <label htmlFor="isAvecOfInvitee"> <Field type="checkbox" id="isAvecOfInvitee" name="isAvecOfInvitee" />{' '} Olen kutsuvieraan avec </label> <ErrorBox /> </InputWrapper> <InputWrapper> <InputLabel>Muuta huomioitavaa / terveisiä</InputLabel> <TextInput type="text" name="other" /> <Separator /> <ErrorBox /> </InputWrapper> {error && ( <ErrorText> Virhe ilmoittautumisessa. Ota yhteyttä [email protected] </ErrorText> )} <SubmitButton type="submit" disabled={isSubmitting}> Ilmoittaudu </SubmitButton> </Form> )} </Formik> ) FormWrapper.propTypes = { submitCallback: PropTypes.func.isRequired, error: PropTypes.bool.isRequired, } class SignupForm extends React.Component { state = { submitted: false, error: false, } submit(success) { if (success) { this.setState({ submitted: true, }) } else { this.setState({ submitted: false, error: true, }) } } render() { const { submitted, error } = this.state if (submitted) { return ( <> <p> <b>Kiitos osallistumisestasi!</b> </p> <p>Saat sähköpostiisi vahvistuksen osallistumisestasi.</p> </> ) } return ( <FormWrapper error={error} submitCallback={success => this.submit(success)} /> ) } } export default SignupForm
23.075221
80
0.523011
false
true
true
false
d00793c657ef97dd55b858e951b587382e5b6899
891
jsx
JSX
modules/category/skin/react/components/articleList.jsx
Skepton/Neon-React
afe2a5502e24d9bf52685e0669ca9be183b3af13
[ "MIT" ]
null
null
null
modules/category/skin/react/components/articleList.jsx
Skepton/Neon-React
afe2a5502e24d9bf52685e0669ca9be183b3af13
[ "MIT" ]
null
null
null
modules/category/skin/react/components/articleList.jsx
Skepton/Neon-React
afe2a5502e24d9bf52685e0669ca9be183b3af13
[ "MIT" ]
null
null
null
import templateComponent from 'page/skin/react/components/template'; import routeStore from 'router/skin/react/helpers/routeStore'; class NeonArticleList extends templateComponent { constructor(props){ super(props); this.state = routeStore.get(); this.parseCategoryUrl(); } setRouteData(data){ this.setState(data); this.parseCategoryUrl(); } parseCategoryUrl(){ var params = this.state.params.categoryUrl.split('/'); console.log(params); } componentWillMount(){ var self = this; this.routeDispatcherToken = routeStore.getDispatcher.register(function(data){ self.setRouteData(data); }); } componentWillUnmount(){ routeStore.getDispatcher.unregister(this.routeDispatcherToken); } } module.exports = NeonArticleList;
27
86
0.636364
false
true
false
true
d0079c8b29a48a1b0142d8d8a700aa10a573be85
5,003
jsx
JSX
src/providers/SchedulingProviderTemp4.jsx
mochic/thescubawizard-site
7673736d2d47070345b292623250e26ea7cacb09
[ "MIT" ]
null
null
null
src/providers/SchedulingProviderTemp4.jsx
mochic/thescubawizard-site
7673736d2d47070345b292623250e26ea7cacb09
[ "MIT" ]
null
null
null
src/providers/SchedulingProviderTemp4.jsx
mochic/thescubawizard-site
7673736d2d47070345b292623250e26ea7cacb09
[ "MIT" ]
null
null
null
import React, { useState } from "react" import SchedulingContext from "../contexts/scheduling.context" import submitToAPI from "../api" // import { processPhoneNumber } from "../utils" import { isEmptyString, emailFormatter, phoneFormatter, validateEmail, validatePhone, sanitizeEmail, sanitizePhone, } from "../utils" export default ({ children }) => { const STATUS = { UNSUBMITTED: "UNSUBMITTED", SUBMITTING: "SUBMITTING", SUBMITTED: "SUBMITTED", } const submit = async (phoneNumber, emailAddress) => { const emailError = schedulingState.fields[0].validator(emailAddress) const phoneError = schedulingState.fields[1].validator(phoneNumber) setScheduling(prevState => { // all fields empty if (isEmptyString(phoneNumber) && isEmptyString(emailAddress)) { return { ...prevState, status: STATUS.UNSUBMITTED, prevStatus: STATUS.UNSUBMITTED, errors: ["Please enter a phone number or email address."], } } // for const emailError = prevState.fields[0].validator(emailAddress) const phoneError = prevState.fields[1].validator(phoneNumber) const validatedFields = [ // emailAddress { ...prevState.fields[0], value: emailAddress, errors: emailError ? [emailError] : [], }, // phoneNumber { ...prevState.fields[1], value: phoneNumber, errors: phoneError ? [phoneError] : [], }, ] fieldsValid = validatedFields.map(f => f.errors.length < 1).includes(true) console.log("fields valid: ", prevState, fieldsValid) return { ...prevState, status: fieldsValid ? STATUS.SUBMITTING : STATUS.UNSUBMITTED, prevStatus: fieldsValid ? STATUS.SUBMITTING : STATUS.UNSUBMITTED, fields: validatedFields, } }) // dont continue if no valid fields... if (!fieldsValid) { console.log( "%cNo valid fields...", "color: #ff00ff", fieldsValid, scheduling ) return } console.log("Submitting...") let [submittedToAPI, apiErrored] = await submitToAPI( sanitizeEmail(emailAddress), sanitizePhone(phoneNumber) ) console.log("%capi response:", "color: #ff00ff", submittedToAPI, apiErrored) if (apiErrored) { setScheduling(prevState => ({ ...prevState, status: STATUS.UNSUBMITTED, previousStatus: STATUS.SUBMITTING, errors: [ `An expected error occurred when submitting your values to our api.`, ], })) } else { setScheduling(prevState => ({ ...prevState, status: STATUS.SUBMITTED, previousStatus: STATUS.SUBMITTING, })) } } // const resetSubmission = () => { // console.log("resetting submission") // setScheduling(({ prevStatus }) => ({ ...schedulingState, prevStatus })) // } const resetSubmission = () => { console.log("resetting submission") setScheduling(({ prevStatus }) => ({ ...schedulingState })) } // const fieldSetterFactory = id => (() => {}) // const fieldValidateFactory = id => (() => {}) const schedulingState = { STATUS, status: STATUS.UNSUBMITTED, previousStatus: null, fields: [ { id: "email", type: "email", value: "", errors: [], formatter: emailFormatter, validator: validateEmail, setValue: v => { setScheduling(prevState => ({ ...prevState, fields: prevState.fields.map(f => f.id === `email` ? { ...f, value: f.formatter(v, f.value) } : f ), })) }, validate: () => { setScheduling(prevState => ({ ...prevState, fields: prevState.fields.map(f => f.id === `email` ? { ...f, errors: [f.validator(f.value)] } : f ), })) }, }, { id: "phone", type: "tel", value: "", errors: [], formatter: phoneFormatter, validator: validatePhone, setValue: v => { setScheduling(prevState => ({ ...prevState, fields: prevState.fields.map(f => f.id === `phone` ? { ...f, value: f.formatter(v, f.value) } : f ), })) }, validate: () => { setScheduling(prevState => ({ ...prevState, fields: prevState.fields.map(f => f.id === `phone` ? { ...f, errors: [f.validator(f.value)] } : f ), })) }, }, ], errors: [], // top level errors like api not available, auth errors, etc... submit, resetSubmission, } const [scheduling, setScheduling] = useState(schedulingState) return ( <SchedulingContext.Provider value={scheduling}> {children} </SchedulingContext.Provider> ) }
27.338798
80
0.548271
false
true
false
true
d007a04e89420f3691d608843415a5839b8f2a72
2,168
jsx
JSX
app/javascript/packages/document-capture/components/selfie-step.jsx
Weaver-Lily-Mae/identity-idp
21be6a360593180a608324fb4b43306bf14ef9ed
[ "CC0-1.0", "CC-BY-4.0" ]
null
null
null
app/javascript/packages/document-capture/components/selfie-step.jsx
Weaver-Lily-Mae/identity-idp
21be6a360593180a608324fb4b43306bf14ef9ed
[ "CC0-1.0", "CC-BY-4.0" ]
1
2021-06-25T15:48:46.000Z
2021-06-25T15:48:46.000Z
app/javascript/packages/document-capture/components/selfie-step.jsx
Weaver-Lily-Mae/identity-idp
21be6a360593180a608324fb4b43306bf14ef9ed
[ "CC0-1.0", "CC-BY-4.0" ]
null
null
null
import React, { useContext } from 'react'; import { hasMediaAccess } from '@18f/identity-device'; import useI18n from '../hooks/use-i18n'; import DeviceContext from '../context/device'; import AcuantCapture from './acuant-capture'; import SelfieCapture from './selfie-capture'; import FormErrorMessage from './form-error-message'; import withBackgroundEncryptedUpload from '../higher-order/with-background-encrypted-upload'; /** * @typedef SelfieStepValue * * @prop {Blob|string|null|undefined} selfie Selfie value. */ /** * @param {import('./form-steps').FormStepComponentProps<SelfieStepValue>} props Props object. */ function SelfieStep({ value = {}, onChange = () => {}, errors = [], registerField = () => undefined, }) { const { t } = useI18n(); const { isMobile } = useContext(DeviceContext); const error = errors.find(({ field }) => field === 'selfie')?.error; return ( <> <p>{t('doc_auth.instructions.document_capture_selfie_instructions')}</p> <p className="margin-bottom-0">{t('doc_auth.tips.document_capture_header_text')}</p> <ul> <li>{t('doc_auth.tips.document_capture_selfie_text1')}</li> <li>{t('doc_auth.tips.document_capture_selfie_text2')}</li> <li>{t('doc_auth.tips.document_capture_selfie_text3')}</li> </ul> {isMobile || !hasMediaAccess() ? ( <AcuantCapture ref={registerField('selfie', { isRequired: true })} capture="user" label={t('doc_auth.headings.document_capture_selfie')} bannerText={t('doc_auth.headings.photo')} value={value.selfie} onChange={(nextSelfie) => onChange({ selfie: nextSelfie })} allowUpload={false} errorMessage={error ? <FormErrorMessage error={error} /> : undefined} /> ) : ( <SelfieCapture ref={registerField('selfie', { isRequired: true })} value={value.selfie} onChange={(nextSelfie) => onChange({ selfie: nextSelfie })} errorMessage={error ? <FormErrorMessage error={error} /> : undefined} /> )} </> ); } export default withBackgroundEncryptedUpload(SelfieStep);
34.967742
94
0.638838
false
true
false
true
d007a25715832a4b1fb7d8582515da50ad8f86a1
412
jsx
JSX
assets/js/components/PrivateRoute.jsx
patrick1309/formation-api-platform-react
a95f4c2338334a8ff7d31752e209a4ae2175bb18
[ "MIT" ]
null
null
null
assets/js/components/PrivateRoute.jsx
patrick1309/formation-api-platform-react
a95f4c2338334a8ff7d31752e209a4ae2175bb18
[ "MIT" ]
null
null
null
assets/js/components/PrivateRoute.jsx
patrick1309/formation-api-platform-react
a95f4c2338334a8ff7d31752e209a4ae2175bb18
[ "MIT" ]
null
null
null
import React, { useContext } from "react"; import { Route, Redirect } from "react-router-dom"; import AuthContext from "../contexts/AuthContext"; const PrivateRoute = ({ path, component }) => { const { isAuthenticated } = useContext(AuthContext); return isAuthenticated ? ( <Route path={path} component={component} /> ) : ( <Redirect to="/login"></Redirect> ); }; export default PrivateRoute;
25.75
54
0.674757
false
true
false
true
d007a4a6e851690bcbce9bfa46740042cb2afad3
1,691
jsx
JSX
src/components/home/About.jsx
dwilbank68/gatsby-backroads
dc092b9abbbe365396eee0739db5bdb9af6c92ad
[ "MIT" ]
null
null
null
src/components/home/About.jsx
dwilbank68/gatsby-backroads
dc092b9abbbe365396eee0739db5bdb9af6c92ad
[ "MIT" ]
null
null
null
src/components/home/About.jsx
dwilbank68/gatsby-backroads
dc092b9abbbe365396eee0739db5bdb9af6c92ad
[ "MIT" ]
null
null
null
import React from 'react'; import Title from "../Title.jsx"; import styles from '../../css/about.module.css'; // import img from '../../images/defaultBcg.jpeg'; import {useStaticQuery, graphql} from 'gatsby'; import Img from 'gatsby-image'; const getAbout = graphql` query aboutImage { aboutImage:file(relativePath:{eq:"defaultBcg.jpeg"}) { childImageSharp{ fluid(maxWidth:600) { ...GatsbyImageSharpFluid_tracedSVG } } } } ` const About = () => { const {aboutImage} = useStaticQuery(getAbout) return ( <section className={styles.about}> <Title titleLeft='about' titleRight='us'/> <div className={styles.aboutCenter}> <article className={styles.aboutImg}> <div className={styles.imgContainer}> {/*<img src={img} alt="about company"/>*/} <Img fluid={aboutImage.childImageSharp.fluid} alt="awesome landscape"/> </div> </article> <article className={styles.aboutInfo}> <h4>explore the difference</h4> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequatur quae rem voluptatem?</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequatur quae rem voluptatem?</p> <button type="button" className="btn-primary"> read more </button> </article> </div> </section> ); }; export default About;
34.510204
117
0.529273
false
true
false
true
d007ab9a9ba168aab2023b46d9408c2d6d0ecfdf
1,564
jsx
JSX
assets/src/components/books/BookListContainer.jsx
rodbv/kamu
f390d91f7d7755b49176cf5d504648e3fe572237
[ "MIT" ]
70
2018-05-23T16:44:44.000Z
2021-12-05T21:48:10.000Z
assets/src/components/books/BookListContainer.jsx
rodbv/kamu
f390d91f7d7755b49176cf5d504648e3fe572237
[ "MIT" ]
122
2018-10-06T21:31:24.000Z
2020-11-09T15:04:56.000Z
assets/src/components/books/BookListContainer.jsx
rodbv/kamu
f390d91f7d7755b49176cf5d504648e3fe572237
[ "MIT" ]
50
2018-05-23T05:49:10.000Z
2021-11-22T07:53:42.000Z
import React, { useContext, useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { withRouter } from 'react-router'; import BookList from './BookList'; import LoadingIndicator from '../LoadingIndicator'; import performAction from '../../utils/bookAction'; import { OPEN_BOOK_ACTION } from '../../utils/constants'; import UserContext from '../UserContext'; import { bookUrl } from '../../utils/urls'; const BookListContainer = (props) => { const [books, setBooks] = useState(null); const context = useContext(UserContext); const onAction = (action, book) => { if (action === OPEN_BOOK_ACTION) { props.history.push(bookUrl(book, book.library)); return; } performAction(action, book).then((updatedBook) => { setBooks( books.map((it) => (it.id === updatedBook.id ? updatedBook : it)), ); context.updateUser(); }); }; useEffect(() => { props.source().then((data) => { setBooks(data.results); }); }, []); if (books == null) return <LoadingIndicator />; if (books.length === 0) { return ( <p data-testid="no-books-message" className="no-books-message"> {props.noBooksMessage} </p> ); } return <BookList books={books} onAction={onAction} />; }; BookListContainer.propTypes = { source: PropTypes.func.isRequired, noBooksMessage: PropTypes.string.isRequired, history: PropTypes.shape({ push: PropTypes.func.isRequired, }).isRequired, }; export { BookListContainer }; export default withRouter(BookListContainer);
27.928571
73
0.650256
false
true
false
true
d007abb3db9ea2c5f462a096ed48a4551d9de33c
6,796
jsx
JSX
src/components/manage/Add/Add.jsx
tiberiuichim/volto
e231e30c2635679fa31a1abfe3a00f192ab47cd1
[ "MIT" ]
1
2020-01-11T16:05:27.000Z
2020-01-11T16:05:27.000Z
src/components/manage/Add/Add.jsx
tiberiuichim/volto
e231e30c2635679fa31a1abfe3a00f192ab47cd1
[ "MIT" ]
null
null
null
src/components/manage/Add/Add.jsx
tiberiuichim/volto
e231e30c2635679fa31a1abfe3a00f192ab47cd1
[ "MIT" ]
null
null
null
/** * Add container. * @module components/manage/Add/Add */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Helmet } from '@plone/volto/helpers'; import { connect } from 'react-redux'; import { compose } from 'redux'; import { keys } from 'lodash'; import { defineMessages, injectIntl } from 'react-intl'; import { Button } from 'semantic-ui-react'; import { Portal } from 'react-portal'; import { DragDropContext } from 'react-dnd'; import HTML5Backend from 'react-dnd-html5-backend'; import qs from 'query-string'; import { settings } from '~/config'; import { createContent, getSchema } from '../../../actions'; import { Form, Icon, Toolbar, Sidebar } from '../../../components'; import { getBaseUrl, hasBlocksData, getBlocksFieldname, getBlocksLayoutFieldname, } from '../../../helpers'; import saveSVG from '../../../icons/save.svg'; import clearSVG from '../../../icons/clear.svg'; const messages = defineMessages({ add: { id: 'Add {type}', defaultMessage: 'Add {type}', }, save: { id: 'Save', defaultMessage: 'Save', }, cancel: { id: 'Cancel', defaultMessage: 'Cancel', }, }); /** * Add class. * @class Add * @extends Component */ class Add extends Component { /** * Property types. * @property {Object} propTypes Property types. * @static */ static propTypes = { createContent: PropTypes.func.isRequired, getSchema: PropTypes.func.isRequired, pathname: PropTypes.string.isRequired, schema: PropTypes.objectOf(PropTypes.any), content: PropTypes.shape({ // eslint-disable-line react/no-unused-prop-types '@id': PropTypes.string, '@type': PropTypes.string, }), returnUrl: PropTypes.string, createRequest: PropTypes.shape({ loading: PropTypes.bool, loaded: PropTypes.bool, }).isRequired, schemaRequest: PropTypes.shape({ loading: PropTypes.bool, loaded: PropTypes.bool, }).isRequired, type: PropTypes.string, }; /** * Default properties * @property {Object} defaultProps Default properties. * @static */ static defaultProps = { schema: null, content: null, returnUrl: null, type: 'Default', }; /** * Constructor * @method constructor * @param {Object} props Component properties * @constructs WysiwygEditor */ constructor(props) { super(props); this.onCancel = this.onCancel.bind(this); this.onSubmit = this.onSubmit.bind(this); } /** * Component did mount * @method componentDidMount * @returns {undefined} */ componentDidMount() { this.props.getSchema(this.props.type); } /** * Component will receive props * @method componentWillReceiveProps * @param {Object} nextProps Next properties * @returns {undefined} */ UNSAFE_componentWillReceiveProps(nextProps) { if ( this.props.createRequest.loading && nextProps.createRequest.loaded && nextProps.content['@type'] === this.props.type ) { this.props.history.push( this.props.returnUrl || nextProps.content['@id'].replace(settings.apiPath, ''), ); } } /** * Submit handler * @method onSubmit * @param {object} data Form data. * @returns {undefined} */ onSubmit(data) { this.props.createContent(getBaseUrl(this.props.pathname), { ...data, '@static_behaviors': this.props.schema.definitions ? keys(this.props.schema.definitions) : null, '@type': this.props.type, }); } /** * Cancel handler * @method onCancel * @returns {undefined} */ onCancel() { this.props.history.push(getBaseUrl(this.props.pathname)); } form = React.createRef(); /** * Render method. * @method render * @returns {string} Markup for the component. */ render() { if (this.props.schemaRequest.loaded) { const visual = hasBlocksData(this.props.schema.properties); return ( <div id="page-add"> <Helmet title={this.props.intl.formatMessage(messages.add, { type: this.props.type, })} /> <Form ref={this.form} schema={this.props.schema} formData={{ [getBlocksFieldname(this.props.schema.properties)]: null, [getBlocksLayoutFieldname(this.props.schema.properties)]: null, }} onSubmit={this.onSubmit} hideActions pathname={this.props.pathname} visual={visual} title={this.props.intl.formatMessage(messages.add, { type: this.props.type, })} loading={this.props.createRequest.loading} /> <Portal node={__CLIENT__ && document.getElementById('toolbar')}> <Toolbar pathname={this.props.pathname} hideDefaultViewButtons inner={ <> <Button id="toolbar-save" className="save" aria-label={this.props.intl.formatMessage(messages.save)} onClick={() => this.form.current.onSubmit()} loading={this.props.createRequest.loading} > <Icon name={saveSVG} className="circled" size="30px" title={this.props.intl.formatMessage(messages.save)} /> </Button> <Button className="cancel" onClick={() => this.onCancel()}> <Icon name={clearSVG} className="circled" aria-label={this.props.intl.formatMessage( messages.cancel, )} size="30px" title={this.props.intl.formatMessage(messages.cancel)} /> </Button> </> } /> </Portal> {visual && ( <Portal node={__CLIENT__ && document.getElementById('sidebar')}> <Sidebar /> </Portal> )} </div> ); } return <div />; } } export default compose( DragDropContext(HTML5Backend), injectIntl, connect( (state, props) => ({ createRequest: state.content.create, schemaRequest: state.schema, content: state.content.data, schema: state.schema.schema, pathname: props.location.pathname, returnUrl: qs.parse(props.location.search).return_url, type: qs.parse(props.location.search).type, }), { createContent, getSchema }, ), )(Add);
26.755906
77
0.564155
false
true
true
false
d007b9d087919b9e6d5334fd4cb00a0b93f336da
5,387
jsx
JSX
src/App.jsx
kar-21/battle-ship
7b1437c0f98ce589f4e7b0b149692527d4f41bfe
[ "MIT" ]
null
null
null
src/App.jsx
kar-21/battle-ship
7b1437c0f98ce589f4e7b0b149692527d4f41bfe
[ "MIT" ]
null
null
null
src/App.jsx
kar-21/battle-ship
7b1437c0f98ce589f4e7b0b149692527d4f41bfe
[ "MIT" ]
null
null
null
import React, { useState, useCallback } from "react"; import { Suspense } from "react"; import { BrowserRouter, Switch, Route } from "react-router-dom"; import { FullScreen, useFullScreenHandle } from "react-full-screen"; import DeviceOrientation, { Orientation } from "react-screen-orientation"; import Button from "@material-ui/core/Button"; import FullscreenIcon from "@material-ui/icons/Fullscreen"; import CircularProgress from "@material-ui/core/CircularProgress"; import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles"; import Typography from "@material-ui/core/Typography"; import CssBaseline from "@material-ui/core/CssBaseline"; import ShipImage from "./assets/images/ship-image.svg"; import "./App.scss"; const Welcome = React.lazy(() => import("./components/Welcome")); const ArrangeShips = React.lazy(() => import("./components/ArrangeShip")); const Error = React.lazy(() => import("./components/Error")); const BattleGround = React.lazy(() => import("./components/BattleGround")); const theme = createMuiTheme({ palette: { primary: { main: "#5a5a5a", }, secondary: { main: "#EF1212", }, contrastThreshold: 3, tonalOffset: 0.2, background: { default: "#f8f8f8", }, }, typography: { fontFamily: ["Verdana", "Arial", "Helvetica", "sans-serif"].join(","), }, }); const classes = { fullscreenDiv: { display: "flex", height: "100vh", justifyContent: "space-between", alignItems: "center", textAlign: "center", flexDirection: "column", }, fullscreenButton: { margin: "3%", fontWeight: "bolder", }, fullscreenText: { marginRight: "6%", marginLeft: "6%", marginTop: "0.5%", fontWeight: "600", }, h1: { marginBottom: "1%", }, progress: { display: "flex", justifyContent: "center", }, rotateScreen: { paddingTop: "48vh", }, }; const App = () => { const [userName, setUserName] = useState(""); const [userAvatar, setUserAvatar] = useState(""); const [gridArray, setGridArray] = useState([]); const [isFullscreen, setIsFullscreen] = useState(false); const handle = useFullScreenHandle(); const getUserName = (name) => { setUserName(name); }; const getAvatar = (avatarIndex) => { setUserAvatar(avatarIndex); }; const getGridArray = (gridArray) => { setGridArray(gridArray); }; const reportChange = useCallback((state, handle) => { setIsFullscreen(state); }, []); const RoutingComponents = () => ( <Suspense fallback={ <div style={classes.progress}> <CircularProgress /> </div> } > <BrowserRouter> <Switch> <Route exact path="/" component={() => ( <Welcome getUserName={getUserName} getAvatar={getAvatar} /> )} /> <Route exact path="/arrangeShip" component={() => ( <ArrangeShips userName={userName} getGridArray={getGridArray} /> )} /> <Route exact path="/battleGround" component={() => ( <BattleGround userName={userName} gridArray={gridArray} userAvatar={userAvatar} /> )} /> <Route path="/**" component={() => <Error />} /> </Switch> </BrowserRouter> </Suspense> ); const EnterFullScreenText = () => ( <div style={classes.fullscreenDiv}> <h1 style={classes.h1}>Battle Ship</h1> <img src={ShipImage} alt="ship" className="ship-image" /> <span style={classes.fullscreenText}> A single player game which involves in strategy. Player has to plan the their fleet of ships & win over the computer. </span> <span style={classes.fullscreenText}> For better experince we want you to use this application in fullscreen mode. </span> <Button style={classes.fullscreenButton} color="primary" variant="contained" size="large" onClick={handle.enter} startIcon={<FullscreenIcon />} > Enter FullScreen </Button> </div> ); return ( <> <ThemeProvider theme={theme}> <CssBaseline /> <Typography component={"span"} variant={"body2"}> <EnterFullScreenText /> <FullScreen handle={handle} onChange={reportChange}> <DeviceOrientation lockOrientation={"landscape"} className="orientation" > <Orientation orientation="landscape" alwaysRender={false}> {isFullscreen ? <RoutingComponents /> : <></>} </Orientation> <Orientation orientation="portrait" alwaysRender={false}> <div style={classes.fullscreenDiv}> <div style={{ ...classes.fullscreenText, ...classes.rotateScreen, }} > Please rotate your device </div> </div> </Orientation> </DeviceOrientation> </FullScreen> </Typography> </ThemeProvider> </> ); }; export default App;
27.625641
79
0.558938
false
true
false
true
d007c42376265d858508239a568723ad26358253
321
jsx
JSX
src/pages/404.jsx
DeClaessens/declaessens-gatsby-starter
749f78d7337ed5872806ee859bc544985d7f39f2
[ "MIT" ]
null
null
null
src/pages/404.jsx
DeClaessens/declaessens-gatsby-starter
749f78d7337ed5872806ee859bc544985d7f39f2
[ "MIT" ]
null
null
null
src/pages/404.jsx
DeClaessens/declaessens-gatsby-starter
749f78d7337ed5872806ee859bc544985d7f39f2
[ "MIT" ]
null
null
null
import React from 'react'; import Layout from '@/components/layout'; import SEO from '@/components/seo'; const NotFoundPage = () => ( <Layout> <SEO title="404: Not found" /> <h1>NOT FOUND</h1> <p>You just hit a route that doesn&#39;t exist... the sadness.</p> </Layout> ); export default NotFoundPage;
21.4
70
0.647975
false
true
false
true
d007c883077040a803f89d63ab913e1fcf60a26b
2,873
jsx
JSX
src/components/Table/Table.jsx
DAism2019/Deme-Frontend
06b1af2525627ea11d6b0761baa8125c5c3c97f6
[ "MIT" ]
null
null
null
src/components/Table/Table.jsx
DAism2019/Deme-Frontend
06b1af2525627ea11d6b0761baa8125c5c3c97f6
[ "MIT" ]
null
null
null
src/components/Table/Table.jsx
DAism2019/Deme-Frontend
06b1af2525627ea11d6b0761baa8125c5c3c97f6
[ "MIT" ]
null
null
null
/*! ========================================================= * Material Dashboard React - v1.7.0 ========================================================= * Product Page: https://www.creative-tim.com/product/material-dashboard-react * Copyright 2019 Creative Tim (https://www.creative-tim.com) * Licensed under MIT (https://github.com/creativetimofficial/material-dashboard-react/blob/master/LICENSE.md) * Coded by Creative Tim ========================================================= * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. */ import React from "react"; import PropTypes from "prop-types"; // @material-ui/core components import withStyles from "@material-ui/core/styles/withStyles"; import Table from "@material-ui/core/Table"; import TableHead from "@material-ui/core/TableHead"; import TableRow from "@material-ui/core/TableRow"; import TableBody from "@material-ui/core/TableBody"; import TableCell from "@material-ui/core/TableCell"; // core components import tableStyle from "assets/jss/material-dashboard-react/components/tableStyle.jsx"; function CustomTable({ ...props }) { const { classes, tableHead, tableData, tableHeaderColor } = props; return ( <div className={classes.tableResponsive}> <Table className={classes.table}> {tableHead !== undefined ? ( <TableHead className={classes[tableHeaderColor + "TableHeader"]}> <TableRow className={classes.tableHeadRow}> {tableHead.map((prop, key) => { return ( <TableCell className={classes.tableCell + " " + classes.tableHeadCell} key={key} > {prop} </TableCell> ); })} </TableRow> </TableHead> ) : null} <TableBody> {tableData.map((prop, key) => { return ( <TableRow key={key} className={classes.tableBodyRow}> {prop.map((prop, key) => { return ( <TableCell className={classes.tableCell} key={key} style={{fontSize:20}}> {prop} </TableCell> ); })} </TableRow> ); })} </TableBody> </Table> </div> ); } CustomTable.defaultProps = { tableHeaderColor: "gray" }; CustomTable.propTypes = { classes: PropTypes.object.isRequired, tableHeaderColor: PropTypes.oneOf([ "warning", "primary", "danger", "success", "info", "rose", "gray" ]), tableHead: PropTypes.arrayOf(PropTypes.string), tableData: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)) }; export default withStyles(tableStyle)(CustomTable);
31.571429
128
0.562826
false
true
false
true
d007dc777b99ba112ba5eadbba8f166e98e72335
369
jsx
JSX
component/Slider/SliderItem/SliderItem.jsx
ScorpionJay/react-redux-router-demo
8b312e790912dc45c834c94f95e9bead091b780c
[ "MIT" ]
null
null
null
component/Slider/SliderItem/SliderItem.jsx
ScorpionJay/react-redux-router-demo
8b312e790912dc45c834c94f95e9bead091b780c
[ "MIT" ]
null
null
null
component/Slider/SliderItem/SliderItem.jsx
ScorpionJay/react-redux-router-demo
8b312e790912dc45c834c94f95e9bead091b780c
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; export default class SliderItem extends Component { constructor(props) { super(props); } render() { let { count, item } = this.props; let width = 100 / count + '%'; return ( <li className="slider-item" style={{width: width}}> <img src={item.src} alt={item.alt} /> </li> ); } }
20.5
57
0.566396
false
true
true
false
d00812578131ad640d095235c933efb9d173ebab
418
jsx
JSX
app/components/shipyard/buildQueue/subsidizeButton.jsx
Kantigen/ka-web
81391465cfe20608942a06f7a4fe701f00ce4d30
[ "MIT" ]
1
2016-06-16T08:19:19.000Z
2016-06-16T08:19:19.000Z
app/components/shipyard/buildQueue/subsidizeButton.jsx
Kantigen/ka-web
81391465cfe20608942a06f7a4fe701f00ce4d30
[ "MIT" ]
23
2016-06-16T01:17:58.000Z
2021-11-28T23:55:53.000Z
app/components/shipyard/buildQueue/subsidizeButton.jsx
Kantigen/ka-web
81391465cfe20608942a06f7a4fe701f00ce4d30
[ "MIT" ]
5
2017-08-08T04:18:52.000Z
2020-11-15T04:51:40.000Z
import PropTypes from 'prop-types'; import React from 'react'; class SubsidizeButton extends React.Component { static propTypes = { obj: PropTypes.object.isRequired, buildingId: PropTypes.number.isRequired, }; render() { return ( <div className='ui fluid action input'> <div className='ui green button'>Subsidize, 23E</div> </div> ); } } export default SubsidizeButton;
19.904762
61
0.669856
false
true
true
false
d008236b490952d0fd8f512e9185af5ec5bb0bab
512
jsx
JSX
src/gatsby-theme-portfolio/components/social/LinkedIn/index.jsx
apshah92/portfolioSite
2fcd9622e3262b6337ca74b827916eabf537da8d
[ "MIT" ]
null
null
null
src/gatsby-theme-portfolio/components/social/LinkedIn/index.jsx
apshah92/portfolioSite
2fcd9622e3262b6337ca74b827916eabf537da8d
[ "MIT" ]
null
null
null
src/gatsby-theme-portfolio/components/social/LinkedIn/index.jsx
apshah92/portfolioSite
2fcd9622e3262b6337ca74b827916eabf537da8d
[ "MIT" ]
null
null
null
import React from "react"; export const LinkedIn = ({ color }) => ( <svg viewBox="10 10 512 512"> <path fill={color} d="M186.4 142.4c0 19-15.3 34.5-34.2 34.5 -18.9 0-34.2-15.4-34.2-34.5 0-19 15.3-34.5 34.2-34.5C171.1 107.9 186.4 123.4 186.4 142.4zM181.4 201.3h-57.8V388.1h57.8V201.3zM273.8 201.3h-55.4V388.1h55.4c0 0 0-69.3 0-98 0-26.3 12.1-41.9 35.2-41.9 21.3 0 31.5 15 31.5 41.9 0 26.9 0 98 0 98h57.5c0 0 0-68.2 0-118.3 0-50-28.3-74.2-68-74.2 -39.6 0-56.3 30.9-56.3 30.9v-25.2H273.8z"/> </svg> );
64
396
0.625
false
true
false
true
d0082b5edac414aa7b707bb62d9dc7528d0663fe
3,480
jsx
JSX
client/src/Site_pages/Products.jsx
WalterMarikwa/ecommerce-website
0fbd444b577e34f210fed07a6dedf9aa6d1301ce
[ "MIT" ]
null
null
null
client/src/Site_pages/Products.jsx
WalterMarikwa/ecommerce-website
0fbd444b577e34f210fed07a6dedf9aa6d1301ce
[ "MIT" ]
4
2021-05-10T16:42:20.000Z
2022-02-27T11:17:51.000Z
client/src/Site_pages/Products.jsx
WalterMarikwa/ecommerce-website
0fbd444b577e34f210fed07a6dedf9aa6d1301ce
[ "MIT" ]
null
null
null
import React from "react"; import axios from 'axios'; // import Prod from "./ProductsData.json"; import "../page_styles/Products.css"; import DropMenu from "../components/products/FilterProducts"; import Hero from "../components/products/Hero"; import DropMenuprice from "../components/products/FilterProductsByPrice" class Products extends React.Component { state = { Products: [], nameFilter: '', priceFilter: '' }; componentDidMount() { axios .get("/api/products") .then((response) => { console.log(response) this.setState({ Products: response.data }) }) .catch(err => { console.log(err); }); } updateNameFilter = (name) => { this.setState({nameFilter: name}) } updatePriceFilter = (priceString) => { this.setState({priceFilter: priceString}) } render() { let productsToList = [...this.state.Products] // filtering on productsToList let nameFilter = this.state.nameFilter; const priceFilter = this.state.priceFilter; if (nameFilter && nameFilter.toLowerCase() !== 'all') { console.log('Filter is on!') nameFilter = nameFilter.toLowerCase() productsToList = productsToList.filter( Products => { const type = Products.product_type.toLowerCase() return type.indexOf(nameFilter) !== -1 } ); } if (priceFilter && priceFilter.toLowerCase() !== 'all') { console.log('hit the price filter'); console.log(productsToList); productsToList = productsToList.filter((product) => { const priceFilterArr = priceFilter.split(','); const priceMin = parseInt(priceFilterArr[0]); const priceMax = parseInt(priceFilterArr[1]); console.log(priceMin, "min"); console.log(priceMax, "max"); return product.item_price >= priceMin && product.item_price <= priceMax; }) } // Work on this!! // if(productsToList.length == 0) { // } console.log("test", priceFilter); return ( <div> <Hero /> <DropMenu onNameChange={this.updateNameFilter} /> <DropMenuprice onPriceChange={this.updatePriceFilter} /> <div className="card"> <div className="row"> <div className="cards" className="col-sm-12"> <div className="row"> {productsToList.map((product, index) => { return ( <div className="col-sm-4 col-sm-4" key={`product-card-${product.product_id}`}> <div className=" card aSeries"> <div className="name">{product.product_type}</div> <div className="photoBg" style={{ backgroundImage: `url(${product.image})` }}></div> <div className="description">{product.description_type}</div> <div className="price">${product.item_price}</div> <div className="btn-group"> <input className="btn btn-primary" type="submit" value="Buy" /> </div> </div> </div> ); })} </div> </div> </div> </div> </div> ); } } export default Products;
30.79646
108
0.530747
false
true
true
false
d008345f2942c7d8f72b695942e569b0b76e60e9
1,503
jsx
JSX
src/scenes/Scheduler/Schedule/index.jsx
eoh-uiuc/volunteer-portal
f303d04ae3f492e1a89b6815d511185967df86bc
[ "MIT" ]
null
null
null
src/scenes/Scheduler/Schedule/index.jsx
eoh-uiuc/volunteer-portal
f303d04ae3f492e1a89b6815d511185967df86bc
[ "MIT" ]
null
null
null
src/scenes/Scheduler/Schedule/index.jsx
eoh-uiuc/volunteer-portal
f303d04ae3f492e1a89b6815d511185967df86bc
[ "MIT" ]
null
null
null
import React from 'react'; import { connect } from 'react-redux'; import Tab from '@material-ui/core/Tab'; import Tabs from '@material-ui/core/Tabs'; import { setScheduleTab } from 'services/ui/actions'; import Day from './Day'; import Details from './Details'; import './styles.scss'; const Schedule = (props) => { const handleChange = (event, value) => { props.setScheduleTab(value); }; const { timeslots, tab } = props; if (timeslots === null) { return <div>Loading</div>; } return ( <div className="schedule"> {tab === 0 && <Day data={timeslots['03/05/2019']} />} {tab === 1 && <Day data={timeslots['03/06/2019']} />} {tab === 2 && <Day data={timeslots['03/07/2019']} />} {tab === 3 && <Day data={timeslots['03/08/2019']} />} {tab === 4 && <Day data={timeslots['03/09/2019']} />} {tab === 5 && <Day data={timeslots['03/10/2019']} />} <div className="date-nav"> <Tabs value={tab} onChange={handleChange} centered> <Tab label="March 5th" /> <Tab label="March 6th" /> <Tab label="March 7th" /> <Tab label="March 8th" /> <Tab label="March 9th" /> <Tab label="March 10th" /> </Tabs> </div> <Details /> </div> ); } const mapStateToProps = (state) => ({ timeslots: state.timeslots.data, tab: state.ui.tab, }); const mapDispatchToProps = { setScheduleTab, }; export default connect(mapStateToProps, mapDispatchToProps)(Schedule);
25.913793
70
0.572854
false
true
false
true
d00841941c9cb0ff1af0e816e18f060b4388ea11
1,472
jsx
JSX
react-frontend/src/explorer/Explorer.jsx
DanielaRocha6/hangryff
ea459a77bed77f71b496c15050b442acc10873ae
[ "MIT" ]
null
null
null
react-frontend/src/explorer/Explorer.jsx
DanielaRocha6/hangryff
ea459a77bed77f71b496c15050b442acc10873ae
[ "MIT" ]
null
null
null
react-frontend/src/explorer/Explorer.jsx
DanielaRocha6/hangryff
ea459a77bed77f71b496c15050b442acc10873ae
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import './explorer.css'; export default class Explorer extends React.Component { constructor(props) { super(props); this.state = { recipes: [] }; this.clickRecipe = this.clickRecipe.bind(this); } componentDidMount() { const api = 'http://localhost:3001/api/recipes/all'; (async () => { const req = await fetch(api); const data = await req.json(); this.setState({ recipes: data }); })(); } clickRecipe(recipe) { return () => this.props.goToRecipe(recipe); } render() { return ( <div id="recipes-explorer-container"> {this.state.recipes.map((r, i) => { return ( <div key={i} onClick={this.clickRecipe(r)}> <span>{r._fields[0].properties.title}</span> <img src={r._fields[0].properties.image} alt={r._fields[0].properties.image}/> <div className="recipe-item-footer"> <div> <i className="fas fa-utensils"></i> <span>{r._fields[0].properties.servings}</span> </div> <div> <i className="fas fa-dollar-sign"></i> <span>{r._fields[0].properties.pricePerServing}</span> </div> </div> </div> ); })} </div> ); } } Explorer.propTypes = { goToRecipe: PropTypes.func.isRequired }
26.763636
92
0.528533
false
true
true
false
d008422b1ab849fd2c45069417898154ab24373b
1,603
jsx
JSX
src/views/UserCreateForm.jsx
Intey/banking-frontend
686ffdf9528ef6ca6996078e214eb915aea4fb57
[ "MIT" ]
null
null
null
src/views/UserCreateForm.jsx
Intey/banking-frontend
686ffdf9528ef6ca6996078e214eb915aea4fb57
[ "MIT" ]
null
null
null
src/views/UserCreateForm.jsx
Intey/banking-frontend
686ffdf9528ef6ca6996078e214eb915aea4fb57
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import './UserCreateForm.css' import Field from './Field.jsx' import { commonOnChange } from '../utils/helpers.js' export default class UserCreateForm extends React.Component { constructor(props) { super(props) this.state = { username: "", rate: 1, password: "", passwordConfirm: "" } this.onChange = commonOnChange.bind(this); } create = () => { this.props.onCreateNewUser({ username: this.state.username, rate: this.state.rate, password: this.state.password, is_superuser: false, }) } render() { let errors = this.props.errors || [] const passwordMatch = (this.state.password.trim() !== "" && this.state.password === this.state.passwordConfirm) const confirmError = passwordMatch ? null : "Password doesn't match" return ( <React.Fragment> <h3>Create new User</h3> <Field name="username" onChange={this.onChange} value={this.state.username} error={errors.username}/> <Field name="rate" onChange={this.onChange} value={this.state.rate} error={errors.rate}/> <Field name="password" onChange={this.onChange} value={this.state.password} error={errors.password}/> <Field name="passwordConfirm" onChange={this.onChange} value={this.state.passwordConfirm} error={confirmError}/> <button disabled={!passwordMatch} onClick={this.create}>Create</button> </React.Fragment> ) } } UserCreateForm.propTypes = { onCreateNewUser: PropTypes.func.isRequired }
31.431373
120
0.651903
false
true
true
false
d008531b637bdd0e466f808f295be922d8da063a
688
jsx
JSX
src/component/search/SearchBar.jsx
tishchungoora/vezear-frontend
80080aabec939901e5a44b2105a9dcaee1ae0b72
[ "MIT" ]
null
null
null
src/component/search/SearchBar.jsx
tishchungoora/vezear-frontend
80080aabec939901e5a44b2105a9dcaee1ae0b72
[ "MIT" ]
3
2021-10-06T09:02:13.000Z
2022-02-18T17:21:45.000Z
src/component/search/SearchBar.jsx
tishchungoora/vezear-frontend
80080aabec939901e5a44b2105a9dcaee1ae0b72
[ "MIT" ]
null
null
null
import React, { Component } from "react"; export default class SearchBar extends Component { render() { const { handleSearchInputChange, handleSearchSubmit } = this.props return ( <div> <h5 className="pb-2">Search by keyword:</h5> <form className="form-inline" onSubmit={handleSearchSubmit}> <input className="form-control w-75" type="text" placeholder="Search for..." aria-label="Search" onChange={handleSearchInputChange} /> <button className="btn btn-primary ml-2" type="submit"> Search </button> </form> </div> ); } }
26.461538
70
0.55814
false
true
true
false
d0086b4ac94c1af31aed91678d975b66191c0d2c
1,287
jsx
JSX
src/app/containers/ArticleTimestamp/index.jsx
alex-magana/simorgh
85c8989f2370144b35e8a26ec73807e1d065d658
[ "Apache-2.0" ]
null
null
null
src/app/containers/ArticleTimestamp/index.jsx
alex-magana/simorgh
85c8989f2370144b35e8a26ec73807e1d065d658
[ "Apache-2.0" ]
null
null
null
src/app/containers/ArticleTimestamp/index.jsx
alex-magana/simorgh
85c8989f2370144b35e8a26ec73807e1d065d658
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import { number } from 'prop-types'; import { GridItemConstrainedMedium } from '../../lib/styledGrid'; import Timestamp from '../Timestamp'; import { isValidDateTime } from '../Timestamp/timestampUtilities'; import { formatDateNumeric } from './timeFormats'; import { isFirstRelative, isLastRelative, formatType } from './helpers'; const ArticleTimestamp = ({ firstPublished, lastPublished }) => { if (!isValidDateTime(firstPublished) || !isValidDateTime(lastPublished)) { return null; } return ( <GridItemConstrainedMedium> <Timestamp timestamp={firstPublished} dateTimeFormat={formatDateNumeric} format={formatType({ firstPublished })} isRelative={isFirstRelative(firstPublished, lastPublished)} /> {firstPublished !== lastPublished ? ( <Timestamp timestamp={lastPublished} dateTimeFormat={formatDateNumeric} format={formatType({ lastPublished, firstPublished })} isRelative={isLastRelative(lastPublished)} prefix="Updated" /> ) : null} </GridItemConstrainedMedium> ); }; ArticleTimestamp.propTypes = { firstPublished: number.isRequired, lastPublished: number.isRequired, }; export default ArticleTimestamp;
31.390244
76
0.686869
false
true
false
true
d008834c9332190692ffb84988bf8e615f141804
323
jsx
JSX
src/components/home/GetInTouch.jsx
sassansh/sassansh.github.io
13faf180eeb94be88471636598c3622eabf0f450
[ "MIT" ]
null
null
null
src/components/home/GetInTouch.jsx
sassansh/sassansh.github.io
13faf180eeb94be88471636598c3622eabf0f450
[ "MIT" ]
1
2022-02-28T01:50:56.000Z
2022-02-28T01:50:56.000Z
src/components/home/GetInTouch.jsx
sassansh/sassansh.github.io
13faf180eeb94be88471636598c3622eabf0f450
[ "MIT" ]
null
null
null
import React from "react"; const GetInTouch = ({ heading, message, email }) => { return ( <> <h2 className="display-4 pb-3 text-center">{heading}</h2> <p className="lead text-center pb-3"> {message}, <a href={`mailto:${email}`}>{email}</a>. </p> </> ); }; export default GetInTouch;
21.533333
63
0.560372
false
true
false
true
d008851a302e1b6c4b11472efa270f5dbf5d0b48
2,335
jsx
JSX
lib/wijmo-5.20193.637/samples/Nav/TreeView/DataBinding/InitialState/react/src/app.jsx
Thomas080304/sss
9c409b7233b5291ecf9250ce0028656e5cdfd95a
[ "MIT" ]
null
null
null
lib/wijmo-5.20193.637/samples/Nav/TreeView/DataBinding/InitialState/react/src/app.jsx
Thomas080304/sss
9c409b7233b5291ecf9250ce0028656e5cdfd95a
[ "MIT" ]
null
null
null
lib/wijmo-5.20193.637/samples/Nav/TreeView/DataBinding/InitialState/react/src/app.jsx
Thomas080304/sss
9c409b7233b5291ecf9250ce0028656e5cdfd95a
[ "MIT" ]
null
null
null
import './app.css'; import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wjNav from '@grapecity/wijmo.react.nav'; import { getData } from './data'; class App extends React.Component { constructor(props) { super(props); this.state = getData(); } render() { return (<div className="container-fluid"> <wjNav.TreeView itemsSource={this.state}></wjNav.TreeView> <h2>Selecting a default item</h2> <p> If you select an item when the tree loads, it will automatically ensure the selected node is visible, expanding the tree and scrolling as needed. In this case, we selected the 'Solar Panel' item: </p> <wjNav.TreeView itemsSource={this.state} loadedItems={this.theTreeSelectedLoadedItems.bind(this)}></wjNav.TreeView> <h2>Collapsing to a given Level</h2> <p> Use the <b>collapseToLevel</b> method to collapse or expand the tree to a given level when it loads. For example, the trees below start totally collapsed and totally expanded: </p> <wjNav.TreeView itemsSource={this.state} loadedItems={this.onTreeCollapsedLoadedItems.bind(this)}></wjNav.TreeView> <wjNav.TreeView itemsSource={this.state} loadedItems={this.onTreeExpandedLoadedItems.bind(this)}></wjNav.TreeView> </div>); } theTreeSelectedLoadedItems(s, e) { s.selectedItem = this.findItem(s.itemsSource, "Solar Panel"); } onTreeCollapsedLoadedItems(s, e) { s.collapseToLevel(0); } onTreeExpandedLoadedItems(s, e) { s.collapseToLevel(10); } findItem(items, str) { for (var i = 0; items && i < items.length; i++) { if (items[i].header.indexOf(str) !== -1) { return items[i]; } var result = this.findItem(items[i].items, str); if (result) { return result; } } return null; } } ReactDOM.render(<App />, document.getElementById('app'));
37.66129
131
0.564454
false
true
true
false
d0088959aa57030e7ec65451dd1f7ac184091978
3,157
jsx
JSX
superset-frontend/src/dashboard/components/CssEditor.jsx
mar-bi/incubator-superset
c30e966a9a7e172383623705ce0beae65acd5c05
[ "Apache-2.0" ]
30
2020-10-24T02:30:31.000Z
2022-03-29T23:21:48.000Z
superset-frontend/src/dashboard/components/CssEditor.jsx
mar-bi/incubator-superset
c30e966a9a7e172383623705ce0beae65acd5c05
[ "Apache-2.0" ]
339
2017-03-09T00:02:21.000Z
2022-03-29T22:28:50.000Z
superset-frontend/src/dashboard/components/CssEditor.jsx
mar-bi/incubator-superset
c30e966a9a7e172383623705ce0beae65acd5c05
[ "Apache-2.0" ]
9
2020-12-21T16:20:20.000Z
2022-03-18T06:04:37.000Z
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import React from 'react'; import PropTypes from 'prop-types'; import Select from 'src/components/Select'; import AceEditor from 'react-ace'; import 'brace/mode/css'; import 'brace/theme/github'; import { t } from '@superset-ui/translation'; import ModalTrigger from '../../components/ModalTrigger'; const propTypes = { initialCss: PropTypes.string, triggerNode: PropTypes.node.isRequired, onChange: PropTypes.func, templates: PropTypes.array, }; const defaultProps = { initialCss: '', onChange: () => {}, templates: [], }; class CssEditor extends React.PureComponent { constructor(props) { super(props); this.state = { css: props.initialCss, cssTemplateOptions: [], }; this.changeCss = this.changeCss.bind(this); this.changeCssTemplate = this.changeCssTemplate.bind(this); } changeCss(css) { this.setState({ css }, () => { this.props.onChange(css); }); } changeCssTemplate(opt) { this.changeCss(opt.css); } renderTemplateSelector() { if (this.props.templates) { return ( <div style={{ zIndex: 10 }}> <h5>{t('Load a template')}</h5> <Select options={this.props.templates} placeholder={t('Load a CSS template')} onChange={this.changeCssTemplate} /> </div> ); } return null; } render() { return ( <ModalTrigger triggerNode={this.props.triggerNode} modalTitle={t('CSS')} isMenuItem modalBody={ <div> {this.renderTemplateSelector()} <div style={{ zIndex: 1 }}> <h5>{t('Live CSS Editor')}</h5> <div style={{ border: 'solid 1px grey' }}> <AceEditor mode="css" theme="github" minLines={8} maxLines={30} onChange={this.changeCss} height="200px" width="100%" editorProps={{ $blockScrolling: true }} enableLiveAutocompletion value={this.state.css || ''} /> </div> </div> </div> } /> ); } } CssEditor.propTypes = propTypes; CssEditor.defaultProps = defaultProps; export default CssEditor;
27.215517
63
0.595502
false
true
false
true
d008955ee000003bf5d5e776d789c87aa2a508c8
432
jsx
JSX
src/components/Input.jsx
sumitjoshi97/ToDo
2114580344ba32d3de23474b32ba4a91b3e70b2b
[ "MIT" ]
null
null
null
src/components/Input.jsx
sumitjoshi97/ToDo
2114580344ba32d3de23474b32ba4a91b3e70b2b
[ "MIT" ]
null
null
null
src/components/Input.jsx
sumitjoshi97/ToDo
2114580344ba32d3de23474b32ba4a91b3e70b2b
[ "MIT" ]
null
null
null
import React from 'react'; import '../css/Input.css'; const Input = (props) => { return ( <div id="input"> <input type="text" placeholder={props.placeholder} value={props.input} onChange={props.handleInput} /> <button id="btn" onClick={props.handleClick}>Add</button> </div> ); } export default Input;
24
69
0.488426
false
true
false
true
d008a2198af8df37afae8e0ef10be3aae77bedba
1,002
jsx
JSX
src/views/client/Archive/index.jsx
MonsterAnan/react-blog-ts
3b56531cc11b4a9cda34dc4b7e18e41667d48a91
[ "MIT" ]
10
2020-05-21T10:45:22.000Z
2020-07-22T07:22:22.000Z
src/views/client/Archive/index.jsx
MonsterAnan/react-blog-ts
3b56531cc11b4a9cda34dc4b7e18e41667d48a91
[ "MIT" ]
6
2020-12-04T20:58:55.000Z
2021-08-07T04:36:26.000Z
src/views/client/Archive/index.jsx
MonsterAnan/react-blog-ts
3b56531cc11b4a9cda34dc4b7e18e41667d48a91
[ "MIT" ]
3
2020-07-14T15:15:58.000Z
2020-07-17T16:23:44.000Z
import React, { useEffect, useState } from "react"; import Card from "components/Card"; import TimeLine from "./TimeLine"; import Container from "@material-ui/core/Container"; import FirstBanner from "views/client/FirstBanner"; // api import { getArticle } from "api/client/article"; export default function Archive() { const [list, setList] = useState([]); const [total, setTotal] = useState(0); const [page, setPagination] = useState(1); const [pagesize] = useState(5); useEffect(() => { getArticle({ pageindex: page }).then((res) => { if (res && res.code === 1) { setList(res.data.list); setTotal(res.data.total) } }); }, [page]); const setPage=(e,pageindex)=>{ setPagination(pageindex) } return ( <> <FirstBanner /> <Container className="container"> <Card> <TimeLine list={list} page={page} pagesize={pagesize} total={total} setPage={setPage} /> </Card> </Container> </> ); }
27.081081
98
0.608782
false
true
false
true
d008a63f1b10b1e58d92e10aa466ac27dc518d15
1,984
jsx
JSX
public/js/components/Sidebar/Account.jsx
OOT-Multiworld-Tracker/Multiworld-Tracker
c81a1366d8895f9055d04473186004ae72eca380
[ "Apache-2.0" ]
1
2021-04-18T23:32:21.000Z
2021-04-18T23:32:21.000Z
public/js/components/Sidebar/Account.jsx
OOT-Multiworld-Tracker/Multiworld-Tracker
c81a1366d8895f9055d04473186004ae72eca380
[ "Apache-2.0" ]
30
2021-04-19T20:16:42.000Z
2022-01-06T03:35:04.000Z
public/js/components/Sidebar/Account.jsx
OOT-Multiworld-Tracker/Multiworld-Tracker
c81a1366d8895f9055d04473186004ae72eca380
[ "Apache-2.0" ]
3
2021-04-23T15:57:32.000Z
2022-02-01T18:55:28.000Z
import React from 'react' import app, { SaveUtils } from '../../app' import axios from 'axios' import './Account.css' import Saves from '../Saves' const URL = "https://api.beyondapp.net/users/@me" export default class Account extends React.Component { constructor (props) { super(props) this.state = { account: {} } this.handleLogin = this.handleLogin.bind(this) } handleLogin (account) { axios.get(URL, { headers: { "Authorization": "Bearer " + localStorage.token } }).then(response => { this.setState({ account: response.data }) }) } componentDidMount () { if (!localStorage.getItem('saves')) { SaveUtils.migrate() } axios.get(URL, { headers: { "Authorization": "Bearer " + localStorage.token } }).then(response => { this.setState({ account: response.data }) }) app.subscribe('account', this.handleLogin) } componentWillUnmount () { } render () { return ( <> {(this.state.account.username && <> <div className="account-container"> <img className='avatar' src={this.state.account.avatar}/> <span className='location-items'>{this.state.account.username}</span> </div> <button className='btn' style={{width: '100%'}} onClick={() => { localStorage.removeItem("token"); this.setState({ account: {} }) }}>Logout</button> <button className='btn' style={{width: '100%'}}>Import Cloud</button> <div className='list'> <div className='list-header'>Cloud Files</div> <div className='list-content'><Saves /></div> </div> </> ) || <button className='btn' style={{width: '100%'}} onClick={this.props.onLogin}>Login</button>} </> ) } }
26.105263
160
0.526714
false
true
true
false
d008c153da3a9e05fdc3cdd1b0b0fa03c4dc7a07
5,664
jsx
JSX
ui/component/commentMenuList/view.jsx
LBRYFoundation/lbry-desktop
4ddf75f836b91bbb7efdc27f7216b0847e6177bc
[ "MIT" ]
1
2021-12-31T06:39:11.000Z
2021-12-31T06:39:11.000Z
ui/component/commentMenuList/view.jsx
LBRYFoundation/lbry-desktop
4ddf75f836b91bbb7efdc27f7216b0847e6177bc
[ "MIT" ]
null
null
null
ui/component/commentMenuList/view.jsx
LBRYFoundation/lbry-desktop
4ddf75f836b91bbb7efdc27f7216b0847e6177bc
[ "MIT" ]
null
null
null
// @flow import * as ICONS from 'constants/icons'; import * as MODALS from 'constants/modal_types'; import React from 'react'; import { MenuList, MenuItem } from '@reach/menu-button'; import ChannelThumbnail from 'component/channelThumbnail'; import Icon from 'component/common/icon'; import { parseURI } from 'lbry-redux'; type Props = { uri: ?string, authorUri: string, // full LBRY Channel URI: lbry://@channel#123... commentId: string, // sha256 digest identifying the comment isTopLevel: boolean, isPinned: boolean, commentIsMine: boolean, // if this comment was signed by an owned channel disableEdit?: boolean, disableRemove?: boolean, supportAmount?: any, handleEditComment: () => void, // --- select --- claim: ?Claim, claimIsMine: boolean, contentChannelPermanentUrl: any, activeChannelClaim: ?ChannelClaim, playingUri: ?PlayingUri, // --- perform --- openModal: (id: string, {}) => void, clearPlayingUri: () => void, muteChannel: (string) => void, pinComment: (string, string, boolean) => Promise<any>, commentModAddDelegate: (string, string, ChannelClaim) => void, setQuickReply: (any) => void, }; function CommentMenuList(props: Props) { const { uri, claim, authorUri, commentIsMine, commentId, muteChannel, pinComment, clearPlayingUri, activeChannelClaim, contentChannelPermanentUrl, isTopLevel, isPinned, handleEditComment, commentModAddDelegate, playingUri, disableEdit, disableRemove, openModal, supportAmount, setQuickReply, } = props; const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl; function handlePinComment(commentId, claimId, remove) { pinComment(commentId, claimId, remove); } function handleDeleteComment() { if (playingUri && playingUri.source === 'comment') { clearPlayingUri(); } openModal(MODALS.CONFIRM_REMOVE_COMMENT, { commentId, commentIsMine, contentChannelPermanentUrl, supportAmount, setQuickReply, }); } function handleCommentBlock() { openModal(MODALS.BLOCK_CHANNEL, { contentUri: uri, commenterUri: authorUri }); } function handleCommentMute() { muteChannel(authorUri); } function assignAsModerator() { if (activeChannelClaim && authorUri) { const { channelName, channelClaimId } = parseURI(authorUri); commentModAddDelegate(channelClaimId, channelName, activeChannelClaim); } } return ( <MenuList className="menu__list"> {activeChannelIsCreator && <div className="comment__menu-title">{__('Creator tools')}</div>} {activeChannelIsCreator && isTopLevel && ( <MenuItem className="comment__menu-option menu__link" onSelect={() => handlePinComment(commentId, claim ? claim.claim_id : '', isPinned)} > <span className={'button__content'}> <Icon aria-hidden icon={ICONS.PIN} className={'icon'} /> {isPinned ? __('Unpin') : __('Pin')} </span> </MenuItem> )} {activeChannelIsCreator && ( <MenuItem className="comment__menu-option" onSelect={assignAsModerator}> <div className="menu__link"> <Icon aria-hidden icon={ICONS.ADD} /> {__('Add as moderator')} </div> <span className="comment__menu-help"> {__('Assign this user to moderate %channel%', { channel: activeChannelClaim ? activeChannelClaim.name : __('your channel'), })} </span> </MenuItem> )} {!disableRemove && activeChannelClaim && (activeChannelClaim.permanent_url === authorUri || activeChannelClaim.permanent_url === contentChannelPermanentUrl) && ( <MenuItem className="comment__menu-option" onSelect={handleDeleteComment}> <div className="menu__link"> <Icon aria-hidden icon={ICONS.DELETE} /> {__('Remove')} </div> </MenuItem> )} {commentIsMine && activeChannelClaim && activeChannelClaim.permanent_url === authorUri && !disableEdit && ( <MenuItem className="comment__menu-option menu__link" onSelect={handleEditComment}> <Icon aria-hidden icon={ICONS.EDIT} /> {__('Edit')} </MenuItem> )} {!commentIsMine && ( <MenuItem className="comment__menu-option" onSelect={handleCommentBlock}> <div className="menu__link"> <Icon aria-hidden icon={ICONS.BLOCK} /> {__('Block')} </div> {activeChannelIsCreator && ( <span className="comment__menu-help">{__('Prevent this channel from interacting with you.')}</span> )} </MenuItem> )} {!commentIsMine && ( <MenuItem className="comment__menu-option" onSelect={handleCommentMute}> <div className="menu__link"> <Icon aria-hidden icon={ICONS.MUTE} /> {__('Mute')} </div> {activeChannelIsCreator && ( <span className="comment__menu-help">{__('Hide this channel for you only.')}</span> )} </MenuItem> )} {activeChannelClaim && ( <div className="comment__menu-active"> <ChannelThumbnail xsmall noLazyLoad uri={activeChannelClaim.permanent_url} /> <div className="comment__menu-channel"> {__('Interacting as %channelName%', { channelName: activeChannelClaim.name })} </div> </div> )} </MenuList> ); } export default CommentMenuList;
31.466667
119
0.627648
false
true
false
true
d008cda97bd093d2bed071c287d5a0099ad0e1c6
1,018
jsx
JSX
WebUI/client-app/src/components/form/SearchBar.jsx
binwu0412/react-.netCore_template
8f64626de4823dd0c71b6f0e9ee5afca9146866d
[ "MIT" ]
null
null
null
WebUI/client-app/src/components/form/SearchBar.jsx
binwu0412/react-.netCore_template
8f64626de4823dd0c71b6f0e9ee5afca9146866d
[ "MIT" ]
null
null
null
WebUI/client-app/src/components/form/SearchBar.jsx
binwu0412/react-.netCore_template
8f64626de4823dd0c71b6f0e9ee5afca9146866d
[ "MIT" ]
null
null
null
import React from "react"; import { Paper, InputBase, IconButton, makeStyles } from "@material-ui/core"; import { Search, Person } from '@material-ui/icons'; const useStyles = makeStyles(() => ({ root: { padding: "2px 4px", display: "flex", alignItems: "center", width: 400, margin: "10px 0" }, input: { marginLeft: 10, flex: 1, }, iconButton: { padding: 10, }, divider: { height: 28, margin: 4, }, })); const SearchBar = ({onClick, searchString, onChange}) => { const classes = useStyles(); return ( <Paper component="form" className={classes.root}> <IconButton className={classes.iconButton} disabled> <Person /> </IconButton> <InputBase value={searchString} className={classes.input} placeholder="Search Employee" onChange={onChange} /> <IconButton className={classes.iconButton} onClick={onClick}> <Search /> </IconButton> </Paper> ); } export default SearchBar;
22.622222
77
0.601179
false
true
false
true
d008d33bebd2b1e522f6d123d19430ebe6fb11eb
529
jsx
JSX
src/containers/main.jsx
tellor-tracking/tellor-ui
68d01e8999f247649e2fa5dbdda4198559bddadf
[ "MIT" ]
1
2016-11-01T15:51:33.000Z
2016-11-01T15:51:33.000Z
src/containers/main.jsx
tellor-tracking/tellor-ui
68d01e8999f247649e2fa5dbdda4198559bddadf
[ "MIT" ]
null
null
null
src/containers/main.jsx
tellor-tracking/tellor-ui
68d01e8999f247649e2fa5dbdda4198559bddadf
[ "MIT" ]
null
null
null
import React from 'react'; import {observer} from 'mobx-react'; import SidePanel from '../components/side-panel/index.jsx'; import Stage from './stage.jsx'; @observer class Main extends React.Component { constructor(props) { super(props); } render() { return ( <div className="Main"> {this.props.store.activeApplicationId === null ? null : <SidePanel {...this.props}/>} <Stage {...this.props}/> </div> ); } } export default Main;
23
101
0.568998
false
true
true
false
d008e01b8429e3a642ffb2f9f32bc1befe1c1183
1,732
jsx
JSX
component/ContactSection.jsx
Maxfurry/pletora
38200031e2ba0c88a90898f3540f544a3aa87487
[ "MIT" ]
null
null
null
component/ContactSection.jsx
Maxfurry/pletora
38200031e2ba0c88a90898f3540f544a3aa87487
[ "MIT" ]
5
2021-03-10T02:33:30.000Z
2021-12-09T01:20:11.000Z
component/ContactSection.jsx
Maxfurry/pletora
38200031e2ba0c88a90898f3540f544a3aa87487
[ "MIT" ]
null
null
null
import LocalMap from "./localMap"; import contactSectionStyle from "../styles/components/contactSection.style"; function ContactInfo() { const info = [ { label: "Operational Office: ", info: "1C, Alhaji Masha Close/Ademola Street, Off Awolowo Road, Ikoyi, Lagos." }, { label: "Email: ", info: "[email protected]" }, { label: "Phone Number: ", info: "+234(0) 809 319 8241, 01 6328 493-4" } ]; return ( <> <ul> {info.map((singleInfo, i) => { const { label, info } = singleInfo; return ( <li key={i}> <strong>{label}</strong> {info} </li> ); })} </ul> <style jsx>{contactSectionStyle}</style> </> ); } export default function ContactSection() { return ( <> <section className="contact-section" id="contact"> <div> <h1>Office address</h1> <div className="local-map"> <LocalMap /> </div> </div> <div> <h1>Get in touch</h1> <form action=""> <div> <input type="text" placeholder="name" /> <input type="text" placeholder="email address" /> </div> <textarea name="" id="" cols="30" rows="10" placeholder="Send a message to us..." ></textarea> <button>send message</button> </form> </div> <div className="contact-info"> <ContactInfo /> </div> </section> <style jsx>{contactSectionStyle}</style> </> ); }
23.093333
80
0.464781
false
true
false
true
d008e1a9d6ec9d367fcfb700e1cee5ac4a0f0f2e
498
jsx
JSX
.history/src/components/landing/Intro/HeroImg/heroImageMobile_20211002212949.jsx
szilarddenes/gatsby-gpo
b59c5a5b2ded959e7ccfaf2fdab50fa4cfbcfe76
[ "MIT" ]
1
2021-09-23T15:38:03.000Z
2021-09-23T15:38:03.000Z
.history/src/components/landing/Intro/HeroImg/heroImageMobile_20211002212949.jsx
szilarddenes/gatsby-gpo
b59c5a5b2ded959e7ccfaf2fdab50fa4cfbcfe76
[ "MIT" ]
null
null
null
.history/src/components/landing/Intro/HeroImg/heroImageMobile_20211002212949.jsx
szilarddenes/gatsby-gpo
b59c5a5b2ded959e7ccfaf2fdab50fa4cfbcfe76
[ "MIT" ]
null
null
null
import React from 'react' import { Thumbnail, BorderedImage } from "../styles"; import FadeInLeft from "hooks/fadeInLeft"; import { StaticImage } from "gatsby-plugin-image" const HeroImageMobile = () => { return ( <Thumbnail> <FadeInLeft> <BorderedImage> <StaticImage src="../../../../assets/illustrations/hero-main-mobile-comp.png" alt="" as={/> </BorderedImage > </FadeInLeft> </Thumbnail> ) } export default HeroImageMobile
26.210526
102
0.618474
false
true
false
true
d008e3098657fa008598f22332731ec4d14a6284
7,113
jsx
JSX
client/components/ChatApp.jsx
murrayjbrown/chat-feathers-nextjs-react-hooks-example
df1f8dd76f4537a641d3f5a514ca2c6b7833f5cb
[ "MIT" ]
null
null
null
client/components/ChatApp.jsx
murrayjbrown/chat-feathers-nextjs-react-hooks-example
df1f8dd76f4537a641d3f5a514ca2c6b7833f5cb
[ "MIT" ]
null
null
null
client/components/ChatApp.jsx
murrayjbrown/chat-feathers-nextjs-react-hooks-example
df1f8dd76f4537a641d3f5a514ca2c6b7833f5cb
[ "MIT" ]
null
null
null
// @flow import React, { useEffect, useReducer, useState } from 'react'; import datetime from 'dayjs'; import match from 'rust-match'; import produce from 'immer'; import { dashCat } from '@client/util'; import { defaultToStrict } from 'rambdax'; import { appClient, useAppContainer } from '@client/containers/AppContainer'; type LocalAction = { type: string, payload: any, }; type LocalState = { isStarted: boolean, messages: Array<Object>, users: Array<Object>, }; type Start = { messages?: Array<Object>, users?: Array<Object>, }; const initialState: LocalState = { isStarted: false, messages: [], users: [], }; const chatActions = { addMessage: (message: Array<Object>) => ({ type: 'addMessage', payload: message, }), addUser: (user: Array<Object>) => ({ type: 'addMessage', payload: user, }), reset: () => ({ type: 'reset', }), start: (startProps: Start) => ({ type: 'start', payload: startProps, }), }; const reducer = (state: LocalState, action: LocalAction) => produce(state, draft => match(action.type, { addMessage: () => { const messages = draft.messages.concat(action.payload); return { ...draft, messages }; }, addUser: () => { const users = draft.users.concat(action.payload); return { ...draft, users }; }, reset: () => { return { ...initialState }; }, start: () => { const messages = draft.messages.concat(action.payload.messages); const users = draft.messages.concat(action.payload.users); return { ...draft, messages, users, isStarted: true }; }, _: () => { throw new Error('Unexpected action: ' + action.type); }, }), ); type Props = { label: string, }; export default function ChatApp({ label }: Props) { // eslint-disable-next-line no-unused-vars const [state, _] = useAppContainer(); const [chatElem, setChatElem] = useState(); const [chatState, dispatchChat] = useReducer(reducer, initialState); const addMessage = (message: Array<Object>) => { dispatchChat(chatActions.addMessage(message)); }; const addUser = (user: Array<Object>) => { dispatchChat(chatActions.addUser(user)); }; const startChat = async () => { const client = appClient(); if (client) { const [userPage, messagePage] = await Promise.all([ client.service('users').find(), client.service('messages').find({ query: { $sort: { createdAt: -1 }, $limit: 25, }, }), ]); dispatchChat( chatActions.start({ messages: messagePage.data.reverse(), users: userPage.data, }), ); } }; useEffect(() => { const client = appClient(); if (client && !chatState.isStarted) { // Add new user(s) to the user list client.service('users').removeListener('created'); client.service('users').on('created', user => { addUser(user); }); // Add new message(s) to the message list client.service('messages').removeListener('created'); client.service('messages').on('created', message => { addMessage(message); scrollToBottom(); }); // Retrieve users and past messages startChat(); } return () => { if (client) { client.service('messages').removeListener('created'); client.service('users').removeListener('created'); } }; }, [state.isStarted]); function logout() { const client = appClient(); if (client) { client.logout(); } } function sendMessage(ev) { const client = appClient(); if (client && ev) { const elem = ev.target.querySelector('[name="text"]'); if (elem && elem.value) { const text = elem.value.trim(); if (text) { client .service('messages') .create({ text }) .then(() => { elem.value = ''; }); } } ev.preventDefault(); } } function scrollToBottom() { if (chatElem) { chatElem.scrollTop = chatElem.scrollHeight - chatElem.clientHeight; } } const id = (...ids: Array<string>) => dashCat(defaultToStrict('', label), ...ids); return ( <div className='app flex flex-column'> <header className='title-bar flex flex-row flex-center'> <div className='title-wrapper block center-element'> <img className='logo' src='/public/images/mjbrown_logo-70x66.png' alt='Logo' /> <span className='title'>Chat</span> </div> </header> <main className='flex flex-row flex-1 clear'> <aside className='sidebar col col-3 flex flex-column flex-space-between'> <header className='flex flex-row flex-center'> <h4 className='font-300 text-center'> <span className='font-600 online-count' aria-labelledby={id('users')} data-testid={id('users')} > {chatState.users.length} </span>{' '} <label id={id('users')}>users</label> </h4> </header> <ul className='flex flex-column flex-1 list-unstyled user-list'> {chatState.users.map((user, idx) => ( <li key={user._id} aria-labelledby={id('user', idx.toString())} data-testid={id('users', idx.toString())} > <a className='block relative' href='#'> <img src={user.avatar} alt={user.email} className='avatar' /> <span className='absolute username'> <label id={id('user', idx.toString())}>{user.email}</label> </span> </a> </li> ))} </ul> <footer className='flex flex-row flex-center'> <a href='#' onClick={() => logout()} className='button button-primary' aria-labelledby={id('signout')} data-testid={id('signout')} > <label id={id('signout')}>Sign Out</label> </a> </footer> </aside> <div className='flex flex-column col col-9'> <main className='chatElem flex flex-column flex-1 clear' ref={elem => setChatElem(elem)} > {chatState.messages.map((message, idx) => ( <div key={message._id} className='message flex flex-row' aria-labelledby={id('message', idx.toString())} data-testid={id('signout', idx.toString())} > <div className='message-wrapper'> <p className='chat-message-header'> <span className='chat-message-username font-600'> {message.user.email} </span> <span>&nbsp;</span> <span className='chat-message-date font-300'> <label id={id('signout', idx.toString())}> {datetime(message.createdAt).format('MMM DD, hh:mm:ss')} </label> </span> </p> <p className='message-content font-300'>{message.text}</p> </div> </div> ))} </main> <form onSubmit={ev => sendMessage(ev)} className='flex flex-row flex-space-between' aria-labelledby={id('send-message')} data-testid={id('send-message')} id='send-message' > <input type='text' name='text' className='flex flex-1' /> <button className='button-primary' type='submit'> <label id={id('send-message')}>Send</label> </button> </form> </div> </main> </div> ); }
25.223404
77
0.585969
true
false
false
true
d008e8b13a6400c4de973d3f6de4801e64911592
2,186
jsx
JSX
src/components/FileList/FileList.jsx
ceeaspb/flamescope
8f0f64ebbba91c74c42f837519843d11b4ae066c
[ "Apache-2.0" ]
1
2018-04-12T15:34:32.000Z
2018-04-12T15:34:32.000Z
src/components/FileList/FileList.jsx
ceeaspb/flamescope
8f0f64ebbba91c74c42f837519843d11b4ae066c
[ "Apache-2.0" ]
null
null
null
src/components/FileList/FileList.jsx
ceeaspb/flamescope
8f0f64ebbba91c74c42f837519843d11b4ae066c
[ "Apache-2.0" ]
null
null
null
/** * * Copyright 2018 Netflix, 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, { Component } from 'react' import { Segment, Dimmer, Loader, List } from 'semantic-ui-react' const styles = { container: { top: '75px', }, listItem: { fontWeight: 400, color: '#000', } } export default class FileList extends Component { constructor(props) { super(props); this.state = { files: [], loading: false, }; } componentDidMount() { this.setState({loading: true}) fetch('/stack/list') .then(res => { return res.json() }) .then(data => { this.setState({files: data, loading: false}) }) } render() { return ( <Segment style={styles.container}> <Dimmer page inverted active={this.state.loading}> <Loader size='massive' inverted>Loading</Loader> </Dimmer> <List> {this.state.files.sort().map(function(filename) { const path = encodeURIComponent(filename); return ( <List.Item style={styles.listItem} as='a' href={`/#/heatmap/${path}`} key={filename}> <List.Icon name='file' /> <List.Content>{filename}</List.Content> </List.Item> ) })} </List> </Segment> ) } }
29.540541
113
0.506404
false
true
true
false
d008f468f5f2930b3cedf18cf8109e85def3f203
16,014
jsx
JSX
app/components/document/Grids.jsx
thiriet/actionview-fe
bb8df0a6fb432e42f32fb252c6943f8c93f41b9d
[ "Apache-2.0" ]
null
null
null
app/components/document/Grids.jsx
thiriet/actionview-fe
bb8df0a6fb432e42f32fb252c6943f8c93f41b9d
[ "Apache-2.0" ]
null
null
null
app/components/document/Grids.jsx
thiriet/actionview-fe
bb8df0a6fb432e42f32fb252c6943f8c93f41b9d
[ "Apache-2.0" ]
null
null
null
import React, { PropTypes, Component } from 'react'; import { Link } from 'react-router'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; import { FormGroup, FormControl, Button, DropdownButton, MenuItem } from 'react-bootstrap'; import DropzoneComponent from 'react-dropzone-component'; import Lightbox from 'react-image-lightbox'; import _ from 'lodash'; import { notify } from 'react-notify-toast'; import { getFileIconCss } from '../share/Funcs'; const $ = require('$'); const moment = require('moment'); const DelNotify = require('./DelNotify'); const CopyModal = require('./CopyModal'); const MoveModal = require('./MoveModal'); const EditCard = require('./EditCard'); const img = require('../../assets/images/loading.gif'); const { API_BASENAME } = process.env; export default class Grids extends Component { constructor(props) { super(props); this.state = { copyModalShow: false, moveModalShow: false, delNotifyShow: false, operateShow: false, photoIndex: 0, imgPreviewShow: false, currentId: '', editRowId: '' }; this.delNotifyClose = this.delNotifyClose.bind(this); this.uploadSuccess = this.uploadSuccess.bind(this); this.cancelEditCard = this.cancelEditCard.bind(this); this.downloadAll = this.downloadAll.bind(this); this.favorite = this.favorite.bind(this); } static propTypes = { i18n: PropTypes.object.isRequired, user: PropTypes.object.isRequired, project_key: PropTypes.string.isRequired, directory: PropTypes.string.isRequired, options: PropTypes.object, collection: PropTypes.array.isRequired, selectedItem: PropTypes.object.isRequired, query: PropTypes.object.isRequired, loading: PropTypes.bool.isRequired, itemLoading: PropTypes.bool.isRequired, indexLoading: PropTypes.bool.isRequired, index: PropTypes.func.isRequired, select: PropTypes.func.isRequired, addFile: PropTypes.func.isRequired, createFolderShow: PropTypes.bool.isRequired, cancelCreateFolder: PropTypes.func.isRequired, createFolder: PropTypes.func.isRequired, favorite: PropTypes.func.isRequired, update: PropTypes.func.isRequired, copy: PropTypes.func.isRequired, move: PropTypes.func.isRequired, del: PropTypes.func.isRequired } cancelEditCard() { const { cancelCreateFolder } = this.props; cancelCreateFolder(); this.setState({ editRowId: '' }); } delNotifyClose() { this.setState({ delNotifyShow: false }); } edit(id) { this.setState({ editModalShow: true }); const { select } = this.props; select(id); } async favorite() { const { favorite, selectedItem } = this.props; const ecode = await favorite(selectedItem.id, !selectedItem.favorited); if (ecode === 0) { if (selectedItem.favorited) { notify.show('已收藏。', 'success', 2000); } else { notify.show('已取消收藏。', 'success', 2000); } } else { if (selectedItem.favorited) { notify.show('收藏失败。', 'error', 2000); } else { notify.show('取消失败。', 'error', 2000); } } } async clickFavorite(e) { e.stopPropagation(); const { currentId } = this.state; const { select } = this.props; await select(currentId); this.favorite(); } async operateSelect(eventKey, e) { e.stopPropagation(); const { currentId } = this.state; const { select, project_key } = this.props; await select(currentId); if (eventKey === 'rename') { this.setState({ editRowId: currentId }); } else if (eventKey === 'copy') { this.setState({ copyModalShow: true }); } else if (eventKey === 'move') { this.setState({ moveModalShow: true }); } else if (eventKey === 'del') { this.setState({ delNotifyShow: true }); } else if (eventKey === 'download') { const url = API_BASENAME + '/project/' + project_key + '/document/' + currentId + '/download'; window.open(url, '_blank'); } else if (eventKey === 'favorite') { this.favorite(); } } downloadAll() { const { project_key, directory } = this.props; const url = API_BASENAME + '/project/' + project_key + '/document/' + directory + '/download'; window.open(url, '_blank'); } uploadSuccess(localfile, res) { const { addFile } = this.props; if (res.ecode === 0 && res.data) { addFile(res.data); } else { notify.show('文档上传失败。', 'error', 2000); } } getFileSize(bytes) { const K = 1024; const M = 1024 * 1024; const G = 1024 * 1024 * 1024; if (bytes < K/10) { return bytes + 'B'; } else if (bytes < M/10) { return _.ceil(bytes/K, 1) + 'K'; } else if (bytes < G/10) { return _.ceil(bytes/M, 1) + 'M'; } else { return _.ceil(bytes/G, 1) + 'G'; } } clickFile(imgFiles, id) { const { project_key, collection } = this.props; const photoIndex = _.findIndex(imgFiles, { id }); if (photoIndex === -1) { const file = _.find(collection, { id }); const url = API_BASENAME + '/project/' + project_key + '/document/' + id + '/download' + (file && file.type == 'application/pdf' ? ('/' + file.name) : ''); window.open(url, '_blank'); } else { this.setState({ photoIndex, imgPreviewShow: true }); } } render() { const { i18n, user, project_key, directory, collection, selectedItem, loading, indexLoading, itemLoading, createFolderShow, createFolder, del, update, copy, move, options, query } = this.props; const { editRowId, currentId, operateShow, photoIndex, imgPreviewShow } = this.state; const componentConfig = { showFiletypeIcon: true, postUrl: API_BASENAME + '/project/' + project_key + '/document/' + (directory ? (directory + '/') : '') + 'upload' }; const djsConfig = { addRemoveLinks: true }; const eventHandlers = { init: dz => this.dropzone = dz, success: (localfile, response) => { this.uploadSuccess(localfile, response); this.dropzone.removeFile(localfile); }, error: (localfile) => { notify.show('文档上传失败。', 'error', 2000); this.dropzone.removeFile(localfile); } } const directories = _.filter(collection, { d: 1 }); const files = _.reject(collection, { d: 1 }); const imgFiles = _.filter(files, (f) => _.indexOf([ 'image/jpeg', 'image/jpg', 'image/png', 'image/gif' ], f.type) !== -1); return ( <div style={ { clear: 'both' } }> <div className='files-grid-view'> { indexLoading && <div style={ { display: 'block', padding: '30px 0px', textAlign: 'center' } }> <img src={ img } className='loading'/> </div> } <div className='grid-view-container'> { !indexLoading && options.path && options.path.length > 1 && _.isEmpty(query) && <div className='grid-view-item'> <div className='file-content'> <Link to={ '/project/' + project_key + '/document' + (options.path[options.path.length - 2].id !== '0' ? ('/' + options.path[options.path.length - 2].id ) : '') } style={ { textDecoration: 'none' } }> <div className='file-thumb'> <div style={ { fontSize: '80px', color: '#FFD300', marginBottom: '30px' } }>..</div> </div> <div className='file-title-container'> <div className='file-title'>返回上级</div> </div> </Link> </div> </div> } { createFolderShow && <EditCard i18n={ i18n } loading={ itemLoading } data={ {} } createFolder={ createFolder } collection={ collection } cancel={ this.cancelEditCard } mode='createFolder'/> } { _.map(directories, (v) => this.state.editRowId == v.id ? <EditCard i18n={ i18n } loading={ itemLoading } data={ selectedItem } collection={ collection } edit={ update } cancel={ this.cancelEditCard } mode='editFolder' /> : <div className='grid-view-item' title={ v.name } onMouseOver={ () => { this.setState({ currentId: v.id }) } } onMouseLeave={ () => { this.setState({ currentId: '' }) } }> <div className='file-content'> { this.state.currentId == v.id && <div className='operate-icon'> <DropdownButton bsStyle='link' style={ { textDecoration: 'blink', color: '#999' } } key={ v.id } title=<i className='fa fa-cog'></i> onClick={ this.cancelEditCard } onSelect={ this.operateSelect.bind(this) } > <MenuItem eventKey='download'>下载</MenuItem> <MenuItem eventKey='favorite'>{ v.favorited ? '取消收藏' : '收藏' }</MenuItem> { options.permissions && options.permissions.indexOf('manage_project') !== -1 && <MenuItem eventKey='rename'>重命名</MenuItem> } { options.permissions && options.permissions.indexOf('manage_project') !== -1 && <MenuItem eventKey='move'>移动</MenuItem> } { options.permissions && options.permissions.indexOf('manage_project') !== -1 && <MenuItem eventKey='del'>删除</MenuItem> } </DropdownButton> </div> } { v.favorited && <div className='favorite-icon'> <span onClick={ this.clickFavorite.bind(this) }><i className='fa fa-star'></i></span> </div> } <Link to={ '/project/' + project_key + '/document/' + v.id }> <div className='file-thumb'> <span style={ { fontSize: '80px', color: '#FFD300' } }><i className='fa fa-folder'></i></span> </div> <div className='file-title-container'> <div className='file-title'>{ v.name }</div> </div> </Link> </div> </div>) } { _.map(files, (v) => this.state.editRowId == v.id ? <EditCard i18n={ i18n } loading={ itemLoading } data={ selectedItem } collection={ collection } edit={ update } cancel={ this.cancelEditCard } mode='editFile' imgsrc={ v.thumbnails_index ? API_BASENAME + '/project/' + project_key + '/document/' + v.id + '/downloadthumbnails' : '' } fileIconCss={ getFileIconCss(v.name) }/> : <div className='grid-view-item' title={ v.name } onMouseOver={ () => { this.setState({ currentId: v.id }) } } onMouseLeave={ () => { this.setState({ currentId: '' }) } }> <div className='file-content' onClick={ this.clickFile.bind(this, imgFiles, v.id) }> { this.state.currentId == v.id && <div className='operate-icon'> <DropdownButton bsStyle='link' style={ { textDecoration: 'blink', color: '#999' } } key={ v.id } title=<i className='fa fa-cog'></i> onClick={ (e) => { e.stopPropagation(); this.cancelEditCard(); } } onSelect={ this.operateSelect.bind(this) } > <MenuItem eventKey='download'>下载</MenuItem> <MenuItem eventKey='favorite'>{ v.favorited ? '取消收藏' : '收藏' }</MenuItem> { options.permissions && (options.permissions.indexOf('manage_project') !== -1 || v.uploader.id == user.id) && <MenuItem eventKey='rename'>重命名</MenuItem> } { options.permissions && (options.permissions.indexOf('manage_project') !== -1 || v.uploader.id == user.id) && <MenuItem eventKey='move'>移动</MenuItem> } { options.permissions && (options.permissions.indexOf('manage_project') !== -1 || v.uploader.id == user.id) && <MenuItem eventKey='del'>删除</MenuItem> } </DropdownButton> </div> } { v.favorited && <div className='favorite-icon'> <span onClick={ this.clickFavorite.bind(this) }><i className='fa fa-star'></i></span> </div> } <div className='file-thumb'> { v.thumbnails_index ? <img src={ API_BASENAME + '/project/' + project_key + '/document/' + v.id + '/downloadthumbnails' }/> : <span style={ { fontSize: '80px', color: '#aaa' } }> <i className={ getFileIconCss(v.name) }></i> </span> } </div> <div className='file-title-container'> <div className='file-title'>{ v.name }</div> </div> </div> </div>) } </div> </div> { imgPreviewShow && <Lightbox mainSrc={ API_BASENAME + '/project/' + project_key + '/document/' + imgFiles[photoIndex].id + '/download' } nextSrc={ API_BASENAME + '/project/' + project_key + '/document/' + imgFiles[(photoIndex + 1) % imgFiles.length].id + '/download' } prevSrc={ API_BASENAME + '/project/' + project_key + '/document/' + imgFiles[(photoIndex + imgFiles.length - 1) % imgFiles.length].id + '/download' } imageTitle={ imgFiles[photoIndex].name } imageCaption={ imgFiles[photoIndex].uploader.name + ' 上传于 ' + moment.unix(imgFiles[photoIndex].uploaded_at).format('YYYY/MM/DD HH:mm') } onCloseRequest={ () => { this.setState({ imgPreviewShow: false }) } } onMovePrevRequest={ () => this.setState({ photoIndex: (photoIndex + imgFiles.length - 1) % imgFiles.length }) } onMoveNextRequest={ () => this.setState({ photoIndex: (photoIndex + 1) % imgFiles.length }) } /> } <div style={ { marginTop: '15px' } }> <DropzoneComponent style={ { height: '200px' } } config={ componentConfig } eventHandlers={ eventHandlers } djsConfig={ djsConfig } /> </div> <div style={ { marginLeft: '5px', marginTop: '15px', marginBottom: '20px' } }> { !indexLoading && collection.length > 0 && <span>共计 文件夹 { _.filter(collection, { d: 1 }).length } 个,文件 { _.reject(collection, { d: 1 }).length } 个。</span> } { collection.length > 1 && _.isEmpty(query) && options.path.length > 1 && <span style={ { marginLeft: '10px' } }> <i className='fa fa-download'></i> <a href='#' onClick={ (e) => { e.preventDefault(); this.downloadAll(); } }>下载全部</a> </span> } </div> { this.state.copyModalShow && <CopyModal show project_key={ project_key } close={ () => { this.setState({ copyModalShow: false }); } } copy={ copy } data={ selectedItem } i18n={ i18n }/> } { this.state.moveModalShow && <MoveModal show project_key={ project_key } close={ () => { this.setState({ moveModalShow: false }); } } move={ move } data={ selectedItem } i18n={ i18n }/> } { this.state.delNotifyShow && <DelNotify show close={ this.delNotifyClose } data={ selectedItem } del={ del } i18n={ i18n }/> } </div> ); } }
40.541772
216
0.537217
false
true
true
false
d00902649e80506bab0ab9001bf96a6c81b381b3
2,795
jsx
JSX
frontend/blockcontainer/src/components/Login.jsx
garbusa/automated-crypto-web-app-news-and-portfolio-manager
8332d2668d28795ce4a498febbe004cfecfb2011
[ "MIT" ]
null
null
null
frontend/blockcontainer/src/components/Login.jsx
garbusa/automated-crypto-web-app-news-and-portfolio-manager
8332d2668d28795ce4a498febbe004cfecfb2011
[ "MIT" ]
12
2020-06-05T19:35:40.000Z
2022-03-08T22:34:57.000Z
frontend/blockcontainer/src/components/Login.jsx
garbusa/automated-crypto-web-app-news-and-portfolio-manager
8332d2668d28795ce4a498febbe004cfecfb2011
[ "MIT" ]
null
null
null
import React, {Component} from "react"; import {connect} from "react-redux"; import {Link, Redirect} from "react-router-dom"; import {auth} from "../actions"; import Header from './Header' import fav from '../fav.png'; import Footer from './Footer' class Login extends Component { state = { username: "", password: "", } onSubmit = e => { e.preventDefault(); this.props.login(this.state.username, this.state.password); } render() { if (this.props.isAuthenticated) { return <Redirect to="/" /> } return ( <div> <Header/> <div className="container"> <div className="row"> <div className="col-md-5 mx-auto mt-5 mb-5 loginbox"> <form onSubmit={this.onSubmit}> <fieldset> <img src={fav} alt=""/> <span className="overview">Log In</span> {this.props.errors.length > 0 && ( <ul> {this.props.errors.map(error => ( <li className="errormessage" key={error.field}>{error.message}</li> ))} </ul> )} <p> <input type="text" id="username" className="width-100" onChange={e => this.setState({username: e.target.value})} placeholder="Enter Username..."/> </p> <p> <input type="password" id="password" className="width-100" onChange={e => this.setState({password: e.target.value})} placeholder="Enter Password..."/> </p> <p> <button className="blue-btn blue-btn-100" type="submit">Login</button> </p> <p> Don't have an account? <Link to="/register">Register</Link> </p> </fieldset> </form> </div> </div> </div> <Footer/> </div> ) } } const mapStateToProps = state => { let errors = []; if (state.auth.errors) { errors = Object.keys(state.auth.errors).map(field => { return {field, message: state.auth.errors[field]}; }); } return { errors, isAuthenticated: state.auth.isAuthenticated }; } const mapDispatchToProps = dispatch => { return { login: (username, password) => { return dispatch(auth.login(username, password)); } }; } export default connect(mapStateToProps, mapDispatchToProps)(Login);
30.380435
120
0.460465
false
true
true
false
d00902e0c763d3aca673cd3177d9cc3f431d2571
3,401
jsx
JSX
src/sections/Orders/index.jsx
opinewdev/opinew-shogun-frontend
a14daa61e63449f0e98fd836e701f5d0b76fa3dd
[ "Unlicense" ]
null
null
null
src/sections/Orders/index.jsx
opinewdev/opinew-shogun-frontend
a14daa61e63449f0e98fd836e701f5d0b76fa3dd
[ "Unlicense" ]
null
null
null
src/sections/Orders/index.jsx
opinewdev/opinew-shogun-frontend
a14daa61e63449f0e98fd836e701f5d0b76fa3dd
[ "Unlicense" ]
null
null
null
/** * * MIT License * * Copyright 2021 Shogun, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import * as React from 'react' import { useCustomer } from 'frontend-customer' import Container from 'Components/Container' import { useRouter } from 'frontend-router' import Heading from 'Components/Heading' import AuthGuard from 'Components/AuthGuard' import Breadcrumb from 'Components/Breadcrumb' import AccountOrderDetails from 'Components/AccountOrderDetails' import AccountOrderHistory from 'Components/AccountOrderHistory' import { useNormalizedCustomer } from 'Components/Hooks' import { ACCOUNT_URL, ACCOUNT_LOGIN_URL, ACCOUNT_ORDERS_URL } from 'Components/Data' /** * @typedef { import("frontend-customer/dist/customer-sdk/platforms/shopify/storefront-api/types/api").Order } Order * @typedef { import("frontend-customer/dist/customer-sdk/platforms/big_commerce/rest/types/sdk").BigCommerceSdkOrder } BigCommerceSdkOrder */ const AccountOrders = () => { const router = useRouter() /** @type { { "order-id"?: string } } */ const { 'order-id': orderId } = router.query const [customerState, { getAllOrders }] = useCustomer() const { isLoggedIn, orders } = useNormalizedCustomer(customerState) const order = React.useMemo( () => (orders && orderId ? orders.find(order => order.id === orderId) : undefined), [orders, orderId], ) const breadcrumbItems = React.useMemo(() => { /** @type {import("Components/Breadcrumb").BreadcrumbItem[]} */ const items = [ { label: 'Account', url: ACCOUNT_URL }, { label: 'Orders', url: ACCOUNT_ORDERS_URL, isCurrentPage: order === undefined }, ] if (order) { items.push({ label: order.name, url: '', isCurrentPage: true }) } return items }, [order]) React.useEffect(() => { if (isLoggedIn && !orders) { getAllOrders() } }, [isLoggedIn, orders, getAllOrders]) return ( <Container as="section" variant="section-wrapper"> <Breadcrumb mb={6} items={breadcrumbItems} /> <Heading as="h1" mb={16}> {order ? 'Order details' : 'Orders'} </Heading> <AuthGuard allowedAuthStatus="authenticated" redirectUrl={ACCOUNT_LOGIN_URL}> {order ? <AccountOrderDetails order={order} /> : <AccountOrderHistory orders={orders} />} </AuthGuard> </Container> ) } export default AccountOrders
36.967391
139
0.709497
false
true
false
true
d0090fbbdfb0b5be6e023e65d13f0fa6f769af40
1,787
jsx
JSX
src/pages/contact-us.jsx
wildpow/ESC
4c1ea64dde5d1a223baa2a3cd912a01e0923a3a1
[ "MIT" ]
null
null
null
src/pages/contact-us.jsx
wildpow/ESC
4c1ea64dde5d1a223baa2a3cd912a01e0923a3a1
[ "MIT" ]
50
2019-01-24T19:36:00.000Z
2021-02-11T21:30:04.000Z
src/pages/contact-us.jsx
wildpow/esc
4c1ea64dde5d1a223baa2a3cd912a01e0923a3a1
[ "MIT" ]
null
null
null
import { graphql } from "gatsby"; import { HelmetDatoCms } from "gatsby-source-datocms"; import PropTypes from "prop-types"; import { GatsbyImage, getImage } from "gatsby-plugin-image"; import Layout from "../components/Layout"; import ContactUsForm from "../components/Contact-Us/ContactUsForm"; import ContactInfo from "../components/Contact-Us/ContactInfo"; import { Content, ContactUsRoot, } from "../components/Contact-Us/contactUs.styled"; const ContactUs = ({ data }) => { const { panda, seo } = data; return ( <Layout> <HelmetDatoCms seo={seo.seoMetaTags} /> <ContactUsRoot> <GatsbyImage image={getImage(panda.childImageSharp)} /> <Content> <h2>Contact Us</h2> <p> Thank you for visiting ESC Mattress Center, Snohomish County&apos;s favorite mattress store. We strive to be the best mattress store we can be and are always here to help. Feel free to contact us in person at the store during normal business hours, by phone, or through the form below. Sleep well! </p> <ContactInfo /> <h3 className="message">How can We help?</h3> <ContactUsForm /> </Content> </ContactUsRoot> </Layout> ); }; export const contactUsQuery = graphql` query { panda: file(relativePath: { eq: "ContactUsHeader.jpg" }) { childImageSharp { gatsbyImageData( formats: [JPG, WEBP, AVIF] layout: CONSTRAINED width: 1536 ) } } seo: datoCmsSeo(name: { eq: "contact us" }) { seoMetaTags { ...GatsbyDatoCmsSeoMetaTags } } } `; ContactUs.propTypes = { data: PropTypes.instanceOf(Object).isRequired, }; export default ContactUs;
28.822581
79
0.621153
false
true
false
true
d00915ef06b6dd526ac2477118df135a174f150e
471
jsx
JSX
src/MessageBoard.jsx
vicjicaman/tracker-app-ui
88ab993853a13568ac4f5003ffa5442066572757
[ "MIT" ]
null
null
null
src/MessageBoard.jsx
vicjicaman/tracker-app-ui
88ab993853a13568ac4f5003ffa5442066572757
[ "MIT" ]
null
null
null
src/MessageBoard.jsx
vicjicaman/tracker-app-ui
88ab993853a13568ac4f5003ffa5442066572757
[ "MIT" ]
null
null
null
import React from 'react'; import _ from 'lodash' import {InfoIcon} from './InfoIcon'; import {AlertIcon} from './AlertIcon'; export const MessageBoard = ({type, messages}) => { if (messages.length === 0) { return null; } let icon = <InfoIcon/>; if (type === "warning") { icon = <AlertIcon/>; } return (<div className={"alert alert-" + type} role="alert"> {_.map(messages, m => (<span className="d-block">{icon}{' '}{m}</span>))} </div>); }
22.428571
77
0.592357
false
true
false
true
d00919a22868e2ef91b40e4713f532447a90bc1c
699
jsx
JSX
client/src/components/Newsletter.jsx
srishakthidhara/craftsmen
ee65d9f98cb5aeb83445687b7c9b173c904cfd8d
[ "MIT" ]
2
2022-01-29T02:47:14.000Z
2022-02-10T03:45:52.000Z
client/src/components/Newsletter.jsx
srishakthidhara/craftsmen
ee65d9f98cb5aeb83445687b7c9b173c904cfd8d
[ "MIT" ]
10
2022-01-14T05:39:40.000Z
2022-03-18T07:51:17.000Z
client/src/components/Newsletter.jsx
srishakthidhara/craftsmen
ee65d9f98cb5aeb83445687b7c9b173c904cfd8d
[ "MIT" ]
10
2022-01-14T03:30:14.000Z
2022-02-21T13:56:44.000Z
import React from 'react'; import { Send } from '@material-ui/icons'; const Newsletter = () => { return ( <div id='newsletter' className='d-flex justify-content-center align-items-center mt-5 p-5 newsletter'> <div className='text-center'> <h1>Newsletter</h1> <p>get timely updates from your favourite products</p> <div className='input-group'> <input type="text" className="form-control shadow-none" /> <button style={{backgroundColor:'teal'}} className='btn btn-primary px-3'><Send/></button> </div> </div> </div> ) } export default Newsletter
34.95
110
0.559371
false
true
false
true
d0091b0005feeb599efd3a82730c970930ba45d3
10,334
jsx
JSX
src/lib/Quiz.jsx
jasonverber/react-quizmaster
ecad557916fcf60b73f9e519fe9a84ce3e2e61bc
[ "MIT" ]
null
null
null
src/lib/Quiz.jsx
jasonverber/react-quizmaster
ecad557916fcf60b73f9e519fe9a84ce3e2e61bc
[ "MIT" ]
null
null
null
src/lib/Quiz.jsx
jasonverber/react-quizmaster
ecad557916fcf60b73f9e519fe9a84ce3e2e61bc
[ "MIT" ]
null
null
null
import React, { Component } from "react"; const QuizAnswer = props => { const handleClick = () => { props.handleClick(props.index, props.question); } const className = () => { let name = props.className+'Answer '; if (props.selected) name+= props.className+'Selected '; if (props.classes) name+= props.className+props.classes.join(' '+props.className)+' '; return name; } return ( <li onClick={handleClick} className={className()}>{props.text}</li> ) }; class Quiz extends Component { constructor(props) { super(props); let {questions, questionsPerPage, currentPage, inProgress, startCallback, finishCallback, score, penalty, autoEval, endEval, hideEndEval, className, header, footer, beginButton, evaluateButton, continueButton, finishButton, startMessage, finishMessage, pageLabel, scoreLabel, overallScoreLabel, evalHandler, outcomeHandler, ...userProps} = this.props; this.state = { questions: this.prepareQuestions(questions), questionsPerPage: questionsPerPage === 'all' ? questions.length : (questionsPerPage || 1), currentPage: currentPage!==undefined ? currentPage : -1, inProgress: currentPage!==undefined && currentPage>-1 ? true : (inProgress || false), startCallback, finishCallback, score: score!==undefined ? score : 0, penalty: penalty || 0, autoEval: autoEval || false, endEval: endEval!==undefined ? endEval : true, hideEndEval: hideEndEval || false, className: className || 'QuizMaster', userProps: userProps, header, footer, beginButton: beginButton || 'Begin', evaluateButton: evaluateButton || 'Evaluate', continueButton: continueButton || 'Continue', finishButton: finishButton || 'Finish', startMessage: startMessage || 'Click to begin!', finishMessage: finishMessage || 'Quiz complete!', pageLabel : pageLabel || 'Page: ', scoreLabel : scoreLabel || 'Score: ', overallScoreLabel: overallScoreLabel || 'Overall Score: ', evalHandler, outcomeHandler } } componentDidMount = () => { this.setDisplayedQuestions(); } prepareQuestions = (questions) => { questions = questions.map(question=>{ question.answers=question.answers.map(answer=>typeof answer === 'object' ? answer : {text:answer}); return question; }); return questions; }; startQuiz = () => { this.setPage(0); this.state.startCallback ? this.state.startCallback() : null; }; finishQuiz = () => { let {endEval} = this.state; this.setState({inProgress:false, currentPage:-2, finished:true}, endEval ? this.evaluate(-1) : null ); this.state.finishCallback ? this.state.finishCallback() : null; }; setPage = (newPage) => { let {currentPage} = this.state; currentPage = newPage; this.setState({currentPage, inProgress:currentPage>-1}, this.setDisplayedQuestions); } nextPage = () => { let {currentPage} = this.state; this.setPage(currentPage+1); } handleAnswerClick = (aIndex, qIndex) => { let {questions, multiSelect, autoEval} = this.state; if (questions[qIndex].submitted) return; questions[qIndex].answers = questions[qIndex].answers.map((answer, i)=>{ multiSelect = questions[qIndex].multiSelect!==undefined ? questions[qIndex].multiSelect : multiSelect; answer.selected = i===aIndex ? !answer.selected : (multiSelect?answer.selected:false); return answer; }); this.setState({questions}, autoEval ? this.evaluate(qIndex) : null); }; evaluate = (index) => { let {questions, score, penalty, multiSelect, evalHandler} = this.state; questions = questions.map(evalHandler?evalHandler:(question, i) => { let displayed = index>-1 ? question.displayed : true; let indexed = typeof index !== 'number' || index === -1 || i === index; if (!displayed || question.submitted || !indexed) return question; question.attempts = question.attempts ? question.attempts-1 : 0; let selected = question.answers.filter(answer=>answer.selected); let correct = question.answers.filter(answer=>answer.correct); multiSelect = question.multiSelect!==undefined ? question.multiSelect : multiSelect; if (multiSelect!=='all' && selected.find(answer=>answer.correct)) question.correct = true; if (multiSelect==='all' && selected.every(answer=>answer.correct) && correct.every(answer=>answer.selected)) question.correct = true; if (question.attempts===0 || question.correct === true) question.submitted = true; if (question.correct) { question.pointsEarned = selected.reduce((a,b)=>b.correct&&b.points?a+b.points:a,0) || question.possiblePoints || 1; score += question.pointsEarned; } else { if (penalty) score -= penalty; } if (question.submitted) question.answers.map(answer=>{ answer.classes = answer.classes || []; answer.classes.push(answer.correct ? (answer.selected?'CorrectAnswer':'MissingAnswer') : (answer.selected?'IncorrectAnswer':'')) return answer; }); return question; }); this.setState({questions, score}); }; setDisplayedQuestions = () => { let {questions, questionsPerPage, currentPage} = this.state; let start = currentPage * questionsPerPage; let end = start+questionsPerPage>questions.length ? start+questions.length%questionsPerPage : start+questionsPerPage; questions = questions.map((question, i)=>{ question.displayed = (i>=start && i<end); return question; }); this.setState({questions}); }; renderQuizQuestions = () => { let {questions, currentPage, questionsPerPage, autoEval, endEval, finished, className, evaluateButton, continueButton, finishButton} = this.state; let totalQuestions = questions.length; let unsubmitted = questions.filter(question=>question.displayed && !question.submitted).length; let unanswered = questions.filter(question=>question.displayed && question.answers.filter(answer=>answer.selected).length===0).length; let finishedPage = questions.every(question=>question.submitted); questions = questions.filter(question=>question.displayed).map((question, i)=>( <div className={className+'Question'+(finished?' '+className+(question.correct?'Correct':'Incorrect'):'')} key={i}> <span>{question.prompt}</span> <ul> {question.answers.map((answer, j)=>( <QuizAnswer key={j} index={j} question={questionsPerPage*currentPage+i} text={answer.text} selected={answer.selected} submitted={question.submitted} className={className} classes={answer.classes} handleClick={this.handleAnswerClick} /> ))} </ul> </div> )); if (!finished && unsubmitted>0 && !autoEval && !endEval) questions.push(<div key='evalButton'><button disabled={unanswered>0} onClick={this.evaluate}>{evaluateButton}</button></div>); if (!finishedPage && (unsubmitted===0 || (endEval && (currentPage+1)*questionsPerPage<totalQuestions))) questions.push(<div key='continueButton'><button disabled={unanswered>0} onClick={this.nextPage}>{continueButton}</button></div>); if (!finished && (finishedPage || (endEval && (currentPage+1)*questionsPerPage>=totalQuestions))) questions.push(<div key='finishButton'><button disabled={unanswered>0} onClick={this.finishQuiz}>{finishButton}</button></div>); return questions; }; renderQuizPage = () => { return this.renderQuizQuestions(); }; renderQuizStart = () => { let {startMessage, beginButton} = this.state; return ( <> <p><span>{startMessage}</span></p> <p><button onClick={this.startQuiz}>{beginButton}</button></p> </> ); } renderQuizFinish = () => { let {finishMessage, score, questions, endEval, hideEndEval, className, outcomeHandler, overallScoreLabel} = this.state; questions = questions.map(question=>{question.displayed=true; return question}); return ( <> <p><span>{finishMessage}</span></p> {endEval && !hideEndEval?( <div className={className+'EndEval'}> {this.renderQuizQuestions()} </div> ):('')} {outcomeHandler ? outcomeHandler(questions) : ''} {score!==false?( <p>{overallScoreLabel}{score}</p> ):('')} </> ); } renderQuizBody = () => { let {finished, inProgress, currentPage} = this.state; if (finished) return this.renderQuizFinish(); if (!inProgress || currentPage===-1) return this.renderQuizStart(); if (currentPage>-1) return this.renderQuizPage(); }; renderQuizHeader = () => { let {score, questions, currentPage, inProgress, finished, pageLabel} = this.state; if (this.props.header) return this.renderUserString(typeof this.props.header === 'function' ? this.props.header(this.state) : this.props.header); return ( <span>{inProgress&&!finished?pageLabel+(currentPage+1):''}</span> ) }; renderQuizFooter = () => { let {score, questions, inProgress, finished, scoreLabel} = this.state; if (this.props.footer) return this.renderUserString(typeof this.props.footer === 'function' ? this.props.footer(this.state) : this.props.footer); return ( <span>{inProgress&&!finished?scoreLabel+score:''}</span> ) }; renderUserString = (string) => { if (typeof string !== 'string') { string = React.cloneElement(string, {children:this.renderUserString(string.props.children)}); return string; } let vars = Object.assign({},this.state); vars.currentPage = vars.currentPage+1; vars.totalQuestions = vars.questions.length; string = string.replace(/\[\[/g,"{").replace(/\]\]/g,"}"); return string.replace(/\{(\w+)\}/g,(_,k)=>vars[k]!==undefined?vars[k]:vars.userProps[k]||''); } render = () => { let {className, userProps, currentPage} = this.state; return ( <div className={className} {...userProps}> <div className={className+'Header'}> {this.renderQuizHeader()} </div> <div className={className+'Body'}> {this.renderQuizBody()} </div> <div className={className+'Footer'}> {this.renderQuizFooter()} </div> </div> ); } } export default Quiz;
41.502008
355
0.651539
false
true
true
false
d0091dd2879f5b0bdf60d056932a87265b4b1ee5
285
jsx
JSX
src/routes/index.jsx
VadymSemchenko/test
d6a5c7e57493fcdaa5af9b4331487d41a08dd15c
[ "MIT" ]
null
null
null
src/routes/index.jsx
VadymSemchenko/test
d6a5c7e57493fcdaa5af9b4331487d41a08dd15c
[ "MIT" ]
null
null
null
src/routes/index.jsx
VadymSemchenko/test
d6a5c7e57493fcdaa5af9b4331487d41a08dd15c
[ "MIT" ]
null
null
null
import Dashboard from '../layouts/Dashboard/Dashboard' import Ecosystems from '../layouts/Ecosystems/Ecosystems' const indexRoutes = [ { path: '/ecosystems', name: 'Ecosystem', component: Dashboard }, { path: '/', name: 'Home', component: Ecosystems } ] export default indexRoutes
28.5
66
0.726316
true
false
false
true
d00928f7cd571f9fbece339426e0dc2a35b16aa1
1,020
jsx
JSX
src/components/Contact.jsx
antokara/antokara.me
9b8befa99c93ad6b74d43bbcde91ec75add239db
[ "MIT" ]
1
2017-11-23T02:55:15.000Z
2017-11-23T02:55:15.000Z
src/components/Contact.jsx
antokara/antokara.me
9b8befa99c93ad6b74d43bbcde91ec75add239db
[ "MIT" ]
1
2017-10-31T03:03:27.000Z
2017-10-31T03:03:27.000Z
src/components/Contact.jsx
antokara/antokara.me
9b8befa99c93ad6b74d43bbcde91ec75add239db
[ "MIT" ]
1
2017-10-31T03:00:05.000Z
2017-10-31T03:00:05.000Z
import React from 'react'; import PropTypes from 'prop-types'; import IconLink from './IconLink'; import style from './Contact.pcss'; class Contact extends React.Component { constructor(props) { super(props); props.getContact(); } render() { const icons = this.props.icons.map(icon => ( <div key={icon.alt}><IconLink {...icon} /></div> )); return ( <div className={style.contact}> <div className={style.icons}> {icons} </div> <div className={style.text}> {this.props.text[0]}<br /> {this.props.text[1]}, {this.props.text[2]} </div> </div> ); } } Contact.propTypes = { getContact: PropTypes.func.isRequired, text: PropTypes.arrayOf(PropTypes.string), icons: PropTypes.arrayOf(PropTypes.shape({ url: PropTypes.string, alt: PropTypes.string, assetUrl: PropTypes.string, internal: PropTypes.bool, })), }; Contact.defaultProps = { text: [], icons: [], }; export default Contact;
21.25
54
0.604902
false
true
true
false
d009563cb2b564e3391c62d37feeaf447a671dbe
2,026
jsx
JSX
Frontend/src/components/header/header.jsx
sinacek/nasi-politici
712b6ead3e2c410ab947551a6f76b63654a4ae52
[ "MIT" ]
null
null
null
Frontend/src/components/header/header.jsx
sinacek/nasi-politici
712b6ead3e2c410ab947551a6f76b63654a4ae52
[ "MIT" ]
null
null
null
Frontend/src/components/header/header.jsx
sinacek/nasi-politici
712b6ead3e2c410ab947551a6f76b63654a4ae52
[ "MIT" ]
null
null
null
import React, {useState} from 'react' import {Link} from 'react-router-dom' import {useRouteMatch} from 'react-router-dom' import classnames from 'classnames' import SearchBar from '../searchBar/searchBar' import {ReactComponent as Search} from '../../assets/images/searchIcon.svg'; import styles from './header.module.scss' function Header() { const [openMenu, setOpenMenu] = useState(false) const [openSearch, setOpenSearch] = useState(false) const match = useRouteMatch('/') const matchDetail = useRouteMatch('/detail/:id') const showMobileSearch = () => { setOpenMenu(false) setOpenSearch(true) } return ( <header className={classnames(matchDetail && styles.detailHeader, styles.header)}> <div className={classnames(openSearch && styles.mobileSearch, styles.wrapper)}> <div className={styles.navigation}> {!match.isExact && <Link to='/' className={styles.logoLink}> <div className={styles.logo}/> </Link>} {matchDetail && <React.Fragment> <div className={styles.searchActions}> <div onClick={() => setOpenSearch(false)} className={styles.cancel}>Zrušit</div> <SearchBar form={styles.form} wrapperClassname={styles.headerSearchBar}/> <div onClick={showMobileSearch} className={styles.searchIconWrapper}> <Search className={styles.searchIcon} /> </div> </div> <div onClick={() => setOpenMenu(!openMenu)} className={styles.hamburger}>Menu</div> </React.Fragment>} <div className={classnames(styles.links, openMenu && styles.openMenu)}> <Link to='/o-projektu' className={styles.link}>O Projektu</Link> <Link to='/pro-media' className={styles.link}>Pro Média</Link> </div> </div> {!match.isExact && <SearchBar form={styles.form} wrapperClassname={styles.headerSearchBar}/>} </div> </header> ) } export default Header;
39.72549
101
0.631293
false
true
false
true
d0095737dcbccf443d03be91945ef37b0038aef3
7,985
jsx
JSX
ui/component/walletSend/view.jsx
DeepDoge/odysee-frontend
d100f6ed737554c750f985a0ba04ca45e4f94148
[ "MIT" ]
1
2021-11-23T19:55:42.000Z
2021-11-23T19:55:42.000Z
ui/component/walletSend/view.jsx
DeepDoge/odysee-frontend
d100f6ed737554c750f985a0ba04ca45e4f94148
[ "MIT" ]
null
null
null
ui/component/walletSend/view.jsx
DeepDoge/odysee-frontend
d100f6ed737554c750f985a0ba04ca45e4f94148
[ "MIT" ]
null
null
null
// @flow import * as MODALS from 'constants/modal_types'; import React from 'react'; import Button from 'component/button'; import { Form, FormField } from 'component/common/form'; import { Formik } from 'formik'; import validateSendTx from 'util/form-validation'; import Card from 'component/common/card'; import I18nMessage from 'component/i18nMessage'; import LbcSymbol from 'component/common/lbc-symbol'; import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp'; import classnames from 'classnames'; import ChannelSelector from 'component/channelSelector'; import ClaimPreview from 'component/claimPreview'; type Props = { openModal: (id: string, { destination: string, amount: string, isAddress: boolean }) => void, draftTransaction: { address: string, amount: string }, setDraftTransaction: ({ address: string, amount: string }) => void, balance: number, isAddress: boolean, setIsAddress: (boolean) => void, contentUri: string, contentError: string, contentClaim?: StreamClaim, setEnteredContentUri: (string) => void, confirmed: boolean, setConfirmed: (boolean) => void, sendLabel: string, setSendLabel: (string) => void, snack: ?{ linkTarget: ?string, linkText: ?string, message: string, isError: boolean, }, }; class WalletSend extends React.PureComponent<Props> { constructor() { super(); (this: any).handleSubmit = this.handleSubmit.bind(this); (this: any).handleClear = this.handleClear.bind(this); } handleSubmit() { const { draftTransaction, openModal, isAddress, contentUri, setConfirmed } = this.props; const destination = isAddress ? draftTransaction.address : contentUri; const amount = draftTransaction.amount; const modalProps = { destination, amount, isAddress, setConfirmed }; openModal(MODALS.CONFIRM_TRANSACTION, modalProps); } handleClear() { const { setDraftTransaction, setConfirmed } = this.props; setDraftTransaction({ address: '', amount: '', }); setConfirmed(false); } render() { const { draftTransaction, setDraftTransaction, balance, isAddress, setIsAddress, contentUri, contentClaim, setEnteredContentUri, contentError, confirmed, sendLabel, setSendLabel, snack, } = this.props; if (confirmed) { this.handleClear(); setSendLabel('Sending...'); } if (snack) setSendLabel('Send'); return ( <Card title={__('Send Credits')} subtitle={ <I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Send Credits to your friends or favorite creators.</I18nMessage> } actions={ <Formik initialValues={{ address: '', amount: '', }} onSubmit={this.handleSubmit} render={({ values, errors, touched, handleBlur, handleSubmit }) => ( <div> <div className="section"> <Button key="Address" label={__('Address')} button="alt" onClick={() => setIsAddress(true)} className={classnames('button-toggle', { 'button-toggle--active': isAddress })} /> <Button key="Search" label={__('Search')} button="alt" onClick={() => setIsAddress(false)} className={classnames('button-toggle', { 'button-toggle--active': !isAddress })} /> </div> <div className="section"> {!isAddress && <ChannelSelector />} <Form onSubmit={handleSubmit}> {!isAddress && ( <FormField type="text" name="search" error={contentError} placeholder={__('Enter a name, @username or URL')} className="form-field--address" label={__('Recipient search')} onChange={(event) => setEnteredContentUri(event.target.value)} onBlur={handleBlur} value={values.search} /> )} {!isAddress && ( <fieldset-section> <ClaimPreview key={contentUri} uri={contentUri} actions={''} type={'small'} showNullPlaceholder hideMenu hideRepostLabel /> </fieldset-section> )} <fieldset-group class="fieldset-group--smushed"> <FormField autoFocus type="number" name="amount" label={__('Amount')} className="form-field--price-amount" affixClass="form-field--fix-no-height" min="0" step="any" placeholder="12.34" onChange={(event) => setDraftTransaction({ address: draftTransaction.address, amount: event.target.value }) } onBlur={handleBlur} value={draftTransaction.amount} /> {isAddress && ( <FormField type="text" name="address" placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'} className="form-field--address" label={__('Recipient address')} onChange={(event) => setDraftTransaction({ address: event.target.value, amount: draftTransaction.amount }) } onBlur={handleBlur} value={draftTransaction.address} /> )} </fieldset-group> <div className="card__actions"> <Button button="primary" type="submit" label={__(sendLabel)} disabled={ !(parseFloat(draftTransaction.amount) > 0.0) || parseFloat(draftTransaction.amount) >= balance || sendLabel === 'Sending...' || (isAddress ? !draftTransaction.address || validateSendTx(draftTransaction.address).address !== '' : !contentClaim) } /> {!!Object.keys(errors).length || ( <span className="error__text"> {(!!draftTransaction.address && touched.address && errors.address) || (!!draftTransaction.amount && touched.amount && errors.amount) || (parseFloat(draftTransaction.amount) === balance && __('Decrease amount to account for transaction fee')) || (parseFloat(draftTransaction.amount) > balance && __('Not enough Credits'))} </span> )} </div> <WalletSpendableBalanceHelp /> </Form> </div> </div> )} /> } /> ); } } export default WalletSend;
35.968468
119
0.475266
false
true
false
true
d0099933152e964d4741d7fb0172d9b9d8fb0636
4,667
jsx
JSX
imports/ui/components/User/UserProfileForm.jsx
fangjj/ComfyCafe
a65426fd8c594691267c7cb2f3e59fb80f136450
[ "MIT" ]
null
null
null
imports/ui/components/User/UserProfileForm.jsx
fangjj/ComfyCafe
a65426fd8c594691267c7cb2f3e59fb80f136450
[ "MIT" ]
null
null
null
imports/ui/components/User/UserProfileForm.jsx
fangjj/ComfyCafe
a65426fd8c594691267c7cb2f3e59fb80f136450
[ "MIT" ]
null
null
null
import _ from "lodash"; import React from "react"; import "/imports/api/users/methods"; import { initialStateBuilder, dataBuilder } from "/imports/ui/utils/forms"; import reasonBuilder from "/imports/ui/utils/reasonBuilder"; import Powerless from "/imports/ui/components/Powerless"; import Form from "/imports/ui/components/Form"; import TextField from "/imports/ui/components/TextField"; import TextArea from "/imports/ui/components/TextArea"; import MultiField from "/imports/ui/components/MultiField"; import SafetySelector from "/imports/ui/components/SafetySelector"; import BirthdaySelector from "/imports/ui/components/BirthdaySelector"; import LoadingSpinner from "/imports/ui/components/Spinner/LoadingSpinner"; import ReportFormGuts from "/imports/ui/components/Report/ReportFormGuts"; import Snackbar from "/imports/ui/components/Snackbar"; import DangerButton from "/imports/ui/components/Button/DangerButton"; const defaultState = { displayName: "", blurb: "", bio: "", birthday: { month: 1, day: 1 }, avatarSafety: 0, info: {}, infoOrder: [] }; export default React.createClass({ contextTypes: { currentUser: React.PropTypes.object }, getInitialState() { const state = initialStateBuilder(this.props.user.profile, defaultState); if (this.props.mod) { state.violation = "spam"; state.details = ""; } state.snackbarOpen = false; return state; }, handleSnackbarRequestClose() { this.setState({ snackbarOpen: false }); }, handleViolation(e, index, value) { this.setState({ violation: value }); }, handleDetails(e) { this.setState({ details: e.target.value }); }, handleDisplayName(e) { this.setState({ displayName: e.target.value }); }, handleBlurb(e) { this.setState({ blurb: e.target.value }); }, handleBio(e) { this.setState({ bio: e.target.value }); }, handleBirthday(month, day) { this.setState({ birthday: { month, day } }); }, handleAvararSafety(value) { this.setState({ avatarSafety: value }); }, handleInfo(info, order) { this.setState({ info: info, infoOrder: order }); }, handleSubmit(e) { const data = dataBuilder(this.state, defaultState); if (this.props.mod) { const reason = reasonBuilder(this.state); Meteor.call("modUpdateProfile", this.props.user._id, data, reason, (err) => { if (err) { prettyPrint(err); } else { this.setState({ snackbarOpen: true }); } }); } else { Meteor.call("updateProfile", data); } }, handleModDeleteAvatar() { const reason = reasonBuilder(this.state); Meteor.call("modDeleteAvatar", this.props.user._id, reason, (err) => { if (err) { prettyPrint(err); } else { this.setState({ snackbarOpen: true }); } }); }, renderReportForm() { if (this.props.mod) { return <ReportFormGuts violation={this.state.violation} handleViolation={this.handleViolation} details={this.state.details} handleDetails={this.handleDetails} />; } }, render() { return <Form id={this.props.id} actions={this.props.actions} left={this.props.mod && <DangerButton label="Delete Avatar" iconName="delete" subtle={true} onClick={this.handleModDeleteAvatar} />} onSubmit={this.handleSubmit} onClose={this.props.onClose} > {this.renderReportForm()} <TextField defaultValue={this.state.displayName} label="Display Name" onChange={this.handleDisplayName} /> <TextField defaultValue={this.state.blurb} label="Sassy Catchphrase" onChange={this.handleBlurb} /> <TextArea defaultValue={this.state.bio} label="Who the hell are you?" rows={2} onChange={this.handleBio} /> <BirthdaySelector month={this.state.birthday.month} day={this.state.birthday.day} onChange={this.handleBirthday} /> <SafetySelector label="Avatar Safety" value={this.state.avatarSafety} onChange={this.handleAvararSafety} /> <br /> <MultiField label="Random Information" defaultValue={this.state.info} defaultOrder={this.state.infoOrder} defaultQty={1} onChange={this.handleInfo} /> <Snackbar unexist={! this.props.mod} open={this.state.snackbarOpen} message="User updated successfully." onRequestClose={this.handleSnackbarRequestClose} /> </Form>; } });
27.452941
83
0.630598
false
true
false
true
d009a1b3d4ddf401e213870f9d743c6c24b703c0
2,620
jsx
JSX
src/app/modules/HRMS/Tasks/components/Search/index.jsx
munaweralimy/HRMS
b632088e17d013ebee422ac178af3705d1ac0e59
[ "MIT" ]
null
null
null
src/app/modules/HRMS/Tasks/components/Search/index.jsx
munaweralimy/HRMS
b632088e17d013ebee422ac178af3705d1ac0e59
[ "MIT" ]
null
null
null
src/app/modules/HRMS/Tasks/components/Search/index.jsx
munaweralimy/HRMS
b632088e17d013ebee422ac178af3705d1ac0e59
[ "MIT" ]
1
2021-10-03T16:39:39.000Z
2021-10-03T16:39:39.000Z
import React from 'react'; import {Button, Form, Space, Typography } from 'antd'; import { DateField, InputField, SelectField } from '../../../../../atoms/FormElement'; import { useForm } from 'react-hook-form'; const { Title } = Typography; export default (props) => { const { control, handleSubmit } = useForm() const onSubmit = (val) => { props.onSearch(val); } return ( <Space size={15} direction='vertical' className='w-100'> <Title level={5} className='c-gray mb-0'>Filter list:</Title> <Form onFinish={handleSubmit(onSubmit)} layout="inline" className='w-100 inline-form'> <InputField fieldname='id' class='mb-0 w-100' label='' control={control} iProps={{ placeholder: 'ID', size: 'large'}} initValue='' /> <InputField fieldname='name' class='mb-0 w-100' label='' control={control} iProps={{ placeholder: 'Staff Name', size: 'large'}} initValue='' /> <DateField fieldname='date' class='mb-0 w-100' label='' control={control} iProps={{ placeholder: 'Date', size: 'large'}} initValue='' /> <SelectField fieldname='project' label='' class='mb-0 w-100' initValue={props?.field1?.length > 0 ? props.field1[0] : ''} control={control} iProps={{ placeholder: 'Project'}} selectOption={props?.field1} /> <SelectField fieldname='company' label='' class='mb-0 w-100' initValue={props?.field2?.length > 0 ? props.field2[0] : ''} control={control} iProps={{ placeholder: 'Company'}} selectOption={props?.field2} /> <SelectField fieldname='team' label='' class='mb-0 w-100' initValue={props?.field3?.length > 0 ? props.field3[0] : ''} control={control} iProps={{ placeholder: 'Company'}} selectOption={props?.field3} /> <Button size='large' type='primary' htmlType='submit'>Search</Button> </Form> </Space> ) }
34.933333
98
0.447328
false
true
false
true
d009abf5cd301f1252b57452ec29c4773d8ff3ad
813
jsx
JSX
packages/yoga/src/Card/native/GymCard/CheckIn/Avatar.jsx
anku-11-11/yoga
426b985d03a8e1cd91830238b0f7c3e947cad050
[ "MIT" ]
null
null
null
packages/yoga/src/Card/native/GymCard/CheckIn/Avatar.jsx
anku-11-11/yoga
426b985d03a8e1cd91830238b0f7c3e947cad050
[ "MIT" ]
null
null
null
packages/yoga/src/Card/native/GymCard/CheckIn/Avatar.jsx
anku-11-11/yoga
426b985d03a8e1cd91830238b0f7c3e947cad050
[ "MIT" ]
null
null
null
import styled from 'styled-components'; const Avatar = styled.Image` width: 48px; height: 48px; ${({ theme: { yoga: { components: { card: { gym: { checkIn }, }, }, }, }, }) => ` border-radius: ${checkIn.avatar.border.radius}px; `} `; Avatar.displayName = 'Avatar'; const Placeholder = styled.View` ${({ theme: { yoga: { colors: { gray }, components: { card: { gym: { checkIn }, }, }, }, }, }) => ` width: 48px; height: 48px; align-items: center; justify-content: center; border: ${checkIn.avatar.border.width}px solid ${gray[3]}; border-radius: ${checkIn.avatar.border.radius}px; `} `; export { Avatar, Placeholder };
16.591837
62
0.487085
false
true
false
true
d009bda29e8460495706e8374bb905b0b8cfffca
3,011
jsx
JSX
monitoring-dashboard/components/org.wso2.micro.integrator.dashboard.web/src/resource-pages/SequenceListPage.jsx
malakaganga/product-mi-tooling
4a6d358c7dc862cfde9f398500bb5242e2780231
[ "Apache-2.0" ]
null
null
null
monitoring-dashboard/components/org.wso2.micro.integrator.dashboard.web/src/resource-pages/SequenceListPage.jsx
malakaganga/product-mi-tooling
4a6d358c7dc862cfde9f398500bb5242e2780231
[ "Apache-2.0" ]
null
null
null
monitoring-dashboard/components/org.wso2.micro.integrator.dashboard.web/src/resource-pages/SequenceListPage.jsx
malakaganga/product-mi-tooling
4a6d358c7dc862cfde9f398500bb5242e2780231
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import React, {Component} from 'react'; import ListViewParent from '../common/ListViewParent'; import ResourceAPI from '../utils/apis/ResourceAPI'; import Link from '@material-ui/core/Link'; import MUIDataTable from "mui-datatables"; export default class SequenceListPage extends Component { constructor(props) { super(props); this.sequences = null; this.state = { data: [], error: null }; } /** * Retrieve sequences from the MI. */ componentDidMount() { this.retrieveSequences(); } retrieveSequences() { const data = []; new ResourceAPI().getResourceList(`/sequences`).then((response) => { this.sequences = response.data.list || []; this.sequences.forEach((element) => { const rowData = []; rowData.push(element.name); rowData.push(element.tracing); rowData.push(element.stats); data.push(rowData); }); this.setState({data: data}); }).catch((error) => { this.setState({error:error}); }); } renderResourceList() { const columns = [{ name: "Sequence", options: { sortDirection: 'asc', customBodyRender: (value, tableMeta, updateValue) => { return ( <Link component="button" variant="body2" onClick={() => { this.props.history.push(`/sequence/explore?name=${tableMeta.rowData[0]}`) }}> {tableMeta.rowData[0]} </Link> ); } } }, "Tracing", "Statistics"]; const options = { selectableRows: 'none', print: false, download: false, }; return ( <MUIDataTable title={"SEQUENCES"} data={this.state.data} columns={columns} options={options} /> ); } render() { return ( <ListViewParent data={this.renderResourceList()} error={this.state.error} /> ); } }
28.140187
101
0.52275
false
true
true
false