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
sequence
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
sequence
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
sequence
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
d009cb15ccac1cf91f10c3cedd1e392e31df9b44
3,704
jsx
JSX
src/variables/styles/iconButtonStyle.jsx
johnvincentio/repo-material-ui-dashboard-1
aa73a7384ff4312181ea826755d232db4cd5dd13
[ "OML", "RSA-MD" ]
null
null
null
src/variables/styles/iconButtonStyle.jsx
johnvincentio/repo-material-ui-dashboard-1
aa73a7384ff4312181ea826755d232db4cd5dd13
[ "OML", "RSA-MD" ]
null
null
null
src/variables/styles/iconButtonStyle.jsx
johnvincentio/repo-material-ui-dashboard-1
aa73a7384ff4312181ea826755d232db4cd5dd13
[ "OML", "RSA-MD" ]
null
null
null
// ############################## // // // IconButton styles // ############################# import { grayColor, roseColor, primaryColor, infoColor, successColor, warningColor, dangerColor } from '../../variables/styles'; const iconButtonStyle = { button: { height: '40px', minWidth: '40px', width: '40px', borderRadius: '50%', fontSize: '24px', margin: 'auto', padding: '0', boxShadow: '0 2px 2px 0 rgba(153, 153, 153, 0.14), 0 3px 1px -2px rgba(153, 153, 153, 0.2), 0 1px 5px 0 rgba(153, 153, 153, 0.12)', overflow: 'hidden', position: 'relative', lineHeight: 'normal', border: 'none', fontWeight: '400', textTransform: 'uppercase', letterSpacing: '0', willChange: 'box-shadow, transform', transition: 'box-shadow 0.2s cubic-bezier(0.4, 0, 1, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1)', display: 'inline-block', textAlign: 'center', whiteSpace: 'nowrap', verticalAlign: 'middle', touchAction: 'manipulation', cursor: 'pointer', userSelect: 'none', backgroundImage: 'none', backgroundColor: grayColor, '&:hover': { backgroundColor: grayColor, boxShadow: '0 14px 26px -12px rgba(153, 153, 153, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(153, 153, 153, 0.2)' } }, primary: { backgroundColor: primaryColor, boxShadow: '0 2px 2px 0 rgba(156, 39, 176, 0.14), 0 3px 1px -2px rgba(156, 39, 176, 0.2), 0 1px 5px 0 rgba(156, 39, 176, 0.12)', '&:hover': { backgroundColor: primaryColor, boxShadow: '0 14px 26px -12px rgba(156, 39, 176, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(156, 39, 176, 0.2)' } }, info: { backgroundColor: infoColor, boxShadow: '0 2px 2px 0 rgba(0, 188, 212, 0.14), 0 3px 1px -2px rgba(0, 188, 212, 0.2), 0 1px 5px 0 rgba(0, 188, 212, 0.12)', '&:hover': { backgroundColor: infoColor, boxShadow: '0 14px 26px -12px rgba(0, 188, 212, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 188, 212, 0.2)' } }, success: { backgroundColor: successColor, boxShadow: '0 2px 2px 0 rgba(76, 175, 80, 0.14), 0 3px 1px -2px rgba(76, 175, 80, 0.2), 0 1px 5px 0 rgba(76, 175, 80, 0.12)', '&:hover': { backgroundColor: successColor, boxShadow: '0 14px 26px -12px rgba(76, 175, 80, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(76, 175, 80, 0.2)' } }, warning: { backgroundColor: warningColor, boxShadow: '0 2px 2px 0 rgba(255, 152, 0, 0.14), 0 3px 1px -2px rgba(255, 152, 0, 0.2), 0 1px 5px 0 rgba(255, 152, 0, 0.12)', '&:hover': { backgroundColor: warningColor, boxShadow: '0 14px 26px -12px rgba(255, 152, 0, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(255, 152, 0, 0.2)' } }, danger: { backgroundColor: dangerColor, boxShadow: '0 2px 2px 0 rgba(244, 67, 54, 0.14), 0 3px 1px -2px rgba(244, 67, 54, 0.2), 0 1px 5px 0 rgba(244, 67, 54, 0.12)', '&:hover': { backgroundColor: dangerColor, boxShadow: '0 14px 26px -12px rgba(244, 67, 54, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(244, 67, 54, 0.2)' } }, rose: { backgroundColor: roseColor, boxShadow: '0 2px 2px 0 rgba(233, 30, 99, 0.14), 0 3px 1px -2px rgba(233, 30, 99, 0.2), 0 1px 5px 0 rgba(233, 30, 99, 0.12)', '&:hover': { backgroundColor: roseColor, boxShadow: '0 14px 26px -12px rgba(233, 30, 99, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(233, 30, 99, 0.2)' } }, white: { '&,&:focus,&:hover': { backgroundColor: '#FFFFFF', color: grayColor } }, simple: { color: '#FFFFFF', background: 'transparent', boxShadow: 'none' } }; export default iconButtonStyle;
29.632
127
0.602052
true
false
false
true
d009cb5b8280a83fdb4b24d5120a2d0411577932
976
jsx
JSX
src/components/home/Post.jsx
madeusblack/servermuni
50563f6f59e35a462cd179474eae0ade5a38c91e
[ "MIT" ]
null
null
null
src/components/home/Post.jsx
madeusblack/servermuni
50563f6f59e35a462cd179474eae0ade5a38c91e
[ "MIT" ]
null
null
null
src/components/home/Post.jsx
madeusblack/servermuni
50563f6f59e35a462cd179474eae0ade5a38c91e
[ "MIT" ]
null
null
null
/* eslint-disable react/no-danger */ import React from 'react'; import axios from 'axios'; import '../../assets/styles/Post.scss'; /*This component is used to display content of the single post*/ class Post extends React.Component { constructor(props) { super(props); this.state = { title: '', content: '', }; } componentDidMount = async () => { const { match } = this.props; await axios.get( `https://municipalidadnogales.000webhostapp.com/wp-json/wp/v2/posts/${match.params.id}`, ).then((post) => { this.setState({ title: post.data.title.rendered, content: post.data.content.rendered, }); }).catch((error) => { console.log(error); }); } render() { const { title, content } = this.state; return ( <div className='postContainer'> <h1>{title}</h1> <div dangerouslySetInnerHTML={{ __html: content }} /> </div> ); } } export default Post;
23.238095
94
0.588115
false
true
true
false
d009cd22d48a616ef81f63f7e69b09c5b8a8426d
2,643
jsx
JSX
src/components/main/templates/play/components/renderRunner/index.jsx
JoseMayconHS/Run-React
959d0e9a6edd206c2541f5887f27e69c02c78b6e
[ "MIT" ]
2
2019-08-09T00:49:42.000Z
2019-08-10T18:34:57.000Z
src/components/main/templates/play/components/renderRunner/index.jsx
Maycon-PE/Run-React
959d0e9a6edd206c2541f5887f27e69c02c78b6e
[ "MIT" ]
3
2020-09-06T08:57:29.000Z
2021-10-06T00:02:09.000Z
src/components/main/templates/play/components/renderRunner/index.jsx
JoseMayconHS/Run-React
959d0e9a6edd206c2541f5887f27e69c02c78b6e
[ "MIT" ]
null
null
null
import React from 'react' import start from './script/engine/index.js' import './css/index.css' import Table from './components/table' import P from './components/p' import Span from './components/spanSom' function renderTables(participants) { const tables = [] for (let t = 0; t < participants.length; t++) { tables.push(<Table key={t} data={participants[t]} index={t} />) } return tables } function renderP(p) { const ps = [] for (let i = 0; i < p; i++) { ps[i] = <P key={i} id={i} tot={p} /> } return ps } function renderSpanSom(s) { const sons = [] for (let ss = 0; ss < s; ss++) { sons[ss] = <Span key={ss} id={ss} /> } return sons } function setDistance(e) { if (document.getElementById('distancia-valor') === null) { return 2 } else { return document.getElementById('distancia-valor').value } } function run(e, data, distance, started, runStop) { e.preventDefault() const div = document.querySelector('.area-btn-actions') div.style.pointerEvents = 'none' const btn = Array.from(div.childNodes) btn[0].classList.toggle('btn-cancel') const time = !started? 3000: 200 setTimeout(() => div.style.pointerEvents = 'painted', time) start(data, distance, runStop) } export default ({ participants, btn, runStop, closeModal }) => <div className='area-runner scroll'> <input id='engineRuns' type='hidden' value={participants.length} /> <div className='display-none'> <span id='som-corrida'></span> {renderSpanSom(participants.length)} </div> <div id='lideres-table' className="lideres"> <div className='titulo-lideranca'> <span className='display-time'>00:00:00</span> <span className='span-liderea'>Lideres</span> <span id='distancia'>indefinida</span> </div> <div className='liderancas' id="placar"> {renderP(participants.length)} </div> </div> <div className='area-btn-exit'> <input type='button' className='btn-second' value='Voltar' onClick={closeModal} /> </div> <div className='area-tables-runner'> {renderTables(participants)} </div> <form onSubmit={e => runStop() && run(e, participants, setDistance(), btn, runStop)}> <div className='area-interacoes'> <div className='area-input-distancia'> Defina a distância: <input id='distancia-valor' type='number' min='2' max='30' required onChange={setDistance} /> km </div> <div className='area-btn-actions'> <input className='btn-primary' type='submit' value={!btn? 'Começar': 'Parar'} /> </div> </div> </form> </div>
27.821053
127
0.626561
false
true
false
true
d009dfad6d0a388d8c6ead93cfa1c9f3654f67c3
3,174
jsx
JSX
src/components/compra/components/IntroCard/IntroCard.jsx
paularrea/earlyKolyerLanding
dbfc7f5809ec6d66c600b054b504da0cf487cdbe
[ "RSA-MD" ]
null
null
null
src/components/compra/components/IntroCard/IntroCard.jsx
paularrea/earlyKolyerLanding
dbfc7f5809ec6d66c600b054b504da0cf487cdbe
[ "RSA-MD" ]
null
null
null
src/components/compra/components/IntroCard/IntroCard.jsx
paularrea/earlyKolyerLanding
dbfc7f5809ec6d66c600b054b504da0cf487cdbe
[ "RSA-MD" ]
null
null
null
import React, { useState } from "react"; import IntroInfo from "../../../LandingComponents/Collar/components/introInfo/IntroInfo"; import ImgIntroCard from "./ImgIntroCard"; import Button from "../Button"; import { container, img, flex, info_container, text, abs, btn_container, interrogant, only_kolyer_btn, } from "./introCard.module.scss"; import { Link } from "react-scroll"; import SubscriptionModal from "./components/SubscriptionModal"; import MediaQuery from "react-responsive"; import SubscriptionPlan from "../Modals/SubscriptionPlan"; const IntroCard = () => { const [openSubscription, setOpenSubscription] = useState(false); const openSubscriptionModal = () => { setOpenSubscription(!openSubscription); }; return ( <div className={container}> {openSubscription && ( <div> <SubscriptionPlan openModal={openSubscriptionModal} /> </div> )} <div className={img}> <ImgIntroCard /> </div> <div className={abs}> <button data-sal="fade" data-sal-delay="100" data-sal-duration="1000" className={only_kolyer_btn} onClick={openSubscriptionModal} > <b>Sólo Early kolyers</b> </button> <div data-sal="slide-up" data-sal-delay="100" data-sal-duration="1000" className={info_container} > <div style={{cursor:'pointer'}} onClick={openSubscriptionModal}> <h4> Collar kolyy + plan de suscripción <span className={interrogant}>?</span> </h4> </div> <SubscriptionModal /> <section className={flex}> <div> <h3> €147 <span>€210</span> </h3> <p>IVA incl.</p> </div> <div> <h3> €3,99 <span>€7,99</span> </h3> <p>/mes*</p> </div> </section> <div className={text}> <p>IMPORTANTE: </p> <p> *El pago de la suscripción se realizará a través de la app kolyy en el momento de recibir y activar el collar. </p> </div> </div> <div data-sal="fade" data-sal-delay="100" data-sal-duration="1000"> <IntroInfo /> </div> <div className={btn_container}> <MediaQuery maxWidth={870}> <Link activeClass="active" to="buy-collar" spy={true} smooth={true} offset={-100} duration={1000} > <Button>Comprar</Button> </Link> </MediaQuery> <MediaQuery minWidth={870}> <Link activeClass="active" to="buy-collar" spy={true} smooth={true} offset={0} duration={1000} > <Button>Comprar</Button> </Link> </MediaQuery> </div> </div> </div> ); }; export default IntroCard;
27.128205
89
0.50189
false
true
false
true
d009eaf8942130527f1e3d820e9fc60c9dbf9a68
417
jsx
JSX
packages/dx-react-grid-demos/src/theme-sources/bootstrap4/demo-container.jsx
Krijovnick/devextreme-reactive
a8686e49b76db88a086ab9378e08276bac30b8ba
[ "Apache-2.0" ]
1,955
2017-05-16T12:16:27.000Z
2022-03-27T17:29:41.000Z
packages/dx-react-grid-demos/src/theme-sources/bootstrap4/demo-container.jsx
Krijovnick/devextreme-reactive
a8686e49b76db88a086ab9378e08276bac30b8ba
[ "Apache-2.0" ]
1,812
2017-05-17T07:33:28.000Z
2022-03-24T00:11:06.000Z
packages/dx-react-grid-demos/src/theme-sources/bootstrap4/demo-container.jsx
Krijovnick/devextreme-reactive
a8686e49b76db88a086ab9378e08276bac30b8ba
[ "Apache-2.0" ]
395
2017-05-16T11:01:00.000Z
2022-03-15T05:47:50.000Z
import * as React from 'react'; import * as PropTypes from 'prop-types'; import '@devexpress/dx-react-grid-bootstrap4/dist/dx-react-grid-bootstrap4.css'; import '@devexpress/dx-react-chart-bootstrap4/dist/dx-react-chart-bootstrap4.css'; const DemoContainer = ({ children }) => ( <div> {children} </div> ); DemoContainer.propTypes = { children: PropTypes.node.isRequired, }; export default DemoContainer;
24.529412
82
0.726619
false
true
false
true
d009f8ce55803b16c5f195c533d3baf3383799ef
6,123
jsx
JSX
src/sentry/static/sentry/app/views/organizationIncidents/details/header.jsx
Dhivyanshup/sentry
b1436dcac10d7b5b396e845ed61ac5436b3e6ee7
[ "BSD-3-Clause" ]
2
2019-03-04T12:45:54.000Z
2019-03-04T12:45:55.000Z
src/sentry/static/sentry/app/views/organizationIncidents/details/header.jsx
Dhivyanshup/sentry
b1436dcac10d7b5b396e845ed61ac5436b3e6ee7
[ "BSD-3-Clause" ]
null
null
null
src/sentry/static/sentry/app/views/organizationIncidents/details/header.jsx
Dhivyanshup/sentry
b1436dcac10d7b5b396e845ed61ac5436b3e6ee7
[ "BSD-3-Clause" ]
null
null
null
import {Link} from 'react-router'; import PropTypes from 'prop-types'; import React from 'react'; import moment from 'moment'; import styled from 'react-emotion'; import {PageHeader} from 'app/styles/organization'; import {t} from 'app/locale'; import Access from 'app/components/acl/access'; import Count from 'app/components/count'; import DropdownControl from 'app/components/dropdownControl'; import InlineSvg from 'app/components/inlineSvg'; import LoadingError from 'app/components/loadingError'; import MenuItem from 'app/components/menuItem'; import PageHeading from 'app/components/pageHeading'; import SentryTypes from 'app/sentryTypes'; import SubscribeButton from 'app/components/subscribeButton'; import space from 'app/styles/space'; import {isOpen} from '../utils'; import Status from '../status'; export default class DetailsHeader extends React.Component { static propTypes = { incident: SentryTypes.Incident, params: PropTypes.object.isRequired, hasIncidentDetailsError: PropTypes.bool.isRequired, onSubscriptionChange: PropTypes.func.isRequired, onStatusChange: PropTypes.func.isRequired, }; renderStatus() { const {incident, onStatusChange} = this.props; const isIncidentOpen = incident && isOpen(incident); return ( <Access access={['org:write']} renderNoAccessMessage={() => (incident ? <Status incident={incident} /> : null)} > <DropdownControl data-test-id="status-dropdown" label={incident && <Status incident={incident} />} menuWidth="160px" alignRight buttonProps={!incident ? {disabled: true} : null} > <StyledMenuItem onSelect={onStatusChange}> {isIncidentOpen ? t('Close this incident') : t('Reopen this incident')} </StyledMenuItem> </DropdownControl> </Access> ); } render() { const {hasIncidentDetailsError, incident, params, onSubscriptionChange} = this.props; const isIncidentReady = !!incident && !hasIncidentDetailsError; const eventLink = incident && { pathname: `/organizations/${params.orgId}/events/`, // Note we don't have project selector on here so there should be // no query params to forward query: { group: incident.groups, }, }; const dateStarted = incident && moment(incident.dateStarted).format('LL'); return ( <Header> <HeaderItem> <PageHeading> <Breadcrumb> <IncidentsLink to={`/organizations/${params.orgId}/incidents/`}> {t('Incidents')} </IncidentsLink> {dateStarted && ( <React.Fragment> <Chevron src="icon-chevron-right" size={space(2)} /> <IncidentDate>{dateStarted}</IncidentDate> </React.Fragment> )} </Breadcrumb> <IncidentTitle data-test-id="incident-title" loading={!isIncidentReady}> {isIncidentReady ? incident.title : 'Loading'} </IncidentTitle> </PageHeading> </HeaderItem> {hasIncidentDetailsError ? ( <StyledLoadingError /> ) : ( <GroupedHeaderItems> <HeaderItem> <ItemTitle>{t('Status')}</ItemTitle> <ItemValue>{this.renderStatus()}</ItemValue> </HeaderItem> <HeaderItem> <ItemTitle>{t('Event count')}</ItemTitle> {isIncidentReady && ( <ItemValue> <Count value={incident.totalEvents} /> <OpenLink to={eventLink}> <InlineSvg src="icon-open" /> </OpenLink> </ItemValue> )} </HeaderItem> <HeaderItem> <ItemTitle>{t('Users affected')}</ItemTitle> {isIncidentReady && ( <ItemValue> <Count value={incident.uniqueUsers} /> </ItemValue> )} </HeaderItem> <HeaderItem> <ItemTitle>{t('Notifications')}</ItemTitle> <ItemValue> <SubscribeButton disabled={!isIncidentReady} isSubscribed={incident && !!incident.isSubscribed} onClick={onSubscriptionChange} /> </ItemValue> </HeaderItem> </GroupedHeaderItems> )} </Header> ); } } const Header = styled(PageHeader)` background-color: ${p => p.theme.white}; border-bottom: 1px solid ${p => p.theme.borderDark}; margin-bottom: 0; padding: ${space(3)} 0; `; const StyledLoadingError = styled(LoadingError)` flex: 1; &.alert.alert-block { margin: 0 20px; } `; const GroupedHeaderItems = styled('div')` display: flex; text-align: right; `; const HeaderItem = styled('div')` padding: 0 ${space(3)}; `; const ItemTitle = styled('h6')` font-size: ${p => p.theme.fontSizeSmall}; margin-bottom: ${space(1)}; text-transform: uppercase; color: ${p => p.theme.gray2}; letter-spacing: 0.1px; `; const ItemValue = styled('div')` display: flex; justify-content: flex-end; align-items: center; font-size: ${p => p.theme.headerFontSize}; height: 40px; /* This is the height of the Status dropdown */ `; const Breadcrumb = styled('div')` display: flex; align-items: center; margin-bottom: ${space(1)}; `; const IncidentTitle = styled('div')` ${p => p.loading && 'opacity: 0'}; `; const IncidentDate = styled('div')` font-size: 0.8em; color: ${p => p.theme.gray2}; `; const IncidentsLink = styled(Link)` color: inherit; `; const Chevron = styled(InlineSvg)` color: ${p => p.theme.gray1}; margin: 0 ${space(0.5)}; `; const StyledMenuItem = styled(MenuItem)` font-size: ${p => p.theme.fontSizeMedium}; text-align: left; padding: ${space(1)}; `; const OpenLink = styled(Link)` display: flex; font-size: ${p => p.theme.fontSizeLarge}; color: ${p => p.theme.gray2}; margin-left: ${space(1)}; `;
29.018957
89
0.592357
false
true
true
false
d009fd3ade97d1e419d754a90625e4c534443df1
1,532
jsx
JSX
node_modules/bizcharts/src/components/Chart/index.jsx
13020030191/pc
1f003beaaa7dfef753a2302cc91bb470f1df11e7
[ "MIT" ]
2
2021-09-01T08:52:19.000Z
2022-03-13T03:09:02.000Z
src/components/Chart/index.jsx
591094733/BizCharts
5f31e0a096ac5f3ac5a9089507714d0c8e502c00
[ "MIT" ]
null
null
null
src/components/Chart/index.jsx
591094733/BizCharts
5f31e0a096ac5f3ac5a9089507714d0c8e502c00
[ "MIT" ]
null
null
null
/** * Chart Component */ import React from 'react'; import PureChart from './purechart'; import Empty from './empty'; import ErrorBoundary from '../ErrorBoundary'; function hasSource(source) { let flag = true; if (source == null || source.length === 0) { flag = false; } return !!flag; } class Chart extends (React.PureComponent || React.Component) { getG2Instance() { return this.chart; } _refCallback = (c) => { if (c) { this.chart = c.getG2Instance(); } } hasViewSource = () => { let hasViewSource = false; React.Children.map(this.props.children, (child) => { if (!hasViewSource && child && typeof (child.type) === 'function' && child.type.name === 'View' && child.props.data && hasSource(child.props.data)) { hasViewSource = true; } }); return hasViewSource; } render() { const { data, width, height, placeholder, className, style } = this.props; return ( <div className={className} style={style}> { (hasSource(data) || this.hasViewSource() || !placeholder) ? <PureChart ref={this._refCallback} {...this.props} /> : <Empty width={width} height={height} placeholder={placeholder === true ? undefined : placeholder} /> } </div> ); } } export default class BChart extends React.Component { render() { return ( <ErrorBoundary> <Chart {...this.props} /> </ErrorBoundary> ); } }
21.885714
155
0.564621
false
true
true
false
d00a11e0d28e1ada25445c7855ccf0b3261ed747
3,378
jsx
JSX
src/app/SiderMenu.jsx
fidelfly/fxras
6e416222f5f56381d8eca6d6aa32d776e8bc8fc2
[ "MIT" ]
null
null
null
src/app/SiderMenu.jsx
fidelfly/fxras
6e416222f5f56381d8eca6d6aa32d776e8bc8fc2
[ "MIT" ]
null
null
null
src/app/SiderMenu.jsx
fidelfly/fxras
6e416222f5f56381d8eca6d6aa32d776e8bc8fc2
[ "MIT" ]
1
2018-07-20T03:11:07.000Z
2018-07-20T03:11:07.000Z
import { Component } from "react"; import { Menu, Icon } from "antd"; import React from "react"; import PropTypes from "prop-types"; import { Link } from "react-router-dom"; import { SiderMenus } from "../system"; import { MenuMessage } from "../messages"; import { injectIntl } from "react-intl"; import { PathUtil } from "../utils"; class SiderMenu extends Component { constructor(props) { super(props); this.state = this.initStatus(props); } initStatus = (props) => { //const { pathname } = props.location; const pathname = props.path; let state = {}; if (props.collapsed) { state = { openKeys: [], selectedKeys: [pathname], }; } else { let parentPath = PathUtil.getParent(pathname); state = { openKeys: parentPath !== pathname ? [parentPath] : [], selectedKeys: [pathname], }; } return state; }; /* componentWillReceiveProps(newProps) { if (this.props.collapsed !== newProps.collapsed) { this.setState(this.initStatus(newProps)) } }*/ /* menuClick = (e) => { this.setState({ selectedKeys: [e.key] }) } openMenu = (v) => { if (this.props.collapsed) { return } this.setState({ openKeys: [v[v.length - 1]], }); }*/ renderMenuItem = ({ key, title, icon, link, ...props }) => { let { intl } = this.props; return ( <Menu.Item key={key || link} {...props}> <Link to={link || key}> {icon && <Icon type={icon} />} <span>{intl.formatMessage(MenuMessage[title])}</span> </Link> </Menu.Item> ); }; renderSubMenu = ({ key, title, icon, link, sub, ...props }) => { let { intl } = this.props; return ( <Menu.SubMenu key={key || link} title={ <span> {icon && <Icon type={icon} />} <span>{intl.formatMessage(MenuMessage[title])}</span> </span> } {...props}> {sub && sub.map((item) => this.renderMenuItem(item))} </Menu.SubMenu> ); }; render() { return ( <Menu inlineCollapsed={this.props.collapsed} mode={this.props.collapsed ? "vertical" : "inline"} theme={this.props.theme} defaultSelectedKeys={this.state.selectedKeys} defaultOpenKeys={this.state.openKeys}> {SiderMenus && SiderMenus.map((item) => item.sub && item.sub.length ? this.renderSubMenu(item) : this.renderMenuItem(item) )} </Menu> ); } } SiderMenu.propTypes = { onClick: PropTypes.func, menus: PropTypes.array, path: PropTypes.string, }; /*const mapStateToProps = state => { return { theme: state.ui.siderTheme, collapsed: state.ui.collapsed, } }*/ export default injectIntl(SiderMenu); //export default withRouter(connect(mapStateToProps)(injectIntl(SiderMenu)))
28.15
106
0.48431
false
true
true
false
d00a18305c8e14e977b8dfee0ee6ff4f743cce66
1,683
jsx
JSX
frontend/src/components/Result.jsx
abu-dhabi-code/KyselyApp
985fc06a48611d29c610119e782127e6f78ce6a0
[ "MIT" ]
null
null
null
frontend/src/components/Result.jsx
abu-dhabi-code/KyselyApp
985fc06a48611d29c610119e782127e6f78ce6a0
[ "MIT" ]
null
null
null
frontend/src/components/Result.jsx
abu-dhabi-code/KyselyApp
985fc06a48611d29c610119e782127e6f78ce6a0
[ "MIT" ]
null
null
null
import { useState } from "react"; import RadioResult from "./RadioResult"; import MultiselectResult from "./MultiselectResult"; import TextResult from "./TextResult"; /** * * @param {{result: import("../utils/api").Question}} result - the question to display the results of * @returns {JSX.Element} */ function Result({ result }) { const [showResults, setShowResults] = useState(false); const renderByType = () => { switch (result.type) { case "Radio": return <RadioResult answerObjects={result.answers} />; case "Multiselect": return <MultiselectResult answerObjects={result.answers} />; default: return <TextResult result={result} />; } } return ( <div className="bg-sweet-brown m-3 w-full px-1 py-1 rounded shadow-sm flex flex-col items-center" > <div className="w-full px-5 py-3 mt-0 mx-0 bg-teal-blue rounded-t" > <h1 className=""> {result.name} </h1> </div> <div className="bg-dk-byzantium text-center brightness-95 rounded-b w-full pb-2"> <input type="button" className="btn-primary mb-2 mt-6" value={showResults ? "Hide Results" : "Show Results"} onClick={() => setShowResults(!showResults)} /> {showResults && ( <span> {result.answers.length > 0 ? renderByType() : <p className="my-4 text-red-500">No answers</p> } </span> )} </div> </div> ) } export default Result;
26.296875
101
0.534165
false
true
false
true
d00a20e3453f1469357b39496cbb0d2156431a8e
8,255
jsx
JSX
src/pages/List/Lists.jsx
OneEightZeroEight/miya
42fecf855a2bea0f62dd0dcb4f8b79ba979e9aec
[ "Apache-2.0" ]
1
2018-12-23T06:38:59.000Z
2018-12-23T06:38:59.000Z
src/pages/List/Lists.jsx
OneEightZeroEight/miya
42fecf855a2bea0f62dd0dcb4f8b79ba979e9aec
[ "Apache-2.0" ]
null
null
null
src/pages/List/Lists.jsx
OneEightZeroEight/miya
42fecf855a2bea0f62dd0dcb4f8b79ba979e9aec
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react'; import { connect } from 'react-redux'; import {Link } from 'react-router-dom' // import Hfooter from '../../components/Hfooter.jsx'; // import ListHeader from './ListHeader.jsx'; import '../../styles/Lists.scss'; import { Spin, BackTop } from 'antd'; //引入 ant class Lists extends Component { constructor(props) { super(props); this.props = props; console.log(props); this.state = { licur:0, contentClass: "screen_nav", detail: [], detailitem:[], loading: true, loadingmore : true, lititle :[ {name:"人气"}, {name:"销量"}, {name:"新品"}, {name:"价格"}, ] } } toggleLicur(index,e) { this.setState((prevState) => ({ licur: index, })) if(this.state.licur===3){ let newdetail = this.state.detail; let newarr = newdetail.sort((function (o1, o2) { return o1.real_price - o2.real_price; })) // let newarr = newdetail.reverse();倒序brand_id console.log(newarr) } if(this.state.licur===1){ let newdetail = this.state.detail; let newarr = newdetail.sort((function (o1, o2) { return o1.brand_id - o2.brand_id; })) // let newarr = newdetail.reverse();倒序 console.log(newarr) } if(this.state.licur===2){ let newdetail = this.state.detail; let newarr = newdetail.sort((function (o1, o2) { return o1.comm_rate - o2.comm_rate; })) // let newarr = newdetail.reverse();倒序 console.log(newarr) } } windowOnScroll() { if(this.state.loadingmore===true){ window.onscroll = () =>{ //获取滚动条滚动的距离 let h = document.documentElement.scrollTop; //滚动条的总距离 let all = document.documentElement.scrollHeight; // console.log(h,all); if (all-h===667) { React.axios.get('../jsons/Lists.json') .then((res) => { // console.log(res.data) let arr3 = res.data.pagetwo; let arr4 = this.state.detail.concat(arr3); console.log(arr4); this.setState((prevState) => ({ detail: arr4, })) return this.state; }) .catch((err) => { console.log(err) }) } if (h>50) { // console.log(666) this.setState({ contentClass: "fixeds" }); } else { this.setState({ contentClass: "screen_nav", loadingmore : false }); } } } } getdetail() { React.axios.get('../jsons/Lists.json') .then((res) => { // console.log(res.data) let arr = res.data.pageone; let arr2 = this.state.detail.concat(arr); this.setState((prevState) => ({ detail: arr2, loading: false })) // return this.state; }) .catch((err) => { console.log(err) }) } getId(index,e){ console.log(index); let items = this.state.detail[index] console.log(items); this.setState((prevState) => ({ detailitem: items })) } componentDidMount() { this.getdetail(); } componentDidUpdate(){ this.windowOnScroll(); } componentWillReceiveProps(){ console.log(this.props) } render() { console.log(this.state.detailitem) console.log(this.props) return ( <div style={{ display: this.props.showlist.isShowlists ? "block" : "none" }}> <nav className={this.state.contentClass}> <ul> { (()=>{ return this.state.lititle.map((item,index)=>{ return <li key={index} className={index===this.state.licur?"active":'rq'} onClick={this.toggleLicur.bind(this,index)} >{item.name}</li> }) })() } </ul> {/* <div className="mask"></div> */} </nav> <div className="proList" id="listItems"> { (() => { return this.state.detail.map((item, index) => { return <Link to='/detail/' replace className="defaultBlock" id={item.id} data-sku={item.id} key={index} alt='' // onClick={this.getId.bind(this,index)} onClick={this.props.getdetails.bind(this, index)} > <a href="/list/listdetail" title="miya" alt='' > <div className="entranceMap"> <img src={item.image} alt="" /> </div> <div className="rim"> <div className="mainTitle"> {item.brand_name} {item.name} </div> <div className="price"> <div className="price_desc"><span>{item.activity_dynamics}</span> <div className="gsh-mark">自营</div> </div> <div className="mia_price"> <span className="mia_price_title"></span><span className="price_icon">¥</span><span className="mia_price_con">{item.real_price}</span> </div> <div className="market_price"> <span className="market_price_title"></span><span className="price_icon">¥</span><del className="market_price_con">{item.market_price}</del> </div> </div> </div> </a> <a href="1" className="Fbutton btn-cart addShoppingCart"><span></span></a> </Link> }) })() } </div> <div> <BackTop /> {/* <strong style={{ color: 'rgba(64, 64, 64, 0.6)' }}> gray </strong> */} </div> <div className='example'> <Spin tip="Loading..." spinning={this.state.loading} /> </div> </div> ) } } export default connect((state) => { console.log(state) return state }, (dispatch) => { return { getdetails(index) { console.log(index); dispatch({ type: 'getdetails', aa:this.state.detail[index] }) } } })(Lists);
37.184685
192
0.374561
false
true
true
false
d00a211a71a0e9d13bb424257afc36f2908d16c4
2,799
jsx
JSX
MapStore2/web/client/components/manager/importer/Layer.jsx
MaddoxMaila/mapstore-v1
6f728c16be075e285c7389c9188f3c8d072d2ae1
[ "BSD-2-Clause-FreeBSD" ]
349
2015-08-07T18:07:52.000Z
2022-03-22T13:41:23.000Z
MapStore2/web/client/components/manager/importer/Layer.jsx
MaddoxMaila/mapstore-v1
6f728c16be075e285c7389c9188f3c8d072d2ae1
[ "BSD-2-Clause-FreeBSD" ]
7,114
2015-07-27T15:28:52.000Z
2022-03-31T11:05:12.000Z
MapStore2/web/client/components/manager/importer/Layer.jsx
MaddoxMaila/mapstore-v1
6f728c16be075e285c7389c9188f3c8d072d2ae1
[ "BSD-2-Clause-FreeBSD" ]
335
2015-07-28T09:36:34.000Z
2022-03-26T02:41:05.000Z
/** * Copyright 2016, GeoSolutions Sas. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ import React from 'react'; import PropTypes from 'prop-types'; import Button from '../../misc/Button'; import { Panel } from 'react-bootstrap'; import Message from '../../I18N/Message'; class Layer extends React.Component { static propTypes = { layer: PropTypes.object, loading: PropTypes.bool, edit: PropTypes.bool, panProps: PropTypes.object, updateLayer: PropTypes.func }; static defaultProps = { layer: {}, edit: true, loading: false, updateLayer: () => {} }; state = {}; onChange = (event) => { let state = {}; state[event.target.name] = event.target.value || ""; this.setState(state); }; renderInput = (name) => { let input; if (name !== "description") { input = (<input disabled={!this.props.edit || name === "name"} name={name} key={name} type="text" style={{width: "100%"}} onChange={this.onChange} value={this.state[name] !== undefined ? this.state[name] : this.props.layer[name]} />); } else { input = (<textarea disabled={!this.props.edit} name={name} key={name} type="text" style={{width: "100%"}} onChange={this.onChange} value={this.state[name] !== undefined ? this.state[name] : this.props.layer[name]} />); } return [ <dt style={{marginBottom: "10px"}} key={"title-" + name}>{name}</dt>, <dd> {input} </dd>]; }; render() { return (<Panel {...this.props.panProps}> <dl className="dl-horizontal"> {["name", "title", "description"].map(this.renderInput)} </dl> <div style={{"float": "right"}}> <Button bsStyle="primary" disabled={!this.isUpdateEnabled()} onClick={() => {this.props.updateLayer(this.state); }}> <Message msgId="importer.task.update" /></Button> </div> </Panel>); } isValid = () => { return this.state.name !== ""; }; isModified = () => { return Object.keys(this.state).some((element) => { return this.state[element] !== this.props.layer[element]; }); }; isUpdateEnabled = () => { return this.isModified() && this.isValid() && !this.props.loading; }; } export default Layer;
27.99
132
0.499821
false
true
true
false
d00a5f3959337a6a1cd40acf2a4750fd83c359c8
1,637
jsx
JSX
src/component/user/authentication-simple-component.jsx
Kouzukii/unleash-frontend
0c4337f3697dd45c32305bb65f7e7e96e566e53a
[ "Apache-2.0" ]
null
null
null
src/component/user/authentication-simple-component.jsx
Kouzukii/unleash-frontend
0c4337f3697dd45c32305bb65f7e7e96e566e53a
[ "Apache-2.0" ]
null
null
null
src/component/user/authentication-simple-component.jsx
Kouzukii/unleash-frontend
0c4337f3697dd45c32305bb65f7e7e96e566e53a
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import { CardActions, Button, Textfield } from 'react-mdl'; class SimpleAuthenticationComponent extends React.Component { static propTypes = { authDetails: PropTypes.object.isRequired, unsecureLogin: PropTypes.func.isRequired, fetchFeatureToggles: PropTypes.func.isRequired, }; handleSubmit = evt => { evt.preventDefault(); const email = this.refs.email.inputRef.value; const user = { email }; const path = evt.target.action; this.props.unsecureLogin(path, user).then(this.props.fetchFeatureToggles); }; render() { const authDetails = this.props.authDetails; return ( <form onSubmit={this.handleSubmit} action={authDetails.path}> <p>{authDetails.message}</p> <p> This instance of Unleash is not set up with a secure authentication provider. You can read more about{' '} <a href="https://github.com/Unleash/unleash/blob/master/docs/securing-unleash.md" target="_blank"> securing Unleash on GitHub </a> </p> <Textfield label="Email" name="email" required type="email" ref="email" /> <br /> <CardActions style={{ textAlign: 'center' }}> <Button raised colored> Sign in </Button> </CardActions> </form> ); } } export default SimpleAuthenticationComponent;
34.829787
118
0.562004
false
true
true
false
d00a67434ca0a2d64058a3aef6f2d606e30978ff
274
jsx
JSX
example/fullstack/browser/js/routes/people/index.jsx
dadleyy/hoctable
11fcdd38419d2c2ae34d5f63f5783a0f2a4f79a5
[ "MIT" ]
4
2016-12-05T19:55:09.000Z
2019-07-12T22:02:59.000Z
example/fullstack/browser/js/routes/people/index.jsx
dadleyy/hoctable
11fcdd38419d2c2ae34d5f63f5783a0f2a4f79a5
[ "MIT" ]
61
2017-01-29T03:35:25.000Z
2018-03-14T17:35:44.000Z
example/fullstack/browser/js/routes/people/index.jsx
dadleyy/hoctable
11fcdd38419d2c2ae34d5f63f5783a0f2a4f79a5
[ "MIT" ]
1
2016-09-02T10:01:07.000Z
2016-09-02T10:01:07.000Z
import Paged from "../../pages/people"; import PagedDelegate from "../../services/delegates/people/paged"; import * as React from "react"; function Route() { let delegate = new PagedDelegate(); return Q.resolve(<Paged delegate={delegate} />); } export default Route;
22.833333
66
0.70073
false
true
false
true
d00a783d29f5d18bfcae67cfb8cb599db7e1b721
4,010
jsx
JSX
src/components/Parabirimi/Parabirimi.jsx
akayee/hoopbooks
ae927bdd338de238acb5469458bdfbc3c3b35d0b
[ "MIT" ]
null
null
null
src/components/Parabirimi/Parabirimi.jsx
akayee/hoopbooks
ae927bdd338de238acb5469458bdfbc3c3b35d0b
[ "MIT" ]
null
null
null
src/components/Parabirimi/Parabirimi.jsx
akayee/hoopbooks
ae927bdd338de238acb5469458bdfbc3c3b35d0b
[ "MIT" ]
null
null
null
import React from "react"; import classNames from "classnames"; // @material-ui/core components import withStyles from "@material-ui/core/styles/withStyles"; import MenuList from "@material-ui/core/MenuList"; import MenuItem from "@material-ui/core/MenuItem"; import Grow from "@material-ui/core/Grow"; import Paper from "@material-ui/core/Paper"; import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import Hidden from "@material-ui/core/Hidden"; import Poppers from "@material-ui/core/Popper"; // @material-ui/icons import Notifications from "@material-ui/icons/Notifications"; //core components import Button from "components/CustomButtons/Button.jsx"; import dropdownStyle from "assets/jss/material-dashboard-react/dropdownStyle.jsx"; class Dropdown extends React.Component { state = { open: false }; handleToggle = () => { this.setState(state => ({ open: !state.open })); }; handleClose = event => { if (this.anchorEl.contains(event.target)) { return; } this.setState({ open: false }); }; render() { const { classes } = this.props; const { open } = this.state; return ( <div className={classes.manager}> <Button buttonRef={node => { this.anchorEl = node; }} color={window.innerWidth > 959 ? "transparent" : "white"} justIcon={window.innerWidth > 959} simple={!(window.innerWidth > 959)} aria-owns={open ? "menu-list-grow" : null} aria-haspopup="true" onClick={this.handleToggle} className={classes.buttonLink} > <Notifications className={classes.icons} /> <span className={classes.notifications}>5</span> <Hidden mdUp implementation="css"> <p onClick={this.handleClick} className={classes.linkText}> Notification </p> </Hidden> </Button> <Poppers open={open} anchorEl={this.anchorEl} transition disablePortal className={ classNames({ [classes.popperClose]: !open }) + " " + classes.pooperNav } > {({ TransitionProps, placement }) => ( <Grow {...TransitionProps} id="menu-list-grow" style={{ transformOrigin: placement === "bottom" ? "center top" : "center bottom" }} > <Paper> <ClickAwayListener onClickAway={this.handleClose}> <MenuList role="menu"> <MenuItem onClick={this.handleClose} className={classes.dropdownItem} > Mike John responded to your email </MenuItem> <MenuItem onClick={this.handleClose} className={classes.dropdownItem} > You have 5 new tasks </MenuItem> <MenuItem onClick={this.handleClose} className={classes.dropdownItem} > You're now friend with Andrew </MenuItem> <MenuItem onClick={this.handleClose} className={classes.dropdownItem} > Another Notification </MenuItem> <MenuItem onClick={this.handleClose} className={classes.dropdownItem} > Another One </MenuItem> </MenuList> </ClickAwayListener> </Paper> </Grow> )} </Poppers> </div> ); } } export default withStyles(dropdownStyle)(Dropdown);
32.601626
82
0.508728
false
true
true
false
d00a8212c081842b77880c23c0f9ff56f1fa58fe
400
jsx
JSX
src/stories/utils/ValueTypeBadge.jsx
Alejandroid17/useScraper
510e7986f8d0b0576f4123153697689bf8b6f4f9
[ "MIT" ]
1
2022-01-02T22:24:04.000Z
2022-01-02T22:24:04.000Z
src/stories/utils/ValueTypeBadge.jsx
Alejandroid17/useScraper
510e7986f8d0b0576f4123153697689bf8b6f4f9
[ "MIT" ]
2
2022-01-03T21:21:11.000Z
2022-01-09T12:48:46.000Z
src/stories/utils/ValueTypeBadge.jsx
Alejandroid17/useScraper
510e7986f8d0b0576f4123153697689bf8b6f4f9
[ "MIT" ]
null
null
null
import React from "react" const ValueTypeBadge = ({ value }) => { const valueType = typeof value === "object" ? Array.isArray(value) ? "array" : typeof value : typeof value return ( <span className="flex items-center px-2 py-1 mx-1 text-sm leading-none text-green-500 rounded bg-slate-100"> {valueType} </span> ) } export default ValueTypeBadge
21.052632
112
0.62
false
true
false
true
d00a88b8b4aed711863ac0e097b1bc41fbd597d6
2,734
jsx
JSX
web/src/components/repoCard/repoCard.jsx
szabogabor91/gimlet-dashboard
1300866570a84a358352f52a6aea403de12446cb
[ "Apache-2.0" ]
null
null
null
web/src/components/repoCard/repoCard.jsx
szabogabor91/gimlet-dashboard
1300866570a84a358352f52a6aea403de12446cb
[ "Apache-2.0" ]
null
null
null
web/src/components/repoCard/repoCard.jsx
szabogabor91/gimlet-dashboard
1300866570a84a358352f52a6aea403de12446cb
[ "Apache-2.0" ]
null
null
null
import React from "react"; import {StarIcon} from "@heroicons/react/outline"; import {StarIcon as SolidStarIcon} from "@heroicons/react/solid"; function RepoCard(props) { const {name, services, navigateToRepo, favorite, favoriteHandler} = props; const numberOfReposOnCard = 5; const truncatedServices = services.length > numberOfReposOnCard ? services.slice(0, numberOfReposOnCard) : services; const serviceWidgets = truncatedServices.map(service => { let ingressWidgets = []; if (service.ingresses !== undefined) { ingressWidgets = service.ingresses.map(ingress => ( <p class="text-gray-400"> <span>{ingress.url}</span> <a href={`https://${ingress.url}`} target="_blank" rel="noopener noreferrer" onClick={(e) => { e.stopPropagation(); return true }}> <svg xmlns="http://www.w3.org/2000/svg" className="inline fill-current hover:text-teal-300 ml-1 text-gray-500 hover:text-gray-700" width="12" height="12" viewBox="0 0 24 24"> <path d="M0 0h24v24H0z" fill="none"/> <path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/> </svg> </a> </p> )) } return ( <div> <p className="text-xs">{service.service.namespace}/{service.service.name} <span className="flex-shrink-0 inline-block px-2 py-0.5 mx-1 text-green-800 text-xs font-medium bg-green-100 rounded-full"> {service.env} </span> </p> <ul className="text-xs pl-2"> {ingressWidgets} </ul> {services.length > numberOfReposOnCard ? <p>...</p> : null} </div> ) }) return ( <div className="relative"> <div className="absolute top-0 right-0 m-6"> {favorite && <SolidStarIcon className="h-4 w-4 text-green-400 hover:text-gray-400 cursor-pointer" onClick={() => favoriteHandler(name)} /> } {!favorite && <StarIcon className="h-4 w-4 text-gray-400 hover:text-green-400 cursor-pointer" onClick={() => favoriteHandler(name)} /> } </div> <div className="w-full flex items-center justify-between p-6 space-x-6 cursor-pointer" onClick={() => navigateToRepo(name)}> <div className="flex-1 truncate"> <p className="text-sm font-bold">{name}</p> <div className="p-2 space-y-2"> {serviceWidgets} </div> </div> </div> </div> ) } export default RepoCard;
34.607595
152
0.565106
false
true
false
true
d00a8c78d9ac50e97dff7ef6326e3575d22d2a01
6,455
jsx
JSX
hasher-matcher-actioner/webapp/src/components/settings/ActionPerformer/ActionPerformerRows.jsx
SantaKaus/ThreatExchange
659b385a851722c116191a0943788e1217e02c27
[ "BSD-3-Clause" ]
null
null
null
hasher-matcher-actioner/webapp/src/components/settings/ActionPerformer/ActionPerformerRows.jsx
SantaKaus/ThreatExchange
659b385a851722c116191a0943788e1217e02c27
[ "BSD-3-Clause" ]
3
2021-08-21T07:49:33.000Z
2022-03-12T01:03:31.000Z
hasher-matcher-actioner/webapp/src/components/settings/ActionPerformer/ActionPerformerRows.jsx
SantaKaus/ThreatExchange
659b385a851722c116191a0943788e1217e02c27
[ "BSD-3-Clause" ]
null
null
null
/** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved */ import React, {useState} from 'react'; import {PropTypes} from 'prop-types'; import Button from 'react-bootstrap/Button'; import Modal from 'react-bootstrap/Modal'; import OverlayTrigger from 'react-bootstrap/OverlayTrigger'; import Tooltip from 'react-bootstrap/Tooltip'; import ActionPerformerColumns from './ActionPerformerColumns'; export default function ActionPerformerRows({ name, type, params, edit, onSave, onDelete, canNotDeleteOrUpdateName, }) { const [editing, setEditing] = useState(edit); const [showDeleteActionConfirmation, setShowDeleteActionConfirmation] = useState(false); const [showUpdateActionConfirmation, setShowUpdateActionConfirmation] = useState(false); const [updatedAction, setUpdatedAction] = useState({ name, config_subtype: type, fields: params, }); const onUpdatedActionChange = (key, value) => { if (key === 'name' || key === 'config_subtype') { setUpdatedAction({...updatedAction, ...value}); } else { setUpdatedAction({ ...updatedAction, fields: {...updatedAction.fields, ...value}, }); } }; const resetForm = () => { setUpdatedAction({ name, config_subtype: type, fields: params, }); }; return ( <> <tr hidden={editing}> <td> <Button className="mb-2 table-action-button" onClick={() => setEditing(true)}> <ion-icon name="pencil" size="large" className="ion-icon-white" /> </Button> <br /> <Button variant="secondary" className="table-action-button" disabled={canNotDeleteOrUpdateName} onClick={() => setShowDeleteActionConfirmation(true)}> <ion-icon name="trash-bin" size="large" className="ion-icon-white" /> </Button> <br /> <Modal show={showDeleteActionConfirmation} onHide={() => setShowDeleteActionConfirmation(false)}> <Modal.Header closeButton> <Modal.Title>Confirm Action Delete</Modal.Title> </Modal.Header> <Modal.Body> <p> Please confirm you want to delete the action named{' '} <strong>{name}</strong>. </p> </Modal.Body> <Modal.Footer> <Button variant="secondary" onClick={() => setShowDeleteActionConfirmation(false)}> Cancel </Button> <Button variant="primary" onClick={() => onDelete(name)}> Yes, Delete This Action </Button> </Modal.Footer> </Modal> {canNotDeleteOrUpdateName ? ( <OverlayTrigger overlay={ <Tooltip id={`tooltip-${name}`}> The action {name} can not be deleted because it is currently being used by one or more action rules. Please edit the rule(s) to refer to another action, or delete the rule(s), then retry. </Tooltip> }> <Button variant="secondary" className="table-action-button"> <ion-icon name="help-outline" size="large" className="ion-icon-white" /> </Button> </OverlayTrigger> ) : null} </td> <ActionPerformerColumns key={updatedAction.name} name={updatedAction.name} type={updatedAction.config_subtype} params={updatedAction.fields} editing={false} onChange={onUpdatedActionChange} canNotDeleteOrUpdateName={canNotDeleteOrUpdateName} /> </tr> <tr hidden={!editing}> <td> <Button variant="outline-primary" className="mb-2 table-action-button" onClick={() => { setShowUpdateActionConfirmation(true); }}> <ion-icon name="checkmark" size="large" className="ion-icon-white" /> </Button> <br /> <Button variant="outline-secondary" className="table-action-button" onClick={() => { resetForm(); setEditing(false); }}> <ion-icon name="close" size="large" className="ion-icon-white" /> </Button> <Modal show={showUpdateActionConfirmation} onHide={() => setShowUpdateActionConfirmation(false)}> <Modal.Header closeButton> <Modal.Title>Confirm Action Update</Modal.Title> </Modal.Header> <Modal.Body> <p> Please confirm you want to update the action named{' '} <strong>{name}</strong>. </p> </Modal.Body> <Modal.Footer> <Button variant="secondary" onClick={() => setShowUpdateActionConfirmation(false)}> Cancel </Button> <Button variant="primary" onClick={() => { setEditing(false); onSave({name, type, updatedAction}); setShowUpdateActionConfirmation(false); }}> Yes, Update This Action </Button> </Modal.Footer> </Modal> </td> <ActionPerformerColumns name={updatedAction.name} type={updatedAction.config_subtype} params={updatedAction.fields} editing onChange={onUpdatedActionChange} canNotDeleteOrUpdateName={canNotDeleteOrUpdateName} /> </tr> </> ); } ActionPerformerRows.propTypes = { name: PropTypes.string.isRequired, type: PropTypes.string.isRequired, edit: PropTypes.bool.isRequired, params: PropTypes.shape({ url: PropTypes.string.isRequired, headers: PropTypes.string.isRequired, }).isRequired, onSave: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired, canNotDeleteOrUpdateName: PropTypes.bool.isRequired, };
31.334951
78
0.53261
false
true
false
true
d00a8f52c66e10a5bdbdbe5f7ea0ad183ad55aba
3,552
jsx
JSX
src/phenome/components/icon.jsx
nealyip/framework7
b42f48ecdca7f469df9023d47e37cf17d867356f
[ "MIT" ]
1
2019-10-11T02:54:22.000Z
2019-10-11T02:54:22.000Z
src/phenome/components/icon.jsx
nealyip/framework7
b42f48ecdca7f469df9023d47e37cf17d867356f
[ "MIT" ]
null
null
null
src/phenome/components/icon.jsx
nealyip/framework7
b42f48ecdca7f469df9023d47e37cf17d867356f
[ "MIT" ]
null
null
null
import Utils from '../utils/utils'; import Mixins from '../utils/mixins'; export default { name: 'f7-icon', props: { id: [String, Number], material: String, // Material Icons f7: String, // Framework7 Icons ion: String, // Ionicons fa: String, // Font Awesome icon: String, // Custom ifMd: String, ifIos: String, ios: String, md: String, tooltip: String, size: [String, Number], ...Mixins.colorProps, }, render() { const self = this; const props = self.props; const { id, style, } = props; return ( <i ref="el" id={id} style={Utils.extend({ fontSize: self.sizeComputed }, style)} className={self.classes} > {self.iconTextComputed} <slot /> </i> ); }, watch: { 'props.tooltip': function watchTooltip(newText) { const self = this; if (!newText || !self.f7Tooltip) return; self.f7Tooltip.setText(newText); }, }, componentDidMount() { const self = this; const el = self.refs.el; if (!el) return; const { tooltip } = self.props; if (!tooltip) return; self.$f7ready((f7) => { self.f7Tooltip = f7.tooltip.create({ targetEl: el, text: tooltip, }); }); }, componentWillUnmount() { const self = this; if (self.f7Tooltip && self.f7Tooltip.destroy) { self.f7Tooltip.destroy(); self.f7Tooltip = null; delete self.f7Tooltip; } }, computed: { sizeComputed() { const self = this; let size = self.props.size; if (typeof size === 'number' || parseFloat(size) === size * 1) { size = `${size}px`; } return size; }, iconTextComputed() { const self = this; const { material, f7, ifMd, ifIos, md, ios } = self.props; let text = material || f7; const mdIcon = ifMd || md; const iosIcon = ifIos || ios; if (mdIcon && self.$theme.md && (mdIcon.indexOf('material:') >= 0 || mdIcon.indexOf('f7:') >= 0)) { text = mdIcon.split(':')[1]; } else if (iosIcon && self.$theme.ios && (iosIcon.indexOf('material:') >= 0 || iosIcon.indexOf('f7:') >= 0)) { text = iosIcon.split(':')[1]; } return text; }, classes() { let classes = { icon: true, }; const self = this; const props = self.props; const { ifMd, ifIos, material, f7, fa, ion, icon, md, ios, className, } = props; const mdIcon = ifMd || md; const iosIcon = ifIos || ios; if (mdIcon || iosIcon) { const parts = (self.$theme.md ? mdIcon : iosIcon).split(':'); const prop = parts[0]; const value = parts[1]; if (prop === 'material' || prop === 'fa' || prop === 'f7') { classes.fa = prop === 'fa'; classes['material-icons'] = prop === 'material'; classes['f7-icons'] = prop === 'f7'; } if (prop === 'fa' || prop === 'ion') { classes[`${prop}-${value}`] = true; } if (prop === 'icon') { classes[value] = true; } } else { classes = { icon: true, 'material-icons': material, 'f7-icons': f7, fa, }; if (ion) classes[`ion-${ion}`] = true; if (fa) classes[`fa-${fa}`] = true; if (icon) classes[icon] = true; } return Utils.classNames( className, classes, Mixins.colorClasses(props), ); }, }, };
26.117647
116
0.502534
false
true
false
true
d00a8f894044eadc6ef054153a475866b1b9ef74
2,097
jsx
JSX
src/views/client/MyCoupons.jsx
Killua010/random-things-UI-E-Commerce
76b649f156a19aff8ec16286802b44c635193fb7
[ "MIT" ]
1
2019-07-08T16:10:19.000Z
2019-07-08T16:10:19.000Z
src/views/client/MyCoupons.jsx
Killua010/coisas-aleatorias-UI
76b649f156a19aff8ec16286802b44c635193fb7
[ "MIT" ]
1
2022-02-10T16:48:33.000Z
2022-02-10T16:48:33.000Z
src/views/client/MyCoupons.jsx
Killua010/coisas-aleatorias-UI
76b649f156a19aff8ec16286802b44c635193fb7
[ "MIT" ]
null
null
null
/* eslint-disable no-unused-vars */ import React from "react"; import { CardBody, Card, CardHeader, CardTitle, Row, Col } from "reactstrap"; import Table from "@material-ui/core/Table"; import TableBody from "@material-ui/core/TableBody"; import TableCell from "@material-ui/core/TableCell"; import TableRow from "@material-ui/core/TableRow"; import { connect } from "react-redux"; import OrderService from "../../services/OrderService"; import "../../assets/css/index.css"; class MyCoupons extends React.Component { constructor(props){ super(props); this.couponService = new OrderService("coupons"); this.state = { client:{}, coupons: [], }; this.getCoupons = this.getCoupons.bind(this); } getCoupons(){ if(this.props.client !== undefined){ this.couponService.getAllByClientId(this.props.client.id).then(res => { this.setState({ coupons: res }); }); } } componentDidMount(){ if(this.props.client === null){ this.props.history.push("/login"); } else { this.setState({ client: this.props.client }); this.getCoupons(); } } render() { return ( <div className="content"> <Row> <Col md={12}> <Card className="demo-icons"> <CardHeader> <CardTitle>Meus Cupons</CardTitle> </CardHeader> <CardBody> { this.state.coupons.map((coupon, index) => { return( <Card key={index}> <CardBody> <Table> <TableBody> <TableRow> <TableCell>Cupom: {coupon.name}</TableCell> <TableCell>Valor: R$ {coupon.value}</TableCell> <TableCell>Status: {(coupon.status === true)?"Ativo":"Inativo"}</TableCell> </TableRow> </TableBody> </Table> </CardBody> </Card> ); }) } </CardBody> </Card> </Col> </Row> </div> ); } } const mapStateToProps = state => ({ client: state.client }); export default connect(mapStateToProps)(MyCoupons);
21.397959
91
0.570815
true
false
true
false
d00a92249b13c7b75ea6506edeff7334f76104cb
314
jsx
JSX
src/app.jsx
unirakun/multi-store-redux-saga
a09a2f1ece00533a7f5042b1737a77ef8bd119b7
[ "MIT" ]
null
null
null
src/app.jsx
unirakun/multi-store-redux-saga
a09a2f1ece00533a7f5042b1737a77ef8bd119b7
[ "MIT" ]
3
2018-01-06T13:37:57.000Z
2018-01-08T11:11:22.000Z
src/app.jsx
alakarteio/multi-store-redux-saga
a09a2f1ece00533a7f5042b1737a77ef8bd119b7
[ "MIT" ]
null
null
null
import React from 'react' import Header from './components/header' import Cities from './screens/cities' import Contacts from './screens/contacts' const App = () => { return ( <div style={{ backgroundColor: 'red' }}> <Header /> <Cities /> <Contacts /> </div> ) } export default App
18.470588
44
0.61465
false
true
false
true
d00a99c8240ba883e57871e8851fa5afc46e4a48
4,120
jsx
JSX
src/components/Settings/CycleInput.jsx
veritasnz/devclock
0161aeea9b5aa13ec93460273e3cef813d87d9d4
[ "MIT" ]
null
null
null
src/components/Settings/CycleInput.jsx
veritasnz/devclock
0161aeea9b5aa13ec93460273e3cef813d87d9d4
[ "MIT" ]
null
null
null
src/components/Settings/CycleInput.jsx
veritasnz/devclock
0161aeea9b5aa13ec93460273e3cef813d87d9d4
[ "MIT" ]
null
null
null
import { Fragment, useRef, useState } from "react"; import messages from "../../messageConfig"; import s from "./CycleInput.module.css"; const typeOptions = []; for (const key in messages) { typeOptions.push( <option key={key} value={key}> {key} </option> ); } const CycleInput = (props) => { const typeRef = useRef(); let errorMessage = ""; const [formError, setFormError] = useState(""); /** * Mins */ const [mins, setMins] = useState(""); const [minsIsTouched, setMinsIsTouched] = useState(false); const minsIsInvalid = mins < 0 || mins > 90; const minsHasError = minsIsTouched && minsIsInvalid; if (minsHasError) { errorMessage += "Please enter an amount of minutes between 0 and 90. "; } const minsBlurHandler = () => setMinsIsTouched(true); const minsChangeHandler = (event) => { let value = parseInt(event.target.value); if (isNaN(value)) value = ""; setMins(value); }; /** * Secs */ const [secs, setSecs] = useState(""); const [secsIsTouched, setSecsIsTouched] = useState(false); const secsIsInvalid = secs > 59 || secs < 0; const secsHasError = secsIsTouched && secsIsInvalid; if (secsHasError) { errorMessage += "Please enter a valid amount of seconds. "; } const secsBlurHandler = () => setSecsIsTouched(true); const secsChangeHandler = (event) => { let value = parseInt(event.target.value); if (isNaN(value)) value = ""; setSecs(value); }; /** * Submit */ const submitHandler = (event) => { event.preventDefault(); const type = typeRef.current.value; if (secsIsInvalid || minsIsInvalid) { return; } if (type.trim() === "") { setFormError( "Something went horribly wrong. Please refresh the page and try again." ); return; } if (mins * 60 + secs <= 0) { setFormError("Please enter an amount of time greater than 0"); return; } console.log(); const block = { type: type, seconds: parseInt(mins * 60 + secs), message: messages[type], }; props.onAddBlock(block); setFormError(""); setSecs(""); setMins(""); }; return ( <Fragment> <form className={s.wrap} onSubmit={submitHandler}> <div className={s.input}> <label htmlFor="type">Block Type</label> <select id="type" name="type" ref={typeRef}> {typeOptions} </select> </div> <div className={`${s.input} ${minsHasError && s.error}`}> <label htmlFor="type">Minutes</label> <input type="number" name="mins" placeholder="00" value={mins} onBlur={minsBlurHandler} onChange={minsChangeHandler} /> </div> <div className={`${s.input} ${secsHasError && s.error}`}> <label htmlFor="type">Secs</label> <input type="number" name="secs" placeholder="00" value={secs} onBlur={secsBlurHandler} onChange={secsChangeHandler} /> </div> <button type="submit"> <span className="sr-only">Add Current Item</span> <i className="fas fa-plus-circle" aria-hidden="true"></i> </button> </form> {(errorMessage || formError) && ( <p className={s["error-message"]}>{errorMessage + formError}</p> )} </Fragment> ); }; export default CycleInput;
28.611111
87
0.482039
false
true
false
true
d00aa744b2d2057b9664fa3bc29ee1445e9be4c9
1,549
jsx
JSX
src/js/components/SettingsPage.jsx
mArchiver/lantern
62d3cb39afd1a24980b458e649584598b772b5ca
[ "MIT" ]
null
null
null
src/js/components/SettingsPage.jsx
mArchiver/lantern
62d3cb39afd1a24980b458e649584598b772b5ca
[ "MIT" ]
null
null
null
src/js/components/SettingsPage.jsx
mArchiver/lantern
62d3cb39afd1a24980b458e649584598b772b5ca
[ "MIT" ]
null
null
null
import React from 'react'; // Decorators import { router, flux, i18n } from 'Decorator'; import Header from './Header.jsx'; import SettingsMenu from './SettingsMenu.jsx'; import UserProfile from './UserProfile.jsx'; import AccountSettings from './AccountSettings.jsx'; class SettingsRouter extends React.Component { render() { if (this.props.category == 'profile') return <UserProfile /> if (this.props.category == 'account') return <AccountSettings /> return <div />; } } @router @flux @i18n class SettingsPage extends React.Component { constructor(props, context) { super(props, context); this.state = { error: false }; } componentWillMount = () => { this.flux.on('state.User', this.flux.bindListener(this.onChange)); } componentWillUnmount = () => { this.flux.off('state.User', this.onChange); } componentDidUpdate = () => { // $(this.refs.sidebar.getDOMNode()).sidebar(); } onChange = () => { } render() { return ( <div className='main-page'> <Header /> <div className={'ui basic segment'}> <div className='ui hidden divider'></div> <div className='ui hidden divider'></div> <div className='ui stackable grid'> <div className='computer only four wide column'> <SettingsMenu category={this.props.params.category} /> </div> <div className='twelve wide computer sixteen wide tablet column'> <SettingsRouter category={this.props.params.category} /> </div> </div> </div> </div> ); } } export default SettingsPage;
20.653333
71
0.650742
true
false
true
false
d00ab4c87c2fb041362652fbdcbe7d51cfe98fb7
884
jsx
JSX
src/components/WindBellList/Language.jsx
birdfishdrumn/mysite
daeb6d0dcd8ec59301d0f4daae2e643f9c1951eb
[ "RSA-MD" ]
null
null
null
src/components/WindBellList/Language.jsx
birdfishdrumn/mysite
daeb6d0dcd8ec59301d0f4daae2e643f9c1951eb
[ "RSA-MD" ]
null
null
null
src/components/WindBellList/Language.jsx
birdfishdrumn/mysite
daeb6d0dcd8ec59301d0f4daae2e643f9c1951eb
[ "RSA-MD" ]
null
null
null
import React from "react" export const Language = ({ lang, language }) => { switch (language) { case "France": return <div>{lang.translatedDescription.fr}</div> case "English": return <div>{lang.translatedDescription.en}</div> case "Chinese": return <div>{lang.translatedDescription.zh_TW}</div> case "Korean": return <div>{lang.translatedDescription.ko}</div> } return <div>{lang.description}</div> } export const Name = ({ langName, language }) => { switch (language) { case "France": return <div>{langName.translatedName.fr}</div> case "English": return <div>{langName.translatedName.en}</div> case "Chinese": return <div>{langName.translatedName.zh_TW}</div> case "Korean": return <div>{langName.translatedName.ko}</div> } return <div>{langName.name}</div> } // export default Language
28.516129
58
0.647059
false
true
false
true
d00ab5da57ae2de58ba23c830dfa64c0f3629ec5
6,020
jsx
JSX
awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx
jborean93/awx
646c9cc7081270baf03c2261e10393d3c48e2fc4
[ "Apache-2.0" ]
null
null
null
awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx
jborean93/awx
646c9cc7081270baf03c2261e10393d3c48e2fc4
[ "Apache-2.0" ]
null
null
null
awx/ui_next/src/screens/Project/ProjectDetail/ProjectDetail.jsx
jborean93/awx
646c9cc7081270baf03c2261e10393d3c48e2fc4
[ "Apache-2.0" ]
null
null
null
import React, { useCallback } from 'react'; import { Link, useHistory } from 'react-router-dom'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; import { Button, List, ListItem } from '@patternfly/react-core'; import { Project } from '../../../types'; import { Config } from '../../../contexts/Config'; import AlertModal from '../../../components/AlertModal'; import { CardBody, CardActionsRow } from '../../../components/Card'; import DeleteButton from '../../../components/DeleteButton'; import { DetailList, Detail, UserDateDetail, } from '../../../components/DetailList'; import ErrorDetail from '../../../components/ErrorDetail'; import ExecutionEnvironmentDetail from '../../../components/ExecutionEnvironmentDetail'; import CredentialChip from '../../../components/CredentialChip'; import { ProjectsAPI } from '../../../api'; import { toTitleCase } from '../../../util/strings'; import useRequest, { useDismissableError } from '../../../util/useRequest'; import ProjectSyncButton from '../shared/ProjectSyncButton'; function ProjectDetail({ project, i18n }) { const { allow_override, created, custom_virtualenv, description, id, local_path, modified, name, scm_branch, scm_clean, scm_delete_on_update, scm_refspec, scm_type, scm_update_on_launch, scm_update_cache_timeout, scm_url, summary_fields, } = project; const history = useHistory(); const { request: deleteProject, isLoading, error: deleteError } = useRequest( useCallback(async () => { await ProjectsAPI.destroy(id); history.push(`/projects`); }, [id, history]) ); const { error, dismissError } = useDismissableError(deleteError); let optionsList = ''; if ( scm_clean || scm_delete_on_update || scm_update_on_launch || allow_override ) { optionsList = ( <List> {scm_clean && <ListItem>{i18n._(t`Clean`)}</ListItem>} {scm_delete_on_update && ( <ListItem>{i18n._(t`Delete on Update`)}</ListItem> )} {scm_update_on_launch && ( <ListItem>{i18n._(t`Update Revision on Launch`)}</ListItem> )} {allow_override && ( <ListItem>{i18n._(t`Allow Branch Override`)}</ListItem> )} </List> ); } return ( <CardBody> <DetailList gutter="sm"> <Detail label={i18n._(t`Name`)} value={name} dataCy="project-detail-name" /> <Detail label={i18n._(t`Description`)} value={description} /> {summary_fields.organization && ( <Detail label={i18n._(t`Organization`)} value={ <Link to={`/organizations/${summary_fields.organization.id}/details`} > {summary_fields.organization.name} </Link> } /> )} <Detail label={i18n._(t`Source Control Type`)} value={ scm_type === '' ? i18n._(t`Manual`) : toTitleCase(project.scm_type) } /> <Detail label={i18n._(t`Source Control URL`)} value={scm_url} /> <Detail label={i18n._(t`Source Control Branch`)} value={scm_branch} /> <Detail label={i18n._(t`Source Control Refspec`)} value={scm_refspec} /> {summary_fields.credential && ( <Detail label={i18n._(t`Source Control Credential`)} value={ <CredentialChip key={summary_fields.credential.id} credential={summary_fields.credential} isReadOnly /> } /> )} {optionsList && ( <Detail label={i18n._(t`Options`)} value={optionsList} /> )} <Detail label={i18n._(t`Cache Timeout`)} value={`${scm_update_cache_timeout} ${i18n._(t`Seconds`)}`} /> <ExecutionEnvironmentDetail virtualEnvironment={custom_virtualenv} executionEnvironment={summary_fields?.default_environment} isDefaultEnvironment /> <Config> {({ project_base_dir }) => ( <Detail label={i18n._(t`Project Base Path`)} value={project_base_dir} /> )} </Config> <Detail label={i18n._(t`Playbook Directory`)} value={local_path} /> <UserDateDetail label={i18n._(t`Created`)} date={created} user={summary_fields.created_by} /> <UserDateDetail label={i18n._(t`Last Modified`)} date={modified} user={summary_fields.modified_by} /> </DetailList> <CardActionsRow> {summary_fields.user_capabilities?.edit && ( <Button ouiaId="project-detail-edit-button" aria-label={i18n._(t`edit`)} component={Link} to={`/projects/${id}/edit`} > {i18n._(t`Edit`)} </Button> )} {summary_fields.user_capabilities?.start && ( <ProjectSyncButton projectId={project.id} /> )} {summary_fields.user_capabilities?.delete && ( <DeleteButton name={name} modalTitle={i18n._(t`Delete Project`)} onConfirm={deleteProject} isDisabled={isLoading} > {i18n._(t`Delete`)} </DeleteButton> )} </CardActionsRow> {/* Update delete modal to show dependencies https://github.com/ansible/awx/issues/5546 */} {error && ( <AlertModal isOpen={error} variant="error" title={i18n._(t`Error!`)} onClose={dismissError} > {i18n._(t`Failed to delete project.`)} <ErrorDetail error={error} /> </AlertModal> )} </CardBody> ); } ProjectDetail.propTypes = { project: Project.isRequired, }; export default withI18n()(ProjectDetail);
30.1
97
0.559136
false
true
false
true
d00abd9484700e66feef83d9eaa3d23bf8323827
3,961
jsx
JSX
src/components/Modals/ModalCreateEchoAddress.jsx
instaloper/store-wallet
045f35e2ad3cba437a3e9a1c628f9d9c7ef234c8
[ "MIT" ]
18
2018-10-05T14:12:20.000Z
2021-02-20T19:46:22.000Z
src/components/Modals/ModalCreateEchoAddress.jsx
instaloper/store-wallet
045f35e2ad3cba437a3e9a1c628f9d9c7ef234c8
[ "MIT" ]
7
2019-10-08T08:42:38.000Z
2022-03-25T18:52:10.000Z
src/components/Modals/ModalCreateEchoAddress.jsx
instaloper/store-wallet
045f35e2ad3cba437a3e9a1c628f9d9c7ef234c8
[ "MIT" ]
1
2019-11-04T16:41:17.000Z
2019-11-04T16:41:17.000Z
import React from 'react'; import { Modal, Button, Form } from 'semantic-ui-react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { connect } from 'react-redux'; import _ from 'lodash'; import FocusLock from 'react-focus-lock'; import { injectIntl } from 'react-intl'; import { closeModal, setError } from '../../actions/ModalActions'; import { MODAL_GENERATE_ECHO_ADDRESS } from '../../constants/ModalConstants'; import { generateEchoAddress } from '../../actions/TransactionActions'; import TransactionScenario from '../../containers/TransactionScenario'; class ModalCreateEchoAddress extends React.Component { constructor(props) { super(props); this.DEFAULT_STATE = { label: '', }; this.state = _.cloneDeep(this.DEFAULT_STATE); } onGenerateEchoAdress(submit) { this.props.closeModal(); submit(); } onChange(e) { this.props.setError(null); this.setState({ label: e.target.value }); } onClose(e) { e.preventDefault(); this.props.closeModal(); } render() { const { show, error, intl, keyWeightWarn, } = this.props; return ( <TransactionScenario handleTransaction={() => this.props.generateEchoAddress(this.state.label)} > { (submit) => ( <Modal className="create-address-modal" open={show}> <FocusLock autoFocus={false}> <button className="icon-close" onClick={(e) => this.onClose(e)} /> <div className="modal-header"> <h2 className="modal-header-title"> {intl.formatMessage({ id: 'modals.modal_create_echo_address.title' })} </h2> </div> <Form className="modal-body"> <div className="info-text"> {intl.formatMessage({ id: 'modals.modal_create_echo_address.text' })} </div> <div className={classnames('field', { error: !!error })}> <label htmlFor="address"> {intl.formatMessage({ id: 'modals.modal_create_echo_address.address_input.title' })} </label> <input type="text" placeholder={ intl.formatMessage({ id: 'modals.modal_create_echo_address.address_input.placeholder' }) } name="address" onChange={(e) => this.onChange(e)} autoFocus /> { error ? <span className="error-message"> {intl.formatMessage({ id: error })} </span> : null } <span className="warning-message"> {intl.formatMessage({ id: 'modals.modal_create_echo_address.warning' })} </span> </div> <div className="form-panel"> <Button type="submit" className="main-btn" onClick={() => this.onGenerateEchoAdress(submit)} content={intl.formatMessage({ id: 'modals.modal_create_echo_address.generate_button_text' })} disabled={keyWeightWarn} /> </div> </Form> </FocusLock> </Modal> ) } </TransactionScenario> ); } } ModalCreateEchoAddress.propTypes = { show: PropTypes.bool, error: PropTypes.string, closeModal: PropTypes.func.isRequired, generateEchoAddress: PropTypes.func.isRequired, setError: PropTypes.func.isRequired, intl: PropTypes.any.isRequired, keyWeightWarn: PropTypes.bool.isRequired, }; ModalCreateEchoAddress.defaultProps = { show: false, error: null, }; export default injectIntl(connect( (state) => ({ show: state.modal.getIn([MODAL_GENERATE_ECHO_ADDRESS, 'show']), error: state.modal.getIn([MODAL_GENERATE_ECHO_ADDRESS, 'error']), keyWeightWarn: state.global.get('keyWeightWarn'), }), (dispatch) => ({ closeModal: () => dispatch(closeModal(MODAL_GENERATE_ECHO_ADDRESS)), generateEchoAddress: (label) => dispatch(generateEchoAddress(label)), setError: (value) => dispatch(setError(MODAL_GENERATE_ECHO_ADDRESS, value)), }), )(ModalCreateEchoAddress));
28.496403
104
0.630144
true
false
true
false
d00ac221cd36e3bd12ebed9352e85b26bb531ef7
931
jsx
JSX
public/Components/Table.jsx
SimonSun1988/reactMessageWall
916b8059a78e486231ef2b544ecaf0394ac80442
[ "MIT" ]
null
null
null
public/Components/Table.jsx
SimonSun1988/reactMessageWall
916b8059a78e486231ef2b544ecaf0394ac80442
[ "MIT" ]
null
null
null
public/Components/Table.jsx
SimonSun1988/reactMessageWall
916b8059a78e486231ef2b544ecaf0394ac80442
[ "MIT" ]
null
null
null
import React from 'react' import AppStore from '../stores/AppStore' var Table = React.createClass({ getInitialState() { return AppStore.getState(); }, componentDidMount() { AppStore.listen(this.onChange); }, componentWillUnmount() { // 取消事件監聽 AppStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, render: function() { let messages = this.state.messages.map(function(message) { return ( <tr><td>{message}</td></tr> ) }); return ( <table className="striped"> <thead> <tr> <th>Message</th> </tr> </thead> <tbody> {messages} </tbody> </table> ) } }); module.exports = Table;
19.395833
66
0.444683
false
true
false
true
d00ac44a8354d3859af8ea2bca7a8cd42de98ec4
1,033
jsx
JSX
src/components/header.jsx
Camboridesbikes/ENG1002933
9ceeac3523f102992831cf8652be033beded16e8
[ "MIT" ]
null
null
null
src/components/header.jsx
Camboridesbikes/ENG1002933
9ceeac3523f102992831cf8652be033beded16e8
[ "MIT" ]
null
null
null
src/components/header.jsx
Camboridesbikes/ENG1002933
9ceeac3523f102992831cf8652be033beded16e8
[ "MIT" ]
null
null
null
import { Link } from "gatsby" import PropTypes from "prop-types" import React from "react" const Header = ({ siteTitle, siteDescription }) => ( <header style={{ height:`1.5rem`, background: `black`, marginBottom: `0`, }} > <div style={{ margin: `.1rem 0`, maxWidth: 960, padding: `0 1.0875rem`, }} > <p style={{ margin: 0, color: `white`,}}> <Link to="/" style={{ color: `white`, textDecoration: `none`, fontSize: `1rem`, }} > {siteTitle}- </Link> {siteDescription} </p> {/* <p style={{ color: `white`, }} > {siteDescription} </p> */} </div> </header> ) Header.propTypes = { siteTitle: PropTypes.string, siteDescription: PropTypes.string, } Header.defaultProps = { siteTitle: ``, siteDescription: ``, } export default Header
18.446429
52
0.45789
false
true
false
true
d00acfac75fcd5cea8749ab1e3c50eec28181e1e
7,490
jsx
JSX
frontend/src/views/UserProfile/OtherUserProfile.jsx
bounswe/bounswe2018group5
d547820bfb3070da3e3935a64429e4c45aef6098
[ "MIT" ]
10
2018-03-18T20:33:39.000Z
2021-03-03T07:37:33.000Z
frontend/src/views/UserProfile/OtherUserProfile.jsx
bounswe/bounswe2018group5
d547820bfb3070da3e3935a64429e4c45aef6098
[ "MIT" ]
254
2018-02-07T15:52:26.000Z
2019-01-08T04:11:47.000Z
frontend/src/views/UserProfile/OtherUserProfile.jsx
bounswe/bounswe2018group5
d547820bfb3070da3e3935a64429e4c45aef6098
[ "MIT" ]
5
2018-03-01T13:28:45.000Z
2021-05-24T11:07:06.000Z
import React, {Component} from "react"; import Helmet from "react-helmet"; // @material-ui/core components import withStyles from "@material-ui/core/styles/withStyles"; import AddAlert from "@material-ui/icons/AddAlert"; // core components import PortfolioCard from "components/Card/PortfolioCard"; import Grid from '@material-ui/core/Grid'; import GridItem from "material-dashboard-react/dist/components/Grid/GridItem"; import GridContainer from "material-dashboard-react/dist/components/Grid/GridContainer"; import Card from "material-dashboard-react/dist/components/Card/Card"; import CardHeader from "material-dashboard-react/dist/components/Card/CardHeader"; import CardAvatar from "material-dashboard-react/dist/components/Card/CardAvatar"; import CardBody from "material-dashboard-react/dist/components/Card/CardBody"; import Snackbar from "material-dashboard-react/dist/components/Snackbar/Snackbar"; import { tryGetUserProfile, userProfileReset } from "redux/user/Actions.js"; import MessageCard from "components/Card/MessageCard"; import default_image from "assets/img/faces/default_image.png"; import connect from "react-redux/es/connect/connect"; import { getCookie, LOGGEDIN_USERID_COOKIE } from "services/cookies"; const styles = { cardCategoryWhite: { color: "rgba(255,255,255,.62)", margin: "0", fontSize: "14px", marginTop: "0", marginBottom: "0" }, cardTitleWhite: { color: "#FFFFFF", marginTop: "0px", minHeight: "auto", fontWeight: "300", fontFamily: "'Roboto', 'Helvetica', 'Arial', sans-serif", marginBottom: "3px", textDecoration: "none" } }; class OtherUserProfile extends Component { constructor(props) { super(props); // we use this to make the card to appear after the page has been rendered this.state = { cardAnimaton: "cardHidden", user: {}, open: false, place: 'tr', notificationMessage: '', updateProfile: false, updatePassword: false, gender: -2, type: -1, portfolios: [] }; } componentDidMount() { const { user_id } = this.props.match.params; const loggedin_user_id = getCookie(LOGGEDIN_USERID_COOKIE); const { history } = this.props; if (user_id === loggedin_user_id) { history.push("/home/profile"); } if (user_id === undefined) { history.push("/home/index"); } this.props.tryGetUserProfile(user_id); } componentDidUpdate(prevProps, prevState) { const { getUserProfileInProgress, getUserProfileHasError, getUserProfileCompleted, user} = this.props.user; if (!getUserProfileInProgress && !getUserProfileHasError && getUserProfileCompleted) { this.setState({ user: user, full_name: user.full_name, bio: user.bio, gender: user.gender, type: user.type, portfolios: user.portfolios }); this.props.userProfileReset(); } } render() { const {classes} = this.props; const { user, portfolios } = this.state; var porfolio_grid = ( <GridContainer> {portfolios.map((prop, key) => { return ( <GridItem xs={12} sm={12} md={12} key={key}> <PortfolioCard portfolio_id={prop.id} title={prop.title} description={prop.description} attachments={prop.attachments} date={prop.date} project_id={prop.project_id} tags={prop.tags} /> </GridItem> ); })} </GridContainer> ); return ( <div> <div> <Helmet title='Profile Page' meta={[ {property: 'og:title', content: 'Profile Page'}, ]}/> </div> <GridContainer> <GridItem xs={12} sm={12} md={8}> <Card> <CardHeader color="primary"> <Grid container> <Grid item xs={11}> <h4 className={classes.cardTitleWhite}>{"Portfolio"}</h4> <p className={classes.cardCategoryWhite}>Fill your portfolio</p> </Grid> </Grid> </CardHeader> <CardBody> {porfolio_grid} </CardBody> </Card> </GridItem> <GridItem xs={12} sm={12} md={4}> <Card profile> <CardAvatar profile> <img src={process.env.REACT_APP_API_STATIC_URL + "profile_images/" + user.profile_image} onError={(e) => { e.target.onerror = null; e.target.src = default_image }} alt="..."/> </CardAvatar> <CardBody profile> <h6 className={classes.cardCategory}> {typeof user.type === "undefined" || user.type === null ? "User Type Not Set" : user.type ? "Client" : "Freelancer"} </h6> <h4 className={classes.cardTitle}> {user.full_name ? user.full_name : ""} <br/> {user.email ? user.email : ""} </h4> <p className={classes.description}> {user.bio ? user.bio : ""} </p> <MessageCard projectOwner={user.id}></MessageCard> </CardBody> </Card> </GridItem> </GridContainer> <Snackbar place={this.state.place} icon={AddAlert} color={this.state.color} message={this.state.notificationMessage} open={this.state.open} closeNotification={() => this.setState({open: false})} close /> </div> ); } } function bindAction(dispatch) { return { tryGetUserProfile: (user_id) => dispatch(tryGetUserProfile(user_id)), userProfileReset: () => dispatch(userProfileReset()), }; } const mapStateToProps = state => ({ user: state.user }); export default connect( mapStateToProps, bindAction )(withStyles(styles)(OtherUserProfile));
38.608247
152
0.473431
false
true
true
false
d00ad4eb4c60a2affd6b64f49a0154961c1349b7
548
jsx
JSX
apps/frontend/src/main.jsx
DBuckley0126/n-back-task
2dfc1abb6a94a295a6b9885ec097c9013273df53
[ "MIT" ]
null
null
null
apps/frontend/src/main.jsx
DBuckley0126/n-back-task
2dfc1abb6a94a295a6b9885ec097c9013273df53
[ "MIT" ]
null
null
null
apps/frontend/src/main.jsx
DBuckley0126/n-back-task
2dfc1abb6a94a295a6b9885ec097c9013273df53
[ "MIT" ]
null
null
null
import { StrictMode } from 'react' import { getTheme } from '@n-back-task/ui' import { Provider } from 'react-redux' import { ThemeProvider } from '@material-ui/core/styles' import * as ReactDOM from 'react-dom' import App from './app/App' import RootLayout from './app/layouts/RootLayout' import store from './store' ReactDOM.render( <Provider store={store}> <StrictMode> <ThemeProvider theme={getTheme()}> <RootLayout> <App /> </RootLayout> </ThemeProvider> </StrictMode> </Provider>, document.getElementById('root') )
24.909091
56
0.693431
true
false
false
true
d00af3567e960ce3e2f1479218b510005dff4b18
1,305
jsx
JSX
src/components/Modal/CloseModalButton.jsx
JoshMDiaz/diazre
056c8a44b57934ca9c548f98795ccded004674e4
[ "MIT" ]
null
null
null
src/components/Modal/CloseModalButton.jsx
JoshMDiaz/diazre
056c8a44b57934ca9c548f98795ccded004674e4
[ "MIT" ]
null
null
null
src/components/Modal/CloseModalButton.jsx
JoshMDiaz/diazre
056c8a44b57934ca9c548f98795ccded004674e4
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import PropTypes from 'prop-types' import x from '../../images/x.svg' import xDark from '../../images/x_dark.svg' class CloseModalButton extends Component { constructor(props) { super(props); this.state = { circleClass: '' } } showCircleClass = () => { this.setState({ circleClass: 'show-circle' }); } hideCircleClass = () => { this.setState({ circleClass: 'hide-circle' }); } render() { const { circleClass } = this.state, { closeModal, darkIcon } = this.props; return ( <span className={`close cursor-pointer ${circleClass} ${darkIcon ? 'dark' : ''}`} onMouseEnter={this.showCircleClass} onMouseLeave={this.hideCircleClass} onClick={closeModal}> { darkIcon ? ( <img src={xDark} alt="x" className="icon"/> ) : ( <img src={x} alt="x" className="icon"/> )} <svg className="circle-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2"> <circle className="path circle" fill="none" cx="65.1" cy="65.1" r="62.1"/> </svg> </span> ); } } export default CloseModalButton; CloseModalButton.proptypes = { closeModal: PropTypes.func.isRequired, darkIcon: PropTypes.bool };
26.632653
181
0.596169
false
true
true
false
d00afef8429562b5a1ea4d880d6b2b765a80405c
401
jsx
JSX
app/src/components/PrivateRoute/index.jsx
Build-Week-the-subreddit-predictor-intl/Front-End
52b6b7ea3a5b3b5830e72d624e03486a65a5aab5
[ "MIT" ]
null
null
null
app/src/components/PrivateRoute/index.jsx
Build-Week-the-subreddit-predictor-intl/Front-End
52b6b7ea3a5b3b5830e72d624e03486a65a5aab5
[ "MIT" ]
38
2019-11-19T13:38:53.000Z
2022-03-15T19:58:36.000Z
app/src/components/PrivateRoute/index.jsx
Build-Week-the-subreddit-predictor-intl/Front-End
52b6b7ea3a5b3b5830e72d624e03486a65a5aab5
[ "MIT" ]
1
2019-11-18T04:39:01.000Z
2019-11-18T04:39:01.000Z
import React from "react"; import { Route, Redirect } from "react-router-dom"; const isAuthed = () => { return localStorage.getItem("token") ? true : false; }; const PrivateRoute = ({ children, ...rest }) => { return ( <Route {...rest} render={() => isAuthed() ? children : <Redirect to={{ pathname: "/login" }} /> } /> ); }; export default PrivateRoute;
19.095238
72
0.55611
false
true
false
true
d00b0621abf5885cad7ffa79bb503599ee0dcbfb
3,781
jsx
JSX
src/components/organisms/chartElements/HorizontalStackedBarChartContainer.jsx
andras-szesztai/boring-bar-chart-gatsby
231c84808e240be985a359acfbe4a7c3757881f5
[ "MIT" ]
null
null
null
src/components/organisms/chartElements/HorizontalStackedBarChartContainer.jsx
andras-szesztai/boring-bar-chart-gatsby
231c84808e240be985a359acfbe4a7c3757881f5
[ "MIT" ]
7
2020-04-04T07:24:54.000Z
2020-04-07T17:08:35.000Z
src/components/organisms/chartElements/HorizontalStackedBarChartContainer.jsx
andras-szesztai/boring-bar-chart-gatsby
231c84808e240be985a359acfbe4a7c3757881f5
[ "MIT" ]
null
null
null
import React, { useState, useEffect } from "react" import _ from "lodash" import { FlexContainer, GridContainer } from "../../atoms" import { usePrevious } from "../../../hooks" import { HorizontalStackedBar } from "../../molecules" function getResultsData(data) { const orderedList = ["Lose", "Draw", "Win"] const totalLength = data.length const groupped = _.groupBy(data, "result") let percentagesObject = {} orderedList.forEach( el => (percentagesObject = { ...percentagesObject, [el]: groupped[el].length / totalLength, }) ) return percentagesObject } export default function({ data: { unfiltered, periodFiltered }, isFiltered, colorRange, results, isTooltip, withNumber, }) { const prevIsFiltered = usePrevious(isFiltered) const prevPeriodFiltered = usePrevious(periodFiltered) const prevUnfiltered = usePrevious(unfiltered) const [state, setState] = useState({ isInitialized: false, resultData: { unfilteredResults: undefined, filteredResults: undefined, }, }) const { isInitialized, resultData } = state useEffect(() => { if (!isInitialized && unfiltered) { const resultData = getResultsData(unfiltered) setState({ isInitialized: true, resultData: { unfilteredResults: resultData, filteredResults: resultData, }, }) } if (isInitialized) { if (prevIsFiltered && !isFiltered) { setState(prev => ({ ...prev, resultData: { ...prev.resultData, filteredResults: prev.resultData.unfilteredResults, }, })) } if (periodFiltered.length !== prevPeriodFiltered.length) { setState(prev => ({ ...prev, resultData: { ...prev.resultData, filteredResults: getResultsData(periodFiltered), }, })) } if (unfiltered.length !== prevUnfiltered.length) { setState(prev => ({ ...prev, resultData: { ...prev.resultData, unfilteredResults: getResultsData(unfiltered), }, })) } } // eslint-disable-next-line react-hooks/exhaustive-deps }, [isFiltered, isInitialized, periodFiltered, prevIsFiltered, unfiltered]) const isFilterActive = unfiltered.length !== periodFiltered.length return ( <GridContainer columnGap={0} rows="repeat(2, 1fr)" rowGap={isTooltip ? 1 : 0} columns={(isTooltip && isFilterActive) ? "60px 1fr" : "1fr"} height="100%" width="100%" > {Object.keys(resultData).map((obj, i) => { const isFirst = i === 1 return ( <> {isTooltip && isFilterActive && ( <FlexContainer justify="flex-start" paddingLeft={2} paddingBottom={isFirst && 2} paddingTop={!isFirst && 2} > {isFirst ? "Unfiltered" : "Filtered"} </FlexContainer> )} <FlexContainer key={obj} height="100%" width="100%"> <HorizontalStackedBar withNumber={withNumber} data={resultData[obj]} margin={{ top: !isFirst ? 10 : 0, left: 10, bottom: isFirst ? 10 : 0, right: 10, }} colorRange={colorRange} highlightArray={ isFiltered ? Object.keys(results).filter(d => results[d]) : Object.keys(results) } /> </FlexContainer> </> ) })} </GridContainer> ) }
27.59854
77
0.533457
false
true
false
true
d00b07d11417f0dd7eece69d3f8db8c7d530d479
421
jsx
JSX
client/src/components/tabs/Tab.jsx
mesh029/Urban-50
93618def7eb346c606746a107c0bd4208f9379a7
[ "MIT" ]
null
null
null
client/src/components/tabs/Tab.jsx
mesh029/Urban-50
93618def7eb346c606746a107c0bd4208f9379a7
[ "MIT" ]
null
null
null
client/src/components/tabs/Tab.jsx
mesh029/Urban-50
93618def7eb346c606746a107c0bd4208f9379a7
[ "MIT" ]
null
null
null
import React from 'react' import { Tab } from 'semantic-ui-react' import './tab.css' const TabExampleBasic = ({component}) => <Tab panes={panes} /> const panes=[ { menuItem: 'Tab 1', render: () => <Tab.Pane>{component}</Tab.Pane> }, { menuItem: 'Tab 2', render: () => <Tab.Pane>Tab 2 Content</Tab.Pane> }, { menuItem: 'Tab 3', render: () => <Tab.Pane>Tab 3 Content</Tab.Pane> }, ] export default TabExampleBasic
30.071429
74
0.634204
false
true
false
true
d00b0bb8f5c262f856bce66ccb153aeb1f9ebe72
208
jsx
JSX
vant-cli/base/src/my-icon/index.jsx
cpylua/vant-demo
2a62dc75f87c256fe734acecdcf6c7b0455a71ce
[ "MIT" ]
1,636
2017-11-28T02:11:14.000Z
2022-03-30T17:29:50.000Z
vant-cli/base/src/my-icon/index.jsx
Fabuhaokan/vant-demo
43212a96ed71db319bc7c081710407b5bf8e8501
[ "MIT" ]
86
2017-11-16T02:35:20.000Z
2022-02-16T07:42:56.000Z
vant-cli/base/src/my-icon/index.jsx
Fabuhaokan/vant-demo
43212a96ed71db319bc7c081710407b5bf8e8501
[ "MIT" ]
1,157
2017-11-17T02:09:36.000Z
2022-03-28T07:01:32.000Z
import { Icon } from 'vant'; export default { name: 'my-icon', props: { name: String, dot: Boolean }, render() { return <Icon name={this.name} dot={this.dot} class="my-icon" />; } };
13.866667
68
0.552885
false
true
false
true
d00b19167fa4c4b78924a93845a3915a418ee6e6
1,267
jsx
JSX
src/components/common/footer.jsx
veeqtor/personal-resume
beda86f4e8c06f6f4cc711b405fca4cac9a09fc3
[ "MIT" ]
null
null
null
src/components/common/footer.jsx
veeqtor/personal-resume
beda86f4e8c06f6f4cc711b405fca4cac9a09fc3
[ "MIT" ]
5
2021-03-09T15:11:15.000Z
2022-02-26T16:43:19.000Z
src/components/common/footer.jsx
veeqtor/personal-resume
beda86f4e8c06f6f4cc711b405fca4cac9a09fc3
[ "MIT" ]
null
null
null
import React from "react" import data from "../../data/siteData" const Footer = () => { return ( <footer id="contact"> <h3 className="footer-header wow fadeInUp" data-wow-duration="2s">Get in touch</h3> <div className="footer-contacts wow fadeInUp" data-wow-duration="1s" data-wow-offset="50" > <ul> <li><a href={data.userInfo.socialMediaLinks.twitter} target='_blank' rel="noopener noreferrer" className='tw'>TW</a></li> <li><a href={data.userInfo.socialMediaLinks.linkedIn} target='_blank' rel="noopener noreferrer" className='in'>IN</a></li> <li><a href={data.userInfo.socialMediaLinks.facebook} target='_blank' rel="noopener noreferrer" className='fb'>FB</a></li> <li><a href={`mailto:${data.userInfo.email}`} target='_blank' rel="noopener noreferrer" className='mail'>EMAIL</a></li> </ul> </div> <div className="footer-sub wow fadeInUp" data-wow-duration="2s"> <span>&copy; {new Date().getFullYear()}, Victor Nwokeocha</span> </div> </footer> ) } export default Footer
34.243243
72
0.550908
false
true
false
true
d00b1c4ca0a5f1b14c37461722d24c08344d2d0f
531
jsx
JSX
examples/Convergence.Demo/Convergence.Demo/js/components/chuck_norris/chuck_norris.app.jsx
MValle21/convergence
1a2fb4704c822793984064f53eff7d29703650e0
[ "MIT" ]
4
2017-11-03T13:21:48.000Z
2017-11-09T15:17:58.000Z
examples/Convergence.Demo/Convergence.Demo/js/components/chuck_norris/chuck_norris.app.jsx
MValle21/convergence
1a2fb4704c822793984064f53eff7d29703650e0
[ "MIT" ]
1
2020-04-17T14:36:55.000Z
2020-04-17T14:36:55.000Z
examples/Convergence.Demo/Convergence.Demo/js/components/chuck_norris/chuck_norris.app.jsx
MValle21/convergence
1a2fb4704c822793984064f53eff7d29703650e0
[ "MIT" ]
1
2021-01-14T02:05:00.000Z
2021-01-14T02:05:00.000Z
import React from 'react'; import PropTypes from 'prop-types'; import { Provider } from 'react-redux' import { create } from './store'; import ChuckNorrisContainer from './chuck_norris.container'; const ChuckNorrisApp = ({ state }) => { const local = create(state); return ( <Provider store={local} > <ChuckNorrisContainer /> </Provider> ); }; ChuckNorrisApp.propTypes = { store: PropTypes.object }; ChuckNorrisApp.defaultProps = { store: null }; export default ChuckNorrisApp;
21.24
60
0.659134
false
true
false
true
d00b389c9bc25519783f7a5abab65879405ef3a4
252
jsx
JSX
components/common/LoadingOverlay.jsx
pranavraagz/curator-frontend
af04777769058ad69c6b4c71433ecaaa7ee3800b
[ "Apache-2.0" ]
1
2022-02-04T13:58:52.000Z
2022-02-04T13:58:52.000Z
components/common/LoadingOverlay.jsx
pranavraagz/curator-frontend
af04777769058ad69c6b4c71433ecaaa7ee3800b
[ "Apache-2.0" ]
null
null
null
components/common/LoadingOverlay.jsx
pranavraagz/curator-frontend
af04777769058ad69c6b4c71433ecaaa7ee3800b
[ "Apache-2.0" ]
null
null
null
function LoadingOverlay({ children }) { return ( <div className="fixed w-full h-full fcc backdrop-filter backdrop-blur-sm"> <div className="p-4 rounded-lg bg-opacity-80 fcc ">{children}</div> </div> ) } export default LoadingOverlay
25.2
78
0.68254
false
true
false
true
d00b472c79f7624acdd2ca8dcc6b4efc49fee3d7
1,722
jsx
JSX
src/components/Footer/Footer.jsx
AKi8-itm/akiportfolio2
0ffe18875a98c57fc06339267db29497075f1660
[ "MIT" ]
null
null
null
src/components/Footer/Footer.jsx
AKi8-itm/akiportfolio2
0ffe18875a98c57fc06339267db29497075f1660
[ "MIT" ]
null
null
null
src/components/Footer/Footer.jsx
AKi8-itm/akiportfolio2
0ffe18875a98c57fc06339267db29497075f1660
[ "MIT" ]
null
null
null
import React, { useContext } from 'react'; import { Container } from 'react-bootstrap'; import { Link } from 'react-scroll'; import PortfolioContext from '../../context/context'; import GithubButtons from '../GithubButtons/GithubButtons'; import { githubButtons } from '../../mock/data'; const Footer = () => { const { footer } = useContext(PortfolioContext); const { networks } = footer; const { isEnabled } = githubButtons; return ( <footer className="footer navbar-static-bottom"> <Container> <span className="back-to-top"> <Link to="hero" smooth duration={1000}> <i className="fa fa-angle-up fa-2x" aria-hidden="true" /> </Link> </span> <div className="social-links"> {networks && networks.map((network) => { const { id, name, url } = network; return ( <a key={id} href={url || 'https://github.com/AKi8-itm/AKi8-itm.git'} rel="noopener noreferrer" target="_blank" aria-label={name} > <i className={`fa fa-${name || 'refresh'} fa-inverse`} /> </a> ); })} </div> <hr /> <p className="footer__text"> © {new Date().getFullYear()} - All rights reserved by{' '} <a href="https://github.com/AKi8-itm/AKi8-itm.git" target="_blank" rel="noopener noreferrer"> Akira Fujikawa </a> </p> {isEnabled && <GithubButtons />} </Container> </footer> ); }; export default Footer;
31.888889
104
0.498258
false
true
false
true
d00b6f3a2e3adf120cd12b63526c0aab4c93205b
1,030
jsx
JSX
src/js/App.jsx
Mydayyy/webpack4-react-boilerplate
61f959a85782c02659924dec53bb9777a795871b
[ "MIT" ]
7
2018-05-14T12:37:37.000Z
2020-07-20T18:10:17.000Z
src/js/App.jsx
Mydayyy/webpack4-react-boilerplate
61f959a85782c02659924dec53bb9777a795871b
[ "MIT" ]
8
2018-12-20T02:01:30.000Z
2022-02-26T03:43:48.000Z
src/js/App.jsx
Mydayyy/webpack4-react-boilerplate
61f959a85782c02659924dec53bb9777a795871b
[ "MIT" ]
null
null
null
import React from "react"; import ReactDOM from "react-dom"; import {hot} from "react-hot-loader"; import {Route, Switch, Redirect} from "react-router-dom"; import Page1 from "~/pages/Page1/Page1"; import Page2 from "~/pages/Page2/Page2"; class App extends React.Component { constructor(props) { super(props); this.state = {}; } render() { return ( <div id="app"> <Switch> <Route exact={true} name="/" path="/" component={Page1} /> <Route exact={true} name="page1" path="/page1" component={Page1} /> <Route exact={true} name="page2" path="/page2" component={Page2} /> <Route render={function() { return <h1>We found exactly zero pages at the path you were looking for. Sorry!</h1>; }} /> </Switch> </div> ); } } export default hot(module)(App);
29.428571
113
0.496117
false
true
true
false
d00b8707ab2b7783ce844089850500eb5bd88156
476
jsx
JSX
src/react-context/src/main.jsx
daviddesmet/playground
8eb0abbe545f17907fd3c8ac4b0601b184618e14
[ "MIT" ]
null
null
null
src/react-context/src/main.jsx
daviddesmet/playground
8eb0abbe545f17907fd3c8ac4b0601b184618e14
[ "MIT" ]
null
null
null
src/react-context/src/main.jsx
daviddesmet/playground
8eb0abbe545f17907fd3c8ac4b0601b184618e14
[ "MIT" ]
null
null
null
import "simplebar/src/simplebar.css"; import React from "react"; import ReactDOM from "react-dom"; import { BrowserRouter } from "react-router-dom"; import { HelmetProvider } from "react-helmet-async"; import ContextWrapper from "./ContextWrapper"; import App from "./App"; ReactDOM.render( <HelmetProvider> <BrowserRouter> <ContextWrapper> <App /> </ContextWrapper> </BrowserRouter> </HelmetProvider>, document.getElementById("root") );
21.636364
52
0.697479
false
true
false
true
d00ba15b40d29596173e5ee476d9f75f2aaa717a
1,812
jsx
JSX
src/index.jsx
real-fakeuser/FluxReduxSiteSearchTapp
f6006c27f734b03ff0a3229f69bd400dc672ffba
[ "MIT" ]
1
2017-09-05T06:42:22.000Z
2017-09-05T06:42:22.000Z
src/index.jsx
real-fakeuser/FluxReduxSiteSearchTapp
f6006c27f734b03ff0a3229f69bd400dc672ffba
[ "MIT" ]
null
null
null
src/index.jsx
real-fakeuser/FluxReduxSiteSearchTapp
f6006c27f734b03ff0a3229f69bd400dc672ffba
[ "MIT" ]
2
2017-09-05T06:42:25.000Z
2018-09-04T09:40:18.000Z
import React from 'react'; import ReactDOM from 'react-dom'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import immutable from 'immutable'; import { ModeSwitch } from 'chayns-components'; import App from './components/App'; import rootReducer from './reducers'; import SERVER_URL from './constants/server-url'; import { loadData } from './actions/fetchData'; /** * The function waits till the chayns api is successfully loaded and * every additional functionality of it is ready to go, * renders the App component then * and finally initializes the ModeSwitch. * @return {Promise.<void>} */ async function init() { console.debug('ServerUrl for current environment:', SERVER_URL); if (__DEV__ || __STAGING__) { const installDevTools = require('immutable-devtools'); installDevTools(immutable); } const storeMiddleware = [thunk]; if (__DEV__ || __STAGING__) { storeMiddleware.push(require('redux-logger').default); } console.log(storeMiddleware); const store = createStore( rootReducer, applyMiddleware(...storeMiddleware) ); await chayns.ready; const tappElement = document.querySelector('.tapp'); ReactDOM.render(<Provider store={store}> <App/> </Provider>, tappElement); /** * Initialize the ModeSwitch. The available modes are 'user mode' (default) and 'chayns® manager'. * You can specify content to display according to the current mode (see chayns 'mode' component). */ ModeSwitch.init({ groups: [{ id: 1, uacIds: [1], name: 'chayns® manager' }] }); // dispatch async example action store.dispatch(loadData()); } init();
28.3125
102
0.661148
false
true
false
true
d00baac12e468cb2c568fa35eb80687304dfcac0
1,225
jsx
JSX
packages/terra-paginator/src/terra-dev-site/doc/paginator/ProgressivePaginator.3.doc.jsx
CompSciLauren/terra-core
6e84583b6841055f49bd4a52ebeb23a378a43384
[ "Apache-2.0" ]
null
null
null
packages/terra-paginator/src/terra-dev-site/doc/paginator/ProgressivePaginator.3.doc.jsx
CompSciLauren/terra-core
6e84583b6841055f49bd4a52ebeb23a378a43384
[ "Apache-2.0" ]
null
null
null
packages/terra-paginator/src/terra-dev-site/doc/paginator/ProgressivePaginator.3.doc.jsx
CompSciLauren/terra-core
6e84583b6841055f49bd4a52ebeb23a378a43384
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import DocTemplate from 'terra-doc-template'; import ReadMe from '../../../../docs/ProgressiveREADME.md'; import { name, version } from '../../../../package.json'; // Example Files import ProgressivePaginatorPropsTable from '!terra-props-table-loader!../../../../src/ProgressivePaginator'; import ProgressivePaginatorSrc from '!raw-loader!../../../../src/ProgressivePaginator'; import ProgressivePaginatorExample from '../example/ProgressivePaginatorExample'; import ProgressivePaginatorExampleSrc from '!raw-loader!../../../../src/terra-dev-site/doc/example/ProgressivePaginatorExample'; const DocPage = () => ( <DocTemplate packageName={name} packageVersion={version} readme={ReadMe} srcPath={`https://github.com/cerner/terra-core/tree/master/packages/${name}`} examples={[ { title: 'Progressive Paginator Example', example: <ProgressivePaginatorExample />, source: ProgressivePaginatorExampleSrc, }, ]} propsTables={[ { componentName: 'Progressive Paginator', componentSrc: ProgressivePaginatorSrc, componentProps: ProgressivePaginatorPropsTable, }, ]} /> ); export default DocPage;
33.108108
128
0.688163
false
true
false
true
d00bb486aa9d544ad0ee2da2db877e2720466349
2,646
jsx
JSX
src/components/VolunteerLogs/VolunteerLogsRows.jsx
ctc-uci/oc-habitats-frontend
fe1aa6321af53d65e87f4ae057484f1e39aa9063
[ "MIT" ]
null
null
null
src/components/VolunteerLogs/VolunteerLogsRows.jsx
ctc-uci/oc-habitats-frontend
fe1aa6321af53d65e87f4ae057484f1e39aa9063
[ "MIT" ]
58
2021-11-01T02:17:36.000Z
2022-03-31T21:31:27.000Z
src/components/VolunteerLogs/VolunteerLogsRows.jsx
ctc-uci/oc-habitats-frontend
fe1aa6321af53d65e87f4ae057484f1e39aa9063
[ "MIT" ]
null
null
null
import { Button, Checkbox, Icon } from '@chakra-ui/react'; import PropTypes from 'prop-types'; import { React } from 'react'; import { FiEdit3 } from 'react-icons/fi'; import { Link } from 'react-router-dom'; const DateFormat = ({ date }) => { return new Date(date).toLocaleDateString(); }; const Check = ({ checked, setChecked, id }) => { return ( <Checkbox bg="white" isChecked={checked.get(id)} onChange={event => { if (event.target.checked) { const remainingChecks = new Map(checked); remainingChecks.set(id, true); setChecked(remainingChecks); } else { const remainingChecks = new Map(checked); remainingChecks.set(id, false); setChecked(remainingChecks); } }} /> ); }; const AllCheck = ({ checked, setChecked, allChecked, setAllChecked }) => { const handleAllChecked = () => { const newCheckedData = new Map(checked); if (allChecked) { newCheckedData.forEach((value, keys) => { newCheckedData.set(keys, false); }); } else { newCheckedData.forEach((value, keys) => { newCheckedData.set(keys, true); }); } setAllChecked(!allChecked); setChecked(newCheckedData); }; return <Checkbox bg="white" isChecked={allChecked} onChange={handleAllChecked} />; }; const Partners = ({ sessionPartners }) => { if (sessionPartners.length === 0) { return ''; } const names = sessionPartners.map( partner => `${partner.firstName.charAt(0)}. ${partner.lastName}`, ); return <p>{names.join(', ')}</p>; }; const EditButton = ({ logId, approval }) => { // console.log(logId); if (approval === 'APPROVED') { return ''; } return ( <Link to={`/create-log/${logId}`}> <Button bgColor="transparent" minW={2} h={6} px={2}> <Icon h={{ md: 5, base: 4 }} w={{ md: 5, base: 4 }} as={FiEdit3} /> </Button> </Link> ); }; Check.propTypes = { // eslint-disable-next-line react/forbid-prop-types checked: PropTypes.object.isRequired, setChecked: PropTypes.func.isRequired, id: PropTypes.string.isRequired, }; AllCheck.propTypes = { // eslint-disable-next-line react/forbid-prop-types checked: PropTypes.object.isRequired, setChecked: PropTypes.func.isRequired, allChecked: PropTypes.bool.isRequired, setAllChecked: PropTypes.func.isRequired, }; Partners.propTypes = { sessionPartners: PropTypes.arrayOf(Object).isRequired, }; EditButton.propTypes = { logId: PropTypes.string.isRequired, approval: PropTypes.string.isRequired, }; export { DateFormat, Check, AllCheck, Partners, EditButton };
26.46
84
0.629252
false
true
false
true
d00be9e644b051a6cf21e25a8ae1573098e474ee
1,791
jsx
JSX
components/AcknowledgementsView.jsx
TheStanfordDaily/archives-web
7e3f6351a64fd28270ead41d68dfe4908be64424
[ "Apache-2.0" ]
2
2019-05-13T17:36:04.000Z
2019-12-02T10:08:26.000Z
components/AcknowledgementsView.jsx
TheStanfordDaily/archives-web
7e3f6351a64fd28270ead41d68dfe4908be64424
[ "Apache-2.0" ]
80
2019-05-11T06:11:36.000Z
2021-12-09T01:38:09.000Z
components/AcknowledgementsView.jsx
TheStanfordDaily/archives-web
7e3f6351a64fd28270ead41d68dfe4908be64424
[ "Apache-2.0" ]
1
2019-11-15T03:09:34.000Z
2019-11-15T03:09:34.000Z
import React from "react"; import { STRINGS } from "../helpers/constants"; class AcknowledgementsView extends React.Component { componentDidMount() { document.title = "Acknowledgements" + STRINGS.SITE_NAME_WITH_DIVIDER; } render() { return ( <div className="AcknowledgementsMainView"> <div className="AcknowledgementsContent"> <h1>Acknowledgements</h1> <p> The Stanford Daily Archives would not have been possible without the vision and determination of Charlie Hoffman '73, MBA '76. Hoffman, the editor-in-chief of Vol. 163, worked tirelessly to oversee the life of this project, ensuring that we could present more than 120 years of Stanford history in its original form. For that, and for all of his dedication to The Daily, we are grateful. </p> <p> We would also like to acknowledge the hard work of Ed Kohn '73, whose assistance was an integral part of the archives launch, and the continued support of The Friends of The Stanford Daily Foundation. </p> <p> The Stanford Daily thanks the following for sponsoring digitized volumes: </p> <ul> <li>Ben Hur</li> <li>Rich Jaroslovsky</li> <li>Ivan Maisel</li> <li>Devin Banerjee</li> <li>Elise McDonald</li> </ul> <p> The Stanford Daily Archives website was revamped and redesigned in 2019 (Vol. 255-256) by The Daily's Tech Team led by Ashwin Ramaswami '21 and Yifei He '22. </p> </div> </div> ); } } export default AcknowledgementsView;
35.82
80
0.592965
false
true
true
false
d00bee3466da407f71bb179ba8a6481bd0e33e2f
573
jsx
JSX
tour/components/slides/Create.jsx
imajeet/Manta
afaa38c548ffc2551ecdbec6249276e740d277e9
[ "CC0-1.0" ]
1
2017-12-31T14:44:27.000Z
2017-12-31T14:44:27.000Z
tour/components/slides/Create.jsx
SebastianGaud/Manta
06c753ed7063454e720f4afeb33ebf5eb58c2e5c
[ "CC0-1.0" ]
1
2021-05-09T10:32:37.000Z
2021-05-09T10:32:37.000Z
tour/components/slides/Create.jsx
SebastianGaud/Manta
06c753ed7063454e720f4afeb33ebf5eb58c2e5c
[ "CC0-1.0" ]
null
null
null
import React from 'react'; import path from 'path'; import Slide from '../Slide'; const description = ` Manta has a flexible form interface. It keeps things simple by default but you can always turn on/off additional fields whenever you find necessary. `; console.log('__dirname: ', __dirname); function Create() { return ( <Slide fromColor="#85E5A9" toColor="#26BB86" heading="Step 1. Create" description={description} imgSrc={path.resolve(__dirname, './imgs/Create.svg')} imgSize="350px" /> ); } export default Create;
22.92
148
0.675393
false
true
false
true
d00bf06fff9e855e3377f25ae9c58bf7611b1b97
6,441
jsx
JSX
src/_metronic/partials/layout/MenuModal.jsx
gloffer/crypto
5c7d5a82255687c6bc08e82a0554f40140f6b762
[ "MIT" ]
null
null
null
src/_metronic/partials/layout/MenuModal.jsx
gloffer/crypto
5c7d5a82255687c6bc08e82a0554f40140f6b762
[ "MIT" ]
null
null
null
src/_metronic/partials/layout/MenuModal.jsx
gloffer/crypto
5c7d5a82255687c6bc08e82a0554f40140f6b762
[ "MIT" ]
null
null
null
/* eslint-disable react-hooks/exhaustive-deps */ /* eslint-disable jsx-a11y/anchor-is-valid */ import React, { useEffect, useRef } from 'react'; import { Modal } from 'react-bootstrap-v5'; import { Link, useLocation } from 'react-router-dom'; import { KTSVG, toAbsoluteUrl } from '../../helpers'; const MenuModal = ({ show, handleClose, children }) => { const location = useLocation(); const isFirstRef = useRef(true); useEffect(() => { if (isFirstRef.current) { isFirstRef.current = false; } else { handleClose(); } }, [location]); return (<Modal className='bg-white' id='kt_mega_menu_modal' aria-hidden='true' tabIndex='-1' dialogClassName='modal-fullscreen' contentClassName='shadow-none' show={show}> <div className='container-xxl'> <div className='modal-header d-flex align-items-center justify-content-between border-0'> <div className='d-flex align-items-center'> {/* begin::Logo */} <Link to='/'> <img alt='logo' className='h-30px' src={toAbsoluteUrl('/media/logos/logo-default.svg')}/> </Link> {/* end::Logo */} </div> {/* begin::Close */} <div className='btn btn-icon btn-sm btn-light-primary ms-2' onClick={handleClose}> <KTSVG path='/media/icons/duotune/arrows/arr061.svg' className='svg-icon-2'/> </div> {/* end::Close */} </div> <div className='modal-body'> {/* begin::Row */} <div className='row py-10 g-5'> {/* begin::Column */} <div className='col-lg-6 pe-lg-25'>{children}</div> {/* end::Column */} {/* begin::Column */} <div className='col-lg-6'> <h3 className='fw-bolder mb-8'>Quick Links</h3> {/* begin::Row */} <div className='row g-5'> <div className='col-sm-4'> <a href='#' className='card card-custom bg-light-success hoverable min-h-125px shadow-none mb-5'> <div className='card-body d-flex flex-column flex-center'> <h3 className='fs-3 mb-2 text-dark fw-bolder'>Security</h3> <p className='mb-0 text-gray-600'>$2.99/month</p> </div> </a> </div> <div className='col-sm-4'> <a href='#' className='card card-custom bg-light-danger hoverable min-h-125px shadow-none mb-5'> <div className='card-body d-flex flex-column flex-center text-center'> <h3 className='fs-3 mb-2 text-dark fw-bolder'>Demo</h3> <p className='mb-0 text-gray-600'>Free Version</p> </div> </a> </div> <div className='col-sm-4'> <a href='#' className='card card-custom bg-light-warning hoverable min-h-125px shadow-none mb-5'> <div className='card-body d-flex flex-column flex-center text-center'> <h3 className='fs-3 mb-2 text-dark text-hover-primary fw-bolder'>Try Now</h3> <p className='mb-0 text-gray-600'>Pro Version</p> </div> </a> </div> </div> {/* end::Row */} {/* begin::Row */} <div className='row g-5'> <div className='col-sm-8'> <a href='#' className='card card-custom bg-light-primary hoverable min-h-125px shadow-none mb-5'> <div className='card-body d-flex flex-column flex-center text-center'> <h3 className='fs-3 mb-2 text-dark fw-bolder'>Payment Methods</h3> <p className='mb-0 text-gray-600'> Credit Cards/Debit Cards, Paypal, <br /> Transferwise & Others </p> </div> </a> {/* begin::Row */} <div className='row g-5'> <div className='col-sm-6'> <a className='card card-custom bg-light-warning hoverable shadow-none min-h-125px mb-5'> <div className='card-body d-flex flex-column flex-center text-center'> <h3 className='fs-3 mb-2 text-dark fw-bolder'>Support</h3> <p className='mb-0 text-gray-600'>6 Month Free</p> </div> </a> </div> <div className='col-sm-6'> <a href='#' className='card card-custom bg-light-success hoverable shadow-none min-h-125px mb-5'> <div className='card-body d-flex flex-column flex-center text-center'> <h3 className='fs-3 mb-2 text-dark fw-bolder'>Installation</h3> <p className='mb-0 text-gray-600'>$0.99 Per Machine</p> </div> </a> </div> </div> {/* end::Row */} </div> <div className='col-sm-4'> <a href='#' className='card card-custom card-stretch mb-5 bg-light-info hoverable shadow-none min-h-250px'> <div className='card-body d-flex flex-column p-0'> <div className='d-flex flex-column flex-center text-center px-5 pt-10'> <h3 className='fs-3 mb-2 text-dark fw-bolder'>Quick Start</h3> <p className='mb-0 text-gray-600'>Single Click Import</p> </div> <div className='flex-grow-1 bgi-no-repeat bgi-size-contain bgi-position-x-center bgi-position-y-bottom card-rounded-bottom' style={{ backgroundImage: `url('${toAbsoluteUrl('/media/illustrations/terms-1.png')}')`, }}/> </div> </a> </div> </div> {/* end::Row */} </div> {/* end::Column */} </div> {/* end::Row */} </div> </div> </Modal>); }; export { MenuModal };
48.428571
176
0.475858
false
true
false
true
d00bfd14c2b2e7963202baadeecbaf50ef89276f
4,979
jsx
JSX
web/client/examples/scalebar/app.jsx
ComputingFreedomCollective/MapStore2
b8a0ddbcae3b980b0fa53be356e6ca10f0fdd13e
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
web/client/examples/scalebar/app.jsx
ComputingFreedomCollective/MapStore2
b8a0ddbcae3b980b0fa53be356e6ca10f0fdd13e
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
web/client/examples/scalebar/app.jsx
ComputingFreedomCollective/MapStore2
b8a0ddbcae3b980b0fa53be356e6ca10f0fdd13e
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
const PropTypes = require('prop-types'); /** * Copyright 2015, GeoSolutions Sas. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ var React = require('react'); var ReactDOM = require('react-dom'); var DebugUtils = require('../../utils/DebugUtils').default; var {connect} = require('react-redux'); var {bindActionCreators, combineReducers} = require('redux'); var {Provider} = require('react-redux'); var {changeBrowserProperties} = require('../../actions/browser'); var ConfigUtils = require('../../utils/ConfigUtils').default; var Debug = require('../../components/development/Debug'); var mapConfig = require('../../reducers/map').default; var browser = require('../../reducers/browser').default; var LMap = require('../../components/map/leaflet/Map'); var LLayer = require('../../components/map/leaflet/Layer'); var {changeMapView, changeZoomLevel} = require('../../actions/map'); var ScaleBox = require("../../components/mapcontrols/scale/ScaleBox"); var BootstrapReact = require('react-bootstrap'); var Grid = BootstrapReact.Grid; var Row = BootstrapReact.Row; var Col = BootstrapReact.Col; // Here we create the store, we use Debug utils but is not necessary // Insteed we need to pass here map configuration var store = DebugUtils.createDebugStore(combineReducers({browser, mapConfig}), {mapConfig: { zoom: 14, center: { y: 48.87, x: 2.32, crs: "EPSG:4326" }, projection: "EPSG:900913" }, browser: {}}); require('../../components/map/leaflet/plugins/TileProviderLayer'); /** * Detect Browser's properties and save in app state. **/ store.dispatch(changeBrowserProperties(ConfigUtils.getBrowserProperties())); const zoomLabelArray = ['-----------', '----------', '---------', '-------', '-------', '------', '-----', '----', '---', '--', '-', '+', '++', '+++', '++++', '+++++', '++++++', '+++++++', '++++++++', '+++++++++', '++++++++++', '+++++++++++' ]; class MyMap extends React.Component { static propTypes = { mapConfig: ConfigUtils.PropTypes.config, changeMapView: PropTypes.func, changeZoomLevel: PropTypes.func, browser: PropTypes.object, zoom: PropTypes.number }; static defaultProps = {}; render() { return (<div id="viewer" > <LMap key="map" center={this.props.mapConfig.center} zoom={this.props.mapConfig.zoom} projection={this.props.mapConfig.projection} onMapViewChanges={this.manageNewMapView} > <LLayer type="tileprovider" position={0} key="Staeman" options={{name: "Stamen", provider: "Stamen.TonerBackground"}} /> </LMap> <Grid fluid={false} className="scalebargrid"> <Row> <Col lg={2} md={3} xs={4}> <ScaleBox id="scaleBox" key="scaleBox" onChange={this.props.changeZoomLevel} currentZoomLvl={this.props.mapConfig.zoom} /> </Col> <Col lg={2} lgOffset={3} md={3} mdOffset={1} xs={4}> <ScaleBox id="scaleBox2" key="scaleBox2" template={ (scale, index) => { return index + 1; } } onChange={this.props.changeZoomLevel} currentZoomLvl={this.props.mapConfig.zoom} /> </Col> <Col lg={2} lgOffset={3} md={3} mdOffset={2} xs={4} className="scaleBox1"> <ScaleBox id="scaleBox1" key="scaleBox1" template={ (scale, index) => { return zoomLabelArray[index]; } } onChange={this.props.changeZoomLevel} currentZoomLvl={this.props.mapConfig.zoom} /> </Col> </Row> </Grid> </div>) ; } manageNewMapView = (center, zoom, bbox, size, mapStateSource) => { this.props.changeMapView(center, zoom, bbox, size, mapStateSource); }; } let App = connect((state) => { return { mapConfig: state.mapConfig, browser: state.browser }; }, dispatch => { return bindActionCreators({changeMapView, changeZoomLevel}, dispatch); })(MyMap); ReactDOM.render( <Provider store={store}> <div> <App /> <Debug/> </div> </Provider>, document.getElementById('container') );
34.818182
136
0.512954
false
true
true
false
d00c263205868ded6d854a861fa0999801af1018
4,615
jsx
JSX
app/components/type/EditModal.jsx
git9am/actionview-fe
eabc08b4807e2f84fad60873c1866b66b7d8907e
[ "Apache-2.0" ]
null
null
null
app/components/type/EditModal.jsx
git9am/actionview-fe
eabc08b4807e2f84fad60873c1866b66b7d8907e
[ "Apache-2.0" ]
null
null
null
app/components/type/EditModal.jsx
git9am/actionview-fe
eabc08b4807e2f84fad60873c1866b66b7d8907e
[ "Apache-2.0" ]
null
null
null
import React, { PropTypes, Component } from 'react'; import { reduxForm } from 'redux-form'; import { Modal, Button, ControlLabel, FormControl, FormGroup, HelpBlock } from 'react-bootstrap'; import Select from 'react-select'; import _ from 'lodash'; import { notify } from 'react-notify-toast'; const img = require('../../assets/images/loading.gif'); const validate = (values, props) => { const errors = {}; if (!values.name) { errors.name = '必填'; } else if (props.data.name !== values.name && _.findIndex(props.collection || [], { name: values.name }) !== -1) { errors.name = '该名称已存在'; } if (!values.abb) { errors.abb = '必填'; } else { const pattern = new RegExp(/^[a-zA-Z0-9]/); if (!pattern.test(values.abb)) { errors.abb = '格式有误'; } else if (props.data.abb !== values.abb && _.findIndex(props.collection || [], { abb: values.abb }) !== -1) { errors.abb = '该缩码已存在'; } } return errors; }; @reduxForm({ form: 'type', fields: ['id', 'name', 'abb', 'description'], validate }) export default class EditModal extends Component { constructor(props) { super(props); this.state = { ecode: 0 }; this.handleSubmit = this.handleSubmit.bind(this); this.handleCancel = this.handleCancel.bind(this); } static propTypes = { i18n: PropTypes.object.isRequired, submitting: PropTypes.bool, invalid: PropTypes.bool, dirty: PropTypes.bool, values: PropTypes.object, fields: PropTypes.object, handleSubmit: PropTypes.func.isRequired, close: PropTypes.func.isRequired, data: PropTypes.object.isRequired, initializeForm: PropTypes.func.isRequired, update: PropTypes.func.isRequired } componentWillMount() { const { initializeForm, data } = this.props; initializeForm({ ...data }); } async handleSubmit() { const { values, update, close } = this.props; const ecode = await update(values); if (ecode === 0) { this.setState({ ecode: 0 }); close(); notify.show('更新完成。', 'success', 2000); } else { this.setState({ ecode: ecode }); } } handleCancel() { const { close, submitting } = this.props; if (submitting) { return; } this.setState({ ecode: 0 }); close(); } render() { const { i18n: { errMsg }, fields: { id, name, abb, description }, handleSubmit, invalid, dirty, submitting, data } = this.props; if (abb.value) { abb.value = abb.value.toUpperCase(); abb.value = abb.value.substring(0, 1); } return ( <Modal show onHide={ this.handleCancel } backdrop='static' aria-labelledby='contained-modal-title-sm'> <Modal.Header closeButton style={ { background: '#f0f0f0', height: '50px' } }> <Modal.Title id='contained-modal-title-la'>{ '编辑问题类型 - ' + data.name }</Modal.Title> </Modal.Header> <form onSubmit={ handleSubmit(this.handleSubmit) } onKeyDown={ (e) => { if (e.keyCode == 13) { e.preventDefault(); } } }> <Modal.Body> <FormGroup controlId='formControlsText' validationState={ name.touched && name.error ? 'error' : null }> <ControlLabel><span className='txt-impt'>*</span>名称</ControlLabel> <FormControl type='hidden' { ...id }/> <FormControl disabled={ submitting } type='text' { ...name } placeholder='问题类型名'/> { name.touched && name.error && <HelpBlock style={ { float: 'right' } }>{ name.error }</HelpBlock> } </FormGroup> <FormGroup controlId='formControlsText' validationState={ abb.touched && abb.error ? 'error' : null }> <ControlLabel><span className='txt-impt'>*</span>缩码</ControlLabel> <FormControl disabled={ submitting } type='text' { ...abb } placeholder='缩码(一个字母或数字)'/ > { abb.touched && abb.error && <HelpBlock style={ { float: 'right' } }>{ abb.error }</HelpBlock> } </FormGroup> <FormGroup controlId='formControlsText'> <ControlLabel>描述</ControlLabel> <FormControl disabled={ submitting } type='text' { ...description } placeholder='描述'/> </FormGroup> </Modal.Body> <Modal.Footer> <span className='ralign'>{ this.state.ecode !== 0 && !submitting && errMsg[this.state.ecode] }</span> <img src={ img } className={ submitting ? 'loading' : 'hide' }/> <Button disabled={ !dirty || submitting || invalid } type='submit'>确定</Button> <Button bsStyle='link' disabled={ submitting } onClick={ this.handleCancel }>取消</Button> </Modal.Footer> </form> </Modal> ); } }
36.338583
132
0.6039
false
true
true
false
d00c38dfb34664b45a93633ba0e14b8c3c0fe5f1
1,420
jsx
JSX
client/src/Components/Leave/LeavePageCard/LeavePageCardEmp.jsx
ruhin31416/Human-Resource-Management-System
bb14af3870295cf397c8d9c115e5e724c90d0c7b
[ "Apache-2.0" ]
null
null
null
client/src/Components/Leave/LeavePageCard/LeavePageCardEmp.jsx
ruhin31416/Human-Resource-Management-System
bb14af3870295cf397c8d9c115e5e724c90d0c7b
[ "Apache-2.0" ]
null
null
null
client/src/Components/Leave/LeavePageCard/LeavePageCardEmp.jsx
ruhin31416/Human-Resource-Management-System
bb14af3870295cf397c8d9c115e5e724c90d0c7b
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import { Card, Col, Row } from 'antd'; const LeavePageCard = () => { return ( <div className="site-statistic-demo-card"> <Row gutter={16}> <Col span={6}> <Card style={{ textAlign:"center", background: "#fff7e6", borderRadius: "20px",borderColor: "#096dd9"}}> <h5>Annual Leave</h5> <h3 style={{fontWeight:"bold"}}>12</h3> </Card> </Col> <Col span={6}> <Card style={{ textAlign:"center", background: "#fcffe6", borderRadius: "20px",borderColor: "#08979c" }}> <h5>Medical Leave</h5> <h3 style={{fontWeight:"bold"}}>12</h3> </Card> </Col> <Col span={6}> <Card style={{ textAlign:"center",background: "#e6f7ff", borderRadius: "20px",borderColor: "#531dab" }}> <h5>Other Leave</h5> <h3 style={{fontWeight:"bold"}}>12</h3> </Card> </Col> <Col span={6}> <Card style={{ textAlign:"center", background: "#e6fffb", borderRadius: "20px",borderColor: "#7cb305" }}> <h5>Remaining Leave</h5> <h3 style={{fontWeight:"bold"}}>12</h3> </Card> </Col> </Row> </div> ); }; export default LeavePageCard;
33.809524
121
0.464085
false
true
false
true
d00c42d7f4d251c5aa32071289161ac12aa8c0c2
681
jsx
JSX
src/assets/jss/material-kit-react/views/landingPageSections/productStyle.jsx
BushidoLab/bushido_v2
5a595a5150d10b74b1365862b9622982a2381143
[ "MIT" ]
null
null
null
src/assets/jss/material-kit-react/views/landingPageSections/productStyle.jsx
BushidoLab/bushido_v2
5a595a5150d10b74b1365862b9622982a2381143
[ "MIT" ]
null
null
null
src/assets/jss/material-kit-react/views/landingPageSections/productStyle.jsx
BushidoLab/bushido_v2
5a595a5150d10b74b1365862b9622982a2381143
[ "MIT" ]
null
null
null
import { title } from "assets/jss/material-kit-react.jsx"; const productStyle = { section: { padding: "70px 5px", textAlign: "center" }, title: { ...title, marginBottom: "1rem", marginTop: "30px", minHeight: "32px", textDecoration: "none" }, description: { color: "#545454", marginBottom: "30px" }, cardPadding: { paddingBottom: "35px" }, cardDimensions: { // maxWidth: '345px', width: "100%", minHeight: "390px" }, cardFooter: { width: "100%", height: "30%", justifyContent: "center", alignItems: "center" }, contentHeight: { height: "32em" }, contentHeightConsultation: { height: "28em" } }; export default productStyle;
16.214286
58
0.625551
true
false
false
true
d00c465693241c75b708b59e7ecce271bfbd7fa2
1,644
jsx
JSX
frontend/components/posts/post_box.jsx
JamesKoenig/barrl
f586dc8c62b6d197965a8dfab24db58ce45da103
[ "BSD-3-Clause" ]
null
null
null
frontend/components/posts/post_box.jsx
JamesKoenig/barrl
f586dc8c62b6d197965a8dfab24db58ce45da103
[ "BSD-3-Clause" ]
2
2021-02-08T17:41:47.000Z
2021-02-19T20:02:37.000Z
frontend/components/posts/post_box.jsx
JamesKoenig/barrl
f586dc8c62b6d197965a8dfab24db58ce45da103
[ "BSD-3-Clause" ]
null
null
null
import React from 'react'; import { useHistory,useLocation } from 'react-router-dom'; import PostFollowButton from './post_follow_button'; import TotalLikes from '../likes/total_likes'; import LikeButton from '../likes/like_button_container'; export default ({ post, author }) => { const history = useHistory(); const location = useLocation(); /* enclose the history object in the callback, * as per the example in https://reactrouter.com/native/api/Hooks/usehistory * (retrieved August 26th 2021) */ const boxOnClick = () => { /* I can probably use some react router elements for this but this just * gets it done. avert thine eyes lest it offends thee. */ if( !/\/posts\/.+/.test(location.pathname) ) { history.push(`/posts/${post.id}`); } } return ( <div className="post-display" onClick={boxOnClick} > <header className="post-header"> <div> <h3 className="author-name">{author.username}</h3> </div> <PostFollowButton /> </header> <div className="post-content"> { post.photoUrl ? <img src={post.photoUrl} /> : null } <p className="post-text">{post.body}</p> </div> <footer className="post-properties"> <TotalLikes postId={post.id} /> <span className="post-misc"> <LikeButton postId={post.id} /> <button className="post-share-button"> <span className="material-icons md-dark"> link </span> </button> </span> </footer> </div> ) }
29.890909
78
0.575426
false
true
false
true
d00c61a64ec437a307d4896b5c9078c1ee500550
3,280
jsx
JSX
src/components/AddPostForm/AddPostForm.jsx
pfeeny84/packrat
815c50123ecc0f76ac8ab79120832e3de9e57204
[ "MIT" ]
null
null
null
src/components/AddPostForm/AddPostForm.jsx
pfeeny84/packrat
815c50123ecc0f76ac8ab79120832e3de9e57204
[ "MIT" ]
null
null
null
src/components/AddPostForm/AddPostForm.jsx
pfeeny84/packrat
815c50123ecc0f76ac8ab79120832e3de9e57204
[ "MIT" ]
null
null
null
import React, { useState } from 'react'; import './AddPostForm.css' import { Button, Form, Grid, Header, Image, Divider, Segment } from 'semantic-ui-react' import { FaPhotoVideo } from 'react-icons/fa'; export default function AddPostForm(props){ const [selectedFile, setSelectedFile] = useState('') const initialState = { description: '', item: '', brand: '', model: '', year: '' } const [state, setState] = useState(initialState) function handleFileInput(e){ setSelectedFile(e.target.files[0]) } function handleChange(e){ setState({ ...state, [e.target.name]: e.target.value }) } function handleSubmit(e){ e.preventDefault() console.log('is handlesUbmit being called?') //making FormData for post request const formData = new FormData() formData.append('photo', selectedFile) formData.append('item', state.item) formData.append('brand', state.brand) formData.append('model', state.model) formData.append('year', state.year) formData.append('description', state.description) props.handleAddPost(formData) setState(initialState) } return ( <Grid textAlign='center' verticalAlign='middle' > <Grid.Column style={{ maxWidth: 450 }} > <Segment className='addForm' inverted > <Form autoComplete="off" onSubmit={handleSubmit} > <Form.Input className="form-control" name="item" value={state.item} placeholder="Item Type" onChange={handleChange} required /> <Form.Input className="form-control" name="brand" value={state.brand} placeholder="Brand" onChange={handleChange} required /> <Form.Input className="form-control" name="model" value={state.model} placeholder="Model" onChange={handleChange} required /> <Form.Input className="form-control" name="year" value={state.year} placeholder="Year" onChange={handleChange} required /> <Form.TextArea className="form-control" name="description" value={state.description} placeholder="Description" onChange={handleChange} required /> <label>Item Image</label> <Form.Input className="form-control" type="file" name="photo" onChange={handleFileInput} /> <Button inverted color='red' type="submit" className="btn" > Add to My Collection </Button> </Form> </Segment> </Grid.Column> </Grid> ); }
27.563025
88
0.485671
false
true
false
true
d00c8a3513d45eb9376f70eba9f4e0f4aa622007
9,212
jsx
JSX
front/src/routes/scene/edit-scene/ActionCard.jsx
jukeb0x/Gladys
afe4a2473333ef7f8984adf8a778f96f65becb76
[ "Apache-2.0" ]
1,024
2019-01-07T15:11:18.000Z
2022-03-31T11:40:05.000Z
front/src/routes/scene/edit-scene/ActionCard.jsx
jukeb0x/Gladys
afe4a2473333ef7f8984adf8a778f96f65becb76
[ "Apache-2.0" ]
1,059
2019-01-13T19:36:21.000Z
2022-03-31T23:20:47.000Z
front/src/routes/scene/edit-scene/ActionCard.jsx
jukeb0x/Gladys
afe4a2473333ef7f8984adf8a778f96f65becb76
[ "Apache-2.0" ]
147
2019-01-21T19:13:00.000Z
2022-03-31T23:18:51.000Z
import { h } from 'preact'; import { Text } from 'preact-i18n'; import cx from 'classnames'; import { ACTIONS } from '../../../../../server/utils/constants'; // Actions cards import ChooseActionTypeParams from './actions/ChooseActionTypeCard'; import DelayActionParams from './actions/DelayActionParams'; import DeviceGetValueParams from './actions/DeviceGetValueParams'; import DeviceSetValue from './actions/DeviceSetValue'; import SendMessageParams from './actions/SendMessageParams'; import OnlyContinueIfParams from './actions/only-continue-if/OnlyContinueIfParams'; import TurnOnOffLightParams from './actions/TurnOnOffLightParams'; import TurnOnOffSwitchParams from './actions/TurnOnOffSwitchParams'; import StartSceneParams from './actions/StartSceneParams'; import UserPresence from './actions/UserPresence'; import HttpRequest from './actions/HttpRequest'; import CheckUserPresence from './actions/CheckUserPresence'; import CheckTime from './actions/CheckTime'; import HouseEmptyOrNotCondition from './actions/HouseEmptyOrNotCondition'; const deleteActionFromColumn = (columnIndex, rowIndex, deleteAction) => () => { deleteAction(columnIndex, rowIndex); }; const ACTION_ICON = { [ACTIONS.LIGHT.TURN_ON]: 'fe fe-toggle-right', [ACTIONS.LIGHT.TURN_OFF]: 'fe fe-toggle-left', [ACTIONS.SWITCH.TURN_ON]: 'fe fe-toggle-right', [ACTIONS.SWITCH.TURN_OFF]: 'fe fe-toggle-left', [ACTIONS.TIME.DELAY]: 'fe fe-clock', [ACTIONS.MESSAGE.SEND]: 'fe fe-message-square', [ACTIONS.CONDITION.ONLY_CONTINUE_IF]: 'fe fe-shuffle', [ACTIONS.DEVICE.GET_VALUE]: 'fe fe-refresh-cw', [ACTIONS.USER.SET_SEEN_AT_HOME]: 'fe fe-home', [ACTIONS.USER.SET_OUT_OF_HOME]: 'fe fe-home', [ACTIONS.HTTP.REQUEST]: 'fe fe-link', [ACTIONS.USER.CHECK_PRESENCE]: 'fe fe-home', [ACTIONS.CONDITION.CHECK_TIME]: 'fe fe-watch', [ACTIONS.SCENE.START]: 'fe fe-fast-forward', [ACTIONS.HOUSE.IS_EMPTY]: 'fe fe-home', [ACTIONS.HOUSE.IS_NOT_EMPTY]: 'fe fe-home', [ACTIONS.DEVICE.SET_VALUE]: 'fe fe-radio' }; const ActionCard = ({ children, ...props }) => ( <div class={cx({ 'col-lg-12': props.action.type === ACTIONS.CONDITION.ONLY_CONTINUE_IF, 'col-lg-6': props.action.type === ACTIONS.MESSAGE.SEND, 'col-lg-4': props.action.type !== ACTIONS.CONDITION.ONLY_CONTINUE_IF && props.action.type !== ACTIONS.MESSAGE.SEND })} > <div class="card"> <div class="card-header"> {props.action.type !== null && <i class={ACTION_ICON[props.action.type]} />} {props.action.type === null && <i class="fe fe-plus-circle" />} <div class="card-title"> <i class={props.action.icon} style={{ marginRight: '10px' }} />{' '} <Text id={`editScene.actions.${props.action.type}`} /> {props.action.type === null && <Text id="editScene.newAction" />} </div> {props.highLightedActions && props.highLightedActions[`${props.columnIndex}:${props.index}`] && ( <div class="card-status bg-blue" /> )} <div class="card-options"> {false && ( <a class="card-options-collapse"> <i class="fe fe-chevron-down" /> </a> )} <a onClick={deleteActionFromColumn(props.columnIndex, props.index, props.deleteAction)} class="card-options-remove" > <i class="fe fe-x" /> </a> </div> </div> <div class="card-body"> {props.action.type === ACTIONS.TIME.DELAY && ( <DelayActionParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === null && ( <ChooseActionTypeParams columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.LIGHT.TURN_ON && ( <TurnOnOffLightParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.LIGHT.TURN_OFF && ( <TurnOnOffLightParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.SWITCH.TURN_ON && ( <TurnOnOffSwitchParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.SWITCH.TURN_OFF && ( <TurnOnOffSwitchParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.MESSAGE.SEND && ( <SendMessageParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} actionsGroupsBefore={props.actionsGroupsBefore} variables={props.variables} /> )} {props.action.type === ACTIONS.CONDITION.ONLY_CONTINUE_IF && ( <OnlyContinueIfParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} actionsGroupsBefore={props.actionsGroupsBefore} variables={props.variables} setVariables={props.setVariables} /> )} {props.action.type === ACTIONS.DEVICE.GET_VALUE && ( <DeviceGetValueParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} variables={props.variables} setVariables={props.setVariables} /> )} {props.action.type === ACTIONS.USER.SET_SEEN_AT_HOME && ( <UserPresence action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.USER.CHECK_PRESENCE && ( <CheckUserPresence action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.USER.SET_OUT_OF_HOME && ( <UserPresence action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.HTTP.REQUEST && ( <HttpRequest action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} setVariables={props.setVariables} /> )} {props.action.type === ACTIONS.CONDITION.CHECK_TIME && ( <CheckTime action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} setVariables={props.setVariables} /> )} {props.action.type === ACTIONS.SCENE.START && ( <StartSceneParams action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} variables={props.variables} setVariables={props.setVariables} scene={props.scene} /> )} {props.action.type === ACTIONS.HOUSE.IS_EMPTY && ( <HouseEmptyOrNotCondition action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.HOUSE.IS_NOT_EMPTY && ( <HouseEmptyOrNotCondition action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} {props.action.type === ACTIONS.DEVICE.SET_VALUE && ( <DeviceSetValue action={props.action} columnIndex={props.columnIndex} index={props.index} updateActionProperty={props.updateActionProperty} /> )} </div> </div> </div> ); export default ActionCard;
37.145161
120
0.594008
false
true
false
true
d00c8c85f9e6a21bdbd9b9f5a8a596da56fbb804
5,001
jsx
JSX
src/Clock.jsx
yhlben/react-clock
7c70e1e3cb52310746eb2abb2c1e2c90724d0dfe
[ "MIT" ]
null
null
null
src/Clock.jsx
yhlben/react-clock
7c70e1e3cb52310746eb2abb2c1e2c90724d0dfe
[ "MIT" ]
null
null
null
src/Clock.jsx
yhlben/react-clock
7c70e1e3cb52310746eb2abb2c1e2c90724d0dfe
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import mergeClassNames from 'merge-class-names'; import Hand from './Hand'; import Mark from './Mark'; import { getHours, getMinutes, getSeconds, } from './shared/dates'; import { isHandLength, isOppositeHandLength, isHandWidth, isMarkLength, isMarkWidth } from './shared/propTypes'; export default class Clock extends Component { renderMinuteMarks() { if (!this.props.renderMinuteMarks) { return null; } const { minuteMarksLength, minuteMarksWidth, renderHourMarks, } = this.props; const minuteMarks = []; for (let i = 1; i <= 60; i += 1) { const isHourMark = renderHourMarks && !(i % 5); if (!isHourMark) { minuteMarks.push( <Mark angle={i * 6} key={`minute_${i}`} length={minuteMarksLength} name="minute" width={minuteMarksWidth} />, ); } } return minuteMarks; } renderHourMarks() { if (!this.props.renderHourMarks) { return null; } const { hourMarksLength, hourMarksWidth, } = this.props; const hourMarks = []; for (let i = 1; i <= 12; i += 1) { hourMarks.push( <Mark angle={i * 30} key={`hour_${i}`} number={this.props.showNumber ? i : null} length={hourMarksLength} name="hour" width={hourMarksWidth} />, ); } return hourMarks; } renderFace() { return ( <div className="react-clock__face"> {this.renderMinuteMarks()} {this.renderHourMarks()} </div> ); } renderHourHand() { const { hourHandWidth, hourHandLength, hourHandOppositeLength, value, } = this.props; const angle = value ? ( (getHours(value) * 30) + (getMinutes(value) / 2) + (getSeconds(value) / 600) ) : 0; return ( <Hand angle={angle} name="hour" length={hourHandLength} oppositeLength={hourHandOppositeLength} width={hourHandWidth} /> ); } renderMinuteHand() { if (!this.props.renderMinuteHand) { return null; } const { minuteHandWidth, minuteHandLength, minuteHandOppositeLength, value, } = this.props; const angle = value ? ( (getHours(value) * 360) + (getMinutes(value) * 6) + (getSeconds(value) / 10) ) : 0; return ( <Hand angle={angle} name="minute" length={minuteHandLength} oppositeLength={minuteHandOppositeLength} width={minuteHandWidth} /> ); } renderSecondHand() { if (!this.props.renderSecondHand) { return null; } const { secondHandWidth, secondHandLength, secondHandOppositeLength, value, } = this.props; const angle = value ? ( (getMinutes(value) * 360) + (getSeconds(value) * 6) ) : 0; return ( <Hand name="second" angle={angle} length={secondHandLength} oppositeLength={secondHandOppositeLength} width={secondHandWidth} /> ); } render() { const { size, value } = this.props; return ( <time className={mergeClassNames('react-clock', this.props.className)} dateTime={value instanceof Date ? value.toISOString() : value} style={{ width: `${size}px`, height: `${size}px`, }} > {this.renderFace()} {this.renderHourHand()} {this.renderMinuteHand()} {this.renderSecondHand()} </time> ); } } Clock.defaultProps = { hourHandLength: 50, hourHandWidth: 4, hourMarksLength: 10, hourMarksWidth: 3, minuteHandLength: 70, minuteHandWidth: 2, minuteMarksLength: 6, minuteMarksWidth: 1, renderHourMarks: true, renderMinuteHand: true, renderMinuteMarks: true, renderSecondHand: true, secondHandLength: 90, secondHandWidth: 1, size: 150, }; Clock.propTypes = { className: PropTypes.oneOfType([ PropTypes.string, PropTypes.arrayOf(PropTypes.string), ]), hourHandLength: isHandLength, hourHandOppositeLength: isOppositeHandLength, hourHandWidth: isHandWidth, hourMarksLength: isMarkLength, hourMarksWidth: isMarkWidth, minuteHandLength: isHandLength, minuteHandOppositeLength: isOppositeHandLength, minuteHandWidth: isHandWidth, minuteMarksLength: isMarkLength, minuteMarksWidth: isMarkWidth, renderHourMarks: PropTypes.bool, renderMinuteHand: PropTypes.bool, renderMinuteMarks: PropTypes.bool, renderSecondHand: PropTypes.bool, secondHandLength: isHandLength, secondHandOppositeLength: isOppositeHandLength, secondHandWidth: isHandWidth, size: PropTypes.number, showNumber: PropTypes.bool, value: PropTypes.oneOfType([ PropTypes.string, PropTypes.instanceOf(Date), ]), };
21.556034
112
0.59928
false
true
true
false
d00cc59607827708d87a95b31af328944cb4857a
9,522
jsx
JSX
frontend/public/components/utils/value-from-pair.jsx
shdn-ibm/console
8c87a967a04b4df4ba253cd7e88a6b993814d9fc
[ "Apache-2.0" ]
null
null
null
frontend/public/components/utils/value-from-pair.jsx
shdn-ibm/console
8c87a967a04b4df4ba253cd7e88a6b993814d9fc
[ "Apache-2.0" ]
1
2020-04-22T13:04:09.000Z
2020-04-22T13:04:09.000Z
frontend/public/components/utils/value-from-pair.jsx
shdn-ibm/console
8c87a967a04b4df4ba253cd7e88a6b993814d9fc
[ "Apache-2.0" ]
2
2020-08-03T08:23:58.000Z
2020-08-21T02:48:05.000Z
import * as React from 'react'; import * as PropTypes from 'prop-types'; import * as _ from 'lodash-es'; import * as fuzzy from 'fuzzysearch'; import { useTranslation } from 'react-i18next'; import { Dropdown, ResourceName } from './'; // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#envvarsource-v1-core // valueFrom: // fieldRef: // fieldPath: spec.nodeName // valueFrom: // secretKeyRef: // name: mysecret // key: username // valueFrom: // configMapKeyRef: // name: tectonic-config // key: consoleBaseAddress // valueFrom: // resourceFieldRef: // containerName: test-container // resource: requests.cpu // divisor: 1 // 1 is default const getSpacer = (configMap, secret) => { const spacerBefore = new Set(); return _.isEmpty(configMap) || _.isEmpty(secret) ? spacerBefore : spacerBefore.add(secret); }; const getKeys = (keyMap) => { const itemKeys = {}; _.mapKeys(keyMap, (value, key) => (itemKeys[key] = key)); return itemKeys; }; export const NameKeyDropdownPair = ({ name, key, configMaps, secrets, serviceAccounts, onChange, kind, nameTitle, placeholderString, isKeyRef = true, }) => { const { t } = useTranslation(); const getHeaders = (configMap, secret, serviceAccount) => { const headers = {}; if (configMap && !_.isEmpty(configMap)) { headers[configMap] = t('public~ConfigMaps'); } if (secret && !_.isEmpty(secret)) { headers[secret] = t('public~Secrets'); } if (serviceAccount && !_.isEmpty(serviceAccount)) { headers[serviceAccount] = t('public~ServiceAccounts'); } return headers; }; let itemKeys = {}; let refProperty; const cmItems = {}; const secretItems = {}; const saItems = {}; const nameAutocompleteFilter = (text, item) => fuzzy(text, item.props.name); const keyAutocompleteFilter = (text, item) => fuzzy(text, item); const keyTitle = _.isEmpty(key) ? t('public~Select a key') : key; const cmRefProperty = isKeyRef ? 'configMapKeyRef' : 'configMapRef'; const secretRefProperty = isKeyRef ? 'secretKeyRef' : 'secretRef'; const serviceAccountRefProperty = isKeyRef ? 'serviceAccountKeyRef' : 'serviceAccountRef'; _.each(configMaps.items, (v) => { cmItems[`${v.metadata.name}:${cmRefProperty}`] = ( <ResourceName kind="ConfigMap" name={v.metadata.name} /> ); if (kind === 'ConfigMap' && _.isEqual(v.metadata.name, name)) { refProperty = cmRefProperty; itemKeys = getKeys(v.data); } }); _.each(secrets.items, (v) => { secretItems[`${v.metadata.name}:${secretRefProperty}`] = ( <ResourceName kind="Secret" name={v.metadata.name} /> ); if (kind === 'Secret' && _.isEqual(v.metadata.name, name)) { refProperty = secretRefProperty; itemKeys = getKeys(v.data); } }); serviceAccounts && _.each(serviceAccounts.items, (v) => { saItems[`${v.metadata.name}:${serviceAccountRefProperty}`] = ( <ResourceName kind="ServiceAccount" name={v.metadata.name} /> ); if (kind === 'ServiceAccount' && _.isEqual(v.metadata.name, name)) { refProperty = serviceAccountRefProperty; itemKeys = getKeys(v.data); } }); const firstConfigMap = _.isEmpty(cmItems) ? {} : Object.keys(cmItems)[0]; const firstSecret = _.isEmpty(secretItems) ? {} : Object.keys(secretItems)[0]; const firstServiceAccount = saItems && !_.isEmpty(saItems) ? Object.keys(saItems)[0] : {}; const headerBefore = getHeaders(firstConfigMap, firstSecret, firstServiceAccount); const spacerBefore = getSpacer(firstConfigMap, firstSecret); const items = _.assign({}, cmItems, secretItems, saItems); return ( <> <Dropdown menuClassName="value-from__menu dropdown-menu--text-wrap" className="value-from" autocompleteFilter={nameAutocompleteFilter} autocompletePlaceholder={placeholderString} items={items} selectedKey={name} title={nameTitle} headerBefore={headerBefore} spacerBefore={spacerBefore} onChange={(val) => { const keyValuePair = _.split(val, ':'); onChange({ [keyValuePair[1]]: isKeyRef ? { name: keyValuePair[0], key: '' } : { name: keyValuePair[0] }, }); }} /> {isKeyRef && ( <Dropdown menuClassName="value-from__menu dropdown-menu--text-wrap" className="value-from value-from--key" autocompleteFilter={keyAutocompleteFilter} autocompletePlaceholder={t('public~Key')} items={itemKeys} selectedKey={key} title={keyTitle} onChange={(val) => onChange({ [refProperty]: { name, key: val } })} /> )} </> ); }; const FieldRef = ({ data: { fieldPath } }) => ( <> <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control" value="FieldRef" disabled /> </div> <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control" value={fieldPath} disabled /> </div> </> ); const ConfigMapSecretKeyRef = ({ data: { name, key }, configMaps, secrets, serviceAccounts, onChange, disabled, kind, }) => { const { t } = useTranslation(); const placeholderString = t('public~ConfigMap or Secret'); const nameTitle = _.isEmpty(name) ? ( t('public~Select a resource') ) : ( <ResourceName kind={kind} name={name} /> ); if (disabled) { return ( <> <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control" value={`${name} - ${kind}`} disabled /> </div> <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control" value={key} disabled /> </div> </> ); } return ( <NameKeyDropdownPair key={key} name={name} configMaps={configMaps} secrets={secrets} serviceAccounts={serviceAccounts} onChange={onChange} kind={kind} nameTitle={nameTitle} placeholderString={placeholderString} /> ); }; const ConfigMapSecretRef = ({ data: { name, key }, configMaps, secrets, serviceAccounts, onChange, disabled, kind, }) => { const { t } = useTranslation(); const placeholderString = t('public~ConfigMap or Secret'); const nameTitle = _.isEmpty(name) ? ( t('public~Select a resource') ) : ( <ResourceName kind={kind} name={name} /> ); const isKeyRef = false; const nameString = _.isEmpty(name) ? '' : `${name} - ${kind}`; if (disabled) { return ( <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control" value={nameString} disabled placeholder={t('public~ConfigMap/Secret')} /> </div> ); } return ( <NameKeyDropdownPair key={key} name={name} configMaps={configMaps} secrets={secrets} serviceAccounts={serviceAccounts} onChange={onChange} kind={kind} nameTitle={nameTitle} placeholderString={placeholderString} isKeyRef={isKeyRef} /> ); }; const ResourceFieldRef = ({ data: { containerName, resource } }) => ( <> <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control value-from" value={`${containerName} - Resource Field`} disabled /> </div> <div className="pairs-list__value-ro-field"> <input type="text" className="pf-c-form-control value-from" value={resource} disabled /> </div> </> ); const keyStringToComponent = { fieldRef: { component: FieldRef, }, secretKeyRef: { component: ConfigMapSecretKeyRef, kind: 'Secret', }, configMapKeyRef: { component: ConfigMapSecretKeyRef, kind: 'ConfigMap', }, configMapSecretKeyRef: { component: ConfigMapSecretKeyRef, }, resourceFieldRef: { component: ResourceFieldRef, }, configMapRef: { component: ConfigMapSecretRef, kind: 'ConfigMap', }, secretRef: { component: ConfigMapSecretRef, kind: 'Secret', }, serviceAccountRef: { component: ConfigMapSecretRef, kind: 'ServiceAccount', }, configMapSecretRef: { component: ConfigMapSecretRef, }, }; export class ValueFromPair extends React.PureComponent { constructor(props) { super(props); this.onChangeVal = (...args) => this._onChangeVal(...args); } _onChangeVal(value) { const { onChange } = this.props; const e = { target: { value } }; return onChange(e); } render() { const { pair, configMaps, secrets, serviceAccounts, disabled } = this.props; const valueFromKey = Object.keys(this.props.pair)[0]; const componentInfo = keyStringToComponent[valueFromKey]; if (!componentInfo) { return null; } const Component = componentInfo.component; return ( <Component data={pair[valueFromKey]} configMaps={configMaps} secrets={secrets} serviceAccounts={serviceAccounts} kind={componentInfo.kind} onChange={this.onChangeVal} disabled={disabled} /> ); } } ValueFromPair.propTypes = { pair: PropTypes.object.isRequired, configMaps: PropTypes.object, secrets: PropTypes.object, onChange: PropTypes.func, disabled: PropTypes.bool, };
27.205714
98
0.617202
false
true
false
true
d00cc655a06b44d54465f1b230fe8aa7aaa6e0ef
7,748
jsx
JSX
awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx
chris93111/awx
cd49213924f1cd451e5c17390b9c2b237085d1be
[ "Apache-2.0" ]
null
null
null
awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx
chris93111/awx
cd49213924f1cd451e5c17390b9c2b237085d1be
[ "Apache-2.0" ]
1
2020-11-05T16:07:07.000Z
2020-11-05T16:07:07.000Z
awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx
chris93111/awx
cd49213924f1cd451e5c17390b9c2b237085d1be
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import { act } from 'react-dom/test-utils'; import { createMemoryHistory } from 'history'; import { sleep } from '@testUtils/testUtils'; import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers'; import { JobTemplatesAPI, LabelsAPI, ProjectsAPI } from '@api'; import JobTemplateEdit from './JobTemplateEdit'; jest.mock('@api'); const mockJobTemplate = { id: 1, name: 'Foo', description: 'Bar', job_type: 'run', inventory: 2, project: 3, playbook: 'Baz', type: 'job_template', forks: 0, limit: '', verbosity: '0', job_slice_count: 1, timeout: 0, job_tags: '', skip_tags: '', diff_mode: false, allow_callbacks: false, allow_simultaneous: false, use_fact_cache: false, host_config_key: '', scm_branch: '', summary_fields: { user_capabilities: { edit: true, }, labels: { results: [{ name: 'Sushi', id: 1 }, { name: 'Major', id: 2 }], }, inventory: { id: 2, organization_id: 1, }, credentials: [ { id: 1, kind: 'cloud', name: 'Foo' }, { id: 2, kind: 'ssh', name: 'Bar' }, ], project: { id: 15, name: 'Boo', }, }, }; const mockRelatedCredentials = { count: 2, next: null, previous: null, results: [ { id: 1, type: 'credential', url: '/api/v2/credentials/1/', related: {}, summary_fields: { user_capabilities: { edit: true, delete: true, copy: true, use: true, }, }, created: '2016-08-24T20:20:44.411607Z', modified: '2019-06-18T16:14:00.109434Z', name: 'Test Vault Credential', description: 'Credential with access to vaulted data.', organization: 1, credential_type: 3, inputs: { vault_password: '$encrypted$' }, }, { id: 2, type: 'credential', url: '/api/v2/credentials/2/', related: {}, summary_fields: { user_capabilities: { edit: true, delete: true, copy: true, use: true, }, }, created: '2016-08-24T20:20:44.411607Z', modified: '2017-07-11T15:58:39.103659Z', name: 'Test Machine Credential', description: 'Credential with access to internal machines.', organization: 1, credential_type: 1, inputs: { ssh_key_data: '$encrypted$' }, }, ], }; const mockRelatedProjectPlaybooks = [ 'check.yml', 'debug-50.yml', 'debug.yml', 'debug2.yml', 'debug_extra_vars.yml', 'dynamic_inventory.yml', 'environ_test.yml', 'fail_unless.yml', 'pass_unless.yml', 'pause.yml', 'ping-20.yml', 'ping.yml', 'setfact_50.yml', 'vault.yml', ]; const mockInstanceGroups = [ { id: 1, type: 'instance_group', url: '/api/v2/instance_groups/1/', related: { jobs: '/api/v2/instance_groups/1/jobs/', instances: '/api/v2/instance_groups/1/instances/', }, name: 'tower', capacity: 59, committed_capacity: 0, consumed_capacity: 0, percent_capacity_remaining: 100.0, jobs_running: 0, jobs_total: 3, instances: 1, controller: null, is_controller: false, is_isolated: false, policy_instance_percentage: 100, policy_instance_minimum: 0, policy_instance_list: [], }, ]; JobTemplatesAPI.readCredentials.mockResolvedValue({ data: mockRelatedCredentials, }); ProjectsAPI.readPlaybooks.mockResolvedValue({ data: mockRelatedProjectPlaybooks, }); LabelsAPI.read.mockResolvedValue({ data: { results: [] } }); describe('<JobTemplateEdit />', () => { beforeEach(() => { LabelsAPI.read.mockResolvedValue({ data: { results: [] } }); JobTemplatesAPI.readCredentials.mockResolvedValue({ data: mockRelatedCredentials, }); JobTemplatesAPI.readInstanceGroups.mockReturnValue({ data: { results: mockInstanceGroups }, }); ProjectsAPI.readDetail.mockReturnValue({ id: 1, allow_override: true, name: 'foo', }); }); afterEach(() => { jest.clearAllMocks(); }); test('initially renders successfully', async () => { let wrapper; await act(async () => { wrapper = mountWithContexts( <JobTemplateEdit template={mockJobTemplate} /> ); }); await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0); }); test('handleSubmit should call api update', async () => { let wrapper; await act(async () => { wrapper = mountWithContexts( <JobTemplateEdit template={mockJobTemplate} /> ); }); const updatedTemplateData = { name: 'new name', inventory: 1, }; const labels = [ { id: 3, name: 'Foo' }, { id: 4, name: 'Bar' }, { id: 5, name: 'Maple' }, { id: 6, name: 'Tree' }, ]; await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0); act(() => { wrapper.find('input#template-name').simulate('change', { target: { value: 'new name', name: 'name' }, }); wrapper.find('AnsibleSelect#template-job-type').invoke('onChange')( 'check' ); wrapper.find('InventoryLookup').invoke('onChange')({ id: 1, organization: 1, }); wrapper.find('LabelSelect').invoke('onChange')(labels); }); wrapper.update(); await act(async () => { wrapper.find('button[aria-label="Save"]').simulate('click'); }); await sleep(0); const expected = { ...mockJobTemplate, ...updatedTemplateData, become_enabled: false, }; delete expected.summary_fields; delete expected.id; delete expected.type; expect(JobTemplatesAPI.update).toHaveBeenCalledWith(1, expected); expect(JobTemplatesAPI.disassociateLabel).toHaveBeenCalledTimes(2); expect(JobTemplatesAPI.associateLabel).toHaveBeenCalledTimes(4); }); test('should navigate to job template detail when cancel is clicked', async () => { const history = createMemoryHistory({}); let wrapper; await act(async () => { wrapper = mountWithContexts( <JobTemplateEdit template={mockJobTemplate} />, { context: { router: { history } } } ); }); const cancelButton = await waitForElement( wrapper, 'button[aria-label="Cancel"]', e => e.length === 1 ); await act(async () => { cancelButton.prop('onClick')(); }); expect(history.location.pathname).toEqual( '/templates/job_template/1/details' ); }); test('should not call ProjectsAPI.readPlaybooks if there is no project', async () => { const history = createMemoryHistory({}); const noProjectTemplate = { id: 1, name: 'Foo', description: 'Bar', job_type: 'run', inventory: 2, playbook: 'Baz', type: 'job_template', forks: 0, limit: '', verbosity: '0', job_slice_count: 1, timeout: 0, job_tags: '', skip_tags: '', diff_mode: false, allow_callbacks: false, allow_simultaneous: false, use_fact_cache: false, host_config_key: '', summary_fields: { user_capabilities: { edit: true, }, labels: { results: [{ name: 'Sushi', id: 1 }, { name: 'Major', id: 2 }], }, inventory: { id: 2, organization_id: 1, }, credentials: [ { id: 1, kind: 'cloud', name: 'Foo' }, { id: 2, kind: 'ssh', name: 'Bar' }, ], }, }; await act(async () => mountWithContexts(<JobTemplateEdit template={noProjectTemplate} />, { context: { router: { history } }, }) ); expect(ProjectsAPI.readPlaybooks).not.toBeCalled(); }); });
25.486842
88
0.579892
false
true
false
true
d00cc9a1afb474615ae6cfbf951bd919347943bf
485
jsx
JSX
packages/components/src/Time/__tests__/index.unit.test.jsx
mewbak/numenta-web
e89594f03aa76a94dcea369bab593b60ff67a341
[ "MIT" ]
33
2016-08-16T14:44:31.000Z
2020-09-22T15:43:29.000Z
packages/components/src/Time/__tests__/index.unit.test.jsx
mewbak/numenta-web
e89594f03aa76a94dcea369bab593b60ff67a341
[ "MIT" ]
123
2016-09-10T21:59:47.000Z
2019-02-12T05:54:40.000Z
packages/components/src/Time/__tests__/index.unit.test.jsx
mewbak/numenta-web
e89594f03aa76a94dcea369bab593b60ff67a341
[ "MIT" ]
27
2016-07-26T19:28:56.000Z
2020-09-22T15:43:35.000Z
import moment from 'moment' import React from 'react' import renderer from 'react-test-renderer' import Time from '../../Time' const when = '2016-09-21T18:10:32' describe('Time React component', () => { it('Renders correctly', () => { const occur = moment(new Date(when)).utcOffset(0, false) const component = renderer.create( <Time moment={occur}> {when} </Time> ) const tree = component.toJSON() expect(tree).toMatchSnapshot() }) })
20.208333
60
0.628866
false
true
false
true
d00cd470b9a87c79c90cd6b8541c39d2c7126ad4
556
jsx
JSX
views/layouts/shared/FlexContainerLayout.jsx
XavierLeTohic/hackathon-pm
8670d7c5a8a04a34081c3ce534777981ebcb6ad6
[ "MIT" ]
null
null
null
views/layouts/shared/FlexContainerLayout.jsx
XavierLeTohic/hackathon-pm
8670d7c5a8a04a34081c3ce534777981ebcb6ad6
[ "MIT" ]
null
null
null
views/layouts/shared/FlexContainerLayout.jsx
XavierLeTohic/hackathon-pm
8670d7c5a8a04a34081c3ce534777981ebcb6ad6
[ "MIT" ]
null
null
null
var React = require('react'); class FlexContainerLayout extends React.Component { getTemplate() { let ctnClass = this.props.nameClass ? "flexContainer "+ this.props.nameClass : "flexContainer"; if(this.props.element ==='ul') { return ( <ul className={ctnClass}> {this.props.children} </ul> ) } return ( <div className={ctnClass}> {this.props.children} </div> ) } render() { return ( this.getTemplate() ) } } module.exports = FlexContainerLayout;
18.533333
99
0.571942
true
false
true
false
d00ce41623d73d779e912c0ab643254be052dfd5
1,380
jsx
JSX
src/Hypzeh.Web/ClientApp/components/layout/SplashScreen/BaseLoader/BaseLoader.styles.jsx
hypzeh/hypzeh.github.io
d176db5bac459efc11b266f6aacdd65d2f5bf85c
[ "MIT" ]
null
null
null
src/Hypzeh.Web/ClientApp/components/layout/SplashScreen/BaseLoader/BaseLoader.styles.jsx
hypzeh/hypzeh.github.io
d176db5bac459efc11b266f6aacdd65d2f5bf85c
[ "MIT" ]
null
null
null
src/Hypzeh.Web/ClientApp/components/layout/SplashScreen/BaseLoader/BaseLoader.styles.jsx
hypzeh/hypzeh.github.io
d176db5bac459efc11b266f6aacdd65d2f5bf85c
[ "MIT" ]
null
null
null
import styled, { keyframes } from 'styled-components'; const progress = keyframes` 0% { margin-left: 0; margin-right: 100%; } 50% { margin-left: 25%; margin-right: 0; } 100% { margin-left: 100%; margin-right: 0; } `; const Wrapper = styled.div` position: absolute; top: 0; bottom: 0; left: 0; right: 0; display: flex; flex-direction: column; background-color: ${({ theme }) => theme.colours.splash_screen_background_colour}; color: ${({ theme }) => theme.colours.splash_screen_colour}; fill: ${({ theme }) => theme.colours.splash_screen_colour}; user-select: none; &::before { content: ''; flex-grow: 1; max-height: calc(50% - 100px); } `; const Content = styled.div` display: flex; flex-direction: column; align-items: center; `; const Logo = styled.div` position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; & > svg { margin: .5rem .5rem .25rem .5rem; } & > h3 { margin: .25rem .5rem .5rem .5rem; text-transform: uppercase; } `; const Loader = styled.div` display: flex; height: .1rem; width: 10rem; &::before { content: ''; width: 100%; background-color: ${({ theme }) => theme.colours.splash_screen_colour}; animation: ${progress} 2s infinite; } `; export default { Wrapper, Content, Logo, Loader, };
19.43662
84
0.624638
false
true
false
true
d00cf42411eea556a6c3fd48f77668a49fabac3d
4,520
jsx
JSX
components/AblyChatComponent.jsx
diebraga/realtimechat-ably
c43ec3caeded71db20ec85cd48d7dd7209f14f78
[ "Apache-2.0" ]
null
null
null
components/AblyChatComponent.jsx
diebraga/realtimechat-ably
c43ec3caeded71db20ec85cd48d7dd7209f14f78
[ "Apache-2.0" ]
null
null
null
components/AblyChatComponent.jsx
diebraga/realtimechat-ably
c43ec3caeded71db20ec85cd48d7dd7209f14f78
[ "Apache-2.0" ]
null
null
null
import React, { useEffect, useState } from 'react'; import { useChannel } from "./AblyReactEffect"; import styles from './AblyChatComponent.module.css'; const users = [ {id: '1', name: 'Diego Braga', email: 'diebraga.developer@gmail.com', src: "https://bit.ly/dan-abramov"}, {id: '2', name: 'Joseph Seph', email: 'joshephserphty@gmail.com', src: "https://bit.ly/code-beast"}, {id: '3', name: "Sarah O'Shea", email: 'diebraga.jegssson@gmail.com', src: "https://bit.ly/ryan-florence"}, ] const AblyChatComponent = () => { const [myChannel, setMyChanel] = useState('') let inputBox = null; let messageEnd = null; const [messageText, setMessageText] = useState(""); const [receivedMessages, setMessages] = useState([]); const messageTextIsEmpty = messageText.trim().length === 0; const [channel, ably] = useChannel(myChannel, (message) => { const history = receivedMessages.slice(-199); setMessages([...history, message]); }); const sendChatMessage = (messageText) => { channel.publish({ name: 'Diego', data: messageText }); setMessageText(""); inputBox.focus(); } const handleFormSubmission = (event) => { event.preventDefault(); sendChatMessage(messageText); } const handleKeyPress = (event) => { if (event.charCode !== 13 || messageTextIsEmpty) { return; } sendChatMessage(messageText); event.preventDefault(); } const messages = receivedMessages.map((message, index) => { const author = message.connectionId === ably.connection.id ? "Eu" : `${message.name}`; const hours = new Date().getHours(); const minutes = new Date().getMinutes(); return ( <div key={index} style={{display: 'flex'}}> &nbsp;&nbsp; <span className={styles.message} data-author={author}> {message.data} </span> &nbsp;&nbsp; <div> <span>{author}:</span> <span>{hours}:{minutes}</span> </div> </div> ) }); useEffect(() => { messageEnd.scrollIntoView({ behaviour: "smooth" }); }); return ( <> <div style={{display: 'flex', cursor: 'pointer', justifyContent: 'space-around', marginTop: '20px'}} > <div onClick={() => setMyChanel('Global')} style={{display: 'flex'}}> <img src='https://images.theconversation.com/files/378097/original/file-20210111-23-bqsfwl.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1200&h=1200.0&fit=crop' height='100px' style={{ borderRadius: '80px', marginRight: '50px' }} /> <h1>Chat Global</h1> </div> <button onClick={() => setMyChanel('')} className={myChannel !== 'Global' ? styles.invisible : null} style={{background: 'red', color: 'white', fontWeight: 'bold', fontSize: '40px', height: '80px' }}> X </button> </div> <hr size="3" color='black'/> {users.map(user => { return ( <div style={{display: 'flex', cursor: 'pointer', justifyContent: 'space-around', marginTop: '20px'}} key={user.id} > <div onClick={() => setMyChanel(user.email)} style={{display: 'flex'}} onClick={() => setMyChanel(user.email)}> <img src={user.src} height='100px' style={{ borderRadius: '80px', marginRight: '50px' }} /> <h1>Chat do {user.name}</h1> </div> <button onClick={() => setMyChanel('')} className={myChannel !== user.email ? styles.invisible : null} style={{background: 'red', color: 'white', fontWeight: 'bold', fontSize: '40px', height: '80px' }}> X </button> </div> ) })} <div className={myChannel.length > 0 ? styles.chatHolder : styles.invisible}> <div className={styles.chatText}> {messages} <div ref={(element) => { messageEnd = element; }}></div> </div> <form onSubmit={handleFormSubmission} className={styles.form}> <textarea ref={(element) => { inputBox = element; }} value={messageText} placeholder="Type a message..." onChange={e => setMessageText(e.target.value)} onKeyPress={handleKeyPress} className={styles.textarea} ></textarea> <button type="submit" className={styles.button} disabled={messageTextIsEmpty}>Send</button> </form> </div> </> ) } export default AblyChatComponent;
32.992701
154
0.571903
false
true
false
true
d00d11c8dd2df6bb81e9972bbede9f6da3ca8a71
1,870
jsx
JSX
bowtie/src/header.jsx
artochoa/vue
1a72f0c026d6e2e93f92dca4343db14261348e9b
[ "MIT" ]
813
2016-08-19T17:15:22.000Z
2022-03-18T06:50:08.000Z
bowtie/src/header.jsx
rdiaz18/vue
1a72f0c026d6e2e93f92dca4343db14261348e9b
[ "MIT" ]
230
2016-07-25T23:26:34.000Z
2021-06-03T12:59:36.000Z
bowtie/src/header.jsx
rdiaz18/vue
1a72f0c026d6e2e93f92dca4343db14261348e9b
[ "MIT" ]
85
2016-10-17T20:14:54.000Z
2021-06-02T11:42:51.000Z
import PropTypes from 'prop-types'; import React from 'react'; import { storeState } from './utils'; var msgpack = require('msgpack-lite'); export default class Bowhead extends React.Component { constructor(props) { super(props); var local = sessionStorage.getItem(this.props.uuid); if (local === null) { this.state = { value: this.props.initial }; } else { this.state = JSON.parse(local); } } getValue = (data, fn) => { fn(msgpack.encode(this.state.value)); }; setText = data => { var arr = new Uint8Array(data['data']); arr = msgpack.decode(arr); this.setState({ value: arr }); storeState(this.props.uuid, this.state, { value: arr }); }; componentDidMount() { var socket = this.props.socket; var uuid = this.props.uuid; socket.on(uuid + '#get', this.getText); socket.on(uuid + '#text', this.setText); } render() { switch (this.props.size) { case 1: return <h1 dangerouslySetInnerHTML={{ __html: this.state.value }} />; case 2: return <h2 dangerouslySetInnerHTML={{ __html: this.state.value }} />; case 3: return <h3 dangerouslySetInnerHTML={{ __html: this.state.value }} />; case 4: return <h4 dangerouslySetInnerHTML={{ __html: this.state.value }} />; case 5: return <h5 dangerouslySetInnerHTML={{ __html: this.state.value }} />; case 6: return <h6 dangerouslySetInnerHTML={{ __html: this.state.value }} />; } } } Bowhead.propTypes = { uuid: PropTypes.string.isRequired, socket: PropTypes.object.isRequired, initial: PropTypes.string.isRequired, size: PropTypes.number.isRequired, };
31.166667
85
0.564171
false
true
true
false
d00d3de1d24108c723f8a2bbff3fa11e4993cf19
1,701
jsx
JSX
src/components/UpdateMove/UpdateMove.jsx
dremanchan/prime-solo-project
0609256b910b2fb555cab263c403e8c3eadea2b2
[ "PostgreSQL" ]
null
null
null
src/components/UpdateMove/UpdateMove.jsx
dremanchan/prime-solo-project
0609256b910b2fb555cab263c403e8c3eadea2b2
[ "PostgreSQL" ]
1
2022-02-17T21:05:58.000Z
2022-02-17T21:05:58.000Z
src/components/UpdateMove/UpdateMove.jsx
dremanchan/prime-solo-project
0609256b910b2fb555cab263c403e8c3eadea2b2
[ "PostgreSQL" ]
null
null
null
import { useState, React, useEffect } from "react"; import { Link, useHistory, useParams } from "react-router-dom"; import { useDispatch, useSelector } from "react-redux"; import Button from "@mui/material/Button"; function UpdateMove() { const dispatch = useDispatch(); const history = useHistory(); const params = useParams(); const move = useSelector((store) => store.selectedMove); const char = useSelector((store) => store.selectedCharacter); const [input, setInput] = useState(""); const [frames, setFrames] = useState(""); function handleSubmit(evt) { evt.preventDefault(); dispatch({ type: 'UPDATE_MOVE', payload: { input: input, frames: frames, id: move } }) dispatch({ type:'FETCH_MOVES' }); history.push(`/smashcharacter/${char}`); } return ( <> <div> <h1>Update Move</h1> <form onSubmit={handleSubmit}> <p>Input:</p> <input type="text" value={input} onChange={(evt) => setInput(evt.target.value)} /> <p>Frames:</p> <input type="text" value={frames} onChange={(evt) => setFrames(evt.target.value)} /> {/* Returns user to the character page after submitting */} <Button onClick={handleSubmit} variant="contained"> Submit </Button> </form> <Link to={`smashcharacter/${char}`}> <Button variant="contained">Cancel</Button> </Link> </div> </> ); } export default UpdateMove;
24.3
69
0.529688
false
true
false
true
d00d6462c451a27927a52b9c0b578ce1368a7d53
2,061
jsx
JSX
src/components/about.jsx
PauloVictorMaia/PriveLanding
5d5e7a9bcb2e5f84102a7b85d816b4969f64df79
[ "MIT" ]
null
null
null
src/components/about.jsx
PauloVictorMaia/PriveLanding
5d5e7a9bcb2e5f84102a7b85d816b4969f64df79
[ "MIT" ]
null
null
null
src/components/about.jsx
PauloVictorMaia/PriveLanding
5d5e7a9bcb2e5f84102a7b85d816b4969f64df79
[ "MIT" ]
null
null
null
import './styles.css' export const About = (props) => { return ( <div id='about'> <div className='container'> <div className='row-effect'> <div style={{ }} > <img style={{height: 370, width: 500}} src='img/imageabout2.jpg' className='img-responsive' alt='' /> {/* <img style={{height: 350, width: 'auto', marginLeft: 5}} src='img/priveimage.jpeg' className='img-responsive' alt='' />{' '} */} </div> <div className='col-xs-12 col-md-6'> <div className='about-text'> <h2>Um pouco sobre nós</h2> <p>{props.data ? props.data.paragraph : 'loading...'}</p> <h3>Porque Privê Residence Club?</h3> <div className='list-style'> <div className='col-lg-6 col-sm-6 col-xs-12'> <ul> {props.data ? props.data.Why.map((d, i) => ( <li key={`${d}-${i}`}>{d}</li> )) : 'loading'} </ul> </div> <div className='col-lg-6 col-sm-6 col-xs-12'> <ul> {props.data ? props.data.Why2.map((d, i) => ( <li key={`${d}-${i}`}> {d}</li> )) : 'loading'} </ul> </div> </div> </div> </div> </div> <a href='https://api.whatsapp.com/send?phone=558587988723&text=Ol%C3%A1%2C%20vim%20pelo%20site%2C%20tenho%20interesse%20de%20ser%20um%20associado%20Priv%C3%AA%20Residence%20Club%2C%20gostaria%20de%20mais%20informa%C3%A7%C3%B5es.' className='btn btn-custom btn-lg page-scroll' target='blank' style={{margin: 15}} > Assine já </a> </div> </div> ) }
34.35
239
0.409025
false
true
false
true
d00d6941510ffb7d9d34db212cb90c18a70d9fff
237
jsx
JSX
fundamentos/src/components/comunicacao/indireta/Sub.jsx
CarlosSantos-Dev/ReactProjects
8a1fa654f138596ed8eb9c93d282c578c8d69e2f
[ "MIT" ]
null
null
null
fundamentos/src/components/comunicacao/indireta/Sub.jsx
CarlosSantos-Dev/ReactProjects
8a1fa654f138596ed8eb9c93d282c578c8d69e2f
[ "MIT" ]
null
null
null
fundamentos/src/components/comunicacao/indireta/Sub.jsx
CarlosSantos-Dev/ReactProjects
8a1fa654f138596ed8eb9c93d282c578c8d69e2f
[ "MIT" ]
null
null
null
import React from "react" export default (props) => { function acao() { props.quandoClicar(Math.random(), "Gerado") } return ( <div> <button onClick={acao}>Alterar</button> </div> ) }
18.230769
51
0.527426
false
true
false
true
d00d70f3690662a6015949cb808e3fb9b3f48ff4
128
jsx
JSX
codenation/react-13/src/components/Topbar.jsx
Alex-Xavier/Codenation-AceleraDev-ReactJS
58608ef45ef58a0e9afb180f9832c9d5cc76b3ce
[ "MIT" ]
null
null
null
codenation/react-13/src/components/Topbar.jsx
Alex-Xavier/Codenation-AceleraDev-ReactJS
58608ef45ef58a0e9afb180f9832c9d5cc76b3ce
[ "MIT" ]
null
null
null
codenation/react-13/src/components/Topbar.jsx
Alex-Xavier/Codenation-AceleraDev-ReactJS
58608ef45ef58a0e9afb180f9832c9d5cc76b3ce
[ "MIT" ]
null
null
null
import React from 'react'; class Topbar extends React.Component { render() { return (<div />); } } export default Topbar;
12.8
38
0.671875
true
false
true
false
d00d8abc407bf0e8a99e77a343e44b151818d2d4
1,942
jsx
JSX
client/src/components/forms/UserImage/UserImage.jsx
Mishawaka/hackathon-project
6b95751819487b0277584e32a18619337d90b88f
[ "MIT" ]
null
null
null
client/src/components/forms/UserImage/UserImage.jsx
Mishawaka/hackathon-project
6b95751819487b0277584e32a18619337d90b88f
[ "MIT" ]
null
null
null
client/src/components/forms/UserImage/UserImage.jsx
Mishawaka/hackathon-project
6b95751819487b0277584e32a18619337d90b88f
[ "MIT" ]
null
null
null
import React, { useContext } from 'react'; import FormPage from '../FormPage/FormPage'; import ImageCrop from '../ImageCrop/ImageCrop'; import { ImageContext } from '../../../contexts/ImageContext'; import plus from '../../../img/plus.svg'; const ProjectImages = ({ modal, setModal, customRef, setUser }) => { const { croppedImageUrl, setFile } = useContext(ImageContext); const nextImage = (file) => { blobToBase64(file, (base64) => { fetch(`http://${process.env.REACT_APP_ROOT}/set-user-image`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ image: base64, email: localStorage.getItem('email'), }), }) .then((res) => res.json()) .then((data) => { if (data.ok) { setFile(false); setUser(data.user); setModal(false); window.location.reload(); } }) .catch((err) => console.log(err)); }); }; const blobToBase64 = function (blob, cb) { var reader = new FileReader(); reader.onload = function () { var dataUrl = reader.result; var base64 = dataUrl.split(',')[1]; cb(base64); }; reader.readAsDataURL(blob); }; return ( <FormPage modal={modal} setModal={setModal}> <h1>Изменить фото профиля</h1> <div className="form-group"> <ImageCrop aspect={1 / 1} height={100} nextImage={nextImage} clickRef={customRef} /> <div className={croppedImageUrl ? 'background' : 'blocked background'} onClick={croppedImageUrl ? null : () => customRef.current.click()} > <img style={{ display: croppedImageUrl ? 'none' : 'block' }} src={plus} alt="plus" /> </div> </div> </FormPage> ); }; export default ProjectImages;
28.144928
76
0.53862
false
true
false
true
d00d920414453b26970430f8d0c8b72c0d9a7634
1,579
jsx
JSX
src/components/auth/signin.jsx
UncleVesimir/saga-server-side-client
668dbbb809d3dfc5d32ec81feb0c38d4dd36d66f
[ "MIT" ]
null
null
null
src/components/auth/signin.jsx
UncleVesimir/saga-server-side-client
668dbbb809d3dfc5d32ec81feb0c38d4dd36d66f
[ "MIT" ]
null
null
null
src/components/auth/signin.jsx
UncleVesimir/saga-server-side-client
668dbbb809d3dfc5d32ec81feb0c38d4dd36d66f
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import { connect } from 'react-redux' import { Field, reduxForm } from 'redux-form' import { dispatchLoginRequest } from '../../actions'; class Signin extends Component { renderField = ({input, label, type, meta:{touched, error}}) => { return ( <div> <label htmlFor={input.name}>{label}</label> <input className="form-control" id={input.name} type={type} {...input}/> </div> ) } renderAlert = () => { if(this.props.authError){ return ( <div className="alert alert-danger"> <strong>Oops!</strong> {this.props.authError} </div> ); } } onSubmit = ({email, password}) =>{ this.props.dispatchLoginRequest(email, password); } render() { const { handleSubmit } = this.props; return ( <form onSubmit={handleSubmit(this.onSubmit)}> <Field className="form-control" label = "Email" name= "email" type = "text" component = {this.renderField} /> <Field className="form-control" label = "Password" name= "password" type = "password" component = {this.renderField} /> {this.renderAlert()} <button type="submit" className="btn btn-primary">Sign In</button> </form> ) } } function mapStateToProps(state){ return {authError:state.auth.error} } export default reduxForm({ form: 'signin' })(connect(mapStateToProps, { dispatchLoginRequest })(Signin))
24.292308
76
0.565548
false
true
true
false
d00d94da75d979d00533223222756d9832a94dc6
1,970
jsx
JSX
frontend/src/todo/todoForm.jsx
jeangregolon/todo-app
e39bd7b7dd64e9915f378b7007e23f59fa05b59e
[ "MIT" ]
null
null
null
frontend/src/todo/todoForm.jsx
jeangregolon/todo-app
e39bd7b7dd64e9915f378b7007e23f59fa05b59e
[ "MIT" ]
null
null
null
frontend/src/todo/todoForm.jsx
jeangregolon/todo-app
e39bd7b7dd64e9915f378b7007e23f59fa05b59e
[ "MIT" ]
null
null
null
import React, {Component} from 'react' import {connect} from 'react-redux' import {bindActionCreators} from 'redux' import Grid from '../template/grid' import IconButton from '../template/iconButton' import {add, changeDescription, search, clear} from './todoActions' class TodoForm extends Component { constructor(props){ super(props) this.keyHandler = this.keyHandler.bind(this) } componentWillMount() { this.props.search() } keyHandler(e){ const { add, clear, search, description} = this.props if (e.key === 'Enter'){ e.shiftKey ? search() : add(description) }else if (e.key === 'Escape'){ clear() } } render(){ const { add, search, description} = this.props return ( <div role='form' className='todoForm'> <Grid cols='12 9 10'> <input id='description' className='form-control' placeholder='Adicione uma tarefa' onChange={this.props.changeDescription} onKeyUp={this.keyHandler} value={this.props.description}></input> </Grid> <Grid cols='12 3 2'> <IconButton style='primary' icon='plus' onClick={() => add(description)}></IconButton> <IconButton style='info' icon='search' onClick={search}></IconButton> <IconButton style='default' icon='close' onClick={this.props.clear}></IconButton> </Grid> </div> ) } } const mapStateToProps = state => ({description: state.todo.description}) const mapDispatchToProps = dispatch => bindActionCreators({add, changeDescription, search, clear}, dispatch) export default connect(mapStateToProps, mapDispatchToProps)(TodoForm)
34.561404
73
0.548731
false
true
true
false
d00d9c35471f57ba8f75b1da32ac7a015046865a
164
jsx
JSX
app/eventHandlers/utils/doInvisibleAllTopFolders.jsx
Luk-kar/Blending-PSD-colors-toolset
81e7a6c0d73a392aaa2e940a5f0e3d0b3a08a686
[ "MIT" ]
1
2022-02-04T01:31:29.000Z
2022-02-04T01:31:29.000Z
app/eventHandlers/utils/doInvisibleAllTopFolders.jsx
Luk-kar/Blending-PSD-colors-toolset
81e7a6c0d73a392aaa2e940a5f0e3d0b3a08a686
[ "MIT" ]
null
null
null
app/eventHandlers/utils/doInvisibleAllTopFolders.jsx
Luk-kar/Blending-PSD-colors-toolset
81e7a6c0d73a392aaa2e940a5f0e3d0b3a08a686
[ "MIT" ]
null
null
null
#include "./doInvisible.jsx" function doInvisibleAllTopFolders() { var doc = app.activeDocument; var folders = doc.layerSets; doInvisible(folders); }
18.222222
37
0.707317
false
true
false
true
d00dab8371b98b1665a14240f9c376156f2b8044
1,516
jsx
JSX
client/app/User/components/Reusable/LoaderSpinner/LoaderSpinner.jsx
priteshpatel3501/E-Commerce-Auth-Demo
4c71095fd65bdae2319d9a480b1df663b78d10b3
[ "MIT" ]
null
null
null
client/app/User/components/Reusable/LoaderSpinner/LoaderSpinner.jsx
priteshpatel3501/E-Commerce-Auth-Demo
4c71095fd65bdae2319d9a480b1df663b78d10b3
[ "MIT" ]
null
null
null
client/app/User/components/Reusable/LoaderSpinner/LoaderSpinner.jsx
priteshpatel3501/E-Commerce-Auth-Demo
4c71095fd65bdae2319d9a480b1df663b78d10b3
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import "./LoaderSpinner.scss"; // import Loaderr from "react-loader-spinner"; // import "react-loader-spinner/dist/loader/css/react-spinner-loader.css"; class LoaderSpinner extends Component { render() { let { width, height, color, borderWidth, animationDuration } = this.props; return ( // <div class="loader">Loading...</div> // <div // id="loader" // style={{ // position: "fixed", // top: 0, // bottom: 0, // left: 0, // right: 0, // background: "#fff", // zIndex: 9999 // }} // > // <div className="cssload-speeding-wheel loader text-center"> // <Loaderr // type="Oval" // color="#233750" // height={30} // width={30} // // timeout={3000} //3 secs // /> // </div> // </div> <span className="spinner" style={{ width: width, height: height, borderTopColor: color, borderWidth: borderWidth, animationDuration: animationDuration }}></span> ); } } export default LoaderSpinner; // <div className="preloader"> // <div className="cssload-speeding-wheel loader"></div> // </div>
31.583333
82
0.443931
false
true
true
false
d00db4d5c2be68b09b5390f8f15fa08154822e72
1,752
jsx
JSX
client/src/components/featured/Featured.jsx
GabrielPivoto/clone-netflix
31ef33e711216c20035aca72e8e0b2f1ac840180
[ "MIT" ]
1
2022-03-29T01:17:07.000Z
2022-03-29T01:17:07.000Z
client/src/components/featured/Featured.jsx
GabrielPivoto/clone-netflix
31ef33e711216c20035aca72e8e0b2f1ac840180
[ "MIT" ]
null
null
null
client/src/components/featured/Featured.jsx
GabrielPivoto/clone-netflix
31ef33e711216c20035aca72e8e0b2f1ac840180
[ "MIT" ]
null
null
null
import { InfoOutlined, PlayArrow } from '@material-ui/icons' import React from 'react' import "./featured.scss" export default function Featured({ type }) { return ( <div className="featured"> {type && ( <div className="category"> <span>{type === "movie"?"Filmes":"Séries"}</span> <select name="genre" id="genre"> <option >Gênero</option> <option value="adventure">Aventura</option> <option value="comedy">Comédia</option> <option value="crime">Crime</option> <option value="fantasy">Fantasia</option> <option value="horror">Terror</option> <option value="romance">Romance</option> <option value="sci-fi">Ficção</option> <option value="thriller">Thriller</option> <option value="western">Faroeste</option> <option value="animation">Animação</option> <option value="drama">Drama</option> <option value="documentary">Documentário</option> </select> </div> )} <img src="https://www.inatel.br/imprensa/images/Campus_Inatel.JPG" alt="" /> <div className="info"> <img src="https://s3-sa-east-1.amazonaws.com/prod-jobsite-files.kenoby.com/uploads/inatel-1610566114-inatelpng.png" alt="" /> <span className="desc"> Um documentário sobre a melhor faculdade de engenharia do Brasil. </span> <div className="buttons"> <button className="play"> <PlayArrow /> <span>Play</span> </button> <button className="more"> <InfoOutlined /> <span>Info</span> </button> </div> </div> </div> ); }
37.276596
131
0.563356
false
true
false
true
d00db885473ff144cf90ac79ce47b5d5de1d7b03
427
jsx
JSX
app/components/NotFound.jsx
mhmiles/hollingsware.com
03791a87c7f1eb7046b8ad175abfd390e0270ecb
[ "MIT" ]
1
2017-01-27T03:18:09.000Z
2017-01-27T03:18:09.000Z
app/components/NotFound.jsx
mhmiles/hollingsware.com
03791a87c7f1eb7046b8ad175abfd390e0270ecb
[ "MIT" ]
null
null
null
app/components/NotFound.jsx
mhmiles/hollingsware.com
03791a87c7f1eb7046b8ad175abfd390e0270ecb
[ "MIT" ]
null
null
null
import React from 'react' import styles from './NotFound.css' import Helmet from 'react-helmet' import Line from './PixelLine' export default () => { return ( <div className={styles.container}> <Line style={{top: 0, position: "absolute", backgroundColor: "rgba(0,0,0,0.15)"}} /> <Helmet> <title>Hollingsware - Page not found</title> </Helmet> <span>Page Not Found</span> </div> ) }
25.117647
90
0.622951
false
true
false
true
d00dc7e67c95239d46e17f5c0a1d466c1566665a
2,102
jsx
JSX
backend/frontend/src/components/ProjectForm.jsx
GoodGuy4221/my-todo-site-on-drf
788bc9f8c33432ccd6a92a3c07ee6953b039478b
[ "MIT" ]
null
null
null
backend/frontend/src/components/ProjectForm.jsx
GoodGuy4221/my-todo-site-on-drf
788bc9f8c33432ccd6a92a3c07ee6953b039478b
[ "MIT" ]
null
null
null
backend/frontend/src/components/ProjectForm.jsx
GoodGuy4221/my-todo-site-on-drf
788bc9f8c33432ccd6a92a3c07ee6953b039478b
[ "MIT" ]
null
null
null
import React from "react"; class ProjectForm extends React.Component { constructor(props) { super(props); this.state = { name: '', url: '', users: [] } } handleUserChange(event) { if (!event.target.selectedOptions) { this.setState({ 'user': [] }) return; } let users = [] for (let i = 0; i < event.target.selectedOptions.length; i++) { users.push(event.target.selectedOptions.item(i).value) } this.setState({ 'users': users }) console.log(users) } handleChange(event) { this.setState({[event.target.name]: event.target.value}) } handleSubmit(event) { event.preventDefault() this.props.createProject(this.state) } render() { return ( <> <h1 className='text-center'>Создание нового проекта</h1> <form onSubmit={(event => this.handleSubmit(event))}> <div className='form-group'> <label for='name'>Название</label> <input type='text' name='name' placeholder='name' onChange={(event) => this.handleChange(event)}/> </div> <div className='form-group'> <label for='url'>Ссылка на репозиторий</label> <input type='url' name='url' placeholder='repo url' onChange={(event) => this.handleChange(event)}/> </div> <select name="user" multiple onChange={(event) => this.handleUserChange(event)}> {this.props.users.map((item) => <option value={item.id}>{item.username}</option>)} </select> <input type="submit" value="Отправить"/> </form> </> ) } } export default ProjectForm
30.028571
110
0.454805
false
true
true
false
d00dcfad7a8735e0ae0a908e373ab5f0a73e3e25
1,944
jsx
JSX
src/components/Post.jsx
ryguybenson/React-week-one
fff529267b1c13325330f6d718232ce12dcdb6b7
[ "Unlicense" ]
null
null
null
src/components/Post.jsx
ryguybenson/React-week-one
fff529267b1c13325330f6d718232ce12dcdb6b7
[ "Unlicense" ]
null
null
null
src/components/Post.jsx
ryguybenson/React-week-one
fff529267b1c13325330f6d718232ce12dcdb6b7
[ "Unlicense" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import { v4 } from 'uuid'; function Post(props) { let _name =null; let _price =null; let _content =null; function handleNewPost(event) { event.preventDefault(); props.onNewPostCreation({name: _name.value, price: _price.value, content: _content.value, id: v4()}); _name.value = ''; _price.value = ''; _content.value = ''; console.log(props.onNewPostCreation); } const postStyle = { backgroundImage: 'linear-gradient(to bottom,#282828,#484848,#282828)', display: 'flex', flexFlow: 'row nowrap', justifyContent: 'center', alignItems: 'center', height: '60px', width: '100vw', margin: 'auto' }; const formWidth = { width: '75%', display: 'flex', flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center' }; const formStyle = { height: '30px', width: '30%', backgroundColor: '#fff', }; const inputStyle = { paddingLeft: '20px', backgroundColor: '#fff', height: '100%', width: 'calc(100% - 22px)', }; const buttonStyle ={ marginLeft: '10px' }; return ( <div style={postStyle}> <form onSubmit={handleNewPost} style={formWidth}> <div style={formStyle}> <input style={inputStyle} placeholder='Name/Brand' type='text' ref={(input) => {_name = input;}}/> </div> <div style={formStyle}> <input style={inputStyle} placeholder='Alcohol Content' type='text' ref={(input) => {_content = input;}}/> </div> <div style={formStyle}> <input style={inputStyle} placeholder='Price' type='text' ref={(input) => {_price = input;}}/> </div> <button style={buttonStyle} type='submit'>ADD</button> </form> </div> ); } Post.propTypes = { onNewPostCreation: PropTypes.func }; export default Post;
23.707317
105
0.588992
false
true
false
true
d00dde082d8c50c205e62879df4761d74d73e098
348
jsx
JSX
frontend/.history/src/components/posts/Posts/Post_20201118144235.jsx
Flea00012/Group-webDev1
8ecfb469c1cb3930f7028dfebee0b66030c04b05
[ "MIT" ]
null
null
null
frontend/.history/src/components/posts/Posts/Post_20201118144235.jsx
Flea00012/Group-webDev1
8ecfb469c1cb3930f7028dfebee0b66030c04b05
[ "MIT" ]
25
2020-11-16T12:46:38.000Z
2020-11-24T09:26:27.000Z
frontend/.history/src/components/posts/Posts/Post_20201118144235.jsx
Flea00012/Group-webDev1
8ecfb469c1cb3930f7028dfebee0b66030c04b05
[ "MIT" ]
3
2020-11-16T14:10:40.000Z
2020-12-26T17:53:01.000Z
import React from 'react'; import Comments from '../Comments/Comments' export default function Post() { functionNow = () => { console.log (group); } return ( <> <hr /> <h1>Post that was submitted</h1> <hr /> <label>{functionNow()}</label> <Comments /> </> ); }
14.5
43
0.482759
false
true
false
true
d00dea26f37761bef73300fcdc6ded438858d409
1,219
jsx
JSX
shopify_supply/src/components/ProductCard.client.jsx
IT-Hobo/hydrogen-examples
e6f3898ca28189d2f0caed5ba340308ed56172f8
[ "MIT" ]
2
2022-02-02T05:07:48.000Z
2022-02-18T20:52:44.000Z
shopify_supply/src/components/ProductCard.client.jsx
IT-Hobo/hydrogen-examples
e6f3898ca28189d2f0caed5ba340308ed56172f8
[ "MIT" ]
null
null
null
shopify_supply/src/components/ProductCard.client.jsx
IT-Hobo/hydrogen-examples
e6f3898ca28189d2f0caed5ba340308ed56172f8
[ "MIT" ]
null
null
null
import { Link, ProductProvider, ProductTitle, SelectedVariantImage, SelectedVariantPrice, } from '@shopify/hydrogen/client'; export default function ProductCard({product}) { const firstVariant = product?.variants?.edges[0]?.node; if (!product) return null; return ( <ProductProvider product={product} initialVariantId={firstVariant.id}> <Link to={`/products/${product.handle}`}> <SelectedVariantImage className="rounded-md bg-gray-100 h-80 w-96 mb-2" /> <ProductTitle className="text-gray-900 font-medium" /> </Link> <div className="flex items-center"> <SelectedVariantPrice className="text-gray-900"> {({currencyCode, amount, currencyNarrowSymbol}) => { return ( <span>{`${currencyCode} ${currencyNarrowSymbol}${amount}`}</span> ); }} </SelectedVariantPrice> <SelectedVariantPrice priceType="compareAt" className="text-gray-400 line-through" > {({amount, currencyNarrowSymbol}) => { return <span>{`${currencyNarrowSymbol}${amount}`}</span>; }} </SelectedVariantPrice> </div> </ProductProvider> ); }
30.475
82
0.611977
false
true
false
true
d00df3a09f94dfca5122969cecb4751adfc10916
9,039
jsx
JSX
superset/assets/src/dashboard/components/gridComponents/Tabs.jsx
Will-Copeland/incubator-superset
925b8dbb90552aa1a66c2f0bcdcf7d1252ab925f
[ "Apache-2.0", "CC-BY-4.0", "MIT" ]
1
2020-05-12T05:00:11.000Z
2020-05-12T05:00:11.000Z
superset/assets/src/dashboard/components/gridComponents/Tabs.jsx
Will-Copeland/incubator-superset
925b8dbb90552aa1a66c2f0bcdcf7d1252ab925f
[ "Apache-2.0", "CC-BY-4.0", "MIT" ]
null
null
null
superset/assets/src/dashboard/components/gridComponents/Tabs.jsx
Will-Copeland/incubator-superset
925b8dbb90552aa1a66c2f0bcdcf7d1252ab925f
[ "Apache-2.0", "CC-BY-4.0", "MIT" ]
3
2019-10-28T02:28:58.000Z
2020-05-21T10:00:32.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 { Tabs as BootstrapTabs, Tab as BootstrapTab } from 'react-bootstrap'; import DragDroppable from '../dnd/DragDroppable'; import DragHandle from '../dnd/DragHandle'; import DashboardComponent from '../../containers/DashboardComponent'; import DeleteComponentButton from '../DeleteComponentButton'; import HoverMenu from '../menu/HoverMenu'; import findTabIndexByComponentId from '../../util/findTabIndexByComponentId'; import { componentShape } from '../../util/propShapes'; import { NEW_TAB_ID, DASHBOARD_ROOT_ID } from '../../util/constants'; import { RENDER_TAB, RENDER_TAB_CONTENT } from './Tab'; import { TAB_TYPE } from '../../util/componentTypes'; import { LOG_ACTIONS_SELECT_DASHBOARD_TAB } from '../../../logger/LogUtils'; const NEW_TAB_INDEX = -1; const MAX_TAB_COUNT = 7; const propTypes = { id: PropTypes.string.isRequired, parentId: PropTypes.string.isRequired, component: componentShape.isRequired, parentComponent: componentShape.isRequired, index: PropTypes.number.isRequired, depth: PropTypes.number.isRequired, renderTabContent: PropTypes.bool, // whether to render tabs + content or just tabs editMode: PropTypes.bool.isRequired, renderHoverMenu: PropTypes.bool, logEvent: PropTypes.func.isRequired, directPathToChild: PropTypes.arrayOf(PropTypes.string), // grid related availableColumnCount: PropTypes.number, columnWidth: PropTypes.number, onResizeStart: PropTypes.func, onResize: PropTypes.func, onResizeStop: PropTypes.func, // dnd createComponent: PropTypes.func.isRequired, handleComponentDrop: PropTypes.func.isRequired, onChangeTab: PropTypes.func, deleteComponent: PropTypes.func.isRequired, updateComponents: PropTypes.func.isRequired, }; const defaultProps = { children: null, renderTabContent: true, renderHoverMenu: true, availableColumnCount: 0, columnWidth: 0, directPathToChild: [], onChangeTab() {}, onResizeStart() {}, onResize() {}, onResizeStop() {}, }; class Tabs extends React.PureComponent { constructor(props) { super(props); const tabIndex = findTabIndexByComponentId({ currentComponent: props.component, directPathToChild: props.directPathToChild, }); this.state = { tabIndex, }; this.handleClickTab = this.handleClickTab.bind(this); this.handleDeleteComponent = this.handleDeleteComponent.bind(this); this.handleDeleteTab = this.handleDeleteTab.bind(this); this.handleDropOnTab = this.handleDropOnTab.bind(this); } componentWillReceiveProps(nextProps) { const maxIndex = Math.max(0, nextProps.component.children.length - 1); if (this.state.tabIndex > maxIndex) { this.setState(() => ({ tabIndex: maxIndex })); } } handleClickTab(tabIndex) { const { component, createComponent } = this.props; if (tabIndex === NEW_TAB_INDEX) { createComponent({ destination: { id: component.id, type: component.type, index: component.children.length, }, dragging: { id: NEW_TAB_ID, type: TAB_TYPE, }, }); } else if (tabIndex !== this.state.tabIndex) { this.props.logEvent(LOG_ACTIONS_SELECT_DASHBOARD_TAB, { tab_id: component.id, index: tabIndex, }); this.setState(() => ({ tabIndex })); this.props.onChangeTab({ tabIndex, tabId: component.children[tabIndex] }); } } handleDeleteComponent() { const { deleteComponent, id, parentId } = this.props; deleteComponent(id, parentId); } handleDeleteTab(tabIndex) { this.handleClickTab(Math.max(0, tabIndex - 1)); } handleDropOnTab(dropResult) { const { component } = this.props; // Ensure dropped tab is visible const { destination } = dropResult; if (destination) { const dropTabIndex = destination.id === component.id ? destination.index // dropped ON tabs : component.children.indexOf(destination.id); // dropped IN tab if (dropTabIndex > -1) { setTimeout(() => { this.handleClickTab(dropTabIndex); }, 30); } } } render() { const { depth, component: tabsComponent, parentComponent, index, availableColumnCount, columnWidth, onResizeStart, onResize, onResizeStop, handleComponentDrop, renderTabContent, renderHoverMenu, isComponentVisible: isCurrentTabVisible, editMode, } = this.props; const { tabIndex: selectedTabIndex } = this.state; const { children: tabIds } = tabsComponent; return ( <DragDroppable component={tabsComponent} parentComponent={parentComponent} orientation="row" index={index} depth={depth} onDrop={handleComponentDrop} editMode={editMode} > {({ dropIndicatorProps: tabsDropIndicatorProps, dragSourceRef: tabsDragSourceRef, }) => ( <div className="dashboard-component dashboard-component-tabs"> {editMode && renderHoverMenu && ( <HoverMenu innerRef={tabsDragSourceRef} position="left"> <DragHandle position="left" /> <DeleteComponentButton onDelete={this.handleDeleteComponent} /> </HoverMenu> )} <BootstrapTabs id={tabsComponent.id} activeKey={selectedTabIndex} onSelect={this.handleClickTab} animation mountOnEnter unmountOnExit={false} > {tabIds.map((tabId, tabIndex) => ( // react-bootstrap doesn't render a Tab if we move this to its own Tab.jsx so we // use `renderType` to indicate what the DashboardComponent should render. This // prevents us from passing the entire dashboard component lookup to render Tabs.jsx <BootstrapTab key={tabId} eventKey={tabIndex} title={ <DashboardComponent id={tabId} parentId={tabsComponent.id} depth={depth} index={tabIndex} renderType={RENDER_TAB} availableColumnCount={availableColumnCount} columnWidth={columnWidth} onDropOnTab={this.handleDropOnTab} onDeleteTab={this.handleDeleteTab} /> } > {renderTabContent && ( <DashboardComponent id={tabId} parentId={tabsComponent.id} depth={depth} // see isValidChild.js for why tabs don't increment child depth index={tabIndex} renderType={RENDER_TAB_CONTENT} availableColumnCount={availableColumnCount} columnWidth={columnWidth} onResizeStart={onResizeStart} onResize={onResize} onResizeStop={onResizeStop} onDropOnTab={this.handleDropOnTab} isComponentVisible={ selectedTabIndex === tabIndex && isCurrentTabVisible } /> )} </BootstrapTab> ))} {editMode && tabIds.length < MAX_TAB_COUNT && ( <BootstrapTab eventKey={NEW_TAB_INDEX} title={<div className="fa fa-plus" />} /> )} </BootstrapTabs> {/* don't indicate that a drop on root is allowed when tabs already exist */} {tabsDropIndicatorProps && parentComponent.id !== DASHBOARD_ROOT_ID && ( <div {...tabsDropIndicatorProps} /> )} </div> )} </DragDroppable> ); } } Tabs.propTypes = propTypes; Tabs.defaultProps = defaultProps; export default Tabs;
32.989051
100
0.610134
false
true
false
true
d00dfa0473283385f887d153b4b8b6940d69da6b
818
jsx
JSX
src/index.jsx
kirkins/etheroll
183ae8a0509f3dc216f23663fd66b3a7b6a7280f
[ "MIT" ]
null
null
null
src/index.jsx
kirkins/etheroll
183ae8a0509f3dc216f23663fd66b3a7b6a7280f
[ "MIT" ]
null
null
null
src/index.jsx
kirkins/etheroll
183ae8a0509f3dc216f23663fd66b3a7b6a7280f
[ "MIT" ]
null
null
null
import React from 'react'; import ReactDOM from 'react-dom'; import setupGA from './utils/analytics'; import setupSentry from './utils/sentry'; import IntlContextProvider from './contexts/IntlContext'; import './index.css'; import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap/dist/js/bootstrap.min'; import '@fortawesome/fontawesome-free/css/all.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; setupGA(); setupSentry(); ReactDOM.render( <IntlContextProvider> <App /> </IntlContextProvider>, document.getElementById('root'), ); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA serviceWorker.unregister();
30.296296
72
0.744499
false
true
false
true
d00dff948519b413e17ab0d17fcd09164bf78a14
19,882
jsx
JSX
src/lib/project-saver-hoc.jsx
xufangbo/scratch-gui
c656e7febb5df525dc04c3da2e5a3d23978f31a7
[ "BSD-3-Clause" ]
3,559
2016-11-09T02:32:40.000Z
2022-03-31T05:02:15.000Z
src/lib/project-saver-hoc.jsx
xufangbo/scratch-gui
c656e7febb5df525dc04c3da2e5a3d23978f31a7
[ "BSD-3-Clause" ]
5,654
2016-11-09T16:30:47.000Z
2022-03-31T20:20:59.000Z
src/lib/project-saver-hoc.jsx
xufangbo/scratch-gui
c656e7febb5df525dc04c3da2e5a3d23978f31a7
[ "BSD-3-Clause" ]
3,105
2016-11-15T15:39:23.000Z
2022-03-31T12:10:33.000Z
import bindAll from 'lodash.bindall'; import React from 'react'; import PropTypes from 'prop-types'; import {connect} from 'react-redux'; import VM from 'scratch-vm'; import collectMetadata from '../lib/collect-metadata'; import log from '../lib/log'; import storage from '../lib/storage'; import dataURItoBlob from '../lib/data-uri-to-blob'; import saveProjectToServer from '../lib/save-project-to-server'; import { showAlertWithTimeout, showStandardAlert } from '../reducers/alerts'; import {setAutoSaveTimeoutId} from '../reducers/timeout'; import {setProjectUnchanged} from '../reducers/project-changed'; import { LoadingStates, autoUpdateProject, createProject, doneCreatingProject, doneUpdatingProject, getIsAnyCreatingNewState, getIsCreatingCopy, getIsCreatingNew, getIsLoading, getIsManualUpdating, getIsRemixing, getIsShowingWithId, getIsShowingWithoutId, getIsUpdating, projectError } from '../reducers/project-state'; /** * Higher Order Component to provide behavior for saving projects. * @param {React.Component} WrappedComponent the component to add project saving functionality to * @returns {React.Component} WrappedComponent with project saving functionality added * * <ProjectSaverHOC> * <WrappedComponent /> * </ProjectSaverHOC> */ const ProjectSaverHOC = function (WrappedComponent) { class ProjectSaverComponent extends React.Component { constructor (props) { super(props); bindAll(this, [ 'getProjectThumbnail', 'leavePageConfirm', 'tryToAutoSave' ]); } componentWillMount () { if (typeof window === 'object') { // Note: it might be better to use a listener instead of assigning onbeforeunload; // but then it'd be hard to turn this listening off in our tests window.onbeforeunload = e => this.leavePageConfirm(e); } // Allow the GUI consumer to pass in a function to receive a trigger // for triggering thumbnail or whole project saves. // These functions are called with null on unmount to prevent stale references. this.props.onSetProjectThumbnailer(this.getProjectThumbnail); this.props.onSetProjectSaver(this.tryToAutoSave); } componentDidUpdate (prevProps) { if (!this.props.isAnyCreatingNewState && prevProps.isAnyCreatingNewState) { this.reportTelemetryEvent('projectWasCreated'); } if (!this.props.isLoading && prevProps.isLoading) { this.reportTelemetryEvent('projectDidLoad'); } if (this.props.projectChanged && !prevProps.projectChanged) { this.scheduleAutoSave(); } if (this.props.isUpdating && !prevProps.isUpdating) { this.updateProjectToStorage(); } if (this.props.isCreatingNew && !prevProps.isCreatingNew) { this.createNewProjectToStorage(); } if (this.props.isCreatingCopy && !prevProps.isCreatingCopy) { this.createCopyToStorage(); } if (this.props.isRemixing && !prevProps.isRemixing) { this.props.onRemixing(true); this.createRemixToStorage(); } else if (!this.props.isRemixing && prevProps.isRemixing) { this.props.onRemixing(false); } // see if we should "create" the current project on the server // // don't try to create or save immediately after trying to create if (prevProps.isCreatingNew) return; // if we're newly able to create this project, create it! if (this.isShowingCreatable(this.props) && !this.isShowingCreatable(prevProps)) { this.props.onCreateProject(); } // see if we should save/update the current project on the server // // don't try to save immediately after trying to save if (prevProps.isUpdating) return; // if we're newly able to save this project, save it! const becameAbleToSave = this.props.canSave && !prevProps.canSave; const becameShared = this.props.isShared && !prevProps.isShared; if (this.props.isShowingSaveable && (becameAbleToSave || becameShared)) { this.props.onAutoUpdateProject(); } } componentWillUnmount () { this.clearAutoSaveTimeout(); // Cant unset the beforeunload because it might no longer belong to this component // i.e. if another of this component has been mounted before this one gets unmounted // which happens when going from project to editor view. // window.onbeforeunload = undefined; // eslint-disable-line no-undefined // Remove project thumbnailer function since the components are unmounting this.props.onSetProjectThumbnailer(null); this.props.onSetProjectSaver(null); } leavePageConfirm (e) { if (this.props.projectChanged) { // both methods of returning a value may be necessary for browser compatibility (e || window.event).returnValue = true; return true; } return; // Returning undefined prevents the prompt from coming up } clearAutoSaveTimeout () { if (this.props.autoSaveTimeoutId !== null) { clearTimeout(this.props.autoSaveTimeoutId); this.props.setAutoSaveTimeoutId(null); } } scheduleAutoSave () { if (this.props.isShowingSaveable && this.props.autoSaveTimeoutId === null) { const timeoutId = setTimeout(this.tryToAutoSave, this.props.autoSaveIntervalSecs * 1000); this.props.setAutoSaveTimeoutId(timeoutId); } } tryToAutoSave () { if (this.props.projectChanged && this.props.isShowingSaveable) { this.props.onAutoUpdateProject(); } } isShowingCreatable (props) { return props.canCreateNew && props.isShowingWithoutId; } updateProjectToStorage () { this.props.onShowSavingAlert(); return this.storeProject(this.props.reduxProjectId) .then(() => { // there's an http response object available here, but we don't need to examine // it, because there are no values contained in it that we care about this.props.onUpdatedProject(this.props.loadingState); this.props.onShowSaveSuccessAlert(); }) .catch(err => { // Always show the savingError alert because it gives the // user the chance to download or retry the save manually. this.props.onShowAlert('savingError'); this.props.onProjectError(err); }); } createNewProjectToStorage () { return this.storeProject(null) .then(response => { this.props.onCreatedProject(response.id.toString(), this.props.loadingState); }) .catch(err => { this.props.onShowAlert('creatingError'); this.props.onProjectError(err); }); } createCopyToStorage () { this.props.onShowCreatingCopyAlert(); return this.storeProject(null, { originalId: this.props.reduxProjectId, isCopy: 1, title: this.props.reduxProjectTitle }) .then(response => { this.props.onCreatedProject(response.id.toString(), this.props.loadingState); this.props.onShowCopySuccessAlert(); }) .catch(err => { this.props.onShowAlert('creatingError'); this.props.onProjectError(err); }); } createRemixToStorage () { this.props.onShowCreatingRemixAlert(); return this.storeProject(null, { originalId: this.props.reduxProjectId, isRemix: 1, title: this.props.reduxProjectTitle }) .then(response => { this.props.onCreatedProject(response.id.toString(), this.props.loadingState); this.props.onShowRemixSuccessAlert(); }) .catch(err => { this.props.onShowAlert('creatingError'); this.props.onProjectError(err); }); } /** * storeProject: * @param {number|string|undefined} projectId - defined value will PUT/update; undefined/null will POST/create * @return {Promise} - resolves with json object containing project's existing or new id * @param {?object} requestParams - object of params to add to request body */ storeProject (projectId, requestParams) { requestParams = requestParams || {}; this.clearAutoSaveTimeout(); // Serialize VM state now before embarking on // the asynchronous journey of storing assets to // the server. This ensures that assets don't update // while in the process of saving a project (e.g. the // serialized project refers to a newer asset than what // we just finished saving). const savedVMState = this.props.vm.toJSON(); return Promise.all(this.props.vm.assets .filter(asset => !asset.clean) .map( asset => storage.store( asset.assetType, asset.dataFormat, asset.data, asset.assetId ).then(response => { // Asset servers respond with {status: ok} for successful POSTs if (response.status !== 'ok') { // Errors include a `code` property, e.g. "Forbidden" return Promise.reject(response.code); } asset.clean = true; }) ) ) .then(() => this.props.onUpdateProjectData(projectId, savedVMState, requestParams)) .then(response => { this.props.onSetProjectUnchanged(); const id = response.id.toString(); if (id && this.props.onUpdateProjectThumbnail) { this.storeProjectThumbnail(id); } this.reportTelemetryEvent('projectDidSave'); return response; }) .catch(err => { log.error(err); throw err; // pass the error up the chain }); } /** * Store a snapshot of the project once it has been saved/created. * Needs to happen _after_ save because the project must have an ID. * @param {!string} projectId - id of the project, must be defined. */ storeProjectThumbnail (projectId) { try { this.getProjectThumbnail(dataURI => { this.props.onUpdateProjectThumbnail(projectId, dataURItoBlob(dataURI)); }); } catch (e) { log.error('Project thumbnail save error', e); // This is intentionally fire/forget because a failure // to save the thumbnail is not vitally important to the user. } } getProjectThumbnail (callback) { this.props.vm.postIOData('video', {forceTransparentPreview: true}); this.props.vm.renderer.requestSnapshot(dataURI => { this.props.vm.postIOData('video', {forceTransparentPreview: false}); callback(dataURI); }); this.props.vm.renderer.draw(); } /** * Report a telemetry event. * @param {string} event - one of `projectWasCreated`, `projectDidLoad`, `projectDidSave`, `projectWasUploaded` */ // TODO make a telemetry HOC and move this stuff there reportTelemetryEvent (event) { try { if (this.props.onProjectTelemetryEvent) { const metadata = collectMetadata(this.props.vm, this.props.reduxProjectTitle, this.props.locale); this.props.onProjectTelemetryEvent(event, metadata); } } catch (e) { log.error('Telemetry error', event, e); // This is intentionally fire/forget because a failure // to report telemetry should not block saving } } render () { const { /* eslint-disable no-unused-vars */ autoSaveTimeoutId, autoSaveIntervalSecs, isCreatingCopy, isCreatingNew, projectChanged, isAnyCreatingNewState, isLoading, isManualUpdating, isRemixing, isShowingSaveable, isShowingWithId, isShowingWithoutId, isUpdating, loadingState, onAutoUpdateProject, onCreatedProject, onCreateProject, onProjectError, onRemixing, onSetProjectUnchanged, onSetProjectThumbnailer, onSetProjectSaver, onShowAlert, onShowCopySuccessAlert, onShowRemixSuccessAlert, onShowCreatingCopyAlert, onShowCreatingRemixAlert, onShowSaveSuccessAlert, onShowSavingAlert, onUpdatedProject, onUpdateProjectData, onUpdateProjectThumbnail, reduxProjectId, reduxProjectTitle, setAutoSaveTimeoutId: setAutoSaveTimeoutIdProp, /* eslint-enable no-unused-vars */ ...componentProps } = this.props; return ( <WrappedComponent isCreating={isAnyCreatingNewState} {...componentProps} /> ); } } ProjectSaverComponent.propTypes = { autoSaveIntervalSecs: PropTypes.number.isRequired, autoSaveTimeoutId: PropTypes.number, canCreateNew: PropTypes.bool, canSave: PropTypes.bool, isAnyCreatingNewState: PropTypes.bool, isCreatingCopy: PropTypes.bool, isCreatingNew: PropTypes.bool, isLoading: PropTypes.bool, isManualUpdating: PropTypes.bool, isRemixing: PropTypes.bool, isShared: PropTypes.bool, isShowingSaveable: PropTypes.bool, isShowingWithId: PropTypes.bool, isShowingWithoutId: PropTypes.bool, isUpdating: PropTypes.bool, loadingState: PropTypes.oneOf(LoadingStates), locale: PropTypes.string.isRequired, onAutoUpdateProject: PropTypes.func, onCreateProject: PropTypes.func, onCreatedProject: PropTypes.func, onProjectError: PropTypes.func, onProjectTelemetryEvent: PropTypes.func, onRemixing: PropTypes.func, onSetProjectSaver: PropTypes.func.isRequired, onSetProjectThumbnailer: PropTypes.func.isRequired, onSetProjectUnchanged: PropTypes.func.isRequired, onShowAlert: PropTypes.func, onShowCopySuccessAlert: PropTypes.func, onShowCreatingCopyAlert: PropTypes.func, onShowCreatingRemixAlert: PropTypes.func, onShowRemixSuccessAlert: PropTypes.func, onShowSaveSuccessAlert: PropTypes.func, onShowSavingAlert: PropTypes.func, onUpdateProjectData: PropTypes.func.isRequired, onUpdateProjectThumbnail: PropTypes.func, onUpdatedProject: PropTypes.func, projectChanged: PropTypes.bool, reduxProjectId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), reduxProjectTitle: PropTypes.string, setAutoSaveTimeoutId: PropTypes.func.isRequired, vm: PropTypes.instanceOf(VM).isRequired }; ProjectSaverComponent.defaultProps = { autoSaveIntervalSecs: 120, onRemixing: () => {}, onSetProjectThumbnailer: () => {}, onSetProjectSaver: () => {}, onUpdateProjectData: saveProjectToServer }; const mapStateToProps = (state, ownProps) => { const loadingState = state.scratchGui.projectState.loadingState; const isShowingWithId = getIsShowingWithId(loadingState); return { autoSaveTimeoutId: state.scratchGui.timeout.autoSaveTimeoutId, isAnyCreatingNewState: getIsAnyCreatingNewState(loadingState), isLoading: getIsLoading(loadingState), isCreatingCopy: getIsCreatingCopy(loadingState), isCreatingNew: getIsCreatingNew(loadingState), isRemixing: getIsRemixing(loadingState), isShowingSaveable: ownProps.canSave && isShowingWithId, isShowingWithId: isShowingWithId, isShowingWithoutId: getIsShowingWithoutId(loadingState), isUpdating: getIsUpdating(loadingState), isManualUpdating: getIsManualUpdating(loadingState), loadingState: loadingState, locale: state.locales.locale, projectChanged: state.scratchGui.projectChanged, reduxProjectId: state.scratchGui.projectState.projectId, reduxProjectTitle: state.scratchGui.projectTitle, vm: state.scratchGui.vm }; }; const mapDispatchToProps = dispatch => ({ onAutoUpdateProject: () => dispatch(autoUpdateProject()), onCreatedProject: (projectId, loadingState) => dispatch(doneCreatingProject(projectId, loadingState)), onCreateProject: () => dispatch(createProject()), onProjectError: error => dispatch(projectError(error)), onSetProjectUnchanged: () => dispatch(setProjectUnchanged()), onShowAlert: alertType => dispatch(showStandardAlert(alertType)), onShowCopySuccessAlert: () => showAlertWithTimeout(dispatch, 'createCopySuccess'), onShowRemixSuccessAlert: () => showAlertWithTimeout(dispatch, 'createRemixSuccess'), onShowCreatingCopyAlert: () => showAlertWithTimeout(dispatch, 'creatingCopy'), onShowCreatingRemixAlert: () => showAlertWithTimeout(dispatch, 'creatingRemix'), onShowSaveSuccessAlert: () => showAlertWithTimeout(dispatch, 'saveSuccess'), onShowSavingAlert: () => showAlertWithTimeout(dispatch, 'saving'), onUpdatedProject: loadingState => dispatch(doneUpdatingProject(loadingState)), setAutoSaveTimeoutId: id => dispatch(setAutoSaveTimeoutId(id)) }); // Allow incoming props to override redux-provided props. Used to mock in tests. const mergeProps = (stateProps, dispatchProps, ownProps) => Object.assign( {}, stateProps, dispatchProps, ownProps ); return connect( mapStateToProps, mapDispatchToProps, mergeProps )(ProjectSaverComponent); }; export { ProjectSaverHOC as default };
43.221739
119
0.584448
false
true
true
false
d00e0ec5e842677086182a38a7473638010f57fc
822
jsx
JSX
src/components/CardNota/CardNota.jsx
HenriqueCSaraiva/React-Note2.0
a0fc30997ec9b66bffabf39467c5423a34b26c5a
[ "MIT" ]
null
null
null
src/components/CardNota/CardNota.jsx
HenriqueCSaraiva/React-Note2.0
a0fc30997ec9b66bffabf39467c5423a34b26c5a
[ "MIT" ]
null
null
null
src/components/CardNota/CardNota.jsx
HenriqueCSaraiva/React-Note2.0
a0fc30997ec9b66bffabf39467c5423a34b26c5a
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import "./estilo.css"; import {ReactComponent as DELETESVG} from "../../assets/img/delete.svg"; class CardNota extends Component{ apagar(){ const indice = this.props.indice; this.props.apagarNota(indice); } render(){ return( <section className="card-nota"> <header className="card-nota_cabecalho"> <h3 className="card-nota_titulo">{this.props.titulo}</h3> <DELETESVG onClick={this.apagar.bind(this)} /> <h4>{this.props.categoria}</h4> </header> <p className="card-nota_texto">{this.props.texto}</p> </section> ); } } export default CardNota;
32.88
85
0.515815
false
true
true
false
d00e1282632c592e270a2a5525a3c84d9d887d70
2,966
jsx
JSX
blocks/UserTable/src/UserSearch.jsx
hopesfish/react-materials
684f361c8369e69f3359189809d1f045c4e57223
[ "MIT" ]
1
2020-09-19T08:07:16.000Z
2020-09-19T08:07:16.000Z
react-materials/blocks/UserTable/src/UserSearch.jsx
james-cain/ice
bfd7ba6af36ad6d1190001f78af6214a56d8935e
[ "MIT" ]
null
null
null
react-materials/blocks/UserTable/src/UserSearch.jsx
james-cain/ice
bfd7ba6af36ad6d1190001f78af6214a56d8935e
[ "MIT" ]
1
2019-04-09T21:53:07.000Z
2019-04-09T21:53:07.000Z
/* eslint-disable react/no-unused-state */ import React, { Component } from 'react'; import { Input, Select, Grid } from '@alifd/next'; import { FormBinderWrapper, FormBinder } from '@icedesign/form-binder'; import IceContainer from '@icedesign/container'; const { Row, Col } = Grid; export default class UserTable extends Component { static displayName = 'UserTable'; static propTypes = {}; static defaultProps = {}; constructor(props) { super(props); this.state = { formValue: {}, }; } formChange = (value) => { console.log('changed value', value); this.setState({ formValue: value, }); }; render() { const { formValue } = this.state; return ( <IceContainer title="搜索"> <FormBinderWrapper value={formValue} onChange={this.formChange}> <Row wrap> <Col xxs="24" l="8" style={styles.formCol}> <span style={styles.label}>学校:</span> <FormBinder name="university"> <Select placeholder="请选择" style={{ width: '200px' }}> <Select.Option value="zhejiang">浙江大学</Select.Option> <Select.Option value="fudan">上海复旦</Select.Option> <Select.Option value="zhongshan">中山大学</Select.Option> </Select> </FormBinder> </Col> <Col xxs="24" l="8" style={styles.formCol}> <span style={styles.label}>院系:</span> <FormBinder name="college"> <Select placeholder="请选择" style={{ width: '200px' }}> <Select.Option value="computer">计算机学院</Select.Option> <Select.Option value="design">设计学院</Select.Option> </Select> </FormBinder> </Col> <Col xxs="24" l="8" style={styles.formCol}> <span style={styles.label}>班级:</span> <FormBinder name="class"> <Input /> </FormBinder> </Col> <Col xxs="24" l="8" style={styles.formCol}> <span style={styles.label}>姓名:</span> <FormBinder name="name"> <Input /> </FormBinder> </Col> <Col xxs="24" l="8" style={styles.formCol}> <span style={styles.label}>电话:</span> <FormBinder name="phone"> <Input /> </FormBinder> </Col> <Col xxs="24" l="8" style={styles.formCol}> <span style={styles.label}>角色:</span> <FormBinder name="role"> <Input /> </FormBinder> </Col> </Row> </FormBinderWrapper> </IceContainer> ); } } const styles = { formRow: { marginBottom: '18px', }, formCol: { display: 'flex', alignItems: 'center', marginBottom: '20px', }, label: { lineHeight: '28px', paddingRight: '10px', }, };
29.366337
72
0.508766
false
true
true
false
d00e16e39d36866f2db6c248fd64e45ccc2ad0c5
7,631
jsx
JSX
web/src/editor/assets/ModelPanel.jsx
liugjin/ShadowEditor
7045dbc0b0f04a3eacb89a394b1a3ab42fc7a6f1
[ "MIT" ]
1
2021-11-13T05:30:38.000Z
2021-11-13T05:30:38.000Z
web/src/editor/assets/ModelPanel.jsx
liugjin/ShadowEditor
7045dbc0b0f04a3eacb89a394b1a3ab42fc7a6f1
[ "MIT" ]
null
null
null
web/src/editor/assets/ModelPanel.jsx
liugjin/ShadowEditor
7045dbc0b0f04a3eacb89a394b1a3ab42fc7a6f1
[ "MIT" ]
null
null
null
/* * Copyright 2017-2020 The ShadowEditor Authors. All rights reserved. * * Use of this source code is governed by a MIT-style * license that can be found in the LICENSE file. * * For more information, please visit: https://github.com/tengge1/ShadowEditor * You can also visit: https://gitee.com/tengge1/ShadowEditor */ import { classNames, PropTypes } from '../../third_party'; import { SearchField, ImageList } from '../../ui/index'; import EditModelWindow from './window/EditModelWindow.jsx'; import ModelLoader from '../../loader/ModelLoader'; import AddObjectCommand from '../../command/AddObjectCommand'; /** * 模型面板 * @author tengge / https://github.com/tengge1 */ class ModelPanel extends React.Component { constructor(props) { super(props); this.state = { data: [], categoryData: [], name: '', categories: [] }; this.handleClick = this.handleClick.bind(this); this.handleAdd = this.handleAdd.bind(this); this.handleEdit = this.handleEdit.bind(this); this.handleDelete = this.handleDelete.bind(this); this.update = this.update.bind(this); } render() { const { className, style } = this.props; const { data, categoryData, name, categories } = this.state; const { enableAuthority, authorities } = app.server; let list = data; if (name.trim() !== '') { list = list.filter(n => { return n.Name.toLowerCase().indexOf(name.toLowerCase()) > -1 || n.FirstPinYin.toLowerCase().indexOf(name.toLowerCase()) > -1 || n.TotalPinYin.toLowerCase().indexOf(name.toLowerCase()) > -1; }); } if (categories.length > 0) { list = list.filter(n => { return categories.indexOf(n.CategoryID) > -1; }); } const imageListData = list.map(n => { return Object.assign({}, n, { id: n.ID, src: n.Thumbnail ? `${app.options.server}${n.Thumbnail}` : null, title: n.Name, icon: 'model', cornerText: n.Type }); }); return <div className={classNames('ModelPanel', className)} style={style} > <SearchField data={categoryData} placeholder={_t('Search Content')} showAddButton={!enableAuthority || authorities.includes('ADD_MESH')} showFilterButton onAdd={this.handleAdd} onInput={this.handleSearch.bind(this)} /> <ImageList data={imageListData} showEditButton={!enableAuthority || authorities.includes('EDIT_MESH')} showDeleteButton={!enableAuthority || authorities.includes('DELETE_MESH')} onClick={this.handleClick} onEdit={this.handleEdit} onDelete={this.handleDelete} /> </div>; } componentDidUpdate() { if (this.init === undefined && this.props.show === true) { this.init = true; this.update(); } } update() { fetch(`${app.options.server}/api/Category/List?Type=Mesh`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ categoryData: obj.Data }); }); }); fetch(`${app.options.server}/api/Mesh/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ data: obj.Data }); }); }); } handleSearch(name, categories) { this.setState({ name, categories }); } handleClick(model) { let loader = new ModelLoader(app); let url = model.Url; if (model.Url.indexOf(';') > -1) { // 包含多个入口文件 url = url.split(';').map(n => app.options.server + n); } else { url = app.options.server + model.Url; } loader.load(url, model, { camera: app.editor.camera, renderer: app.editor.renderer, audioListener: app.editor.audioListener, clearChildren: true }).then(obj => { if (!obj) { return; } obj.name = model.Name; Object.assign(obj.userData, model, { Server: true }); if (app.storage.addMode === 'click') { this.clickSceneToAdd(obj); } else { this.addToCenter(obj); } }); } // 添加到场景中心 addToCenter(obj) { var cmd = new AddObjectCommand(obj); cmd.execute(); if (obj.userData.scripts) { obj.userData.scripts.forEach(n => { app.editor.scripts.push(n); }); app.call('scriptChanged', this); } } // 点击场景添加 clickSceneToAdd(obj) { let added = false; app.editor.gpuPickNum += 1; app.on(`gpuPick.ModelPanel`, intersect => { // 鼠标移动出现预览效果 if (!intersect.point) { return; } if (!added) { added = true; app.editor.sceneHelpers.add(obj); } obj.position.copy(intersect.point); }); app.on(`raycast.ModelPanel`, intersect => { // 点击鼠标放置模型 app.on(`gpuPick.ModelPanel`, null); app.on(`raycast.ModelPanel`, null); obj.position.copy(intersect.point); this.addToCenter(obj); app.editor.gpuPickNum -= 1; }); } // ------------------------------- 上传 --------------------------------------- handleAdd() { app.upload(`${app.options.server}/api/Mesh/Add`, obj => { if (obj.Code === 200) { this.update(); } app.toast(_t(obj.Msg)); }); } // ------------------------------- 编辑 --------------------------------------- handleEdit(data) { var win = app.createElement(EditModelWindow, { data, callback: this.update }); app.addElement(win); } // ------------------------------ 删除 ---------------------------------------- handleDelete(data) { app.confirm({ title: _t('Confirm'), content: `${_t('Delete')} ${data.title}?`, onOK: () => { fetch(`${app.options.server}/api/Mesh/Delete?ID=${data.id}`, { method: 'POST' }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { app.toast(_t(obj.Msg), 'warn'); return; } this.update(); }); }); } }); } } ModelPanel.propTypes = { className: PropTypes.string, style: PropTypes.object, show: PropTypes.bool }; ModelPanel.defaultProps = { className: null, style: null, show: false }; export default ModelPanel;
29.46332
90
0.463504
false
true
true
false
d00e1bfe03c5d845deb25487e07936c9104b08c7
3,531
jsx
JSX
src/components/work.jsx
johnnyxbell/johnnybell.io
f2577e691f5b626cc50c8a4c8a3bdf62de7f1a5c
[ "MIT" ]
null
null
null
src/components/work.jsx
johnnyxbell/johnnybell.io
f2577e691f5b626cc50c8a4c8a3bdf62de7f1a5c
[ "MIT" ]
8
2020-06-07T20:51:42.000Z
2022-02-26T16:59:25.000Z
src/components/work.jsx
johnnyxbell/johnnybell.io
f2577e691f5b626cc50c8a4c8a3bdf62de7f1a5c
[ "MIT" ]
null
null
null
import React from 'react'; import styled from 'styled-components'; import Nike from '../assets/images/nikestore.jpg'; import Evvntly from '../assets/images/evvnty.jpeg'; import StackShare from '../assets/images/stackshare.jpeg'; const PortfolioPanel = styled.div` font-family: 'Open Sans', 'Arial', Serif; min-height: 250px; background: #2a2a2a; font-size: 25px; padding: 50px 0; position: relative; `; const PortfolioItems = styled.div` display: flex; flex-flow: row wrap; margin-left: 1%; margin-right: 1%; `; const Tools = styled.div` position: absolute; top: 10px; right: 10px; display: flex; align-items: center; z-index: 1; img { width: 30px !important; height: 30px; margin-top: 1px; padding: 0 5px; } `; const Description = styled.div` bottom: 3%; left: 3%; z-index: 5; color: #6b6b6b; background: #f7f7f9; padding: 5px 15px; margin-top: -7px; a { transition: all 0.5s ease; color: #575757; &:hover { color: #969696; } } h3 { font-size: 16px; } p { font-size: 14px; } `; const PortfolioItem = styled.div` flex-basis: 31.3333333333%; margin: 1%; position: relative; @media (max-width: 1024px) and (min-width: 415px) { flex-basis: 48%; } @media (max-width: 414px) and (min-width: 320px) { flex-basis: 98%; } svg { width: 30px !important; height: 30px !important; } img { width: 100%; -webkit-filter: grayscale(0); opacity: 1; &:hover { transition: all 0.25s ease-in-out; filter: gray; -webkit-filter: grayscale(100%); opacity: 1; } } `; const Work = () => { return ( <PortfolioPanel> <PortfolioItems> <PortfolioItem> <a href='https://www.evvntly.com/' target='_blank' rel='noopener noreferrer'> <img src={Evvntly} alt='evvntly.com' /> </a> <Description> <a href='https://www.evvntly.com/' target='_blank' rel='noopener noreferrer'> <h3>Evvntly</h3> </a> <p> A iOS and web app that allows you to search for events near you. Built with React and React Native. </p> </Description> </PortfolioItem> <PortfolioItem> <a href='http://stackshare.io' target='_blank' rel='noopener noreferrer'> <img src={StackShare} alt='StackShare' />{' '} </a> <Description> <a href='http://stackshare.io' target='_blank' rel='noopener noreferrer'> <h3>StackShare</h3> </a> <p> A software discovery platform that lets you see all the best software tools and who's using them. Built with React, Apollo, GraphQL & Rails. </p> </Description> </PortfolioItem> <PortfolioItem> <a href='http://nikestore.com.au' target='_blank' rel='noopener noreferrer'> <img src={Nike} alt='Nike Store Australia' />{' '} </a> <Description> <a href='http://nikestore.com.au' target='_blank' rel='noopener noreferrer'> <h3>Nike Store Australia</h3> </a> <p> An e-commerce site for Nike Australia built in Magento <em>(The magento build of this site is no longer live)</em>. </p> </Description> </PortfolioItem> </PortfolioItems> </PortfolioPanel> ); }; export default Work;
24.692308
99
0.563863
false
true
false
true
d00e2c99a106e3c1b23fbeb471212dc99bfe004c
4,958
jsx
JSX
components/convert_channel_modal/convert_channel_modal.jsx
sajalrudderlabs/mattermost-webapp
4ca1336fd4ae1be79ddf84367870b8cb3e4d8f08
[ "Apache-2.0" ]
3
2018-07-02T21:15:39.000Z
2019-12-18T10:26:01.000Z
components/convert_channel_modal/convert_channel_modal.jsx
sajalrudderlabs/mattermost-webapp
4ca1336fd4ae1be79ddf84367870b8cb3e4d8f08
[ "Apache-2.0" ]
13
2018-04-23T23:50:21.000Z
2019-10-22T05:25:41.000Z
components/convert_channel_modal/convert_channel_modal.jsx
sajalrudderlabs/mattermost-webapp
4ca1336fd4ae1be79ddf84367870b8cb3e4d8f08
[ "Apache-2.0" ]
15
2018-01-31T00:55:44.000Z
2020-05-21T16:56:45.000Z
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import PropTypes from 'prop-types'; import React from 'react'; import {Modal} from 'react-bootstrap'; import {FormattedHTMLMessage, FormattedMessage} from 'react-intl'; import {trackEvent} from 'actions/diagnostics_actions.jsx'; import Constants from 'utils/constants.jsx'; import FormattedMarkdownMessage from 'components/formatted_markdown_message.jsx'; export default class ConvertChannelModal extends React.PureComponent { static propTypes = { /** * Function called when modal is dismissed */ onHide: PropTypes.func.isRequired, channelId: PropTypes.string.isRequired, channelDisplayName: PropTypes.string.isRequired, actions: PropTypes.shape({ /** * Function called for converting channel to private, */ convertChannelToPrivate: PropTypes.func.isRequired, }), } constructor(props) { super(props); this.state = {show: true}; } handleConvert = () => { const {actions, channelId} = this.props; if (channelId.length !== Constants.CHANNEL_ID_LENGTH) { return; } actions.convertChannelToPrivate(channelId); trackEvent('actions', 'convert_to_private_channel', {channel_id: channelId}); this.onHide(); } onHide = () => { this.setState({show: false}); } render() { const { channelDisplayName, onHide, } = this.props; return ( <Modal dialogClassName='a11y__modal' show={this.state.show} onHide={this.onHide} onExited={onHide} role='dialog' aria-labelledby='convertChannelModalLabel' > <Modal.Header closeButton={true}> <Modal.Title componentClass='h1' id='convertChannelModalLabel' > <FormattedMessage id='convert_channel.title' defaultMessage='Convert {display_name} to a private channel?' values={{ display_name: channelDisplayName, }} /> </Modal.Title> </Modal.Header> <Modal.Body> <p> <FormattedMarkdownMessage id='convert_channel.question1' defaultMessage='When you convert **{display_name}** to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only.' values={{ display_name: channelDisplayName, }} /> </p> <p> <FormattedHTMLMessage id='convert_channel.question2' defaultMessage='The change is permanent and cannot be undone.' /> </p> <p> <FormattedMarkdownMessage id='convert_channel.question3' defaultMessage='Are you sure you want to convert **{display_name}** to a private channel?' values={{ display_name: channelDisplayName, }} /> </p> </Modal.Body> <Modal.Footer> <button type='button' className='btn btn-link' onClick={this.onHide} tabIndex='2' > <FormattedMessage id='convert_channel.cancel' defaultMessage='No, cancel' /> </button> <button type='button' className='btn btn-primary' data-dismiss='modal' onClick={this.handleConvert} autoFocus={true} tabIndex='1' > <FormattedMessage id='convert_channel.confirm' defaultMessage='Yes, convert to private channel' /> </button> </Modal.Footer> </Modal> ); } }
35.669065
260
0.456837
false
true
false
true
d00e2d080780bb6bb38a63f9d2ef1ea741aedd7f
597
jsx
JSX
src/components/Note.jsx
Arish-theGalaxyBea/galaxy-kanban-board
b119ebe08a36bdb4dc7a8ed478a6bccbf6fa96d6
[ "MIT" ]
1
2021-02-17T16:06:39.000Z
2021-02-17T16:06:39.000Z
src/components/Note.jsx
Arish-theGalaxyBea/galaxy-kanban-board
b119ebe08a36bdb4dc7a8ed478a6bccbf6fa96d6
[ "MIT" ]
null
null
null
src/components/Note.jsx
Arish-theGalaxyBea/galaxy-kanban-board
b119ebe08a36bdb4dc7a8ed478a6bccbf6fa96d6
[ "MIT" ]
null
null
null
import React from 'react'; type Props = { children?: React$Node<*>, connectDragSource: Function, connectDropTarget: Function, isDragging: boolean, }; export default class Note extends React.Component<*, Props, *> { render() { const connectDragSource = this.props.connectDragSource; const connectDropTarget = this.props.connectDropTarget; const isDragging = this.props.isDragging; return connectDragSource( connectDropTarget( <li style={{ opacity: isDragging ? 0 : 1 }} className="note"> {this.props.children} </li> ) ); } }
23.88
69
0.661642
false
true
true
false
d00e305dc9b4712fd65eb9a1de7a99b74da521bf
2,253
jsx
JSX
src/layouts/Allmessage.jsx
ellezbayramov/Whatsappchat
6b9f968e3370efb717d0c76ed92b10986a85bf44
[ "Apache-2.0" ]
null
null
null
src/layouts/Allmessage.jsx
ellezbayramov/Whatsappchat
6b9f968e3370efb717d0c76ed92b10986a85bf44
[ "Apache-2.0" ]
null
null
null
src/layouts/Allmessage.jsx
ellezbayramov/Whatsappchat
6b9f968e3370efb717d0c76ed92b10986a85bf44
[ "Apache-2.0" ]
null
null
null
import React, { useEffect, useState, useRef } from "react"; import styled from "styled-components"; import { Context } from "../Context"; import fire from "../firebase"; import { AiOutlineSend } from "react-icons/ai"; import { useParams } from "react-router-dom"; import { useContext } from "react"; function Allmessage() { const [allmessages, setallmessages] = useState([]); const { title } = useParams(); const { user } = useContext(Context); useEffect(() => { fire .firestore() .collection("Rooms") .doc(title) .collection("Messages") .orderBy("date", "asc") .onSnapshot((snapshot) => setallmessages(snapshot.docs.map((doc) => doc.data())), ); }, [title]); return ( <div> <Alldiv> {allmessages.map((g) => { if (g.user == user.displayName) { return ( <Messagediv> <Mymessage> <span style={{ fontSize: "10px" }}>{g.user}</span> <ProfilImg src={g.photo} /> <br /> <span style={{ fontWeight: "700" }}>{g.message}</span> </Mymessage> </Messagediv> ); } else { return ( <Messagediv> <Theirmessage> <span style={{ fontSize: "10px" }}>{g.user}</span> <ProfilImg src={g.photo} /> <br /> <span style={{ fontWeight: "700" }}>{g.message}</span> </Theirmessage> </Messagediv> ); } })} </Alldiv> </div> ); } export default Allmessage; const Alldiv = styled.div` width: 100%; height: 100%; `; const Messagediv = styled.div` width: 100%; height: auto; min-height: 100px; `; const Mymessage = styled.div` float: right; min-width: 100px; max-width: 180px; height: auto; margin-right: 20px; background-color: green; word-break: break-all; color: white; `; const Theirmessage = styled(Mymessage)` float: left; background-color: white; color: black; margin-left: 20px; `; const ProfilImg = styled.img` vertical-align: middle; width: 20px; height: 20px; border-radius: 50%; `;
23.968085
72
0.527297
false
true
false
true
d00e53c65f955362f06dd4ccbef1b800c8b37531
478
jsx
JSX
client/src/components/Items.jsx
hunterxdong/hrr-37-MVP
80c5501c824ce8becfd48b211974a1c2c48b270f
[ "MIT" ]
null
null
null
client/src/components/Items.jsx
hunterxdong/hrr-37-MVP
80c5501c824ce8becfd48b211974a1c2c48b270f
[ "MIT" ]
null
null
null
client/src/components/Items.jsx
hunterxdong/hrr-37-MVP
80c5501c824ce8becfd48b211974a1c2c48b270f
[ "MIT" ]
null
null
null
import React from 'react'; import $ from 'jquery'; class Items extends React.Component { constructor(props) { super(props); this.state = {}; } clickX() { this.props.del(this.props.id); } render() { return ( <div> <div className="container-data"> {this.props.name} owes you {this.props.amount} for {this.props.why} <div className="deleteMe" onClick={this.clickX.bind(this)}> X </div> </div> </div> ); } } export default Items;
18.384615
72
0.615063
true
false
true
false
d00e545de999ec0ef82e9ec19d71c89c948d4f73
393
jsx
JSX
src/filing/submission/ReceiptContainer.jsx
kgudel/hmda-frontend
8244b727136d6046e71701fb59ac2c9d956356bd
[ "CC0-1.0" ]
13
2016-03-18T23:36:50.000Z
2019-02-25T00:44:45.000Z
src/filing/submission/ReceiptContainer.jsx
kgudel/hmda-frontend
8244b727136d6046e71701fb59ac2c9d956356bd
[ "CC0-1.0" ]
1,164
2016-01-22T21:13:06.000Z
2020-01-02T20:36:02.000Z
src/filing/submission/ReceiptContainer.jsx
kgudel/hmda-frontend
8244b727136d6046e71701fb59ac2c9d956356bd
[ "CC0-1.0" ]
16
2019-11-08T14:03:56.000Z
2021-03-10T22:28:12.000Z
import { connect } from 'react-redux' import Receipt from './Receipt.jsx' export function mapStateToProps(state) { const { timestamp, receipt, email } = state.app.signature const { status } = state.app.submission const { filingPeriod } = state.app return { timestamp, receipt, status, filingPeriod, email } } export default connect(mapStateToProps)(Receipt)
18.714286
59
0.692112
false
true
false
true
d00e5716d9842c9595b46853f43c0f74a167a42c
574
jsx
JSX
src/views/components/UploadExport.jsx
HSLdevcom/jore-graphql-import
0b2db4fbca6c2a23901408148bff64572be57d4f
[ "MIT" ]
1
2020-02-04T06:11:09.000Z
2020-02-04T06:11:09.000Z
src/views/components/UploadExport.jsx
HSLdevcom/jore-graphql-import
0b2db4fbca6c2a23901408148bff64572be57d4f
[ "MIT" ]
7
2018-01-15T09:29:29.000Z
2022-01-31T09:21:03.000Z
src/views/components/UploadExport.jsx
HSLdevcom/jore-graphql-import
0b2db4fbca6c2a23901408148bff64572be57d4f
[ "MIT" ]
1
2019-12-10T12:50:39.000Z
2019-12-10T12:50:39.000Z
import React from "react"; import { PATH_PREFIX } from "../../constants"; const UploadExport = ({ disabled }) => { return ( <> <h3>Upload an export archive</h3> <form id="export-upload" action={`${PATH_PREFIX}upload`} method="post" encType="multipart/form-data" > <fieldset disabled={disabled}> <legend>Select file</legend> <input type="file" name="export" /> <input type="submit" value="Upload" /> </fieldset> </form> </> ); }; export default UploadExport;
22.96
48
0.545296
false
true
false
true
d00e5bf391bf4cca2ac0f562d530312970264f8c
1,364
jsx
JSX
src/standalone/topbar-insert/forms/components/InsertFormList.jsx
matthewgallo/swagger-editor
38daf5d90c50b21777efe76bf7811723227afcbb
[ "Apache-2.0" ]
7,824
2015-01-02T23:02:38.000Z
2022-03-31T14:47:18.000Z
src/standalone/topbar-insert/forms/components/InsertFormList.jsx
matthewgallo/swagger-editor
38daf5d90c50b21777efe76bf7811723227afcbb
[ "Apache-2.0" ]
1,948
2015-01-01T06:31:50.000Z
2022-03-31T17:24:26.000Z
src/standalone/topbar-insert/forms/components/InsertFormList.jsx
matthewgallo/swagger-editor
38daf5d90c50b21777efe76bf7811723227afcbb
[ "Apache-2.0" ]
2,429
2015-01-02T19:32:01.000Z
2022-03-29T10:15:24.000Z
import React from "react" import PropTypes from "prop-types" import { OrderedMap, Map, List } from "immutable" import { removeFormItem } from "../helpers/form-data-helpers" const InsertFormList = ({ parent, formData, getComponent }) => { const InsertForm = getComponent("InsertForm") const InsertFormInput = getComponent("InsertFormInput") if (!List.isList(formData)) { return (<div> An error occurred while loading the form.</div>) } const jsx = [] formData.forEach((item, index) => { const showClose = index === formData.count() - 1 const close = ( <span type="button" className="close remove-item pull-right" aria-label="remove" onClick={() => removeFormItem(parent)}> <span aria-hidden="true">&times;</span> </span> ) jsx.push(( <div className="card-body" key={`index-${index}`}> {showClose && close} {((OrderedMap.isOrderedMap(item) || Map.isMap(item)) && item.has("value")) ? <InsertFormInput formData={item} index={index} getComponent={getComponent} /> : <InsertForm formData={item} getComponent={getComponent} /> } </div> )) }) return <div> {jsx} </div> } InsertFormList.propTypes = { formData: PropTypes.object.isRequired, getComponent: PropTypes.func.isRequired, parent: PropTypes.object } export default InsertFormList
30.311111
126
0.651026
false
true
false
true
d00e5ccb9e25a3c8217dc3091c679e293cbe0b9c
15,614
jsx
JSX
src/routes/metadata/components/TemplateForm.jsx
nqviet/connect-app
24c8456de50af295b78835cb7880fab0a960733d
[ "FSFAP" ]
55
2016-09-08T18:31:13.000Z
2021-12-07T04:49:19.000Z
src/routes/metadata/components/TemplateForm.jsx
nqviet/connect-app
24c8456de50af295b78835cb7880fab0a960733d
[ "FSFAP" ]
3,265
2016-07-21T08:45:43.000Z
2022-03-22T13:56:40.000Z
src/routes/metadata/components/TemplateForm.jsx
nqviet/connect-app
24c8456de50af295b78835cb7880fab0a960733d
[ "FSFAP" ]
254
2016-08-16T08:28:11.000Z
2021-12-13T11:31:42.000Z
/** * Metadata Fields Form */ import _ from 'lodash' import React, { Component } from 'react' import PropTypes from 'prop-types' import Modal from 'react-modal' import ace from 'brace' import 'brace/mode/json' import 'brace/theme/github' import { JsonEditor } from 'jsoneditor-react' import 'jsoneditor-react/es/editor.min.css' import SelectDropdown from '../../../components/SelectDropdown/SelectDropdown' import FormsyForm from 'appirio-tech-react-components/components/Formsy' const TCFormFields = FormsyForm.Fields const Formsy = FormsyForm.Formsy import './TemplateForm.scss' class TemplateForm extends Component { constructor(props) { super(props) this.state = { valid: false, fields: [], textAreaValid: true, productCategories: [], projectTypes: [], values: null, dirty: false, isFocused: false, isChange: false, showDeleteConfirm: false, primaryKeyType: '', primaryKeyValue: null, verifyPrimaryKeyValue: null, isNewVersion: false, forcedError: { verifyPrimaryKeyValue: null, } } this.onValid = this.onValid.bind(this) this.onInvalid = this.onInvalid.bind(this) this.onChange = this.onChange.bind(this) this.onSave = this.onSave.bind(this) this.onDuplicate = this.onDuplicate.bind(this) this.showDelete = this.showDelete.bind(this) this.cancelDelete = this.cancelDelete.bind(this) this.confirmDelete = this.confirmDelete.bind(this) this.onChangeDropdown = this.onChangeDropdown.bind(this) this.onVerifyPrimaryKeyValueChange = this.onVerifyPrimaryKeyValueChange.bind(this) this.init = this.init.bind(this) this.onCreateNewVersion = this.onCreateNewVersion.bind(this) } componentDidMount() { // this.init(this.props) } componentWillReceiveProps(nextProps) { this.init(nextProps) } componentWillMount() { this.init(this.props) } init(props) { const { metadata, metadataType, isNew, metadataWithVersion } = props const name = metadataType const type = metadata && metadata.hasOwnProperty('id') && !metadataWithVersion ? 'number' : 'text' let primaryKeyValue = null primaryKeyValue = metadata && metadata.hasOwnProperty('id') ? metadata['id'] : null primaryKeyValue = metadata && !metadata.hasOwnProperty('id') ? metadata['key'] : primaryKeyValue primaryKeyValue = metadata && metadata.hasOwnProperty('key') && metadataWithVersion ? metadata['key'] : primaryKeyValue this.setState({ // productCategories: metadataType === 'productTemplate' ? this.getProductCategoryOptions() : [], // projectTypes: metadataType === 'projectTemplate' ? this.getProjectTypeOptions() : [], values: isNew && !metadata ? {} : metadata, name, primaryKeyType: type, primaryKeyValue }) } getField(field, isRequired=true) { const { values } = this.state const validations = null const type = field['type'] const label = field['key'] const isDropdown = type === 'dropdown' const isObject = type === 'object' const isJSON = type === 'json' const isJSONFullScreen = type === 'jsonfullscreen' const isCheckbox = type === 'checkbox' const isTextarea = type === 'textarea' const isTextBox = !isDropdown && !isCheckbox && !isObject && !isJSON && !isTextarea && !isJSONFullScreen const options = isDropdown ? field['options'] : [] let value = field['value'] let isReadOnly = false if (field['readonly']) { isReadOnly = true } let isHidden = false if (values && values[label]) { value = field['type'] === 'object' ? JSON.stringify(values[label]) : values[label] if (values.hasOwnProperty('id') && label === 'id') { if (!this.props.isNew) { isReadOnly = true } } if ((!values.hasOwnProperty('id') || this.props.metadataWithVersion) && label === 'key') { if (!this.props.isNew || this.state.isNewVersion) { isReadOnly = true } } } else if (isCheckbox) { value = false } if (label === 'id') { isHidden = true } return ( !isHidden && <div className={`field ${isReadOnly ? 'read-only' : ''}`} key={label}> <div className="label">{`${!isCheckbox && !isJSONFullScreen ? label : ''}`}</div> { isTextBox && ( <TCFormFields.TextInput wrapperClass="input-field" type={type} name={label} validations={validations} value={value || ''} validationError={`Please enter ${label}`} required={isRequired} readonly={isReadOnly} /> ) } { isTextarea && ( <TCFormFields.Textarea autoResize wrapperClass="input-field" type={type} name={label} validations={validations} value={value || ''} validationError={`Please enter ${label}`} required={isRequired} readonly={isReadOnly} /> ) } { isDropdown && ( <div className="dropdown-field"> <SelectDropdown name={label} options={options} theme="default max-height" onSelect={(option) => { this.props.dropdownChange(label, option) this.onChangeDropdown(label, option) }} value={value} required={label!=='subCategory'} /> </div> ) } { isCheckbox && ( <div className="checkbox"> <TCFormFields.Checkbox ref={label} name={label} label={label} value={value} /> </div> ) } { isObject && ( <TCFormFields.Textarea wrapperClass="textarea-field" name={label} value={value} validations={validations} validationError={`Please enter ${label}`} /> ) } { isJSON && ( <div className="json_editor_wrapper"> <JsonEditor value={value} ace={ace} mode="code" allowedModes={['code', 'tree', 'view']} theme="ace/theme/github" onChange={(json) => { this.onJSONEdit(field, json) }} /> </div> ) } { isJSONFullScreen && ( <div className="json_editor_wrapper"> <div> <div className="label">{label}</div> <button type="button" className="tc-btn tc-btn-primary tc-btn-sm maximize-btn" onClick={this.props.enterFullScreen}>Maximize</button> </div> <JsonEditor ref={this.props.setJsonEditorRef} value={value} ace={ace} mode="code" allowedModes={['code', 'tree', 'view']} theme="ace/theme/github" onChange={(json) => { this.props.changeJSONEdit(json) }} /> </div> ) } </div> ) } onValid() { this.setState({valid: true}) } onInvalid() { this.setState({valid: false}) } /** * Validate the id before delete template */ validate(state) { const errors = { verifyPrimaryKeyValue: null, } if (state.verifyPrimaryKeyValue !== null && state.verifyPrimaryKeyValue !== state.primaryKeyValue.toString()) { errors.verifyPrimaryKeyValue = `The ${state.primaryKeyType === 'number' ? 'id' : 'key'} does not match` } return errors } onVerifyPrimaryKeyValueChange(type, value) { const newState = {...this.state, verifyPrimaryKeyValue: value, isFocused: true, } newState.forcedError = this.validate(newState) this.setState(newState) } onDuplicate() { this.props.createTemplate(true) } onCreateNewVersion() { this.setState({ isNewVersion: true, }) this.props.createNewVersion() } onSave() { const { saveTemplate } = this.props const { primaryKeyValue, values } = this.state let payload = values if (values.hasOwnProperty('aliases')) { const aliases = _.split(values.aliases, ',') payload = _.assign({}, payload, { aliases }) } if (payload.subCategory === '') { payload.subCategory = null } saveTemplate(primaryKeyValue, payload) } showDelete() { this.setState({ showDeleteConfirm: true, forcedError: { verifyPrimaryKeyValue: null, } }) } cancelDelete() { this.setState({ showDeleteConfirm: false, }) } confirmDelete() { const { forcedError, primaryKeyValue } = this.state if (!forcedError.verifyPrimaryKeyValue) { this.setState({ showDeleteConfirm: false }) this.props.deleteTemplate(primaryKeyValue) } } onChangeDropdown(label, option) { const { values } = this.state const updatedValue = {} updatedValue[`${label}`] = option.value this.setState({ values: _.assign({}, values, updatedValue) }) } onChange(currentValues, isChanged) { const { changeTemplate } = this.props // console.log(currentValues) this.setState({ dirty: isChanged }) if (currentValues.hasOwnProperty('metadata')) { try { currentValues.metadata = JSON.parse(currentValues.metadata) this.setState({ textAreaValid: true}) changeTemplate(currentValues) } catch (e) { this.setState({ textAreaValid: false}) } } else if (currentValues.hasOwnProperty('phases')) { try { currentValues.phases = JSON.parse(currentValues.phases) this.setState({ textAreaValid: true}) changeTemplate(currentValues) } catch (e) { this.setState({ textAreaValid: false}) } } else { changeTemplate(currentValues) } } onJSONEdit(field, jsObject) { const { values } = this.state // const type = field['type'] const label = field['key'] const updatedJSONValue = {} updatedJSONValue[`${label}`] = jsObject this.setState({ values: _.assign({}, values, updatedJSONValue) }) } render() { const { fields, metadata, metadataWithVersion } = this.props const { // name, showDeleteConfirm, primaryKeyType, verifyPrimaryKeyValue, forcedError, } = this.state const isRequired = true return ( <div className="template-form-container"> <Formsy.Form className="template-form" onInvalid={this.onInvalid} onValidSubmit={this.onSubmit} onValid={this.onValid} onChange={this.onChange} > { _.map(fields, (field) => this.getField(field)) } { metadataWithVersion && metadata.revision && ( <div className="history-field"> <div className="label">revision</div> <span className="field-value"> {metadata.revision} </span> <span className="title-action" onClick={this.props.toggleModalOpen}> See history </span> </div> ) } <div className="controls"> <button type="submit" className="tc-btn tc-btn-primary" disabled={!this.state.valid || !this.state.textAreaValid} onClick={this.onSave} > Save </button> <button type="submit" className="tc-btn tc-btn-primary" onClick={this.onDuplicate} disabled={this.props.isNew} > Duplicate </button> <button type="submit" className="tc-btn tc-btn-warning" onClick={this.showDelete} disabled={this.props.isNew} > Delete </button> </div> { metadataWithVersion && ( <div className="controls"> <button type="submit" className="tc-btn new-version-btn" disabled={!this.state.valid || !this.state.textAreaValid} onClick={this.onCreateNewVersion} disabled={this.props.isNew} > Create New Version </button> </div> ) } </Formsy.Form> <Modal isOpen={ showDeleteConfirm } className="delete-template-dialog" overlayClassName="delete-template-dialog-overlay" onRequestClose={ this.cancelDelete } contentLabel="" > <div className="modal-title"> Are you sure you want to delete this template? </div> <div className="modal-body"> Please enter the {primaryKeyType === 'number' ? 'id' : 'key'} of the template to be deleted </div> <Formsy.Form> <TCFormFields.TextInput wrapperClass="input-field" type={primaryKeyType} name={primaryKeyType} validations={null} onChange={this.onVerifyPrimaryKeyValueChange} forceErrorMessage={forcedError['verifyPrimaryKeyValue']} value="" validationError={`Please confirm the ${primaryKeyType === 'number' ? 'id' : 'key'} is the same entity as the selected one`} required={isRequired} /> </Formsy.Form> <div className="button-area flex center action-area"> <button className="tc-btn tc-btn-default tc-btn-sm action-btn btn-cancel" onClick={this.cancelDelete} >Cancel</button> <button className="tc-btn tc-btn-warning tc-btn-sm action-btn " onClick={this.confirmDelete} disabled={!verifyPrimaryKeyValue || forcedError.verifyPrimaryKeyValue} >Delete </button> </div> </Modal> </div> ) } } TemplateForm.defaultProps = { enterFullScreen: () => {}, createNewVersion: () => {}, dropdownChange: () => {}, changeJSONEdit: () => {}, toggleModalOpen: () => {}, productCategories: [], projectTypes: [], metadataWithVersion: false, } TemplateForm.propTypes = { isNew: PropTypes.bool.isRequired, metadataWithVersion: PropTypes.bool, fields: PropTypes.array.isRequired, productCategories: PropTypes.array, projectTypes: PropTypes.array, metadata: PropTypes.object.isRequired, metadataType: PropTypes.string.isRequired, deleteTemplate: PropTypes.func.isRequired, saveTemplate: PropTypes.func.isRequired, changeTemplate: PropTypes.func.isRequired, createTemplate: PropTypes.func.isRequired, createNewVersion: PropTypes.func, dropdownChange: PropTypes.func, changeJSONEdit: PropTypes.func, toggleModalOpen: PropTypes.func, setJsonEditorRef: PropTypes.func.isRequired, loadProjectMetadata: PropTypes.func.isRequired, enterFullScreen: PropTypes.func, } export default TemplateForm
30.084778
149
0.561739
false
true
true
false
d00e736ddfa098849d9452d8c4972065d2728d00
642
jsx
JSX
src/reducers/post/post-existence-by-user-reducer.jsx
latyaodessa/yf-react
ee15fd9f6a81254aeabe02c2b6ba28ae592aaec3
[ "MIT" ]
null
null
null
src/reducers/post/post-existence-by-user-reducer.jsx
latyaodessa/yf-react
ee15fd9f6a81254aeabe02c2b6ba28ae592aaec3
[ "MIT" ]
null
null
null
src/reducers/post/post-existence-by-user-reducer.jsx
latyaodessa/yf-react
ee15fd9f6a81254aeabe02c2b6ba28ae592aaec3
[ "MIT" ]
null
null
null
import {GET_IS_POST_EXIST_FULFILLED, GET_IS_POST_EXIST_REJECTED} from "../../constants/user/user-constants" export default function reducer(state = { existence: false, fetched: false, error: null, fetching: true } , action) { switch (action.type) { case GET_IS_POST_EXIST_REJECTED: { return {...state, fetching: false, error: action.payload} } case GET_IS_POST_EXIST_FULFILLED: { return { ...state, fetching: false, fetched: true, existence: action.payload } } default: { return {...state} } } }
22.137931
108
0.574766
true
false
false
true
d00e891fb3d52d79e969f18b6a612bd1a2f9af13
4,421
jsx
JSX
src/frontend/common/widget/DropdownDatePicker/DropdownDatePicker.jsx
alexn1/qforms
5b1ec0093535317d9dcbd34ec899a8ab8ba1d5ad
[ "MIT" ]
3
2015-06-17T02:46:36.000Z
2019-05-26T13:24:26.000Z
src/frontend/common/widget/DropdownDatePicker/DropdownDatePicker.jsx
alexn1/qforms
5b1ec0093535317d9dcbd34ec899a8ab8ba1d5ad
[ "MIT" ]
8
2021-05-19T07:09:24.000Z
2021-12-22T16:19:35.000Z
src/frontend/common/widget/DropdownDatePicker/DropdownDatePicker.jsx
alexn1/qforms
5b1ec0093535317d9dcbd34ec899a8ab8ba1d5ad
[ "MIT" ]
null
null
null
class DropdownDatePicker extends ReactComponent { constructor(props) { // console.log('DropdownDatePicker.constructor', props); super(props); this.state = { open : false, value: props.value || null, }; if (props.value && !(props.value instanceof Date)) { throw new Error(`need Date type, got ${typeof props.value}`); } } onInputClick = (e) => { // console.log('DropdownDatePicker.onInputClick', e); if (this.props.readOnly) return; this.setState(prevState => ({open: !prevState.open})); } onInputKeyDown = e => { // console.log('DropdownDatePicker.onInputKeyDown', e.which); if (e.which === 27 && this.state.open) { this.setState({open: false}); } } onCloseDown = async (e) => { // console.log('DropdownDatePicker.onCloseDown', e); this.setState({value: null}); if (this.props.onChange) { this.props.onChange(null); } } onBlur = (e) => { // console.log('DropdownDatePicker.onBlur'); if (this.state.open) { this.setState({open: false}); } } onDatePickerMouseDown = (e) => { // console.log('DropdownDatePicker.onDatePickerMouseDown'); e.preventDefault(); // e.stopPropagation(); // return false; } onDatePickerDateSelected = (date) => { // console.log('DropdownDatePicker.onDatePickerDateSelected', date); const value = new Date(date[0], date[1], date[2]); this.setState({open: false, value}); if (this.props.onChange) { this.props.onChange(value); } } getFormat() { if (this.props.format) return this.props.format; return '{DD}.{MM}.{YYYY} {hh}:{mm}:{ss}'; } getStringValue() { if (this.getValue()) { return Helper.formatDate(this.getValue(), this.getFormat()); } return ''; } getMinDate() { if (this.props.getMinDate) { return this.props.getMinDate(); } else if (this.props.oldDates === false) { return DatePicker.getTodayArr(); } return null; } getSelectedMonth() { if (this.getValue()) { return [this.getValue().getFullYear(), this.getValue().getMonth()]; } return null; } getSelectedDate() { if (this.getValue()) { return [this.getValue().getFullYear(), this.getValue().getMonth(), this.getValue().getDate()]; } return null; } getValue() { return this.state.value; } shouldComponentUpdate(nextProps, nextState) { // console.log('DropdownDatePicker.shouldComponentUpdate', 'nextProps:', nextProps, 'nextState:', nextState); this.state.value = nextProps.value; return true; } getClassList() { return [ ...super.getClassList(), ...(this.props.readOnly ? ['read-only'] : []) ]; } render() { // console.log('DropdownDatePicker.render', this.props, this.state); return ( <div className={this.getCssClassNames()}> <input className={`${this.getCssBlockName()}__input`} readOnly={true} onClick={this.onInputClick} onBlur={this.onBlur} value={this.getStringValue()} placeholder={this.props.placeholder} onKeyDown={this.onInputKeyDown} /> <div className={`${this.getCssBlockName()}__close ${this.getStringValue() !== '' && !this.props.readOnly ? 'visible' : ''}`} onMouseDown={this.onCloseDown}> <CloseIcon/> </div> {this.state.open && <DatePicker classList={[`${this.getCssBlockName()}__date-picker`]} minDate={this.getMinDate()} selectedMonth={this.getSelectedMonth()} selectedDate={this.getSelectedDate()} onMouseDown={this.onDatePickerMouseDown} onDateSelected={this.onDatePickerDateSelected} /> } </div> ); } } window.QForms.DropdownDatePicker = DropdownDatePicker;
34.811024
172
0.525673
false
true
false
true
d00e9bf92c0d1ebc6e3bfcd9dc6f49abd769957a
468
jsx
JSX
src/components/index.jsx
homeguys/npm-one
7e7b52c096bd95c47c5647d6e5c0272ee09da6f3
[ "MIT" ]
null
null
null
src/components/index.jsx
homeguys/npm-one
7e7b52c096bd95c47c5647d6e5c0272ee09da6f3
[ "MIT" ]
3
2021-03-10T04:28:30.000Z
2022-02-10T17:29:38.000Z
src/components/index.jsx
homeguys/npm-one
7e7b52c096bd95c47c5647d6e5c0272ee09da6f3
[ "MIT" ]
null
null
null
export { default as TimeChoice } from './time_choice/demo' export { default as SpaceChoice } from './space_choice/demo' export { default as LinkageSelect } from './linkage_select/demo' export { default as TimeSwitch } from './time_switch/demo' export { default as Searchbox } from './search_box/demo' export { default as ChartPie } from './chart_pie/demo' export { default as ChartBar } from './chart_bar/demo' export { default as ChartLine } from './chart_line/demo'
52
64
0.74359
false
true
false
true
d00ea2980f0049da89a294e94bb0b3c279c3089e
1,367
jsx
JSX
src/components/heading/modules.jsx
gaiasols/aces
60006187d0ca8190499a3e5e388f2f1c0256da31
[ "MIT" ]
null
null
null
src/components/heading/modules.jsx
gaiasols/aces
60006187d0ca8190499a3e5e388f2f1c0256da31
[ "MIT" ]
1
2020-08-20T09:15:34.000Z
2020-08-20T09:15:34.000Z
src/components/heading/modules.jsx
gaiasols/aces
60006187d0ca8190499a3e5e388f2f1c0256da31
[ "MIT" ]
5
2020-08-20T08:52:03.000Z
2020-08-25T00:24:22.000Z
import Link from 'next/link' const DashboardHeader = ({ project, subtitle }) => { return ( <div> <div className="max-w-5xl mx-auto px-6"> <div className="absolute pt-2 z-0"> <Link href="/dashboard/projects"> <a className="inline-block text-xs text-indigo-500 uppercase tracking-wide hover:text-indigo-700"> <svg className="bg-transparent rounded fill-current w-auto inline-block float-left h-3 -ml-1 mr-2" viewBox="0 0 443.52 443.520" xmlns="http://www.w3.org/2000/svg"> <g> <path d="M143.492,221.863L336.226,29.129c6.663-6.664,6.663-17.468,0-24.132c-6.665-6.662-17.468-6.662-24.132,0l-204.8,204.8 c-6.662,6.664-6.662,17.468,0,24.132l204.8,204.8c6.78,6.548,17.584,6.36,24.132-0.42c6.387-6.614,6.387-17.099,0-23.712 L143.492,221.863z"/> </g> </svg> <span className="block float-left leading-none">Projects</span> </a> </Link> </div> <div className="py-12 border-b border-red-300"> <h2 className="dashboard-heading"> Project Modules </h2> <p className="text-gray-600 text-sm font-light"> {subtitle && subtitle} </p> </div> </div> </div> ) } export default DashboardHeader
40.205882
177
0.553036
false
true
false
true
d00eab6bfc0f1a9352038266aa8f5062734b9abf
262
jsx
JSX
src/Components/QuizSamples/NextButton.jsx
vanhai28/demo_FE
cb248f4859ff64e3d53c014ce2c8bf0726309be6
[ "MIT" ]
null
null
null
src/Components/QuizSamples/NextButton.jsx
vanhai28/demo_FE
cb248f4859ff64e3d53c014ce2c8bf0726309be6
[ "MIT" ]
null
null
null
src/Components/QuizSamples/NextButton.jsx
vanhai28/demo_FE
cb248f4859ff64e3d53c014ce2c8bf0726309be6
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import {Button} from "reactstrap" class NextButton extends Component { render() { return ( <Button color="primary" size="lg" onClick={this.props.onClick} >&gt;</Button> ); } } export default NextButton
23.818182
83
0.671756
false
true
true
false
d00ebee62e48fc719a8ab9cdd6384c644df2ae95
2,636
jsx
JSX
app/components/OrderList/Item/index.jsx
zhangxintong/dianping
3957518247208fe29d9ca6b89e8c9233421d6393
[ "MIT" ]
null
null
null
app/components/OrderList/Item/index.jsx
zhangxintong/dianping
3957518247208fe29d9ca6b89e8c9233421d6393
[ "MIT" ]
null
null
null
app/components/OrderList/Item/index.jsx
zhangxintong/dianping
3957518247208fe29d9ca6b89e8c9233421d6393
[ "MIT" ]
null
null
null
import React from 'react' import PureRenderMixin from 'react-addons-pure-render-mixin' import './style.less' class Item extends React.Component { constructor(props, context) { super(props, context); this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this); this.state = { commentState:2 //0-未评价 1-评价中 2-已评价 } } render() { const data = this.props.data return ( <div className="order-item-container"> <div className="clear-fix"> <div className="order-item-img float-left"> <img src={data.img}/> </div> <div className="order-item-comment float-right"> { this.state.commentState === 0 ? <button className="btn" onClick={this.showComment.bind(this)}>未评价</button> : this.state.commentState ===1 ? '' :<button className="btn unseleted-btn">已评价</button> } </div> <div className="order-item-content"> <span>商户:{data.title}</span> <span>数量:{data.count}</span> <span>价格:¥{data.price}</span> </div> </div> { // “评价中”才会显示输入框 this.state.commentState === 1 ? <div className="comment-text-container"> <textarea style={{width: '100%', height: '80px'}} className="comment-text" ref="commentText"></textarea> <button className="btn" onClick={this.submitClickHandle.bind(this)}>提交</button> &nbsp; <button className="btn unseleted-btn" onClick={this.hideComment.bind(this)}>取消</button> </div> : '' } </div> ) } showComment(){ this.setState({ commentState:1 }) } hideComment(){ this.setState({ commentState:0 }) } submitClickHandle(){ const submitComment = this.props.submitComment const id = this.props.data.id const commentTextDOM = this.refs.commentText const value = commentTextDOM.value.trim() if(!value){ return } //提交评论内容 submitComment(id,value,this.commentOK.bind(this)) } commentOK(){ //已经评价 修改状态 this.setState({ commentState:2 }) } componentDidMount(){ this.setState({ commentState:this.props.data.commentState }) } } export default Item
30.651163
128
0.511381
true
false
true
false
d00ec044f87b43aa966d5aefe0de15b54105f029
1,768
jsx
JSX
src/components/form/FieldErrors.jsx
seudev/vlakte
db8d1988d738311e2377a098bc2437cd827f1be8
[ "Apache-2.0" ]
null
null
null
src/components/form/FieldErrors.jsx
seudev/vlakte
db8d1988d738311e2377a098bc2437cd827f1be8
[ "Apache-2.0" ]
null
null
null
src/components/form/FieldErrors.jsx
seudev/vlakte
db8d1988d738311e2377a098bc2437cd827f1be8
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import FormHelperText from '@material-ui/core/FormHelperText'; import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline'; import { makeStyles } from '@material-ui/core/styles'; import { useFieldContext } from './Field'; const useStyles = makeStyles({ root: { width: '100%', marginLeft: ({ level }) => { return `${level}rem`; } }, helper: { display: 'flex', alignItems: 'center', flexWrap: 'wrap' }, icon: { fontSize: '1rem', marginRight: '5px' }, message: { '&:first-letter': { textTransform: 'uppercase' } } }); const FieldErrors = () => { const { hasErrors, errors } = useFieldContext(); if (!hasErrors) { return false; } const ErrorContainer = props => { const classes = useStyles(props); return ( <div className={`field-errors ${classes.root}`}> {props.errors.map(({ message, context }, index) => ( <FormHelperText key={index} error component='div' className={classes.helper}> <ErrorOutlineIcon className={classes.icon} /> <span className={classes.message}>{message}</span> {context && context.details instanceof Array && ( <ErrorContainer errors={context.details} level={props.level + 1} /> )} </FormHelperText> ))} </div> ); }; return <ErrorContainer errors={errors} level={0} />; }; FieldErrors.propTypes = {}; FieldErrors.defaultProps = {}; export default FieldErrors;
26.787879
97
0.532805
false
true
false
true
d00ec8739dd830a86dfd424006bbf9e10792769e
2,414
jsx
JSX
src/components/CodeListing/CodeListing.jsx
rawsta/rawblog
ccc9596034bf12a8d1179e1222795d3fc32b89f6
[ "MIT" ]
null
null
null
src/components/CodeListing/CodeListing.jsx
rawsta/rawblog
ccc9596034bf12a8d1179e1222795d3fc32b89f6
[ "MIT" ]
6
2021-11-06T20:33:42.000Z
2022-02-27T20:25:16.000Z
src/components/CodeListing/CodeListing.jsx
rawsta/rawblog
ccc9596034bf12a8d1179e1222795d3fc32b89f6
[ "MIT" ]
null
null
null
import React from "react"; import { Link } from "gatsby"; import Img from 'gatsby-image'; // import moment from 'moment'; import { formatDate } from '../../utils/global'; class CodeListing extends React.Component { getCodeList() { const {codeEdges} = this.props; const codeList = []; codeEdges.forEach(codeEdge => { codeList.push({ path: codeEdge.node.fields.slug, tags: codeEdge.node.frontmatter.tags, cover: codeEdge.node.frontmatter.cover, category: codeEdge.node.frontmatter.category, title: codeEdge.node.frontmatter.title, date: codeEdge.node.fields.date, excerpt: codeEdge.node.excerpt, timeToRead: codeEdge.node.timeToRead }); }); return codeList; }; render() { const codeList = this.getCodeList(); const CAT_ICON = { javascript: <i className="fab fa-js-square" />, php: <i className="fab fa-php" />, css3: <i className="fab fa-css3-alt" />, wordpress: <i className="fab fa-wordpress-simple" />, typo3: <i className="fab fa-typo3" />, server: <i className="fas fa-server" />, linux: <i className="fab fa-linux" />, windows: <i className="fab fa-windows" />, cheatsheet: <i className="fas fa-receipt" />, test: <i className="fab fa-diaspora" />, }; return ( <section className="post-list"> {codeList.map(code => ( <Link to={code.path} key={code.title}> <article className="post-item" style={{backgroundImage: `url(${code.cover})`}}> <header className="post-item-content"> <span title={code.category}> {CAT_ICON[code.category]} </span> <div className="post-header"> <h2 className="post-title">{code.title}</h2> <span title="Beitragsdatum"> <i className="far fa-calendar-alt" /> {` `} {formatDate(code.date)} </span> <span title="Grob gechätzte Lesezeit"> {` | `} <i className="fas fa-code" /> {` `} {code.tags} </span> </div> </header> </article> </Link> ))} </section> ); } } export default CodeListing;
31.350649
91
0.524027
false
true
true
false
d00ecf55529e66aabe6356d87d10eff6dc861d39
3,646
jsx
JSX
src/components/Sidebar/Sidebar.jsx
thipokKub/db-front
772271cedd3d927c35d6857098b61af001dcef98
[ "MIT" ]
null
null
null
src/components/Sidebar/Sidebar.jsx
thipokKub/db-front
772271cedd3d927c35d6857098b61af001dcef98
[ "MIT" ]
null
null
null
src/components/Sidebar/Sidebar.jsx
thipokKub/db-front
772271cedd3d927c35d6857098b61af001dcef98
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { NavLink } from "react-router-dom"; import HeaderLinks from "../Header/HeaderLinks.jsx"; import imagine1 from "assets/img/sidebar-1.jpg"; import imagine2 from "assets/img/sidebar-2.jpg"; import imagine3 from "assets/img/sidebar-3.jpg"; import imagine4 from "assets/img/sidebar-4.jpg"; import logo from "assets/img/Chula_low_poly.png"; import dashboardRoutes from "routes/dashboard.jsx"; import connect from '../../redux/connectAll.js' import constraint from '../../variables/Constraint'; const { projectName } = constraint; const ImageArray = [imagine1, imagine2, imagine3, imagine4] class Sidebar extends Component { constructor(props) { super(props); this.state = { width: window.innerWidth, index: 3, }; } activeRoute(routeName) { return this.props.location.pathname.indexOf(routeName) > -1 ? "active" : ""; } updateDimensions() { this.setState({ width: window.innerWidth }); } componentDidMount() { this.updateDimensions(); window.addEventListener("resize", this.updateDimensions.bind(this)); } render() { const { isDisabledMenuItem } = this.props.page; return ( <div id="sidebar" className="sidebar" data-color="blue" data-image={ImageArray[this.state.index]} > <div className="sidebar-background" style={{ backgroundImage: `url('${ImageArray[this.state.index]}')` }} /> <div className="logo"> <a className="simple-text logo-mini" > <div className="logo-img"> <img src={logo} alt="logo_image" /> </div> </a> <a className="simple-text logo-normal" > {projectName} </a> </div> <div className="sidebar-wrapper"> <ul className="nav"> {this.state.width <= 991 ? <HeaderLinks /> : null} {dashboardRoutes.map((prop, key) => { if (!prop.redirect) { if (isDisabledMenuItem) { if (prop.path.toLowerCase() !== '/login') { return null; } return ( <li className="active" key={key} > <NavLink to={prop.path} className="nav-link" activeClassName="active" > <i className={prop.icon} /> <p>{prop.name}</p> </NavLink> </li>); } else if(!isDisabledMenuItem && prop.path.toLowerCase() === '/login') { return null; } return ( <li className={ prop.upgrade ? "active active-pro" : this.activeRoute(prop.path) } key={key} > <NavLink to={prop.path} className="nav-link" activeClassName="active" > <i className={prop.icon} /> <p>{prop.name}</p> </NavLink> </li> ); } return null; })} </ul> </div> </div> ); } } export default connect(Sidebar, { states: ["page"], actions: [] });
29.885246
88
0.463796
false
true
true
false