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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d00007f0967a66b9c4a913ae7c1b9fd081b75263 | 556 | jsx | JSX | src/js/containers/pages/ArrayHookPage.jsx | react-custom-projects/custom-react-hooks | 1a28a9209cc8db20c3abc0ac58a6d8ece5a6b5ad | [
"MIT"
] | null | null | null | src/js/containers/pages/ArrayHookPage.jsx | react-custom-projects/custom-react-hooks | 1a28a9209cc8db20c3abc0ac58a6d8ece5a6b5ad | [
"MIT"
] | null | null | null | src/js/containers/pages/ArrayHookPage.jsx | react-custom-projects/custom-react-hooks | 1a28a9209cc8db20c3abc0ac58a6d8ece5a6b5ad | [
"MIT"
] | null | null | null | import React from 'react';
//custom hooks
import useArray from '../../customHooks/UseArray';
const ArrayHookPage = () => {
const toDos = useArray([]);
return (
<div className="magnify-container">
<h3>ToDos</h3>
<button onClick={() => toDos.add(Math.random())}>Add</button>
<ul>
{toDos.value.map((el, i) => (
<li key={i}>
{el} <button onClick={() => toDos.removeByIndex(i)}>Delete</button>
</li>
))}
</ul>
<button onClick={() => toDos.clear()}>Clear Todos</button>
</div>
);
};
export default ArrayHookPage;
| 22.24 | 73 | 0.591727 | true | false | false | true |
d00009246fb13dcca8132937d1f4a1baaac1b137 | 8,866 | jsx | JSX | src/tools/webui/src/components/pages/Configuration.jsx | mpranj/libelektra | 373a87dad9101a875aeb79abc8e49560612af2bc | [
"MIT",
"BSD-3-Clause-Clear",
"Apache-2.0",
"BSD-3-Clause"
] | 188 | 2015-01-07T20:34:26.000Z | 2022-03-16T09:55:09.000Z | src/tools/webui/src/components/pages/Configuration.jsx | mpranj/libelektra | 373a87dad9101a875aeb79abc8e49560612af2bc | [
"MIT",
"BSD-3-Clause-Clear",
"Apache-2.0",
"BSD-3-Clause"
] | 3,813 | 2015-01-02T14:00:08.000Z | 2022-03-31T14:19:11.000Z | src/tools/webui/src/components/pages/Configuration.jsx | mpranj/libelektra | 373a87dad9101a875aeb79abc8e49560612af2bc | [
"MIT",
"BSD-3-Clause-Clear",
"Apache-2.0",
"BSD-3-Clause"
] | 149 | 2015-01-10T02:07:50.000Z | 2022-03-16T09:50:24.000Z | /**
* @file
*
* @brief this is the configuration page
*
* it renders the interactive tree view
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/
import React, { Component } from "react";
import { Card, CardHeader, CardText } from "material-ui/Card";
import IconButton from "material-ui/IconButton";
import NavigationRefresh from "material-ui/svg-icons/navigation/refresh";
import TreeView from "../../containers/ConnectedTreeView";
import TreeSearch from "../../containers/ConnectedTreeSearch";
import InstanceError from "../InstanceError.jsx";
const NAMESPACES = ["user", "system", "spec", "dir"];
// create tree structure from kdb ls result (list of available keys)
const partsTree = (acc, parts) => {
if (parts.length <= 0) return acc;
const part = parts.shift();
if (!acc[part]) acc[part] = {};
partsTree(acc[part], parts);
return acc;
};
const createTree = (ls) =>
ls.reduce((acc, item) => {
return partsTree(acc, item.split("/"));
}, {});
const parseDataSet = (
getKey,
sendNotification,
instanceId,
tree,
path,
parent
) => {
return Object.keys(tree).map((key) => {
const newPath = path ? path + "/" + key : key;
let data = {
name: key,
path: newPath,
root: !path,
parent: parent,
};
const children = parseDataSet(
getKey,
sendNotification,
instanceId,
tree[key],
newPath,
data
);
data.children =
Array.isArray(children) && children.length > 0
? (notify = true) => {
return new Promise((resolve) => {
getKey(instanceId, newPath, true);
resolve(children);
});
}
: false;
return data;
});
};
const parseData = (getKey, sendNotification, instanceId, ls, kdb) => {
if (!Array.isArray(ls)) return;
const tree = createTree(ls);
return parseDataSet(getKey, sendNotification, instanceId, tree);
};
const getUnfolded = (searchResults) => {
let unfolded = [];
for (let r of searchResults) {
const parts = r.split("/");
let path = "";
for (let p of parts) {
path = path.length === 0 ? p : path + "/" + p;
if (!unfolded.includes(path)) {
unfolded.push(path);
}
}
}
return unfolded;
};
// configuration page
export default class Configuration extends Component {
constructor(props, ...rest) {
super(props, ...rest);
const { getKdb, match } = props;
const { id } = match && match.params;
getKdb(id);
this.state = { data: this.generateData(props) || [] };
}
componentWillReceiveProps(nextProps) {
this.setState({ data: this.generateData(nextProps) || [] });
}
updateKey = (data, [keyPath, ...paths], keyData) =>
Array.isArray(data)
? data.map((d) => {
if (d.name === keyPath) {
if (paths.length > 0) {
// recurse deeper
return {
...d,
children: this.updateKey(d.children, paths, keyData),
};
}
// we found the key, replace data
return keyData;
}
// not the path we want to edit
return d;
})
: data;
updateData = (keyData, paths) => {
const { data } = this.state;
const newData = this.updateKey(data, paths, keyData);
return this.setState({ data: newData });
};
waitForData = () => {
const { sendNotification } = this.props;
const { data } = this.state;
const user = Array.isArray(data) && data.find((d) => d.path === "user");
if (!user || !user.children) {
this.timeout = setTimeout(this.waitForData, 100);
} else {
this.preload(data).then(() =>
sendNotification("configuration data loaded!")
);
}
};
componentDidMount() {
this.waitForData();
}
generateData = ({ ls, match, getKey }) => {
const { id } = match && match.params;
const { sendNotification } = this.props;
return parseData(getKey, sendNotification, id, [...NAMESPACES, ...ls]);
};
refresh = () => {
return window.location.reload();
};
preload = async (tree, paths = [], levels = 1) => {
if (!tree) return await Promise.resolve(tree);
return await Promise.all(
tree.map(async (item, i) => {
let { children } = item;
if (!children) return item;
const childItems =
typeof children === "function"
? await children(false) // resolve children if necessary
: children;
const newPaths = [...paths, item.name];
let promises = [
this.updateData(
{
...item,
children: childItems,
},
newPaths
),
];
if (levels > 0) {
if (NAMESPACES.includes(newPaths.indexOf(0))) {
promises.push(this.preload(childItems, newPaths, levels - 1));
}
}
return Promise.all(promises);
})
);
};
render() {
const { instance, match, instanceError, search } = this.props;
const { data } = this.state;
if (instanceError) {
return (
<Card>
<CardHeader
title={
<h1>
<b>404</b> instance not found
</h1>
}
/>
<CardText>
<InstanceError
instance={instance}
error={instanceError}
refresh={this.refresh}
/>
</CardText>
</Card>
);
}
if (!instance) {
const title = (
<h1>
<b>Loading instance...</b> please wait
</h1>
);
return (
<Card>
<CardHeader title={title} />
</Card>
);
}
const { id } = match && match.params;
const { name, description, host, visibility } = instance;
const title = (
<h1>
<b>{name}</b>
<IconButton
className="hoverEffect"
style={{ marginLeft: 6, width: 28, height: 28, padding: 6 }}
iconStyle={{ width: 16, height: 16 }}
onClick={this.refresh}
tooltip="refresh"
>
<NavigationRefresh />
</IconButton>
</h1>
);
const isSearching = search && search.done;
const hasResults = search && search.results && search.results.length > 0;
const searchError = search && search.error;
const filteredData =
isSearching && hasResults
? this.generateData({ ...this.props, ls: search.results })
: data;
const autoUnfold =
isSearching &&
hasResults &&
search.results &&
search.results.length <= 10;
const filteredInstance = autoUnfold
? { ...instance, unfolded: getUnfolded(search.results) }
: instance;
return (
<Card style={{ padding: "8px 16px" }}>
<CardHeader
title={title}
subtitle={
<span>
{description ? description + " — " : ""}
host: <span style={{ opacity: 0.7 }}>{host}</span>
— visibility:{" "}
<span style={{ opacity: 0.7 }}>{visibility}</span>
</span>
}
/>
<CardText>
{instanceError ? (
<InstanceError
instance={instance}
error={instanceError}
refresh={this.refresh}
/>
) : data && Array.isArray(data) && data.length > 0 ? (
[
<TreeSearch instanceId={id} />,
searchError ? (
<div
style={{
fontSize: "1.1em",
color: "rgba(0, 0, 0, 0.4)",
marginTop: "1.5em",
padingLeft: "0.5em",
}}
>
<b>{searchError.name}:</b> {searchError.message}
</div>
) : isSearching && !hasResults ? (
<div
style={{
fontSize: "1.1em",
color: "rgba(0, 0, 0, 0.4)",
marginTop: "1.5em",
padingLeft: "0.5em",
}}
>
No results found for "{search.query}".
</div>
) : (
<TreeView
searching={isSearching || (search && search.clearing)}
instance={filteredInstance}
instanceId={id}
data={filteredData}
instanceVisibility={visibility}
/>
),
]
) : (
<div style={{ fontSize: "1.1em", color: "rgba(0, 0, 0, 0.4)" }}>
Loading configuration data...
</div>
)}
</CardText>
</Card>
);
}
}
| 26.153392 | 77 | 0.498195 | false | true | true | false |
d0000dce55c161037f27e15cb22892616fa3941f | 1,447 | jsx | JSX | src/modules/landing-page/components/About.jsx | StudioKarsa/studiokarsa-web | ddf4bedf99e74fdb414577f85262f7f1c2530700 | [
"RSA-MD"
] | 7 | 2021-06-23T03:07:34.000Z | 2021-09-17T15:30:02.000Z | src/modules/landing-page/components/About.jsx | StudioKarsa/studiokarsa.tech | ddf4bedf99e74fdb414577f85262f7f1c2530700 | [
"RSA-MD"
] | 2 | 2021-07-11T13:23:33.000Z | 2021-07-12T14:33:15.000Z | src/modules/landing-page/components/About.jsx | StudioKarsa/studiokarsa.tech | ddf4bedf99e74fdb414577f85262f7f1c2530700 | [
"RSA-MD"
] | null | null | null | import React from 'react'
import { useTranslation } from 'react-i18next'
import { Link } from 'gatsby'
import TeamSVG from '../../../assets/images/team.svg'
import ArrowSVG from '../../../assets/icons/arrow.svg'
const About = () => {
const { t } = useTranslation()
return (
<div id="section-about" className="flex flex-col px-6 md:px-20 space-y-2">
<div className="flex flex-col">
<h2 className="text-2xl lg:text-3xl font-medium text-primary tracking-wide uppercase">
{t('landingPage.about.title')}
</h2>
<h2 className="text-2xl lg:text-4xl font-semibold tracking-wider">
{t('landingPage.about.subtitle')}
</h2>
</div>
<div className="flex flex-col md:flex-row justify-between">
<div className="w-full md:w-1/2 p-2 md:p-8">
<TeamSVG className="w-full h-full" />
</div>
<div className="flex w-full md:w-1/2 p-2 md:p-8 text-lg">
<div className="my-auto">
<p>{t('landingPage.about.content')}</p>
<br />
<Link
to="/"
className="group font-semibold flex flex-row items-center hover:underline"
>
{t('common.learnMore')}
<ArrowSVG className="w-5 h-5 ml-12 group-hover:transform group-hover:translate-x-4 duration-200" />
</Link>
</div>
</div>
</div>
</div>
)
}
export default About
| 32.886364 | 113 | 0.564616 | false | true | false | true |
d0001cdfec9f7208b4c756359d08eeed65b74d24 | 1,033 | jsx | JSX | agile/src/app/agile/containers/project/Backlog/BacklogComponent/SprintComponent/SprintItemComponent/BacklogHeader.jsx | choerodon/choerodon-front-agile | 0275762f89d3ee9e9e624fb729ba67494f73c823 | [
"Apache-2.0"
] | 17 | 2018-06-08T08:35:43.000Z | 2021-11-19T06:29:29.000Z | agile/src/app/agile/containers/project/Backlog/BacklogComponent/SprintComponent/SprintItemComponent/BacklogHeader.jsx | choerodon/choerodon-front-agile | 0275762f89d3ee9e9e624fb729ba67494f73c823 | [
"Apache-2.0"
] | null | null | null | agile/src/app/agile/containers/project/Backlog/BacklogComponent/SprintComponent/SprintItemComponent/BacklogHeader.jsx | choerodon/choerodon-front-agile | 0275762f89d3ee9e9e624fb729ba67494f73c823 | [
"Apache-2.0"
] | 16 | 2018-06-08T09:58:32.000Z | 2020-01-02T09:47:59.000Z | import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import SprintName from './SprintHeaderComponent/SprintName';
import SprintVisibleIssue from './SprintHeaderComponent/SprintVisibleIssue';
import '../Sprint.scss';
import BacklogStore from '../../../../../../stores/project/backlog/BacklogStore';
@inject('AppState', 'HeaderStore')
@observer class BacklogHeader extends Component {
render() {
const {
data, expand, toggleSprint, sprintId, issueCount,
} = this.props;
return (
<div className="c7n-backlog-sprintTop">
<div className="c7n-backlog-springTitle">
<div className="c7n-backlog-sprintTitleSide">
<SprintName
type="backlog"
expand={expand}
sprintName="待办事项"
toggleSprint={toggleSprint}
/>
<SprintVisibleIssue
issueCount={issueCount}
/>
</div>
</div>
</div>
);
}
}
export default BacklogHeader;
| 28.694444 | 81 | 0.607938 | false | true | true | false |
d0002670d92c11e085f8d1f77fe233fe479265e9 | 1,166 | jsx | JSX | imports/ui2/components/TabNav.jsx | gabijuns/liane-toolkit | 583304cb4396c342bfec32532b37d0827d952c38 | [
"MIT"
] | null | null | null | imports/ui2/components/TabNav.jsx | gabijuns/liane-toolkit | 583304cb4396c342bfec32532b37d0827d952c38 | [
"MIT"
] | null | null | null | imports/ui2/components/TabNav.jsx | gabijuns/liane-toolkit | 583304cb4396c342bfec32532b37d0827d952c38 | [
"MIT"
] | null | null | null | import React, { Component } from "react";
import styled, { css } from "styled-components";
const Container = styled.nav`
display: flex;
align-items: center;
justify-content: center;
margin: 0 0 2rem;
font-size: 0.8em;
font-weight: 600;
background: #333;
a {
text-align: center;
flex: 1 1 auto;
color: #666;
padding: 0.5rem 1rem;
text-decoration: none;
border-bottom: 2px solid transparent;
&:hover,
&:active,
&:focus {
color: #000;
border-color: #eee;
}
&.active {
color: #333;
border-color: #000;
}
}
${props =>
props.dark &&
css`
background: #333;
a {
color: rgba(255, 255, 255, 0.6);
&:hover,
&:active,
&:focus {
color: #fff;
border-color: rgba(0, 0, 0, 0.3);
}
&.active {
color: #f7f7f7;
border-color: #212121;
}
}
`}
`;
export default class TabNav extends Component {
render() {
const { children, ...props } = this.props;
return (
<Container {...props} className="tab-nav">
{children}
</Container>
);
}
}
| 19.433333 | 48 | 0.517153 | false | true | true | false |
d00029d7001284f38d3aea4994b1015b4b333ba8 | 6,444 | jsx | JSX | src/pages/staff/food/AddFood.jsx | CS2102-Team-51/main | 99198373ca74b16528df9184fab1e1d9a900951f | [
"MIT"
] | null | null | null | src/pages/staff/food/AddFood.jsx | CS2102-Team-51/main | 99198373ca74b16528df9184fab1e1d9a900951f | [
"MIT"
] | 6 | 2020-03-29T18:58:20.000Z | 2020-03-29T19:14:55.000Z | src/pages/staff/food/AddFood.jsx | CS2102-Team-51/main | 99198373ca74b16528df9184fab1e1d9a900951f | [
"MIT"
] | 2 | 2020-02-07T15:17:59.000Z | 2020-02-08T07:04:35.000Z | import React, {Component} from 'react';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogTitle from '@material-ui/core/DialogTitle';
import Radio from '@material-ui/core/Radio';
import RadioGroup from '@material-ui/core/RadioGroup';
import {FormControlLabel} from '@material-ui/core';
import * as apiRoute from '../../../components/Api/route';
import Axios from 'axios';
export default class AddRestaurant extends Component {
constructor () {
super ();
this.state = {
success: false,
rname: '',
raddress: '',
rmincost: '',
};
this._handleClose = this._handleClose.bind (this);
this._handleRegister = this._handleRegister.bind (this);
this._showSuccess = this._showSuccess.bind (this);
}
componentDidMount () {}
componentDidUpdate (prevProps) {
if (this.props.setOpen !== prevProps.setOpen) {
console.log ('This is my status: ', this.props.status);
console.log ('This is my food: ', this.props.singleFood);
if (this.props.status === 'Edit') {
this.setState ({
fname: this.props.singleFood[3],
fprice: this.props.singleFood[4],
favailable: this.props.singleFood[2],
flimit: this.props.singleFood[2],
});
}
}
}
_handleClose = () => {
this.setState ({
success: false,
showError: '',
fname: '',
fprice: '',
favailable: '',
flimit: '',
});
this.props.updateSetOpen (false);
};
_handleRegister = () => {
let food = {
fname: this.state.fname.trim (),
fprice: this.state.fprice.trim (),
favailable: this.state.favailable.trim (),
flimit: this.state.flimit.trim (),
};
if (this.props.status === 'Create') {
Axios.post (apiRoute.FOOD_API + '/post/' + this.props.rid, food, {
withCredentials: false,
})
.then (response => {
console.log (response);
this._showSuccess ();
this.props.fetchFood ();
})
.catch (error => {
console.log (error);
});
} else {
Axios.put (
apiRoute.FOOD_API + '/update/' + this.props.singleFood.fid + '/' + this.props.rid,
food,
{
withCredentials: false,
}
)
.then (response => {
console.log (response);
this._showSuccess ();
this.props.fetchFood ();
})
.catch (error => {
console.log (error);
this._showError ('nameTaken');
});
}
};
_showSuccess () {
this.setState ({
success: true,
showError: '',
});
}
updateFname (event) {
this.setState ({
fname: event.target.value,
});
}
updateFprice (event) {
this.setState ({
fprice: event.target.value,
});
}
updateFavailable (event) {
this.setState ({
favailable: event.target.value,
});
}
updateFlimit (event) {
this.setState ({
flimit: event.target.value,
});
}
render () {
return (
<div>
<Dialog
open={this.props.setOpen}
onClose={this._handleClose}
aria-labelledby="form-dialog-title"
maxWidth="xl"
>
<DialogTitle id="form-dialog-title">
{this.props.status === 'Create'
? 'Register a Restaurant'
: 'Edit a Restaurant'}
</DialogTitle>
<DialogContent>
<DialogContentText>
You're one step away from bringing happiness (and food) to thousands of others!
</DialogContentText>
{this.state.showError
? <DialogContentText className="registrationError">
{this.state.showError}
</DialogContentText>
: ''}
{this.state.success && this.props.status === 'Create'
? <DialogContentText className="registrationSuccess">
Registration success!
</DialogContentText>
: ''}
{this.state.success && this.props.status === 'Edit'
? <DialogContentText className="registrationSuccess">
Update success!
</DialogContentText>
: ''}
<TextField
autoFocus
margin="dense"
value={this.state.fname}
onChange={e => this.updateFname (e)}
id="fullname"
label="Food Name"
variant="outlined"
inputProps={{maxLength: 50}}
required
fullWidth
/>
<TextField
margin="dense"
value={this.state.fprice}
onChange={e => this.updateFprice (e)}
id="username"
label="Food Price"
type="number"
variant="outlined"
inputProps={{maxLength: 50}}
required
fullWidth
/>
<TextField
margin="dense"
value={this.state.favailable}
onChange={e => this.updateFavailable (e)}
id="password"
label="Food Availability (true or false)"
type="boolean"
variant="outlined"
inputProps={{maxLength: 50}}
required
fullWidth
/>
<TextField
margin="dense"
value={this.state.flimit}
onChange={e => this.updateFlimit (e)}
id="password"
label="Food Limit"
type="number"
variant="outlined"
inputProps={{maxLength: 50}}
required
fullWidth
/>
</DialogContent>
<DialogActions>
<Button onClick={this._handleClose} color="primary">
Cancel
</Button>
<Button onClick={this._handleRegister} color="primary">
{this.props.status === 'Create' ? 'Create' : 'Update'}
</Button>
</DialogActions>
</Dialog>
</div>
);
}
}
| 28.387665 | 93 | 0.522036 | false | true | true | false |
d000322489ad25f38f083d1f2ff169902bf48c31 | 450 | jsx | JSX | designsystem/examples/form/Checkbox.jsx | NghiNg/designsystem | 548fdb7b32e0d956f29d098f001007936a22125e | [
"MIT"
] | null | null | null | designsystem/examples/form/Checkbox.jsx | NghiNg/designsystem | 548fdb7b32e0d956f29d098f001007936a22125e | [
"MIT"
] | null | null | null | designsystem/examples/form/Checkbox.jsx | NghiNg/designsystem | 548fdb7b32e0d956f29d098f001007936a22125e | [
"MIT"
] | null | null | null | import { Checkbox } from '@sb1/ffe-form-react';
<fieldset className="ffe-fieldset">
<legend className="ffe-form-label ffe-form-label--block">
Hvilke aviser leser du?
</legend>
<Checkbox name="newspapers" value="vg">
VG
</Checkbox>
<Checkbox name="newspapers" value="dagbladet">
Dagbladet
</Checkbox>
<Checkbox name="newspapers" value="aftenposten">
Aftenposten
</Checkbox>
</fieldset>
| 26.470588 | 61 | 0.637778 | false | true | false | true |
d000506f694749bd1135ef62724500540d5f2d33 | 1,955 | jsx | JSX | src/client/components/containers/EventsContainer.jsx | TWetmore/Swell | ed852fbb6079c63e7986adcf294c889c524109c8 | [
"MIT"
] | 10 | 2020-12-31T16:25:16.000Z | 2021-02-12T01:56:20.000Z | src/client/components/containers/EventsContainer.jsx | njfleming/Swell | 632fcd4df07f87ce813b6b8e042768fb47c89c91 | [
"MIT"
] | null | null | null | src/client/components/containers/EventsContainer.jsx | njfleming/Swell | 632fcd4df07f87ce813b6b8e042768fb47c89c91 | [
"MIT"
] | null | null | null | import React from 'react';
import {UnControlled as CodeMirror} from 'react-codemirror2';
import EmptyState from '../display/EmptyState';
import EventPreview from '../display/EventPreview';
import 'codemirror/theme/neo.css'
export default function EventsContainer({currentResponse}) {
const { request, response } = currentResponse;
if (!response || !response.events || response.events.length < 1) {
return (
<EmptyState connection={currentResponse.connection}/>
);
}
const { events, headers } = response;
let responseBody = '';
// If it's a stream or graphQL subscription
if (
(events && events.length > 1) ||
(headers?.["content-type"] && headers["content-type"].includes('stream')) ||
(currentResponse.graphQL && request.method === 'SUBSCRIPTION')
) {
let eventType = 'Stream';
if (currentResponse.graphQL && request.method === 'SUBSCRIPTION') {
eventType = 'Subscription'
}
events.forEach((event, idx) => {
const eventStr = JSON.stringify(event, null, 4);
responseBody += `-------------${eventType} Event ${idx + 1}-------------\n${eventStr}\n\n`;
});
}
// If it's a single response
else {
responseBody = JSON.stringify(events[0], null, 4);
}
return (
<div className="tab_content-response overflow-event-parent-container" id="events-display">
{request.method === 'GET' && (
<EventPreview
className='overflow-event-child-container'
contents={responseBody}
/>
)}
<div className='overflow-event-parent-container'>
<CodeMirror
className='overflow-event-child-container'
value={responseBody}
options={{
mode: 'application/json',
theme: 'neo responsebody',
lineNumbers: true,
tabSize: 4,
lineWrapping: true,
readOnly: true,
}}
/>
</div>
</div>
);
} | 28.75 | 97 | 0.596419 | false | true | false | true |
d0005faaed23832d240c25d2576b22049bdd76d6 | 2,660 | jsx | JSX | src/views/Projects.jsx | tschaeff/thor-news-gastbyjs-blog | c1ad216e1501823ee670a11274e8a39dfe1c0c06 | [
"MIT"
] | 8 | 2019-01-28T19:32:53.000Z | 2020-05-04T16:58:21.000Z | src/views/Projects.jsx | thorwebdev/thor-news-gastbyjs-blog | a5dc15814366abfce7b949b16440e821faea312b | [
"MIT"
] | 2 | 2019-01-13T11:10:00.000Z | 2019-02-05T00:08:28.000Z | src/views/Projects.jsx | thorwebdev/thor-news-gastbyjs-blog | a5dc15814366abfce7b949b16440e821faea312b | [
"MIT"
] | 2 | 2019-11-14T07:31:50.000Z | 2020-01-31T17:17:25.000Z | import React from "react";
import PropTypes from "prop-types";
import { Divider, DividerMiddle } from "../elements/Dividers";
import Content from "../elements/Content";
import Inner from "../elements/Inner";
import { UpDown, UpDownWide } from "../styles/animations";
import { colors } from "../../tailwind";
import SVG from "../components/SVG";
const Projects = ({ children }) => (
<>
<DividerMiddle
bg="linear-gradient(to right, SlateBlue 0%, DeepSkyBlue 100%)"
speed={-0.2}
offset={1.1}
factor={2}
/>
<Content speed={0.4} offset={1.2} factor={2}>
<Inner>{children}</Inner>
</Content>
<Divider speed={0.1} offset={1} factor={2}>
<UpDown>
<SVG icon="box" width={6} fill={colors.white} left="85%" top="75%" />
<SVG icon="upDown" width={8} fill={colors.teal} left="70%" top="20%" />
<SVG
icon="triangle"
width={8}
stroke={colors.orange}
left="25%"
top="5%"
/>
<SVG
icon="circle"
hiddenMobile
width={24}
fill={colors.white}
left="17%"
top="60%"
/>
</UpDown>
<UpDownWide>
<SVG
icon="arrowUp"
hiddenMobile
width={16}
fill={colors.green}
left="20%"
top="90%"
/>
<SVG
icon="triangle"
width={12}
stroke={colors.white}
left="90%"
top="30%"
/>
<SVG
icon="circle"
width={16}
fill={colors.yellow}
left="70%"
top="90%"
/>
<SVG
icon="triangle"
hiddenMobile
width={16}
stroke={colors.teal}
left="18%"
top="75%"
/>
<SVG icon="circle" width={6} fill={colors.white} left="75%" top="10%" />
<SVG
icon="upDown"
hiddenMobile
width={8}
fill={colors.green}
left="45%"
top="10%"
/>
</UpDownWide>
<SVG icon="circle" width={6} fill={colors.white} left="4%" top="20%" />
<SVG icon="circle" width={12} fill={colors.pink} left="80%" top="60%" />
<SVG icon="box" width={6} fill={colors.orange} left="10%" top="10%" />
<SVG icon="box" width={12} fill={colors.yellow} left="29%" top="26%" />
<SVG icon="hexa" width={16} stroke={colors.red} left="75%" top="30%" />
<SVG icon="hexa" width={8} stroke={colors.yellow} left="80%" top="70%" />
</Divider>
</>
);
export default Projects;
Projects.propTypes = {
children: PropTypes.node.isRequired
};
| 27.42268 | 80 | 0.495113 | false | true | false | true |
d00065730e697c5c4c86d6097e4d728a84db8d32 | 1,760 | jsx | JSX | src/components/Hero/Hero.jsx | tracey-web/portfolio | c301d7f4064939b0c6667781a2f070b550adb45e | [
"MIT"
] | null | null | null | src/components/Hero/Hero.jsx | tracey-web/portfolio | c301d7f4064939b0c6667781a2f070b550adb45e | [
"MIT"
] | null | null | null | src/components/Hero/Hero.jsx | tracey-web/portfolio | c301d7f4064939b0c6667781a2f070b550adb45e | [
"MIT"
] | null | null | null | import React, { useContext, useState, useEffect } from 'react';
import { Container } from 'react-bootstrap';
import Fade from 'react-reveal/Fade';
import { Link } from 'react-scroll';
import VideoBg from 'reactjs-videobg';
import PortfolioContext from '../../context/context';
import mp4 from '../../images/clouds.mp4';
import poster from '../../images/clouds.png';
const Header = () => {
const { hero } = useContext(PortfolioContext);
const { title, name, subtitle, cta } = hero;
const [isDesktop, setIsDesktop] = useState(false);
const [isMobile, setIsMobile] = useState(false);
useEffect(() => {
if (window.innerWidth > 769) {
setIsDesktop(true);
setIsMobile(false);
} else {
setIsMobile(true);
setIsDesktop(false);
}
}, []);
return (
<section id="hero" className="jumbotron">
<VideoBg poster={poster} wrapperClass="cloud-video">
<VideoBg.Source src={mp4} type="video/mp4" />
</VideoBg>
<Container>
<Fade left={isDesktop} bottom={isMobile} duration={1000} delay={500} distance="30px">
<h1 className="hero-title">
{title || 'Hi, my name is'}{' '}
<span className="text-color-main">{name || 'Tracey Hill'}</span>.
<br />
{subtitle || "I'm a software engineer."}
</h1>
</Fade>
<Fade left={isDesktop} bottom={isMobile} duration={1000} delay={1000} distance="30px">
<p className="hero-cta">
<span className="cta-btn cta-btn--hero">
<Link to="about" smooth duration={1000}>
{cta || 'Learn more'}
</Link>
</span>
</p>
</Fade>
</Container>
</section>
);
};
export default Header;
| 31.428571 | 94 | 0.576136 | false | true | false | true |
d0008858a0dc613211ac22def08629552334b7d0 | 1,408 | jsx | JSX | src/components/UserAccount/UserAccountDetails.jsx | MasterEatsPlatzi/Master-Eats | 5df6d8969040b2038303fd72c14098c932be987b | [
"MIT"
] | 1 | 2020-07-01T04:39:25.000Z | 2020-07-01T04:39:25.000Z | src/components/UserAccount/UserAccountDetails.jsx | MasterEatsPlatzi/Master-Eats | 5df6d8969040b2038303fd72c14098c932be987b | [
"MIT"
] | 6 | 2020-07-03T16:45:42.000Z | 2022-02-27T07:34:14.000Z | src/components/UserAccount/UserAccountDetails.jsx | MasterEatsPlatzi/Master-Eats | 5df6d8969040b2038303fd72c14098c932be987b | [
"MIT"
] | null | null | null | import React from 'react';
import './UserAccount.scss';
import { Link } from 'react-router-dom';
const UserAccountDetails = () => {
return (
<div className="UserAccount__container__menu-settings">
<h2>Mi cuenta</h2>
<form action="">
<div className="form-wrapper">
<div className="form-row">
<label htmlFor="name">Nombre</label><br />
<input type="text" id="name" placeholder="Juan Carlos" ></input>
</div>
<div className="form-row">
<label htmlFor="lname">Apellidos</label><br />
<input type="text" id="lname" placeholder="Martinez Barajas" ></input>
</div>
</div>
<div className="form-wrapper">
<div className="form-row">
<label htmlFor="email">Email</label><br />
<input type="email" id="email" name="email" placeholder="[email protected]" ></input>
</div>
<div className="form-row">
<label htmlFor="phone">Telefono</label><br />
<input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}" placeholder="3203889058" ></input>
</div>
</div>
<div className="form-button">
<Link to="/success"><button type="submit" form="" value="Submit">Guardar</button></Link>
</div>
</form>
</div>
)
}
export default UserAccountDetails; | 37.052632 | 125 | 0.557528 | false | true | false | true |
d00098a2c0173690e38a34a5535312546bf46c61 | 1,098 | jsx | JSX | frontend/src/components/main/main.jsx | ChrisMeyer7088/PersonalSite | 6d068b5ac21a5134cfbddd6fb6bd24c33711c1f3 | [
"MIT"
] | null | null | null | frontend/src/components/main/main.jsx | ChrisMeyer7088/PersonalSite | 6d068b5ac21a5134cfbddd6fb6bd24c33711c1f3 | [
"MIT"
] | null | null | null | frontend/src/components/main/main.jsx | ChrisMeyer7088/PersonalSite | 6d068b5ac21a5134cfbddd6fb6bd24c33711c1f3 | [
"MIT"
] | null | null | null | import { useRef } from 'react';
import { Header } from '../header/header.jsx';
import { About } from '../about/about.jsx';
import { Work } from '../work/work.jsx';
import { Projects } from '../projects/projects.jsx';
import { Contact } from '../contact/contact.jsx';
import { Icons } from '../icons/icons.jsx'
import { useResize} from '../custom/useResize.jsx';
import styles from './main.scss';
export const Main = () => {
const ref = useRef();
const { width, height } = useResize(ref);
const isMobile = width < 600;
return (
<div ref={ref} className={styles.page}>
<Header width={width} />
<div className={styles.containerInfo}>
<section id="about" className={`${styles.section} ${styles.sectionHeight}`}><About /></section>
<section id="work" className={styles.section}><Work isMobile={isMobile} /></section>
<section id="projects" className={styles.section}><Projects isMobile={isMobile} /></section>
<section id="contact" className={styles.section}><Contact /></section>
</div>
{ !isMobile && <Icons />}
</div>
);
}; | 37.862069 | 103 | 0.632058 | false | true | false | true |
d000a72069056e997b16a99d18b964177805ac68 | 355 | jsx | JSX | Print/source/js/components/Title.jsx | kmakoto0212/kintone-plugins | 429ed92fd85c6bfa56863aabf059fbf73c85b6f6 | [
"MIT"
] | null | null | null | Print/source/js/components/Title.jsx | kmakoto0212/kintone-plugins | 429ed92fd85c6bfa56863aabf059fbf73c85b6f6 | [
"MIT"
] | null | null | null | Print/source/js/components/Title.jsx | kmakoto0212/kintone-plugins | 429ed92fd85c6bfa56863aabf059fbf73c85b6f6 | [
"MIT"
] | null | null | null | /* eslint-disable react/prop-types */
import React, {memo} from 'react';
import Label from '@components/Label';
import '@css/header';
const Title = ({title}) => {
return (
<>
<Label
className="header-title"
text={title}
fontSize="16px"
isVisible={!!title}
/>
</>
);
};
export default memo(Title);
| 17.75 | 38 | 0.560563 | false | true | false | true |
d000b3eaef0d8ffaa066f93e8c0d8c94bc1b8002 | 2,566 | jsx | JSX | src/components/Tables/Acessos.jsx | user-cube/ies_frontend | 406401eba6ade48b16634027c6648115ce060a0f | [
"MIT"
] | 1 | 2019-12-22T21:32:08.000Z | 2019-12-22T21:32:08.000Z | src/components/Tables/Acessos.jsx | user-cube/ies_frontend | 406401eba6ade48b16634027c6648115ce060a0f | [
"MIT"
] | null | null | null | src/components/Tables/Acessos.jsx | user-cube/ies_frontend | 406401eba6ade48b16634027c6648115ce060a0f | [
"MIT"
] | null | null | null | import React from "react";
// react component for creating dynamic tables
import ReactTable from "react-table";
class LastAccessTable extends React.Component {
constructor(props) {
super(props);
this.state = {
acessos: props.acessosX,
colums: [
{
Header: 'Ocorrência',
accessor: 'timestamp',
sortable: true,
minWidth: 400,
style: {
textAlign: "center",
height: "50px",
}
}, {
Header: 'Responsável',
accessor: 'user',
sortable: false,
filterable: true,
minWidth: 200,
style: {
textAlign: "center",
height: "50px",
}
}, {
Header: 'Ação',
accessor: 'action',
sortable: false,
filterable: true,
minWidth: 200,
style: {
textAlign: "center",
height: "50px",
}
}, {
Header: 'Fonte',
accessor: 'origin',
sortable: false,
filterable: true,
minWidth: 200,
style: {
textAlign: "center",
height: "50px",
}
}
],
};
}
componentDidMount() {
this.setState({
acessos: this.props.acessosX,
})
}
componentDidUpdate(prevProps) {
if (this.props.acessosX !== prevProps.acessosX) {
this.setState({acessosX: this.props.acessosX});
}
}
render() {
return (
<>
<ReactTable
noDataText="Sem Dados"
data={this.props.acessosX}
columns={this.state.colums}
showPaginationTop={true}
showPaginationBottom={false}
defaultPageSize={10}
defaultFilterMethod={this.filterMethod}
resizable={false}
className="-striped -highlight -pagination"
/>
</>
);
}
}
export default LastAccessTable;
| 28.831461 | 63 | 0.377631 | false | true | true | false |
d000bd5aa9eebf5e2c831ac7b8d0a2c09a3dd655 | 480 | jsx | JSX | client/src/components/comment-card/styles.jsx | Suzan-Dev/vlog | 2a1de3c66b325171cb8f09b80f1dc08c80ca5ba7 | [
"MIT"
] | null | null | null | client/src/components/comment-card/styles.jsx | Suzan-Dev/vlog | 2a1de3c66b325171cb8f09b80f1dc08c80ca5ba7 | [
"MIT"
] | null | null | null | client/src/components/comment-card/styles.jsx | Suzan-Dev/vlog | 2a1de3c66b325171cb8f09b80f1dc08c80ca5ba7 | [
"MIT"
] | 1 | 2022-01-18T11:05:46.000Z | 2022-01-18T11:05:46.000Z | import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles((theme) => ({
commentCardContainer: {
margin: theme.spacing(3, 0),
display: 'flex',
alignContent: 'center',
'& > div:last-child': {
marginLeft: theme.spacing(2),
'& > div': {
display: 'flex',
alignItems: 'center',
},
},
},
authorName: {
fontWeight: 'bold',
marginRight: theme.spacing(1),
},
}));
export default useStyles;
| 19.2 | 54 | 0.56875 | false | true | false | true |
d000c516fbca143cbaf02b3edf56e2d4acc2164d | 3,073 | jsx | JSX | ui/src/components/Company/LoginCompanyPage.jsx | IvayloIV/AdsPartners | 693c5c7abb4ab9e5b8944fd6c874ce82dca9d5e0 | [
"MIT"
] | null | null | null | ui/src/components/Company/LoginCompanyPage.jsx | IvayloIV/AdsPartners | 693c5c7abb4ab9e5b8944fd6c874ce82dca9d5e0 | [
"MIT"
] | null | null | null | ui/src/components/Company/LoginCompanyPage.jsx | IvayloIV/AdsPartners | 693c5c7abb4ab9e5b8944fd6c874ce82dca9d5e0 | [
"MIT"
] | null | null | null | import React, { useState } from 'react';
import { useDispatch } from "react-redux";
import { toast } from 'react-toastify';
import TextField from '@material-ui/core/TextField';
import { Button } from 'semantic-ui-react';
import * as validations from '../../validations/login';
import { loginCompanyAction } from '../../actions/companyActions';
export default props => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [emailValidation, setEmailValidation] = useState('');
const [passwordValidation, setPasswordValidation] = useState('');
const dispatch = useDispatch();
const onChangeHandler = (e, setValue, setValidation) => {
const name = e.target.name;
const value = e.target.value;
if (setValidation !== null) {
setValidation(validations[name](value));
}
setValue(value);
};
const onSubmitHandler = async (e) => {
e.preventDefault();
let haveError = false;
haveError = validateField('email', email, setEmailValidation) || haveError;
haveError = validateField('password', password, setPasswordValidation) || haveError;
if (haveError) {
toast.error('Поправете грешките в полетата.');
return;
}
const params = { email, password };
const json = await dispatch(loginCompanyAction(params))
if (json !== null) {
props.history.push("/");
}
};
const validateField = (name, value, setValidation) => {
let validationValue = validations[name](value);
setValidation(validationValue);
return validationValue !== '';
};
return (
<div className="login-container company-login">
<div className="login-form">
<h1>Вход за компания</h1>
<form onSubmit={onSubmitHandler}>
<div className="login-field">
<TextField
type="text"
label="Мейл"
value={email}
name="email"
onChange={e => onChangeHandler(e, setEmail, setEmailValidation)}
/>
<span data-testid="emailValidation">{emailValidation}</span>
</div>
<div className="login-field">
<TextField
type="password"
label="Парола"
value={password}
name="password"
onChange={e => onChangeHandler(e, setPassword, setPasswordValidation)}
/>
<span>{passwordValidation}</span>
</div>
<div>
<Button color="blue" type="submit" id="login-button">Влез</Button>
</div>
</form>
</div>
</div>
);
};
| 35.321839 | 98 | 0.508949 | false | true | false | true |
d000c7561690a331bf6a90a180127b66cac28cbd | 6,928 | jsx | JSX | features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx | miyurud/carbon-apimgt | 0990a1eac7c7ca648d763f79330d39eea0417d40 | [
"Apache-2.0"
] | 2 | 2019-09-19T11:30:08.000Z | 2019-10-27T07:38:16.000Z | features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx | miyurud/carbon-apimgt | 0990a1eac7c7ca648d763f79330d39eea0417d40 | [
"Apache-2.0"
] | null | null | null | features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/components/Base/Header/headersearch/SearchUtils.jsx | miyurud/carbon-apimgt | 0990a1eac7c7ca648d763f79330d39eea0417d40 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import match from 'autosuggest-highlight/match';
import parse from 'autosuggest-highlight/parse';
import TextField from '@material-ui/core/TextField';
import MenuItem from '@material-ui/core/MenuItem';
import ListItemText from '@material-ui/core/ListItemText';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import Divider from '@material-ui/core/Divider';
import Icon from '@material-ui/core/Icon';
import InputAdornment from '@material-ui/core/InputAdornment';
import SearchOutlined from '@material-ui/icons/SearchOutlined';
import { Link } from 'react-router-dom';
import ProductIcon from 'AppComponents/Shared/CustomIcon';
import CircularProgress from '@material-ui/core/CircularProgress';
import API from 'AppData/api';
import SearchParser from './SearchParser';
/* Utility methods defined here are described in
* react-autosuggest documentation https://github.com/moroshko/react-autosuggest
*/
/**
*
* @param {Object} inputProps Props given for the underline input element
* @returns {React.Component} @inheritdoc
*/
function renderInput(inputProps) {
const {
classes, ref, isLoading, onChange, ...other
} = inputProps; // `isLoading` has destructured here to prevent passing unintended prop to TextField
let loadingAdorment = null;
if (isLoading) {
loadingAdorment = (
<InputAdornment position='end'>
<CircularProgress />
</InputAdornment>
);
}
return (
<TextField
id='searchQuery'
InputProps={{
inputRef: ref,
className: classes.input,
classes: { focused: classes.inputFocused },
startAdornment: (
<InputAdornment position='start'>
<SearchOutlined />
</InputAdornment>
),
endAdornment: loadingAdorment,
onChange,
...other,
}}
/>
);
}
function getPath(suggestion) {
switch (suggestion.type) {
case 'API':
return `/apis/${suggestion.id}/overview`;
case 'APIPRODUCT':
return `/api-products/${suggestion.id}/overview`;
default:
if (suggestion.associatedType === 'API') {
return `/apis/${suggestion.apiUUID}/documents/${suggestion.id}/details`;
} else {
return `/api-products/${suggestion.apiUUID}/documents/${suggestion.id}/details`;
}
}
}
function getArtifactMetaInfo(suggestion) {
switch (suggestion.type) {
case 'API':
return suggestion.version;
case 'APIPRODUCT':
return '';
default:
return suggestion.apiName + ' ' + suggestion.apiVersion;
}
}
function getIcon(type) {
switch (type) {
case 'API':
return <Icon style={{ fontSize: 30 }}>settings_applications</Icon>;
case 'APIPRODUCT':
return (
<ProductIcon
width={16}
height={16}
icon='api-product'
strokeColor='#000000'
/>
);
default:
return <Icon style={{ fontSize: 30 }}>library_books</Icon>;
}
}
/**
*
* Use your imagination to define how suggestions are rendered.
* @param {Object} suggestion This is either API object or document coming from search API call
* @param {Object} { query, isHighlighted } query : User entered value
* @returns {React.Component} @inheritdoc
*/
function renderSuggestion(suggestion, { query, isHighlighted }) {
const matches = match(suggestion.name, query);
const parts = parse(suggestion.name, matches);
const path = getPath(suggestion);
const artifactMetaInfo = getArtifactMetaInfo(suggestion);
// TODO: Style the version ( and apiName if docs) apearing in the menu item
return (
<>
<Link to={path} style={{ color: 'black' }}>
<MenuItem selected={isHighlighted}>
<ListItemIcon>
{getIcon(suggestion.type)}
</ListItemIcon>
<ListItemText
primary={parts.map((part, index) => {
return part.highlight ? (
<span key={String(index)} style={{ fontWeight: 500 }}>
{part.text}
</span>
) : (
<strong key={String(index)} style={{ fontWeight: 300 }}>
{part.text}
</strong>
);
})}
secondary={artifactMetaInfo}
/>
</MenuItem>
</Link>
<Divider />
</>
);
}
/**
* When suggestion is clicked, Autosuggest needs to populate the input
* based on the clicked suggestion. Teach Autosuggest how to calculate the input value for every given suggestion.
*
* @param {Object} suggestion API Object returned from APIS search api.list[]
* @returns {String} API Name
*/
function getSuggestionValue(suggestion) {
return suggestion.name;
}
/**
* Build the search query from the user input
* @param searchText
* @returns {string}
*/
function buildSearchQuery(searchText) {
const inputValue = searchText.trim().toLowerCase();
return SearchParser.parse(inputValue);
}
/**
* Called for any input change to get the results set
*
* @param {String} value current value in input element
* @returns {Promise} If no input text, return a promise which resolve to empty array, else return the API.all response
*/
function getSuggestions(value) {
const modifiedSearchQuery = buildSearchQuery(value);
if (value.trim().length === 0 || !modifiedSearchQuery) {
return new Promise((resolve) => resolve({ obj: { list: [] } }));
} else {
return API.search({ query: modifiedSearchQuery, limit: 8 });
}
}
export {
renderInput, renderSuggestion, getSuggestions, getSuggestionValue, buildSearchQuery,
};
| 34.128079 | 119 | 0.594544 | false | true | false | true |
d000f0dc93d91ca5eafc8f53d5234467958778af | 3,014 | jsx | JSX | src/components/Header/HeaderControlsNotifications.jsx | serCJm/react-admin-dashboard | 92b56f1ca2293b460a5310d8b9c955d6ef9b5916 | [
"MIT"
] | 1 | 2018-12-13T20:01:17.000Z | 2018-12-13T20:01:17.000Z | src/components/Header/HeaderControlsNotifications.jsx | serCJm/react-admin-dashboard | 92b56f1ca2293b460a5310d8b9c955d6ef9b5916 | [
"MIT"
] | 9 | 2019-09-07T22:46:35.000Z | 2022-02-26T06:52:37.000Z | src/components/Header/HeaderControlsNotifications.jsx | serCJm/react-admin-dashboard | 92b56f1ca2293b460a5310d8b9c955d6ef9b5916 | [
"MIT"
] | null | null | null | import React, { Component } from "react";
import { NavLink } from "react-router-dom";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faEnvelope } from "@fortawesome/free-solid-svg-icons";
import { faBell } from "@fortawesome/free-solid-svg-icons";
import { faRss } from "@fortawesome/free-solid-svg-icons";
import HeaderControlsBell from "./HeaderControlsBell";
import HeaderControlsRSS from "./HeaderControlsRSS";
class HeaderControlsNotifications extends Component {
state = {
showNotifications: false,
showRSS: false
};
handleNotificationsClick = () => {
if (!this.state.showNotifications) {
// attach/remove event handler
document.addEventListener(
"click",
this.handleNotificationsOutsideClick,
false
);
} else {
document.removeEventListener(
"click",
this.handleNotificationsOutsideClick,
false
);
}
this.setState(prevState => ({
showNotifications: !prevState.showNotifications
}));
};
handleNotificationsOutsideClick = e => {
// ignore clicks on the component itself
if (this.node1.contains(e.target)) {
return;
}
this.handleNotificationsClick();
};
handleRSSClick = () => {
if (!this.state.showRSS) {
// attach/remove event handler
document.addEventListener("click", this.handleRSSOutsideClick, false);
} else {
document.removeEventListener("click", this.handleRSSOutsideClick, false);
}
this.setState(prevState => ({
showRSS: !prevState.showRSS
}));
};
handleRSSOutsideClick = e => {
// ignore clicks on the component itself
if (this.node2.contains(e.target)) {
return;
}
this.handleRSSClick();
};
render() {
let headerControlsBell = null;
if (this.state.showNotifications) {
headerControlsBell = <HeaderControlsBell />;
}
let headerControlsRSS = null;
if (this.state.showRSS) {
headerControlsRSS = <HeaderControlsRSS />;
}
return (
<div className="header-controls-item">
<NavLink
className="header-controls-icon"
to="/inbox"
aria-label="Go to inbox"
>
<span>
<FontAwesomeIcon icon={faEnvelope} />
</span>
</NavLink>
<span
className="header-controls-icon"
ref={node => {
this.node1 = node;
}}
onClick={this.handleNotificationsClick}
>
<FontAwesomeIcon icon={faBell} />
{headerControlsBell}
<div className="bubble1">3</div>
</span>
<span
className="header-controls-icon"
ref={node => {
this.node2 = node;
}}
onClick={this.handleRSSClick}
>
<FontAwesomeIcon icon={faRss} />
<div className="bubble2">4</div>
{headerControlsRSS}
</span>
</div>
);
}
}
export default HeaderControlsNotifications;
| 26.672566 | 79 | 0.60219 | false | true | true | false |
d0010ef5b3e1c812a02bc262e18d1d803d953d49 | 11,376 | jsx | JSX | superset-frontend/src/explore/components/ExploreChartHeader.jsx | choice-form/superset | 8d579798671459ea1635f177b7c8e6f1612ff3b2 | [
"Apache-2.0"
] | null | null | null | superset-frontend/src/explore/components/ExploreChartHeader.jsx | choice-form/superset | 8d579798671459ea1635f177b7c8e6f1612ff3b2 | [
"Apache-2.0"
] | 1 | 2022-02-23T10:34:59.000Z | 2022-02-23T10:34:59.000Z | superset-frontend/src/explore/components/ExploreChartHeader.jsx | choice-form/superset | 8d579798671459ea1635f177b7c8e6f1612ff3b2 | [
"Apache-2.0"
] | null | null | null | /**
* 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 { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import PropTypes from 'prop-types';
import Icons from 'src/components/Icons';
import { CategoricalColorNamespace, SupersetClient, styled, t } from 'src/core';
import { Tooltip } from 'src/components/Tooltip';
import ReportModal from 'src/components/ReportModal';
import {
fetchUISpecificReport,
toggleActive,
deleteActiveReport,
} from 'src/reports/actions/reports';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import HeaderReportActionsDropdown from 'src/components/ReportModal/HeaderReportActionsDropdown';
import { chartPropShape } from 'src/dashboard/util/propShapes';
import EditableTitle from 'src/components/EditableTitle';
import AlteredSliceTag from 'src/components/AlteredSliceTag';
import FaveStar from 'src/components/FaveStar';
import Timer from 'src/components/Timer';
import CachedLabel from 'src/components/CachedLabel';
import PropertiesModal from 'src/explore/components/PropertiesModal';
import { sliceUpdated } from 'src/explore/actions/exploreActions';
import CertifiedIcon from 'src/components/CertifiedIcon';
import ExploreActionButtons from './ExploreActionButtons';
import RowCountLabel from './RowCountLabel';
const CHART_STATUS_MAP = {
failed: 'danger',
loading: 'warning',
success: 'success',
};
const propTypes = {
actions: PropTypes.object.isRequired,
addHistory: PropTypes.func,
can_overwrite: PropTypes.bool.isRequired,
can_download: PropTypes.bool.isRequired,
dashboardId: PropTypes.number,
isStarred: PropTypes.bool.isRequired,
slice: PropTypes.object,
sliceName: PropTypes.string,
table_name: PropTypes.string,
form_data: PropTypes.object,
ownState: PropTypes.object,
timeout: PropTypes.number,
chart: chartPropShape,
};
const StyledHeader = styled.div`
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
span[role='button'] {
display: flex;
height: 100%;
}
.title-panel {
display: flex;
align-items: center;
}
.right-button-panel {
display: flex;
align-items: center;
> .btn-group {
flex: 0 0 auto;
margin-left: ${({ theme }) => theme.gridUnit}px;
}
}
.action-button {
color: ${({ theme }) => theme.colors.grayscale.base};
margin: 0 ${({ theme }) => theme.gridUnit * 1.5}px 0
${({ theme }) => theme.gridUnit}px;
}
`;
const StyledButtons = styled.span`
display: flex;
align-items: center;
`;
export class ExploreChartHeader extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
isPropertiesModalOpen: false,
showingReportModal: false,
};
this.openPropertiesModal = this.openPropertiesModal.bind(this);
this.closePropertiesModal = this.closePropertiesModal.bind(this);
this.showReportModal = this.showReportModal.bind(this);
this.hideReportModal = this.hideReportModal.bind(this);
this.renderReportModal = this.renderReportModal.bind(this);
this.fetchChartDashboardData = this.fetchChartDashboardData.bind(this);
}
componentDidMount() {
const { dashboardId } = this.props;
if (this.canAddReports()) {
const { user, chart } = this.props;
// this is in the case that there is an anonymous user.
this.props.fetchUISpecificReport(
user.userId,
'chart_id',
'charts',
chart.id,
);
}
if (dashboardId) {
this.fetchChartDashboardData();
}
}
async fetchChartDashboardData() {
const { dashboardId, slice } = this.props;
const response = await SupersetClient.get({
endpoint: `/api/v1/chart/${slice.slice_id}`,
});
const chart = response.json.result;
const dashboards = chart.dashboards || [];
const dashboard =
dashboardId &&
dashboards.length &&
dashboards.find(d => d.id === dashboardId);
if (dashboard && dashboard.json_metadata) {
// setting the chart to use the dashboard custom label colors if any
const labelColors =
JSON.parse(dashboard.json_metadata).label_colors || {};
const categoricalNamespace = CategoricalColorNamespace.getNamespace();
Object.keys(labelColors).forEach(label => {
categoricalNamespace.setColor(label, labelColors[label]);
});
}
}
getSliceName() {
const { sliceName, table_name: tableName } = this.props;
const title = sliceName || t('%s - untitled', tableName);
return title;
}
postChartFormData() {
this.props.actions.postChartFormData(
this.props.form_data,
true,
this.props.timeout,
this.props.chart.id,
this.props.ownState,
);
}
openPropertiesModal() {
this.setState({
isPropertiesModalOpen: true,
});
}
closePropertiesModal() {
this.setState({
isPropertiesModalOpen: false,
});
}
showReportModal() {
this.setState({ showingReportModal: true });
}
hideReportModal() {
this.setState({ showingReportModal: false });
}
renderReportModal() {
const attachedReportExists = !!Object.keys(this.props.reports).length;
return attachedReportExists ? (
<HeaderReportActionsDropdown
showReportModal={this.showReportModal}
hideReportModal={this.hideReportModal}
toggleActive={this.props.toggleActive}
deleteActiveReport={this.props.deleteActiveReport}
/>
) : (
<>
<span
role="button"
title={t('Schedule email report')}
tabIndex={0}
className="action-button"
onClick={this.showReportModal}
>
<Icons.Calendar />
</span>
</>
);
}
canAddReports() {
if (!isFeatureEnabled(FeatureFlag.ALERT_REPORTS)) {
return false;
}
const { user } = this.props;
if (!user) {
// this is in the case that there is an anonymous user.
return false;
}
const roles = Object.keys(user.roles || []);
const permissions = roles.map(key =>
user.roles[key].filter(
perms => perms[0] === 'menu_access' && perms[1] === 'Manage',
),
);
return permissions[0].length > 0;
}
render() {
const { user, form_data: formData, slice } = this.props;
const {
chartStatus,
chartUpdateEndTime,
chartUpdateStartTime,
latestQueryFormData,
queriesResponse,
} = this.props.chart;
// TODO: when will get appropriate design for multi queries use all results and not first only
const queryResponse = queriesResponse?.[0];
const chartFinished = ['failed', 'rendered', 'success'].includes(
this.props.chart.chartStatus,
);
return (
<StyledHeader id="slice-header" className="panel-title-large">
<div className="title-panel">
{slice?.certified_by && (
<>
<CertifiedIcon
certifiedBy={slice.certified_by}
details={slice.certification_details}
/>{' '}
</>
)}
<EditableTitle
title={this.getSliceName()}
canEdit={!this.props.slice || this.props.can_overwrite}
onSaveTitle={this.props.actions.updateChartTitle}
/>
{this.props.slice && (
<StyledButtons>
{user.userId && (
<FaveStar
itemId={this.props.slice.slice_id}
fetchFaveStar={this.props.actions.fetchFaveStar}
saveFaveStar={this.props.actions.saveFaveStar}
isStarred={this.props.isStarred}
showTooltip
/>
)}
<PropertiesModal
show={this.state.isPropertiesModalOpen}
onHide={this.closePropertiesModal}
onSave={this.props.sliceUpdated}
slice={this.props.slice}
/>
<Tooltip
id="edit-desc-tooltip"
title={t('Edit chart properties')}
>
<span
role="button"
tabIndex={0}
className="edit-desc-icon"
onClick={this.openPropertiesModal}
>
<i className="fa fa-edit" />
</span>
</Tooltip>
{this.props.chart.sliceFormData && (
<AlteredSliceTag
className="altered"
origFormData={this.props.chart.sliceFormData}
currentFormData={formData}
/>
)}
</StyledButtons>
)}
</div>
<div className="right-button-panel">
{chartFinished && queryResponse && (
<RowCountLabel
rowcount={Number(queryResponse.rowcount) || 0}
limit={Number(formData.row_limit) || 0}
/>
)}
{chartFinished && queryResponse && queryResponse.is_cached && (
<CachedLabel
onClick={this.postChartFormData.bind(this)}
cachedTimestamp={queryResponse.cached_dttm}
/>
)}
<Timer
startTime={chartUpdateStartTime}
endTime={chartUpdateEndTime}
isRunning={chartStatus === 'loading'}
status={CHART_STATUS_MAP[chartStatus]}
/>
{this.canAddReports() && this.renderReportModal()}
<ReportModal
show={this.state.showingReportModal}
onHide={this.hideReportModal}
props={{
userId: this.props.user.userId,
userEmail: this.props.user.email,
chart: this.props.chart,
creationMethod: 'charts',
}}
/>
<ExploreActionButtons
actions={{
...this.props.actions,
openPropertiesModal: this.openPropertiesModal,
}}
slice={this.props.slice}
canDownloadCSV={this.props.can_download}
chartStatus={chartStatus}
latestQueryFormData={latestQueryFormData}
queryResponse={queryResponse}
/>
</div>
</StyledHeader>
);
}
}
ExploreChartHeader.propTypes = propTypes;
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{ sliceUpdated, fetchUISpecificReport, toggleActive, deleteActiveReport },
dispatch,
);
}
export default connect(null, mapDispatchToProps)(ExploreChartHeader);
| 30.745946 | 98 | 0.620781 | false | true | false | true |
d0011ff5c50f8e4a30346178d0638e77a3147cc9 | 4,495 | jsx | JSX | __tests__/components/SEO.spec.jsx | pcooney10/react-seo | 531e9d5580faf5e53ca263a595b9ad5964819a54 | [
"Apache-2.0"
] | null | null | null | __tests__/components/SEO.spec.jsx | pcooney10/react-seo | 531e9d5580faf5e53ca263a595b9ad5964819a54 | [
"Apache-2.0"
] | null | null | null | __tests__/components/SEO.spec.jsx | pcooney10/react-seo | 531e9d5580faf5e53ca263a595b9ad5964819a54 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2020 American Express Travel Related Services Company, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express
* or implied. See the License for the specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import SEO from '../../src';
jest.mock('react-helmet', () => ({ Helmet: 'Helmet' }));
describe('SEO', () => {
it('should render correctly with the minimal tags', () => {
const component = shallow(
<SEO
title="Lorem Ipsum"
siteUrl="https://example.com"
/>
);
expect(component).toMatchSnapshot();
});
it('should provide the canonical URL', () => {
const component = shallow(
<SEO
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
siteUrl="https://example.com"
title="Lorem Ipsum"
canonical="https://example.com/index.html"
/>
);
const helmet = component.find('Helmet');
const { link } = helmet.props();
expect(link).toEqual([{
rel: 'canonical', href: 'https://example.com/index.html',
}]);
});
it('should provide the robots', () => {
const component = shallow(
<SEO
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
robots={['index', 'follow']}
siteUrl="https://example.com"
title="Lorem Ipsum"
canonical="https://example.com/index.html"
/>
);
const helmet = component.find('Helmet');
const { meta } = helmet.props();
const robots = meta.find((tag) => tag.name === 'robots');
expect(robots).toMatchObject({
name: 'robots', content: 'index,follow',
});
});
it('should render image tags correctly', () => {
const component = shallow(
<SEO
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
siteUrl="https://example.com"
title="Lorem Ipsum"
image={{
src: 'http://example.com/ogp.jpg',
type: 'image/jpeg',
width: 500,
height: 300,
alt: 'A shiny red apple with a bite taken out',
}}
/>
);
expect(component).toMatchSnapshot();
});
it('should render video tags correctly', () => {
const component = shallow(
<SEO
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
siteUrl="https://example.com"
title="Lorem Ipsum"
video={{
src: 'http://example.com/movie.swf',
type: 'application/x-shockwave-flash',
width: 500,
height: 300,
alt: 'A shiny red apple with a bite taken out',
}}
/>
);
expect(component).toMatchSnapshot();
});
it('should render Open Graph tags correctly', () => {
const component = shallow(
<SEO
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
siteUrl="https://example.com"
title="Lorem Ipsum"
openGraph={{
title: 'Open Graph Title',
}}
/>
);
expect(component).toMatchSnapshot();
});
it('should render Twitter Card tags correctly', () => {
const component = shallow(
<SEO
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
siteUrl="https://example.com"
title="Lorem Ipsum"
twitterCard={{
title: 'Twitter Card Title',
}}
/>
);
expect(component).toMatchSnapshot();
});
it('should render Helmet props correctly', () => {
const component = shallow(
<SEO
author="John Doe"
description="Lorem ipsum sat delor."
keywords={['foo', 'bar']}
siteUrl="https://example.com"
title="Lorem Ipsum"
canonical="https://example.com/foo/bar"
defaultTitle="Curabitur pretium tincidunt lacus."
defer={false}
encodeSpecialCharacters={true}
onChangeClientState={jest.fn()}
titleTemplate={null}
zipTies={false}
/>
);
expect(component).toMatchSnapshot();
});
});
| 27.919255 | 100 | 0.573749 | false | true | false | true |
d001326025cdb56143af9fd8827c12ac049dbfc3 | 4,746 | jsx | JSX | src/components/MainHeader/NavLinks.jsx | ngwessels/SeatGeek-CLone | cd06c2a522fedc91928cca4692403ace97487aac | [
"MIT"
] | 1 | 2019-06-04T00:34:33.000Z | 2019-06-04T00:34:33.000Z | src/components/MainHeader/NavLinks.jsx | ngwessels/SeatGeek-CLone | cd06c2a522fedc91928cca4692403ace97487aac | [
"MIT"
] | null | null | null | src/components/MainHeader/NavLinks.jsx | ngwessels/SeatGeek-CLone | cd06c2a522fedc91928cca4692403ace97487aac | [
"MIT"
] | null | null | null | import React from 'react';
import NavButton from './NavButton';
function NavLinks() {
var style = {
display: 'flex',
alignItems: 'center',
}
var bump = {
paddingRight: '20px'
}
return (
<div style={style}>
<svg style={bump} preserveAspectRatio="xMidYMid" width="128" height="24" viewBox="0 0 128 24" class="seatgeek-logo__svg">
<path fill="#FFF" fillrule="evenodd" d="M128.000,19.649 L124.626,19.649 L120.335,13.763 L120.336,19.649 L117.450,19.649 L117.450,4.136 L120.334,4.136 L120.335,13.014 L124.531,8.050 L127.894,8.050 L123.306,13.361 L128.000,19.649 ZM111.842,17.457 C113.923,17.457 115.348,16.328 115.348,16.328 L115.348,18.955 C114.481,19.430 113.291,19.904 111.534,19.904 C105.582,19.904 105.279,15.251 105.279,13.852 C105.279,10.696 107.273,7.784 110.807,7.784 C115.936,7.784 115.912,12.338 115.912,13.227 L115.912,14.719 L108.192,14.719 C108.379,16.136 109.524,17.457 111.842,17.457 ZM113.194,12.385 C113.066,11.277 112.481,10.214 110.931,10.214 C109.125,10.214 108.364,11.368 108.197,12.385 L113.194,12.385 ZM99.929,17.457 C102.009,17.457 103.434,16.328 103.434,16.328 L103.434,18.955 C102.567,19.430 101.377,19.904 99.620,19.904 C93.668,19.904 93.365,15.251 93.365,13.852 C93.365,10.696 95.359,7.784 98.894,7.784 C104.022,7.784 103.998,12.338 103.998,13.227 L103.998,14.719 L96.279,14.719 C96.466,16.136 97.610,17.457 99.929,17.457 ZM101.280,12.385 C101.153,11.277 100.568,10.214 99.018,10.214 C97.212,10.214 96.450,11.368 96.284,12.385 L101.280,12.385 ZM87.036,19.902 C82.303,19.902 79.163,17.037 79.163,12.057 C79.163,6.854 82.956,3.917 86.982,3.917 C90.010,3.917 91.456,4.877 91.456,4.877 L91.456,7.823 C90.269,7.091 89.194,6.501 87.035,6.501 C84.026,6.501 82.158,9.071 82.158,12.057 C82.158,14.865 83.799,17.313 86.945,17.313 C88.142,17.313 88.926,17.039 88.926,17.039 L88.926,13.719 L85.813,13.719 L85.813,11.133 L90.407,11.133 C91.185,11.133 91.816,11.768 91.816,12.551 L91.816,18.955 C91.816,18.955 90.300,19.902 87.036,19.902 ZM76.456,17.459 C77.381,17.459 78.463,16.833 78.463,16.833 L78.454,19.339 C78.454,19.339 77.557,19.902 75.707,19.902 C71.750,19.902 71.900,17.025 71.900,15.301 L71.900,5.186 L74.784,5.186 C74.784,5.937 74.784,6.932 74.784,8.024 L78.004,8.024 L78.004,10.469 L74.785,10.469 C74.785,12.937 74.785,15.706 74.785,15.706 C74.785,16.760 75.136,17.459 76.456,17.459 ZM60.968,16.416 C60.968,13.426 63.413,12.612 67.416,12.760 C67.416,11.387 67.330,10.214 65.131,10.214 C63.426,10.214 61.682,11.350 61.682,11.350 L61.682,8.728 C61.682,8.728 63.637,7.772 65.847,7.772 C67.323,7.772 70.275,7.965 70.275,12.113 C70.275,15.917 70.277,19.478 70.277,19.478 C70.277,19.478 67.971,19.902 66.252,19.902 C63.991,19.902 60.968,19.400 60.968,16.416 ZM67.391,14.767 C66.493,14.718 63.861,14.494 63.861,16.186 C63.861,18.180 67.391,17.488 67.391,17.488 L67.391,14.767 ZM55.973,17.457 C58.054,17.457 59.479,16.328 59.479,16.328 L59.479,18.955 C58.612,19.430 57.422,19.904 55.665,19.904 C49.713,19.904 49.410,15.251 49.410,13.852 C49.410,10.696 51.404,7.784 54.939,7.784 C60.067,7.784 60.043,12.338 60.043,13.227 L60.043,14.719 L52.324,14.719 C52.511,16.136 53.655,17.457 55.973,17.457 ZM57.325,12.385 C57.198,11.277 56.613,10.214 55.062,10.214 C53.257,10.214 52.495,11.368 52.329,12.385 L57.325,12.385 ZM44.915,11.012 C45.675,11.331 48.304,12.385 48.304,15.315 C48.304,18.777 45.325,19.902 42.356,19.902 C39.387,19.902 37.491,18.654 37.491,18.654 L37.491,15.688 C37.491,15.688 39.912,17.313 42.356,17.313 C44.800,17.313 45.299,16.437 45.299,15.560 C45.299,14.676 44.849,14.288 44.129,13.904 C43.409,13.520 42.060,13.013 40.569,12.477 C39.079,11.941 37.296,11.026 37.296,8.390 C37.296,5.187 40.075,3.919 42.877,3.919 C45.679,3.919 47.415,4.877 47.415,4.877 L47.415,7.823 C47.415,7.823 45.206,6.501 42.745,6.501 C41.017,6.501 40.361,7.215 40.291,8.103 C40.216,9.057 40.897,9.408 41.507,9.723 C41.929,9.942 44.284,10.747 44.915,11.012 ZM28.872,17.454 L26.133,17.454 L26.133,12.573 C26.133,11.780 26.772,11.137 27.560,11.137 L31.269,11.137 L31.269,13.722 L28.872,13.722 L28.872,17.454 ZM15.635,24.000 C9.429,24.000 5.363,22.277 5.363,22.277 L5.363,19.348 C5.363,19.348 9.358,21.185 15.635,21.185 C21.911,21.185 25.906,19.348 25.906,19.348 L25.906,22.277 C25.906,22.277 21.840,24.000 15.635,24.000 ZM7.931,16.306 L5.363,2.584 C5.363,2.584 9.286,0.000 15.635,0.000 C21.983,0.000 25.906,2.584 25.906,2.584 L23.338,16.306 L7.931,16.306 ZM2.397,13.722 L0.000,13.722 L0.000,11.137 L3.709,11.137 C4.497,11.137 5.136,11.780 5.136,12.573 L5.136,17.454 L2.397,17.454 L2.397,13.722 Z"></path>
</svg>
<NavButton title='Sports'/>
<NavButton title='Music'/>
<NavButton title='More'/>
<NavButton title='Sell'/>
</div>
);
}
export default NavLinks;
| 169.5 | 4,180 | 0.705225 | false | true | false | true |
d00142066cb277fc203dfeae311af88ef3c2ab54 | 9,078 | jsx | JSX | awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx | jwlogemann/awx | 4a8f1d41fa05f25e310f3166449e1a93de4fddb1 | [
"Apache-2.0"
] | 1 | 2020-03-29T13:01:12.000Z | 2020-03-29T13:01:12.000Z | awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx | jwlogemann/awx | 4a8f1d41fa05f25e310f3166449e1a93de4fddb1 | [
"Apache-2.0"
] | 1 | 2019-09-24T21:08:04.000Z | 2019-09-24T21:08:04.000Z | awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx | jbradberry/awx | b8ec94a0ae5356614342820d2e3b67c06bf7bb44 | [
"Apache-2.0"
] | null | null | null | import React, { Component } from 'react';
import { t } from '@lingui/macro';
import { withI18n } from '@lingui/react';
import { Card, CardActions, PageSection } from '@patternfly/react-core';
import { Switch, Route, Redirect, withRouter, Link } from 'react-router-dom';
import { TabbedCardHeader } from '@components/Card';
import AppendBody from '@components/AppendBody';
import CardCloseButton from '@components/CardCloseButton';
import ContentError from '@components/ContentError';
import FullPage from '@components/FullPage';
import JobList from '@components/JobList';
import RoutedTabs from '@components/RoutedTabs';
import { Schedules } from '@components/Schedule';
import ContentLoading from '@components/ContentLoading';
import { ResourceAccessList } from '@components/ResourceAccessList';
import NotificationList from '@components/NotificationList';
import {
WorkflowJobTemplatesAPI,
CredentialsAPI,
OrganizationsAPI,
} from '@api';
import WorkflowJobTemplateDetail from './WorkflowJobTemplateDetail';
import WorkflowJobTemplateEdit from './WorkflowJobTemplateEdit';
import { Visualizer } from './WorkflowJobTemplateVisualizer';
class WorkflowJobTemplate extends Component {
constructor(props) {
super(props);
this.state = {
contentError: null,
hasContentLoading: true,
template: null,
webhook_key: null,
isNotifAdmin: false,
};
this.loadTemplate = this.loadTemplate.bind(this);
this.loadSchedules = this.loadSchedules.bind(this);
this.loadScheduleOptions = this.loadScheduleOptions.bind(this);
}
async componentDidMount() {
await this.loadTemplate();
}
async componentDidUpdate(prevProps) {
const { location } = this.props;
if (location !== prevProps.location) {
await this.loadTemplate();
}
}
async loadTemplate() {
const { setBreadcrumb, match } = this.props;
const { id } = match.params;
this.setState({ contentError: null });
try {
const { data } = await WorkflowJobTemplatesAPI.readDetail(id);
if (data?.related?.webhook_key) {
const {
data: { webhook_key },
} = await WorkflowJobTemplatesAPI.readWebhookKey(id);
this.setState({ webhook_key });
}
if (data?.summary_fields?.webhook_credential) {
const {
data: {
summary_fields: {
credential_type: { name },
},
},
} = await CredentialsAPI.readDetail(
data.summary_fields.webhook_credential.id
);
data.summary_fields.webhook_credential.kind = name;
}
const notifAdminRes = await OrganizationsAPI.read({
page_size: 1,
role_level: 'notification_admin_role',
});
setBreadcrumb(data);
this.setState({
template: data,
isNotifAdmin: notifAdminRes.data.results.length > 0,
});
} catch (err) {
this.setState({ contentError: err });
} finally {
this.setState({ hasContentLoading: false });
}
}
loadScheduleOptions() {
const { template } = this.state;
return WorkflowJobTemplatesAPI.readScheduleOptions(template.id);
}
loadSchedules(params) {
const { template } = this.state;
return WorkflowJobTemplatesAPI.readSchedules(template.id, params);
}
render() {
const { i18n, me, location, match, setBreadcrumb } = this.props;
const {
contentError,
hasContentLoading,
template,
webhook_key,
isNotifAdmin,
} = this.state;
const canSeeNotificationsTab = me.is_system_auditor || isNotifAdmin;
const canToggleNotifications = isNotifAdmin;
const tabsArray = [
{ name: i18n._(t`Details`), link: `${match.url}/details` },
{ name: i18n._(t`Access`), link: `${match.url}/access` },
];
if (canSeeNotificationsTab) {
tabsArray.push({
name: i18n._(t`Notifications`),
link: `${match.url}/notifications`,
});
}
if (template) {
tabsArray.push({
name: i18n._(t`Schedules`),
link: `${match.url}/schedules`,
});
}
tabsArray.push({
name: i18n._(t`Visualizer`),
link: `${match.url}/visualizer`,
});
tabsArray.push({
name: i18n._(t`Completed Jobs`),
link: `${match.url}/completed_jobs`,
});
tabsArray.forEach((tab, n) => {
tab.id = n;
});
if (hasContentLoading) {
return (
<PageSection>
<Card>
<ContentLoading />
</Card>
</PageSection>
);
}
if (contentError) {
return (
<PageSection>
<Card>
<ContentError error={contentError}>
{contentError.response.status === 404 && (
<span>
{i18n._(`Template not found.`)}{' '}
<Link to="/templates">{i18n._(`View all Templates.`)}</Link>
</span>
)}
</ContentError>
</Card>
</PageSection>
);
}
const cardHeader = (
<TabbedCardHeader>
<RoutedTabs tabsArray={tabsArray} />
<CardActions>
<CardCloseButton linkTo="/templates" />
</CardActions>
</TabbedCardHeader>
);
return (
<PageSection>
<Card>
{location.pathname.endsWith('edit') ||
location.pathname.includes('schedules/')
? null
: cardHeader}
<Switch>
<Redirect
from="/templates/workflow_job_template/:id"
to="/templates/workflow_job_template/:id/details"
exact
/>
{template && (
<Route
key="wfjt-details"
path="/templates/workflow_job_template/:id/details"
render={() => (
<WorkflowJobTemplateDetail
template={template}
webhook_key={webhook_key}
/>
)}
/>
)}
{template && (
<Route
path="/templates/workflow_job_template/:id/access"
render={() => (
<ResourceAccessList
resource={template}
apiModel={WorkflowJobTemplatesAPI}
/>
)}
/>
)}
{canSeeNotificationsTab && (
<Route
path="/templates/workflow_job_template/:id/notifications"
render={() => (
<NotificationList
id={Number(match.params.id)}
canToggleNotifications={canToggleNotifications}
apiModel={WorkflowJobTemplatesAPI}
/>
)}
/>
)}
{template && (
<Route
key="wfjt-edit"
path="/templates/workflow_job_template/:id/edit"
render={() => (
<WorkflowJobTemplateEdit
template={template}
webhook_key={webhook_key}
/>
)}
/>
)}
{template && (
<Route
key="wfjt-visualizer"
path="/templates/workflow_job_template/:id/visualizer"
render={() => (
<AppendBody>
<FullPage>
<Visualizer template={template} />
</FullPage>
</AppendBody>
)}
/>
)}
{template?.id && (
<Route path="/templates/workflow_job_template/:id/completed_jobs">
<JobList
defaultParams={{
workflow_job__workflow_job_template: template.id,
}}
/>
</Route>
)}
{template?.id && (
<Route
path="/templates/workflow_job_template/:id/schedules"
render={() => (
<Schedules
setBreadcrumb={setBreadcrumb}
unifiedJobTemplate={template}
loadSchedules={this.loadSchedules}
loadScheduleOptions={this.loadScheduleOptions}
/>
)}
/>
)}
<Route
key="not-found"
path="*"
render={() => (
<ContentError isNotFound>
{match.params.id && (
<Link
to={`/templates/workflow_job_template/${match.params.id}/details`}
>
{i18n._(`View Template Details`)}
</Link>
)}
</ContentError>
)}
/>
</Switch>
</Card>
</PageSection>
);
}
}
export { WorkflowJobTemplate as _WorkflowJobTemplate };
export default withI18n()(withRouter(WorkflowJobTemplate));
| 29.861842 | 88 | 0.523023 | false | true | true | false |
d001433ce3ac511b8eea06d4c703f44eddc4f30b | 2,212 | jsx | JSX | person/src/container/bossinfo/bossinfo.jsx | zhangshuaidan/-App | 593c62acd15fc8fd00e5ffbd7c33b4207862e7f9 | [
"MIT"
] | null | null | null | person/src/container/bossinfo/bossinfo.jsx | zhangshuaidan/-App | 593c62acd15fc8fd00e5ffbd7c33b4207862e7f9 | [
"MIT"
] | 6 | 2020-09-04T23:20:47.000Z | 2021-03-09T10:28:12.000Z | person/src/container/bossinfo/bossinfo.jsx | zhangshuaidan/-App | 593c62acd15fc8fd00e5ffbd7c33b4207862e7f9 | [
"MIT"
] | null | null | null | import React from "react";
import { NavBar, InputItem, TextareaItem, Button } from 'antd-mobile';
import { Redirect } from 'react-router-dom'
import AvatarSelector from '../../component/avatar-selector/avatar-selector'
import {connect} from 'react-redux'
import { update} from '../../redux/user.redux'
@connect(
state=>state.user,
{update}
)
class BossInfo extends React.Component{
constructor(props){
super(props)
this.state={
title:"",
desc:"",
company:"",
money:''
}
}
onChange(key,val){
this.setState({
[key]:val
})
}
render(){
const path =this.props.location.pathname
const redirect = this.props.redirectTo
return(
<div>
{redirect && redirect!==path? <Redirect to={this.props.redirectTo} /> : null}
{/* {this.props.redirectTo ? <Redirect to={this.props.redirectTto}> </Redirect>:null} */}
<NavBar mode="dark">BOSS完善信息页面</NavBar>
<AvatarSelector
selectAvatar={(imgname)=>{
this.setState({
avatar:imgname
})
}}
// selectAvatar={5}
></AvatarSelector>
<InputItem onChange={(v)=>this.onChange('title',v)}>
招聘职位
</InputItem>
<InputItem onChange={(v) => this.onChange('company', v)}>
公司名称
</InputItem>
<InputItem onChange={(v) => this.onChange('money', v)}>
职位薪资
</InputItem>
<TextareaItem
rows={3}
autoHeight
title="职位要求"
onChange={(v) => this.onChange('desc', v)}>
</TextareaItem>
<Button type="primary"
onClick={()=>{
this.props.update(this.state)
}}
>保存</Button>
</div>
)
}
}
export default BossInfo | 32.529412 | 106 | 0.445298 | false | true | true | false |
d0014fdc6f667864c0b15a9aecf62036b0633a5f | 2,067 | jsx | JSX | app/components/explorer/treefolderexplorer/folderCreateItem.jsx | learning-layers/LivingDocumentsClient | ff4ae0502957b1fafb07ecf0098ba5c108aaedd0 | [
"Apache-2.0"
] | null | null | null | app/components/explorer/treefolderexplorer/folderCreateItem.jsx | learning-layers/LivingDocumentsClient | ff4ae0502957b1fafb07ecf0098ba5c108aaedd0 | [
"Apache-2.0"
] | null | null | null | app/components/explorer/treefolderexplorer/folderCreateItem.jsx | learning-layers/LivingDocumentsClient | ff4ae0502957b1fafb07ecf0098ba5c108aaedd0 | [
"Apache-2.0"
] | null | null | null | "use strict";
import React from "react";
import jQuery from "jquery";
import FolderActions from "../../../reflux/folder/folderActions";
let Input = require("react-bootstrap").Input;
let FolderCreateItem = React.createClass({
getInitialState() {
return {
createFolderName: ""
};
},
reset() {
this.setState({
createFolderName: ""
});
},
componentDidMount: function() {
jQuery(document.body).on("keydown", this.handleKeyDown);
},
componentWillUnmount: function() {
jQuery(document.body).off("keydown", this.handleKeyDown);
},
changeCreateFolder(event) {
this.state.createFolderName = event.target.value;
this.setState({});
},
submit() {
let value = React.findDOMNode(this.refs.folderNameInput).childNodes[0].value;
console.info("current value=" + value);
// https://api.learnenv.com:9000/api/folders
//{name: "Test2"}
let newFolder = {name: value};
jQuery.post(
global.config.endpoint +
"/api/folders",
JSON.stringify(newFolder)
).then((data) => {
console.log(data);
FolderActions.newFolderCreated(data);
});
},
handleKeyDown: function(e) {
var ENTER = 13;
if( e.keyCode === ENTER ) {
this.submit();
}
},
render: function() {
let folderIcon = <span className="glyphicon glyphicon-folder-close"></span>;
let btnClasses = "btn-default";
return (
<li className="folder-item">
<button className={"btn btn-fab btn-fab-mini btn-raised btn-sm " + btnClasses}>
{folderIcon}
<div className="ripple-wrapper"></div>
</button>
<Input ref="folderNameInput" type="text" placeholder={this.props.folder} value={this.state.createFolderName} onChange={this.changeCreateFolder} />
</li>
);
}
});
export default FolderCreateItem; | 30.850746 | 162 | 0.562651 | false | true | false | true |
d0017763eae4b8df6209a88626e4d96ff3f7e144 | 5,605 | jsx | JSX | src/views/SignIn/index.jsx | sheunglaili/react-dashboard-template-with-firebase-login | e85f58c215374e284d792156053a4e7f5837ba23 | [
"MIT"
] | 8 | 2020-07-09T15:33:21.000Z | 2022-01-15T07:16:47.000Z | src/views/SignIn/index.jsx | sheunglaili/react-dashboard-template-with-firebase-login | e85f58c215374e284d792156053a4e7f5837ba23 | [
"MIT"
] | 2 | 2020-09-01T08:13:43.000Z | 2022-02-10T18:04:17.000Z | src/views/SignIn/index.jsx | sheunglaili/react-dashboard-template-with-firebase-login | e85f58c215374e284d792156053a4e7f5837ba23 | [
"MIT"
] | 8 | 2020-06-26T20:41:28.000Z | 2022-03-14T23:43:37.000Z | import React, { Component } from 'react';
import { Link, withRouter } from 'react-router-dom';
// Externals
import PropTypes from 'prop-types';
import compose from 'recompose/compose';
import validate from 'validate.js';
import _ from 'underscore';
// Material helpers
import { withStyles } from '@material-ui/core/styles/index';
// Material components
import Grid from '@material-ui/core/Grid/index';
import Button from '@material-ui/core/Button/index';
import CircularProgress from '@material-ui/core/CircularProgress/index';
import IconButton from '@material-ui/core/IconButton/index';
import TextField from '@material-ui/core/TextField/index';
import Typography from '@material-ui/core/Typography/index';
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
// Shared components
import FacebookIcon from 'icons/Facebook';
import GoogleIcon from 'icons/Google';
// Component styles
import styles from './styles';
// Form validation schema
import schema from './schema';
import * as firebase from 'firebase/app'
import { connect } from 'react-redux';
import { auth } from '../../redux/modules/auth/action'
// Service methods
const signIn = () => {
return new Promise(resolve => {
setTimeout(() => {
resolve(true);
}, 1500);
});
};
class SignIn extends Component {
state = {
values: {
email: '',
password: ''
},
touched: {
email: false,
password: false
},
errors: {
email: null,
password: null
},
isValid: false,
isLoading: false,
submitError: null
};
componentWillMount() {
firebase.auth().useDeviceLanguage();
}
handleBack = () => {
const { history } = this.props;
history.goBack();
};
validateForm = _.debounce(() => {
const { values } = this.state;
const newState = { ...this.state };
const errors = validate(values, schema);
newState.errors = errors || {};
newState.isValid = errors ? false : true;
this.setState(newState);
}, 300);
handleFieldChange = (field, value) => {
const newState = { ...this.state };
newState.submitError = null;
newState.touched[field] = true;
newState.values[field] = value;
this.setState(newState, this.validateForm);
};
handleSignIn = async () => {
const provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('https://www.googleapis.com/auth/documents');
provider.addScope('https://www.googleapis.com/auth/drive');
this.props.dispatch(auth(provider));
};
render() {
const { classes } = this.props;
const {
values,
touched,
errors,
isValid,
submitError,
isLoading
} = this.state;
const showEmailError = touched.email && errors.email;
const showPasswordError = touched.password && errors.password;
return (
<div className={classes.root}>
<Grid
className={classes.grid}
container
>
<Grid
className={classes.quoteWrapper}
item
lg={5}
>
<div className={classes.quote}>
<div className={classes.quoteInner}>
<Typography
className={classes.quoteText}
variant="h1"
>
Hella narwhal Cosby sweater McSweeney's, salvia kitsch before
they sold out High Life.
</Typography>
<div className={classes.person}>
<Typography
className={classes.name}
variant="body1"
>
Takamaru Ayako
</Typography>
<Typography
className={classes.bio}
variant="body2"
>
Manager at inVision
</Typography>
</div>
</div>
</div>
</Grid>
<Grid
className={classes.content}
item
lg={7}
xs={12}
>
<div className={classes.content}>
<div className={classes.contentHeader}>
<IconButton
className={classes.backButton}
onClick={this.handleBack}
>
<ArrowBackIcon />
</IconButton>
</div>
<div className={classes.contentBody}>
<form className={classes.form}>
<Typography
className={classes.title}
variant="h2"
>
Sign in
</Typography>
<Typography
className={classes.subtitle}
variant="body1"
>
Sign in with Google
</Typography>
<Button
className={classes.googleButton}
onClick={this.handleSignIn}
size="large"
variant="contained"
>
<GoogleIcon className={classes.googleIcon} />
Login with Google
</Button>
</form>
</div>
</div>
</Grid>
</Grid>
</div>
);
}
}
SignIn.propTypes = {
className: PropTypes.string,
classes: PropTypes.object.isRequired,
history: PropTypes.object.isRequired
};
export default compose(
withRouter,
withStyles(styles)
)(connect()(SignIn));
| 25.593607 | 79 | 0.532917 | false | true | true | false |
d0017e2ada3924d5b659224eb64f7cf1e7451d3a | 1,632 | jsx | JSX | templates/demo-store/src/components/ProductOptions.client.jsx | Shopify/hydrogen | effc509cbfc9ddf4bf8df9f8dff17daa47362dbb | [
"MIT"
] | 2,156 | 2021-11-06T02:52:37.000Z | 2022-03-31T23:54:13.000Z | templates/demo-store/src/components/ProductOptions.client.jsx | Shopify/hydrogen | effc509cbfc9ddf4bf8df9f8dff17daa47362dbb | [
"MIT"
] | 492 | 2021-11-07T06:38:58.000Z | 2022-03-31T16:20:43.000Z | templates/demo-store/src/components/ProductOptions.client.jsx | Shopify/hydrogen | effc509cbfc9ddf4bf8df9f8dff17daa47362dbb | [
"MIT"
] | 129 | 2021-11-07T09:54:08.000Z | 2022-03-30T06:10:18.000Z | import {useProductOptions} from '@shopify/hydrogen';
/**
* A client component that tracks a selected variant and/or selling plan state, as well as callbacks for modifying the state
*/
export default function ProductOptions() {
const {options, setSelectedOption, selectedOptions} = useProductOptions();
return (
<>
{options.map(({name, values}) => {
return (
<fieldset key={name} className="mt-8">
<legend className="mb-4 text-xl font-medium text-gray-900">
{name}
</legend>
<div className="flex items-center flex-wrap gap-4">
{values.map((value) => {
const checked = selectedOptions[name] === value;
const id = `option-${name}-${value}`;
return (
<label key={id} htmlFor={id}>
<input
className="sr-only"
type="radio"
id={id}
name={`option[${name}]`}
value={value}
checked={checked}
onChange={() => setSelectedOption(name, value)}
/>
<div
className={`p-2 border cursor-pointer rounded text-sm md:text-md ${
checked ? 'bg-gray-900 text-white' : 'text-gray-900'
}`}
>
{value}
</div>
</label>
);
})}
</div>
</fieldset>
);
})}
</>
);
}
| 32.64 | 124 | 0.433211 | false | true | false | true |
d00186671d0c1d2ca712dd5600b1ff6fc53d0549 | 2,920 | jsx | JSX | superset-frontend/spec/javascripts/views/CRUD/csstemplates/CssTemplateModal_spec.jsx | vinaybabunaidu/incubator-superset | 6c6ded139b80fd2799eb028f1421137c86096170 | [
"Apache-2.0"
] | 3 | 2021-02-19T01:43:50.000Z | 2021-08-14T04:56:41.000Z | superset-frontend/spec/javascripts/views/CRUD/csstemplates/CssTemplateModal_spec.jsx | vinaybabunaidu/incubator-superset | 6c6ded139b80fd2799eb028f1421137c86096170 | [
"Apache-2.0"
] | 39 | 2019-07-28T09:49:37.000Z | 2022-03-31T09:37:13.000Z | superset-frontend/spec/javascripts/views/CRUD/csstemplates/CssTemplateModal_spec.jsx | vinaybabunaidu/incubator-superset | 6c6ded139b80fd2799eb028f1421137c86096170 | [
"Apache-2.0"
] | 1 | 2020-12-07T12:24:49.000Z | 2020-12-07T12:24:49.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 thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import fetchMock from 'fetch-mock';
import CssTemplateModal from 'src/views/CRUD/csstemplates/CssTemplateModal';
import Modal from 'src/common/components/Modal';
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import { CssEditor } from 'src/components/AsyncAceEditor';
import { styledMount as mount } from 'spec/helpers/theming';
const mockData = { id: 1, template_name: 'test' };
const FETCH_CSS_TEMPLATE_ENDPOINT = 'glob:*/api/v1/css_template/*';
const CSS_TEMPLATE_PAYLOAD = { result: mockData };
fetchMock.get(FETCH_CSS_TEMPLATE_ENDPOINT, CSS_TEMPLATE_PAYLOAD);
const mockStore = configureStore([thunk]);
const store = mockStore({});
const mockedProps = {
addDangerToast: () => {},
onCssTemplateAdd: jest.fn(() => []),
onHide: () => {},
show: true,
cssTemplate: mockData,
};
async function mountAndWait(props = mockedProps) {
const mounted = mount(<CssTemplateModal show {...props} />, {
context: { store },
});
await waitForComponentToPaint(mounted);
return mounted;
}
describe('CssTemplateModal', () => {
let wrapper;
beforeAll(async () => {
wrapper = await mountAndWait();
});
it('renders', () => {
expect(wrapper.find(CssTemplateModal)).toExist();
});
it('renders a Modal', () => {
expect(wrapper.find(Modal)).toExist();
});
it('renders add header when no css template is included', async () => {
const addWrapper = await mountAndWait({});
expect(
addWrapper.find('[data-test="css-template-modal-title"]').text(),
).toEqual('Add CSS Template');
});
it('renders edit header when css template prop is included', () => {
expect(
wrapper.find('[data-test="css-template-modal-title"]').text(),
).toEqual('Edit CSS Template Properties');
});
it('renders input elements for template name', () => {
expect(wrapper.find('input[name="template_name"]')).toExist();
});
it('renders css editor for css', () => {
expect(wrapper.find(CssEditor)).toExist();
});
});
| 32.087912 | 76 | 0.697603 | false | true | false | true |
d0018f95982f4531527f472a879908b888c9966d | 1,200 | jsx | JSX | front/www/src/pages/ProfilePage.jsx | MattCo23/Project-Flanders | e9aef2ad5a5ea88644a7cab06b27fe95237d7b29 | [
"MIT",
"Unlicense"
] | 4 | 2020-11-26T03:25:12.000Z | 2021-08-29T19:49:27.000Z | front/www/src/pages/ProfilePage.jsx | MattCo23/Project-Flanders | e9aef2ad5a5ea88644a7cab06b27fe95237d7b29 | [
"MIT",
"Unlicense"
] | 12 | 2020-11-26T11:55:48.000Z | 2021-03-06T22:11:08.000Z | front/www/src/pages/ProfilePage.jsx | MattCo23/Project-Flanders | e9aef2ad5a5ea88644a7cab06b27fe95237d7b29 | [
"MIT",
"Unlicense"
] | null | null | null | import React from 'react';
import { Profile } from '../components/Profile/Profile';
import { ProfileData } from '../components/Profile/Subsections/ProfileData';
import { ProfilePass } from '../components/Profile/Subsections/ProfilePass';
import { ProfileContainer } from '../components/Profile/Subsections/ProfileContainer';
import { ProfileBookings } from '../components/Profile/Subsections/ProfileBookings';
export const ProfilePage = (props) => {
const { profile_data, profile_pass, profile_bookings, dispatch } = props;
return (
<>
{!(profile_data || profile_pass || profile_bookings) && <Profile {...props} />}
{profile_data && (
<ProfileContainer props={[{ profile_data: profile_data }, dispatch]}>
{<ProfileData {...props} />}
</ProfileContainer>
)}
{profile_pass && (
<ProfileContainer props={[{ profile_pass: profile_pass }, dispatch]}>
{<ProfilePass {...props} />}
</ProfileContainer>
)}
{profile_bookings && (
<ProfileContainer props={[{ profile_bookings: profile_bookings }, dispatch]}>
{<ProfileBookings {...props} />}
</ProfileContainer>
)}
</>
);
};
| 36.363636 | 86 | 0.640833 | false | true | false | true |
d00190949571005d82bd3ab924ba05559465d265 | 622 | jsx | JSX | packages/terra-notification-dialog/tests/jest/_ContentLayoutAsList.test.jsx | kschuste/terra-framework | c1e8afc2d38a2ef6505541ca8218b23fd37fc650 | [
"Apache-2.0"
] | 65 | 2017-11-16T20:32:58.000Z | 2021-06-01T16:46:48.000Z | packages/terra-notification-dialog/tests/jest/_ContentLayoutAsList.test.jsx | kschuste/terra-framework | c1e8afc2d38a2ef6505541ca8218b23fd37fc650 | [
"Apache-2.0"
] | 987 | 2017-10-23T19:46:57.000Z | 2022-03-29T14:41:37.000Z | packages/terra-notification-dialog/tests/jest/_ContentLayoutAsList.test.jsx | kschuste/terra-framework | c1e8afc2d38a2ef6505541ca8218b23fd37fc650 | [
"Apache-2.0"
] | 64 | 2018-01-30T16:08:46.000Z | 2022-03-02T15:43:45.000Z | import React from 'react';
/* eslint-disable import/no-extraneous-dependencies */
import { shallowWithIntl } from 'terra-enzyme-intl';
import ContentLayoutAsList from '../../src/_ContentLayoutAsList';
describe('Content Layout As List', () => {
it('shallow renders layout with no items', () => {
const list = shallowWithIntl(
<ContentLayoutAsList items={[]} />,
);
expect(list).toMatchSnapshot();
});
it('shallow renders layout with items', () => {
const list = shallowWithIntl(
<ContentLayoutAsList items={['item 1', 'item2']} />,
);
expect(list).toMatchSnapshot();
});
});
| 27.043478 | 65 | 0.646302 | false | true | false | true |
d001a72997b282e7c0640dafafe20792bcdeafbd | 320 | jsx | JSX | components/Image/index.jsx | tyrro/react-survey | 2615f2c7bf9c6df486a13d1a8fcd8c6b227a454d | [
"MIT"
] | 6 | 2022-03-07T07:30:19.000Z | 2022-03-16T10:38:14.000Z | components/Image/index.jsx | tyrro/react-survey | 2615f2c7bf9c6df486a13d1a8fcd8c6b227a454d | [
"MIT"
] | 46 | 2022-03-11T09:43:01.000Z | 2022-03-30T02:14:04.000Z | components/Image/index.jsx | tyrro/react-survey | 2615f2c7bf9c6df486a13d1a8fcd8c6b227a454d | [
"MIT"
] | null | null | null | import NextImage from 'next/image';
import PropTypes from 'prop-types';
const Image = ({ src, alt, ...attributes }) => <NextImage src={src} alt={alt} {...attributes} />;
Image.propTypes = {
src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
alt: PropTypes.string.isRequired,
};
export default Image;
| 26.666667 | 97 | 0.7 | false | true | false | true |
d001b174b3ddf9cbd7ae149ab1fda61595b76411 | 2,320 | jsx | JSX | src/Components/JsonConfigComponent/ConfigCheckbox.jsx | ioBroker/adapter-react-v5 | 927b438392fe5b955a0cbe7b14f6509debdaec87 | [
"MIT"
] | 1 | 2022-03-30T08:11:30.000Z | 2022-03-30T08:11:30.000Z | src/Components/JsonConfigComponent/ConfigCheckbox.jsx | ioBroker/adapter-react-v5 | 927b438392fe5b955a0cbe7b14f6509debdaec87 | [
"MIT"
] | null | null | null | src/Components/JsonConfigComponent/ConfigCheckbox.jsx | ioBroker/adapter-react-v5 | 927b438392fe5b955a0cbe7b14f6509debdaec87 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@mui/styles';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import FormHelperText from '@mui/material/FormHelperText';
import FormControl from '@mui/material/FormControl';
import ConfigGeneric from './ConfigGeneric';
import I18n from '../../i18n';
const styles = theme => ({
error: {
color: 'red'
}
});
class ConfigCheckbox extends ConfigGeneric {
renderItem(error, disabled) {
const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
let isIndeterminate = Array.isArray(value);
return <FormControl className={this.props.classes.fullWidth} variant="standard">
<FormControlLabel
onClick={e => {
e.preventDefault();
e.stopPropagation();
this.onChange(this.props.attr, !value);
}}
control={<Checkbox
indeterminate={isIndeterminate}
checked={!!value}
onChange={e => {
if (isIndeterminate) {
this.onChange(this.props.attr, true);
} else {
this.onChange(this.props.attr, e.target.checked);
}
}}
disabled={!!disabled}
/>}
label={this.getText(this.props.schema.label)}
/>
<FormHelperText className={this.props.classes.error}>{
error ? (this.props.schema.validatorErrorText ? I18n.t(this.props.schema.validatorErrorText) : I18n.t('ra_Error')) :
null}</FormHelperText>
{this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}
</FormControl>
}
}
ConfigCheckbox.propTypes = {
socket: PropTypes.object.isRequired,
themeType: PropTypes.string,
themeName: PropTypes.string,
style: PropTypes.object,
className: PropTypes.string,
data: PropTypes.object.isRequired,
schema: PropTypes.object,
onError: PropTypes.func,
onChange: PropTypes.func,
};
export default withStyles(styles)(ConfigCheckbox); | 35.692308 | 177 | 0.615948 | false | true | false | true |
d001bd29a68c86b46cbb299cb25cb8be5aafb8c0 | 2,487 | jsx | JSX | src/components/result/DidResult.jsx | sighttviewliu/universal-resolver-frontend | 771450453eff8d1d2270af1d284b06f9f8ba1a31 | [
"Apache-2.0"
] | 2 | 2018-12-05T12:45:48.000Z | 2019-06-27T12:08:08.000Z | src/components/result/DidResult.jsx | sighttviewliu/universal-resolver-frontend | 771450453eff8d1d2270af1d284b06f9f8ba1a31 | [
"Apache-2.0"
] | null | null | null | src/components/result/DidResult.jsx | sighttviewliu/universal-resolver-frontend | 771450453eff8d1d2270af1d284b06f9f8ba1a31 | [
"Apache-2.0"
] | null | null | null | import React, { Component } from 'react';
import { Card, Divider } from 'semantic-ui-react'
import DidReference from './DidReference';
import Service from './Service';
import PublicKey from './PublicKey';
export class DidResult extends Component {
render() {
var didDocumentServices;
if (Array.isArray(this.props.didDocument.service)) didDocumentServices = this.props.didDocument.service;
else if (typeof this.props.didDocument.service === 'object') didDocumentServices = Array.of(this.props.didDocument.service);
else didDocumentServices = Array.of();
const services = didDocumentServices.map((didDocumentService, i) =>
<Service key={i} name={didDocumentService.name} type={didDocumentService.type} serviceEndpoint={didDocumentService.serviceEndpoint} selected={this.props.resolverMetadata.selectedServices ? this.props.resolverMetadata.selectedServices.includes(i) : null} />
);
var didDocumentPublicKeys;
if (Array.isArray(this.props.didDocument.publicKey)) didDocumentPublicKeys = this.props.didDocument.publicKey;
else if (typeof this.props.didDocument.publicKey === 'object') didDocumentPublicKeys = Array.of(this.props.didDocument.publicKey);
else if (typeof this.props.didDocument.authentication === 'object' && Array.isArray(this.props.didDocument.authentication.publicKey)) didDocumentPublicKeys = this.props.didDocument.authentication.publicKey;
else if (typeof this.props.didDocument.authentication === 'object' && typeof this.props.didDocument.authentication.publicKey === 'object') didDocumentPublicKeys = Array.of(this.props.didDocument.authentication.publicKey);
else didDocumentPublicKeys = Array.of();
const publicKeys = didDocumentPublicKeys.map((didDocumentPublicKey, i) =>
<PublicKey key={i} type={didDocumentPublicKey.type} publicKeyBase64={didDocumentPublicKey.publicKeyBase64} publicKeyBase58={didDocumentPublicKey.publicKeyBase58} publicKeyPem={didDocumentPublicKey.publicKeyPem} publicKeyHex={didDocumentPublicKey.publicKeyHex} ethereumAddress={didDocumentPublicKey.ethereumAddress} address={didDocumentPublicKey.address} />
);
return (
<div className='did-result'>
<DidReference didReference={this.props.didReference} />
<Divider />
<Card.Group>
{services}
</Card.Group>
<Divider />
<Card.Group>
{publicKeys}
</Card.Group>
</div>
);
}
}
export default DidResult;
| 55.266667 | 359 | 0.739043 | true | false | true | false |
d001bf4483d72b928bbd27aebc004c0b1b1cbf09 | 883 | jsx | JSX | app/components/ProductsTable.jsx | char-lie/react-products-list | f53b3866caa51c445368d1010152153aa7d50363 | [
"MIT"
] | null | null | null | app/components/ProductsTable.jsx | char-lie/react-products-list | f53b3866caa51c445368d1010152153aa7d50363 | [
"MIT"
] | null | null | null | app/components/ProductsTable.jsx | char-lie/react-products-list | f53b3866caa51c445368d1010152153aa7d50363 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import { Table, TableHead, TableRow, TableCell } from 'react-toolbox/lib/table';
import ProductModel from '../models/Product';
const ProductsTable = props => (
<Table selectable={false}>
<TableHead>
<TableCell>
Name
</TableCell>
<TableCell>
Color
</TableCell>
</TableHead>
{props.products.map(product => (
<TableRow>
<TableCell>
{product.name}
</TableCell>
<TableCell>
{product.color.toLowerCase()}
</TableCell>
</TableRow>
))}
</Table>
);
ProductsTable.propTypes = Object.freeze({
products: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
color: PropTypes.oneOf(ProductModel.AVAILABLE_COLORS).isRequired,
})).isRequired,
});
export default ProductsTable;
| 22.641026 | 80 | 0.631937 | false | true | false | true |
d001d36562f6f81b5127e9fb217d871c686eb665 | 297 | jsx | JSX | src/Footer.jsx | gallantry007/my-new-react-pr | 93b62968498bba3baeba8bca14781ef0694538c5 | [
"MIT"
] | null | null | null | src/Footer.jsx | gallantry007/my-new-react-pr | 93b62968498bba3baeba8bca14781ef0694538c5 | [
"MIT"
] | null | null | null | src/Footer.jsx | gallantry007/my-new-react-pr | 93b62968498bba3baeba8bca14781ef0694538c5 | [
"MIT"
] | null | null | null | import React from "react";
const Footer=()=>{
return(
<>
<footer className="bg-light text-center">
<p>
2022 Gallantry .All Right Reserved / Terms and Conditions Apply
</p>
</footer>
</>
)
}
export default Footer; | 16.5 | 79 | 0.498316 | false | true | false | true |
d001dddb2db90a72b356e977eda0d0e408792a7c | 2,824 | jsx | JSX | src/views/Login/index.jsx | KirillYoYo/Banks | 1c133f30cb54f05863fed5aaa195e1edebc69e33 | [
"MIT"
] | null | null | null | src/views/Login/index.jsx | KirillYoYo/Banks | 1c133f30cb54f05863fed5aaa195e1edebc69e33 | [
"MIT"
] | null | null | null | src/views/Login/index.jsx | KirillYoYo/Banks | 1c133f30cb54f05863fed5aaa195e1edebc69e33 | [
"MIT"
] | null | null | null | import React from 'react'
import PropTypes from 'prop-types'
import {Form, Input, Button, Row, Col, Icon, message} from 'antd'
import {bindActionCreators} from 'redux'
import {connect} from 'react-redux'
import {withRouter} from 'react-router-dom';
import {login} from '../../actions/auth'
const FormItem = Form.Item
import './index.sass'
const propTypes = {
user: PropTypes.object,
loggingIn: PropTypes.bool,
loginErrors: PropTypes.string
};
class Login extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: false
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.user !== this.props.user) {
if (nextProps.user) {
localStorage.setItem('uid', nextProps.user.uid);
this.props.history.replace('/main');
}
}
}
componentWillMount () {
if (localStorage.getItem('uid')) {
this.props.history.replace('/main');
}
}
shouldComponentUpdate () {
return !localStorage.getItem('uid')
}
handleSubmit(e) {
e.preventDefault();
this.setState({
loading: true
});
const data = this.props.form.getFieldsValue()
this.props.login(data.user, data.password)
this.setState({
loading: false
});
}
toRegister() {
this.props.history.replace('/register');
}
render() {
const {getFieldDecorator} = this.props.form
return (
<Row className="login-row" type="flex" justify="space-around" align="middle">
<Col span="8">
<Form layout="horizontal" onSubmit={this.handleSubmit.bind(this)} className="login-form">
<h2 className="logo"><span>logo</span></h2>
<FormItem>
{getFieldDecorator('user')(
<Input prefix={<Icon type="user" style={{fontSize: 13}}/>} placeholder='admin'/>
)}
</FormItem>
<FormItem>
{getFieldDecorator('password')(
<Input prefix={<Icon type="lock" style={{fontSize: 13}}/>} type='password'
placeholder='123456'/>
)}
</FormItem>
<p>
<Button className="btn-login" type='primary' size="large" icon="poweroff"
loading={this.state.loading} htmlType='submit'>Log</Button>
</p>
<p>
<Button className="btn-register" size="large" icon="right-square-o" htmlType='button'
onClick={this.toRegister.bind(this)}>Registration</Button>
</p>
</Form>
</Col>
</Row>
)
}
}
Login.propTypes = propTypes;
Login = Form.create()(Login);
function mapStateToProps(state) {
const {auth} = state;
if (auth.user) {
return {user: auth.user, loggingIn: auth.loggingIn, loginErrors: ''};
}
return {user: null, loggingIn: auth.loggingIn, loginErrors: auth.loginErrors};
}
function mapDispatchToProps(dispatch) {
return {
login: bindActionCreators(login, dispatch)
}
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Login))
| 24.136752 | 94 | 0.652975 | true | false | true | false |
d001f1ae731005741a7845a49216f8622320f157 | 1,927 | jsx | JSX | src/components/MediaComponents/MediaItem.jsx | PlayXman/reactapp-showcase | 269205e46f810074004694ea1b287bf47a470234 | [
"MIT"
] | null | null | null | src/components/MediaComponents/MediaItem.jsx | PlayXman/reactapp-showcase | 269205e46f810074004694ea1b287bf47a470234 | [
"MIT"
] | 34 | 2018-06-17T20:49:19.000Z | 2021-12-24T05:54:24.000Z | src/components/MediaComponents/MediaItem.jsx | PlayXman/app-msa | 269205e46f810074004694ea1b287bf47a470234 | [
"MIT"
] | null | null | null | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import withStyles from '@material-ui/core/styles/withStyles';
import Grid from '@material-ui/core/Grid/Grid';
import OwnageBtn from '../Item/actions/OwnageBtn';
import Labels from '../Item/labels/Labels';
import SubMenu from '../Item/submenu/SubMenu';
import Item from '../Item/Item';
const style = {
cont: {
width: 158,
},
};
/**
* Main item component.
*/
class MediaItem extends PureComponent {
state = {
openSubmenu: false,
};
handleSubmenuOpen = () => {
this.setState({
openSubmenu: true,
});
};
handleSubmenuClose = () => {
this.setState({
openSubmenu: false,
});
};
render() {
const {
id,
itemId,
title,
releaseDate,
imageUrl,
isReleased,
ownageStatus,
labels,
children,
classes,
} = this.props;
const { openSubmenu } = this.state;
return (
<Grid item className={classes.cont} id={id}>
<Item
title={title}
releaseDate={releaseDate}
imageUrl={imageUrl}
isReleased={isReleased}
onClick={this.handleSubmenuOpen}
highlight={openSubmenu}
>
<OwnageBtn
released={isReleased}
ownageStatus={ownageStatus}
itemKey={itemId}
/>
<Labels labels={labels} />
</Item>
<SubMenu
open={openSubmenu}
onClose={this.handleSubmenuClose}
itemID={itemId}
itemTitle={title}
labels={labels}
>
{children}
</SubMenu>
</Grid>
);
}
}
MediaItem.propTypes = {
id: PropTypes.string,
itemId: PropTypes.string.isRequired,
title: PropTypes.string,
imageUrl: PropTypes.string,
releaseDate: PropTypes.string,
isReleased: PropTypes.bool,
ownageStatus: PropTypes.oneOf(['DEFAULT', 'DOWNLOADABLE', 'OWNED']),
labels: PropTypes.array,
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
};
export default withStyles(style)(MediaItem);
| 20.284211 | 90 | 0.659056 | true | false | false | true |
d0020ce0723ee2e863d0ac191f58d872cba2a660 | 364 | jsx | JSX | src/components/Header.jsx | Quarzizus/curso-redux | 565c687da145d41de8083a2a1502818e3cacde7b | [
"MIT"
] | 1 | 2021-06-24T14:51:56.000Z | 2021-06-24T14:51:56.000Z | src/components/Header.jsx | Quarzizus/curso-redux | 565c687da145d41de8083a2a1502818e3cacde7b | [
"MIT"
] | null | null | null | src/components/Header.jsx | Quarzizus/curso-redux | 565c687da145d41de8083a2a1502818e3cacde7b | [
"MIT"
] | null | null | null | import React from "react";
import { Link } from "react-router-dom";
import "./styles/Header.scss";
const Header = () => {
return (
<header className="Header">
<Link to="/" className="Link">
<h2>Home</h2>
</Link>
<Link to="/users" className="Link">
<h2>Users</h2>
</Link>
</header>
);
};
export default Header;
| 19.157895 | 41 | 0.552198 | false | true | false | true |
d0020ed08e3a5ac6a483cdac5c8d0081df789a03 | 1,301 | jsx | JSX | app/components/pages/HCHelpPage.jsx | Connoropolous/HC-Admin | eff4385ef9ed2e62be4ca57b64164a4c01158747 | [
"MIT"
] | 3 | 2019-02-11T17:51:53.000Z | 2019-07-05T09:21:11.000Z | app/components/pages/HCHelpPage.jsx | Connoropolous/HC-Admin | eff4385ef9ed2e62be4ca57b64164a4c01158747 | [
"MIT"
] | 4 | 2019-02-09T03:29:21.000Z | 2019-04-30T05:47:37.000Z | app/components/pages/HCHelpPage.jsx | holochain/HC-Admin | 1d76faaf60155038ff0576e08017efc09585ed1e | [
"MIT"
] | 1 | 2019-02-07T13:28:42.000Z | 2019-02-07T13:28:42.000Z | import * as React from 'react';
import classNames from 'classnames';
import { Theme } from '@material-ui/core/styles/createMuiTheme';
import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles';
import createStyles from '@material-ui/core/styles/createStyles';
import Typography from '@material-ui/core/Typography';
import QueueAnim from 'rc-queue-anim';
import Dashboard from "../page-components/Dashboard"
import styles from '../styles/page-styles/DefaultPageMuiStyles';
class HCHelpPage extends React.Component<WithStyles<typeof styles>, any> {
constructor(props: any) {
super(props);
this.state = {
open: true,
}
};
render() {
const { classes } = this.props;
const gutterBottom : boolean = true;
return (
<Dashboard>
<main className={classes.content}>
<div className={classes.appBarSpacer} />
<Typography className={classes.mainHeader} style={{color:"#e4e4e4"}} variant="display1" gutterBottom={gutterBottom} component="h2" >
Q&A Help Page + Administrator Settings
</Typography>
<br/>
<div className={classes.tableContainer}>
<Settings/>
</div>
</main>
</Dashboard>
);
}
}
export default withStyles(styles)(HCHelpPage);
| 30.255814 | 142 | 0.660261 | false | true | true | false |
d00211d290e0450c0b64e8b628e0f89487ab5967 | 417 | jsx | JSX | src/components/pages/Home/Home.jsx | Eazybee/Video-Album | 91990bf01dc4b83ec6ee74c6e5b5a39983c7b68d | [
"MIT"
] | null | null | null | src/components/pages/Home/Home.jsx | Eazybee/Video-Album | 91990bf01dc4b83ec6ee74c6e5b5a39983c7b68d | [
"MIT"
] | 5 | 2021-06-28T19:28:23.000Z | 2022-02-26T19:07:46.000Z | src/components/pages/Home/Home.jsx | Eazybee/Video-Album | 91990bf01dc4b83ec6ee74c6e5b5a39983c7b68d | [
"MIT"
] | null | null | null | import React, { useContext } from 'react';
import PageLayout from '../../ui/layout/PageLayout';
import Video from '<organisms>/Video/Video';
import VideoContext from '<context>/video';
const Homepage = () => {
const [videos] = useContext(VideoContext);
return (
<PageLayout>
{videos.map((videoData, key) => <Video key={key} {...videoData}/>)}
</PageLayout>
);
};
export default Homepage;
| 24.529412 | 75 | 0.647482 | false | true | false | true |
d002333595e82f0a03375b93fddcc17aa9acd563 | 423 | jsx | JSX | icons/jsx/SignalWifi0Bar.jsx | openedx/paragon | 370b558a906d5f1f451c204a0b1f653feccc24ac | [
"Apache-2.0"
] | 5 | 2022-02-16T17:22:51.000Z | 2022-03-29T13:50:03.000Z | icons/jsx/SignalWifi0Bar.jsx | arizzitano/excalibur | 5dc4acfaa731e7d7a4e9f13b492f73891f8ae970 | [
"Apache-2.0"
] | 196 | 2022-01-12T19:25:24.000Z | 2022-03-31T17:12:27.000Z | icons/jsx/SignalWifi0Bar.jsx | arizzitano/excalibur | 5dc4acfaa731e7d7a4e9f13b492f73891f8ae970 | [
"Apache-2.0"
] | 2 | 2022-01-20T11:50:25.000Z | 2022-01-26T17:25:41.000Z | import * as React from "react";
function SvgSignalWifi0Bar(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={24}
height={24}
viewBox="0 0 24 24"
{...props}
>
<path d="M12 4C7.31 4 3.07 5.9 0 8.98L12 21 24 8.98A16.88 16.88 0 0012 4zM2.92 9.07C5.51 7.08 8.67 6 12 6s6.49 1.08 9.08 3.07L12 18.17l-9.08-9.1z" />
</svg>
);
}
export default SvgSignalWifi0Bar;
| 23.5 | 155 | 0.586288 | false | true | false | true |
d00234a45cd4c2729aeb43b8c58eb74e77a65aa9 | 3,414 | jsx | JSX | src/components/search/HeaderSearch.jsx | LD4P/sinopia_editor | 28f433875b280be6ea28583f1a33faa069595fea | [
"Apache-2.0"
] | 24 | 2019-07-09T18:26:33.000Z | 2022-02-19T22:15:46.000Z | src/components/search/HeaderSearch.jsx | LD4P/sinopia_editor | 28f433875b280be6ea28583f1a33faa069595fea | [
"Apache-2.0"
] | 2,150 | 2018-09-26T17:30:33.000Z | 2022-03-31T10:16:49.000Z | src/components/search/HeaderSearch.jsx | LD4P/sinopia_editor | 28f433875b280be6ea28583f1a33faa069595fea | [
"Apache-2.0"
] | 6 | 2018-12-14T17:57:46.000Z | 2021-02-13T18:12:26.000Z | // Copyright 2019 Stanford University see LICENSE for license
import React, { useRef, useEffect, useState } from "react"
import { useSelector } from "react-redux"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faSearch, faInfoCircle } from "@fortawesome/free-solid-svg-icons"
import { Popover } from "bootstrap"
import searchConfig from "../../../static/searchConfig.json"
import { sinopiaSearchUri } from "utilities/authorityConfig"
import useSearch from "hooks/useSearch"
import { selectSearchQuery } from "selectors/search"
const HeaderSearch = () => {
const [uri, setUri] = useState(sinopiaSearchUri)
const lastQueryString = useSelector((state) =>
selectSearchQuery(state, "resource")
)
const [query, setQuery] = useState("")
const popoverRef = useRef()
const { fetchNewSearchResults } = useSearch()
const options = searchConfig.map((config) => (
<option key={config.uri} value={config.uri}>
{config.label}
</option>
))
useEffect(() => {
if (lastQueryString) setQuery(lastQueryString)
}, [lastQueryString])
useEffect(() => {
const popover = new Popover(popoverRef.current, {
content:
'Sinopia search: use * as wildcard; default operator for multiple terms is AND; use | (pipe) as OR operator; use quotation marks for exact match. For more details see <a href="https://github.com/LD4P/sinopia/wiki/Searching-in-Sinopia">Searching in Sinopia</a>',
html: true,
})
return () => popover.hide
}, [popoverRef])
const handleQueryChange = (event) => {
setQuery(event.target.value)
event.preventDefault()
}
const handleUriChange = (event) => {
setUri(event.target.value)
event.preventDefault()
}
const handleSearchClick = (event) => {
event.preventDefault()
if (query === "") {
return
}
fetchNewSearchResults(query, uri)
}
const handleKeyPress = (event) => {
if (event.key === "Enter" && query !== "") {
fetchNewSearchResults(query, uri)
event.preventDefault()
}
}
return (
<div className="flex-grow-1">
<div className="input-group mb-2">
<label htmlFor="search" className="col-form-label pe-1 ms-5">
Search
</label>
<a
href="#tooltip"
className="tooltip-heading pt-2"
tabIndex="0"
data-bs-toggle="popover"
data-bs-trigger="focus"
ref={popoverRef}
>
<FontAwesomeIcon className="info-icon" icon={faInfoCircle} />
</a>
<select
className="flex-grow-0 form-select"
id="searchType"
value={uri}
onChange={handleUriChange}
onBlur={handleUriChange}
>
<option value={sinopiaSearchUri}>Sinopia</option>
{options}
</select>
<input
className="flex-grow-1 form-control"
type="search"
id="search"
onChange={handleQueryChange}
onBlur={handleQueryChange}
onKeyPress={handleKeyPress}
value={query}
/>
<button
className="btn btn-outline-secondary"
type="button"
aria-label="Submit search"
data-testid="Submit search"
onClick={handleSearchClick}
>
<FontAwesomeIcon icon={faSearch} />
</button>
</div>
</div>
)
}
export default HeaderSearch
| 29.179487 | 269 | 0.615407 | false | true | false | true |
d00240546a16457dee93184e1100802971d8bf92 | 453 | jsx | JSX | botfront/imports/ui/components/utils/Utils.jsx | thomas779/botfront | ba120f98d8b9877a136aa07284808392ce34381a | [
"Apache-2.0"
] | 737 | 2019-05-08T15:29:35.000Z | 2022-03-31T07:13:04.000Z | botfront/imports/ui/components/utils/Utils.jsx | thomas779/botfront | ba120f98d8b9877a136aa07284808392ce34381a | [
"Apache-2.0"
] | 367 | 2019-05-09T20:44:19.000Z | 2021-05-04T19:38:25.000Z | botfront/imports/ui/components/utils/Utils.jsx | thomas779/botfront | ba120f98d8b9877a136aa07284808392ce34381a | [
"Apache-2.0"
] | 303 | 2019-05-11T18:44:27.000Z | 2022-03-31T07:44:27.000Z | import React from 'react';
import PropTypes from 'prop-types';
import { Loader, Popup } from 'semantic-ui-react';
export function Loading({ loading, children }) {
return !loading ? children : <Loader active inline='centered' />;
}
export function tooltipWrapper(trigger, tooltip) {
return (
<Popup size='mini' inverted content={tooltip} trigger={trigger} />
);
}
Loading.propTypes = {
loading: PropTypes.bool.isRequired,
};
| 22.65 | 74 | 0.684327 | false | true | false | true |
d0024d02867c54efe1ac52688c358deda8d87070 | 2,560 | jsx | JSX | client/containers/ActivitiesContainer.jsx | LordRegis22/voyajour-travel | 367f75a5bb63663bd54b171f7d69a28730ebe455 | [
"MIT"
] | 1 | 2020-10-18T05:38:41.000Z | 2020-10-18T05:38:41.000Z | client/containers/ActivitiesContainer.jsx | LordRegis22/voyajour-travel | 367f75a5bb63663bd54b171f7d69a28730ebe455 | [
"MIT"
] | null | null | null | client/containers/ActivitiesContainer.jsx | LordRegis22/voyajour-travel | 367f75a5bb63663bd54b171f7d69a28730ebe455 | [
"MIT"
] | null | null | null | /* eslint-disable import/extensions */
import React, { useState } from 'react';
import { connect } from 'react-redux';
import { Button } from 'react-bootstrap';
import Activity from '../components/Activity.jsx';
import ActivityFormModal from '../components/AddActivityModal.jsx';
import * as actions from '../actions/actions';
const mapDispatchToProps = (dispatch) => ({
handleFormInput: (newState) => dispatch(actions.activityFormInput(newState)),
handleFormSubmit: (newState) =>
dispatch(actions.activityFormSubmit(newState)),
addToActivitiesArray: (activity, userId) =>
dispatch(actions.storeNewActivity(activity, userId)),
});
const mapStateToProps = (state) => ({
description: state.form.newActivity.description,
notes: state.form.newActivity.notes,
address: state.form.newActivity.address,
link: state.form.newActivity.link,
completed: state.form.newActivity.completed,
userId: state.form.activeUser.userId,
activities: state.trips.activities,
activeLocationId: state.trips.activeLocationId,
});
const ActivitiesContainer = (props) => {
// note, this is the use of React Hooks below. Typically, we wouldn't use
// hooks in a redux application, because we want all state in the store.
// however, we chose to use a hook here for this one piece of the application
const [showModal, setShowModal] = useState(false);
const {
description,
notes,
address,
link,
completed,
userId,
handleFormInput,
handleFormSubmit,
addToActivitiesArray,
activities,
activeLocationId,
} = props;
return (
<div id='large-activity-container'>
<ActivityFormModal
show={showModal}
onHide={() => setShowModal(false)}
description={description}
notes={notes}
address={address}
link={link}
userId={userId}
handleFormInput={handleFormInput}
handleFormSubmit={handleFormSubmit}
addActivity={addToActivitiesArray}
activeLocationId={activeLocationId}
/>
<h1>Activities: </h1>
<div id='all-activities'>
<Button onClick={() => setShowModal(true)}>Add Activity</Button>
{activities.map((el, i) => (
<Activity
key={`activity${i}`}
description={el.description}
notes={el.notes}
address={el.address}
link={el.link}
locationId={el.location_id}
/>
))}
</div>
</div>
);
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(ActivitiesContainer);
| 30.47619 | 79 | 0.663672 | false | true | false | true |
d00250d309a72db7085c443b4f5982363b782288 | 1,628 | jsx | JSX | src/views/ComingSoonScreen.jsx | adimute/dvir-dashboard | 23a08556c4f98151ab992bf7e7971e17a22ae156 | [
"MIT"
] | 1 | 2020-02-22T18:44:46.000Z | 2020-02-22T18:44:46.000Z | src/views/ComingSoonScreen.jsx | adimute/dvir-dashboard | 23a08556c4f98151ab992bf7e7971e17a22ae156 | [
"MIT"
] | 1 | 2022-02-10T21:16:59.000Z | 2022-02-10T21:16:59.000Z | src/views/ComingSoonScreen.jsx | adimute/dvir-dashboard | 23a08556c4f98151ab992bf7e7971e17a22ae156 | [
"MIT"
] | null | null | null | /*!
=========================================================
* Paper Dashboard React - v1.1.0
=========================================================
* Product Page: https://www.creative-tim.com/product/paper-dashboard-react
* Copyright 2019 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://github.com/creativetimofficial/paper-dashboard-react/blob/master/LICENSE.md)
* Coded by Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
import React from "react";
// reactstrap components
import {
Card,
CardHeader,
CardBody,
CardTitle,
Table,
Row,
Col
} from "reactstrap";
class ComingSoonScreen extends React.Component {
render() {
return (
<>
<div className="content">
<Row>
<Col md="12">
<Card>
<CardHeader>
<CardTitle tag="h4">Coming Soon Screen</CardTitle>
</CardHeader>
<CardBody>
</CardBody>
</Card>
</Col>
<Col md="12">
<Card className="card-plain">
<CardHeader>
<CardTitle tag="h4"></CardTitle>
<p className="card-category">
</p>
</CardHeader>
<CardBody>
</CardBody>
</Card>
</Col>
</Row>
</div>
</>
);
}
}
export default ComingSoonScreen;
| 24.298507 | 128 | 0.468673 | false | true | true | false |
d0029051ff84b9a5e5e6fc605573ef6932971795 | 187 | jsx | JSX | section_15_react_router_w_hooks/project_1/src/Redux.jsx | Kubixii/React | 2bd831fb8f39f19eaf8b1d0d391f9e2870db6a40 | [
"MIT"
] | null | null | null | section_15_react_router_w_hooks/project_1/src/Redux.jsx | Kubixii/React | 2bd831fb8f39f19eaf8b1d0d391f9e2870db6a40 | [
"MIT"
] | null | null | null | section_15_react_router_w_hooks/project_1/src/Redux.jsx | Kubixii/React | 2bd831fb8f39f19eaf8b1d0d391f9e2870db6a40 | [
"MIT"
] | null | null | null | import React from 'react'
const Redux = () => {
return (
<article>
<h2>
Redux
</h2>
</article>
);
}
export default Redux; | 14.384615 | 25 | 0.411765 | false | true | false | true |
d002925e8d33eb33df1321798408a78e940c90a2 | 1,794 | jsx | JSX | client/src/components/Chat/Chat/Dialog/Dialog.jsx | gabivlj/R | 582faecf6f24429859d467f6e5859837dcd71a8d | [
"MIT"
] | 7 | 2019-08-18T10:53:10.000Z | 2020-08-25T00:32:13.000Z | client/src/components/Chat/Chat/Dialog/Dialog.jsx | gabivlj/R | 582faecf6f24429859d467f6e5859837dcd71a8d | [
"MIT"
] | 4 | 2019-11-22T00:31:34.000Z | 2022-01-22T09:56:36.000Z | client/src/components/Chat/Chat/Dialog/Dialog.jsx | gabivlj/R | 582faecf6f24429859d467f6e5859837dcd71a8d | [
"MIT"
] | 1 | 2020-05-31T01:39:55.000Z | 2020-05-31T01:39:55.000Z | import React, { useEffect, useRef } from 'react';
import ReactDOM from 'react-dom';
import {
Dialog,
DialogTitle,
DialogContent,
DialogContentText,
DialogActions,
Button,
CircularProgress,
} from '@material-ui/core';
export default function DialogMe({
open,
handleClose,
title,
Render,
propsRender,
renderActions,
image,
handleBack,
isLoading,
handleFriend,
titleButton,
scrollableGeneral,
onScroll,
}) {
return (
<div>
<Dialog
open={open}
onScroll={onScroll || function() {}}
onClose={handleClose}
scroll={scrollableGeneral ? 'body' : 'paper'}
aria-labelledby="scroll-dialog-title"
fullWidth
maxWidth="md"
>
<DialogTitle
id="scroll-dialog-title"
style={{ borderBottom: '1px solid #dce7f2' }}
>
{image}
{title}
<Button
onClick={handleFriend}
className="ml-3"
type="button"
color="primary"
>
{titleButton}
</Button>
<Button
onClick={handleClose}
className="ml-3"
type="button"
color="secondary"
>
Close
</Button>
</DialogTitle>
<DialogContent modal="false" dividers="true">
{isLoading ? (
<div style={{ padding: '10% 10% 10% 50%' }}>
<CircularProgress />
</div>
) : (
<Render {...propsRender} />
)}
</DialogContent>
<DialogActions
disableActionSpacing
style={{ borderTop: '1px solid #dce7f2', overflowX: 'hidden' }}
>
{renderActions}
</DialogActions>
</Dialog>
</div>
);
}
| 21.878049 | 73 | 0.513378 | false | true | false | true |
d00293f04c6094aa3a154597ba83b10ab3f290dd | 2,012 | jsx | JSX | webapp/components/admin_console/admin_console.jsx | realrolfje/mattermost-platform | 1397798f1763b0848957a8672c8d40b6243764d5 | [
"Apache-2.0"
] | null | null | null | webapp/components/admin_console/admin_console.jsx | realrolfje/mattermost-platform | 1397798f1763b0848957a8672c8d40b6243764d5 | [
"Apache-2.0"
] | null | null | null | webapp/components/admin_console/admin_console.jsx | realrolfje/mattermost-platform | 1397798f1763b0848957a8672c8d40b6243764d5 | [
"Apache-2.0"
] | 1 | 2020-09-18T02:17:38.000Z | 2020-09-18T02:17:38.000Z | // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import 'bootstrap';
import ErrorBar from 'components/error_bar.jsx';
import AdminStore from 'stores/admin_store.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
import AdminSidebar from './admin_sidebar.jsx';
export default class AdminConsole extends React.Component {
static get propTypes() {
return {
children: React.PropTypes.node.isRequired
};
}
constructor(props) {
super(props);
this.handleConfigChange = this.handleConfigChange.bind(this);
this.state = {
config: AdminStore.getConfig()
};
}
componentWillMount() {
AdminStore.addConfigChangeListener(this.handleConfigChange);
AsyncClient.getConfig();
}
componentWillUnmount() {
AdminStore.removeConfigChangeListener(this.handleConfigChange);
}
handleConfigChange() {
this.setState({
config: AdminStore.getConfig()
});
}
render() {
const config = this.state.config;
if (!config) {
return <div/>;
}
if (config && Object.keys(config).length === 0 && config.constructor === 'Object') {
return (
<div className='admin-console__wrapper'>
<ErrorBar/>
<div className='admin-console'/>
</div>
);
}
// not every page in the system console will need the config, but the vast majority will
const children = React.cloneElement(this.props.children, {
config: this.state.config
});
return (
<div className='admin-console__wrapper'>
<ErrorBar/>
<div className='admin-console'>
<AdminSidebar/>
{children}
</div>
</div>
);
}
}
| 27.189189 | 96 | 0.567097 | false | true | true | false |
d00295d4cabb840c28fba53287dc574646e645fa | 487 | jsx | JSX | src/components/Input/Input.jsx | YanaDerevianko/matrix-creator | 84a8e1c4c8814747c1235e75dddf77e56d1e7417 | [
"MIT"
] | null | null | null | src/components/Input/Input.jsx | YanaDerevianko/matrix-creator | 84a8e1c4c8814747c1235e75dddf77e56d1e7417 | [
"MIT"
] | null | null | null | src/components/Input/Input.jsx | YanaDerevianko/matrix-creator | 84a8e1c4c8814747c1235e75dddf77e56d1e7417 | [
"MIT"
] | null | null | null | import React from "react";
import store from "../../redux/store";
import shortid from 'shortid';
export const Input = ({ inputLabel, inputHandler, value }) => {
const setValueHandler = (param) => store.dispatch(inputHandler(param));
return (
<label htmlFor={shortid.generate()}>
{inputLabel}
<input
id={shortid.generate()}
type="number"
onChange={(e) => setValueHandler(+e.target.value)}
value={value}
/>
</label>
);
}; | 24.35 | 73 | 0.601643 | false | true | false | true |
d002ab53567f5b9a746e294e305ab2a217c488c6 | 477 | jsx | JSX | src/components/startpage/serviceitem.jsx | dominikhofmanpl/mwcollective-gatsby-wordpress-site | c266325f32eecc8df625e3044cdd5fbab8d739de | [
"RSA-MD"
] | null | null | null | src/components/startpage/serviceitem.jsx | dominikhofmanpl/mwcollective-gatsby-wordpress-site | c266325f32eecc8df625e3044cdd5fbab8d739de | [
"RSA-MD"
] | null | null | null | src/components/startpage/serviceitem.jsx | dominikhofmanpl/mwcollective-gatsby-wordpress-site | c266325f32eecc8df625e3044cdd5fbab8d739de | [
"RSA-MD"
] | null | null | null | import React from 'react'
const ServiceItem = ({serviceIcon, serviceTitle, serviceDescription}) => {
return (
<div className="flex flex-col py-4 md:mr-4">
<img src={serviceIcon} alt="" srcset="" style={{
width: `4rem`
}} className="my-3"/>
<h3 className="mont-semi my-1">{serviceTitle}</h3>
<p className="inriasans-reg my-3">{serviceDescription}</p>
</div>
)
}
export default ServiceItem | 31.8 | 74 | 0.572327 | false | true | false | true |
d002adcb2d63e54b1fb80cf2dd820a39426fcd43 | 739 | jsx | JSX | src/components/porfolio-page.jsx | HenKyubi666/HenKyubi666.github.io | c1cf7a60b27067c363ac83ee88a4291ccf04f4c0 | [
"RSA-MD"
] | null | null | null | src/components/porfolio-page.jsx | HenKyubi666/HenKyubi666.github.io | c1cf7a60b27067c363ac83ee88a4291ccf04f4c0 | [
"RSA-MD"
] | null | null | null | src/components/porfolio-page.jsx | HenKyubi666/HenKyubi666.github.io | c1cf7a60b27067c363ac83ee88a4291ccf04f4c0 | [
"RSA-MD"
] | null | null | null | import React from "react"
const PorfolioPage = ({ imgPage, altImgPage, title, description, urlPage }) => (
<div className="h-100 w-100 card d-flex flex-column porfolio-slide">
<div className="my-auto">
<div className="d-flex justify-content-center">
<img className="img-portfolio" src={imgPage} alt={altImgPage} />
</div>
<div className="card-body">
<h5 className="fs-2 fw-bold text-center">{title}</h5>
<p className="fs-6 text-center">{description}</p>
<div className="d-flex justify-content-center">
<a href={urlPage} className="btn-porfolio-page text-center">
Go
</a>
</div>
</div>
</div>
</div>
)
export default PorfolioPage
| 32.130435 | 80 | 0.607578 | false | true | false | true |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
- Downloads last month
- 2