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
12761b002640c04cd5f349ccaa0168d54c076b56
18,509
jsx
JSX
web-ui/src/components/student/worksheets/core-value/History.jsx
kentu512/react-aws-cognito-serverless
049be0427337275a879ed413fbc36d08fbffa08f
[ "MIT" ]
1
2020-10-12T20:48:37.000Z
2020-10-12T20:48:37.000Z
web-ui/src/components/student/worksheets/core-value/History.jsx
kentu512/react-aws-cognito-serverless
049be0427337275a879ed413fbc36d08fbffa08f
[ "MIT" ]
12
2021-02-03T05:06:28.000Z
2021-02-03T05:06:31.000Z
web-ui/src/components/student/worksheets/core-value/History.jsx
kentu512/react-aws-cognito-serverless
049be0427337275a879ed413fbc36d08fbffa08f
[ "MIT" ]
1
2020-10-12T20:48:59.000Z
2020-10-12T20:48:59.000Z
import React from 'react'; import { Link } from 'react-router-dom'; import { makeStyles } from '@material-ui/core/styles'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; import TableHead from '@material-ui/core/TableHead'; import TableRow from '@material-ui/core/TableRow'; import TextField from '@material-ui/core/TextField'; import Button from '@material-ui/core/Button'; import FastRewindRoundedIcon from '@material-ui/icons/FastRewindRounded'; import FastForwardRoundedIcon from '@material-ui/icons/FastForwardRounded'; import Wrapper from './../../../ui/wrapper/Wrapper'; import Comment from './../../../ui/comment/Comment'; import Textfield from '../../../ui/textfield/Textfield'; import { GET_CORE, INSEERT_CORE } from './../../../../graphql/student/worksheets/core-value/Core'; const useStyles = makeStyles(theme => ({ root: { width: '100%', marginTop: theme.spacing(3), overflowX: 'auto', }, icon: { fontSize: '3rem', color: 'grey' }, container: { display: 'flex', flexWrap: 'wrap' }, table: { fontSize: '1rem' }, tablecell: { padding: '2%', fontSize: '1rem', backgroundColor: 'lightgrey', border: 'solid', borderWidth: '1px' }, tablecell1: { border: 'solid', borderWidth: '1px', }, tablecell2: { border: 'solid', borderWidth: '1px', width: '60%' }, textfield: { marginLeft: theme.spacing(1), marginRight: theme.spacing(1), width: '100%', color: 'black' }, disable: { width: '100%', color: 'black' }, title: { marginTop: '10%' } })); const History = (props) => { const classes = useStyles(); const root = props.location.pathname.replace(props.cores[1].url, ''); const prev = props.cores[0].url; const next = props.cores[2].url; const [id, setID] = React.useState(0); const [isLoaded, setLoaded] = React.useState(false); const [history, setHistory] = React.useState(String); const params1 = ['academic', 'extra', 'hobby', 'friend', 'teacher', 'parent', 'people', 'dream', 'time']; const params2 = ['academic', 'extra', 'hobby', 'friend', 'teacher', 'parent', 'people', 'dream', 'time']; const params3 = ['academic', 'extra', 'hobby', 'tip', 'reading', 'friend', 'teacher', 'parent', 'people', 'dream', 'time']; const params4 = ['academic', 'extra', 'hobby', 'tip', 'reading', 'friend', 'teacher', 'parent', 'people', 'dream', 'time']; React.useEffect(() => { props.client.query({query: GET_CORE, variables: {usersub: props.sub, subid: props.subid}}).then(res => { const data = res.data; if (data) { setLoaded(true); if (data.core.length > 0) { setID(data.core[0].id); setHistory(data.core[0].value); }; }; }); }, [props.client, props.sub, props.subid, props.location.pathname]); const handleClick = () => { var elementary = []; for (var index = 0; index < 9; index++) { elementary.push(document.getElementById(`el-${params1[index]}`).value); }; var middle = []; for (var index1 = 0; index1 < 9; index1++) { middle.push(document.getElementById(`mi-${params2[index1]}`).value); }; var fresh = []; for (var index2 = 0; index2 < 11; index2++) { fresh.push(document.getElementById(`fr-${params3[index2]}`).value); }; var sopho = []; for (var index3 = 0; index3 < 11; index3++) { sopho.push(document.getElementById(`so-${params4[index3]}`).value) }; const history_obj = { elementary: elementary, middle: middle, fresh: fresh, sopho: sopho }; const obj = { usersub: props.sub, sub_id: props.subid, value: JSON.stringify(history_obj) }; if (id !== 0) { obj.id = id; }; props.client.mutate({ mutation: INSEERT_CORE, variables: { core: obj } }).then(res => { const data = res.data; if (data.core.affected_rows > 0) { props.history.push(root); } }); }; const TimeTextfield = (props) => { return ( <form className = {classes.container} noValidate autoComplete = 'off' style = {{border: 'solid', borderWidth: '1px'}}> <div style = {{width: '100%', padding: '0 2% 0 2%'}}> <TextField id = {props.id} className = {classes.textfield} defaultValue = {props.value} multiline InputProps = {{ disableUnderline: true }} /> </div> </form> ) } const elementaryTable = () => { const trs = [ 'Academic', 'Extracurricular', 'Hobbies, pasttime', 'Relationship with friends', 'Relationship with teachers', 'Relationship with parents', 'People who inspired you', 'Dreams, goals' ]; return ( <TableBody id = 'element'> {trs.map((tr, index) => <TableRow key = {index}> <TableCell className = {classes.tablecell1}> {tr} </TableCell> <TableCell className = {classes.tablecell2}> <Textfield id = {`el-${params1[index]}`} value = {history && JSON.parse(history).elementary[index]}/> </TableCell> </TableRow> )} </TableBody> ) }; const middleTable = () => { const trs = [ 'Academic', 'Extracurricular', 'Hobbies, pasttime, boy/girl friend', 'Relationship with friends', 'Relationship with teachers', 'Relationship with parents', 'People who inspired you', 'Dreams, goals' ]; return ( <TableBody id = 'middle'> {trs.map((tr, index) => <TableRow key = {index}> <TableCell className = {classes.tablecell1}> {tr} </TableCell> <TableCell className = {classes.tablecell2}> <Textfield id = {`mi-${params2[index]}`} value = {history && JSON.parse(history).middle[index]}/> </TableCell> </TableRow> )} </TableBody> ) }; const freshmanTable = () => { const trs = [ 'Academic', 'Extracurricular', 'Hobbies, pasttime, boy/girl friend', 'Tip, study abroad', 'Reading book', 'Relationship with friends', 'Relationship with teachers', 'Relationship with parents', 'People who inspired you', 'Dreams, goals' ]; return ( <TableBody id = 'fresh'> {trs.map((tr, index) => <TableRow key = {index}> <TableCell className = {classes.tablecell1}> {tr} </TableCell> <TableCell className = {classes.tablecell2}> <Textfield id = {`fr-${params3[index]}`} value = {history && JSON.parse(history).fresh[index]}/> </TableCell> </TableRow> )} </TableBody> ) }; const sophomoreTable = () => { const trs = [ 'Academic', 'Extracurricular', 'Hobbies, pasttime, boy/girl friend', 'Tip, study abroad', 'Reading book', 'Relationship with friends', 'Relationship with teachers', 'Relationship with parents', 'People who inspired you', 'Dreams, goals' ]; return ( <TableBody id = 'sopho'> {trs.map((tr, index) => <TableRow key = {index}> <TableCell className = {classes.tablecell1}> {tr} </TableCell> <TableCell className = {classes.tablecell2}> <Textfield id = {`so-${params4[index]}`} value = {history && JSON.parse(history).sopho[index]}/> </TableCell> </TableRow> )} </TableBody> ) }; if (!isLoaded) { return ( <p>Loading ... </p> ) } else { return ( <div> <div className = 'center direction'> <Link to = {`${root}${prev}`} style = {{textDecoration: 'none'}}> <FastRewindRoundedIcon className = {classes.icon} style = {{marginLeft: '5rem'}} /> </Link> <Link to = {`${root}${next}`} style = {{textDecoration: 'none'}}> <FastForwardRoundedIcon className = {classes.icon} style = {{marginRight: '5rem'}}/> </Link> </div> <div className = 'center'> <div style = {{width: '80%', textAlign: 'center'}}> <h2 className = 'center text_center'>3.2 Your life history and what matters the most to you</h2> <h3 className = 'center'>(60 min)</h3> </div> </div> <div className = 'center'> <div className = 'p-60'> <p className = 'text_center'>Reflect on your life history. This chronological table will help you find clues as to how you have developed your expressed/hidden core values over time.</p> <div className = 'line'></div> <p>[Kindergarten/Elementary school (1-5th grade)]</p> <Wrapper components = { [ <Table className = {classes.table} aria-label = 'caption table'> <TableHead> <TableRow> <TableCell className = {classes.tablecell} align = 'center'>Items</TableCell> <TableCell className = {classes.tablecell} align = 'center'>What did your life look life?</TableCell> </TableRow> </TableHead> {elementaryTable()} </Table>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {0} /> ] } /> <p className = 'center'>What did you value most at that time?</p> <Wrapper components = { [ <TimeTextfield id = {`el-${params1[8]}`} value = {history && JSON.parse(history).elementary[8]}/>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {1} /> ] } /> <p className = {classes.title}>[Middle school (6-8th grade)]</p> <Wrapper components = { [ <Table className = {classes.table} aria-label = 'caption table'> <TableHead> <TableRow> <TableCell className = {classes.tablecell} align = 'center'>Items</TableCell> <TableCell className = {classes.tablecell} align = 'center'>What did your life look life?</TableCell> </TableRow> </TableHead> {middleTable()} </Table>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {2} /> ] } /> <p className = 'center'>What did you value most at that time?</p> <Wrapper components = { [ <TimeTextfield id = {`mi-${params2[8]}`} value = {history && JSON.parse(history).middle[8]}/>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {3} /> ] } /> <p className = {classes.title}>[Freshman year in High school (9th grade)]</p> <Wrapper components = { [ <Table className = {classes.table} aria-label = 'caption table'> <TableHead> <TableRow> <TableCell className = {classes.tablecell} align = 'center'>Items</TableCell> <TableCell className = {classes.tablecell} align = 'center'>What did your life look life?</TableCell> </TableRow> </TableHead> {freshmanTable()} </Table>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {4} /> ] } /> <p className = 'center'>What did you value most at that time?</p> <Wrapper components = { [ <TimeTextfield id = {`fr-${params3[10]}`} value = {history && JSON.parse(history).fresh[10]}/>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {5} /> ] } /> <p className = {classes.title}>[Sophomore year in High school (10th grade)]</p> <Wrapper components = { [ <Table className = {classes.table} aria-label = 'caption table'> <TableHead> <TableRow> <TableCell className = {classes.tablecell} align = 'center'>Items</TableCell> <TableCell className = {classes.tablecell} align = 'center'>What did your life look life?</TableCell> </TableRow> </TableHead> {sophomoreTable()} </Table>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {6} /> ] } /> <p className = 'center'>What did you value most at that time?</p> <Wrapper components = { [ <TimeTextfield id = {`so-${params4[10]}`} value = {history && JSON.parse(history).sopho[10]}/>, <Comment type = {props.type} client = {props.client} student = {props.student} worksheet = {props.worksheet_id} sub = {props.subid} item = {7} /> ] } /> </div> </div> <div className = 'center'> <Button onClick = {handleClick} className = 'pl-4 pr-4' variant = 'contained' color = 'primary' > Save </Button> </div> </div> ); } }; export default History;
43.346604
210
0.411421
false
true
false
true
127621ca94292c0f7926ddb7600ba8c146928083
4,699
jsx
JSX
client/app/visualizations/table/columns/image.jsx
techwavein/redash
e36f8a1a8492f601241571e55bbbe89b1610c311
[ "BSD-2-Clause" ]
1
2019-11-09T07:57:05.000Z
2019-11-09T07:57:05.000Z
client/app/visualizations/table/columns/image.jsx
techwavein/redash
e36f8a1a8492f601241571e55bbbe89b1610c311
[ "BSD-2-Clause" ]
3
2022-02-14T01:15:27.000Z
2022-02-27T11:21:50.000Z
client/app/visualizations/table/columns/image.jsx
techwavein/redash
e36f8a1a8492f601241571e55bbbe89b1610c311
[ "BSD-2-Clause" ]
1
2019-12-06T08:30:35.000Z
2019-12-06T08:30:35.000Z
import { extend, trim } from 'lodash'; import React from 'react'; import PropTypes from 'prop-types'; import { useDebouncedCallback } from 'use-debounce'; import Input from 'antd/lib/input'; import Popover from 'antd/lib/popover'; import Icon from 'antd/lib/icon'; import { formatSimpleTemplate } from '@/lib/value-format'; function Editor({ column, onChange }) { const [onChangeDebounced] = useDebouncedCallback(onChange, 200); return ( <React.Fragment> <div className="m-b-15"> <label htmlFor={`table-column-editor-${column.name}-image-url`}>URL template</label> <Input id={`table-column-editor-${column.name}-image-url`} data-test="Table.ColumnEditor.Image.UrlTemplate" defaultValue={column.imageUrlTemplate} onChange={event => onChangeDebounced({ imageUrlTemplate: event.target.value })} /> </div> <div className="m-b-15"> <label htmlFor={`table-column-editor-${column.name}-image-width`}> Size <Popover content="Any positive integer value that specifies size in pixels. Leave empty to use default value." placement="topLeft" arrowPointAtCenter > <Icon className="m-l-5" type="question-circle" theme="filled" /> </Popover> </label> <div className="d-flex align-items-center"> <Input id={`table-column-editor-${column.name}-image-width`} data-test="Table.ColumnEditor.Image.Width" placeholder="Width" defaultValue={column.imageWidth} onChange={event => onChangeDebounced({ imageWidth: event.target.value })} /> <span className="p-l-5 p-r-5">&times;</span> <Input id={`table-column-editor-${column.name}-image-height`} data-test="Table.ColumnEditor.Image.Height" placeholder="Height" defaultValue={column.imageHeight} onChange={event => onChangeDebounced({ imageHeight: event.target.value })} /> </div> </div> <div className="m-b-15"> <label htmlFor={`table-column-editor-${column.name}-image-title`}>Title template</label> <Input id={`table-column-editor-${column.name}-image-title`} data-test="Table.ColumnEditor.Image.TitleTemplate" defaultValue={column.imageTitleTemplate} onChange={event => onChangeDebounced({ imageTitleTemplate: event.target.value })} /> </div> <div className="m-b-15"> <Popover content={( <React.Fragment> <div>All columns can be referenced using <code>{'{{ column_name }}'}</code> syntax.</div> <div>Use <code>{'{{ @ }}'}</code> to reference current (this) column.</div> <div>This syntax is applicable to URL, Title and Size options.</div> </React.Fragment> )} placement="topLeft" arrowPointAtCenter > <span style={{ cursor: 'default' }}> Format specs <Icon className="m-l-5" type="question-circle" theme="filled" /> </span> </Popover> </div> </React.Fragment> ); } Editor.propTypes = { column: PropTypes.shape({ name: PropTypes.string.isRequired, imageUrlTemplate: PropTypes.string, imageWidth: PropTypes.string, imageHeight: PropTypes.string, imageTitleTemplate: PropTypes.string, }).isRequired, onChange: PropTypes.func.isRequired, }; export default function initImageColumn(column) { function prepareData(row) { row = extend({ '@': row[column.name] }, row); const src = trim(formatSimpleTemplate(column.imageUrlTemplate, row)); if (src === '') { return {}; } const width = parseInt(formatSimpleTemplate(column.imageWidth, row), 10); const height = parseInt(formatSimpleTemplate(column.imageHeight, row), 10); const title = trim(formatSimpleTemplate(column.imageTitleTemplate, row)); const result = { src }; if (Number.isFinite(width) && (width > 0)) { result.width = width; } if (Number.isFinite(height) && (height > 0)) { result.height = height; } if (title !== '') { result.text = title; // `text` is used for search result.title = title; result.alt = title; } return result; } function ImageColumn({ row }) { // eslint-disable-line react/prop-types const { text, ...props } = prepareData(row); return <img alt="" {...props} />; } ImageColumn.prepareData = prepareData; return ImageColumn; } initImageColumn.friendlyName = 'Image'; initImageColumn.Editor = Editor;
33.805755
113
0.60864
false
true
false
true
12762c3fd933d1fa7eebabd63416249d22945411
1,608
jsx
JSX
src/components/ContactForm/ContactForm.jsx
Serhii-Chekalov/goit-react-hw-02-phonebook
00f8560d9a796d3f7a30e08cda75044f2bada009
[ "MIT" ]
null
null
null
src/components/ContactForm/ContactForm.jsx
Serhii-Chekalov/goit-react-hw-02-phonebook
00f8560d9a796d3f7a30e08cda75044f2bada009
[ "MIT" ]
null
null
null
src/components/ContactForm/ContactForm.jsx
Serhii-Chekalov/goit-react-hw-02-phonebook
00f8560d9a796d3f7a30e08cda75044f2bada009
[ "MIT" ]
null
null
null
import { Component } from "react"; import { Form, Label, Input, Button } from "./ContactForm.styled"; class ContactForm extends Component { state = { name: "", number: "", }; handleChange = (e) => { this.setState({ [e.currentTarget.name]: e.target.value }); }; handleSubmit = (e) => { e.preventDefault(); const { name, number } = this.state; const { onSubmit } = this.props; onSubmit(name, number); this.setState({ name: "", number: "" }); }; render() { const { handleSubmit, handleChange } = this; const { name, number } = this.state; return ( <Form action="" onSubmit={handleSubmit}> <Label htmlFor="name">Name</Label> <Input onChange={handleChange} type="text" name="name" value={name} pattern="^[a-zA-Zа-яА-Я]+(([' -][a-zA-Zа-яА-Я ])?[a-zA-Zа-яА-Я]*)*$" title="Имя может состоять только из букв, апострофа, тире и пробелов. Например Adrian, Jacob Mercer, Charles de Batz de Castelmore d'Artagnan и т. п." required /> <Label htmlFor="number">Number</Label> <Input onChange={handleChange} type="tel" name="number" value={number} pattern="\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}" title="Номер телефона должен состоять цифр и может содержать пробелы, тире, круглые скобки и может начинаться с +" required /> <Button type="submit">Add contact</Button> </Form> ); } } export default ContactForm;
28.714286
160
0.550373
false
true
true
false
127639ee6295e3540281a748e2bb4faadc3a798e
217
jsx
JSX
src/Components/Form.jsx
123-code/Crypto-Wallet
54061091245825ad7af35f93b8784849f11801d3
[ "MIT" ]
null
null
null
src/Components/Form.jsx
123-code/Crypto-Wallet
54061091245825ad7af35f93b8784849f11801d3
[ "MIT" ]
null
null
null
src/Components/Form.jsx
123-code/Crypto-Wallet
54061091245825ad7af35f93b8784849f11801d3
[ "MIT" ]
null
null
null
import React from 'react'; const Form = (props,props1)=>{ return( <> <form> <h2>{props}</h2> <input type="text"/> </form> </> ) } export default Form;
14.466667
30
0.428571
false
true
false
true
127658c6d5a3b64fd98ad31ceb285f99433621c1
693
jsx
JSX
src/router/renderRoutes.jsx
gengliangxiang/webpack-react
46c1f1db10e33dface422944c4cd4492fdaa374b
[ "ISC" ]
5
2020-01-04T06:27:52.000Z
2021-05-16T16:41:19.000Z
src/router/renderRoutes.jsx
gengliangxiang/webpack-react
46c1f1db10e33dface422944c4cd4492fdaa374b
[ "ISC" ]
5
2020-04-06T03:41:55.000Z
2022-02-18T18:02:31.000Z
src/router/renderRoutes.jsx
gengliangxiang/webpack-react
46c1f1db10e33dface422944c4cd4492fdaa374b
[ "ISC" ]
1
2020-09-24T08:41:49.000Z
2020-09-24T08:41:49.000Z
import React from 'react'; import { Route, Redirect, Switch } from 'react-router-dom'; const renderRoutes = (routes, authed, authPath = '/login', extraProps = {}, switchProps = {}) => (routes ? ( <Switch {...switchProps}> {routes.map((route, i) => ( <Route key={route.key || i} path={route.path} exact={route.exact} strict={route.strict} render={props => { if (!route.requiresAuth || authed || route.path === authPath) { return <route.component {...props} {...extraProps} route={route} />; } return <Redirect to={{ pathname: authPath, state: { from: props.location } }} />; }} /> ))} </Switch> ) : null); export default renderRoutes;
28.875
108
0.59596
true
false
false
true
127659ed604829fed0180f70c25eadf09805e383
1,898
jsx
JSX
src/applications/claims-status/components/appeals-v2/AppealHelpSidebar.jsx
jennilynhowell/vets-website
4edea8aee0c80cdbaa0ff731d5e60dc814ed63b7
[ "CC0-1.0" ]
null
null
null
src/applications/claims-status/components/appeals-v2/AppealHelpSidebar.jsx
jennilynhowell/vets-website
4edea8aee0c80cdbaa0ff731d5e60dc814ed63b7
[ "CC0-1.0" ]
null
null
null
src/applications/claims-status/components/appeals-v2/AppealHelpSidebar.jsx
jennilynhowell/vets-website
4edea8aee0c80cdbaa0ff731d5e60dc814ed63b7
[ "CC0-1.0" ]
1
2018-09-26T12:02:49.000Z
2018-09-26T12:02:49.000Z
import React from 'react'; import Raven from 'raven-js'; const vbaVersion = ( <div> <h2 className="help-heading">Need help?</h2> <p>Call the Veterans Affairs Benefits and Services</p> <p className="help-phone-number"> <a className="help-phone-number-link" href="tel:1-800-827-1000">1-800-827-1000</a> </p> <p>Monday - Friday, 8:00am - 9:00pm (ET)</p> </div> ); const boardVersion = ( <div> <h2 className="help-heading">Need help?</h2> <p>Call the Board of Veterans’ Appeals</p> <p className="help-phone-number"> <a className="help-phone-number-link" href="tel:1-800-923-8387">1-800-923-8387</a> </p> <p>Monday - Friday, 9:00am - 4:30pm (ET)</p> </div> ); /** * Displays the "Need help?" sidebar content based on the appeal's location. * * @param {String} location The location of the appeal. Possible options: * ['aoj', 'bva'] * @param {String} aoj The Agency of Original Jurisdiction. * Used if the location is 'aoj' * Possible options: * ['vba', 'vha', 'nca', 'other'] */ export default function AppealHelpSidebar({ location, aoj }) { if (location === 'aoj') { // If the location is 'aoj', we have to check which agency it came from to show // the appropriate information. switch (aoj) { case 'vba': return vbaVersion; case 'vha': return null; // vha version (coming soon to a sidebar near you!) case 'nca': return null; // nca version (coming soon to a sidebar near you!) case 'other': return boardVersion; default: Raven.captureMessage(`appeal-status-unexpected-aoj: ${aoj}`); } } else if (location === 'bva') { return boardVersion; } else { Raven.captureMessage(`appeal-status-unexpected-location: ${location}`); } return null; }
32.724138
88
0.597471
false
true
false
true
127662262682d885abc5e6bbc4108f86f4805078
3,054
jsx
JSX
src/sentry/static/sentry/app/components/lazyLoad.jsx
pavelkovar/sentry
2ea999f948e88bf6fb606753ddaf79af8cf5085e
[ "BSD-3-Clause" ]
null
null
null
src/sentry/static/sentry/app/components/lazyLoad.jsx
pavelkovar/sentry
2ea999f948e88bf6fb606753ddaf79af8cf5085e
[ "BSD-3-Clause" ]
null
null
null
src/sentry/static/sentry/app/components/lazyLoad.jsx
pavelkovar/sentry
2ea999f948e88bf6fb606753ddaf79af8cf5085e
[ "BSD-3-Clause" ]
null
null
null
import PropTypes from 'prop-types'; import React from 'react'; import sdk from 'app/utils/sdk'; import {t} from 'app/locale'; import LoadingError from 'app/components/loadingError'; import LoadingIndicator from 'app/components/loadingIndicator'; import retryableImport from 'app/utils/retryableImport'; class LazyLoad extends React.Component { static propTypes = { hideBusy: PropTypes.bool, hideError: PropTypes.bool, /** * Function that returns a promise of a React.Component */ component: PropTypes.func, /** * Also accepts a route object from react-router that has a `componentPromise` property */ route: PropTypes.shape({ path: PropTypes.string, componentPromise: PropTypes.func, }), }; constructor(...args) { super(...args); this.state = { Component: null, error: null, }; } componentDidMount() { this.fetchComponent(); } componentWillReceiveProps(nextProps, nextState) { // This is to handle the following case: // <Route path="a/"> // <Route path="b/" component={LazyLoad} componentPromise={...} /> // <Route path="c/" component={LazyLoad} componentPromise={...} /> // </Route> // // `LazyLoad` will get not fully remount when we switch between `b` and `c`, // instead will just re-render. Refetch if route paths are different if (nextProps.route && nextProps.route === this.props.route) return; // If `this.fetchComponent` is not in callback, // then there's no guarantee that new Component will be rendered this.setState( { Component: null, }, this.fetchComponent ); } componentDidCatch(error, info) { this.handleFetchError(error); } getComponentGetter = () => this.props.component || this.props.route.componentPromise; handleFetchError = error => { // eslint-disable-next-line no-console console.error(error); sdk.captureException(error, {fingerprint: ['webpack', 'error loading chunk']}); this.setState({ error, }); }; fetchComponent = () => { let getComponent = this.getComponentGetter(); retryableImport(getComponent) .then(Component => { // Always load default export if available this.setState({ Component: Component.default || Component, }); }, this.handleFetchError) .catch(this.handleFetchError); }; fetchRetry = () => { this.setState( { error: null, }, () => this.fetchComponent() ); }; render() { let {Component, error} = this.state; // eslint-disable-next-line no-unused-vars let {hideBusy, hideError, component, ...otherProps} = this.props; if (error && !hideError) { return ( <LoadingError onRetry={this.fetchRetry} message={t('There was an error loading a component.')} /> ); } if (!Component && !hideBusy) return <LoadingIndicator />; return <Component {...otherProps} />; } } export default LazyLoad;
25.663866
91
0.625082
false
true
true
false
12767b490ea28d0d84a758d69464f119a3ffe1fb
19,530
jsx
JSX
app/src/pages/inside/stepPage/modals/postIssueModal/postIssueModal.jsx
zmilonas/service-ui
77391693b2a2a52b54c60b9c28d1c5ccc11b8f4d
[ "Apache-2.0" ]
54
2016-09-15T09:05:38.000Z
2021-12-13T22:42:33.000Z
app/src/pages/inside/stepPage/modals/postIssueModal/postIssueModal.jsx
zmilonas/service-ui
77391693b2a2a52b54c60b9c28d1c5ccc11b8f4d
[ "Apache-2.0" ]
1,549
2016-11-22T09:57:10.000Z
2022-03-31T12:15:25.000Z
app/src/pages/inside/stepPage/modals/postIssueModal/postIssueModal.jsx
zmilonas/service-ui
77391693b2a2a52b54c60b9c28d1c5ccc11b8f4d
[ "Apache-2.0" ]
115
2016-09-15T09:40:46.000Z
2022-03-03T14:37:46.000Z
/* * Copyright 2019 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { reduxForm } from 'redux-form'; import track from 'react-tracking'; import classNames from 'classnames/bind'; import { injectIntl, defineMessages } from 'react-intl'; import { fetch, updateSessionItem, getSessionItem } from 'common/utils'; import { URLS } from 'common/urls'; import { JIRA, RALLY } from 'common/constants/pluginNames'; import { COMMON_LOCALE_KEYS } from 'common/constants/localization'; import { activeProjectSelector, userIdSelector } from 'controllers/user'; import { namedAvailableBtsIntegrationsSelector, uiExtensionPostIssueFormSelector, } from 'controllers/plugins'; import { showScreenLockAction, hideScreenLockAction } from 'controllers/screenLock'; import { showNotification, NOTIFICATION_TYPES } from 'controllers/notification'; import { btsIntegrationBackLinkSelector } from 'controllers/testItem'; import { withModal } from 'components/main/modal'; import { DynamicFieldsSection } from 'components/fields/dynamicFieldsSection'; import { normalizeFieldsWithOptions, mapFieldsToValues, } from 'components/fields/dynamicFieldsSection/utils'; import { FieldProvider } from 'components/fields/fieldProvider'; import { InputCheckbox } from 'components/inputs/inputCheckbox'; import { ISSUE_TYPE_FIELD_KEY } from 'components/integrations/elements/bts/constants'; import { BtsIntegrationSelector } from 'pages/inside/common/btsIntegrationSelector'; import { DarkModalLayout } from 'components/main/modal/darkModalLayout'; import { GhostButton } from 'components/buttons/ghostButton'; import { hideModalAction } from 'controllers/modal'; import ErrorInlineIcon from 'common/img/error-inline.svg'; import Parser from 'html-react-parser'; import { ItemsList } from '../makeDecisionModal/optionsSection/itemsList'; import { JiraCredentials } from './jiraCredentials'; import { RallyCredentials } from './rallyCredentials'; import { INCLUDE_ATTACHMENTS_KEY, INCLUDE_LOGS_KEY, INCLUDE_COMMENTS_KEY, LOG_QUANTITY, } from './constants'; import { validate, createFieldsValidationConfig, getDataSectionConfig, getDefaultIssueModalConfig, getDefaultOptionValueKey, } from './utils'; import styles from './postIssueModal.scss'; const cx = classNames.bind(styles); const SYSTEM_CREDENTIALS_BLOCKS = { [JIRA]: JiraCredentials, [RALLY]: RallyCredentials, }; let validationConfig = null; const messages = defineMessages({ post: { id: 'PostIssueModal.post', defaultMessage: 'Post', }, postIssue: { id: 'PostIssueModal.postIssue', defaultMessage: 'Post issue', }, systemUrlInfo: { id: 'PostIssueModal.systemUrlInfo', defaultMessage: 'Issue will be posted to {systemUrl}', }, includeDataHeader: { id: 'PostIssueModal.includeDataHeader', defaultMessage: 'Include data', }, attachmentsHeader: { id: 'PostIssueModal.attachmentsHeader', defaultMessage: 'Attachments', }, logsHeader: { id: 'PostIssueModal.logsHeader', defaultMessage: 'Logs', }, commentsHeader: { id: 'PostIssueModal.commentsHeader', defaultMessage: 'Comments', }, credentialsHeader: { id: 'PostIssueModal.credentialsHeader', defaultMessage: '{system} Credentials:', }, noDefaultPropertiesMessage: { id: 'PostIssueModal.noDefaultPropertiesMessage', defaultMessage: 'Configure Bug Tracking System integration default properties to post bugs', }, postIssueSuccess: { id: 'PostIssueModal.postIssueSuccess', defaultMessage: 'Ticket has been created.', }, postIssueForTheTest: { id: 'PostIssueModal.postIssueForTheTest', defaultMessage: 'Post Issue for the test {launchNumber}', }, postIssueFailed: { id: 'PostIssueModal.postIssueFailed', defaultMessage: 'Failed to post issue', }, cancel: { id: 'PostIssueModal.cancel', defaultMessage: 'Cancel', }, }); @withModal('postIssueModal') @reduxForm({ form: 'postIssueForm', validate: (fields) => validate(fields, validationConfig), }) @track() @connect( (state) => ({ activeProject: activeProjectSelector(state), namedBtsIntegrations: namedAvailableBtsIntegrationsSelector(state), userId: userIdSelector(state), getBtsIntegrationBackLink: (itemId) => btsIntegrationBackLinkSelector(state, itemId), postIssueExtensions: uiExtensionPostIssueFormSelector(state), }), { showScreenLockAction, hideScreenLockAction, showNotification, hideModalAction, }, ) @injectIntl export class PostIssueModal extends Component { static propTypes = { intl: PropTypes.object.isRequired, activeProject: PropTypes.string.isRequired, namedBtsIntegrations: PropTypes.object.isRequired, userId: PropTypes.string.isRequired, showScreenLockAction: PropTypes.func.isRequired, hideScreenLockAction: PropTypes.func.isRequired, showNotification: PropTypes.func.isRequired, initialize: PropTypes.func.isRequired, handleSubmit: PropTypes.func.isRequired, change: PropTypes.func.isRequired, getBtsIntegrationBackLink: PropTypes.func.isRequired, dirty: PropTypes.bool.isRequired, postIssueExtensions: PropTypes.array, data: PropTypes.shape({ items: PropTypes.array, fetchFunc: PropTypes.func, eventsInfo: PropTypes.object, }).isRequired, tracking: PropTypes.shape({ trackEvent: PropTypes.func, getTrackingData: PropTypes.func, }).isRequired, hideModalAction: PropTypes.func, invalid: PropTypes.bool, }; static defaultProps = { postIssueExtensions: [], data: { items: [], fetchFunc: () => {}, eventsInfo: {}, }, }; constructor(props) { super(props); const { data: { items }, } = props; const { pluginName, integration, ...config } = getDefaultIssueModalConfig( props.namedBtsIntegrations, props.userId, ); const { id, integrationParameters: { defectFormFields }, } = integration; const systemAuthConfig = this.getSystemAuthDefaultConfig(pluginName, config); const fields = this.initIntegrationFields(defectFormFields, systemAuthConfig, pluginName); const selectedItems = this.isBulkOperation ? items.map((item) => { return { ...item, itemId: item.id }; }) : items; this.state = { fields, pluginName, integrationId: id, expanded: true, wasExpanded: false, loading: false, testItems: selectedItems, selectedItems, }; } onPost = () => { this.props.handleSubmit(this.prepareDataToSend)(); }; onChangePlugin = (pluginName) => { if (pluginName === this.state.pluginName) { return; } const { id, integrationParameters } = this.props.namedBtsIntegrations[pluginName][0]; const systemAuthConfig = this.getSystemAuthDefaultConfig(pluginName); const fields = this.initIntegrationFields( integrationParameters.defectFormFields, systemAuthConfig, pluginName, ); this.setState({ pluginName, fields, integrationId: id, }); }; onChangeIntegration = (integrationId) => { if (integrationId === this.state.integrationId) { return; } const { integrationParameters } = this.props.namedBtsIntegrations[this.state.pluginName].find( (item) => item.id === integrationId, ); const fields = this.initIntegrationFields(integrationParameters.defectFormFields); this.setState({ fields, integrationId, }); }; trackFieldClick = (e, eventFn) => { this.props.tracking.trackEvent(eventFn(e.target.checked)); }; getCloseConfirmationConfig = () => { if (!this.props.dirty) { return null; } return { confirmationWarning: this.props.intl.formatMessage(COMMON_LOCALE_KEYS.CLOSE_MODAL_WARNING), }; }; getSystemAuthDefaultConfig = (pluginName, config) => { const systemAuthConfig = {}; if (this.isJiraIntegration(pluginName)) { const storedConfig = config || getSessionItem(`${this.props.userId}_settings`) || {}; systemAuthConfig.username = storedConfig.username; } return systemAuthConfig; }; dataFieldsConfig = [ { name: INCLUDE_ATTACHMENTS_KEY, title: this.props.intl.formatMessage(messages.attachmentsHeader), eventFn: this.props.data.eventsInfo && this.props.data.eventsInfo.attachmentsSwitcher, }, { name: INCLUDE_LOGS_KEY, title: this.props.intl.formatMessage(messages.logsHeader), eventFn: this.props.data.eventsInfo && this.props.data.eventsInfo.logsSwitcher, }, { name: INCLUDE_COMMENTS_KEY, title: this.props.intl.formatMessage(messages.commentsHeader), eventFn: this.props.data.eventsInfo && this.props.data.eventsInfo.commentSwitcher, }, ]; initIntegrationFields = (defectFormFields = [], defaultConfig = {}, pluginName) => { const defaultOptionValueKey = getDefaultOptionValueKey(pluginName); const fields = normalizeFieldsWithOptions(defectFormFields, defaultOptionValueKey).map((item) => item.fieldType === ISSUE_TYPE_FIELD_KEY ? { ...item, disabled: true } : item, ); validationConfig = createFieldsValidationConfig(fields); this.props.initialize({ ...defaultConfig, ...getDataSectionConfig(!this.isBulkOperation), ...mapFieldsToValues(fields), }); return fields; }; prepareDataToSend = (formData) => { const { getBtsIntegrationBackLink } = this.props; const { selectedItems } = this.state; const fields = this.state.fields.map((field) => ({ ...field, value: formData[field.id] })); const backLinks = selectedItems.reduce( (acc, item) => ({ ...acc, [item.id]: getBtsIntegrationBackLink(item) }), {}, ); const data = { [INCLUDE_COMMENTS_KEY]: formData[INCLUDE_COMMENTS_KEY], [INCLUDE_ATTACHMENTS_KEY]: formData[INCLUDE_ATTACHMENTS_KEY], [INCLUDE_LOGS_KEY]: formData[INCLUDE_LOGS_KEY], logQuantity: LOG_QUANTITY, item: selectedItems[0].id, fields, backLinks, }; if (this.isJiraIntegration()) { data.password = formData.password; data.username = formData.username; } else { data.token = formData.token; } this.postIssue(data); }; postIssue = (data) => { const { intl: { formatMessage }, data: { fetchFunc }, namedBtsIntegrations, activeProject, userId, } = this.props; const { pluginName, integrationId, selectedItems } = this.state; const currentExtension = this.getCurrentExtension(); const extensionAction = currentExtension && currentExtension.action; this.props.showScreenLockAction(); const fetchAction = extensionAction ? extensionAction(data, integrationId) : fetch(URLS.btsIntegrationPostTicket(activeProject, integrationId), { method: 'post', data, }); fetchAction .then((response) => { const { integrationParameters: { project, url }, } = namedBtsIntegrations[pluginName].find((item) => item.id === integrationId); const issues = selectedItems.map(({ id, issue = {} }) => ({ testItemId: id, issue: { ...issue, externalSystemIssues: [ ...(issue.externalSystemIssues || []), { ticketId: response.id, url: response.url, btsProject: project, btsUrl: url, }, ], }, })); return fetch(URLS.testItem(activeProject), { method: 'put', data: { issues }, }); }) .then(() => { fetchFunc(); this.props.hideScreenLockAction(); this.props.hideModalAction(); const sessionConfig = { pluginName, integrationId, }; if (this.isJiraIntegration()) { sessionConfig.username = data.username; } updateSessionItem(`${userId}_settings`, sessionConfig); this.props.showNotification({ message: formatMessage(messages.postIssueSuccess), type: NOTIFICATION_TYPES.SUCCESS, }); }) .catch(() => { this.props.hideScreenLockAction(); this.props.showNotification({ message: formatMessage(messages.postIssueFailed), type: NOTIFICATION_TYPES.ERROR, }); }); }; isJiraIntegration = (pluginName = this.state.pluginName) => pluginName === JIRA; expandCredentials = () => { this.setState({ expanded: !this.state.expanded, wasExpanded: true, }); }; componentDidMount() { const { intl, activeProject } = this.props; const { testItems } = this.state; const fetchLogs = () => { this.setState({ loading: true }); const itemIds = testItems.map((item) => item.id); fetch(URLS.bulkLastLogs(activeProject), { method: 'post', data: { itemIds, logLevel: 'ERROR' }, }) .then((testItemLogs) => { const items = []; testItems.forEach((elem) => { items.push({ ...elem, logs: testItemLogs[elem.id] }); }); this.setState({ testItems: items, loading: false, }); }) .catch(() => { this.setState({ testItems: [], selectedItems: [], loading: false, }); this.props.showNotification({ message: intl.formatMessage(messages.linkIssueFailed), type: NOTIFICATION_TYPES.ERROR, }); }); }; fetchLogs(); } isBulkOperation = this.props.data.items.length > 1; renderIssueFormHeaderElements = () => { const { intl: { formatMessage }, } = this.props; return ( <> <GhostButton onClick={this.props.hideModalAction} transparentBorder transparentBackground appearance="topaz" > {formatMessage(messages.cancel)} </GhostButton> <GhostButton onClick={this.onPost} disabled={this.props.invalid} color="''" appearance="topaz" > {formatMessage(messages.postIssue)} </GhostButton> </> ); }; renderTitle = (collapsedRightSection) => { const { data: { items }, intl: { formatMessage }, } = this.props; return collapsedRightSection ? formatMessage(messages.postIssueForTheTest, { launchNumber: items.launchNumber && `#${items.launchNumber}`, }) : formatMessage(messages.post); }; setItems = (newState) => { this.setState(newState); }; renderRightSection = (collapsedRightSection) => { const { testItems, selectedItems, loading } = this.state; return ( <div className={cx('items-list')}> <ItemsList setItems={this.setItems} testItems={testItems} selectedItems={selectedItems} isNarrowView={collapsedRightSection} isBulkOperation={this.isBulkOperation} loading={loading} eventsInfo={this.props.data.eventsInfo} /> </div> ); }; getCurrentExtension = () => { const { postIssueExtensions } = this.props; const { pluginName } = this.state; return postIssueExtensions.find((ext) => ext.pluginName === pluginName); }; render() { const { namedBtsIntegrations, intl: { formatMessage }, data: { eventsInfo }, } = this.props; const { pluginName, integrationId, fields, expanded, wasExpanded } = this.state; const CredentialsComponent = SYSTEM_CREDENTIALS_BLOCKS[pluginName]; const currentExtension = this.getCurrentExtension(); const layoutEventsInfo = { openCloseRightSection: eventsInfo.openCloseRightSection, }; return ( <DarkModalLayout renderHeaderElements={this.renderIssueFormHeaderElements} renderTitle={this.renderTitle} renderRightSection={this.renderRightSection} eventsInfo={layoutEventsInfo} > {() => ( <form className={cx('post-issue-form', 'dark-view')}> <BtsIntegrationSelector namedBtsIntegrations={namedBtsIntegrations} pluginName={pluginName} integrationId={integrationId} onChangeIntegration={this.onChangeIntegration} onChangePluginName={this.onChangePlugin} darkView /> {fields.length ? ( <DynamicFieldsSection withValidation fields={fields} defaultOptionValueKey={getDefaultOptionValueKey(pluginName)} darkView /> ) : ( <div className={cx('no-default-properties-message')}> <div className={cx('icon')}>{Parser(ErrorInlineIcon)}</div> <span>{formatMessage(messages.noDefaultPropertiesMessage)}</span> </div> )} {!this.isBulkOperation && ( <div className={cx('include-block-wrapper')}> <h4 className={cx('form-block-header', 'dark-view')}> <span className={cx('header-text', 'dark-view')}> {formatMessage(messages.includeDataHeader)} </span> </h4> <div className={cx('include-data-block')}> {this.dataFieldsConfig.map((item) => ( <FieldProvider key={item.name} name={item.name} format={Boolean} onChange={(e) => this.trackFieldClick(e, item.eventFn)} > <InputCheckbox> <span className={cx('switch-field-label', 'dark-view')}>{item.title}</span> </InputCheckbox> </FieldProvider> ))} </div> </div> )} {currentExtension && <currentExtension.component />} {CredentialsComponent && ( <div className={cx('credentials-block-wrapper', { expanded })}> <h4 className={cx('form-block-header', 'dark-view')}> <span onClick={this.expandCredentials} className={cx('header-text', 'dark-view')}> {formatMessage(messages.credentialsHeader, { system: pluginName, })} </span> </h4> <div className={cx('credentials-block', { expand: wasExpanded })}> <CredentialsComponent darkView /> </div> </div> )} </form> )} </DarkModalLayout> ); } }
31.298077
100
0.627496
false
true
true
false
12767bfe87e5f01b466756fb8f9862a072889007
468
jsx
JSX
src/components/Profile.jsx
andresV74/project-react-01
618db08d270629fc2270a0129b856d0fd1c1a520
[ "MIT" ]
null
null
null
src/components/Profile.jsx
andresV74/project-react-01
618db08d270629fc2270a0129b856d0fd1c1a520
[ "MIT" ]
null
null
null
src/components/Profile.jsx
andresV74/project-react-01
618db08d270629fc2270a0129b856d0fd1c1a520
[ "MIT" ]
null
null
null
import React from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faIdBadge } from '@fortawesome/free-solid-svg-icons'; import '../styles/components/Profile.styl' const badgeIcon = <FontAwesomeIcon icon={faIdBadge} /> const Profile = ({ description }) => ( <section className="Profile"> <h2 className="Profile-title">{badgeIcon} Profile</h2> <p className="Profile-desc">{description}</p> </section> ) export default Profile
29.25
65
0.728632
true
false
false
true
12767e92f897e5404ef969940591c1499d7e2368
787
jsx
JSX
src/components/icons/IconGoogle.client.jsx
pieroenrico/tune-me-in
0264abd147efb518e78a55fc8b6a4a020b103681
[ "MIT" ]
null
null
null
src/components/icons/IconGoogle.client.jsx
pieroenrico/tune-me-in
0264abd147efb518e78a55fc8b6a4a020b103681
[ "MIT" ]
null
null
null
src/components/icons/IconGoogle.client.jsx
pieroenrico/tune-me-in
0264abd147efb518e78a55fc8b6a4a020b103681
[ "MIT" ]
null
null
null
export default function IconGoogle({ ariaHidden, tabIndex, role, color }) { return ( <svg aria-hidden="{ariaHidden}" tabIndex="{tabIndex}" role="{role}" className="icon icon-google" viewBox="0 0 32 32"><path fill="{color}" d="M20.383,14.498c0.836,3.064-0.664,11.986-9.897,11.986C4.691,26.484,0,21.793,0,16S4.691,5.516,10.485,5.516 c2.832,0,5.191,1.029,7.022,2.746l-2.846,2.732c-0.772-0.744-2.132-1.617-4.177-1.617c-3.576,0-6.494,2.961-6.494,6.623 s2.918,6.623,6.494,6.623c4.147,0,5.707-2.99,5.95-4.521h-5.95v-3.604H20.383L20.383,14.498z M28.957,14.85v-3.044h-3.059v3.044 h-3.043v3.058h3.043v3.044h3.059v-3.044H32V14.85H28.957L28.957,14.85z" /></svg> ) } IconGoogle.defaultProps = { ariaHidden: true, tabIndex: -1, role: 'presentation', color: '#000000' }
65.583333
572
0.677255
false
true
false
true
127685e0d305378d10e386b594a6a8703ef4010b
536
jsx
JSX
src/component/greatPeopleItem.jsx
andyzys/github-previewer
72685e1e6be2c1aefbeec54d6a009a317af7ce40
[ "MIT" ]
null
null
null
src/component/greatPeopleItem.jsx
andyzys/github-previewer
72685e1e6be2c1aefbeec54d6a009a317af7ce40
[ "MIT" ]
null
null
null
src/component/greatPeopleItem.jsx
andyzys/github-previewer
72685e1e6be2c1aefbeec54d6a009a317af7ce40
[ "MIT" ]
null
null
null
import React from 'react'; export default class GreatPeopleItem extends React.Component{ constructor(props) { super(props); } render() { let data = this.props.data.people; let index = this.props.data.index; return( <div className="greatPeopleItem"> <h2 className="rank">{index + 1}</h2> <img className="user-icon" src={data.avatar_url} alt=""/> <a href={data.html_url} target="__blank"> <p className="login">{data.login}</p> </a> </div> ) } }
24.363636
61
0.583955
false
true
true
false
127688e4ca409e546ed1bbdc4bce0ba7a8c72a14
440
jsx
JSX
src/components/H4Box.jsx
Promisemasimba/gatsby-starter-coming-soon
7f5c595e5d69c181f08e2200bf041f2110a63865
[ "MIT" ]
1
2018-05-09T12:57:43.000Z
2018-05-09T12:57:43.000Z
src/components/H4Box.jsx
Promisemasimba/gatsby-starter-coming-soon
7f5c595e5d69c181f08e2200bf041f2110a63865
[ "MIT" ]
null
null
null
src/components/H4Box.jsx
Promisemasimba/gatsby-starter-coming-soon
7f5c595e5d69c181f08e2200bf041f2110a63865
[ "MIT" ]
2
2020-04-06T22:28:48.000Z
2021-02-07T21:56:18.000Z
import styled from 'styled-components' import { Box } from 'grid-styled' import { space, width, fontSize, color } from 'styled-system' const H4Box = styled(Box)` ${space} ${width} ${fontSize} ${color} font-family: 'Raleway',sans-serif; font-weight: 200; text-rendering: optimizeLegibility; font-size: 1rem; line-height: 1.1; text-align: ${props => props.center ? 'center' : 'inherit'}; ` export default H4Box
17.6
62
0.663636
false
true
false
true
12769239acc7f5989052e1e2afebda5b7d1690d0
7,249
jsx
JSX
src/components/SubPages/about-us.jsx
a2uned-solutions/a2unedsolutions.com
a200a1df12f265e6abbf3eda83e9feb0e62e1646
[ "MIT" ]
null
null
null
src/components/SubPages/about-us.jsx
a2uned-solutions/a2unedsolutions.com
a200a1df12f265e6abbf3eda83e9feb0e62e1646
[ "MIT" ]
null
null
null
src/components/SubPages/about-us.jsx
a2uned-solutions/a2unedsolutions.com
a200a1df12f265e6abbf3eda83e9feb0e62e1646
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { ExpansionList, ExpansionPanel } from 'react-md'; import ContactFormDrawer from '../ContactForm/index'; import bryan from '../../../static/assets/bryan.jpg'; import dan from '../../../static/assets/dan.jpg'; import michigan from '../../../static/assets/michigan.svg'; import nathan from '../../../static/assets/nathan.jpg'; import contractors from '../../../static/assets/contractors.jpg'; class AboutUs extends Component { render() { return ( <div className="page-content" id="main-content"> <div className="page-intro"> <p>Over ten years of experience in the Information Technology industry. We've worked with Fortune 500 companies, medium sized businesses, and Ma & Pa Shops.</p> <p>There isn't much we can't handle or provide a solution for. We're willing to go the distance for great clients.</p> <h2 className="made-in-michigan"> <strong> <span>Founded in 2017. Proudly Made in Michigan</span> <img src={michigan} alt="Ann Arbor, Michigan" /> </strong> </h2> </div> <ul className="grid-list"> <li> <div className="member-image" style={{ backgroundImage: `url(${nathan})` }} /> <div className="member-info"> <h2>Nathan Olmstead</h2> <h3>Partner</h3> <p>Designer, Developer, and Chef are his favorite hats to wear. Attempting to keep up with the pace of change Nathan is always eager to learn and peek into the next rabbit hole. He's built more UI configurators than you count on one hand.</p> <ul className="social"> <li> <a href="https://www.linkedin.com/in/nathanolmstead/" title="LinkedIn"> <i className="fa fa-linkedin" aria-hidden="true"></i> </a> </li> <li> <a href="https://twitter.com/disruptingnate/" title="Twitter"> <i className="fa fa-twitter" aria-hidden="true"></i> </a> </li> <li> <a href="https://github.com/nathanolmstead" title="GitHub"> <i className="fa fa-github"></i> </a> </li> </ul> </div> <ExpansionList> <ExpansionPanel className="expansion-panel" label="More About Nathan" footer={null}> <p className="expansion-details"> Designer, Developer, and Chef are his favorite hats to wear. Attempting to keep up with the pace of change Nathan is always eager to learn and peek into the next rabbit hole. He's built more UI configurators than you count on one hand. </p> </ExpansionPanel> </ExpansionList> </li> <li> <div className="member-image" style={{ backgroundImage: `url(${dan})` }} /> <div className="member-info"> <h2>Dan Shields</h2> <h3>Partner</h3> <p>Technical Delivery Leader, Solution Architect, and Football Coach are some of this code whisperers skills. Dan has developed, managed, and delivered multiple large scale ecommerce builds and complex custom applications.</p> <ul className="social"> <li> <a href="https://www.linkedin.com/in/danshields/" title="LinkedIn"> <i className="fa fa-linkedin" aria-hidden="true"></i> </a> </li> </ul> </div> <ExpansionList> <ExpansionPanel className="expansion-panel" label="More About Dan" footer={null}> <p className="expansion-details"> Technical Delivery Leader, Solution Architect, and Football Coach are some of this code whisperers skills. Dan has developed, managed, and delivered multiple large scale ecommerce builds and complex custom applications. </p> </ExpansionPanel> </ExpansionList> </li> <li> <div className="member-image" style={{ backgroundImage: `url(${bryan})` }} /> <div className="member-info"> <h2>Bryan Sabolich</h2> <h3>Partner</h3> <p>Front end code wrangler, Certified Scrum Master, and Grill Master are just a few of the items Bryan brings to the table. With dozens of ecommerce builds and countless features delivered his track record speaks for it's self.</p> <ul className="social"> <li> <a href="https://www.linkedin.com/in/bryansabolich/" title="LinkedIn"> <i className="fa fa-linkedin" aria-hidden="true"></i> </a> </li> </ul> </div> <ExpansionList> <ExpansionPanel className="expansion-panel" label="More About Bryan" footer={null}> <p className="expansion-details"> Front end code wrangler, Certified Scrum Master, and Grill Master are just a few of the items Bryan brings to the table. With dozens of ecommerce builds and countless features delivered his track record speaks for itself. </p> </ExpansionPanel> </ExpansionList> </li> <li> <div className="member-image" style={{ backgroundImage: `url(${contractors})` }} /> <div className="member-info"> <h2>Trusted, Talented, Local</h2> <h3>Contractors</h3> <p>Information Architects, Art Directors, User Experience Designers, SEO Analyst, Quality Assurance Analyst, Engineers, and more. <strong>We've met some amazing people over the years that we still love working with.</strong></p> </div> <ExpansionList> <ExpansionPanel className="expansion-panel" label="More About Our Friends" footer={null}> <p className="expansion-details"> Information Architects, Art Directors, User Experience Designers, SEO Analyst, Quality Assurance Analyst, Engineers, and more. <strong>We've met some amazing people over the years that we still love working with.</strong> </p> </ExpansionPanel> </ExpansionList> </li> </ul> <div className="secondary-content"> <p> We are an experienced team of industry leaders, with a track record of delivering quality products & services for some amazing businesses. This team has delivered multiple custom solutions. Including product configurators, advanced reporting interfaces, and highly branded interfaces. Modern design and development patterns make us tick. We also work with a variety of industry subject matter experts. Team Leaders, Art Directors, Information Architects, DevOps, and Quality Assurance. All trusted individuals we consider friends and have worked with for many years. </p> <ContactFormDrawer button="true" /> </div> </div> ); } } export default AboutUs;
56.193798
578
0.587391
false
true
true
false
12769610fbfa81c7ce081ad5dd2237cc9fc0afbf
190
jsx
JSX
pages/events2/[event]/index.jsx
delimarenata/site-1
8fe2c081d84a7e64261436571775d0ca256ef14b
[ "MIT" ]
1
2020-11-13T13:43:39.000Z
2020-11-13T13:43:39.000Z
pages/events2/[event]/index.jsx
delimarenata/site-1
8fe2c081d84a7e64261436571775d0ca256ef14b
[ "MIT" ]
28
2020-10-05T18:59:42.000Z
2020-11-04T20:58:33.000Z
pages/events2/[event]/index.jsx
delimarenata/site-1
8fe2c081d84a7e64261436571775d0ca256ef14b
[ "MIT" ]
1
2021-01-19T16:41:51.000Z
2021-01-19T16:41:51.000Z
import React from 'react'; import EventDetailTemplate from 'components/templates/event-detail/event-detail'; const EventDetail = () => <EventDetailTemplate />; export default EventDetail;
27.142857
81
0.784211
false
true
false
true
12769ce02d98f57741f224c21cd642d6087b1fe5
3,203
jsx
JSX
catalog-rest-service/src/main/resources/ui/src/components/scorecard/Filters.jsx
pemmasanikrishna/OpenMetadata
ac19aad62001a7c849cb1299cc09e68feed8d1e7
[ "Apache-2.0" ]
null
null
null
catalog-rest-service/src/main/resources/ui/src/components/scorecard/Filters.jsx
pemmasanikrishna/OpenMetadata
ac19aad62001a7c849cb1299cc09e68feed8d1e7
[ "Apache-2.0" ]
null
null
null
catalog-rest-service/src/main/resources/ui/src/components/scorecard/Filters.jsx
pemmasanikrishna/OpenMetadata
ac19aad62001a7c849cb1299cc09e68feed8d1e7
[ "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, { useEffect, useState } from 'react'; import { Col, Row } from 'react-bootstrap'; import Select from 'react-select'; import { getTeams } from '../../axiosAPIs/userAPI'; import SVGIcons, { Icons } from '../../utils/SvgUtils'; const tierOptions = [ { label: 'Tier 1', value: 'Tier 1' }, { label: 'Tier 2', value: 'Tier 2' }, { label: 'Tier 3', value: 'Tier 3' }, ]; const dateFilters = ['Today', 'Month', 'Year']; const Filters = () => { const [teamOptions, setTeamOptions] = useState({}); const [selectedTeam, setSelectedTeam] = useState({ label: 'All', value: 'All', }); const [selectedTier, setSelectedTier] = useState({ label: 'Tier 1', value: 'Tier 1', }); const [dateFilter, setSelectedDateFilter] = useState('Today'); useEffect(() => { getTeams().then((res) => { const teamsList = res.data; const teamsArr = teamsList.map((obj) => { return { label: obj.instance?.name, value: obj.instance?.name }; }); setTeamOptions(teamsArr); }); }, []); const handleTeam = (selectedOption) => { setSelectedTeam(selectedOption); }; const handleTier = (selectedOption) => { setSelectedTier(selectedOption); }; const handleDateFilter = (value) => { setSelectedDateFilter(value); }; return ( <div className="filter-wrapper"> <div className="left-side-filter"> <Row style={{ minWidth: '100%', marginLeft: '0px' }}> <SVGIcons alt="Filter" icon={Icons.FILTERS} /> <span className="ml-3 scorecard-filter">Teams :</span> <Col sm={2}> <Select options={teamOptions} value={selectedTeam} onChange={handleTeam} /> </Col> <span className="ml-3 scorecard-filter">Tiers :</span> <Col sm={2}> <Select options={tierOptions} value={selectedTier} onChange={handleTier} /> </Col> </Row> </div> <div> {dateFilters.map((filter) => ( <span className={`date-filter ${ filter === dateFilter ? 'selected-date-filter' : '' }`} key={filter} onClick={() => handleDateFilter(filter)}> {filter} </span> ))} </div> </div> ); }; export default Filters;
30.216981
76
0.592882
false
true
false
true
1276a133a3aa02252df756c166d4fd1eec42785b
2,149
jsx
JSX
packages/uxcool/src/components/select/mixins/sub.jsx
cloud-SN1/uxcool
1203d90e68d3410f5a447504e0976e2b79c5f054
[ "MIT" ]
38
2020-05-21T15:24:30.000Z
2020-05-26T06:56:23.000Z
packages/uxcool/src/components/select/mixins/sub.jsx
cloud-SN1/uxcool
1203d90e68d3410f5a447504e0976e2b79c5f054
[ "MIT" ]
1
2021-03-03T07:28:12.000Z
2021-03-04T08:11:13.000Z
packages/uxcool/src/components/select/mixins/sub.jsx
cloud-SN1/uxcool
1203d90e68d3410f5a447504e0976e2b79c5f054
[ "MIT" ]
2
2021-03-04T10:05:51.000Z
2021-06-30T01:57:07.000Z
export default { inject: { selectNRoot: { default: false, }, }, computed: { isChildren() { return !!this.selectNRoot; }, rootPrefixCls() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.prefixCls : ''; }, rootSize() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.size : ''; }, rootInnerVisible() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.innerVisible : false; }, rootDisabled() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.disabled : false; }, rootAllowClear() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.allowClear : false; }, rootIsCombobox() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.isCombobox : false; }, rootIsMultiple() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.isMultipleOrTags : false; }, rootSearchInputValue() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.searchInputValue : false; }, rootClearDisabled() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.clearDisabled : true; }, rootTokenSeparators() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.tokenSeparators : []; }, rootGetInputElement() { const { selectNRoot, isChildren } = this; return isChildren ? selectNRoot.getInputElement : null; }, }, methods: { onTokenSeparator(value) { const { isChildren, selectNRoot } = this; return isChildren ? selectNRoot.onTokenSeparator(value) : false; }, onSearchInput(e, value) { const { isChildren, selectNRoot } = this; return isChildren ? selectNRoot.setSearchInputValue(value) : false; }, onSelectorClear(e) { const { isChildren, selectNRoot } = this; return isChildren ? selectNRoot.onClear(e) : false; }, }, };
30.267606
73
0.624477
false
true
false
true
1276a1f85c28103e6a852ebe9b029da80cedc8a1
4,658
jsx
JSX
src/components/about.jsx
naeemhassan09/naeemulhassan
adfae13ccfc01a5c763c0927cf7f2d6a5256199e
[ "MIT" ]
null
null
null
src/components/about.jsx
naeemhassan09/naeemulhassan
adfae13ccfc01a5c763c0927cf7f2d6a5256199e
[ "MIT" ]
null
null
null
src/components/about.jsx
naeemhassan09/naeemulhassan
adfae13ccfc01a5c763c0927cf7f2d6a5256199e
[ "MIT" ]
null
null
null
import React, { Component } from 'react' export default class About extends Component { render() { return ( <div> <section className="colorlib-about" data-section="about"> <div className="colorlib-narrow-content"> <div className="row"> <div className="col-md-12"> <div className="row row-bottom-padded-sm animate-box" data-animate-effect="fadeInLeft"> <div className="col-md-12"> <div className="about-desc"> <span className="heading-meta">About Us</span> <h2 className="colorlib-heading">Who Am I?</h2> <p>I am a Research & Development Engineer at INNEXIV PVT Ltd Pakistan. I have completed my Electrical(Computer) Engineering from Fast-Lahore and my MBA (Supply Chain Management) from Bahria University Islamabad.</p> <p>I have started reflecting my ideas and thougths through the medium of words recently so spelling and grammer mistaks are very often.You can write me back if you spot any and don't want to live anymore :P </p> </div> </div> </div> </div> </div> </div> </section> <section className="colorlib-about"> <div className="colorlib-narrow-content"> <div className="row"> <div className="col-md-6 col-md-offset-3 col-md-pull-3 animate-box" data-animate-effect="fadeInLeft"> <span className="heading-meta">What I do?</span> <h2 className="colorlib-heading">Here are some of my expertise</h2> </div> </div> <div className="row row-pt-md"> <div className="col-md-4 text-center animate-box"> <div className="services color-1"> <span className="icon"> <i className="icon-bulb" /> </span> <div className="desc"> <h3>Web Development </h3> <p>I have experience building websites/web Applications using JavaScript,React,HTML,CSS, Ruby on Rails, python Flask</p> </div> </div> </div> <div className="col-md-4 text-center animate-box"> <div className="services color-3"> <span className="icon"> <i className="icon-phone3" /> </span> <div className="desc"> <h3>Data Structures & Algorithms</h3> <p>As coming from the CS background, I have good grasp over fundamental concepts of DSA</p> </div> </div> </div> <div className="col-md-4 text-center animate-box"> <div className="services color-5"> <span className="icon"> <i className="icon-data" /> </span> <div className="desc"> <h3>Dev Ops</h3> <p>I am pursuing my internship with DevOps team at Juniper and working with tools like Jenkins, Docker, K8s</p> </div> </div> </div> {/* <div className="col-md-4 text-center animate-box"> <div className="services color-2"> <span className="icon"> <i className="icon-data" /> </span> <div className="desc"> <h3>Dev Ops</h3> <p>Jenkins , Kubernetes , Docker </p> </div> </div> </div> <div className="col-md-4 text-center animate-box"> <div className="services color-4"> <span className="icon"> <i className="icon-layers2" /> </span> <div className="desc"> <h3>Graphic Design</h3> <p>My friend knows .. P</p> </div> </div> </div> <div className="col-md-4 text-center animate-box"> <div className="services color-6"> <span className="icon"> <i className="icon-phone3" /> </span> <div className="desc"> <h3>Digital Marketing</h3> <p>I use Instagram eight hours a day :) </p> </div> </div> </div> */} </div> </div> </section> </div> ) } }
42.733945
235
0.477673
false
true
true
false
1276bca8e31d02bc6f838e8d480c95c97da95780
465
jsx
JSX
src/core/Taxes/__tests__/TaxChart.test.jsx
srivanip/qa-entaxy
1786d20657a69e08d0266befcf2450240c36e59e
[ "MIT" ]
10
2018-06-25T03:56:22.000Z
2021-03-23T16:13:46.000Z
src/core/Taxes/__tests__/TaxChart.test.jsx
srivanip/qa-entaxy
1786d20657a69e08d0266befcf2450240c36e59e
[ "MIT" ]
1,622
2018-05-30T18:37:00.000Z
2021-02-11T15:39:13.000Z
src/core/Taxes/__tests__/TaxChart.test.jsx
srivanip/qa-entaxy
1786d20657a69e08d0266befcf2450240c36e59e
[ "MIT" ]
19
2018-06-04T01:51:29.000Z
2020-12-21T21:28:09.000Z
import React from 'react' import { mount } from 'enzyme' import TaxChart from '../TaxChart' describe('TaxChart', () => { it('matches snapshot', () => { const wrapper = mount(( <TaxChart parentWidth={100} parentHeight={100} country="Canada" year={2017} region="Ontario" income={10000} rrsp={0} taxBeforeCredits={10000} /> )) expect(wrapper.debug()).toMatchSnapshot() }) })
21.136364
45
0.554839
false
true
false
true
1276c0e7f8c5ddbac86c57c7ed6aad6da4e3e591
356
jsx
JSX
src/view/components/AppFooter.jsx
xoposhiy/clean-code-game
ceb5fa05c5d0456097f227d231225854568f5054
[ "MIT" ]
null
null
null
src/view/components/AppFooter.jsx
xoposhiy/clean-code-game
ceb5fa05c5d0456097f227d231225854568f5054
[ "MIT" ]
null
null
null
src/view/components/AppFooter.jsx
xoposhiy/clean-code-game
ceb5fa05c5d0456097f227d231225854568f5054
[ "MIT" ]
null
null
null
import React from 'react'; export default function AppFooter() { return <div className="footer"> <div className="container"> <p className="text-muted"> ©2015&nbsp; <a href="https://kontur.ru/career"> СКБ Контур </a>. Связаться с&nbsp;<a href="mailto:pe@kontur.ru">автором</a> </p> </div> </div> }
23.733333
72
0.578652
false
true
false
true
1276c1461b7bbf43a773b8b293100e0c294f34d6
844
jsx
JSX
packages/storybook/src/stories/GovernanceBalanceList.stories.jsx
GoHypernet/hypernet-protocol
67b5c26bf2b4fb0dd3ddddcfdfd521a3589918b2
[ "MIT" ]
1
2022-01-13T00:08:22.000Z
2022-01-13T00:08:22.000Z
packages/storybook/src/stories/GovernanceBalanceList.stories.jsx
GoHypernet/hypernet-protocol
67b5c26bf2b4fb0dd3ddddcfdfd521a3589918b2
[ "MIT" ]
3
2022-01-20T22:56:04.000Z
2022-03-17T20:20:31.000Z
packages/storybook/src/stories/GovernanceBalanceList.stories.jsx
GoHypernet/hypernet-protocol
67b5c26bf2b4fb0dd3ddddcfdfd521a3589918b2
[ "MIT" ]
null
null
null
import { GovernanceBalanceList, GovernanceCard, ViewUtils, } from "@hypernetlabs/web-ui"; import { AssetBalance } from "@hypernetlabs/objects"; export default { title: "Layout/GovernanceBalanceList", component: GovernanceBalanceList, }; const balances = [ new AssetBalance("1", "1", "HYPERTOKEN", "HYPR", 8, 1000000, 0, 17), new AssetBalance("2", "2", "ETHEREUM", "ETH", 8, 1000000, 0, 4), new AssetBalance("3", "3", "TOKEN3", "TKN3", 8, 1000000, 0, 0), new AssetBalance("4", "4", "TOKEN4", "TKN4", 8, 1000000, 0, 0), ]; const Template = (args) => ( <div style={{}}> <GovernanceBalanceList {...args} /> <GovernanceCard> <GovernanceBalanceList {...args} /> </GovernanceCard> </div> ); export const Primary = Template.bind({}); Primary.args = { balances: balances, viewUtils: new ViewUtils(), };
23.444444
70
0.637441
false
true
false
true
1276c506c6edc7e360ff9367a078e8954049dbd4
195
jsx
JSX
src/app/Diary/Kanban/Header/index.jsx
qianyin925/blog_client
acbea1c973913947eadfb0dc130ee40335201fa0
[ "MIT" ]
2
2019-03-07T02:35:03.000Z
2019-04-27T04:57:31.000Z
src/app/Diary/Kanban/Header/index.jsx
qianyin925/blog
acbea1c973913947eadfb0dc130ee40335201fa0
[ "MIT" ]
1
2019-09-17T08:53:12.000Z
2019-09-17T08:53:12.000Z
src/app/Diary/Kanban/Header/index.jsx
qianyin925/blog
acbea1c973913947eadfb0dc130ee40335201fa0
[ "MIT" ]
null
null
null
import React from 'react'; import scss from './index.module.scss'; export default (props) => ( <div className={scss.header} {... props.provided.dragHandleProps}> 可拖动部位 </div> );
17.727273
41
0.641026
false
true
false
true
1276ceb43721de7b10d1cffd1f8702f637e7ef23
1,971
jsx
JSX
src/components/Datatable/DataTableNew.jsx
vangavenunath/Timesheet-portal-with-admin-template
dc892d905ad63e173b6c98e76c4b62013357982b
[ "MIT" ]
null
null
null
src/components/Datatable/DataTableNew.jsx
vangavenunath/Timesheet-portal-with-admin-template
dc892d905ad63e173b6c98e76c4b62013357982b
[ "MIT" ]
null
null
null
src/components/Datatable/DataTableNew.jsx
vangavenunath/Timesheet-portal-with-admin-template
dc892d905ad63e173b6c98e76c4b62013357982b
[ "MIT" ]
null
null
null
import React, { useState, useEffect, useRef } from 'react'; import { BASE_URL } from 'components/constants'; import {deleteSelectedUsers, getAllUserDetails} from 'actions/API' const $ = require('jquery'); $.DataTable = require('datatables.net'); export const DatatableLocal = (props) => { const [tableDataItems, setTableDataItems] = useState([{ Name: '', Password:'', CreatedDate: '' }]) const [toggle, setToggle] = useState(true) const columns = [ { title: 'Name', width: 120, data: 'Name' }, { title: 'Password', width: 180, data: 'Password' }, { title: 'CreatedDate', width: 180, data: 'CreatedDate' }, ]; let table = $("#main").DataTable({ dom: '<"data-table-wrapper"t>', data: tableDataItems, columns, ordering: false }) useEffect(() => { getUsers() // return (() => { // $('.data-table-wrapper') // .find('table') // .DataTable() // .destroy(true) // }) },[toggle]) function reloadTableData(tableDataItems) { const table = $('.data-table-wrapper') .find('table') .DataTable(); table.clear(); table.rows.add(tableDataItems); table.draw(); } const getUsers = async() => { getAllUserDetails() .then(result => { let arr = [] for (var row in result.data) { arr.push({ Name: result.data[row][0], Password: result.data[row][1], CreatedDate: result.data[row][2] }) } setTableDataItems(arr); reloadTableData(arr) }) } return ( <div> {console.log(tableDataItems)} <table id="main" /> </div> ) }
24.036585
118
0.471334
false
true
false
true
1276d5356fff3f2ffa084cb7755e97918b771f4a
264
jsx
JSX
client/index.jsx
febriadj/messaging-app
5e09f0f17eb7a4579536243c2e85fa45d9786710
[ "MIT" ]
6
2021-12-25T09:26:13.000Z
2022-02-28T20:49:09.000Z
client/index.jsx
febriadj/messaging-app
5e09f0f17eb7a4579536243c2e85fa45d9786710
[ "MIT" ]
null
null
null
client/index.jsx
febriadj/messaging-app
5e09f0f17eb7a4579536243c2e85fa45d9786710
[ "MIT" ]
null
null
null
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import store from './redux/store'; import App from './app'; ReactDOM.render( <Provider store={store}><App /></Provider>, document.querySelector('#root'), );
22
45
0.693182
false
true
false
true
1276d5cedcf4a44b1f7b98f888c77374ac7f20c8
1,359
jsx
JSX
react_udemy_academind/react_redux_acad_tasks/tasks/task2/task2_redo/task2_repractise/src/App.jsx
Oyelowo/react_redux
a75cb7959baf6c85ef00023665f06dc1297e19db
[ "MIT" ]
null
null
null
react_udemy_academind/react_redux_acad_tasks/tasks/task2/task2_redo/task2_repractise/src/App.jsx
Oyelowo/react_redux
a75cb7959baf6c85ef00023665f06dc1297e19db
[ "MIT" ]
null
null
null
react_udemy_academind/react_redux_acad_tasks/tasks/task2/task2_redo/task2_repractise/src/App.jsx
Oyelowo/react_redux
a75cb7959baf6c85ef00023665f06dc1297e19db
[ "MIT" ]
null
null
null
import React, {Component} from 'react'; import logo from './logo.svg'; import './App.css'; import Char from './Components/Char'; import Validation from './Components/Validation'; class App extends Component { state = { userInput: '' } inputChangeEventHandler = (event) => { this.setState({userInput: event.target.value}) } deletLetters = (index) => { let userInputAltered = this.state.userInput; userInputAltered = userInputAltered.split(''); userInputAltered.splice(index, 1); let updatedUserInput = userInputAltered.join(''); this.setState({userInput : updatedUserInput}) } render() { let letters = this.state.userInput; letters =letters.split(''); let letterList = letters.map((letter, index) => { if (letter === ' ') { return < Char clickDel = { ()=>this.deletLetters(index) } char = '-' /> } else { return < Char clickDel = { ()=>this.deletLetters(index) } char = { letter } /> } }); return ( <div className="App"> <input type="text" value={this.state.userInput} onChange={this.inputChangeEventHandler}/> <p>{this.state.userInput.length}</p> <hr/> <Validation textLength ={this.state.userInput.length}/> <hr/> {letterList} <hr/> </div> ); } } export default App; // z
21.919355
93
0.601177
false
true
true
false
1276e5ece68d21dbcd86e8e30c281fbec197843a
1,979
jsx
JSX
src/Components/NavBar.jsx
javila35/cvp
b5c24cffdb3cbe4f51414d577c4b67114d896b14
[ "MIT" ]
null
null
null
src/Components/NavBar.jsx
javila35/cvp
b5c24cffdb3cbe4f51414d577c4b67114d896b14
[ "MIT" ]
null
null
null
src/Components/NavBar.jsx
javila35/cvp
b5c24cffdb3cbe4f51414d577c4b67114d896b14
[ "MIT" ]
null
null
null
import React from "react"; import { NavLink, useLocation } from "react-router-dom"; const NavBar = () => { const location = useLocation(); const isCalcOpen = location.pathname.includes("/calculator"); return ( <div className="navbar navbar-expand-lg navbar-light bg-light" role="navigation" aria-current="page" style={{ backgroundColor: "#e3f2fd" }} > <div className="container-fluid"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation" > <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav"> <li className="nav-item"> <NavLink className="nav-link" to="/"> Home </NavLink> </li> <li className="nav-item"> <NavLink className="nav-link" to="/about"> About </NavLink> </li> <li className="nav-item"> <NavLink className="nav-link" to="/calculator" /** Open in new tab if the user isn't already on the calculator page */ target={isCalcOpen ? "" : "_blank"} > Calculator </NavLink> </li> {/* <li className="nav-item"> <NavLink className="nav-link" to="/volunteer"> Volunteer </NavLink> </li> <li className="nav-item"> <NavLink className="nav-link" to="/resources"> Resources </NavLink> </li> */} </ul> </div> </div> </div> ); }; export default NavBar;
29.102941
87
0.478525
false
true
false
true
1276ea6a41e8df536e04dedea68d379fe3ed8a83
2,631
jsx
JSX
InDesign/Bullet.jsx
iconifyit/extendscript
e1ca04ea5a9d08f1481ff0833343e87546d8c7f0
[ "MIT" ]
3
2020-05-25T21:41:29.000Z
2020-05-26T02:10:03.000Z
InDesign/Bullet.jsx
iconifyit/extendscript
e1ca04ea5a9d08f1481ff0833343e87546d8c7f0
[ "MIT" ]
null
null
null
InDesign/Bullet.jsx
iconifyit/extendscript
e1ca04ea5a9d08f1481ff0833343e87546d8c7f0
[ "MIT" ]
null
null
null
/* * Bullet character. */ var Bullet = { /* * Returns true if the object specifier resolves to valid objects. * @type {Boolean} */ isValid: undefined, /* * The parent of the Bullet (a TextDefault, ParagraphStyle, Text, InsertionPoint, TextStyleRange, Paragraph, TextColumn, Line, Word, Character, Story, XmlStory, FindTextPreference, ChangeTextPreference, FindGrepPreference, ChangeGrepPreference, FindTransliteratePreference or ChangeTransliteratePreference). * @type {Mixed} */ parent: undefined, /* * A collection of events. * @type {Events} */ events: undefined, /* * A collection of event listeners. * @type {EventListeners} */ eventListeners: undefined, /* * The type of bullet character. * @type {BulletCharacterType} */ characterType: undefined, /* * The bullet character as a unicode ID or a glyph ID. * @type {Number} */ characterValue: undefined, /* * Font of the bullet character. Can return: Font, String or AutoEnum enumerator. * @type {Mixed} */ bulletsFont: undefined, /* * Font style of the bullet character. Can return: String, NothingEnum enumerator or AutoEnum enumerator. * @type {Mixed} */ bulletsFontStyle: undefined, /* * A property that allows setting of several properties at the same time. * @type {Object} */ properties: undefined, /* * Generates a string which, if executed, will return the Bullet. * @returns {String} */ toSource: function() { return new String(); }, /* * Resolves the object specifier, creating an array of object references. * @returns {Bullet} */ getElements: function() { return new Bullet(); }, /* * Retrieves the object specifier. * @returns {String} */ toSpecifier: function() { return new String(); }, /* * Adds an event listener. * * @param {String} eventType The event type. * @param {Mixed} handler The event handler. Can accept: File or JavaScript Function. * @param {Boolean} [captures] This parameter is obsolete. * @returns {EventListener} */ addEventListener: function(eventType, handler, captures) { return new EventListener(); }, /* * Removes the event listener. * * @param {String} eventType The registered event type. * @param {Mixed} handler The registered event handler. Can accept: File or JavaScript Function. * @param {Boolean} [captures] This parameter is obsolete. * @returns {Boolean} */ removeEventListener: function(eventType, handler, captures) { return new Boolean(); }, };
24.361111
309
0.656784
false
true
false
true
12770114f5ea48288b94a87cf705f5b3cef6c9f8
488
jsx
JSX
src/components/Segmented/Segmented.jsx
russiann/preact-f7
0086ab250b21b570e136250f30388fdf02b13844
[ "MIT" ]
1
2018-05-22T08:53:51.000Z
2018-05-22T08:53:51.000Z
src/components/Segmented/Segmented.jsx
russiann/preact-f7
0086ab250b21b570e136250f30388fdf02b13844
[ "MIT" ]
null
null
null
src/components/Segmented/Segmented.jsx
russiann/preact-f7
0086ab250b21b570e136250f30388fdf02b13844
[ "MIT" ]
null
null
null
import { h } from 'preact'; import PropTypes from 'prop-types'; import { createClassName } from 'create-classname'; const segmentedClass = createClassName('segmented', ['raised:segmented-raised','round:segmented-round']); export const Segmented = ({ children, className, raised, round }) => ( <div className={segmentedClass({ className, raised, round })}>{children}</div> ); Segmented.propTypes = { className: PropTypes.string, raised: PropTypes.bool, round: PropTypes.bool };
30.5
105
0.721311
false
true
false
true
1277130accfd0fc22d81b5770556564b6f5c8fd6
1,556
jsx
JSX
web/client/components/I18N/FlagButton.jsx
fgravin/MapStore2
7508fbc5ec0441262fefe79ab6d263954b3a28eb
[ "BSD-2-Clause-FreeBSD" ]
2
2019-01-23T04:40:25.000Z
2019-05-14T18:00:53.000Z
web/client/components/I18N/FlagButton.jsx
fgravin/MapStore2
7508fbc5ec0441262fefe79ab6d263954b3a28eb
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
web/client/components/I18N/FlagButton.jsx
fgravin/MapStore2
7508fbc5ec0441262fefe79ab6d263954b3a28eb
[ "BSD-2-Clause-FreeBSD" ]
3
2017-11-28T15:17:12.000Z
2019-10-29T18:38:26.000Z
const PropTypes = require('prop-types'); /** * Copyright 2015, GeoSolutions Sas. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ var React = require('react'); var {Button, Tooltip} = require('react-bootstrap'); const OverlayTrigger = require('../misc/OverlayTrigger'); var LocaleUtils = require('../../utils/LocaleUtils'); class LangBar extends React.Component { static propTypes = { id: PropTypes.string, lang: PropTypes.string, code: PropTypes.string, active: PropTypes.bool, label: PropTypes.string, description: PropTypes.string, onFlagSelected: PropTypes.func }; static defaultProps = { locales: LocaleUtils.getSupportedLocales(), code: 'en-US', onLanguageChange: function() {} }; render() { let tooltip = <Tooltip id={"flag-button." + this.props.code}>{this.props.label}</Tooltip>; return (<OverlayTrigger key={"overlay-" + this.props.code} overlay={tooltip}> <Button key={this.props.code} onClick={this.launchFlagAction.bind(this, this.props.code)} active={this.props.active}> <img src={require('./images/flags/' + this.props.code + '.png')} alt={this.props.label}/> </Button> </OverlayTrigger>); } launchFlagAction = (code) => { this.props.onFlagSelected(code); }; } module.exports = LangBar;
30.509804
105
0.615681
false
true
true
false
1277266accb51adebe015282ee863c038adf16c4
2,300
jsx
JSX
seller-web-app/src/components/seller_view.jsx
Sruthi-Ganesh/buyer-seller-app
f9ef9e24ac19af068cee459a7bb319783760c0ca
[ "Apache-2.0" ]
null
null
null
seller-web-app/src/components/seller_view.jsx
Sruthi-Ganesh/buyer-seller-app
f9ef9e24ac19af068cee459a7bb319783760c0ca
[ "Apache-2.0" ]
null
null
null
seller-web-app/src/components/seller_view.jsx
Sruthi-Ganesh/buyer-seller-app
f9ef9e24ac19af068cee459a7bb319783760c0ca
[ "Apache-2.0" ]
1
2021-03-18T07:24:50.000Z
2021-03-18T07:24:50.000Z
import React from 'react'; import PropTypes from 'prop-types'; import { makeStyles, useTheme } from '@material-ui/core/styles'; import AppBar from '@material-ui/core/AppBar'; import Tabs from '@material-ui/core/Tabs'; import Tab from '@material-ui/core/Tab'; import Typography from '@material-ui/core/Typography'; import Box from '@material-ui/core/Box'; import Paper from '@material-ui/core/Paper'; import Availability from './availablity_view'; import Appointment from './appointment_view'; import * as CONSTANTS from '../constants' function TabPanel(props) { const { children, value, index, ...other } = props; return ( <div role="tabpanel" hidden={value !== index} id={`full-width-tabpanel-${index}`} aria-labelledby={`full-width-tab-${index}`} {...other} > {value === index && ( <Box p={3}> <Typography>{children}</Typography> </Box> )} </div> ); } TabPanel.propTypes = { children: PropTypes.node, index: PropTypes.any.isRequired, value: PropTypes.any.isRequired, }; function a11yProps(index) { return { id: `full-width-tab-${index}`, 'aria-controls': `full-width-tabpanel-${index}`, }; } const useStyles = makeStyles({ root: { flexGrow: 1, }, }); export default function CenteredTabs() { const classes = useStyles(); const [value, setValue] = React.useState(0); const handleChange = (event, newValue) => { setValue(newValue); }; return ( <Paper className={classes.root}> <Tabs value={value} onChange={handleChange} indicatorColor="primary" textColor="primary" centered > <Tab label="Pending Appointment Requests" {...a11yProps(0)}/> <Tab label="All Requests" {...a11yProps(1)}/> <Tab label="Change Appointment Schedule" {...a11yProps(2)}/> </Tabs> <TabPanel value={value} index={0}> <Appointment url={CONSTANTS.PENDING_APPOINTMENT_API}> </Appointment> </TabPanel> <TabPanel value={value} index={1}> <Appointment url={CONSTANTS.APPOINTMENT_API}> </Appointment> </TabPanel> <TabPanel value={value} index={2}> <Availability/> </TabPanel> </Paper> ); }
27.058824
76
0.607826
false
true
false
true
127729c81eaaed9768674d5588ba6d5bd8ed303e
742
jsx
JSX
components/users/UserForm.jsx
qarth/rtsupport
721426b2c6d974ca3e2c1b180a35cb8996a79ef4
[ "MIT" ]
null
null
null
components/users/UserForm.jsx
qarth/rtsupport
721426b2c6d974ca3e2c1b180a35cb8996a79ef4
[ "MIT" ]
null
null
null
components/users/UserForm.jsx
qarth/rtsupport
721426b2c6d974ca3e2c1b180a35cb8996a79ef4
[ "MIT" ]
null
null
null
import React, {Component} from 'react'; class UserForm extends Component{ onsubmit(e){ e.preventDefault() const node = this.refs.userName; const userName = node.value; this.props.setUserName(userName); node.value = ''; } render(){ return ( <form onSubmit={this.onSubmit.bind(this)}> <div className='form-group'> <input ref='userName' type="text" className='form-control' placeholder="Set your name..." /> </div> </form> ) } } UserForm.propTypes = { setUserName: React.PropTypes.func.isRequired }
26.5
54
0.485175
false
true
true
false
12773848225b98bf24213f8007a35da12b984d7f
20,735
jsx
JSX
components/post_view/post_list_virtualized/post_list_virtualized.jsx
nykashish/mattermost-webapp
1ac78c48b4fa2dcbf402b849d86a189bf3d3f15e
[ "Apache-2.0" ]
2
2019-06-12T11:52:30.000Z
2020-06-03T22:51:28.000Z
components/post_view/post_list_virtualized/post_list_virtualized.jsx
nykashish/mattermost-webapp
1ac78c48b4fa2dcbf402b849d86a189bf3d3f15e
[ "Apache-2.0" ]
null
null
null
components/post_view/post_list_virtualized/post_list_virtualized.jsx
nykashish/mattermost-webapp
1ac78c48b4fa2dcbf402b849d86a189bf3d3f15e
[ "Apache-2.0" ]
1
2021-07-27T06:13:29.000Z
2021-07-27T06:13:29.000Z
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import PropTypes from 'prop-types'; import React from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import {DynamicSizeList} from 'react-window'; import {isDateLine, isStartOfNewMessages} from 'mattermost-redux/utils/post_list'; import {debounce} from 'mattermost-redux/actions/helpers'; import EventEmitter from 'mattermost-redux/utils/event_emitter'; import LoadingScreen from 'components/loading_screen.jsx'; import Constants, {PostListRowListIds, EventTypes} from 'utils/constants.jsx'; import DelayedAction from 'utils/delayed_action.jsx'; import {getOldestPostId, getPreviousPostId, getLatestPostId} from 'utils/post_utils.jsx'; import * as Utils from 'utils/utils.jsx'; import FloatingTimestamp from 'components/post_view/floating_timestamp'; import NewMessagesBelow from 'components/post_view/new_messages_below'; import PostListRow from 'components/post_view/post_list_row'; import ScrollToBottomArrows from 'components/post_view/scroll_to_bottom_arrows'; const MAX_NUMBER_OF_AUTO_RETRIES = 3; const MAX_EXTRA_PAGES_LOADED = 10; const OVERSCAN_COUNT_BACKWARD = window.OVERSCAN_COUNT_BACKWARD || 80; // Exposing the value for PM to test will be removed soon const OVERSCAN_COUNT_FORWARD = window.OVERSCAN_COUNT_FORWARD || 80; // Exposing the value for PM to test will be removed soon const HEIGHT_TRIGGER_FOR_MORE_POSTS = window.HEIGHT_TRIGGER_FOR_MORE_POSTS || 1000; // Exposing the value for PM to test will be removed soon const BUFFER_TO_BE_CONSIDERED_BOTTOM = 10; const MAXIMUM_POSTS_FOR_SLICING = { channel: 50, permalink: 100, }; const postListStyle = { padding: '14px 0px 7px', }; const virtListStyles = { position: 'absolute', bottom: '0', maxHeight: '100%', }; export default class PostList extends React.PureComponent { static propTypes = { /** * Array of Ids in the channel including date separators, new message indicator, more messages loader, * manual load messages trigger and postId in the order of newest to oldest for populating virtual list rows */ postListIds: PropTypes.array, /** * The number of posts that should be rendered */ postVisibility: PropTypes.number, /** * The channel the posts are in */ channel: PropTypes.object.isRequired, /** * Set to focus this post */ focusedPostId: PropTypes.string, /** * When switching teams we might end up in a state where we select channel from previous team * This flag is explicitly added for adding a loader in these cases to not mounting post list */ channelLoading: PropTypes.bool, latestPostTimeStamp: PropTypes.number, actions: PropTypes.shape({ loadInitialPosts: PropTypes.func.isRequired, /** * Function to increase the number of posts being rendered */ increasePostVisibility: PropTypes.func.isRequired, /** * Function to check and set if app is in mobile view */ checkAndSetMobileView: PropTypes.func.isRequired, }).isRequired, } constructor(props) { super(props); this.loadingMorePosts = false; this.extraPagesLoaded = 0; const channelIntroMessage = PostListRowListIds.CHANNEL_INTRO_MESSAGE; const isMobile = Utils.isMobile(); this.state = { atEnd: false, loadingFirstSetOfPosts: Boolean(!props.postListIds || props.channelLoading), isScrolling: false, autoRetryEnable: true, isMobile, atBottom: true, lastViewedBottom: Date.now(), postListIds: [channelIntroMessage], topPostId: '', postMenuOpened: false, dynamicListStyle: { willChange: 'transform', }, }; this.listRef = React.createRef(); this.postListRef = React.createRef(); if (isMobile) { this.scrollStopAction = new DelayedAction(this.handleScrollStop); } this.initRangeToRender = this.props.focusedPostId ? [0, MAXIMUM_POSTS_FOR_SLICING.permalink] : [0, MAXIMUM_POSTS_FOR_SLICING.channel]; if (!this.state.loadingFirstSetOfPosts) { const newMessagesSeparatorIndex = this.getNewMessagesSeparatorIndex(props.postListIds); this.initRangeToRender = [ Math.max(newMessagesSeparatorIndex - 30, 0), Math.max(newMessagesSeparatorIndex + 30, Math.min(props.postListIds.length - 1, MAXIMUM_POSTS_FOR_SLICING.channel)), ]; } } componentDidMount() { this.mounted = true; if (!this.props.channelLoading) { this.loadPosts(this.props.channel.id, this.props.focusedPostId); } this.props.actions.checkAndSetMobileView(); window.addEventListener('resize', this.handleWindowResize); EventEmitter.addListener(EventTypes.POST_LIST_SCROLL_CHANGE, this.scrollChange); } getSnapshotBeforeUpdate(prevProps, prevState) { if (this.postListRef && this.postListRef.current) { const postsAddedAtTop = this.state.postListIds.length !== prevState.postListIds.length && this.state.postListIds[0] === prevState.postListIds[0]; const channelHeaderAdded = this.state.atEnd !== prevState.atEnd; if ((postsAddedAtTop || channelHeaderAdded) && !this.state.atBottom) { const previousScrollTop = this.postListRef.current.scrollTop; const previousScrollHeight = this.postListRef.current.scrollHeight; return { previousScrollTop, previousScrollHeight, }; } } return null; } componentDidUpdate(prevProps, prevState, snapshot) { if (prevProps.channelLoading && !this.props.channelLoading) { this.loadPosts(this.props.channel.id, this.props.focusedPostId); } if (!this.postListRef.current || !snapshot) { return; } const postlistScrollHeight = this.postListRef.current.scrollHeight; const postsAddedAtTop = this.state.postListIds.length !== prevState.postListIds.length && this.state.postListIds[0] === prevState.postListIds[0]; const channelHeaderAdded = this.state.atEnd !== prevState.atEnd; if ((postsAddedAtTop || channelHeaderAdded) && !this.state.atBottom) { const scrollValue = snapshot.previousScrollTop + (postlistScrollHeight - snapshot.previousScrollHeight); if (scrollValue !== 0 && (scrollValue - snapshot.previousScrollTop) !== 0) { //true as third param so chrome can use animationFrame when correcting scroll this.listRef.current.scrollTo(scrollValue, scrollValue - snapshot.previousScrollTop, true); } } } componentWillUnmount() { this.mounted = false; window.removeEventListener('resize', this.handleWindowResize); EventEmitter.removeListener(EventTypes.POST_LIST_SCROLL_CHANGE, this.scrollChange); } static getDerivedStateFromProps(props, state) { const postListIds = props.postListIds || []; let newPostListIds; if (state.atEnd) { newPostListIds = [...postListIds, PostListRowListIds.CHANNEL_INTRO_MESSAGE]; } else if (props.postVisibility >= Constants.MAX_POST_VISIBILITY) { newPostListIds = [...postListIds, PostListRowListIds.MAX_MESSAGES_LOADED]; } else if (state.autoRetryEnable) { newPostListIds = [...postListIds, PostListRowListIds.MORE_MESSAGES_LOADER]; } else { newPostListIds = [...postListIds, PostListRowListIds.MANUAL_TRIGGER_LOAD_MESSAGES]; } return { postListIds: newPostListIds, }; } getNewMessagesSeparatorIndex = (postListIds) => { return postListIds.findIndex( (item) => item.indexOf(PostListRowListIds.START_OF_NEW_MESSAGES) === 0 ); } scrollChange = (toBottom) => { if (toBottom) { this.scrollToBottom(); } } handleWindowResize = () => { this.props.actions.checkAndSetMobileView(); const isMobile = Utils.isMobile(); if (isMobile !== this.state.isMobile) { const dynamicListStyle = this.state.dynamicListStyle; if (this.state.postMenuOpened) { if (!isMobile && dynamicListStyle.willChange === 'unset') { dynamicListStyle.willChange = 'transform'; } else if (isMobile && dynamicListStyle.willChange === 'transform') { dynamicListStyle.willChange = 'unset'; } } this.setState({ isMobile, dynamicListStyle, }); this.scrollStopAction = new DelayedAction(this.handleScrollStop); } } loadPosts = async (channelId, focusedPostId) => { if (!channelId) { return; } const {hasMoreBefore} = await this.props.actions.loadInitialPosts(channelId, focusedPostId); if (this.mounted) { this.setState({ loadingFirstSetOfPosts: false, atEnd: !hasMoreBefore, }); } } loadMorePosts = async () => { const oldestPostId = this.getOldestVisiblePostId(); if (!oldestPostId) { // loadMorePosts shouldn't be called if we don't already have posts return; } this.loadingMorePosts = true; const {moreToLoad, error} = await this.props.actions.increasePostVisibility(this.props.channel.id, oldestPostId); if (error) { if (this.autoRetriesCount < MAX_NUMBER_OF_AUTO_RETRIES) { this.autoRetriesCount++; debounce(this.loadMorePosts()); } else if (this.mounted) { this.setState({autoRetryEnable: false}); } } else { this.loadingMorePosts = false; if (this.mounted && this.props.postListIds) { this.setState({ atEnd: !moreToLoad, autoRetryEnable: true, }); } if (!this.state.autoRetryEnable) { this.autoRetriesCount = 0; } } }; getOldestVisiblePostId = () => { return getOldestPostId(this.state.postListIds); } togglePostMenu = (opened) => { const dynamicListStyle = this.state.dynamicListStyle; if (this.state.isMobile) { dynamicListStyle.willChange = opened ? 'unset' : 'transform'; } this.setState({ postMenuOpened: opened, dynamicListStyle, }); }; renderRow = ({data, itemId, style}) => { const index = data.indexOf(itemId); let className = ''; const basePaddingClass = 'post-row__padding'; const previousItemId = (index !== -1 && index < data.length - 1) ? data[index + 1] : ''; const nextItemId = (index > 0 && index < data.length) ? data[index - 1] : ''; if (isDateLine(nextItemId) || isStartOfNewMessages(nextItemId)) { className += basePaddingClass + ' bottom'; } if (isDateLine(previousItemId) || isStartOfNewMessages(previousItemId)) { if (className.includes(basePaddingClass)) { className += ' top'; } else { className += basePaddingClass + ' top'; } } return ( <div style={style} className={className} > <PostListRow listId={itemId} previousListId={getPreviousPostId(data, index)} channel={this.props.channel} shouldHighlight={itemId === this.props.focusedPostId} loadMorePosts={this.loadMorePosts} togglePostMenu={this.togglePostMenu} /> </div> ); }; itemKey = (index) => { const {postListIds} = this.state; return postListIds[index] ? postListIds[index] : index; } onScroll = ({scrollDirection, scrollOffset, scrollUpdateWasRequested, clientHeight, scrollHeight}) => { const isNotLoadingPosts = !this.state.loadingFirstSetOfPosts && !this.loadingMorePosts; const didUserScrollBackwards = scrollDirection === 'backward' && !scrollUpdateWasRequested; const isOffsetWithInRange = scrollOffset < HEIGHT_TRIGGER_FOR_MORE_POSTS; if (isNotLoadingPosts && didUserScrollBackwards && isOffsetWithInRange && !this.state.atEnd) { this.loadMorePosts(); } if (this.state.isMobile) { if (!this.state.isScrolling) { this.setState({ isScrolling: true, }); } if (this.scrollStopAction) { this.scrollStopAction.fireAfter(Constants.SCROLL_DELAY); } } this.checkBottom(scrollOffset, scrollHeight, clientHeight); } checkBottom = (scrollOffset, scrollHeight, clientHeight) => { this.updateAtBottom(this.isAtBottom(scrollOffset, scrollHeight, clientHeight)); } isAtBottom = (scrollOffset, scrollHeight, clientHeight) => { // Calculate how far the post list is from being scrolled to the bottom const offsetFromBottom = scrollHeight - clientHeight - scrollOffset; return offsetFromBottom <= BUFFER_TO_BE_CONSIDERED_BOTTOM; } updateAtBottom = (atBottom) => { if (atBottom !== this.state.atBottom) { // Update lastViewedBottom when the list reaches or leaves the bottom let lastViewedBottom = Date.now(); if (this.props.latestPostTimeStamp > lastViewedBottom) { lastViewedBottom = this.props.latestPostTimeStamp; } this.setState({ atBottom, lastViewedBottom, }); } } handleScrollStop = () => { if (this.mounted) { this.setState({ isScrolling: false, }); } } updateFloatingTimestamp = (visibleTopItem) => { if (!this.state.isMobile) { return; } if (!this.props.postListIds) { return; } this.setState({ topPostId: getLatestPostId(this.props.postListIds.slice(visibleTopItem)), }); } onItemsRendered = ({visibleStartIndex}) => { this.updateFloatingTimestamp(visibleStartIndex); } initScrollToIndex = () => { if (this.props.focusedPostId) { const index = this.state.postListIds.findIndex( (item) => item === this.props.focusedPostId ); return { index, position: 'center', }; } const newMessagesSeparatorIndex = this.getNewMessagesSeparatorIndex(this.state.postListIds); if (newMessagesSeparatorIndex > 0) { const topMostPostIndex = this.state.postListIds.indexOf(getOldestPostId(this.state.postListIds)); if (newMessagesSeparatorIndex === topMostPostIndex + 1) { this.loadMorePosts(); return { index: this.state.postListIds.length - 1, position: 'start', }; } return { index: newMessagesSeparatorIndex, position: 'start', }; } return { index: 0, position: 'end', }; } scrollToBottom = () => { this.listRef.current.scrollToItem(0, 'end'); } canLoadMorePosts = async () => { if (this.props.focusedPostId) { return; } if (this.state.loadingFirstSetOfPosts || this.loadingMorePosts) { // Should already be loading posts return; } if (this.state.atEnd) { // Screen is full return; } if (this.extraPagesLoaded > MAX_EXTRA_PAGES_LOADED) { // Prevent this from loading a lot of pages in a channel with only hidden messages // Enable load more messages manual link this.setState({autoRetryEnable: false}); return; } await this.loadMorePosts(); this.extraPagesLoaded += 1; } render() { const channel = this.props.channel; const {dynamicListStyle} = this.state; if (this.state.loadingFirstSetOfPosts) { return ( <div id='post-list'> <LoadingScreen position='absolute' key='loading' /> </div> ); } let newMessagesBelow = null; if (!this.props.focusedPostId) { newMessagesBelow = ( <NewMessagesBelow atBottom={this.state.atBottom} lastViewedBottom={this.state.lastViewedBottom} postIds={this.state.postListIds} onClick={this.scrollToBottom} channelId={this.props.channel.id} /> ); } return ( <div id='post-list'> {this.state.isMobile && ( <React.Fragment> <FloatingTimestamp isScrolling={this.state.isScrolling} isMobile={true} postId={this.state.topPostId} /> <ScrollToBottomArrows isScrolling={this.state.isScrolling} atBottom={this.state.atBottom} onClick={this.scrollToBottom} /> </React.Fragment> )} {newMessagesBelow} <div className='post-list-holder-by-time' key={'postlist-' + channel.id} > <div className='post-list__table'> <div id='postListContent' className='post-list__content' > <AutoSizer> {({height, width}) => ( <DynamicSizeList ref={this.listRef} height={height} width={width} className='post-list__dynamic' itemCount={this.state.postListIds.length} itemData={this.state.postListIds} itemKey={this.itemKey} overscanCountForward={OVERSCAN_COUNT_FORWARD} overscanCountBackward={OVERSCAN_COUNT_BACKWARD} onScroll={this.onScroll} onItemsRendered={this.onItemsRendered} initScrollToIndex={this.initScrollToIndex} canLoadMorePosts={this.canLoadMorePosts} skipResizeClass='col__reply' innerRef={this.postListRef} style={{...virtListStyles, ...dynamicListStyle}} innerListStyle={postListStyle} initRangeToRender={this.initRangeToRender} loaderId={PostListRowListIds.MORE_MESSAGES_LOADER} > {this.renderRow} </DynamicSizeList> )} </AutoSizer> </div> </div> </div> </div> ); } }
35.935875
157
0.55457
false
true
false
true
12773d9c722d1598013ce9c06bcd3612bc728dd1
5,884
jsx
JSX
src/plugins/dam/components/search-assets-form/advanced-options.jsx
triniti/cms-js
cf6a170d0ae09bf1c73805f3be77f337c3cb7a36
[ "Apache-2.0" ]
4
2019-11-08T21:00:34.000Z
2021-09-17T22:35:08.000Z
src/plugins/dam/components/search-assets-form/advanced-options.jsx
triniti/cms-js
cf6a170d0ae09bf1c73805f3be77f337c3cb7a36
[ "Apache-2.0" ]
133
2019-10-03T19:26:45.000Z
2022-03-30T23:28:09.000Z
src/plugins/dam/components/search-assets-form/advanced-options.jsx
triniti/cms-js
cf6a170d0ae09bf1c73805f3be77f337c3cb7a36
[ "Apache-2.0" ]
1
2020-02-07T17:49:08.000Z
2020-02-07T17:49:08.000Z
import CategoryPickerField from '@triniti/cms/plugins/taxonomy/components/category-picker-field'; import ChannelPickerField from '@triniti/cms/plugins/taxonomy/components/channel-picker-field'; import DatePickerField from '@triniti/cms/components/date-picker-field'; import NodeRef from '@gdbots/schemas/gdbots/ncr/NodeRef'; import noop from 'lodash/noop'; import NumberField from '@triniti/cms/components/number-field'; import PeoplePickerField from '@triniti/cms/plugins/people/components/people-picker-field'; import PropTypes from 'prop-types'; import React from 'react'; import { Button, CardBody, CardHeader, Collapse, Card, InputGroup, } from '@triniti/admin-ui-plugin/components'; const AdvancedOptionFields = ({ isCollapsed, onChangeCount, onChangeDate, onChangeSelect, onClearSelect, onRemoveFromSelect, onReset, onSearch, onToggleCollapse, request, }) => { const { created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, category_refs: categoryRefs, channel_ref: channelRef, person_refs: personRefs, count, } = request; const getAll = (key) => { const refs = request[key]; if (!refs) { return []; } return (Array.isArray(refs) ? refs : [refs]).map(NodeRef.fromString); }; return ( <Card className="advanced-options"> <CardHeader toggler> <Button color="toggler" onClick={onToggleCollapse} active={!isCollapsed}> Advanced Options</Button> </CardHeader> <Collapse isOpen={!isCollapsed}> <CardBody> <InputGroup className="advanced-options__items"> <DatePickerField input={{ name: 'createdAfter', onChange: (date) => { onChangeDate('created_after', date); }, value: createdAfter || null, }} label="Created After" meta={{ error: '' }} showSetCurrentDateTimeIcon={false} /> <DatePickerField input={{ name: 'createdBefore', onChange: (date) => onChangeDate('created_before', date), value: createdBefore || null, }} label="Created Before" meta={{ error: '' }} showSetCurrentDateTimeIcon={false} /> <DatePickerField input={{ name: 'updatedAfter', onChange: (date) => onChangeDate('updated_after', date), value: updatedAfter || null, }} label="Updated After" meta={{ error: '' }} showSetCurrentDateTimeIcon={false} /> <DatePickerField input={{ name: 'updatedBefore', onChange: (date) => onChangeDate('updated_before', date), value: updatedBefore || null, }} label="Updated Before" meta={{ error: '' }} showSetCurrentDateTimeIcon={false} /> <CategoryPickerField fields={{ getAll: () => getAll('category_refs'), push: (nodeRef) => onChangeSelect('category_refs', nodeRef.toString()), removeAll: () => onClearSelect('category_refs'), remove: (index) => onRemoveFromSelect('category_refs', categoryRefs[index]), }} isEditMode label="Categories" placeholder="Select Categories..." /> <ChannelPickerField fields={{ getAll: () => getAll('channel_ref'), push: (nodeRef) => onChangeSelect('channel_ref', nodeRef.toString(), false), removeAll: () => onClearSelect('channel_ref'), remove: () => onRemoveFromSelect('channel_ref', channelRef), }} isEditMode label="Channels" placeholder="Select Channels..." /> <PeoplePickerField fields={{ getAll: () => getAll('person_refs'), push: (nodeRef) => onChangeSelect('person_refs', nodeRef.toString()), removeAll: () => onClearSelect('person_refs'), remove: (index) => onRemoveFromSelect('person_refs', personRefs[index]), }} isEditMode label="Related People" placeholder="Select Related People..." /> <NumberField input={{ onChange: onChangeCount, onBlur: noop, name: 'count', }} label="Count" meta={{ error: '' }} value={count || 25} /> </InputGroup> <div className="advanced-options__nav pb-3"> <Button onClick={onReset} color="secondary" disabled={false}> Clear </Button> <Button onClick={onSearch} color="primary" disabled={false} className="mr-1 align-right"> Search </Button> </div> </CardBody> </Collapse> </Card> ); }; AdvancedOptionFields.propTypes = { isCollapsed: PropTypes.bool, onChangeCount: PropTypes.func.isRequired, onChangeDate: PropTypes.func.isRequired, onChangeSelect: PropTypes.func.isRequired, onClearSelect: PropTypes.func.isRequired, onRemoveFromSelect: PropTypes.func.isRequired, onReset: PropTypes.func.isRequired, onSearch: PropTypes.func.isRequired, onToggleCollapse: PropTypes.func.isRequired, request: PropTypes.object, // eslint-disable-line react/forbid-prop-types }; AdvancedOptionFields.defaultProps = { isCollapsed: true, request: null, }; export default AdvancedOptionFields;
32.508287
118
0.565602
false
true
false
true
12774f17aa60cc0adf67b1d4419743473c135410
1,238
jsx
JSX
src/Covid19Dashboard/overlays/GoogleMobilityLayer/index.jsx
urvi-occ/data-portal
7a3ce97352ead2e8f352ec53aabe7749967dff8e
[ "Apache-2.0" ]
22
2017-12-12T14:03:37.000Z
2021-12-16T06:55:23.000Z
src/Covid19Dashboard/overlays/GoogleMobilityLayer/index.jsx
urvi-occ/data-portal
7a3ce97352ead2e8f352ec53aabe7749967dff8e
[ "Apache-2.0" ]
314
2017-09-20T22:46:59.000Z
2022-03-30T20:23:15.000Z
src/Covid19Dashboard/overlays/GoogleMobilityLayer/index.jsx
urvi-occ/data-portal
7a3ce97352ead2e8f352ec53aabe7749967dff8e
[ "Apache-2.0" ]
38
2019-01-20T01:05:54.000Z
2022-03-17T18:05:50.000Z
import React from 'react'; import PropTypes from 'prop-types'; import * as ReactMapGL from 'react-map-gl'; function notIl(date) { return { type: 'fill', filter: ['all'], layout: { visibility: 'visible' }, beforeId: 'county-outline', paint: { 'fill-color': [ 'interpolate', ['linear'], ['get', `rnr_${date}`], -100, '#0d652d', -80, '#188038', -60, '#1e8e3e', -40, '#34a853', -20, '#81c995', 0, '#FFF', 1, '#EED322', 20, '#DA9C20', 40, '#B86B25', 60, '#8B4225', 80, '#850001', ], 'fill-opacity': 0.6, }, }; } class MobilityLayer extends React.Component { render() { return ( <ReactMapGL.Source type='geojson' data={this.props.data}> <ReactMapGL.Layer id='rnr_mobility_data' {...notIl(this.props.date)} layout={{ visibility: this.props.visibility }} /> </ReactMapGL.Source> ); } } MobilityLayer.propTypes = { visibility: PropTypes.string.isRequired, data: PropTypes.object.isRequired, date: PropTypes.string.isRequired, }; export default MobilityLayer;
20.295082
126
0.518578
false
true
true
false
127750af16fc81c6907492405a6dccfb6507cc91
267
jsx
JSX
www/app/src/Components/Stats.jsx
jkulak/spotify-grabtrack
e6cd16709195ca6d2e186a3b8cc7ce1419b6aace
[ "MIT" ]
null
null
null
www/app/src/Components/Stats.jsx
jkulak/spotify-grabtrack
e6cd16709195ca6d2e186a3b8cc7ce1419b6aace
[ "MIT" ]
13
2022-02-10T20:07:49.000Z
2022-03-27T20:07:21.000Z
www/app/src/Components/Stats.jsx
jkulak/spotify-grabtrack
e6cd16709195ca6d2e186a3b8cc7ce1419b6aace
[ "MIT" ]
null
null
null
import React from "react"; import "./Stats.css"; const Stats = (props) => { return ( <ul id="stats"> <li>Results: {props.totalResults}</li> <li>Total tracks: {props.totalTracks}</li> </ul> ); }; export default Stats;
19.071429
54
0.535581
false
true
false
true
127757a2b1335c57e1e832f8cdfe3acad450c3ae
6,049
jsx
JSX
src/client/apps/edit/components/content/section_container/index.jsx
mzikherman/positron
41276b2f7468f0f8e549d46786e935fd40541011
[ "MIT" ]
null
null
null
src/client/apps/edit/components/content/section_container/index.jsx
mzikherman/positron
41276b2f7468f0f8e549d46786e935fd40541011
[ "MIT" ]
null
null
null
src/client/apps/edit/components/content/section_container/index.jsx
mzikherman/positron
41276b2f7468f0f8e549d46786e935fd40541011
[ "MIT" ]
null
null
null
import PropTypes from "prop-types" import React, { Component, Fragment } from "react" import styled from "styled-components" import { color } from "@artsy/palette" import { connect } from "react-redux" import { IconDrag } from "@artsy/reaction/dist/Components/Publishing/Icon/IconDrag" import { RemoveButton } from "client/components/remove_button" import { removeSection } from "client/actions/edit/sectionActions" import { getSectionWidth } from "@artsy/reaction/dist/Components/Publishing/Sections/SectionContainer" import SectionImages from "../sections/images/index.tsx" import SectionSlideshow from "../sections/slideshow" import SectionText from "../sections/text" import SectionText2 from "../sections/text/index2" import SectionVideo from "../sections/video" import { ErrorBoundary } from "client/components/error/error_boundary" import { SectionEmbed } from "../sections/embed" import { SectionSocialEmbed } from "../sections/social_embed" // TODO: Remove after text2 is merged import { data as sd } from "sharify" export class SectionContainer extends Component { static propTypes = { article: PropTypes.object.isRequired, editing: PropTypes.bool, index: PropTypes.number, isHero: PropTypes.bool, onRemoveHero: PropTypes.func, onSetEditing: PropTypes.func, removeSectionAction: PropTypes.func, section: PropTypes.object, sections: PropTypes.array, sectionIndex: PropTypes.number, } isEditing = () => { const { index, editing, isHero, sectionIndex } = this.props if (isHero) { return editing } else { return index === sectionIndex } } onSetEditing = () => { const { editing, index, isHero, onSetEditing } = this.props let setEditing if (isHero) { // use boolean if article.hero_section setEditing = !editing } else { // use the section index if article.section setEditing = this.isEditing() ? null : index } onSetEditing(setEditing) } onRemoveSection = () => { const { index, isHero, onRemoveHero, removeSectionAction } = this.props if (isHero) { onRemoveHero() } else { removeSectionAction(index) } } getSectionComponent = () => { const { section } = this.props switch (section.type) { case "embed": { return <SectionEmbed {...this.props} /> } case "social_embed": { return <SectionSocialEmbed {...this.props} /> } case "image": case "image_set": case "image_collection": { return <SectionImages {...this.props} /> } case "text": { if (sd.IS_EDIT_2) { return <SectionText2 {...this.props} /> } else { return <SectionText {...this.props} /> } } case "video": { return <SectionVideo {...this.props} /> } case "slideshow": { return <SectionSlideshow {...this.props} /> } } } render() { const { article, isHero, section } = this.props const sectionWidth = getSectionWidth(section, article.layout) const isEditing = this.isEditing() const isFillwidth = section.layout === "fillwidth" return ( <ErrorBoundary> <SectionWrapper className="SectionContainer" data-editing={isEditing} data-type={section.type} // TODO: remove css dependent on data-type & editing width={sectionWidth} isHero={isHero} isFillwidth={isFillwidth} > <HoverControls isEditing={isEditing} type={section.type}> {!isEditing && ( <Fragment> {!isHero && ( <DragButtonContainer isFillwidth={isFillwidth}> <IconDrag background={color("black30")} /> </DragButtonContainer> )} <RemoveButtonContainer isFillwidth={isFillwidth}> <RemoveButton onClick={this.onRemoveSection} background={color("black30")} /> </RemoveButtonContainer> <ClickToEdit onClick={this.onSetEditing} /> </Fragment> )} </HoverControls> {this.getSectionComponent()} {isEditing && <ContainerBackground onClick={this.onSetEditing} />} </SectionWrapper> </ErrorBoundary> ) } } const mapStateToProps = state => ({ article: state.edit.article, sectionIndex: state.edit.sectionIndex, }) const mapDispatchToProps = { removeSectionAction: removeSection, } export default connect( mapStateToProps, mapDispatchToProps )(SectionContainer) const SectionWrapper = styled.div` position: relative; width: ${props => props.width}; max-width: 100%; margin: 0 auto; padding: ${props => (props.isFillwidth ? 0 : "20px")}; ${props => props.isHero && ` margin-top: 20px; `}; ` export const HoverControls = styled.div` position: absolute; width: 100%; height: 100%; border: 1px solid ${color("black30")}; top: 0; left: 0; opacity: 0; &:hover { opacity: 1; } ${props => props.isEditing && ` opacity: 1; border-color: ${ props.type === "text" ? color("white100") : color("black100") }; `}; ` export const ClickToEdit = styled.div` position: absolute; width: 100%; height: 100%; top: 0; left: 0; ` export const ContainerBackground = styled.div` width: 100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 1; ` const IconContainer = styled.div` width: 30px; position: absolute; right: -15px; cursor: pointer; z-index: 5; ${props => props.isFillwidth && ` right: 18px; `}; ` const RemoveButtonContainer = styled(IconContainer)` top: -15px; &:hover circle { fill: ${color("red100")}; } ${props => props.isFillwidth && ` top: 20px; `}; ` const DragButtonContainer = styled(IconContainer)` top: 25px; ${props => props.isFillwidth && ` top: 60px; `}; `
24.489879
102
0.61101
false
true
true
false
127764cb989aa6634edb8f17840b16310fa32a97
1,328
jsx
JSX
client/src/components/Calendar/Popup.jsx
teamertibebu/BarkPoint
4d748f66f956c114fd4dc46a2f9cffdfb3ef244c
[ "MIT" ]
null
null
null
client/src/components/Calendar/Popup.jsx
teamertibebu/BarkPoint
4d748f66f956c114fd4dc46a2f9cffdfb3ef244c
[ "MIT" ]
null
null
null
client/src/components/Calendar/Popup.jsx
teamertibebu/BarkPoint
4d748f66f956c114fd4dc46a2f9cffdfb3ef244c
[ "MIT" ]
5
2020-12-07T16:23:15.000Z
2021-10-04T16:37:45.000Z
import React from 'react'; import PropTypes from 'prop-types'; import './Calendar.css'; const Popup = ({ event, setShowPopup }) => ( <div className="calendar-popup"> <div id="popup-title">{event.title}</div> <div id="popup-time"> {`${event.start.toDateString()} * ${event.start.toLocaleTimeString()} - ${event.end.toLocaleTimeString()}`} </div> <div id="popup-location"> {event.location} </div> <div id="guest-count"> {`${event.attendees.length} guest${event.attendees.length > 1 ? 's' : ''}`} </div> <div> {event.attendees.map((attendee) => ( <div key={attendee} className="guestList"> {attendee.email} </div> ))} </div> <button id="close" onClick={() => setShowPopup(false)}>X</button> </div> ); Popup.propTypes = { // setEventLocation: PropTypes.func.isRequired, event: PropTypes.shape({ title: PropTypes.string.isRequired, start: PropTypes.instanceOf(Date).isRequired, end: PropTypes.instanceOf(Date).isRequired, attendees: PropTypes.arrayOf(PropTypes.shape({ email: PropTypes.string.isRequired, responseStatus: PropTypes.string.isRequired, })).isRequired, location: PropTypes.string.isRequired, }).isRequired, setShowPopup: PropTypes.bool.isRequired, }; export default Popup;
30.181818
113
0.642319
false
true
false
true
12776662b5cfb8ec831c61e584ec5f6341d34dce
7,651
jsx
JSX
src/plugins/recordTypes/collectionobject/forms/photo.jsx
mikejritter/cspace-ui.js
56d08c70896499b6f6232162bc2ac6edddaa0c25
[ "ECL-2.0" ]
4
2017-01-27T02:14:33.000Z
2021-05-20T23:54:21.000Z
src/plugins/recordTypes/collectionobject/forms/photo.jsx
mikejritter/cspace-ui.js
56d08c70896499b6f6232162bc2ac6edddaa0c25
[ "ECL-2.0" ]
117
2016-11-29T08:06:22.000Z
2022-03-25T21:30:12.000Z
src/plugins/recordTypes/collectionobject/forms/photo.jsx
mikejritter/cspace-ui.js
56d08c70896499b6f6232162bc2ac6edddaa0c25
[ "ECL-2.0" ]
13
2016-08-29T19:46:50.000Z
2021-04-08T18:34:39.000Z
import { defineMessages } from 'react-intl'; const template = (configContext) => { const { React, } = configContext.lib; const { Col, Panel, Row, } = configContext.layoutComponents; const { Field, } = configContext.recordComponents; const { extensions, } = configContext.config; return ( <Field name="document"> <Panel name="id" collapsible> <Row> <Col> <Field name="objectNumber" /> <Field name="numberOfObjects" /> <Field name="responsibleDepartments"> <Field name="responsibleDepartment" /> </Field> <Row> <Field name="collection" /> <Col> <Field name="namedCollections"> <Field name="namedCollection" /> </Field> </Col> </Row> </Col> <Col> <Field name="briefDescriptions"> <Field name="briefDescription" /> </Field> <Field name="distinguishingFeatures" /> </Col> </Row> <Field name="titleGroupList"> <Field name="titleGroup"> <Panel> <Row> <Col> <Field name="title" /> <Field name="titleLanguage" /> </Col> <Col> <Field name="titleType" /> <Field name="titleTranslationSubGroupList"> <Field name="titleTranslationSubGroup"> <Field name="titleTranslation" /> <Field name="titleTranslationLanguage" /> </Field> </Field> </Col> </Row> </Panel> </Field> </Field> <Field name="objectNameList"> <Field name="objectNameGroup"> <Field name="objectName" /> <Field name="objectNameCurrency" /> <Field name="objectNameLevel" /> <Field name="objectNameSystem" /> <Field name="objectNameType" /> <Field name="objectNameLanguage" /> <Field name="objectNameNote" /> </Field> </Field> </Panel> <Panel name="desc" collapsible collapsed> <Row> <Col> <Field name="copyNumber" /> </Col> <Col> <Field name="editionNumber" /> <Field name="colors"> <Field name="color" /> </Field> </Col> </Row> <Field name="materialGroupList"> <Field name="materialGroup"> <Field name="material" /> <Field name="materialComponent" /> <Field name="materialComponentNote" /> <Field name="materialName" /> <Field name="materialSource" /> </Field> </Field> <Field name="physicalDescription" /> <Row> <Field name="technicalAttributeGroupList"> <Field name="technicalAttributeGroup"> <Field name="technicalAttribute" /> <Field name="technicalAttributeMeasurement" /> <Field name="technicalAttributeMeasurementUnit" /> </Field> </Field> <Col /> </Row> {extensions.dimension.form} <Panel name="content" collapsible collapsed> <Field name="contentDescription" /> <Row> <Col> <Field name="contentLanguages"> <Field name="contentLanguage" /> </Field> <Field name="contentActivities"> <Field name="contentActivity" /> </Field> <Field name="contentConcepts"> <Field name="contentConcept" /> </Field> <Field name="contentDateGroup" /> <Field name="contentPositions"> <Field name="contentPosition" /> </Field> <Field name="contentObjectGroupList"> <Field name="contentObjectGroup"> <Field name="contentObject" /> <Field name="contentObjectType" /> </Field> </Field> </Col> <Col> <Field name="contentPeoples"> <Field name="contentPeople" /> </Field> <Field name="contentPersons"> <Field name="contentPerson" /> </Field> <Field name="contentPlaces"> <Field name="contentPlace" /> </Field> <Field name="contentScripts"> <Field name="contentScript" /> </Field> <Field name="contentOrganizations"> <Field name="contentOrganization" /> </Field> <Field name="contentEventNameGroupList"> <Field name="contentEventNameGroup"> <Field name="contentEventName" /> <Field name="contentEventNameType" /> </Field> </Field> <Field name="contentOtherGroupList"> <Field name="contentOtherGroup"> <Field name="contentOther" /> <Field name="contentOtherType" /> </Field> </Field> </Col> </Row> <Field name="contentNote" /> </Panel> </Panel> <Panel name="prod" collapsible collapsed> <Row> <Col> <Field name="objectProductionDateGroupList"> <Field name="objectProductionDateGroup" /> </Field> <Field name="techniqueGroupList"> <Field name="techniqueGroup"> <Field name="technique" /> <Field name="techniqueType" /> </Field> </Field> <Field name="objectProductionPlaceGroupList"> <Field name="objectProductionPlaceGroup"> <Field name="objectProductionPlace" /> <Field name="objectProductionPlaceRole" /> </Field> </Field> </Col> <Col> <Field name="objectProductionPersonGroupList"> <Field name="objectProductionPersonGroup"> <Field name="objectProductionPerson" /> <Field name="objectProductionPersonRole" /> </Field> </Field> <Field name="objectProductionOrganizationGroupList"> <Field name="objectProductionOrganizationGroup"> <Field name="objectProductionOrganization" /> <Field name="objectProductionOrganizationRole" /> </Field> </Field> <Field name="objectProductionNote" /> </Col> </Row> </Panel> <Panel name="reference" collapsible collapsed> <Field name="referenceGroupList"> <Field name="referenceGroup"> <Field name="reference" /> <Field name="referenceNote" /> </Field> </Field> </Panel> <Panel name="hierarchy" collapsible collapsed> <Field name="relation-list-item" subpath="rel:relations-common-list" /> </Panel> </Field> ); }; export default (configContext) => ({ messages: defineMessages({ name: { id: 'form.collectionobject.photo.name', defaultMessage: 'Photograph Template', }, }), sortOrder: 2, template: template(configContext), });
28.128676
79
0.483728
false
true
false
true
127768a92bfd0881823fcba763621e930cfd06e1
3,270
jsx
JSX
src/applications/gi/components/vet-tec/VetTecApplicationProcess.jsx
kevwalsh/vets-website
39d034d7cdd763970b67b872d0972b15d00122b6
[ "CC0-1.0" ]
null
null
null
src/applications/gi/components/vet-tec/VetTecApplicationProcess.jsx
kevwalsh/vets-website
39d034d7cdd763970b67b872d0972b15d00122b6
[ "CC0-1.0" ]
null
null
null
src/applications/gi/components/vet-tec/VetTecApplicationProcess.jsx
kevwalsh/vets-website
39d034d7cdd763970b67b872d0972b15d00122b6
[ "CC0-1.0" ]
null
null
null
import React from 'react'; import environment from 'platform/utilities/environment'; class VetTecApplicationProcess extends React.Component { providersWebsiteLink = () => { const programs = this.props.institution.programs; if ( programs[0].providerWebsite === null || programs[0].providerWebsite === '' ) { return ( <p> To learn more about available programs, visit the training provider's website. </p> ); } return ( <p> To learn more about available programs,{' '} <a href={`https://${programs[0].providerWebsite}`} target="_blank" rel="noopener noreferrer" > visit the training provider's website </a> . </p> ); }; render() { return ( <div className={ 'columns vads-u-margin-top--neg1p5 vads-u-margin-x--neg1p5 medium-screen:vads-l-col--10' } > <h3 className="vads-u-font-size--h4"> Enrolling in VET TEC is a two-step process: </h3> <p> First, you’ll need to apply for Veteran Employment Through Technology Education Courses (VET TEC). You’ll get a Certificate of Eligibility (COE) in the mail if we approve your application. </p> <p> <a href={ '/education/about-gi-bill-benefits/how-to-use-benefits/vettec-high-tech-program/apply-for-vettec-form-22-0994/introduction' } target="_blank" rel="noopener noreferrer" > Apply for VET TEC (VA Form 22-0994) </a> </p> {// PROD FLAG CT 116 STORY 19868 environment.isProduction() ? ( <p> After you’ve been approved for VET TEC, apply to the program you’d like to attend. </p> ) : ( <p> Then, after you've been approved for VET TEC, apply to the VA-approved training provider you'd like to attend. </p> )} {// PROD FLAG CT 116 STORY 19868 environment.isProduction() ? ( <p> <a href={ '/education/about-gi-bill-benefits/how-to-use-benefits/vettec-high-tech-program/' } target="_blank" rel="noopener noreferrer" > Learn more about VET TEC programs </a> </p> ) : ( this.providersWebsiteLink() )} <h3 className="vads-u-font-size--h4"> Have questions about the VET TEC program or how to apply? </h3> <div> <ul className="vet-tec-application-process-list"> <li> Call us at 1-888-GIBILL ( <a href="tel:+18884424551">1-888-442-4551</a> ). We’re here Monday through Friday, 8:00a.m. to 7:00 p.m. ET. If you have hearing loss, call TYY:711. </li> <li> Or email us at{' '} <a href="mailto:VETTEC.VBABUF@va.gov">VETTEC.VBABUF@va.gov</a> </li> </ul> </div> </div> ); } } export default VetTecApplicationProcess;
30
137
0.511621
false
true
true
false
12776b9e3a224d4a060c9f24b827ff1e73e60bd6
481
jsx
JSX
packages/icons-vue/src/icons/WeiboOutlined.jsx
whalue-design/whalue-design-icons
c2a19c6815855b76c7e1ba0ad816f3958a178608
[ "MIT" ]
null
null
null
packages/icons-vue/src/icons/WeiboOutlined.jsx
whalue-design/whalue-design-icons
c2a19c6815855b76c7e1ba0ad816f3958a178608
[ "MIT" ]
null
null
null
packages/icons-vue/src/icons/WeiboOutlined.jsx
whalue-design/whalue-design-icons
c2a19c6815855b76c7e1ba0ad816f3958a178608
[ "MIT" ]
null
null
null
// GENERATE BY ./scripts/generate.js // DON NOT EDIT IT MANUALLY import Icon from '../components/WvdIcon'; import WeiboOutlinedSvg from '@whalue-design/icons-svg/lib/asn/WeiboOutlined'; export default { name: 'IconWeiboOutlined', displayName: 'WeiboOutlined', functional: true, props: { ...Icon.props }, render: (h, { data, children, props }) => h( Icon, { ...data, props: { ...data.props, ...props, icon: WeiboOutlinedSvg } }, children, ), };
26.722222
78
0.642412
false
true
false
true
1277856055db3a7fb6c4d494c3803aee643b74f7
2,029
jsx
JSX
src/icons/cog-icon.jsx
jsalis/londo-ui
7aa8732cc84c0b00356a042d77349c7263a125c5
[ "MIT" ]
1
2021-07-14T21:26:06.000Z
2021-07-14T21:26:06.000Z
src/icons/cog-icon.jsx
jsalis/londo-ui
7aa8732cc84c0b00356a042d77349c7263a125c5
[ "MIT" ]
null
null
null
src/icons/cog-icon.jsx
jsalis/londo-ui
7aa8732cc84c0b00356a042d77349c7263a125c5
[ "MIT" ]
null
null
null
import { Icon } from "../components"; export function CogIcon(props) { return ( <Icon {...props}> <path d="M12,16c2.206,0,4-1.794,4-4s-1.794-4-4-4s-4,1.794-4,4S9.794,16,12,16z M12,10c1.084,0,2,0.916,2,2s-0.916,2-2,2 s-2-0.916-2-2S10.916,10,12,10z" /> <path d="M2.845,16.136l1,1.73c0.531,0.917,1.809,1.261,2.73,0.73l0.529-0.306C7.686,18.747,8.325,19.122,9,19.402V20 c0,1.103,0.897,2,2,2h2c1.103,0,2-0.897,2-2v-0.598c0.675-0.28,1.314-0.655,1.896-1.111l0.529,0.306 c0.923,0.53,2.198,0.188,2.731-0.731l0.999-1.729c0.552-0.955,0.224-2.181-0.731-2.732l-0.505-0.292C19.973,12.742,20,12.371,20,12 s-0.027-0.743-0.081-1.111l0.505-0.292c0.955-0.552,1.283-1.777,0.731-2.732l-0.999-1.729c-0.531-0.92-1.808-1.265-2.731-0.732 l-0.529,0.306C16.314,5.253,15.675,4.878,15,4.598V4c0-1.103-0.897-2-2-2h-2C9.897,2,9,2.897,9,4v0.598 c-0.675,0.28-1.314,0.655-1.896,1.111L6.575,5.403c-0.924-0.531-2.2-0.187-2.731,0.732L2.845,7.864 c-0.552,0.955-0.224,2.181,0.731,2.732l0.505,0.292C4.027,11.257,4,11.629,4,12s0.027,0.742,0.081,1.111l-0.505,0.292 C2.621,13.955,2.293,15.181,2.845,16.136z M6.171,13.378C6.058,12.925,6,12.461,6,12c0-0.462,0.058-0.926,0.17-1.378 c0.108-0.433-0.083-0.885-0.47-1.108L4.577,8.864l0.998-1.729L6.72,7.797c0.384,0.221,0.867,0.165,1.188-0.142 c0.683-0.647,1.507-1.131,2.384-1.399C10.713,6.128,11,5.739,11,5.3V4h2v1.3c0,0.439,0.287,0.828,0.708,0.956 c0.877,0.269,1.701,0.752,2.384,1.399c0.321,0.307,0.806,0.362,1.188,0.142l1.144-0.661l1,1.729L18.3,9.514 c-0.387,0.224-0.578,0.676-0.47,1.108C17.942,11.074,18,11.538,18,12c0,0.461-0.058,0.925-0.171,1.378 c-0.107,0.433,0.084,0.885,0.471,1.108l1.123,0.649l-0.998,1.729l-1.145-0.661c-0.383-0.221-0.867-0.166-1.188,0.142 c-0.683,0.647-1.507,1.131-2.384,1.399C13.287,17.872,13,18.261,13,18.7l0.002,1.3H11v-1.3c0-0.439-0.287-0.828-0.708-0.956 c-0.877-0.269-1.701-0.752-2.384-1.399c-0.19-0.182-0.438-0.275-0.688-0.275c-0.172,0-0.344,0.044-0.5,0.134l-1.144,0.662l-1-1.729 L5.7,14.486C6.087,14.263,6.278,13.811,6.171,13.378z" /> </Icon> ); }
184.454545
1,727
0.66486
false
true
false
true
127792955110415e47c34b19d5eedf24377c6750
2,923
jsx
JSX
lib/components/export.react.jsx
raylu/terminal.sexy
161714d140181911b7fa5a618781fb02b8cd3dd9
[ "MIT" ]
null
null
null
lib/components/export.react.jsx
raylu/terminal.sexy
161714d140181911b7fa5a618781fb02b8cd3dd9
[ "MIT" ]
null
null
null
lib/components/export.react.jsx
raylu/terminal.sexy
161714d140181911b7fa5a618781fb02b8cd3dd9
[ "MIT" ]
null
null
null
'use strict'; var React = require('react'); var termcolors = require('termcolors'); var saveAs = require('filesaver.js'); var AppStore = require('../stores/app'); termcolors.json = require('../formats/json'); var Export = React.createClass({ getInitialState: function () { return { text: '' }; }, handleExport: function () { var type = this.refs.select.getDOMNode().value; if (! type) { return; } var colors = AppStore.getState().colors; this.setState({ text: termcolors[type].export(colors) }); }, handleDownload: function () { var type = this.refs.select.getDOMNode().value; var scheme = AppStore.getState().scheme; var filename switch(type) { case 'xshell': filename = scheme + '.xcs'; break; case 'putty': filename = scheme + '.reg'; break; case 'iterm': filename = scheme + '.itermcolors'; break; default: filename = scheme + '.txt'; break; } saveAs( new Blob([this.state.text], {type: 'text/plain;charset=utf-8'}), filename ); }, render: function () { return ( <div className='export'> <div className="control"> <label>Format:</label> <select ref='select' defaultValue='xresources'> <option value='alacritty'>Alacritty</option> <option value='chromeshell'>Chrome Secure Shell</option> <option value='gnome'>Gnome Terminal</option> <option value='guake'>Guake</option> <option value='iterm'>iTerm2</option> <option value='konsole'>Konsole</option> <option value='kitty'>Kitty</option> <option value='linux'>Linux console</option> <option value='mintty'>MinTTY</option> <option value='putty'>Putty</option> <option value='st'>Simple Terminal</option> <option value='terminalapp'>Terminal.app</option> <option value='terminator'>Terminator</option> <option value='termite'>Termite</option> <option value='xfce'>XFCE4 Terminal</option> <option value='xshell'>Xshell</option> <option value='xresources'>Xresources</option> <option value=''>-- OTHER --</option> <option value='textmate'>Sublime Text (experimental)</option> <option value='json'>JSON Scheme</option> </select> </div> <textarea value={this.state.text} readOnly spellCheck='false' className='background-bg' ref='textarea' /> <div className='buttons'> <button type='button' onClick={this.handleExport} className='button button-export'>Export</button> <button type='button' onClick={this.handleDownload} className='button button-download'>Download</button> </div> </div> ); } }); module.exports = Export;
30.768421
114
0.584331
false
true
false
true
127793fae5e9c19305dc0cda91e1973eb06936cd
1,358
jsx
JSX
frontend/src/components/Polling/PollingLink.jsx
aleciabenjamin/Planning-Poker
db1d620db6205785869fa250b87c436095c9c2d9
[ "MIT" ]
1
2020-07-28T10:37:23.000Z
2020-07-28T10:37:23.000Z
frontend/src/components/Polling/PollingLink.jsx
aleciabenjamin/Planning-Poker
db1d620db6205785869fa250b87c436095c9c2d9
[ "MIT" ]
2
2021-03-10T18:14:55.000Z
2022-02-27T04:46:58.000Z
frontend/src/components/Polling/PollingLink.jsx
aleciabenjamin/Planning-Poker
db1d620db6205785869fa250b87c436095c9c2d9
[ "MIT" ]
null
null
null
import React, { useState } from "react"; import { Form, Button } from "react-bootstrap"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCopy } from "@fortawesome/free-regular-svg-icons"; import "components/Polling/styles.scss"; const PollingLink = ({ sessionUuId }) => { const [copied, handleCopied] = useState(false); return ( <Form> <Form.Group controlId="pollingLink" className="text-right"> <Form.Control type="text" name="pollingLink" placeholder="Polling Link" className="polling-uuid-field text center d-inline-block" readOnly={true} value={`${sessionUuId ? sessionUuId : ""}`} /> <CopyToClipboard text={`${sessionUuId ? sessionUuId : ""}`} onCopy={() => handleCopied(true)} > <Button variant="link" className="copy-to-clipboard-btn" onClick={(e) => e.preventDefault()} title="Copy to Clipboard" > <FontAwesomeIcon icon={faCopy} /> </Button> </CopyToClipboard> {copied ? ( <span className="text-success">Copied to Clipboard!</span> ) : null} </Form.Group> </Form> ); }; export default PollingLink;
31.581395
68
0.580265
false
true
false
true
12779afc5f7d72eed9fd185fd5b94136dd0c0185
9,125
jsx
JSX
src/components/navbar/navbar.jsx
mayanksh99/dsc-connect-client
31279b5e645c532a9916374750f2828828c3a4f1
[ "MIT" ]
null
null
null
src/components/navbar/navbar.jsx
mayanksh99/dsc-connect-client
31279b5e645c532a9916374750f2828828c3a4f1
[ "MIT" ]
null
null
null
src/components/navbar/navbar.jsx
mayanksh99/dsc-connect-client
31279b5e645c532a9916374750f2828828c3a4f1
[ "MIT" ]
null
null
null
import React, { useState, useContext } from "react"; import { NavLink } from "react-router-dom"; import { AuthContext, DispatchContext } from "../../contexts/userContext"; import styles from "./navbar.module.css"; import useInputState from "../../hooks/useInputState"; import axios from "axios"; import { login } from "./../../utils/routes"; export default function NavBar(props) { const Data = useContext(AuthContext); const Dispatch = useContext(DispatchContext); const handleLogout = () => { Dispatch({ type: "OUT" }); }; const [email, handleEmailChange] = useInputState(""); const [password, handlePasswordChange] = useInputState(""); const [UpIn, setUpIn] = useState(); const dispatch = useContext(DispatchContext); const data = useContext(AuthContext); // useEffect(() => { // data.token !== "" ? props.history.push("/") : props.history.push("/login"); // }, []); const handleLoginSubmit = async e => { e.preventDefault(); let body = { email: email, password: password }; try { const response = await axios.post(login, body); dispatch({ type: "IN", user: { name: response.data.data.name, x: response.data.data.latitude, y: response.data.data.longitude }, token: response.headers["x-auth-token"] }); window.location = "/"; //props.history.push("/"); } catch (error) { console.log(error); } }; const loginBtn = () => { setUpIn("login"); }; const registerBtn = () => { setUpIn("register"); }; return ( <> <nav className="navbar navbar-expand-lg navbar-light"> <div className="container mx-auto"> <NavLink className="navbar-brand" to="/"> <img className="img-fluid" src="/assets/images/logo.svg" alt="logo" width="200px" /> </NavLink> <button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" style={{ border: 0 }} > <span className="navbar-toggler-icon"></span> </button> <div className="collapse navbar-collapse" id="navbarSupportedContent"> <ul className={`navbar-nav mr-auto justify-content-end ${styles.ulEdit}`} > {Data.token === "" ? ( <> <li className="nav-item "> <NavLink className="nav-link" onClick={registerBtn} to="/" data-toggle="modal" data-target="#exampleModalCenter" > Sign Up </NavLink> </li> <li className="nav-item"> <NavLink className=" btn btn-primarynav-link" onClick={loginBtn} to="/" data-toggle="modal" data-target="#exampleModalCenter" type="button" > Sign In </NavLink> </li> </> ) : ( <> <li> <NavLink to="/add"> <button type="button" className={`btn btn-success mt-2 mr-2 ${styles.addBtn}`} > Add your community </button> </NavLink> </li> <li className="nav-item dropdown"> <p className="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" > <img className="img-fluid rounded" src="https://s3.eu-central-1.amazonaws.com/bootstrapbaymisc/blog/24_days_bootstrap/fox.jpg" width="35" alt="" /> </p> <div className="dropdown-menu" aria-labelledby="navbarDropdownMenuLink" > <NavLink className="dropdown-item" to="#"> Profile </NavLink> <NavLink className="dropdown-item" to="/" onClick={handleLogout} > Log Out </NavLink> </div> </li> </> )} </ul> </div> </div> </nav> <div className="modal fade" id="exampleModalCenter" tabIndex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true" > <div className="modal-dialog modal-dialog-centered" role="document"> <div className="modal-content"> <div className="modal-header"> <h5 className="modal-title" id="exampleModalCenterTitle"> Log In </h5> <button type="button" className="close" data-dismiss="modal" aria-label="Close" > <span aria-hidden="true">&times;</span> </button> </div> <div className="modal-body"> {UpIn === "login" ? ( <form onSubmit={handleLoginSubmit}> <div className="form-group"> <label htmlFor="exampleInputEmail1">Email address</label> <input type="email" className="form-control" id="exampleInputEmail1" value={email} onChange={handleEmailChange} placeholder="Enter email" /> </div> <div className="form-group"> <label htmlFor="exampleInputPassword1">Password</label> <input type="password" className="form-control" id="exampleInputPassword1" value={password} onChange={handlePasswordChange} placeholder="Enter password" /> </div> <div className="modal-footer"> <button type="submit" className="btn btn-primary"> Log In </button> </div> </form> ) : ( <form onSubmit={handleLoginSubmit}> <div className="form-group"> <label htmlFor="exampleInputName1">Name</label> <input type="Name" className="form-control" id="exampleInputName1" value={email} onChange={handleEmailChange} placeholder="Enter name" /> </div> <div className="form-group"> <label htmlFor="exampleInputEmail1">Email address</label> <input type="email" className="form-control" id="exampleInputEmail1" value={email} onChange={handleEmailChange} placeholder="Enter email" /> </div> <div className="form-group"> <label htmlFor="exampleInputPassword1">Password</label> <input type="password" className="form-control" id="exampleInputPassword1" value={password} onChange={handlePasswordChange} placeholder="Enter password" /> </div> <div className="modal-footer"> <button type="submit" className="btn btn-primary"> Log In </button> </div> </form> )} </div> </div> </div> </div> </> ); }
33.921933
115
0.416986
false
true
false
true
1277a73acae4a5766dd22d9d2eeef39b2c75c117
996
jsx
JSX
frontend/store/state/user.jsx
3nt3/color-themes
d51f15d96937fdad303168af33b512a811dde183
[ "MIT" ]
126
2015-11-06T08:02:21.000Z
2020-01-21T12:16:48.000Z
frontend/store/state/user.jsx
3nt3/color-themes
d51f15d96937fdad303168af33b512a811dde183
[ "MIT" ]
29
2015-09-24T15:02:06.000Z
2019-08-16T07:07:28.000Z
frontend/store/state/user.jsx
3nt3/color-themes
d51f15d96937fdad303168af33b512a811dde183
[ "MIT" ]
38
2020-06-14T19:45:28.000Z
2022-03-27T09:32:28.000Z
var defaultUserState = { name: "", email: "", updated: false, pending: true, isPremium: false }; export var UserActionType = { SET_USER: "SET_USER", SET_PENDING: "SET_PENDING" } export default class UserActions { static setUser(user) { const {name, email, isPremium} = (user || {}); return { type: UserActionType.SET_USER, name, email, isPremium}; } static setPending() { return {type: UserActionType.SET_PENDING}; } } export function user(state = defaultUserState, action) { switch (action.type) { case UserActionType.SET_USER: return { name: action.name || "", email: action.email || "", updated: true, pending: false, isPremium: !!action.isPremium }; case UserActionType.SET_PENDING: return Object.assign({}, state, {pending: true}); default: return state; } }
24.292683
72
0.553213
false
true
false
true
1277b2f9478fd220a787fe30e30402d91f5e62fa
260
jsx
JSX
src/components/Layout.jsx
albertofragoso/patitas
e3ad379e0607d9ef581bb10c324d214bc65a4545
[ "MIT" ]
null
null
null
src/components/Layout.jsx
albertofragoso/patitas
e3ad379e0607d9ef581bb10c324d214bc65a4545
[ "MIT" ]
3
2021-03-09T11:53:09.000Z
2021-10-06T00:44:43.000Z
src/components/Layout.jsx
albertofragoso/patitas
e3ad379e0607d9ef581bb10c324d214bc65a4545
[ "MIT" ]
null
null
null
import React from 'react' import Header from './Header' import Footer from './Footer' import Home from '../pages/Home' const Layout = ({ children }) => ( <div className="Layout"> <Header /> {children} <Footer /> </div> ) export default Layout
18.571429
34
0.638462
false
true
false
true
1277ba348bb191ea567d383ef9f19ab8bc7a41ec
109,079
jsx
JSX
content/blog/2017-12-17-1/index.jsx
BurkovBA/BurkovBA.github.io
293b37fa3ee7ef1232d3be5d23eda3bbc9d1f757
[ "MIT" ]
null
null
null
content/blog/2017-12-17-1/index.jsx
BurkovBA/BurkovBA.github.io
293b37fa3ee7ef1232d3be5d23eda3bbc9d1f757
[ "MIT" ]
14
2017-12-05T14:35:07.000Z
2018-11-08T17:06:53.000Z
content/blog/2017-12-17-1/index.jsx
BurkovBA/BurkovBA.github.io
293b37fa3ee7ef1232d3be5d23eda3bbc9d1f757
[ "MIT" ]
null
null
null
import React from 'react'; let metadata = { id: "2017-12-17-1", author: "Boris Burkov", authors_avatar: require("images/burkov_boris_web.jpg"), date_created: "17.12.2017", language: "en", title: "Traction", subtitle: "\"MOST STARTUPS DON'T FAIL BECAUSE THEY CAN'T BUILD THE PRODUCT. MOST STARTUPS FAIL BECAUSE THEY CAN'T GET TRACTION.\"", abstract: "This is a digest of 2013 book by the creator of DuckDuckGo search engine Gabriel Weinberg and business writer Justin Mares.\n" + "In this book they explain how vital for an aspiring entrepreneur is to create customer/media awareness of their product\n" + "and give practical advices and examples of how this can be achieved.", cover: "http://t0.gstatic.com/images?q=tbn:ANd9GcRrs7XfZqihvWX-CCmLKp8R9Q0zncirJmWTOEVpa9oEFYQRXphz", categories: ["business", "programming", "people"], time_to_read: 120, views: "", comments: [], }; class Content extends React.Component { constructor(props) { super(props); this.state = metadata; } render() { return ( <div> <h3>Preface</h3> <p> Authors of the book are 2 people:<br /> <b>Justin Mares</b> founded 2 startups, formerly director of revenue at Exceptional, acquired by Rackspace.<br /> <b>Gabriel Weinberg</b> sold his first start-up for multiple million dollars in 2006 at the age of 27. </p> <p> After that Gabriel started writing DuckDuckGo alone, staying in his new house with his wife and released it in the fall of 2008. He posted it on HackerNews and got some interest (with lots of critique naturally). His first project used SEO and viral marketing channels to get traction. He tried to use SEO for this attempt, too, trying to optimize for "new search engine" search query. Then he came up with a widget that returned number of followers of a user to be embedded on their websites, this was bringing about 50 users a day, which clearly was not enough. He realized that for this case he will need to find a different channel of customer acquisition, which made him investigate the problem deeper and eventually led to creation of this manual. </p> <h3>Chapter 1. Traction Channels</h3> <p> Authors draw a parallel between company's traction efforts and a game of darts. In darts you need to hit the center of the target, called "bullseye", surrounded by 3 concentric rings. Similar to that, startup founders also needs to choose their trajectory to the bullseye of their marketing efforts, crossing 3 concentric rings to reach explosive customer growth. </p> <img className="image-responsive center-block" src="https://images-na.ssl-images-amazon.com/images/I/51mHSdQVlfL._SL500_AC_SS350_.jpg" /> <p> 3 rings are: </p> <ul> <li> Outer ring: enumerate all the available traction channels</li> <li> Middle ring: do cheap tests for all of them to see if particular channel is working for you or not</li> <li> Inner ring: get the most promising channel and optimise its performance</li> </ul> <p> Each of the remaining chapters of this book gives details on particular traction channels and suggests strategy and tactics of action with respect to one channel, examples of success/failure and interview with specialists in that particular channel </p> <p>Traction channels:</p> <ol> <li><b>Targeting blogs</b> - Noah Kagan, director of marketing at Mint (personal finance, acquired by Intuit for $170M)</li> <li><b>Publicity</b> - Jason Kincaid, TechCrunch writer; Ryan Holiday - media strategist, author of "Trust me, I'm lying"</li> <li><b>Unconventional PR</b> - Alexis Ohanian - Reddit and Hipmunk</li> <li><b>Search Engine Marketing</b> - Matthew Monahan of Inflection/Archives.com - acquired by Ancestry.com</li> <li><b>Social and Display Ads</b> - Nikhil Sethi of Adaptly - social and buying platform</li> <li><b>Offline Ads</b> - Jason Cohen of WP Engine and Smart Bear Software</li> <li><b>Search Engine Optimization</b> - Rand Fishkin of Moz (SEO soft), Patrick McKenzie of Appointment Reminder</li> <li><b>Content Marketing</b> - Rick Perreault of Unbounce, Sam Yagan of OkCupid</li> <li><b>Email Marketing</b> - Colin Nederkoorn, founder of Customer.io</li> <li><b>Engineering as Marketing</b> - Dharmesh Shah, founder of HubSpot, Marketing Grader</li> <li><b>Viral Marketing</b> - Andrew Chen, viral marketing expert at 500 Startups, Ashish Kundra of myZamana 100k -> 4M in less than 1 year</li> <li><b>Business Development</b> - Paul English, CEO of Kayak, early partnership with AOL, Chris Fralic of Half.com, bought by eBay for $350M</li> <li><b>Sales</b> - David Skok of Matrix partners</li> <li><b>Affiliate Programs</b> - Kristopher Jones of Pepperjam affiliate network, Maneesh Sethi (?)</li> <li><b>Existing Platforms</b> - Alex Pachikov of Evernote (bandwagoned App Store)</li> <li><b>Trade Shows</b> - Brian Riley of SureStop - bike brakes</li> <li><b>Offline Events</b> - Rob Walling of MicroConf</li> <li><b>Speaking Engagements</b> - Eric Ries of Lean Startup, Dan Martell of Clarity</li> <li><b>Community Building</b> - Jeff Atwood of StackExchange</li> </ol> <h3>Chapter 2. Traction Thinking</h3> <p> Mark Andreeson, founder of Netscape and Andreeson-Horowitz, says that in successful startups 50 percent of engineering effort goes to traction. If founders don't have any idea of how to get traction or, even worse, deny the need of active promotion or the project, claiming that it will get viral - it's a bad signal for investor. </p> <p> There's a great temptation to postpone traction efforts until your project is in a very mature state. Don't do that: attempts to get traction actually help you get feedback and bring your attention to overlooked aspects of your project. </p> <p> For Dropbox Customer Acquisition cost was $230, while product was $99, so they had to rely on viral marketing. </p> <p> Naval Ravikant, founder of AngelList: </p> <blockquote> "In November 2010 you could've gotten daily deal startup founded pre-traction, 18 months later you couldn' get funded no matter what." </blockquote> <p> DuckDuckGo had security in mind since 2009, but nobody cared since 2013 until Snowden. After that anonimity became a major selling point for the project. </p> <h3>Chapter 3. Bullseye</h3> <p>Noting interesting.</p> <h3>Chapter 4. Traction Testing</h3> <p> Tools: Clicky, Mixpanel, Chartbeat. </p> <p> Indicators of traction channel: total number of customers available, conversion rate, cost to acquire a customer, lifetime value of a customer. </p> <h3>Chapter 5. Critical Path</h3> <p> Your should envision a certain trajectory of your project, where at each step of its life you should strive to achieve certain <b>Key Performance Indicators (KPI)</b>. For instance, DuckDuckGo at certain point had a goal to get 1% of total search requests in the world. </p> <p> All the traction channels bring users to you, but some are too slow. For instance, SEO and engineering as marketing for DuckDuckGo were bringing users, but at the orders of magnitude slower than it was required. You physically won't have time to work on all the traction channels available. </p> <p>Thus, you should focus only on those channels that are significant enough to help you achieve KPIs.</p> <h3>Chapter 6. Targeting Blogs</h3> <p> Noah Kagan from Mint (personal finance service) was using blogs to reach early traction goal of 100 000 users in first 6 months. He held the following table to quantify their efforts: </p> <div className="table-responsive"> <table className="table"> <thead> <tr> <th>Source</th> <th>Traffic</th> <th>CTR</th> <th>Conversion</th> <th>Total users</th> <th>Status</th> <th>Confirmed</th> <th>Confirmed users</th> </tr> </thead> <tbody> <tr> <td>Tech Crunch</td> <td>300,000</td> <td>10%</td> <td>25%</td> <td>7,500</td> <td>Friend</td> <td>Yes</td> <td>7,500</td> </tr> <tr> <td>Dave McClure</td> <td>30,000</td> <td>10%</td> <td>25%</td> <td>750</td> <td>Friend</td> <td>Yes</td> <td>750</td> </tr> <tr> <td>Mashable</td> <td>500,000</td> <td>100%</td> <td>25%</td> <td>12,500</td> <td>Email</td> <td>No</td> <td>0</td> </tr> <tr> <td>reddit</td> <td>25,000</td> <td>100%</td> <td>25%</td> <td>6,250</td> <td>Coordinated</td> <td>Yes</td> <td>6,250</td> </tr> <tr> <td>Digg</td> <td>100,000</td> <td>100%</td> <td>25%</td> <td>25,000</td> <td>Coordinated</td> <td>Yes</td> <td>25,000</td> </tr> <tr> <td>Google organic</td> <td>5000</td> <td>100%</td> <td>15%</td> <td>750</td> <td>Receiving</td> <td>Yes</td> <td>250</td> </tr> <tr> <td>Google Ads</td> <td>1,000,000</td> <td>3%</td> <td>35%</td> <td>10,500</td> <td>Bought</td> <td>Yes</td> <td>10,500</td> </tr> <tr> <td>Paul Stamatiou</td> <td>50,000</td> <td>5%</td> <td>50%</td> <td>1,250</td> <td>Friend</td> <td>Yes</td> <td>1,250</td> </tr> <tr> <td>Personal Finance Sponsorships</td> <td>200,000</td> <td>10%</td> <td>75%</td> <td>52,000</td> <td>Coordinated</td> <td>Yes</td> <td>52,000</td> </tr> <tr> <td>Okdork.com</td> <td>3,000</td> <td>10%</td> <td>75%</td> <td>225</td> <td>Self</td> <td>Yes</td> <td>225</td> </tr> <tr> <td colSpan="4">Total:</td> <td colSpan="3">116,725</td> <td>104.225</td> </tr> </tbody> </table> </div> <p> How to find blogs in you niche: </p> <ul> <li>google "top X blogs" or "best blogs on X"</li> <li>YouTube</li> <li>Delicious</li> <li>Twitter</li> <li>Social Mention</li> <li>Talk to People</li> </ul> <p> Popular blogs you might not know about: reddit, Product Hunt, Hacker News, Inbound.org, Digg, Quora, Codecademy, Gumroad, Lifehacker. </p> <h3>Chapter 7: Publicity, PR</h3> <h4>Strategy:</h4> <p> Ryan Holiday, director of marketing at American Apparel, author of Trust me, I'm lying: </p> <blockquote> If New York tells about you, they make you a huge favor (their space is limited), if Business Insider posts about you, you make them a favor (their space is infinite). </blockquote> <p> Huffington Post now churns out hundreds of hundreds of articles a day - more articles - more page views - more ad money. </p> <p> CNN, New York Times, the Today show now scout smaller outlets for captivating stories. </p> <p>Ryan Holiday:</p> <blockquote> It's better to start small when targeting big media outlets. So you find the blogs, which TechCrunch reads and get story ideas from. Chances are, it will be easier to get those blogs' attention. You pitch there, which leads TechCrunch to email you or do a story about you based on the information [they've seen] on the news radar. </blockquote> <p> Food chain: Hackernews/subreddits -> TechCrunch/LifeHacker -> New York Times </p> <p> Case of Donors.org: Teachers in NYC often use it to raise money for their projects -> Newsweek picked it -> Oprah's team found it in Newsweek in 2010 -> funding from Gates foundation, major increase in donations. </p> <p> Jason Kincaid, formerly reporter of TechCrunch, says he got pitched >50 times a day. </p> <p> What gets attention: raising money, PR stunt, big partnership, special industry report. But better is a mix of those. </p> <p> No walls of text in emails to reporters! </p> <p> Emotional reaction: they wrote a book about stock exchange, explaining technical details and also noted that market is essentially rigged. </p> <p> Help a Reporter Out (HARO) service </p> <p> Reporter have Twitter accounts with surprisingly small numbers of followers. </p> <p> Plan of action: </p> <ol> <li>submit story to link-sharing sites (reddit, Hacker News) with larger audiences</li> <li>share it on social networks to drive awareness + add social ads</li> <li>email influencers in your industry for comment, some of them will share them with your audience</li> <li>ping blogs in your space, tell them that you have a story that's getting buzz - they may want to jump in and cover you themselves</li> </ol> <p>E-mail template:</p> <blockquote> Hey [name], I wanted to shoot you a note because I loved your post on [similar topic that did a lot of traffic]. I was going to give the following to our publicist, but I thought I would go to you with the exclusive because I read and really enjoy your stuff. My [company built a user base of 25000/book blows the lid of enormous XYZ scandal]. And I did it completely off the radar. This means you'll be first to have it. I can write up any details you need to make it great. Do you think this might be a good fit? If so, should I draft something around [their average] words and send it to you, or do you prefer a different process? If not, totally understand and thanks for reading this much. All the best, [your name] </blockquote> <p>Ryan Holiday about investors:</p> <blockquote> When people gamble, but they don't tell themselves they're gambling (as investors do), they need information to justify their decisions, and they need social proof and examples and evidence that thjey're doing the right thing. They already know if they want to invest in you or not, and they're looking for information that they made the right call. Press is one of the few things that push people over the edge and confirm they're doing the right thing. </blockquote> <h3>Chapter 8. Unconventional PR.</h3> <p>Two main directions: publicity stunts and customer appreciation</p> <h4>Publicity stunts</h4> <p> Richard Brenson was doing his press-conferences as outlandish as possible, dressing like a woman or driving a tank. </p> <p> In 1999 Half.com renamed a town called Halfway into Half.com for a year for $70k and hired a couple of employees there. Josh Copelman launched Half.com on Today show with the mayor of Halfway, Oregon. They received coverage from NY Times, PBS, Wall Street Journal and hundreds of other publications. This gave them 40 mln customers and they were acquired by Ebay in 6 months for 300 million dollars. </p> <p> WePay, Web payment startup, placed a 600-pound block of ice at the conference entrance - PayPal was criticized for freezing some of its customers accounts - and WePay drove attention to that at PayPal's own conference! 1000s of signups. </p> <p> DuckDuckGo brought a billboard in Google's backyard, highlighting its privacy focus. Billboard got press at USA Today, Wired and other media outlets. This doubled their user base. </p> <p> Blendtec, blender manufacturer in Utah, in 2007 created a series of videos "Will it blend?", where they blended a rake, golf balls and iPhone. iPhone video received over 8 million views , and series became a top-100 most viewed on youtube. This increased sales by 500%. </p> <p> Dollar Shave Club, subscription shaving startup, got similar attention by launching a video "Our Blades are F**king Great". It also has millions of views on YouTube and was the main source of >12,000 customers it acquired within 2 days of launching. Video was shared 31,000+ times on Facebook, received 9,500+ comments, 12,000+ likes, 16,000+ tweets. They quickly ranked 3rd in Google search "shave". This was largely thanks to 1500 sites, linking to the video. It also led to features in Forbes, The Wall Street Journal and Wired. </p> <h4>Customer appreciation</h4> <p> Alexis Ohanian, founder of reddit and Hipmunk (travel booking site) was sending luggage tags with a chipmunk and handwritten notes to first several hundred people, who mentioned the site on Twitter. Also gave away T-shirts, stickers. Did same with reddit - T-shirts with alien, personally emailed users to thank them, those emails became a central theme in reddit's press articles. </p> <p> David Hauser used similar approach at Grasshopper.com. Was sending customers Skittles, homemade cookies, Starbucks gift cards, books and handwritten notes. Had 2 full-time employees, working solely on customer appreciation. </p> <p> Holding contests is a great way to generate publicity. Shopify.com, a popular e-commerce platform, is famous for its annual Build a Business competition and six-figure prize. Last year, the content drove 1,900 new customers and more than $3.5 million in sales on its platform. Dropbox used to hold Dropquest competition - users had to complete an intellectually challenging online scavenger hunt and were rewarded with online recognition, brand items and free Dropbox packages for life. In the first year of the competition, almost half a million people went through the quest. Hipmunk had Mother's Day Giveaway: asked to write, why you love mother more than Hipmunk. Received hundreds of submissions via Twitter, sent flowers and chocolates to the moms of happy winners. For $500 Hipmunk generated a lot of attention. Hipmunk has run other contests - flying customers to Thanksgiving. Hired cartoonists to draw "chipmunked" portraits of customers - received hundreds requests in less than 1 hour, increased Facebook fanbase by >350%. </p> <p> Zappos support team was super-nice, they classified its expenses as marketing investment, average phone call length was huge. They were assisting with returns, ordering pizzas, exchanging workout clothes for deep fat fryer. This made Zappos famous among customers. </p> <h4>More cases by David Hauser</h4> <p> While launching Grasshopper.com instead of a press release, they sent chocolate-covered grasshoppers to 5000 influencial people. With each grasshopper they sent a promotional video. After launching this campaign, they got coverage from Fox News, tweets by Guy Kawasaki and Kevin Rose (who had millions of Twitter followers). For $65,000 they became a well-known brand among entrepreneurs. This received major media coverage, created a Youtube video, watched over 200,000 times, over 150 blog posts, increased number of visitors, coming from Twitter and Facebook by over 3,000%. </p> <p> Also they created a viral video "The New Dork" with startup-themed humor, parody on Jay-Z and Alicia Keys song "Empire State of Mind", which received 1 mln views and mentions from Ashton Kutcher, Mashable and TechCrunch. Consciously made references to Mashable in that video, gave a note to them after video release, which gave them more incentive to give more exposure. </p> <p> David's team at another startup Chargify attended SXFW conference and instead of paying $10-15k for sponsorship, they hired a stuntman for $3,000 to run in a big green bull's dress, do backflips, drive Corvette and draw attention otherwise. </p> <p> David's failures: unsuccessful March Madness promotions, failed ticket giveaways, failed dancing grasshoppers video. Anyway, his channel works for them and they leverage it more than any other. </p> <h3>Chapter 9. Search Engine Marketing (SEM)</h3> <p> Online marketers spend over $100 million every day on Google's AdWords. Works in B2C, focuses on people, who are already looking for what you're selling. </p> <p>Terms:</p> <ul> <li><b>Click-Through Rate (CTR)</b> - percentage of ad impressions that result in clicks to your site. If 100 people see your ad and 3 click it, CTR=3%.</li> <li><b>Cost per Click (CPC)</b> - amount it costs to buy a click on an advertisement. CPC is the maximum amount you're willing to pay for a potential customer to come to your site.</li> <li><b>Cost per Acquisition (CPA)</b> - how much it costs to acquire a customer, not just a click. If you buy clicks at $1 and 10% of those who clicked become customers ("convert"), CPA = $10 = CPC / conversion percentage.</li> </ul> <p> Matthew Monahan, CEO and cofounder of Inflection, was spending six figures per month on SEM. They were acquired by Ancestry.com for $100 million. Initially they used SEM to get the initial user base and validate their product (good feedback for just $500-5000). This gave the ballpark of most important metrics: conversions of landing pages, how well email captures are working, average customer acquisition cost (CAC), customer lifetime value (LTV). They used AdWords to drive traffic to landings BEFORE investing into product development. By measuring CTR for different keywords and conversion on those landings, they determined most interesting aspects for customers. They were not sure about scenarios of how customer will use Ancestry.com and this gave them idea. By the time they were building the product, they knew exactly what users wanted. Their initial SEM campaign broke even in a few weeks, meaning that their CPA/CAC=LTV without optimizations of landings, thus they started to spend $100,000 a month on this channel. </p> <h4>Strategy</h4> <p> Google AdWords is the major SEM platform, although BingsAds are also worth considering (they are running on Yahoo!, Bing and DuckDuckGo). </p> <p>Tools to find out, what keywords your audience is looking for and what keywords your rivals are using:</p> <ul> <li>Google's Keyword Planner</li> <li>Keyword Spy</li> <li>SEMrush</li> <li>SpyFu</li> </ul> <p> SEM gets more expensive the more popular your keywords are, thus for testing purposes it is ideal to use "long-tail keywords", such as "1990 census data" instead of just "census data". The ad itself should contain a catchy and relevant title, a well-articulated Call To Action and keywords. After that you should use Google Analytics URL Builder tool to create uniquie URLs pointing to your landing pages to track which ads are converting, not only being clicked at. According to Matthew, just 4 ads are enough to get a baseline of SEM performance and still testing messaging, demographics and landing pages. </p> <p> If customer acquisition cost (CAC) was 15 cents and you make revenue of 13 cents per click, you're in minus. But if you optimize your (sales - marketing) values, you can achieve huge profit margin improvements and dramatically change you business. </p> <p> Optimizely and Visual Website Optimizer are tools to run A/B tests on landing pages. </p> <p> Ads and ad groups are assigned a quality score by Google. It primarily depends on CTR (average CTR is 2%, if CTR is below 1.5%, Google assigns a low score) and time people spend on your website. The higher your quality score, the better ad placings and pricing you get from Google. </p> <h4>Tactics</h4> <p> 2 subtypes of AdWords are Google search network - paid search links - and Google content network - ads on non-Google sites. </p> <p> Retargeting with sites like AdRoll and Perfect Audience allows you to make people, who visited your site, see your links on other sites and be driven back. This increases CTR by 3x or 10x - those users are already hot and close to the center of your conversion funnel. </p> <p> Google Conversion Optimizer is a tool that analyzes your conversion tracking data and automatically adjusts your ads to perform better. You can also use scripts to dynamically manage large number of ads and keywords. </p> <h3>Chapter 10. Social and Display Ads.</h3> <p> Display ads (= banner ads) and social ads are often used both to increase brand awareness much like offline ads and to elicit a direct response. One exclusive application of social ads is to build audience, engage with it over time, eventually convert it into customers. </p> <h4>Display ads</h4> <p> Ad networks: </p> <ul> <li>Google's Display Network (aka Google Content Network) - 4B daily pageviews, 700 unique monthly users, 80% of total online audience</li> <li>Advertising.com (owned by AOL)</li> <li>Tribal Fusion</li> <li>Conversant</li> <li>Adblade</li> </ul> <p> Ad networks allow you to focus on different audience demographics, use images, video, interactive or text ads. Unlike SEM, with display ads user doesn't have to search for your query exactly - e.g. if you're selling a weight-loss product, you can display it on any sites, mentioning nutrition or carbohydrates. </p> <p> There are niche ad networks, focused on smaller sites and a specific audience demographics. </p> <p>Other tools:</p> <ul> <li>the Deck - niche audience of Web creatives</li> <li>BuySellAds - marketplaces for directly buying ads from advertisers</li> <li>MixRank, Adbeat - show you what ads your competitors are running</li> <li>Alexa and Quantcast - show you who visit sites that your competitors are using for their ads</li> </ul> <h4>Social ads</h4> <p> With social ads it often makes sense to create interest about a piece of content, rather than go for clicks directly. </p> <p> CareOne, debt consolidation and relief company, did a survey: social media connections filled out lead generation form at 179% higher rate than typical customers, were 217% more likely to do first payment, came back to fill sign-up form after partially signing it and quitting at 680% higher rate, made first payment at 732% higher rate. </p> <p> Social ads are good to promote a piece of content that is already popular by itself - it's like organic traffic on steroids. At Airbrake Justin Mares promoted some of their best content on Twitter and Facebook: after spending $15 on Twitter ads, tehy received hundreds of organic retweets, tens of Facebook likes, 2 submissions on reddit and Hacker News, in total driving tens of thousands visitors to their site by paying $15 and creating and interview with Stripe's CTO. </p> <p> Outbrain and Sharethrough are content distribution networks that promote your content on popular partner sites such as Forbes, Thought Catalog, Vice, Gothamist and hundreds more. They make your content look life native on target sites. </p> <p> You can also create social experiences. Warby Parker was mailing eyeglasses for free trial, if you create a photo and share it in social networks. </p> <p>Major social sites:</p> <ul> <li>LinkedIn - 250M professionals. Targeting: job title, company, industry, other business demographics.</li> <li>Twitter - 250M users. Sponsored tweets in users feeds. Effective in right time, e.g. sell sportswear during Olympics.</li> <li> Facebook - over 1B active users. Targteting: user interests, pages they like, connections. Gabriel once targeted just his wife by zip code, alma mater and interest affinities - showed her a picture of their son. It's important that your customers might recommend you to their connections. </li> <li>StumbleUpon - 25M "stumblers", actively looking for something new. Ads are part of content. Users are very likely to go away very quickly, so you have to engage them with blog posts, infographics and video.</li> <li>Foursquare - over 45M users. Good for targeting local population.</li> <li>Tumblr - 100M users. Sponsored posts.</li> <li> reddit - 5B monthly page views, 175M monthly unique users, over 500,000 communities. Ads are sponsored links at the top or sponsored links along the sidebar. You can target communities, good ads are funny or controversial and encourage users to engage. </li> <li>YouTube - over 1B monthly unique users, ads are pre-rolls (run before video) or banner ads.</li> <li>Others: BuzzFeed, Scribd, SlideShare, Pinterest.</li> </ul> <p> Display ads and social ads are similar in principle: they require that you understand your audience. They can be used at any product phase as they have a low minimal price and scale. </p> <h3>Chapter 11. Offline Ads.</h3> <p>Offline ad market is still larger than online.</p> <p> Tim Ferris, author of "The 4-Hour Body" and "The 4-Hour Workweek": </p> <blockquote> If dealing with national magazines, consider using "remnant ads" buying agency such as Manhattan Media or Novous Media that specializes in negotiating discounted pricing of up to 90% off rate card. Feel free to negotiate still lower them as a go-between. </blockquote> <p> Offline ads efficiency is harder to track - you can use promo codes to do this, e.g. tractionbook.com/flyer. Jason Cohen of Smart Bear Software was including a section "How did you hear about us?" in the questionary for new customers. Also included an offer of a free book in Dr. Dobb's Journal. </p> <h4>Print advertisement</h4> <p> There are 7000 magazines in the US falling in 3 major categories: consumer publications for large audiences (those in grocery stores), trade publications on particular industry and local magazines. To understand reader demographics, circulation and publication frequency, ask for media package/media package/press kit. </p> <p> Newspapers are similar to journals, but slant towards over-thirty demographic - many young people still buy magazines, not many young people buy newspapers offline. Some ad campaigns are uniquely suited towards newspapers, e.g. time-sensitive offers (for events/sales), awareness campaigns (often, multi-channel) and widely publicized announcements (e.g. for product launch). </p> <p> Direct mail can be surprisingly targeted. You can buy direct mail list for your audience from seller companies. You can buy lists, grouped by demographic, geography or both. Prices are ~$100 per 1000 consumer names and a bit more for business names and addresses. You can even buy a service that creates address list, prints materials and assembles and mails everything for you. </p> <ul> <li>if it's a postal direct response campaign, provide a self-addressed envelope to increase chances of respone</li> <li>use handwritten envelopes</li> <li>have a clear Call to Action</li> <li>investigate bulk mail with local postal service to reduce pricing</li> </ul> <p> Local print ads, such as flyers, directories, calendars or publications such as church bulletins, community newsletters or coupon booklets are a worth ~$100s of dollars, but can expose you to thousands people. Nice case: InstaCab hired cyclists to bike around San Francisco and hand out business cards to people trying to hail a taxi. </p> <h4>Outdoor advertising</h4> <p> In the US Lamar, Clear Channel and Outfront Media are 3 most powerful players in this $6B industry. Their sites provide PDFs with local available billboards. </p> <p> Gabriel strategically placed a billboard in the startup-heavy SoMa district of San-Francisco to call out the differences between the privacy practices of Google and DuckDuckGo. This received lots of media attention from Wired, USA Today, Business Insider etc. and made DuckDuckGo user base double that month. </p> <p> Billboard cost was $7,000 a month. Billboards in less prominent locations can cost $300-$2500 a month. Ads in Times Square can run you $30,000-$100,000 a month. Billboards have a GRP score (Gross Ratings Points), based on location, number of impressions, type of billboard (e.g. digital). Full score means that a given billbaord should reach 100% of diving population a month. </p> <p> Transit ads are better that billboards in terms of "actionability". Billboard are more about awareness - drivers don't drop everything to go for your ads. Blue Line Media is a company, doing transit ads. </p> <h4>Radio and TV ads</h4> <p> Radio and TV ads are priced on a cost-per-point (CPP) basis, where each point represents what it will cost to reach 1 percent of radio station's listeners. The higher the CPP, the more it will cost you to run ad on a station. Cost depends on market, time and how many ads you bought. Ballpark is week of running ad might cost $500-$1500 in a local market or $4,000-$8,000 in a larger market, such as Chicago. </p> <p> Satellite radios, such as Sirius XM with over 50 million subscribers, are an option. </p> <p> TV ads are often used as a branding mechanism. 90% consumers watch TV, average adult in the US watches 26 hours of TV/week. Production costs for actors, video equipment, editing, sound and effects, shooting etc. can run to ~$10,000s with most expensive ones closer to $200,000. </p> <p> National average for airtime is $350,000. However, there are 1,300-plus local TV stations in the US that can be effective and reasonably priced. Prices for local commercials are $5-$50 per thousand viewers per 30-second time slot. Buying TV ads is rather opaque, there's a lot of negotiations, no rate cards etc. It's likely that you'll want to hire a media buyer or agency to do this. </p> <p> Infomercials from Snuggie to ShamWow sell all sorts of knives, vacuum cleaners and workout and body care products, work from home equipment. They were the main force behind P90X $400 million sales. Infomercials can cost between $50,000 and $500,000 to make and last 2 minutes. Traditionally, they are inserted in 28-minute TV show episodes. They are almost always direct response ads. Require cheap testing in advance. </p> <p>Jason Cohen:</p> <blockquote> One thing I learnt at Smart Bear is that I have zero ability to predict, what's going to work. There'd be a piddly magazine where I thought "This is just some piddly magazine, surely no one ready this", and sure enough it was cheap (due to small circulation) and it'd do terrifically! Our ROI on some of those were incredible. ... And it changed over time - an ad might be good for a quarter, or a year, and then decay slowly until it wasn't valuable anymore. </blockquote> <h3>Chapter 12. Search Engine Optimization (SEO)</h3> <h4>Strategy</h4> <p> Read Moz Beginner's Guide to SEO for basics. </p> <p> There are 2 high-level strategies: fat head and long tail. 30% of searches are made of 1-word or 2-word queries, such as "Dishwashers", while 70% are longer searches that don't get searched as much, but in the aggregate add up to the majority of searches made. Fat-head strategy means that you would try to focus on short queries, such as "wooden toys", while long-tail - on long queries, such as "wood puzzles for 3 year olds". </p> <p> Only ~10% of clicks occur beyond the first 10 links, so you want to be as high on the first page as possible. </p> <h4>Fat-head strategy</h4> <ol> <li> Use Google AdWords Keyword Planner to find terms that best describe your product. You need such keywords that if you captured 10% of search traffic, it still results in meaningful traffic. </li> <li> Use Open Site Explorer to find the number of links, competitors use for a given term. This will give you a rough idea of how dofficult it will be to rank high for a given term. If competitor has thousands links to that term, it will take lots of focus on building links and optimizing SEO higher than them. </li> <li> Use Google Trends to narrow down your keywords list to just a handful. Have certain terms been search more or less often the last year? Is geography ok? </li> <li>Try SEM ads against your keywords. Do they convert well?</li> <li>Make titles and headers of your site include your search terms of choice.</li> <li>Get other sites link to your site, ideally, using exact links you're optimizing for.</li> </ol> <p> For something totally new SEO doesn't work too well - e.g. search terms for Uber would sound like "alternatives to taxicabs that I can hire via my phone". </p> <h4>Long-tail strategy</h4> <p> You can still start from Google Keyword Planner or go with Google Analytics/Clicky and analyze organic traffic leading to your website. If you don't have enough content, drawing people through long-tail keywords, you have 2 choices. You can either create Web pages and then after few months check analytics or you could look at competitors sites for signs of meaningful long-tail SEO traffic: they have lots of landing pages (check site:moz.com) or Alexa search rankings and look at the percentage of visitors your competitors are receiving from search - if one competitor receives a lot more traffic from search than others, they are using some kind of SEO strategy. </p> <p> Patrick McKenzie, founder of Bingo Card Creator and Appointment Reminder: </p> <blockquote> You build a machine that takes money on one end and spits rankings on the other. With Bingo Card Creator I pay money to a freelancer to write bingo cards with associated content about them that get slapped up on a page on the Web site. Because those bingo cards are far too niche for any educational publisher to target, I tend to rank very well for them. </blockquote> <blockquote> For $10-20 per search term, you can pay someone to write an article that you won't be embarrassed to put on your Web site. For many SaaS startups, the lifetime value of a customer at the margin might be hundreds of thousands of dollars. So they [articles and landing pages] don't need much traffic at all on an individual basis to aggregate into a meaningful number to the business. </blockquote> <blockquote> The reason my business works is fundamentally because this SEO strategy works phenomenally well. </blockquote> <p> Patrick would hire freelancer to create a page for $3.5 and over 3 years it brings $60-100. At scale of hundreds of such sorts, this is fairly good money. Subpages of his site target a bucket of keywords he wants to rank for. For example, "plants and animals" bingo card category includes pages like "dog breeds bingo", "cat breeds bingo". For each of those, he hired a freelancer to research the term and create a unique set of bingo cards and associated landing pages. You can hire freelancers via oDesk/Elance to churn out targeted articles for long-tail topics that your audience is interested in. </p> <p> Another way to approach long-tail SEO is to use content that naturally flows from your business - just ask yourself, what data pf ours might be interesting for users. Yelp, TripAdvisor, Wikipedia have all gained most of their traffic by producing automated long-tail content. Gabriel's Names Database used this - people searched for old friends and classmates and would find them on Names Database. Pages were auto-generated from data gathered by the product. This generated tons of organic traffic. </p> <h4>Tactics</h4> <p> You need to be able to get links. This can be done via: </p> <ul> <li>Publicity - reporters link to your site</li> <li>Product - e.g. LinkedIn profile pages</li> <li>Content marketing - creating strong content that people are willing to share</li> <li>Widgets</li> </ul> <p> Links are dominant factor in site ranking. Open Site Explorer can tell you, how many links you are getting and where they are coming from. You can look at your competitors link profile to get the idea of where to get links. There's a difference between quality content and cheap freelancer-generated content. First is good for fat-head strategy and natural link building. Infographics, slideshows, images, original research - that's what drives user's traffic. </p> <p>Don't buy links - you'll get heavilly penalized; don't do black hat SEO - it works short-term, but doesn't long-term.</p> <p> SEO is one of the cornerstones of "inbound" marketing - "inbound" marketing brings customers inbound from SEO or social media - thus, unlike SEM or social media ads, money invested in it, stay with you. Rand Fishkin of Moz says, 85% of their marketing is inbound. </p> <p> Mike Volpe from HubSpot: </p> <blockquote> Today we have 30 people in marketing and 120 in sales, all based in Cambridge, MA (no outside sales) and we attract 45-50k new leads per month, 60-80 percent of which are from inbound marketing (not paid). The inbound leads are 50% cheaper and close to 100% more than paid leads. My personal experience and industry knowledge tells me that most other SaaS companies get more like 10% of their leads from inbound marketing, and generate 2-5k leads per month in total, whereas we get 70-80 percent of our leads from inbound, resulting in 45k+ new leads per month. </blockquote> <h3>Chapter 13. Content Marketing</h3> <p> Blog is an important way to attract new customers to your business. </p> <p> Rick Perreault, founder and CEO of Unbounce, service for building Landing Pages and optimizing conversions. They started blogging a year before launch. Sam Yagan, cofounder of OkCupid, popular dating service, launched in 2004, started blogging in 2009. That's when they started to take off. </p> <p>Rick Perreault hired a blogger as the first employee:</p> <blockquote> If we had not started blogging at the beginning the way we did, Unbounce would not be here today. ... Our content still drives customers. Something we wrote in January 2010 still drives customers today. Wherease, if I had spent money on advertising in January, that's it. That money is spent. If you invest in content, it gets picked up by Google. People find it, they share it, and it refers customers almost indefinitely. </blockquote> <blockquote> By the time we launched in the summer of 2010, we were doing 20,00 unique visitors per month to the blog. ... Now our blog is our primary source of customer acquisition. People write about Unbounce. Other people tweet about our posts. Our blog i scenterpiece of all our marketing. </blockquote> <p> Unbounce created a mailing list of 5,000. This wasn't your typical startup product launch. They relied heavily on social media, driving opinion leaders to their blog by pinging them on Twitter asking for feedback. It took their blog a while though: after 6 months they were getting only 800 monthly visits. To speed up visitors acquisition, they started to engage with communities in their field, writing useful answers on targeted forums like Quora, reaching out to influential people on Twitter (this was particularly effective). This is not scalable, but ok for kick-off to make the content start spreading organically. It was often hard to predict, which posts would resonate with the audience, thus keeping a blog schedule was good. </p> <p> OkCupid was acquired by Match.com for $50 million. OkCupid approached its blog differently from Unbounce. They were writing longer posts once a month, studying the usage patterns of their members, headlined with intentionally controversial titles, e.g. "How your race affects the messages you get" to generated traffic and conversation. They are free site, so they couldn't afford high customer acquisition costs, thus were limited to publicity, content marketing, SEO and viral marketing to dirve their growth. They received more traffic from blog than from PR firms. CNN, Rachael Ray, the New York Times and many other outlets wrote about blog topics they covered. As a result, in a year they were near the top of search results for "online dating". </p> <h4>Tactics</h4> <p> According to Unbounce, infographics is shared 20 times more often than text and are more likely to get picked up by other online publications. Their <a href="https://unbounce.com/noob-guide-to-online-marketing-infographic/">Noob Guide to Online Marketing"</a> infographic drove ~10,000s of paying customers and in a year it was shared on Twitter ~ once and hour. </p> <p> One of the secrets of shareable content: show the readers that they have a problem they didn't know about or couldn't articulate. Solution is nice, but anxiety about the problem is what drives them to your post. </p> <p> Quick: name 3 venture capitalists or ask your friends to do so. Many people will mention Fred Wilson, Brad Feld and Mark Suster, because they have popular blogs. Blog can help you position yourself as an indsutry leader in a competitive field. This recognition leads to huge opportunities, such as speaking on major conferences, giving press quotes to journalists, even influencing industry direction. That means, your content is shared even more and your opportunities for business development expand greatly. E.g. Unbounce got integrations with such companies as Salesforce. It's also helpful for 8 other traction channels: SEO, publicity, email marketing, targeting blogs, community building, offline events, existing platforms and business development. </p> <h3>Chapter 14. Email marketing</h3> <p> Groupon, JackTreads, Thrillist and Zappos use email marketing as their core traction channel. </p> <p> Email marketing is good for building familiarity with prospects, acquiring customers and retaining customers. </p> <h4>Email marketing for finding customers</h4> <p> Don't spam your users with bulk, unsolicited email. Instead, create interested users lists - just ask for emails for delivery of premium content (such as videos, textbooks or white papers, short mini-courses on your area of expertise) on the bottom of blog posts and landing pages. </p> <p>You can also consider advertising on email newsletters.</p> <h4>Email marketing for engaging customers</h4> <p> Customer activation is an important and often overlooked part of building a successful product. E.g. for Twitter activated cusomters are those, who actively send Tweets or follow more than 5 people, for Dropbox - those, who uploaded at least 1 file. </p> <p> A popular approach to activate cusomters is to create a series of email, exposing cusomters to new features like "Hey, did you know we have this feature?". Colin Nederkoorn, CEO of Customer.io (company that offers to send email based on actions their customers' users take): </p> <blockquote> You create the ideal experience for your users when they sign up for your trial. You then create all of the paths they can go down when they fail to go through the ideal experience. And you have an email to catch them and help them get back on that [ideal] path. </blockquote> <p> E.g. Dropbox will email newly signed-up users to remind them to upload a file. You can use tools like Vero and Customer.io to automate those messages. E.g. Cusomter.io will send an email to customers 30 minutes after registration and ask, if they need any help. Those emails recieve 17% reply rate. </p> <h4>Email marketing for retaining customers</h4> <p> Digest or notification emails are great for customer retention. Mint sends you weekly financial summaries, BillGuard, service that monitors your credit cards for suspicious transactions, sends a similar monthly report. Planscope (project planning tool for freelancers) sends a weekly email to freelancers, telling how much they made this week. These are "you are awesome" emails, which are pleasant to read. Similary, photo sites will send you photos you took a week ago. </p> <h4>Email marketing for revenue</h4> <p> Patrick McKenzie says that email subscribers are 70x more likely to buy one of his courses than targeting blog/SEO/content marketing subscribers. Emails are good for upselling customers, e.g. WP Engine, WordPress hosting company, gets customers on premium plans via series of emails. They've built a blog speed testing tool (speed.wpengine.com), which measures site performance. They will send 3 emails over a month with an email course about WordPress speed and scalability with 3 quick ways to improve site speed, including payed hosting. If they see that customer is not ready to convert, they switch them to a less frequent monthly mailing list. </p> <p> Email retargeting is also good for customers, who filled in their cart, but left the site before checkout. </p> <h4>Email marketing for referrals</h4> <p> Groupon doesn't give you a discount, unless you mail several friends. Dropbox gives you and your friend whom you brought in extra space. Even some B2B products like Asana will ask customers to import their address books to share with their friends. </p> <h4>Tactics</h4> <p> MailChimp, ConstantlyContact and similar providers ensure email delivery. A/B test every aspect for campaign, especially email timing (e.g. 9-12 or evening). Don't use noreply@example.com - feedback might be valuable. For email content, see <a href="copyhackers.com">Copy Hackers</a>. </p> <h3>Chapter 15. Viral Marketing</h3> <p> If every user brings in at least one other user, your project is "going viral". This was the main driving force behind Facebook, Twitter, WhatsApp. Even if you can't get exponential growth, viral marketing can greatly decrease your customer acquisition cost. Andrew Chen, founder of Muzy (app with over 25 million users), says that with existing platforms, such as Facebook, it's very easy now to become viral. </p> <h4>Strategy</h4> <p> Some products have an inherent virality (e.g. messengers, social networks, Uber with someone), sometimes you can encourage virality via discounts offers like Dropbox or AirBnB (sign up a friend and you both get a discount). You can also promote virality by adding "sent via iPhone" or use of widgets and embeds like Youtube. </p> <p> Your viral coefficient K = number of invitees * conversion percentage, e.g. K = 3 * 60% = 1.8. Also, take into account your viral cycle time - make it as simple as possible, create urgency. </p> <h4>Tactics</h4> <p> Measure your initial viral coefficient and viral cycle time. According to Andrew, it takes 2-3 months and an 1-2 engineers to create a good viral loop. Map all the steps within the loop, cut redundant, increase the number of invitations, customers send. Ashish Kundra, founder of myZamana Indian dating network. When user gets an invitation, it should be designed to have maximum conversion + maximum personal hooks. You can also make "conversion pages", where new users land after getting an invitation, could be usable without login to increase interest. </p> <p>Optimization directions</p> <ul> <li>Buttons vs text links</li> <li>Locations of calls to action</li> <li>Size, color and contrast of action buttons</li> <li>Page speed</li> <li>More images</li> <li>Headlines</li> <li>Site copy</li> <li>Testimonials</li> <li>Signs of social proofs (happy customers, case studies, press mentions, statistics of usage)</li> <li>Number of form fields</li> <li>Allow users to test the product before signup</li> <li>Ease of signup - OAuth</li> <li>Length of signup process</li> </ul> <p> There could exist viral pockets - niches, where you liftoff faster - may be country, age or profession. If you found such a niche - optimize for it - e.g. translate app to their language. </p> <p> Don't forget to do seeding in new demographics - attract new cusomters in other channels with other strategies, such as SEO, SEM or display/social ads - inexpensive for tests. </p> <p>Copy someone else's viral loop exactly, down to detail.</p> <p>Possible mistakes:</p> <ul> <li>Product is not inherently viral, but tries to add viral features</li> <li>Bad product in general, nobody cares about</li> <li>Not enough A/B tests (assume that 1-3 out of 10 yield postive results)</li> <li>Not understanding, how users are currently communicating</li> <li>Not getting guidance from people, who already did this</li> <li>Thinking of virality as a tactics, rather than a deep strategy</li> </ul> <h3>Chapter 16. Engineering as Marketing</h3> <h4>Strategy</h4> <p> HubSpot, a marketing automation software company, has reached ~$10s millions in revenue in a few short years. One of the keys to its success was a free marketing review tool Marketing Grader. It reports, how well you're doing with your online marketing (socical media mentions, blog post shares, basic SEO). It's free for users and gives HubSpot some idea about you as a potential customer. </p> <p>Dharmesh Shah, HubSpot founder:</p> <blockquote> The early story of Marketing Grader is interesting. There were only 3 people at Hubspot at that time. My cofounder and I would regularly "sell" (in the early days a lot of those sales calls were with friends and friends of friends). One of the initial steps in the sales process was for me to get a sense for how good a given company's Web site was at inbound marketing. My cofounder [Brian Halligan] would constantly send me Web sites he wanted me to take a look at so we could determine if they were a good fit. </blockquote> <blockquote> After a few days of this, I got tired of going through the manual steps (look at Alexa, look at their page titles, check out their domains etc.). So I built an application to automate that process for me. On a related note I also started angel investing at the time, and I used the same process to assess the markting savviness of potential startups I was considering investing in. Once the app was built (it didn't take more than a few days for the initial version), I thought it might be useful for other pople, so I registered "websitegrader.com" and made the app available publicly. We eventually started collecting email addresses in the app, and kept iterating on it. </blockquote> <p> More than 3 million sites used Marketing Grader. It accounts for a large portion of 50k+ leads HubSpot gets each month. Its users are at the same time potential HubSpot customers. And inbound marketing works like an asset - once you spent money on it, it continues to bring returns. </p> <p> Another example is SEO company Moz - their free tools Followerwonk and Open Site Explorer, have driven ~10,000s of leads to Moz. Followerwonk allows to analyze Twitter audience and get tips on growing it. Open Site Explorer shows, where sites are getting links, which is a valuable competitive advantage. </p> <p>WP Engine, a WordPress hosting provider, asks for email for checking how fast your WordPress site loads.</p> <h4>Tactics</h4> <p>You can take advantage of cyclical and seasonal behaviour.</p> <ul> <li>Codecademy's Code Year free course with lessons, sent by email weekly, got them 450,000 new users during 2012.</li> <li>Patrick McKenzie, Bingo Card Creator, makes Halloween and Christmas-themed cards.</li> <li>In 2011 Gabriel built a microsite DontTrack.us, which showed, how Google tracks you and how this can be harmful. NSA tracking news or Data Privacy Day increase awareness about this website. Strategy works so well that DuckDuckGo now has multiple such microsites with different domain names, which is good for SEO and just memorable.</li> <li>Chris Fralic of Delicious and Half.com says that Delicious bookmark widget more than trippled adoption of their social bookmarking product.</li> <li>Facebook, StumbleUpon, Google+, Twitter share buttons</li> </ul> <p> Robert Moore of RJMetrics (e-commerce analytics company) uses its own products to discover interesting trends on some of the most popular media sites like Twitter, Tumblr, Instagram and Pinterest. They started to build microsites on those hot topics, like cohortanalysis.com or querymongo.com. The last one was translating SQL queries to Mongo. They look for high ROI on engineering time: if a few days of engineering drive hundreds of leads - it's worth it. </p> <h3>Chapter 17. Business Development</h3> <p> Google had 2 key partnerships: in 1999 they partnered with Netscape to be default search engine in Netscape Navigator. Then Google achieved key partnership with Yahoo! </p> <h4>Strategy</h4> <ul> <li><b>Standard partnerships</b> - e.g. Apple/Nike Nike+ shoe, communicating with iPod or iPhone</li> <li><b>Joint ventures</b> - Starbucks Frappuccino or Doubleshot Espresso - entirely new product from Starbucks/Pepsi</li> <li> <b>Licensing</b> - Starbucks lent its brand to an ice cream manufacturer for Starbucks-flavoured ice cream or Spotify and Grooveshark forced into licensing agreements by the nature of their business - they have to license music content from record labels. </li> <li> <b>Distribution deals</b> - Groupon gets discount to its mailing list from a restaurant. Or Kayak signed a distribution deal with AOL - Kayak used its search technology to power an AOL-owned travel search engine. </li> <li><b>Supply partnerships</b> - Half.com bought books, Hulu and Wallmart getting stock from channel partners.</li> </ul> <p> Business development requirs discipline and strategic thinking. It's tempting to go for partnership with big brand, but this might require you to go off your Critical Path - don't! </p> <p> Chris Fralic, former senior business development executive at AOL, Half.com, eBay and Delicious, currently a partner at first round capital described business development at each of his startups: </p> <blockquote> In the case of Half.com, there were three key things that we needed before we launched. Number one, the site had to work (this was pre-Amazon Cloud days) to ensure that people actually use the site. Then there was inventory. We decided, we needed one million books, movies, etc. at launch, because it sounded like a nice big number. So my team and I worked on how we get product on the shelves. It was our job (prior to launch) to find inventory and get it listed no the site. The third was to get distribution. So we went out and created one of the early affiliate programs and did distribution and marketing partnerships. </blockquote> <p> Charlie O'Donnell, partner at VC firm Brooklyn Bridge Ventures: </p> <blockquote> Create an exhaustive list of all your possible [partners]. ... Make a very simple spreadsheet: Company, Partner Type (Publisher, Carrier, Reseller etc.), Contact Person/Email, Size, Relevance, Ease of Use, and then a subjective prioirty score. There's no reason why a company shouldn't have 50 potential business development partners in their pipeline, maybe one hundred, and be actively working the phones, inboxes, and pounding the pavement to get the deals you need to get - be it for distribution, revenue, PR, or just to outflank the competitor. The latter is totally underutilized. If you go in and impress the top 50 folks in your space, it makes it that much harder for a competitor to get a deal done - because you're seen as the category leader. </blockquote> <p> Once you have a list of potential partners, send it to your investors, friends and advisers for warm introductions. Don't prioritize based just on brand name - instead, say "I want to go for Internet retailers that are between 20 and 250 on the IR (Internet Retailer) 500 - because this puts them in this kind of revenue range - and have a director of e-commerce." </p> <p> Chris at Delicious worked on deals with The Washington Post, Mozilla, Wikipedia. Delicious approached its potential partners with a clear idea of how each of them would benefit from partnership. For <i>The Washington Post</i> the value proposition was to use Delicious's social bookmarks to optimize content for social media. <i>The Washington Post</i> agreed because it was a simple integration with little downside. After that the nunmber of sites, willing to partner with Delicious skyrocketed. It made possible other partnerships, such as with Mozilla, which released 2.0 at that point, so that one of the first new things that upgrading users were seeing was Delicious extension. This more than tripled Delicious user base. At the same time, most deals won't close - e.g. they pursued integration with Wikipedia deal, which failed. </p> <h4>Tactics</h4> <p> Brenda Spoonemore, former senior VP of interactive services at NBA: </p> <blockquote> What do you have that they [big companies] need? You're more focused than they are. You have an idea and you're slolving a problem. You've developed content or technology and you have a focus. That is very difficult to do at a big corporation. </blockquote> <p> You need to identify a right contact in company that you're going to work with. There could be a business development department or you could approach someone like a product director or C-level executive you want to engage with. Find, who's in charge of metric, you're interested in, e.g. selling more T-shirts and put your stake on that person. Just because you're offering a Web site widget doesn't mean that Web site team is ideal set of stakeholders. Then try to get warm introduction through a mutual contact with an overview of your proposal that can be easily forwarded. Then be sure to follow up and set time lines for next steps. Chris Fralic mentioned that it was key for him to get a meeting or phone call set up as quickly as possible, sometimes even on the same day. Then start negotiations - both Chris and Brenda suggest that you make your term sheet as simple as possible - often just 1 page - so that deal requires less lawyers and engineers. After the deal is done, create a memo "how the deal was done" to repeat the process. </p> <p> There can be low-touch BD - e.g. through utilization of public APIs, e.g. Disqus, SlideShare or SoundCloud. Those can work, but you'd better start with landing a few traditional deals. </p> <h3>Chapter 18. Sales</h3> <h4>Strategy</h4> <p> Sean Murphy, owner of customer development and sales consulting firm SKMurphy says that first customer is someone the startup knows or they know. He suggests that startup does a lunch pitch (over a coffee or something) with 5-10 key points. Early conversation is about prospect's problem and pain points. </p> <p> John Raguin, cofounder of insurance company Guidewire Software explains: </p> <blockquote> We went to our potential customers, insurance companies, and proposed to do a short free consulting study that would provide [an assessment] of their operation. We would spend approximately 7-10 man-days of effort understanding their operations and in the end we would give them a high-level presentation, benchmarking them as compared to their peers. In return, we asked for a feedback on what would make the best system that would meet their needs. In the end, we were able to work with over 40 insurance companies this way. We were honest about our motives all the time, and we made sure to provide quality output. </blockquote> <p>Sales conversation structure (Neil Rackham), called SPIN progression:</p> <ul> <li> <b>Situation questions</b> - e.g. "How many employees do you have?" or "How is your organisation structured?" - no more then 1-2 or they'll feel like they're giving information and not getting anything in return, especially executive directors - you ask this to check if you're talking to a likely candidate for sale. </li> <li> <b>Problem questions</b> - e.g. "Are you happy with your current solution?" or "What problems do you face with it?" </li> <li> <b>Implication questions</b> - e.g. "Does this problem hurt your productivity?", this is meant to emphasize that the problem is not a necessary cost of doing business or a nuisance, but actually an avoidable cost. </li> <li> <b>Need-payoff questions</b> - e.g. "How do you feel this solution would help you?" </li> </ul> <p> Steve Barsh, former CEO of SECA, acquired by MCI: "You get your first customers by picking up the phone". Good if you have a warm introduction, but you may have to do cold calling or emailing. </p> <p> Todd Vollmer, enterprise sales professional with 20 years of experience: set daily/weekly targets, be judicious about whom to contact - you might be scared to call senior employees - don't. </p> <p>Sean Murphy:</p> <blockquote> Ordinarily, it's somebody who is one level or two levels up in the organisation; they've got enough perspective on the problem and on the organization to understand what's going to be involved in bringing change to organization. As we work with them they may take up the hierarchy to sell to more senior folks. We don't tend to start at the top unless we are calling on a very small business, in which case you've got to call on the CEO or one of the key execs because no one else can make any decisions. </blockquote> <p> Todd suggests to ask 5 questions: </p> <ul> <li><b>Process</b> - how does company buy solutions like the one you're offering?</li> <li><b>Need</b> - how badly does this company need a solution like yours?</li> <li><b>Authority</b> - which individuals have the authority to make the purchase happen?</li> <li><b>Money</b> - do they have the funds to buy what you're selling? how much does NOT solving the problem cost them?</li> <li><b>Estimated Timing</b> - what are the budget and decision time lines for a purchase?</li> </ul> <p> After a call don't forget to send an email with questions, such as "Will you agree to this closing time line?" </p> <p> Two common situations when you contact a wrong person in organization: 1) a person invites you, but isn't interested in your product, but wants a free consultancy; 2) person thinks about self as a change agent, but has no power - you ask them "Have you ever brought other technology into your company?" - "Well, no, but you know, I've only been here 6 months nad this is what's going to let me make a big difference." </p> <h4>Tactics</h4> <p> David Skok, general partner at Matrix Partners has taken 3 companies public and 1 was acquired. He says that doing cold calls is very expensive and it's better to do marketing first, get relatively hot prospects and pass them on to sales to close. Then try to qualify the prospects by likelihood to close - e.g. if they left e-mail, when accessing your free courses on site, they are hotter. If they are some tiny business on Etsy or Ebay, they are less likely to buy a big package. </p> <p> Mark Suster from Upfront Ventures classifies deals into A, B and C, A are likely to close in 3 months, B - within 3 to 12 months, C - unlikely to close in a year. A deals take 66-75% of salesperson's time, B - depends on sales pipeline, C - no time at all - they go to marketing. Marketing's job is (1) to arm sales reps with presentations, ROI calculators, competitive analysis etc. and (2) to aim at best leads. </p> <p> Finally, you convert prospects and close the deals. Lay out purchasing timeline and ask "yes" or "no" - e.g. "We'll set up a pilot system for you within 2 weeks After 2 weeks, if you like the system we've built and it meets your needs, you'll buy from us. Yes or no?". Binary answer helps you to waste less time on cusomters who are just unwilling to buy. You may have a field sales team or inside one. </p> <p> Remember to put yourself in place of your customer and don't forget about questions they might have and be blocked by, e.g. "is this the best solution on the market?" or "am I sure this works for me?". Possible solutions for those: </p> <ul> <li>Remove the needs for installing software with SaaS</li> <li>Free trials</li> <li>Channel partners (resellers)</li> <li>Demo videos</li> <li>FAQs</li> <li>Reference customers (testimonials, case studies)</li> <li>Email campaigns</li> <li>Webinars or personal demos</li> <li>Ease of installatino and ease of use</li> <li>Low introductory price (less than $250/month for SMB, $10,00 for enerprises)</li> <li>Eliminating committee decision making</li> </ul> <h4>Case study: JBoss</h4> <p> Middleware software provider, created a sales funnel that drove $65 million in revenue just 2 years after founding (and were later acquired by RedHat for $350 million). </p> <p> JBoss initially focused on generating leads, over 5 million people downloaded its free software through SourceForge, but JBoss had no contact information of those people. To get it, they gave away their documentation for free (previouslly they used to charge for it), in exchange for contact details. This generated over 10,000 leads per month. </p> <p> Then they qualified those leads to determine most likely to buy. The company used Eloqua, marketing automation software, to determine the pages and links a prospect engaged with before accessing documentation. Prospects, who spent a lot of time on support pages were good candidates for payed JBoss support service - main source of income. Marketing team would further contact those to determine, if they had a desire to get deal done. </p> <p> Finally, marketing would pass those prospects to sales with their calls, demos, white papers etc. The sales team was able to close about 25% of leads, whereas industry average is 7-10%. Unqualified leads, not ready for sales yet, were put into nurturing campagins, received JBoss Newsletter, invitations to webinars, were encouraged to subscribe to JBoss blog. After a certain time of nurturing, they were brought back into sales pipeline. Each deal's cost was about $10,000. </p> <h3>Chapter 19. Affiliate Programs</h3> <p> Amazon, Zappos, eBay, Orbitz, Netflix use affiliate programs to drive significant portions of their revenue. Interviewed Kris Jones, founder of Pepperjam, which became the 4th largest affiliate network and was acquired by eBay in 2009. At one point, it had a single advertiser, generating $50 million annually through its network. </p> <h4>Strategy</h4> <p> Affiliate programs are frequently found in retail, information products and lead generation. In retail the market size is over $2 billion annually with largest programs being Amazon, Target and Walmart. Amazon pays 4-8.5% of each sale, depending on how many items affiliate sells per month. Amazon and eBay have their own affiliate programs, but this is far too expensive. More often online retailers, such as Walmart, Apple, Starbucks, The North Face, The Home Depot, Verizon, Best Buy and others go through affiliate networks, such as Comission Junction (CJ), Pepperjam and LinkShare. </p> <p>Main categories of affiliate programs:</p> <ul> <li> <b>Coupon/deal sites</b> - RetailMeNot, CouponCabin, Brad's Deals, Slickdeals - offer discounts and take a share; e.g. when you search for "Zappos discount", RetailMeNot is likely to rank highly in search. When you visit RetailMeNot, you get coupon codes for Zappos; if you click through and buy something using a code, RetailMeNot gets a percentage. </li> <li> <b>Loyalty programs</b> - Upromise or Ebates have reward programs that offer cash back on purchases made through their partner networks. They earn money based on the amount their members spend through retail affiliate programs. E.g. if 1000 members buy gift certificates to Olive Garden, Upromise will get a percentage of every dollar spent. Then they pay part of what they earned back to their members. </li> <li> <b>Aggregators</b> - Nextag or PriceGrabber aggregate products from retailers. They often add information to product listings, like additional ratings or price comparisons. </li> <li> <b>Email lists</b> - many affiliates have large email lists to which they will recommend products </li> <li> <b>Vertical sites</b> - many 100,000s of sites (including vertical blogs) have amassed significant audiences geared toward a vertical, such as parenting, sports or electronics. </li> </ul> <p> Selling information products (e-books, software, music and education) through these is increasingly popular as creation of another digital copy has 0 cost. By far the largest affiliate network for info products is ClickBank, where affiliate commissions often reach 75%. ClickBank has more than 100,000 affiliates and millions of products. </p> <p> Lead generation is $26 billion industry. Insurance companies, law firms, mortgage brokers all pay hefty commissions to get customer leads. Depending on the industry, lead may include working email address, home address, phone number or even a credit score. Popular lead-gen networks are Affiliate.com, Clickbooth, Neverblue and Adknowledge. </p> <p> Affiliate programs are popular with financial services and insurance companies because the value of each customer is so high. Health or auto insurance is very expensive, thus leads are expensive, too. Insurance companies are top Google AdWords spenders, often paying $50-100 for a single click. </p> <h4>Tactics</h4> <p> How much of a CAC are you willing to pay? You'd better go with affiliate networks, such as Commission Junction, Pepperjam, ShareASale instead of recruiting affiliates on your own. At Commission Junction you'll have to pay over $2,000 upfront. However, affiliate sales will quickly cover these costs. Or you can build your own affiliate network, recruiting partners from your customer base or people, who have access to a group of customers you want to reach. In this case you don't have to pay all in cash, but can e.g. give away premium accounts, if you're based on Freemium model. E.g. Dropbox referral program was giving away free storage space; QuiBids, top penny auction site, built out a referral program for its current customers, giving free bids to people who refer other customers. </p> <p> The first place to look for affiliates is your own customer base. After that conteact content creators, bloggers, publishers, social media influencers, email list curators. Monetizing blogs is not easy, so those content creators might often look for $. </p> <p> Maneesh Sethi, popular blogger at HacktheSystem has long been an affiliate for many products. He was a cusomter of a product that taught SEO tactics. He loved the program, so he contacted the company himself and worked out a deal with them to give him a commission for each new customer he sent their way. After agreeing to terms, Maneesh sent out an email to his list, mentioning how the SEO program had helped him get better rankings on Google. That single offer has made him nearly $30,000 in 2 years and has made the company much more. He was also recommending RescueTime time-tracking app to more than 3,000 people, being one of its top affiliates. He says that building relationship with content creators is key: give them free access to product, help create content. </p> <p> Larger companies like Amazon or Netflix optimized how much they pay to affiliates for each lead. Startup will be less sure about underlying business and should start with a simpler approach like $5 flat fee or 5% of the price. More complex affiliate programs segment products and reward top affiliates. eBay gives seasonal coupon codes to products it wants to push. Tiered payout programs are also popular - if you drive more transactions, your rate goes up and you make more money. </p> <h4>Major affiliate networks</h4> <ul> <li> <b>Commission Junction</b> - $2,000 upward minimum to sell your prodcut through it, but it curates affiliates and publishers </li> <li><b>ClickBank</b> - leader in infoproducts, cheap to start ($50 to list a product)</li> <li><b>Affiiliate.com</b> - very strict affiliate approval, claims higher-quality traffic</li> <li> <b>Pepperjam</b> - started by Kris Jones, the Pepperjam Exchange encompasses mobile, social, offline retail, print etc. Promotes customer support and transparency as selling points for its network, which costs $1,000 to join. </li> <li><b>ShareASale</b> - over 2,500 merchants, flexible commission structures, $500 to start</li> <li> <b>Adknowledge</b> - offers ad-buying services in addition to affiliate campaigns; works in mobile, search, social media and display ads, so you have affiliates and CPC in one platform </li> <li> <b>LinkShare</b> - helps companies find affiliates and build lead-gen programs for them. Macy's, Avon and Champion manage affiliates through them </li> <li> <b>MobAff</b> - mobile affiliate network, utilizes SMS, push notifications, click to call, mobile display and mobile search </li> <li> <b>Neverblue</b> - targeted towards advertisers, who spend more than $20,000 per month, works with advertising partners on their advertisement and campaigns. </li> <li> <b>Clickbooth</b> - uses search, email and many Web sites to promote brands like DirecTV, Dish Network and QuiBids. </li> <li> <b>RetailMeNot, Inc. (formerly WhaleShark Media)</b> - owns some of the most popular coupon sites in the world, including RetailMeNot and Deals2Buy.com. Google search requests to "term + coupon" often lead here. </li> </ul> <p> Affiliate networks are a bit nicer than SEM/PPC, because you don't risk. If your campaign is bad, you don't lose money - you just don't receive customers. </p> <h3>Chapter 20. Existing Platforms</h3> <p> Web sites, apps or networks with uge amounts of users. Apple and Android app stores, Mozilla and Chrome browser extensions, social platofrms like Facebook, Twitter and Pinterest, new rapidly growing platforms like Tumblr, Snapchat. </p> <p> Mobile video-sharing app Socialcam suggested users sign up with Facebook and Twitter, promoted user videos on both platforms and encouraged to invite friends from each site. It went on to hit 60 million users within 12 months. </p> <h4>Strategy: app stores</h4> <p> Apps get easily discovered in App store, when they are top in rankings or featured. Rankings group apps by category, country, popularity and editor's choice. </p> <p> Trainyard, a paid iOS game developed by Matt Rix wasn't growing the way he hoped. He tried creating a free version (Trainyard Express). An editor at a popular Italian blog wrote a glowing piece on it almost immediately. This propelled the app to number-one free app in Italy - netting more than 22,000 downloads on the day alone! The app then hit the top spot in the UK and was downloaded more than 450,000 times in a week. 7 days later Appled decided to feature it and that dwarfed everything that was before. Downloads skyrocketed by 50x and persisted there while feature was live. Even after that downloads remained significantly elevated. </p> <p> Mark Johnson, founder of Focused Aps LLC tells how promotions work: </p> <ol> <li>Ads get the [app] somewhere into the charts</li> <li>Now it's in the charts, more people see it</li> <li>So it gets more organic downloads</li> <li>Which makes it go a bit higher up in the charts</li> <li>Now even more people see it and it gets more organic downloads</li> <li>People like it and it get more organic downloads</li> <li>It goes up higher in the charts</li> <li>Repeat from 5</li> </ol> <p> To get apps to top, they buy ads from AdMob, installs from Tapjoy, cross-promote their apps through networks or even buy their way through FreeAppADay. High ratings are important - editors choose apps to feature based on them - that's why even top apps are continually asking to rate them. Promotion tricks are good, but good UX is what's most important - Instagram, Path, Google Maps, Pandora, Spotify. </p> <p> Browser extensions in Chrome and add-ons in Firefox - e.g. Adblock Plus and YouTube video saving, bookmarks and passwords managers. Evernote said that its usage went up by 205% thanks to extension - and they already had 6 million users. Again, portals with extensions and add-ons have features and rankings. </p> <h4>Strategy: social sites</h4> <p> New social platforms like Snapchat and Vine are emerging all the time. Sometimes you can find your place by filling in a gap in such platoform's functionality. E.g. in mid-2000s MySpace was the most visited social network in the world and YouTube filled the niche of videa sharing by allowing users to embed videos and users were directed back to YouTube by those embeds, which led to YouTube explosive growth. Bitly fulfilled the need for shorter links on Twitter. Imgur complemented image sharing functionality for reddit users. Airbnb saw much of its early growth from Craigslist customers and designed a special "Post to Craigslist" button, which drove 10,000s customers. PayPal targeted eBay users as its first customers - it purchased goods from eBay and required selleres to accept PayPal - this made them more popular than eBay's own payment system. </p> <h4>Case study: Evernote</h4> <p> Evernote (valued over $1 billion now) focused on every new and existing platforms to ride the bandwagon of that platoform's initial marketing push and increase chances of being featured. Evernote CEO Phil Libin says that they wanted Evernote to support every new device or platform from day 1. When iPhone launched, they were one of the very first iPhone apps, for iPod, Android and Kindle Fire they created a version specifically designed for the platform and available from the day 1. Evernote was featured in the Android store for 6 straight weeks in the early days which gave it 100,000s new customers. When Verizon picked up Android phones and started its marketing push, Evernote benefited from its effort. Alex Pachikov of Evernote says that big companies take new platforms as a gamble and want to wait and see, if it succeeds or not, which is not an option for a startup - you have to gamble. Evernote flopped doing the same on Nokia, Windows and BlackBerry - that's ok, wins justify losses. </p> <p> They thought: what can we do with our apps to make Apple/Google/Microsoft AppStore/whatever editors feature us? They crafted Evernote Peek which looked like magic and was showcased by Apple itself in their commercial, featured and number 1 in Education category for a month and brought 500,000 new users to Evernote's main business, which was one of the main drivers of growth for the project in 2012. </p> <h3>Chapter 21. Trade shows</h3> <h4>Strategy</h4> <p> How to decide, which trade shows to attend? Visit a year before as a guest or ask those who did "How crowded was it? How high was the quality of the attendees? Would you go again?". Plan of actions from Brad Feld, partner at Foundry Group: </p> <ul> <li>Set your goals for a year: press, investors, major customers, partnerships?</li> <li>Write down all events in your industry</li> <li> Evaluate events in terms of your goals: if you need to personally interact with few major prospects, go for shows with more intimate atmosphere, if you just need more interaction - go for crowded ones. </li> <li>Figure out your budget, remember that your goals might change over time.</li> <li> Estimate CAC: take attendee list (ask organisers, if it's not available). E.g. if there are 10,000 people coming, 30% of them fit the profile of potential customer and attendance cost is $10,000 it's highly profitable to go if your LTV is $5k, but not so, if it's $50. </li> </ul> <p> SureStop did conversations with prospect partner companies, figured out what features they wanted from them, focused on them and only after that increased their expenses. </p> <h4>Tactics</h4> <p> Your preparations determine how successful you will be. Arrange meetings beforehand. E.g. Brian Riley sent well-researched emails beforehand with explanation of how SureStop and its technology can benefit them + a one-pager about the company. Jason Cohen of WP Engine/Smart Bear Software says that you should arrange meetings by sending emails like "At [Trade show X]: can we chat for 5 minutes?", at least 5 per day, you can also organise dinner/drinks afterwards. You can meet: </p> <ul> <li> Editors of online and offline magazines. Often overlooked, editors are your key to real press. I've been published in every major programming magazine; almost all of that I can directly attribute to talking with editors at trade shows! It wors. </li> <li>Blogger you like, especially if they are willing to write about you</li> <li>Existing customers</li> <li>Potential customers, currently trialing your stuff</li> <li>Your vendors</li> <li>Your competition</li> <li>Potential partners</li> </ul> <p> Media guys are attending trade shows specifically to see, what's going on in industry - give them something to write about! </p> <p> Mark Suster from Upfront Ventures suggests hosting dinners for journalists, potential customers/partners. You should start with inviting a few interesting friends, then work hard to bag a brand name person who others will want to meet. Just one. After that mention him to everyone else (along with others) and they'll come. Same with customers - invite several customers and several prospects with a few employees of yours - potential customers like to talk to existing cusomters for reference. Final tip: picking a hot venue is one of the best ways to bag high-profile people. However, this can be too costly, so you can split the costs with couple of other companies and extend your network that way. </p> <p> Don't forget about good booth location at the show and giveaways. Coffee mugs and stress balls are proven, but you can go with something more creative rleated to your proposition, such as yo-yos, coconuts, cigar cutters, sunglasses, key chains. You can give away as many bags with your company's name as possible to put tons of other giveaways into. Don't forget about specific Call To Action on your giveaways. Also, make your booth exciting, bring attention to it - show videos or make demonstrations of your product. SureStop managed to work out a relationship with Jamis, one of the largest players, and now make tons of sales through them. </p> <h3>Chapter 22. Offline Events</h3> <p> Twilio, a tool that makes it easy to integrate with phone calls or sms messages, sponsors hackathons, conferences, meetups, large and small. Larger companies like Oracle or Box throw huge events to maintain their position as market leaders. Salesforce's Dreamforce conference has over 100,000 attendees. Offline events allow you to talk with your customers about their problems at the phase I of your startup. In phase II larger conferences like TechCrunch Disrupt, Launch Conference and SXSW can help you build on your existing traction. </p> <h4>Strategy</h4> <p> Twitter launched 9 months before SXSW in 2007 and was seeing decent amount of traction, several thousand users. Many of its users were going to SXSW, so it went too. Ev Williams says they created a Twitter visualizer and negotiated with the festival to put flat panel screens in the hallways. They paid $11K for this and set up the TVs (those were the only money Twitter ever spent on marketing). They created an event-specific feature where you could text "join sxsw" to 40404 and you would show up on screens and if you were not a Twitter user already, you would automatically be following ~6 "ambassadors" who were already on Twitter and attended SXSW - they advertised this on the screens in the hallways. By the end of the conference, Twitter jumped from 12k tweets a day to 60k and also won the SXSW Web Award leading to press coverage and more users. </p> <p> Eric Ries wanted to broaden the audience of Lean Startup and organized his own conference (as he was afraid that his message would be lost at larger confs like SXSW). He tested demand by asking his readers, whether they are interested in a conference or not. After a resounding yes, he sold conference tickets through his site and other popular startup blogs. He ran a small one-day conference at San-Francisco, called Startup Lessons Learned, avoiding hassle with hotel stays, flying speakers etc. He streamed conference to multiple meetup groups across the country so that those who didn't travel to Frisco could attend nation-wide. </p> <p> Enservio, a company that sells expensive software for Insurance companies, was struggling to reach top executives. To get traction through offline events, they went all out to organize the Claims Innovation Summit at Ritz-Carlton hotel in Dove Mountain, Arizona for multiple days. They mad esure event didn't look like a sales pitch, puled out individuals from major consulting firms, respected individuals in insurance industry, founders of hot startups. Then they used this groups of speakers to attract industry executives who were their prospective customers, so that they could network and vacation at the same time. The event attracted top decision makers and established Enservio as industry leader overnight, now it's an annual conference. </p> <p> MicroConf is a smaller conferece for self-funded startups, attracting 100s of founder and selling out in days. When Rob Walling of HitTail started MicroConf, he had troubles with attracting people to the conference they've never heard of. Facebook ads and AdWords didn't work. Nothing that wan't relational didn't work. They created an e-book with quotes of some speakers and it went pretty viral, but didn't sell the tickets. Initially people used to say, it was too expensive ($500 + airfare and hotels), but after conference proved itself, they started to say it's too cheap. HitTail isn't the best example of a company that can throw a good conference - their clients are doctors, real estate, startups - all over the place, so throwing a SEO conference for them wasn't the best solution. Niche conferences are a better way. </p> <p> Meetup group are very effective. Seth Godin launched his book "Linchpin" through a series of meetups across the country, which 10,000 people attended. "Lean Startup Circle" sprouted regular meetups in 20 cities. Nick Pinkston, founder of automated manufacturing startup Plethora Labs run a Hardware Stratup Meetup group in Tech Shop in SF and only expenses were $70 for pizza. His group has now over 2,600 members. Evite threw a large party for Internet celebrity Mahir Cagri, which promoted Evite to its audience, making attendees more likely to use Evite to organize their own events. Yelp launched by throwing parties for Yelp Elites (first users), who were getting free food, merchandise and treated like VIPs. This drew more users. </p> <h4>Tactics</h4> <p> One-day microconferences are good for startups to get traction. You can invite founders of local companies for such a conference, or can follow "unconference" approach and let them suggest topics for round-table discussion. Local universities might be willing to host such events, especially if it's for education purposes. The cost of the conference might be less than $500. </p> <p> If the initial event was successful, consider scaling up. Sponsors might be interested to cover a part of event's costs. Keeing high quality of attendees is important according to Rob of MicroConf, so keep prices relatively high. He also says that tyou need to figure place and time, so that everybody talks to everybody and let speakers sit near attendees between the talks. You need to try more things, iterate quickly, be creative and do things that don't scale (or just have more money). </p> <h3>Chapter 23. Speaking Engagements</h3> <p> Mark Zuckerberg said improving his public speaking has improved his management abilities. Dan Martell, founder of Clarity, ad advice platform that connects founders with successful entrepreneurs, said that teching sells. Opportunity to teach in front of a room for 45 minutes introducing your company and your story to potential customers is time well spent. This is especially valuable traction channel in enterprise and B2B. </p> <h4>Strategy</h4> <p> Event organizers NEED to fill time. If you have a good idea of a talk that aligns well with an area of your expertise, simply pitch your talk to event organizers. They'll want you, especially if your ideas are solid. </p> <p> Steve Barsh, a serial entrepreneur and former CEO of PackLate suggests that rather than pitching conference organizers directly, he contacts them and asks baout the ideal topics they want the speakers cover. Than he crafts the perfect pitch. </p> <p>Conference types:</p> <ul> <li>Premier nation-wide events - 6-12 months after talk proposal</li> <li>Regional events - up to day's drive - 2-4 months</li> <li>Local events - 1-3 months</li> </ul> <p> Event organisers will consider your credibility - both experience in an area and your resume as a speaker. Start speaking at smaller-scale events, run a blog, refine your talks. If you're speaking well, you're likely to find that you're being invited to give talks elsewhere. </p> <h3>Tactics</h3> <p> From the beginning of your talk, audience will have 2 questions: "Why are you important enough to be the one giving a talk? What value can you offer me?" They won't start listening until you address these questions. Dan tells about his previous companies, Flowtown and Spheric and how he sold them for millions. </p> <p> All successful talks are stories. Your story is about what your startup is doing, why you're doing it and how you got to where you are or where things are going. Reach out to people outside the conference - record your talk, tweet slides before every presentation like Rand Fishkin of Moz; like Dan Martell add Twitter handles to the slides and ask the audience to Tweet the content to you, people like the most. Also, in the beginning give the audience a call to action. After conferences, attend speakers' dinners or arrange ones. </p> <h3>Chapter 24. Community building</h3> <p> Interviewed the founders of reddit, Wikipedia, Stack Exchange, Startup Digest, Quibb. You rely upon evangelists - early users, who e.g. wouldn't stop talking about how amazing Yelp is and after a third time heading about it, you're tempted to try it. </p> <h4>Strategy</h4> <p> Having early traction from previous projects is key. Wikipedia had people from Nupedia, earlier online encyclopedia, Stack Exchange had well-trafficked blogs of Joe Spoelsky from Fog Creek Software and Jeff Atwood as a writer at codinghorror.com - they even had a community vote for StackOverflow and received nearly 7,000 submissions in 2008. Chris McCann started Startup Digest by emailing 22 fiends in the Bay Area about local tech events. To grow the list more, Chris started giving 20-second Startup Digest pitches at events he attended. Pitches proved effective: membership grew into low thousands in a matter of months. Today there are 250,000 members of the Startup Digest community. </p> <p> Users should feel that they are a part of something big - write a mission statement, allow cross-connections (e.g. Joel didn't initially see use in Meta - effectively saying people who cared about the community most to go f**k themselves). They should also feel close to founder - as was the case with Alexis Ohanian and Reddit, who personally wrote to people, who spoke about it, even created an open bar tour for redditors. </p> <p> It's crucial to keep quality high - otherwise evangelists will leave, this will make quality drop even more, more evangelist will leave etc. - positive feedback loop. </p> <p> Having a community is great for hiring - you draw people from it. </p> </div> ); } } export default Content; export {metadata};
63.491851
159
0.655543
false
true
true
false
1277c0503f6499857be80070a61e4ae994ede160
17,670
jsx
JSX
src/components/checkout/OrderCheckout/components/CreditCardForm/index.jsx
AWIXOR/elliot-serverless-ecommerce
400bd30917e99bf5732880442b28abc2fa709a99
[ "MIT" ]
2
2021-04-19T13:28:46.000Z
2021-05-22T20:35:50.000Z
src/components/checkout/OrderCheckout/components/CreditCardForm/index.jsx
AWIXOR/elliot-serverless-ecommerce
400bd30917e99bf5732880442b28abc2fa709a99
[ "MIT" ]
14
2020-07-21T04:12:43.000Z
2022-03-26T22:24:24.000Z
src/components/checkout/OrderCheckout/components/CreditCardForm/index.jsx
AWIXOR/elliot-serverless-ecommerce
400bd30917e99bf5732880442b28abc2fa709a99
[ "MIT" ]
1
2021-12-08T23:28:52.000Z
2021-12-08T23:28:52.000Z
import Link from "next/link"; import dynamic from "next/dynamic"; import { useRouter } from "next/router"; import { useState, useMemo } from "react"; import { FormattedMessage, useIntl } from "react-intl"; import { CardElement, injectStripe } from "react-stripe-elements"; import { Flex, Item } from "react-flex-ready"; import { Formik, Field, Form, FastField, ErrorMessage } from "formik"; import * as Yup from "yup"; import PhoneInput from "react-phone-input-2"; import { useCart } from "providers/CartProvider"; import { useCurrency } from "providers/CurrencyProvider"; import { useDispatchCheckout, useCheckout } from "providers/CheckoutProvider"; import isEmpty from "helpers/isEmpty"; import getShippingPayload from "helpers/shipping/getShippingPayload"; import getShippingOptions from "helpers/shipping/getShippingOptions"; import getDisplayedShippingOptions from "helpers/shipping/getDisplayedShippingOptions"; import adjustShippingOptionsForChoices from "helpers/shipping/adjustShippingOptionsForChoices"; import useShippingStateUpdater from "hooks/useShippingStateUpdater"; import useOrderSummary from "hooks/useOrderSummary"; import useShippingInfo from "hooks/useShippingInfo"; import InputField from "components/common/InputField"; import Button from "components/common/Button"; import ErrorField from "components/common/ErrorField"; import Loader from "components/common/Loader"; import BuyButton from "components/checkout/OrderCheckout/components/BuyButton"; import LocationSearchInput from "components/checkout/OrderCheckout/components/LocationSearchInput"; import ShippingAddress from "components/checkout/OrderCheckout/components/ShippingAddress"; const PaymentButtons = dynamic( () => import("components/checkout/PaymentButtons"), { ssr: false } ); import { Wrapper, FieldWrapper, CreditCardWrap, CheckboxWrapper, CheckBox } from "./styles"; import RadioButton from "components/common/RadioButton"; const CreditCardForm = ({ stripe, checkout }) => { const { locale, formatMessage } = useIntl(); const router = useRouter(); const { state: { data: cart } } = useCart(); const { state: currency, exchangeRate, loading: loadingCurrency } = useCurrency(); const { setOrderStatus } = useDispatchCheckout(); const [loadingShippingInfo, setLoadingShippingInfo] = useState(false); const [paymentLoading, setPaymentLoading] = useState(false); const [cardError, setCardError] = useState(false); const [paymentState, setPaymentState] = useState(null); const [validCard, setCardValidity] = useState(false); const [cardOnBlurMessage, setCardOnBlurMessage] = useState(""); const [shippingOptions, setShippingOptions] = useState([]); const [ selectedShippingOptionIndex, setSelectedShippingOptionIndex ] = useState(0); const [ lastAddressUsedToFetchShipping, setLastAddressUsedToFetchShipping ] = useState({ city: "", state: "", country: "", zipCode: "" }); const [touchedErrors, setTouchedErrors] = useState({}); const [optionalShippingAddress, setOptionalShippingAddress] = useState(false); const hasAddressErrors = errors => { return ( Object.keys(errors).filter( key => ["addressLine1", "city", "state", "country", "zipCode"].indexOf( key ) !== -1 ).length > 0 ); }; const isAddressDirty = (fieldName, value) => { return ( ["city", "country", "state", "zipCode"].indexOf(fieldName) !== -1 && value !== lastAddressUsedToFetchShipping[fieldName] ); }; const shippingOption = useMemo( () => getDisplayedShippingOptions({ shippingOptions, checkout }), [JSON.stringify(shippingOptions)] ); const { shippingOptions: displayedShippingOptions, freeShipping } = shippingOption; const { shippingTotal } = useShippingInfo(); const { promotion } = useCheckout(); const { orderTotal } = useOrderSummary({ shippingTotal, exchangeRate, cart, promotion }); useShippingStateUpdater({ selectedShippingOptionIndex, shippingOption }); const handleAddressSelected = async ( addressLine1, addressLine2, city, selectedState, selectedCountry, zipCode ) => { setLoadingShippingInfo(true); const shippingDestination = { line1: addressLine1, line2: addressLine2, city, state: selectedState, country: selectedCountry, zip: zipCode }; const shippingOptions = await getShippingOptions({ shippingDestination, cart, checkout }); setShippingOptions(shippingOptions); setLoadingShippingInfo(false); setLastAddressUsedToFetchShipping({ city, state: selectedState, country: selectedCountry, zipCode: zipCode }); }; const onFieldBlur = async (fieldName, values, dirty, errors) => { const updatedTouchedErrors = { ...touchedErrors }; if (fieldName in errors) { updatedTouchedErrors[fieldName] = true; } else if (fieldName in touchedErrors) { delete updatedTouchedErrors[fieldName]; } const shippingDestination = { line1: values.addressLine1, line2: values.addressLine2, city: values.city, state: values.state, country: values.country, zip: values.zipCode }; setTouchedErrors(updatedTouchedErrors); if (dirty && !hasAddressErrors(errors)) { if ( !displayedShippingOptions || isAddressDirty(fieldName, values[fieldName]) ) { const shippingOptions = await getShippingOptions({ shippingDestination, cart, checkout }); setShippingOptions(shippingOptions); } const updatedLastAddressUsedToFetchShipping = { ...lastAddressUsedToFetchShipping }; updatedLastAddressUsedToFetchShipping[fieldName] = values[fieldName]; setLastAddressUsedToFetchShipping(updatedLastAddressUsedToFetchShipping); } }; const checkValidCard = ({ error, complete }) => { if (cardOnBlurMessage) { setCardOnBlurMessage(""); } setCardError(error && error.message); if (!complete) { setCardOnBlurMessage(formatMessage({ id: "validation.cc.fields" })); } else { setCardValidity(true); } }; const locationSearchInputComponent = ({ field, form, onBlur, value, fieldsToUpdate, optional }) => { return ( <LocationSearchInput field={field} form={form} fieldsToUpdate={fieldsToUpdate} placeholder="33 Irving Place" onBlur={onBlur} onSelect={handleAddressSelected} value={value} optional={optional} /> ); }; return ( <Formik initialValues={{ name: "", email: "", phone: "", addressLine1: "", addressLine2: "", city: "", state: "", country: "", zipCode: "", addressLine1_optional: "", addressLine2_optional: "", city_optional: "", state_optional: "", country_optional: "", zipCode_optional: "" }} validationSchema={Yup.object().shape({ name: Yup.string() .max(100, formatMessage({ id: "validation.full_name" })) .required(formatMessage({ id: "validation.required" })), email: Yup.string() .email(formatMessage({ id: "validation.invalid_email" })) .required(formatMessage({ id: "validation.required" })), phone: Yup.string(), addressLine1: Yup.string().required( formatMessage({ id: "validation.required" }) ), addressLine2: Yup.string(), city: Yup.string().required( formatMessage({ id: "validation.required" }) ), state: Yup.string().required(), country: Yup.string().required( formatMessage({ id: "validation.required" }) ), zipCode: Yup.string().required( formatMessage({ id: "validation.required" }) ), addressLine1_optional: !optionalShippingAddress ? Yup.string() : Yup.string().required(formatMessage({ id: "validation.required" })), addressLine2_optional: !optionalShippingAddress ? Yup.string() : Yup.string(), city_optional: !optionalShippingAddress ? Yup.string() : Yup.string().required(formatMessage({ id: "validation.required" })), state_optional: !optionalShippingAddress ? Yup.string() : Yup.string().required(), country_optional: !optionalShippingAddress ? Yup.string() : Yup.string().required(formatMessage({ id: "validation.required" })), zipCode_optional: !optionalShippingAddress ? Yup.string() : Yup.string().required(formatMessage({ id: "validation.required" })) })} onSubmit={async values => { try { // Within the context of `Elements`, this call to createToken knows which Element to // tokenize, since there's only one in this group. const { token } = await stripe.createToken({ name: values.name }); setPaymentLoading(true); if (!token) { console.error("NO TOKEN"); return; } const { name, addressLine1: line1, addressLine2: line2, city, state, country, zipCode: postalCode, phone, email, shipToAddress, shipToCity, shipToCountry, shipToState, shipToZipCode, addressLine1_optional, addressLine2_optional, city_optional, state_optional, country_optional, zipCode_optional } = values; const data = { email, line1: optionalShippingAddress ? addressLine1_optional : line1, line2: optionalShippingAddress ? addressLine2_optional : line2, city: optionalShippingAddress ? city_optional : city, state: optionalShippingAddress ? state_optional : state, country: optionalShippingAddress ? country_optional : country, postalCode: optionalShippingAddress ? zipCode_optional : postalCode, phone, name: name.slice(0, 100), shipToAddress, shipToCity, shipToCountry, shipToState, shipToZipCode }; const payload = getShippingPayload({ checkout, cart, data, token, shippingOptions: adjustShippingOptionsForChoices({ displayedShippingOptions, shippingOptions, checkout, selectedShippingOptionIndex }), selectedShippingOptionIndex }); const res = await fetch( "https://us-east1-elliot-192017.cloudfunctions.net/createOrderShipping", { method: "post", body: JSON.stringify(payload), headers: { "Content-Type": "application/json" } } ); if (res.ok) { setPaymentState("PAYMENT SUCCESSFUL"); setOrderStatus("PAYMENT SUCCESSFUL"); router.push(`/${locale}/successful-order`); } else { setPaymentState("PAYMENT FAILED"); setOrderStatus("PAYMENT FAILED"); router.push(`/${locale}/order-failed`); } } catch (error) { setPaymentState("PAYMENT FAILED"); setOrderStatus("PAYMENT FAILED"); router.push(`/${locale}/order-failed`); } finally { setPaymentLoading(false); } }} render={({ dirty, errors, setFieldValue, values, setFieldTouched }) => { const canSubmit = dirty && isEmpty(errors) && validCard && !cardError && displayedShippingOptions && !paymentLoading; return ( <Form> <> {[ "name", "email", "phone", "addressLine1", "addressLine2", "city", "state", "country", "zipCode", "addressLine1_optional", "addressLine2_optional", "city_optional", "state_optional", "country_optional", "zipCode_optional" ].map(field => ( <FastField key={field} name={field} autoComplete="on" style={{ display: "none" }} /> ))} </> <Wrapper> <PaymentButtons /> <h4> <FormattedMessage id="checkout.enter_payment_details" /> </h4> <Flex align="flex-start"> <Item col={6} colTablet={12} colMobile={12} gap={2}> <FieldWrapper> <label> <FormattedMessage id="checkout.form.email" /> </label> <Field name="email" type="email" autoComplete="new-password" as={InputField} placeholder="dublin@elliot.store" /> <ErrorMessage component={ErrorField} name="email" /> </FieldWrapper> </Item> <Item col={6} colTablet={12} colMobile={12} gap={2}> <FieldWrapper> <label> <FormattedMessage id="checkout.form.phone" /> </label> <Field country="us" name="phone" autoComplete="new-password" value={values.phone} component={PhoneInput} placeholder={3477150728} onBlur={() => setFieldTouched("phone")} onChange={value => setFieldValue("phone", value)} buttonStyle={{ background: "#fafafa", border: "2px solid #eaeaea", borderRadius: 0 }} dropdownStyle={{ background: "#fff" }} inputStyle={{ width: "100%", lineHeight: 49, fontSize: "12px", color: "#222", height: 50, border: "2px solid #eaeaea", borderRadius: "0" }} /> <ErrorMessage component={ErrorField} name="phone" /> </FieldWrapper> </Item> </Flex> <FieldWrapper> <label> <FormattedMessage id="checkout.form.full_name" /> </label> <Field name="name" as={InputField} autoComplete="new-password" placeholder="Dublin Skywalker" /> <ErrorMessage component={ErrorField} name="name" /> </FieldWrapper> <ShippingAddress locationComponent={locationSearchInputComponent} fieldsToUpdate={[ "addressLine1", "city", "state", "country", "zipCode" ]} onFieldBlur={onFieldBlur} values={values} dirty={dirty} errors={errors} /> <CheckboxWrapper> <CheckBox> <input type="checkbox" onChange={() => setOptionalShippingAddress(!optionalShippingAddress) } /> <span> <FormattedMessage id="checkout.ship_to_different_address" /> </span> </CheckBox> </CheckboxWrapper> {optionalShippingAddress && ( <ShippingAddress locationComponent={locationSearchInputComponent} fieldsToUpdate={[ "addressLine1_optional", "city_optional", "state_optional", "country_optional", "zipCode_optional" ]} onFieldBlur={onFieldBlur} values={values} dirty={dirty} errors={errors} optional /> )} <FieldWrapper> <label style={{ marginRight: "1rem" }}> <FormattedMessage id="checkout.shipping_method" /> </label> {loadingShippingInfo && <Loader />} {freeShipping ? ( <RadioButton> <input type="radio" id="shipping-free" value="free" name="shipping" checked /> <label htmlFor="shipping-free"> <FormattedMessage id="shipping.free" /> </label> </RadioButton> ) : displayedShippingOptions ? ( displayedShippingOptions.map( ({ provider, type, days }, i) => { let label = `${provider} ${type}`; if (days) { label += ` - Arrives in ${days} day(s)`; } return ( <RadioButton key={i}> <input type="radio" id={`shipping-${i}`} value={selectedShippingOptionIndex} name="shipping" onChange={e => setSelectedShippingOptionIndex(e.target.value) } /> <label htmlFor={`shipping-${i}`}>{label}</label> </RadioButton> ); } ) ) : ( !loadingShippingInfo && ( <div> <strong> <FormattedMessage id="checkout.form.complete_shipping_info" /> </strong> </div> ) )} </FieldWrapper> <FieldWrapper> <label> <FormattedMessage id="checkout.form.credit_card" /> {cardError && ( <span> &nbsp; - &nbsp; <span style={{ color: "#e10007", fontSize: "small" }} > {cardError} </span> </span> )} </label> <CreditCardWrap> <div> <CardElement style={{ base: { "::placeholder": { color: "#cfcfcf" }, fontSize: "16px" } }} onChange={checkValidCard} onBlur={() => { if (!cardError && cardOnBlurMessage) { setCardError(cardOnBlurMessage); } }} /> </div> </CreditCardWrap> </FieldWrapper> <div> <BuyButton canSubmit={canSubmit} price={orderTotal} currency={currency} paymentState={paymentState} loadingCurrency={loadingCurrency} paymentLoading={paymentLoading} /> <Link href="/[lang]/" as={`/${locale}/`}> <Button as="a" wide variant="secondary"> <FormattedMessage id="button.go_back" /> </Button> </Link> </div> </Wrapper> </Form> ); }} /> ); }; export default injectStripe(CreditCardForm);
27.310665
99
0.60017
true
false
false
true
1277e2f32b028cb08f6abd50332945389f09ce9c
149
jsx
JSX
src/components/ContextMenu.jsx
blackcoffeecat/dsp-helper
42d1440924ec903050ebe4854e9d5ad96df0676a
[ "MIT" ]
null
null
null
src/components/ContextMenu.jsx
blackcoffeecat/dsp-helper
42d1440924ec903050ebe4854e9d5ad96df0676a
[ "MIT" ]
3
2021-05-21T07:07:10.000Z
2021-10-18T20:08:49.000Z
src/components/ContextMenu.jsx
blackcoffeecat/dsp-helper
42d1440924ec903050ebe4854e9d5ad96df0676a
[ "MIT" ]
null
null
null
import React from 'react'; function ContextMenu(props) { return <div></div>; } export function ContextMenuItem() {} export default ContextMenu;
14.9
36
0.731544
false
true
false
true
1277ecdc4d361e5afbc9c6b07e4ec002a06218da
4,510
jsx
JSX
resources/js/components/PagesComponents/RecipePage/Nutrition.jsx
Andrey-Matanov/cooking_site
314a74285a33740befd267038b1f8ddb7fec7abc
[ "MIT" ]
1
2021-03-17T18:44:59.000Z
2021-03-17T18:44:59.000Z
resources/js/components/PagesComponents/RecipePage/Nutrition.jsx
Andrey-Matanov/cooking_site
314a74285a33740befd267038b1f8ddb7fec7abc
[ "MIT" ]
6
2021-01-19T17:08:22.000Z
2021-04-10T12:54:53.000Z
resources/js/components/PagesComponents/RecipePage/Nutrition.jsx
Andrey-Matanov/cooking_site
314a74285a33740befd267038b1f8ddb7fec7abc
[ "MIT" ]
5
2021-01-20T20:16:54.000Z
2021-02-16T20:46:58.000Z
import React from "react"; import { List, ListItem, Box, Typography, Grid } from "@material-ui/core"; import { useTheme } from "@material-ui/styles"; import DrumstickBiteIcon from "../../Icons/DrumstickBiteIcon"; import CheeseIcon from "../../Icons/CheeseIcon"; import CandyCaneIcon from "../../Icons/CandyCaneIcon"; import BoltIcon from "../../Icons/BoltIcon"; const Nutrition = ({ ingredients }) => { const theme = useTheme(); let nutritionValues = { calorie: 0, protein: 0, fat: 0, carb: 0, }; ingredients.map((item) => { nutritionValues.calorie += item.calorie * item.amount; nutritionValues.protein += item.protein * item.amount; nutritionValues.fat += item.fat * item.amount; nutritionValues.carb += item.carb * item.amount; }); nutritionValues ? Object.keys(nutritionValues).forEach((item) => { nutritionValues[item] = Math.ceil(nutritionValues[item], 0); }) : null; return ( <div> <Box> <Typography variant="h5">Пищевая ценность</Typography> <Typography variant="caption"> Приблизительное значение на основе ингредиентов </Typography> </Box> <List> <ListItem> <Grid container justify="space-between"> <Grid item> <Typography variant="body1"> <BoltIcon color="secondary" fontSize="inherit" />{" "} Энергетическая ценность: </Typography> </Grid> <Grid item> <Typography variant="body1"> {nutritionValues.calorie / 100} ккал </Typography> </Grid> </Grid> </ListItem> <ListItem> <Grid container justify="space-between"> <Grid item> <Typography variant="body1"> <DrumstickBiteIcon color="secondary" fontSize="inherit" />{" "} Протеины: </Typography> </Grid> <Grid item> <Typography variant="body1"> {nutritionValues.protein / 100} г </Typography> </Grid> </Grid> </ListItem> <ListItem> <Grid container justify="space-between"> <Grid item> <Typography variant="body1"> <CandyCaneIcon color="secondary" fontSize="inherit" />{" "} Углеводы: </Typography> </Grid> <Grid item> <Typography variant="body1"> {nutritionValues.carb / 100} г </Typography> </Grid> </Grid> </ListItem> <ListItem> <Grid container justify="space-between"> <Grid item> <Typography variant="body1"> <CheeseIcon color="secondary" fontSize="inherit" />{" "} Жиры: </Typography> </Grid> <Grid item> <Typography variant="body1"> {nutritionValues.fat / 100} г </Typography> </Grid> </Grid> </ListItem> </List> </div> ); }; export default Nutrition;
37.583333
74
0.368514
false
true
false
true
1277f3024f8de5039cbb168219ef7e4e78c523ac
339
jsx
JSX
src/Icon/FontFamily/FontFamily.jsx
gucollaco/react-eulexia
dcf256a2f6e1dc1bee4f35b66a69790a9a7456c6
[ "MIT" ]
3
2020-11-17T14:46:47.000Z
2022-01-31T21:31:21.000Z
src/Icon/FontFamily/FontFamily.jsx
gucollaco/react-eulexia
dcf256a2f6e1dc1bee4f35b66a69790a9a7456c6
[ "MIT" ]
30
2020-10-31T13:06:11.000Z
2021-09-22T04:50:55.000Z
src/Icon/FontFamily/FontFamily.jsx
gucollaco/react-eulexia
dcf256a2f6e1dc1bee4f35b66a69790a9a7456c6
[ "MIT" ]
null
null
null
import React from 'react' const FontFamilyIcon = () => ( <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' role='img' data-testid='font-family-icon' > <path fill='none' d='M0 0h24v24H0z' /> <path d='M13 6v15h-2V6H5V4h14v2z' /> </svg> ) export default FontFamilyIcon
18.833333
42
0.60767
false
true
false
true
1277f6a3ab6137166e7bcc59698f2ee0c13774ea
193
jsx
JSX
app/components/Footer.jsx
Voxelsdev/snappy-redux
539dae854adbb24f5d8a15070eddc4451d886eda
[ "MIT" ]
null
null
null
app/components/Footer.jsx
Voxelsdev/snappy-redux
539dae854adbb24f5d8a15070eddc4451d886eda
[ "MIT" ]
null
null
null
app/components/Footer.jsx
Voxelsdev/snappy-redux
539dae854adbb24f5d8a15070eddc4451d886eda
[ "MIT" ]
null
null
null
import React from 'react' const Footer = React.createClass({ render() { return ( <div> © Copyright 2016 TYLER MILLERRRRR </div> ) } }); export default Footer;
13.785714
41
0.580311
false
true
false
true
1277f95534619c4233c3439dc019e53bb310a884
5,740
jsx
JSX
src/components/FolderModal.jsx
isomerpages/isomercms-frontend
245d2f15eed1adc0decbb9b54a3b319dd285b99a
[ "MIT" ]
5
2019-10-22T15:15:00.000Z
2022-03-24T03:35:04.000Z
src/components/FolderModal.jsx
isomerpages/isomercms-frontend
245d2f15eed1adc0decbb9b54a3b319dd285b99a
[ "MIT" ]
481
2019-10-25T08:37:29.000Z
2022-03-30T17:39:18.000Z
src/components/FolderModal.jsx
isomerpages/isomercms-frontend
245d2f15eed1adc0decbb9b54a3b319dd285b99a
[ "MIT" ]
null
null
null
// TODO: deprecate after Workspace and Resources refactor // remove from FolderCard, use DirectorySettingsModal as separate modal on layout import React, { useState } from "react" import axios from "axios" import PropTypes from "prop-types" import { useMutation, useQueryClient } from "react-query" import elementStyles from "../styles/isomer-cms/Elements.module.scss" import SaveDeleteButtons from "./SaveDeleteButtons" import FormField from "./FormField" import { renameFolder, renameSubfolder, renameResourceCategory, renameMediaSubfolder, } from "../api" import { DEFAULT_RETRY_MSG, slugifyCategory, deslugifyDirectory, } from "../utils" import { validateCategoryName } from "../utils/validators" import { errorToast, successToast } from "../utils/toasts" import { DOCUMENT_CONTENTS_KEY, IMAGE_CONTENTS_KEY, DIR_CONTENT_KEY, FOLDERS_CONTENT_KEY, RESOURCE_ROOM_CONTENT_KEY, } from "../constants" // axios settings axios.defaults.withCredentials = true const selectRenameApiCall = ( folderType, siteName, folderOrCategoryName, subfolderName, newDirectoryName, mediaCustomPath ) => { if ( slugifyCategory(newDirectoryName) === subfolderName || slugifyCategory(newDirectoryName) === folderOrCategoryName ) return if (folderType === "page" && !subfolderName) { const params = { siteName, folderName: folderOrCategoryName, newFolderName: slugifyCategory(newDirectoryName), } return renameFolder(params) } if (folderType === "page" && subfolderName) { const params = { siteName, folderName: folderOrCategoryName, subfolderName, newSubfolderName: slugifyCategory(newDirectoryName), } return renameSubfolder(params) } if (folderType === "resources") { const params = { siteName, categoryName: folderOrCategoryName, newCategoryName: slugifyCategory(newDirectoryName), } return renameResourceCategory(params) } if (folderType === "images" || folderType === "documents") { const params = { siteName, mediaType: folderType, customPath: mediaCustomPath, subfolderName: folderOrCategoryName, newSubfolderName: slugifyCategory(newDirectoryName), } return renameMediaSubfolder(params) } } const FolderModal = ({ displayTitle, displayText, onClose, folderOrCategoryName, subfolderName, siteName, folderType, existingFolders, mediaCustomPath, }) => { // Instantiate queryClient const queryClient = useQueryClient() const [newDirectoryName, setNewDirectoryName] = useState( deslugifyDirectory(subfolderName || folderOrCategoryName) ) const [errors, setErrors] = useState("") // rename folder/subfolder/resource category const { mutateAsync: renameDirectory } = useMutation( () => selectRenameApiCall( folderType, siteName, folderOrCategoryName, subfolderName, newDirectoryName, mediaCustomPath ), { onError: () => errorToast( `There was a problem trying to rename this folder. ${DEFAULT_RETRY_MSG}` ), onSuccess: () => { if (folderType === "resources") { // Resource folder queryClient.invalidateQueries([RESOURCE_ROOM_CONTENT_KEY, siteName]) } else if (folderType === "page" && subfolderName) { // Collection subfolder queryClient.invalidateQueries([ DIR_CONTENT_KEY, siteName, folderOrCategoryName, undefined, ]) } else if (folderType === "page" && !subfolderName) { queryClient.invalidateQueries([DIR_CONTENT_KEY, { siteName }]) } else if (folderType === "images") { queryClient.invalidateQueries([IMAGE_CONTENTS_KEY, mediaCustomPath]) } else if (folderType === "documents") { queryClient.invalidateQueries([ DOCUMENT_CONTENTS_KEY, mediaCustomPath, ]) } onClose() successToast(`Successfully renamed folder!`) }, } ) const folderNameChangeHandler = (event) => { const { value } = event.target const comparisonCategoryArray = subfolderName ? existingFolders.filter((name) => name !== subfolderName) : existingFolders.filter((name) => name !== folderOrCategoryName) const errorMessage = validateCategoryName( value, folderType, comparisonCategoryArray ) setErrors(errorMessage) setNewDirectoryName(value) } return ( <div className={elementStyles.overlay}> <div className={elementStyles["modal-settings"]}> <div className={elementStyles.modalHeader}> <h1>{displayTitle}</h1> <button type="button" onClick={onClose}> <i className="bx bx-x" /> </button> </div> <form className={elementStyles.modalContent}> <FormField title={displayText} id="newDirectoryName" value={newDirectoryName} onFieldChange={folderNameChangeHandler} errorMessage={errors} /> <SaveDeleteButtons isDisabled={!!errors} hasDeleteButton={false} saveCallback={renameDirectory} /> </form> </div> </div> ) } FolderModal.propTypes = { displayTitle: PropTypes.string.isRequired, displayText: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, folderOrCategoryName: PropTypes.string.isRequired, subfolderName: PropTypes.string, siteName: PropTypes.string.isRequired, folderType: PropTypes.string.isRequired, mediaCustomPath: PropTypes.string, } export default FolderModal
27.729469
82
0.660976
false
true
false
true
1277fee69e1a2163c8517ddcff021a61a351f04a
1,372
jsx
JSX
src/components/GossipView/index.jsx
pablogadhi/Laboratorio9-Web-Frontend
bfbed760469d321b40b7be622f21e670c90e0b9a
[ "MIT" ]
null
null
null
src/components/GossipView/index.jsx
pablogadhi/Laboratorio9-Web-Frontend
bfbed760469d321b40b7be622f21e670c90e0b9a
[ "MIT" ]
null
null
null
src/components/GossipView/index.jsx
pablogadhi/Laboratorio9-Web-Frontend
bfbed760469d321b40b7be622f21e670c90e0b9a
[ "MIT" ]
null
null
null
/* Vista de un chisme especifico */ import React from 'react'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import { PropTypes } from 'prop-types'; import * as selectors from '../../reducers'; import * as actions from '../../actions'; import './gView.css'; class GossipView extends React.Component { componentWillMount() { const { fetchDescription } = this.props; fetchDescription(); } render() { const { id, title, date, description, } = this.props; return ( <div className="gossip-view"> <h1>{title}</h1> <h4 className="id-ref"> Chisme {' '} {id} </h4> <h5> Fecha: {' '} {date} </h5> <p>{description}</p> </div> ); } } GossipView.propTypes = { id: PropTypes.number.isRequired, title: PropTypes.string.isRequired, date: PropTypes.string.isRequired, description: PropTypes.string.isRequired, fetchDescription: PropTypes.func.isRequired, }; export default withRouter(connect( (state, { match }) => ({ ...selectors.getGossip(state, match.params.id), description: selectors.getDisplayDescription(state), }), (dispatch, { match }) => ({ fetchDescription() { dispatch(actions.fetchGossipDescription(match.params.id)); }, }), )(GossipView));
23.254237
64
0.603499
false
true
true
false
1277ff64311739ada212106def4dbc368f412c36
4,917
jsx
JSX
app/src/pages/inside/stepPage/modals/linkIssueModal/linkIssueFields/linkIssueFields.jsx
Anton-Akinin/service-ui
89eb1202d0f078e1529f93707ae66dc8fc5221ef
[ "Apache-2.0" ]
54
2016-09-15T09:05:38.000Z
2021-12-13T22:42:33.000Z
app/src/pages/inside/stepPage/modals/linkIssueModal/linkIssueFields/linkIssueFields.jsx
Anton-Akinin/service-ui
89eb1202d0f078e1529f93707ae66dc8fc5221ef
[ "Apache-2.0" ]
1,549
2016-11-22T09:57:10.000Z
2022-03-31T12:15:25.000Z
app/src/pages/inside/stepPage/modals/linkIssueModal/linkIssueFields/linkIssueFields.jsx
Anton-Akinin/service-ui
89eb1202d0f078e1529f93707ae66dc8fc5221ef
[ "Apache-2.0" ]
115
2016-09-15T09:40:46.000Z
2022-03-03T14:37:46.000Z
/* * Copyright 2019 EPAM Systems * * 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 { Component } from 'react'; import track from 'react-tracking'; import PropTypes from 'prop-types'; import Parser from 'html-react-parser'; import CloseIcon from 'common/img/cross-icon-inline.svg'; import classNames from 'classnames/bind'; import { injectIntl, defineMessages } from 'react-intl'; import { GhostButton } from 'components/buttons/ghostButton'; import { FormField } from 'components/fields/formField'; import { Input } from 'components/inputs/input'; import { FieldErrorHint } from 'components/fields/fieldErrorHint'; import PlusIcon from 'common/img/plus-button-inline.svg'; import styles from './linkIssueFields.scss'; const cx = classNames.bind(styles); const messages = defineMessages({ addIssueButtonTitle: { id: 'LinkIssueModal.addIssueButtonTitle', defaultMessage: 'Add new issue', }, issueLinkLabel: { id: 'LinkIssueModal.issueLinkLabel', defaultMessage: 'Link to issue', }, issueIdLabel: { id: 'LinkIssueModal.issueIdLabel', defaultMessage: 'Issue ID', }, issueLinkPlaceholder: { id: 'LinkIssueModal.issueLinkPlaceholder', defaultMessage: 'Enter link to issue', }, }); @injectIntl @track() export class LinkIssueFields extends Component { static propTypes = { intl: PropTypes.object.isRequired, change: PropTypes.func.isRequired, fields: PropTypes.object.isRequired, addEventInfo: PropTypes.object, tracking: PropTypes.shape({ trackEvent: PropTypes.func, getTrackingData: PropTypes.func, }).isRequired, withAutocomplete: PropTypes.bool, darkView: PropTypes.bool, }; static defaultProps = { addEventInfo: {}, withAutocomplete: false, }; updateIssueId = (e, value, oldValue, name) => { const issueIndex = /\d+/.exec(name)[0]; if (value.indexOf('/') !== -1 && !this.props.fields.get(issueIndex).issueId) { let issueIdAutoValue = value.split('/'); issueIdAutoValue = issueIdAutoValue[issueIdAutoValue.length - 1]; this.props.change(`issues[${issueIndex}].issueId`, issueIdAutoValue); } }; render() { const { fields, addEventInfo, tracking, withAutocomplete, darkView } = this.props; return ( <ul className={cx('link-issue-fields')}> {fields.map((issue, index) => ( <li key={issue} className={cx('issue-fields-list-item')}> {fields.length > 1 && ( <div className={cx('remove-issue-fields-button')} onClick={() => fields.remove(index)} > {Parser(CloseIcon)} </div> )} <FormField name={`${issue}.issueLink`} fieldWrapperClassName={cx('field-wrapper')} label={this.props.intl.formatMessage(messages.issueLinkLabel)} onChange={withAutocomplete ? this.updateIssueId : null} labelClassName={cx('label', { 'dark-view': darkView })} > <FieldErrorHint> <Input className={darkView && 'dark-view'} placeholder={this.props.intl.formatMessage(messages.issueLinkPlaceholder)} /> </FieldErrorHint> </FormField> <FormField name={`${issue}.issueId`} fieldWrapperClassName={cx('field-wrapper')} label={this.props.intl.formatMessage(messages.issueIdLabel)} labelClassName={cx('label', { 'dark-view': darkView })} > <FieldErrorHint> <Input maxLength="128" placeholder={this.props.intl.formatMessage(messages.issueIdLabel)} className={darkView && 'dark-view'} /> </FieldErrorHint> </FormField> </li> ))} <li className={cx('add-issue-button', { 'dark-view': darkView })}> <GhostButton type="button" notMinified onClick={() => { tracking.trackEvent(addEventInfo); fields.push({}); }} icon={PlusIcon} appearance={darkView && 'gray'} > {this.props.intl.formatMessage(messages.addIssueButtonTitle)} </GhostButton> </li> </ul> ); } }
34.145833
92
0.609518
false
true
true
false
12782c7fef0ae2c55dea1c96eef5cacbbca69114
1,771
jsx
JSX
src/sentry/static/sentry/app/components/search/sources/index.jsx
legalosLOTR/sentry
0946e508e2a05cb0fef745b6406fdc87bf06a368
[ "BSD-3-Clause" ]
1
2022-02-09T22:56:49.000Z
2022-02-09T22:56:49.000Z
src/sentry/static/sentry/app/components/search/sources/index.jsx
legalosLOTR/sentry
0946e508e2a05cb0fef745b6406fdc87bf06a368
[ "BSD-3-Clause" ]
1
2021-05-09T11:43:43.000Z
2021-05-09T11:43:43.000Z
src/sentry/static/sentry/app/components/search/sources/index.jsx
legalosLOTR/sentry
0946e508e2a05cb0fef745b6406fdc87bf06a368
[ "BSD-3-Clause" ]
null
null
null
import {flatten} from 'lodash'; import PropTypes from 'prop-types'; import React from 'react'; class SearchSources extends React.Component { static propTypes = { sources: PropTypes.array.isRequired, query: PropTypes.string, /** * Render function the passes: * * `isLoading` * `results` - Array of results * `hasAnyResults` - if any results were found */ children: PropTypes.func, }; // `allSources` will be an array of all result objects from each source renderResults(allSources) { let {children} = this.props; // loading means if any result has `isLoading` OR any result is null let isLoading = !!allSources.find(arg => arg.isLoading || arg.results === null); let foundResults = isLoading ? [] : flatten(allSources.map(({results}) => results || [])).sort( (a, b) => a.score - b.score ); let hasAnyResults = !!foundResults.length; return children({ isLoading, results: foundResults, hasAnyResults, }); } renderSources(sources, results, idx) { if (idx >= sources.length) { return this.renderResults(results); } let Source = sources[idx]; return ( <Source {...this.props}> {args => { // Mutate the array instead of pushing because we don't know how often // this child function will be called and pushing will cause duplicate // results to be pushed for all calls down the chain. results[idx] = args; return this.renderSources(sources, results, idx + 1); }} </Source> ); } render() { let {sources} = this.props; return this.renderSources(sources, new Array(sources.length), 0); } } export default SearchSources;
27.246154
84
0.616601
false
true
true
false
1278506992b4d4735903c38c3713d31cb7b9c85c
913
jsx
JSX
src/ChatBar.jsx
gizemocak/Chatty-app-react-web-sockets
3f110b0e8e65405447ba5a066a968ff2855b8eb3
[ "MIT" ]
null
null
null
src/ChatBar.jsx
gizemocak/Chatty-app-react-web-sockets
3f110b0e8e65405447ba5a066a968ff2855b8eb3
[ "MIT" ]
null
null
null
src/ChatBar.jsx
gizemocak/Chatty-app-react-web-sockets
3f110b0e8e65405447ba5a066a968ff2855b8eb3
[ "MIT" ]
null
null
null
import React, { Component } from "react"; class ChatBar extends Component { handleKeyDown = e => { let input = e.target.value; if (input && e.keyCode === 13) { this.props.handleNewMessage(input); document.querySelector("input.chatbar-message").value = ""; } }; handleChangeUserName = e => { if (e.keyCode === 13) { let input = e.target.value; this.props.updateUserName(input); } }; render() { const { currentUser } = this.props; return ( <form className="chatbar"> <input className="chatbar-username" placeholder={currentUser} onKeyUp={this.handleChangeUserName} /> <input type="text" className="chatbar-message" placeholder="Type a message and hit ENTER" onKeyUp={this.handleKeyDown} /> </form> ); } } export default ChatBar;
22.825
65
0.570646
false
true
true
false
12785dc52e227b327aaf9a8103aa92284bf24337
3,838
jsx
JSX
src/components/results/MAGIRequirementResults.jsx
btbright/code-g
a38249b84c79ec6cccd858312e8906471355856c
[ "MIT" ]
null
null
null
src/components/results/MAGIRequirementResults.jsx
btbright/code-g
a38249b84c79ec6cccd858312e8906471355856c
[ "MIT" ]
2
2017-09-03T15:15:21.000Z
2017-11-29T22:46:33.000Z
src/components/results/MAGIRequirementResults.jsx
btbright/code-g
a38249b84c79ec6cccd858312e8906471355856c
[ "MIT" ]
null
null
null
import React from "react"; import { isArray } from "lodash"; import classnames from "classnames"; import { resultFields } from "../../constants/taxpayerReturnFields"; export default props => { return ( <div className="qualification-section"> <p className="requirement"> 1) Your household income is less than 138% of the federal poverty line for the number of individuals in your tax household, not including any dependents you didn't claim; and </p> {props.fplPercentage && <ResultsBody {...props} />} </div> ); }; const MeetsRequirementHeader = ({ fplPercentage }) => <p className="status qualification-success"> <span style={{ color: "green" }}>&#x2714;</span>&nbsp;&nbsp;Since your household income is <strong>{fplPercentage}%</strong> of the federal poverty line, you meet this requirement.<br /> </p>; const DoesNotMeetRequirementHeader = ({ fplPercentage }) => <p className="status qualification-failure"> <span style={{ color: "red" }}>&#x2716;</span>&nbsp;&nbsp;Since your household income is <strong>{fplPercentage}%</strong> of the federal poverty line, you do not meet this requirement.<br /> </p>; const ResultsBody = props => { const RequirementResultsHeader = props.isTaxpayerQualified ? MeetsRequirementHeader : DoesNotMeetRequirementHeader; return ( <div> <RequirementResultsHeader fplPercentage={props.fplPercentage} /> <button className="toggle-calculations" onClick={props.onToggleCalculations} > {props.ui.showReturnFields ? "Hide Calculations" : "Show Calculations"} </button> <table className={classnames( "u-full-width", "taxpayer-fields", props.ui.showReturnFields && "show" )} > <tbody> {Object.keys(resultFields).sort(dependentsSort).map((fieldKey, i) => { const fieldValue = props.parsedTaxpayerReturn[fieldKey]; if (fieldValue === 0) return null; if (isArray(fieldValue)) { return renderDependents(fieldValue); } const { name, type } = resultFields[fieldKey]; return renderFieldRow(name, type, fieldValue, i); })} <tr className="total-row"> <td>Total Household Modified AGI</td> <td colSpan={2} style={{ textAlign: "right" }}> {props.modifiedAGI} </td> </tr> <tr className="total-row"> <td>Federal Poverty Line Reference</td> <td> for {props.numberOfPeopleInTaxHousehold}{" "} {props.numberOfPeopleInTaxHousehold === "1" ? "person" : "people"} </td> <td style={{ textAlign: "right" }}> {props.referenceFPL} </td> </tr> </tbody> </table> </div> ); }; const renderFieldRow = (name, type, fieldValue, i) => { return ( <tr key={i}> <td> {name} </td> <td colSpan={2} style={{ textAlign: "right" }}> {type === "negative" ? `(${fieldValue})` : fieldValue} </td> </tr> ); }; const renderDependents = dependents => { const rows = []; dependents.forEach((dependent, i) => { Object.keys(dependent).forEach((fieldKey, j) => { const fieldValue = dependent[fieldKey]; if (fieldValue === 0) return; const { name, type } = resultFields[fieldKey]; rows.push( renderFieldRow( `Dependent #${i + 1} - ${name}`, type, fieldValue, `${i}-${j}` ) ); }); }); return rows; }; const dependentsSort = (a, b) => { if (a !== "dependents" && b !== "dependents") { return 0; } if (a === "dependents") { return 1; } return -1; };
30.220472
80
0.570349
false
true
false
true
12785fa978ff8cddb01372c96ad0358bf17206b2
536
jsx
JSX
src/ChatBar.jsx
n-david/chattyApp
48917437d16b5a32af10f044cb4db070f1b73f9e
[ "MIT" ]
null
null
null
src/ChatBar.jsx
n-david/chattyApp
48917437d16b5a32af10f044cb4db070f1b73f9e
[ "MIT" ]
null
null
null
src/ChatBar.jsx
n-david/chattyApp
48917437d16b5a32af10f044cb4db070f1b73f9e
[ "MIT" ]
null
null
null
import React, {Component} from 'react'; class ChatBar extends Component { render() { console.log('Rendering <ChatBar/>'); return ( <footer className='chatbar'> <input className='chatbar-username' placeholder='Your Name (Optional)' defaultValue={this.props.currentUser.name} onKeyPress={this.props.changeUser.bind(this)} /> <input className='chatbar-message' placeholder='Type a message and hit ENTER' onKeyPress={this.props.addMessage.bind(this)} /> </footer> ); } } export default ChatBar;
35.733333
170
0.692164
false
true
true
false
127881cb3ad26307675f5682e9e7aade660a76cf
350
jsx
JSX
src/components/NavBar/NavBar.jsx
ralonsodeniz/swapi-people-finder
90ea078f03dd661adf897e1a2093e51bc6ce72ec
[ "MIT" ]
null
null
null
src/components/NavBar/NavBar.jsx
ralonsodeniz/swapi-people-finder
90ea078f03dd661adf897e1a2093e51bc6ce72ec
[ "MIT" ]
6
2020-04-01T09:56:21.000Z
2022-02-27T01:48:55.000Z
src/components/NavBar/NavBar.jsx
ralonsodeniz/swapi-people-finder
90ea078f03dd661adf897e1a2093e51bc6ce72ec
[ "MIT" ]
null
null
null
import React from 'react'; import { NavBarContainer, NavBarTitle, EmpireLogoSvg, RebelLogoSvg } from './NavBar.styles'; const NavBar = () => { return ( <NavBarContainer> <EmpireLogoSvg /> <NavBarTitle> SWAPI People Finder </NavBarTitle> <RebelLogoSvg /> </NavBarContainer> ); }; export default NavBar;
21.875
93
0.637143
false
true
false
true
1278846cc5c50939593acf88080d5c1085027640
2,628
jsx
JSX
src/client/components/Settings/InputWithSave/index.jsx
vladim1219/trudesk
da9d810d33229acacc579cb43cdbae65a8080e84
[ "Apache-2.0" ]
827
2015-07-23T06:27:41.000Z
2022-03-31T20:02:41.000Z
src/client/components/Settings/InputWithSave/index.jsx
vladim1219/trudesk
da9d810d33229acacc579cb43cdbae65a8080e84
[ "Apache-2.0" ]
452
2016-05-17T21:24:39.000Z
2022-03-28T10:20:16.000Z
src/client/components/Settings/InputWithSave/index.jsx
vladim1219/trudesk
da9d810d33229acacc579cb43cdbae65a8080e84
[ "Apache-2.0" ]
378
2017-10-12T22:01:10.000Z
2022-03-30T09:37:04.000Z
/* * . .o8 oooo * .o8 "888 `888 * .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo * 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P' * 888 888 888 888 888 888 888ooo888 `"Y88b. 888888. * 888 . 888 888 888 888 888 888 .o o. )88b 888 `88b. * "888" d888b `V88V"V8P' `Y8bod88P" `Y8bod8P' 8""888P' o888o o888o * ======================================================================== * Author: Chris Brame * Updated: 1/20/19 4:46 PM * Copyright (c) 2014-2019. All rights reserved. */ import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import helpers from 'lib/helpers' import { updateSetting } from 'actions/settings' class InputWithSave extends React.Component { constructor (props) { super(props) this.state = { value: this.props.value } } componentDidMount () { helpers.UI.inputs() } static getDerivedStateFromProps (nextProps, state) { if (!state.value) { return { value: nextProps.value } } return null } onSaveClicked () { this.props.updateSetting({ name: this.props.settingName, value: this.state.value, stateName: this.props.stateName }) } updateValue (evt) { this.setState({ value: evt.target.value }) } render () { let width = '100%' if (this.props.width) width = this.props.width return ( <div className='uk-width-1-1 uk-float-right' style={{ width: width }}> <div className='uk-width-3-4 uk-float-left' style={{ paddingRight: '10px' }}> <input id={this.props.stateName} className='md-input md-input-width-medium' type='text' value={this.state.value} onChange={evt => this.updateValue(evt)} /> </div> <div className='uk-width-1-4 uk-float-right' style={{ marginTop: '10px', textAlign: 'center' }}> <button className='md-btn md-btn-small' onClick={e => this.onSaveClicked(e)}> {this.props.saveLabel ? this.props.saveLabel : 'Save'} </button> </div> </div> ) } } InputWithSave.propTypes = { updateSetting: PropTypes.func.isRequired, settingName: PropTypes.string.isRequired, stateName: PropTypes.string.isRequired, saveLabel: PropTypes.string, value: PropTypes.string, width: PropTypes.string } export default connect( null, { updateSetting } )(InputWithSave)
28.258065
120
0.561263
false
true
true
false
12788ef0d488e0249a963b22a176abc3d2e13cbb
391
jsx
JSX
frontend/docvisitui/src/components/footer/footer.component.jsx
laszlobujak/docvisit
226e5df4192fd6a2c1d898922f9a7601a46a003e
[ "MIT" ]
null
null
null
frontend/docvisitui/src/components/footer/footer.component.jsx
laszlobujak/docvisit
226e5df4192fd6a2c1d898922f9a7601a46a003e
[ "MIT" ]
1
2021-05-11T06:36:04.000Z
2021-05-11T06:36:04.000Z
frontend/docvisitui/src/components/footer/footer.component.jsx
laszlobujak/docvisit
226e5df4192fd6a2c1d898922f9a7601a46a003e
[ "MIT" ]
null
null
null
import React from 'react'; import { Link } from 'react-router-dom'; import './footer.style.scss'; const Footer = () => ( <div className="footer-container"> <div className="menu-item"> <Link to="/signup"> Sign up </Link> <Link to="/login"> Log in </Link> </div> <div id="nurse-and-doctor"></div> </div> ); export default Footer;
18.619048
40
0.55243
false
true
false
true
12789493299e1fdd5852fba0cd051d64bfb77316
677
jsx
JSX
src/components/Logo.jsx
goromanas/emeaap
e2de5a47e071c7bc47fbbcfe06d62e3c5e1da430
[ "RSA-MD" ]
null
null
null
src/components/Logo.jsx
goromanas/emeaap
e2de5a47e071c7bc47fbbcfe06d62e3c5e1da430
[ "RSA-MD" ]
null
null
null
src/components/Logo.jsx
goromanas/emeaap
e2de5a47e071c7bc47fbbcfe06d62e3c5e1da430
[ "RSA-MD" ]
null
null
null
import React from 'react' import styled from 'styled-components' import { useStaticQuery, graphql } from 'gatsby' const StyledLogo = styled.img` padding: 0.25rem; background-color: #fff; border: 1px solid #dee2e6; border-radius: 0.25rem; max-width: 100%; margin-bottom: 0.5rem; ` const Logo = () => { const data = useStaticQuery(graphql` { allFile(filter: { name: { eq: "logo" } }) { edges { node { publicURL name } } } } `) return ( <StyledLogo src={data.allFile.edges[0].node.publicURL} alt={data.allFile.edges[0].node.name} /> ) } export default Logo
18.805556
49
0.573117
false
true
false
true
1278a909eeea9dd98beee62c0f0fa22985923bb0
1,518
jsx
JSX
src/components/Container.jsx
ChenSh1ne/synvisio
fcda82c3aa15644835411f6b964d7a78810ebe8d
[ "MIT" ]
null
null
null
src/components/Container.jsx
ChenSh1ne/synvisio
fcda82c3aa15644835411f6b964d7a78810ebe8d
[ "MIT" ]
null
null
null
src/components/Container.jsx
ChenSh1ne/synvisio
fcda82c3aa15644835411f6b964d7a78810ebe8d
[ "MIT" ]
1
2021-10-17T11:20:35.000Z
2021-10-17T11:20:35.000Z
import React, { Component } from 'react'; import { NavBar } from './'; export default class Container extends Component { constructor(props) { super(props); } render() { return ( <div id='app-container'> {/* navbar content , common for entire application */} <NavBar /> <div id='container-body'> {this.props.children} </div> <footer className="footer w-full m-t"> <div className="container-fluid"> <div className='w-md footer-inner'> <span className="left text-xs-left"> <a className="footer-link" href="mailto:venkat.bandi@usask.ca?subject=MCSCANX Synteny Tool&amp;body=Please%20Fill%20">Contact Us</a> </span> </div> <div className='w-md footer-inner text-xs-right'> <span className='m-r'> Made with <span style={{ "color": '#e25555', 'fontSize': '19px', 'margin': '0px 3px' }}>&hearts;</span> by <a href="https://github.com/kiranbandi">kiranbandi</a></span> <a className="footer-link right" href="http://hci.usask.ca/"> <img src="assets/img/interaction_lab.gif" height="30" /></a> </div> </div> </footer> </div> ); } }
43.371429
200
0.463768
false
true
true
false
1278aca91e04ecf0845d8a5fc50f1be534c6523a
3,583
jsx
JSX
src/Pages/Estabelecimento/innerComponent/Produtos/list-item.jsx
VolneiTonato/mobofertas
8a13c212c5d18666b50b2a3e8b4767f41d412859
[ "MIT" ]
1
2021-02-16T00:15:23.000Z
2021-02-16T00:15:23.000Z
src/Pages/Estabelecimento/innerComponent/Produtos/list-item.jsx
VolneiTonato/mobofertas
8a13c212c5d18666b50b2a3e8b4767f41d412859
[ "MIT" ]
null
null
null
src/Pages/Estabelecimento/innerComponent/Produtos/list-item.jsx
VolneiTonato/mobofertas
8a13c212c5d18666b50b2a3e8b4767f41d412859
[ "MIT" ]
null
null
null
import React, { useEffect, useRef, useState, forwardRef } from 'react' import { Box, Avatar, makeStyles, Divider, List, ListItem, ListItemText, ListItemAvatar } from '@material-ui/core' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faCameraRetro } from '@fortawesome/free-solid-svg-icons' import { lowerCase, startCase, truncate, isString, size } from 'lodash' import { ModalDetailItem } from '../ProdutoDetail' import Moment from 'moment' const useStyles = makeStyles((theme) => ({ root: { width: '100%', maxWidth: 360, backgroundColor: theme.palette.background.paper, }, ListItemAvatar: { paddingRight: 3, }, largeAvatar: { width: theme.spacing(8), height: theme.spacing(8), backgroundColor: 'transparent' }, ListItem: { paddingLeft: 1, margin: 0, maxHeight: 80, height: "80hv", alignItems: "center" } })) const ProdutoItem = (props, ref) => { const classes = useStyles() const { item } = props const [imagemItem, setImagemItem] = useState(null) const [iconCamera, setIconCamera] = useState(null) const modal = useRef() useEffect(() => { if (isString(item.imagem) && size(item.imagem)) setImagemItem(item.imagem) else setIconCamera(<FontAwesomeIcon color="#e7e4e4" size="2x" icon={faCameraRetro} />) }, [])//eslint-disable-line react-hooks/exhaustive-deps const PrintValidade = () => { let dateAtual = Moment(new Date()).format('DD/MM/YYYY') let data = Moment(new Date(item.dataValidade)).format('DD/MM/YYYY') if (dateAtual === data) return <Box component="span" paddingLeft={2}>Válido até hoje</Box> return <Box component="span" textAlign="right" paddingLeft={2}>Válido até {data}</Box> } return ( <List ref={ref} className={classes.root} > <ListItem alignItems="center" className={classes.ListItem} onClick={() => modal.current.handlerOnOpen()} button component="nav"> <ListItemAvatar className={classes.ListItemAvatar}> <Avatar src={imagemItem} className={classes.largeAvatar} variant="square" alt={item.descricao}> {iconCamera} </Avatar> </ListItemAvatar> <ListItemText primary={ <Box fontSize={15} component="span" textAlign="left" > {truncate(startCase(lowerCase(item.descricao)), { length: 50 })} </Box> } secondary={ <> <Box fontSize={15} component="span" textAlign="left" > {`R$ ${item.precoAtual}`} </Box> <Box component="span"> {PrintValidade} </Box> </> } > </ListItemText> </ListItem> <Divider /> <ModalDetailItem ImagemItem={imagemItem} IconNoImage={iconCamera} item={item} ref={modal} /> </List> ) } export default forwardRef(ProdutoItem)
31.707965
140
0.504326
false
true
false
true
1278c0a5e1544b5e5fd8dcc4df33dce153af9dd3
1,407
jsx
JSX
src/server.jsx
Sawtaytoes/Twitter-Style-App-in-React
bfb7e202ea0661749917691d185e9d1e456c9abb
[ "MIT" ]
1
2017-04-05T15:20:59.000Z
2017-04-05T15:20:59.000Z
src/server.jsx
Sawtaytoes/Twitter-Style-App-in-React
bfb7e202ea0661749917691d185e9d1e456c9abb
[ "MIT" ]
null
null
null
src/server.jsx
Sawtaytoes/Twitter-Style-App-in-React
bfb7e202ea0661749917691d185e9d1e456c9abb
[ "MIT" ]
null
null
null
import React from 'react' import { renderToString } from 'react-dom/server' import { ServerRouter as Router, createServerRenderContext } from 'react-router' import { ApolloProvider as Provider } from 'react-apollo' import { compose, createStore } from 'redux' // Polyfills import 'utilities/polyfills' import { getInitialState } from 'utilities/initial-state' import renderFullPage from 'utilities/render-full-page' // Components import Routes from 'routes' // Actions import { updatePageMeta } from 'ducks/location' // Reducers & Routes import rootReducer from 'reducers' // Utilities import { client } from 'utilities/apollo-client' module.exports = (req, res) => { const context = createServerRenderContext() const result = context.getResult() if (result.redirect) { res.redirect(301, result.redirect.pathname + result.redirect.search) return } const initialState = getInitialState() const store = compose()(createStore)(rootReducer, initialState) const renderedContent = renderToString( <Provider store={store} client={client}> <Router location={req.url} context={context} > <Routes /> </Router> </Provider> ) store.dispatch(updatePageMeta(req.originalUrl)) const renderedPage = renderFullPage(renderedContent, store.getState()) if (result.missed) { res.status(404).send(renderedPage).end() } else { res.status(200).send(renderedPage).end() } }
24.684211
80
0.735608
true
false
false
true
1278c6e6db8cb9bca63086ba18b8221d294b3a7e
1,304
jsx
JSX
web/src/components/__tests__/Button.test.jsx
kpelzel/frigate
d35b09b18fb2fa5c9945f965fde9668e16e78c84
[ "MIT" ]
4,083
2019-02-27T04:07:28.000Z
2022-03-31T23:47:08.000Z
web/src/components/__tests__/Button.test.jsx
kpelzel/frigate
d35b09b18fb2fa5c9945f965fde9668e16e78c84
[ "MIT" ]
1,817
2019-03-06T01:28:33.000Z
2022-03-31T22:04:56.000Z
web/src/components/__tests__/Button.test.jsx
kpelzel/frigate
d35b09b18fb2fa5c9945f965fde9668e16e78c84
[ "MIT" ]
538
2019-02-27T04:07:35.000Z
2022-03-31T23:47:17.000Z
import { h } from 'preact'; import Button from '../Button'; import { render, screen } from '@testing-library/preact'; describe('Button', () => { test('renders children', async () => { render( <Button> <div>hello</div> <div>hi</div> </Button> ); expect(screen.queryByText('hello')).toBeInTheDocument(); expect(screen.queryByText('hi')).toBeInTheDocument(); }); test('includes focus, active, and hover classes when enabled', async () => { render(<Button>click me</Button>); const classList = screen.queryByRole('button').classList; expect(classList.contains('focus:outline-none')).toBe(true); expect(classList.contains('focus:ring-2')).toBe(true); expect(classList.contains('hover:shadow-md')).toBe(true); expect(classList.contains('active:bg-blue-600')).toBe(true); }); test('does not focus, active, and hover classes when enabled', async () => { render(<Button disabled>click me</Button>); const classList = screen.queryByRole('button').classList; expect(classList.contains('focus:outline-none')).toBe(false); expect(classList.contains('focus:ring-2')).toBe(false); expect(classList.contains('hover:shadow-md')).toBe(false); expect(classList.contains('active:bg-blue-600')).toBe(false); }); });
35.243243
78
0.659509
false
true
false
true
1278cbd798e66bc4dc24c2778459d95c4c1364a8
950
jsx
JSX
src/features/metricType/components/MetricRadioButtons.jsx
dudiharush/weather-fetcher-redux
abfd871813a2446267689a06c048e34f218929a7
[ "MIT" ]
null
null
null
src/features/metricType/components/MetricRadioButtons.jsx
dudiharush/weather-fetcher-redux
abfd871813a2446267689a06c048e34f218929a7
[ "MIT" ]
null
null
null
src/features/metricType/components/MetricRadioButtons.jsx
dudiharush/weather-fetcher-redux
abfd871813a2446267689a06c048e34f218929a7
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import { RadioButton } from 'app/components/common'; import { TemperatureUnits } from 'app/services/openWeatherMap/units'; import styles from './MetricRadioButtons.scss'; export const MetricRadioButtons = ({ radioChanged }) => ( <div> <RadioButton text="Celsius" value={TemperatureUnits.celsius} name="temperatureType" className={styles.radioButton} checked onChange={radioChanged} /> <RadioButton text="Fahrenheit" value={TemperatureUnits.fahrenheit} name="temperatureType" className={styles.radioButton} onChange={radioChanged} /> <RadioButton text="Kelvin" value={TemperatureUnits.kelvin} name="temperatureType" className={styles.radioButton} onChange={radioChanged} /> </div> ); MetricRadioButtons.propTypes = { radioChanged: PropTypes.func.isRequired };
25.675676
69
0.681053
false
true
false
true
1278f1934922773d08e5684c83e41030f45e3e6d
274
jsx
JSX
client/src/components/containers/SignInButtons.jsx
pedrofrohmut/ecommerce
327951c77f4fb156e1f3e8a10e8cb53409641af3
[ "MIT" ]
2
2019-07-30T20:23:45.000Z
2019-08-09T13:47:53.000Z
client/src/components/containers/SignInButtons.jsx
pedrofrohmut/ecommerce
327951c77f4fb156e1f3e8a10e8cb53409641af3
[ "MIT" ]
6
2020-09-06T11:01:45.000Z
2022-02-18T05:17:33.000Z
client/src/components/containers/SignInButtons.jsx
pedrofrohmut/ecommerce
327951c77f4fb156e1f3e8a10e8cb53409641af3
[ "MIT" ]
1
2021-07-07T16:27:22.000Z
2021-07-07T16:27:22.000Z
import React from "react" import styled from "styled-components" const SignInButtons = () => ( <SignInButtonsStyled className="SingInButtons"> <h1>Sign In Buttons</h1> </SignInButtonsStyled> ) const SignInButtonsStyled = styled.div`` export default SignInButtons
21.076923
49
0.751825
false
true
false
true
12790c1c45a8fba6eb5c37785e338b5670876172
3,669
jsx
JSX
dapp/src/components/FuseDashboard/pages/Dashboard/index.jsx
ahmednabil310/fuse-studio
0e86eb48a8568b79716f5122191f72670e1e70f0
[ "MIT" ]
24
2019-08-21T12:13:53.000Z
2022-03-03T18:05:01.000Z
dapp/src/components/FuseDashboard/pages/Dashboard/index.jsx
ahmednabil310/fuse-studio
0e86eb48a8568b79716f5122191f72670e1e70f0
[ "MIT" ]
21
2019-09-04T12:05:13.000Z
2022-02-08T23:02:38.000Z
dapp/src/components/FuseDashboard/pages/Dashboard/index.jsx
ahmednabil310/fuse-studio
0e86eb48a8568b79716f5122191f72670e1e70f0
[ "MIT" ]
25
2019-07-31T10:42:07.000Z
2022-03-16T08:19:58.000Z
import React from 'react' import { useParams, withRouter } from 'react-router' import CommunityInfo from 'components/FuseDashboard/components/CommunityInfo' import Bridge from 'components/FuseDashboard/components/Bridge' import Header from 'components/FuseDashboard/components/Header' import { observer } from 'mobx-react' import { useStore } from 'store/mobx' import { push } from 'connected-react-router' import { useDispatch } from 'react-redux' import Plugins from 'images/setup_plugins.svg' import Users from 'images/setup_users.svg' import Wallet from 'images/setup_wallet.svg' function CommunityBanner (props) { const { address } = useParams() const dispatch = useDispatch() const wallet = () => { dispatch(push(`/view/fuse-community/${address}/wallet`)) } const plugins = () => { dispatch(push(`/view/fuse-community/${address}/plugins`)) } const users = () => { dispatch(push(`/view/fuse-community/${address}/users`)) } return ( <div className='banner'> <div className='banner__container'> <div className='title'>Community created successfully!</div> <div className='sub-title'>Continue setting up your community</div> <div className='boxes grid-x align-middle align-justify grid-margin-x'> <div className='item cell large-auto grid-x align-middle align-spaced' onClick={plugins}> <div className='image cell small-6'> <img src={Plugins} /> </div> <div className='content cell large-auto'> <div className='content__title'>Set plug-ins</div> <div className='content__subtitle'>Easily add new functionality to your community</div> </div> </div> <div className='item cell large-auto grid-x align-middle align-spaced' onClick={wallet}> <div className='image cell small-6'> <img src={Wallet} /> </div> <div className='content cell large-auto'> <div className='content__title'>Set up wallet</div> <div className='content__subtitle'>Experience your community on iOS or Android</div> </div> </div> <div className='item cell large-auto grid-x align-middle align-spaced' onClick={users}> <div className='image cell small-6'> <img src={Users} /> </div> <div className='content cell large-auto'> <div className='content__title'>Invite users</div> <div className='content__subtitle'>Manage community members and set permissions</div> </div> </div> </div> </div> </div> ) } const Banner = withRouter(CommunityBanner) function Dashboard (props) { const { dashboard, network } = useStore() const { accountAddress } = network const { success } = useParams() const homeTokenAddress = dashboard?.community?.homeTokenAddress const foreignTokenAddress = dashboard?.community?.foreignTokenAddress const handleConfirmation = () => { dashboard.checkAllowance(accountAddress) dashboard.fetchTokenBalances(accountAddress) dashboard.fetchHomeToken(homeTokenAddress) dashboard.fetchForeignToken(foreignTokenAddress) } return ( <div className='content__wrapper'> <Header withLogo /> { success === 'justCreated' && <Banner /> } <CommunityInfo /> { (dashboard?.community?.bridgeDirection === 'foreign-to-home') && ( <Bridge withTitle onConfirmation={handleConfirmation} /> ) } </div> ) } export default observer(Dashboard)
34.942857
101
0.638866
false
true
false
true
12790ec1a24b60a9214f19d1f4c55001063af74a
1,897
jsx
JSX
awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.jsx
vaibhavjaimini/awx
f37471c858c6c09767945128d16e18474310e9a2
[ "Apache-2.0" ]
17
2021-04-03T01:40:17.000Z
2022-03-03T11:45:20.000Z
awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.jsx
vaibhavjaimini/awx
f37471c858c6c09767945128d16e18474310e9a2
[ "Apache-2.0" ]
24
2021-05-18T21:13:35.000Z
2022-03-29T10:23:52.000Z
awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.jsx
vaibhavjaimini/awx
f37471c858c6c09767945128d16e18474310e9a2
[ "Apache-2.0" ]
24
2020-11-27T08:37:35.000Z
2021-03-08T13:27:15.000Z
import React, { useCallback, useEffect } from 'react'; import { useHistory, useParams } from 'react-router-dom'; import { Card } from '@patternfly/react-core'; import { CardBody } from '../../../components/Card'; import useRequest from '../../../util/useRequest'; import { InventorySourcesAPI } from '../../../api'; import InventorySourceForm from '../shared/InventorySourceForm'; function InventorySourceEdit({ source }) { const history = useHistory(); const { id } = useParams(); const detailsUrl = `/inventories/inventory/${id}/sources/${source.id}/details`; const { error, request, result } = useRequest( useCallback( async values => { const { data } = await InventorySourcesAPI.replace(source.id, values); return data; }, [source.id] ), null ); useEffect(() => { if (result) { history.push(detailsUrl); } }, [result, detailsUrl, history]); const handleSubmit = async form => { const { credential, source_path, source_project, source_script, ...remainingForm } = form; const sourcePath = {}; const sourceProject = {}; if (form.source === 'scm') { sourcePath.source_path = source_path === '/ (project root)' ? '' : source_path; sourceProject.source_project = source_project.id; } await request({ credential: credential?.id || null, inventory: id, source_script: source_script?.id || null, ...sourcePath, ...sourceProject, ...remainingForm, }); }; const handleCancel = () => { history.push(detailsUrl); }; return ( <Card> <CardBody> <InventorySourceForm source={source} onCancel={handleCancel} onSubmit={handleSubmit} submitError={error} /> </CardBody> </Card> ); } export default InventorySourceEdit;
24.636364
81
0.598313
false
true
false
true
12791058b6fad8732f4c286a61fcfa6ad9f6f18e
581
jsx
JSX
src/IssueTable/components/IssueCell.test.jsx
fcostarodrigo/react-coding-problem
c758a4fd2f28452e656a7e2a72b256a71d196075
[ "MIT" ]
null
null
null
src/IssueTable/components/IssueCell.test.jsx
fcostarodrigo/react-coding-problem
c758a4fd2f28452e656a7e2a72b256a71d196075
[ "MIT" ]
null
null
null
src/IssueTable/components/IssueCell.test.jsx
fcostarodrigo/react-coding-problem
c758a4fd2f28452e656a7e2a72b256a71d196075
[ "MIT" ]
null
null
null
import React from "react"; import ReactDOM from "react-dom"; import { Table } from "semantic-ui-react"; import IssueCell from "./IssueCell"; describe("Issue cell", () => { it("should render", () => { const div = document.createElement("div"); ReactDOM.render( <Table> <Table.Body> <Table.Row> <IssueCell href="https://example.com" text="Help it does not work!" /> </Table.Row> </Table.Body> </Table>, div ); ReactDOM.unmountComponentAtNode(div); }); });
23.24
46
0.533563
false
true
false
true
1279107cd4139b1d83c838a524cc035a09479acd
1,698
jsx
JSX
src/components/Home.jsx
loctran15/BookSearch
ffff5125bf60baa3a7c215dadc5424356687454a
[ "MIT" ]
1
2022-01-09T21:59:06.000Z
2022-01-09T21:59:06.000Z
src/components/Home.jsx
loctran15/BookSearch
ffff5125bf60baa3a7c215dadc5424356687454a
[ "MIT" ]
null
null
null
src/components/Home.jsx
loctran15/BookSearch
ffff5125bf60baa3a7c215dadc5424356687454a
[ "MIT" ]
null
null
null
import React from "react"; import Navigation from "./Navigation"; import Footer from "./Footer"; import "../styles/Home.css"; import Button from "react-bootstrap/Button"; import * as filters from "../constants/constants"; export default function Home() { const { GENRES } = filters; return ( <div> <link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet" /> <Navigation></Navigation> <div className="hero"> <div className="hero-text"> <p className="hero-title"> A better way to find your favorite books. </p> <p className="hero-description"> BookZ is the most powerful search engine for Google Books library. BookZ works just like web search. Try a search on BookZ. When we find a book with content that contains a match for your search terms, we'll link to it in your search results. </p> <Button href="/search" variant="light"> Get Started </Button>{" "} </div> </div> <div className="category"> <div className="cate-text"> <p className="cate-title">Browse by Genre</p> <div className="cate-btn"> {GENRES.slice(1).map((genre, i) => ( <Button key={i} href={genre.link} variant="dark" className="genre-btn" value={genre.value} // onClick={} > {genre.name} </Button> ))} </div> </div> </div> <Footer></Footer> </div> ); }
27.836066
78
0.517079
false
true
false
true
127911f53f0973613d5c361888b95b332254e909
1,181
jsx
JSX
src/App.jsx
react-custom-projects/mocha-chai-testing
b5e55269f2a3f610cf7e3e402284fe066263d6d2
[ "MIT" ]
null
null
null
src/App.jsx
react-custom-projects/mocha-chai-testing
b5e55269f2a3f610cf7e3e402284fe066263d6d2
[ "MIT" ]
null
null
null
src/App.jsx
react-custom-projects/mocha-chai-testing
b5e55269f2a3f610cf7e3e402284fe066263d6d2
[ "MIT" ]
null
null
null
import React, { useState } from 'react'; import { hot } from 'react-hot-loader/root'; //error boundary import { ErrorBoundary } from 'react-error-boundary'; //error boundary fallback import ErrorBoundaryFallback from './js/generic/ErrorBoundaryFallback'; //components import CurrentCounter from './js/containers/CurrentCounter'; //helpers import { doDecrement, doIncrement } from './js/constants/Helpers'; const App = () => { const [counter, setCounter] = useState(0); const incrementHandler = () => { setCounter(doIncrement); }; const decrementHandler = () => { setCounter(doDecrement); }; return ( <ErrorBoundary FallbackComponent={ErrorBoundaryFallback} onReset={() => { //Reset the state of your app so the error doesn't happen again console.log('Try again clicked'); }} > <div className="container"> <h1>Counter app</h1> <CurrentCounter counter={counter} /> <button data-test="increment" type="button" onClick={incrementHandler}> Increment </button> <button data-test="decrement" type="button" onClick={decrementHandler}> Decrement </button> </div> </ErrorBoundary> ); }; export default hot(App);
25.673913
75
0.6884
true
false
false
true
127916b3c0519aa030e1f26045259bb98e9c6043
5,407
jsx
JSX
src/components/Layout/Footer.jsx
nanirama/ecrloss
56ce18ec2baf44026fafb2ce42ec9ac684da8dd7
[ "RSA-MD" ]
null
null
null
src/components/Layout/Footer.jsx
nanirama/ecrloss
56ce18ec2baf44026fafb2ce42ec9ac684da8dd7
[ "RSA-MD" ]
null
null
null
src/components/Layout/Footer.jsx
nanirama/ecrloss
56ce18ec2baf44026fafb2ce42ec9ac684da8dd7
[ "RSA-MD" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import { Link, useStaticQuery, graphql } from 'gatsby'; import { linksResolver } from '../../utils/linksResolver'; import styled from "styled-components"; import Arrow from '../../assets/icons/Arrow' const Footer = ({ data }) => { const { footerBody } = data; const result = useStaticQuery(query); const blogs = result.allPrismicBlog.edges.map(({ node }) => node); return ( <Wrapper> <Container> <hr /> <Grid> <Item> {footerBody.map((group) => { const { items } = group; const { label } = group.primary; return ( <FooterLinks> <h4>{label}</h4> <ul> {items.map((item) => { const { label, link_url: linkURL } = item; return ( <li> {linkURL.type ? ( <Link to={ linkURL.document && linkURL.document.uid ? linksResolver(linkURL.document) : linksResolver(linkURL) } > {label} </Link> ) : ( <a href={linkURL.url} target={linkURL.target}> {label} </a> )} </li> ); })} </ul> </FooterLinks> ); })} </Item> <Item> <Heading>Our Latest news</Heading> <Links as="ul"> {blogs.map((blog) => ( <li> <Flex as={Link} to={linksResolver(blog)} > <p> {blog.data.title.text} </p> <Arrow /> </Flex> </li> ))} </Links> <h4>Join Our Mailing List</h4> <Button as="a" variant="primary" href="https://ecr-shrink-group.us17.list-manage.com/subscribe?u=6023bad92de17c3cdf8bb689d&id=fe6105ee15" target="_blank" rel="noopener noreferrer" > Subscribe </Button> </Item> </Grid> <CopyRight> <Link to="/privacy">Privacy</Link> </CopyRight> </Container> </Wrapper> ); }; Footer.propTypes = { data: PropTypes.object.isRequired, }; const query = graphql` query { allPrismicBlog( sort: { fields: last_publication_date, order: DESC } limit: 2 ) { edges { node { uid type data { title { text } category { uid } } } } } } `; export default Footer; const Wrapper = styled.div` `; const Container = styled.div` max-width: 1200px; margin:0 auto; padding:0px; box-sizing: border-box; `; const Grid = styled.div` display: grid; grid-template-columns:1fr; grid-gap: 10px 20px; margin:40px 0 0px 0; @media (min-width: 992px) { grid-template-columns: 6fr 6fr; margin:64px 0 30px 0; } @media (max-width: 991px) { flex-direction: column-reverse; display: flex; padding:16px 16px 32px; } `; const Item = styled.div` `; const Heading = styled.h4` color:#4E50F7; `; const FooterLinks = styled.div` width:44.5%; float:left; padding:0 16px; margin-bottom:30px; @media only screen and (min-width:992px) and (max-width:1200px){ width:43%; } @media (max-width: 991px) { padding:0 8px; } @media (max-width: 599px) { width:100%; margin-bottom:15px; } ul{ list-style: none; padding: 0; margin: 0; } li { margin-bottom:16px; line-height:18px; &:hover a { color:#4E50F7; } } a { font-size: 12px; line-height:20px; color:#D1D1D1; font-weight:bold; text-decoration:none; } `; const Links = styled.ul` list-style: none; padding: 0; margin: 0 0 64px 0; @media only screen and (min-width:992px) and (max-width:1200px){ padding:0 15px 0 0; } @media (max-width: 991px) { margin: 0 0 30px 0; } li { margin-bottom:10px; border-top:1px solid #D1D1D1; padding-top:10px; position:relative; &:last-child{ border-bottom:1px solid #D1D1D1; padding-bottom:16px; } &:hover a{ color:#4E50F7; } } p { font-size: 12px; line-height:20px; color:#D1D1D1; font-weight:300; margin:0; padding-right:40px; } svg{ position:absolute; right:0; top:18px; } `; const Button = styled.a` padding:8px 32px; color:#fff; background-color: #4E50F7; font-size: 16px; line-height:20px; font-weight:400; border:none; text-transform:uppercase; display: inline-block; a{ color:#fff; } @media (max-width: 991px) { margin: 0 0 20px 0; } &:hover{ background-color: #4849C8; } `; const CopyRight = styled.div` text-align:right; margin-bottom:35px; a{ font-size: 12px; line-height:20px; color:#D1D1D1; font-weight:bold; &:hover { color:#4E50F7; } } @media (max-width: 991px) { text-align:center; } `; const items = styled.div` `; const Flex = styled.div` `;
20.637405
118
0.496579
false
true
false
true
12796053da9b20be391b2d49764e621cd23e59c0
464
jsx
JSX
packages/icons-vue/src/icons/CopyFilled.jsx
karzanOnline/ant-design-icons
7817c7c1a001796902f24d36ee68cd9787ea2f34
[ "MIT" ]
null
null
null
packages/icons-vue/src/icons/CopyFilled.jsx
karzanOnline/ant-design-icons
7817c7c1a001796902f24d36ee68cd9787ea2f34
[ "MIT" ]
null
null
null
packages/icons-vue/src/icons/CopyFilled.jsx
karzanOnline/ant-design-icons
7817c7c1a001796902f24d36ee68cd9787ea2f34
[ "MIT" ]
1
2021-07-27T14:32:18.000Z
2021-07-27T14:32:18.000Z
// GENERATE BY ./scripts/generate.js // DON NOT EDIT IT MANUALLY import Icon from '../components/AntdIcon'; import CopyFilledSvg from '@ant-design/icons-svg/lib/asn/CopyFilled'; export default { name: 'IconCopyFilled', displayName: 'CopyFilled', functional: true, props: [ ...Icon.props ], render: (h, { data, children, props }) => h( Icon, { ...data, props: { ...data.props, ...props, icon: CopyFilledSvg } }, children, ), };
25.777778
75
0.62931
false
true
false
true
127965b99603bfd118e19885fca6037156c9f501
456
jsx
JSX
src/app/common/ToolsSidebar.jsx
rokaizen/TesisFront
dcf098c1b77db1c52c1e64988e19dfa72348ed33
[ "MIT" ]
null
null
null
src/app/common/ToolsSidebar.jsx
rokaizen/TesisFront
dcf098c1b77db1c52c1e64988e19dfa72348ed33
[ "MIT" ]
null
null
null
src/app/common/ToolsSidebar.jsx
rokaizen/TesisFront
dcf098c1b77db1c52c1e64988e19dfa72348ed33
[ "MIT" ]
null
null
null
import React from 'react'; import { Sidebar } from 'primereact/sidebar'; import Calculator from "./calculator/Calculator"; const ToolsSidebar = (props) => { return ( <Sidebar visible={props.visible} position="right" onHide={props.onHide} style={{ width: '345px' }}> <h1 className="p-card-title">Herramientas</h1> {props.visible && <Calculator isVisible={props.visible} />} </Sidebar> ); } export default React.memo(ToolsSidebar);
30.4
103
0.684211
false
true
false
true
127978bca58b9b5373e96751626223a6387860c1
8,812
jsx
JSX
docs/js/ButtonDocumentation.jsx
alexkuz/belle
4e25fe4176775c8205869dea0f6aea1de8d4e8ee
[ "BSD-3-Clause" ]
null
null
null
docs/js/ButtonDocumentation.jsx
alexkuz/belle
4e25fe4176775c8205869dea0f6aea1de8d4e8ee
[ "BSD-3-Clause" ]
null
null
null
docs/js/ButtonDocumentation.jsx
alexkuz/belle
4e25fe4176775c8205869dea0f6aea1de8d4e8ee
[ "BSD-3-Clause" ]
null
null
null
import React, {Component} from 'react'; import {Button} from 'belle'; import Code from './Code'; import {propertyNameStyle, propertyDescriptionStyle} from './style'; const basicCodeExample = `<!-- primary button --> <Button primary>Follow</Button> <!-- default button --> <Button>Follow</Button>`; const customStyleCodeExample = `<Button primary={ true } style={{ marginRight: 10, color: '#222', border: '1px solid #222', borderBottom: '1px solid #222', borderRadius: 2, background: '#fff' }} hoverStyle={{ border: '1px solid red', borderBottom: '1px solid red', color: '#red', background: '#fff' }} focusStyle={{ border: '1px solid red', borderBottom: '1px solid red', color: '#red', background: '#fff', boxShadow: 'red 0px 0px 5px' }} activeStyle={{ border: '1px solid red', borderTop: '1px solid red', color: '#000', background: '#fff' }}> Follow </Button>`; const disabledButtonCodeExample = `<Button primary style={ {marginRight: 10} }>Follow</Button> <Button primary disabled style={ {marginRight: 10} }>Follow</Button> <Button style={ {marginRight: 10} }>Follow</Button> <Button disabled>Follow</Button> `; export default class ButtonDocumentation extends Component { render() { return (<div> <h2 style={ {marginTop: 0, marginBottom: 40} }>Button</h2> <Button primary style={ {marginRight: 15} }>Follow</Button> <Button>Follow</Button> <Code value={ basicCodeExample } style={ {marginTop: 40} } /> <p style={{ marginTop: 40 }}> <i>Note:</i> Belle's Button is rendered as normal HTML button and behaves exactly like it except for these behaviours: </p> <ul> <li>By default the button is of type="button" instead of "submit".</li> </ul> <h3>Properties</h3> <table> <tr> <td style={ propertyNameStyle }> primary </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p > <i>Boolean</i> <br /> default: false</p> <p>If true the Button will be appear with the primary button styles</p> </td> </tr> <tr> <td style={ propertyNameStyle }> type </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>String</i> of 'button', 'submit', 'reset' <br /> default: 'buttom' </p> <p> This button by is set to type 'button' by default. This different to the default behavior in HTML where a button would submit in case the 'type' attribute is not defined. </p> </td> </tr> <tr> <td style={ propertyNameStyle }> disabled </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Boolean</i> <br /> default: false</p> <p>If true the Button will be disabled and can't be pressed by a user.</p> </td> </tr> <tr> <td style={ propertyNameStyle }> hoverStyle </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Object</i> <br /> optional </p> <p> Works like React's built-in style property. Becomes active once the user hovers over the button with the cursor. </p> </td> </tr> <tr> <td style={ propertyNameStyle }> focusStyle </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Object</i> <br /> optional </p> <p> Works like React's built-in style property except that it extends the properties from the base style. Becomes active once the button is the element focused in the DOM. </p> </td> </tr> <tr> <td style={ propertyNameStyle }> activeStyle </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Object</i> <br /> optional </p> <p> Works like React's built-in style property except that it extends the properties from the base style. Becomes active once the button is pressed by a user, but yet not release. </p> </td> </tr> <tr> <td style={ propertyNameStyle }> disabledStyle </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Object</i> <br /> optional </p> <p> Works like React's built-in style property except that it extends the properties from the base style. Becomes active once the button is disabled. </p> </td> </tr> <tr> <td style={ propertyNameStyle }> disabledHoverStyle </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Object</i> <br /> optional </p> <p> Works like React's built-in style property except that it extends the properties from the base disabledStyle. Becomes active once the button is disabled and a user hovers over it. </p> </td> </tr> <tr> <td style={ propertyNameStyle }> preventFocusStyleForTouchAndClick </td> </tr> <tr> <td style={ propertyDescriptionStyle }> <p> <i>Boolean</i> <br /> optional (default: true) </p> <p> Prevents the focus style being applied in case the buttons becomes focused by a click or touch.<br /> <b>Background:</b> Focus styles are helpful to identify which element is currently in focus when tabbing through the elements e.g. a user wants to switch to the next input element. Yet it feels somewhat distracting when clicking on the Button. That's why Belle by default prevents the focus style being applied in case the Button is focused on by a touch or click event. </p> </td> </tr> </table> <p> Any other property valid for a HTML button like <span style={ {color: 'grey'} }> style, onClick, …</span> </p> <h3>More Examples</h3> <p>Disabled buttons</p> <Button primary style={ {marginRight: 15} }>Follow</Button> <Button primary disabled style={ {marginRight: 15} }>Follow</Button> <Button style={ {marginRight: 15} }>Follow</Button> <Button disabled>Follow</Button> <Code value={ disabledButtonCodeExample } style={ {marginTop: 20} } /> <p>Primary button with custom styles</p> <Button primary={ true } style={{ marginRight: 10, color: '#222', border: '1px solid #222', borderBottom: '1px solid #222', borderRadius: 2, background: '#fff', boxShadow: 'none' }} hoverStyle={{ border: '1px solid red', borderBottom: '1px solid red', color: 'red', background: '#fff', boxShadow: 'none' }} focusStyle={{ border: '1px solid red', borderBottom: '1px solid red', color: 'red', background: '#fff', boxShadow: 'red 0px 0px 5px' }} activeStyle={{ border: '1px solid red', borderTop: '1px solid red', color: 'red', background: '#fff', boxShadow: 'none' }}> Follow </Button> <Code value={ customStyleCodeExample } style={ {marginTop: 20} } /> </div>); } }
28.153355
126
0.473899
false
true
true
false
12797e256cfbaa0220e31e9b58ea1be100d64b36
126
jsx
JSX
src/Header/components/App.jsx
DongnutLa/Webpack-React-v2
445224f0e2e54f90ccd44c2cc9953ea7dc710269
[ "MIT" ]
null
null
null
src/Header/components/App.jsx
DongnutLa/Webpack-React-v2
445224f0e2e54f90ccd44c2cc9953ea7dc710269
[ "MIT" ]
null
null
null
src/Header/components/App.jsx
DongnutLa/Webpack-React-v2
445224f0e2e54f90ccd44c2cc9953ea7dc710269
[ "MIT" ]
null
null
null
import React from 'react'; const App = () => { return ( <h1>Hola mundo desde Header!</h1> ); }; export default App;
12.6
37
0.587302
false
true
false
true
1279862f062fbce22a4743f21849c0d3bc0dc2b8
539
jsx
JSX
client/src/components/Router/AppRouter.jsx
file-sharing-erp-team/university-ecosystem
148622b5ed14429a947f41e5bb924bb2e7f0474c
[ "MIT" ]
null
null
null
client/src/components/Router/AppRouter.jsx
file-sharing-erp-team/university-ecosystem
148622b5ed14429a947f41e5bb924bb2e7f0474c
[ "MIT" ]
null
null
null
client/src/components/Router/AppRouter.jsx
file-sharing-erp-team/university-ecosystem
148622b5ed14429a947f41e5bb924bb2e7f0474c
[ "MIT" ]
null
null
null
import {Switch, Route, Redirect} from 'react-router-dom' import {noAuthRoutes} from './../../routes' export const AppRouter = () => { return( //? Switch is now working but where is some bugs with Redirecting <Switch> { Object.keys(noAuthRoutes).map(key => { return( <Route key={noAuthRoutes[key].path} path={noAuthRoutes[key].path} component={noAuthRoutes[key].Component} exact /> ) })} </Switch> ) }
31.705882
138
0.523191
false
true
false
true
12798695fd38b0a76ecc46c12c16005baf2ae9e3
4,243
jsx
JSX
Klient/src/Components/API/TestQuestionsApi.jsx
Bohdan-creator/TOPTests
cd769c6bb261b311f47637121a47902528f2b12a
[ "Apache-2.0" ]
null
null
null
Klient/src/Components/API/TestQuestionsApi.jsx
Bohdan-creator/TOPTests
cd769c6bb261b311f47637121a47902528f2b12a
[ "Apache-2.0" ]
null
null
null
Klient/src/Components/API/TestQuestionsApi.jsx
Bohdan-creator/TOPTests
cd769c6bb261b311f47637121a47902528f2b12a
[ "Apache-2.0" ]
null
null
null
import Swal from "sweetalert2" import Api from "./Api"; import axios from 'axios' export default class TestQuestionApi extends Api{ constructor() { super(); } async SendTestQuestions(formData){ try { const res = await this.baseAxios.post("https://localhost:44323/api/testQuestion/"+sessionStorage.getItem("TestId"), formData); console.log(res); Swal.fire({icon: 'success', title: 'You have added test questions', title:'You have added test questions'}); setTimeout(()=>window.location.assign("/showTestModify/"+sessionStorage.getItem("TestId")),1000); } catch (ex) { Swal.fire({icon: 'error', title: 'Some empty fields are empty', title:'Some empty fields are empty'}); } } async fetchTestQuestions(userId) { try { const res = await this.baseAxios.get('https://localhost:44323/api/testQuestion/'+sessionStorage.getItem("TestId")); return res.data; } catch (error) { Swal.fire("Oops...", "You don't have anyone subject", "error"); } } async EditTestQuestion(data){ try { const res = await this.baseAxios.patch('https://localhost:44323/api/testQuestion/'+sessionStorage.getItem("QuestionId"),data); Swal.fire({icon: 'success', title: 'You have edit test question', title:'You have edit test question'}); setTimeout(()=>window.location.assign("/showTestModify/"+sessionStorage.getItem("TestId")),1000); return res.data; } catch (error) { Swal.fire("Oops...", "You don't have anyone subject", "error"); } } async GetTestQuestion(){ try { const res = await this.baseAxios .get('https://localhost:44323/api/testQuestion/getQuestion/'+sessionStorage.getItem("QuestionId")); console.log(res); return res; } catch (error) { Swal.fire("Oops...", "You don't have anyone subject", "error"); } } delete = async (id) => { let api = new Api(); await this.baseAxios.delete('https://localhost:44323/api/testQuestion/'+id) } async DeleteTestQuestion(id){ try { Swal.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then((result) => { if (result.isConfirmed) { this.delete(id) Swal.fire( 'Deleted!', 'Your file has been deleted.', 'success' ) setTimeout(()=>window.location.assign("/showTestModify/"+sessionStorage.getItem("TestId")),1000); } }) } catch (error) { Swal.fire("Oops...", "You don't have anyone subject", "error"); } } async showDeletedQuestions(id){ try { console.log(id); const res = await this.baseAxios.get('https://localhost:44323/api/testQuestion/deletedQuestions/'+id); console.log(res); return res.data; } catch (error) { Swal.fire("Oops...", "Error", "error"); } } async restoreTestQuestion(id){ try{ console.log(id); const res = await this.baseAxios.get('https://localhost:44323/api/testQuestion/restore/'+id); Swal.fire({icon: 'success', title: 'You have restored question', title:'You have restored question'}); }catch(error){ Swal.fire("Oops...", "Question not exist", "error"); } } async registerQuestion(fields){ try{ console.log(fields); const res = await this.baseAxios.post('https://localhost:44323/api/testQuestion/addTestQuestion',fields); Swal.fire({icon: 'success', title: 'You have added test question', title:'You have added test question'}); setTimeout(()=>window.location.assign("/showTestModify/"+sessionStorage.getItem("TestId"))); } catch(error){ Swal.fire({icon: 'error', title: 'Please try again', title:'You have added test question'}); } } }
33.409449
142
0.582842
false
true
false
true
12798711a1e665bc53d209158b76c4438abfbfd7
818
jsx
JSX
src/layouts/Footer.jsx
prvtllc/reportmalpractice
ca1254ff8f9eb557dda5cfb0351e0415db84edc8
[ "MIT" ]
null
null
null
src/layouts/Footer.jsx
prvtllc/reportmalpractice
ca1254ff8f9eb557dda5cfb0351e0415db84edc8
[ "MIT" ]
null
null
null
src/layouts/Footer.jsx
prvtllc/reportmalpractice
ca1254ff8f9eb557dda5cfb0351e0415db84edc8
[ "MIT" ]
null
null
null
import React from 'react'; import styled from '@emotion/styled'; const Wrapper = styled.footer` position: relative; padding-top: 2rem; bottom: 0; box-shadow: ${props => props.theme.shadow.footer}; background: ${props => props.theme.gradient.leftToRight}; font-family: ${props => props.theme.fontFamily.body}; font-weight: 500; @media (max-width: ${props => props.theme.breakpoints.s}) { padding-top: 7rem; } `; const Text = styled.div` margin: 0; padding-bottom: 2rem; text-align: center; color: ${props => props.theme.colors.white.light}; `; const Footer = () => ( <Wrapper> <Text> <span> Report Malpractice -{' '} <a href="https://www.reportmalpractice.com">Fairness and Accountability</a> </span> </Text> </Wrapper> ); export default Footer;
23.371429
83
0.641809
false
true
false
true
1279aa8f3c99de1d2ff06e634ffa9fd8cccefd42
2,309
jsx
JSX
react-components/src/components/Segmentation/Interaction.jsx
uktrade/great-cms
f13fa335ddcb925bc33a5fa096fe73ef7bdd351a
[ "MIT" ]
10
2020-04-30T12:04:35.000Z
2021-07-21T12:48:55.000Z
react-components/src/components/Segmentation/Interaction.jsx
uktrade/great-cms
f13fa335ddcb925bc33a5fa096fe73ef7bdd351a
[ "MIT" ]
1,461
2020-01-23T18:20:26.000Z
2022-03-31T08:05:56.000Z
react-components/src/components/Segmentation/Interaction.jsx
uktrade/great-cms
f13fa335ddcb925bc33a5fa096fe73ef7bdd351a
[ "MIT" ]
3
2020-04-07T20:11:36.000Z
2020-10-16T16:22:59.000Z
import React from 'react' import PropTypes from 'prop-types' import { isArray } from '@src/Helpers' import { Select } from '@src/components/Form/Select' import RadioButtons from './RadioButtons' export default function Interaction(props) { const { question, setValue } = props const choices = isArray(question.choices) ? question.choices : question.choices.options || [] return ( <form className="text-blue-deep-80"> <fieldset className="c-fullwidth"> <legend className="visually-hidden">{question.title}</legend> {question.type === 'RADIO' ? ( <RadioButtons name={question.name} choices={choices} initialSelection={question.answer} valueChange={setValue} /> ) : ( '' )} {question.type in { SELECT: 1, MULTI_SELECT: 1 } ? ( <Select label="" id={`question-${question.id}`} update={(newValue) => setValue(Object.values(newValue)[0])} name={question.name} options={choices} hideLabel multiSelect={question.type === 'MULTI_SELECT'} placeholder={question.choices.placeholder || 'Please choose'} selected={question.answer} /> ) : ( '' )} </fieldset> </form> ) } Interaction.propTypes = { question: PropTypes.shape({ name: PropTypes.string.isRequired, type: PropTypes.string.isRequired, id: PropTypes.number.isRequired, title: PropTypes.string.isRequired, answer: (props, propName, componentName) => { const { propName: data } = props return ( data === null || data === undefined || Array.isArray(data) || typeof data === 'string' ) ? null : new Error(`${componentName}: ${propName} type ${typeof data} is not allowed`) }, choices: PropTypes.oneOfType([ PropTypes.shape({ options: PropTypes.arrayOf( PropTypes.shape({ value: PropTypes.string, }) ), placeHolder: PropTypes.string, }), PropTypes.arrayOf( PropTypes.shape({ value: PropTypes.string, }) ), ]), }).isRequired, setValue: PropTypes.func.isRequired, }
28.506173
94
0.56518
false
true
false
true
1279b0ebccddaf3f41ceb80c7f235ec53a6052eb
528
jsx
JSX
icons/jsx/AssuredWorkload.jsx
openedx/paragon
370b558a906d5f1f451c204a0b1f653feccc24ac
[ "Apache-2.0" ]
5
2022-02-16T17:22:51.000Z
2022-03-29T13:50:03.000Z
icons/jsx/AssuredWorkload.jsx
arizzitano/excalibur
5dc4acfaa731e7d7a4e9f13b492f73891f8ae970
[ "Apache-2.0" ]
196
2022-01-12T19:25:24.000Z
2022-03-31T17:12:27.000Z
icons/jsx/AssuredWorkload.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 SvgAssuredWorkload(props) { return ( <svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} viewBox="0 0 24 24" {...props} > <path d="M5 10h2v7H5zm6 0h2v7h-2zm11-4L12 1 2 6v2h20zM2 19v2h12.4c-.21-.64-.32-1.31-.36-2H2zm17-6.74V10h-2v3.26zM20 14l-4 2v2.55c0 2.52 1.71 4.88 4 5.45 2.29-.57 4-2.93 4-5.45V16l-4-2zm-.72 7l-2.03-2.03 1.06-1.06.97.97 2.41-2.38 1.06 1.06L19.28 21z" /> </svg> ); } export default SvgAssuredWorkload;
29.333333
258
0.61553
false
true
false
true
1279d718ca1a96f4f1831287d00db6f98e942d8c
10,089
jsx
JSX
app/svg/UndrawAppreciation.jsx
needcaffeine/virtualcoffee.io
a4b670587940ccef2877c2bb7e254af9b0b440a4
[ "CC-BY-3.0" ]
null
null
null
app/svg/UndrawAppreciation.jsx
needcaffeine/virtualcoffee.io
a4b670587940ccef2877c2bb7e254af9b0b440a4
[ "CC-BY-3.0" ]
null
null
null
app/svg/UndrawAppreciation.jsx
needcaffeine/virtualcoffee.io
a4b670587940ccef2877c2bb7e254af9b0b440a4
[ "CC-BY-3.0" ]
null
null
null
export default function UndrawIllustration({ ariaHidden, title }) { return ( <svg id="b3c5850d-3d23-4aad-a12c-b5e8440d4fde" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 924 458.12749" {...(ariaHidden ? { 'aria-hidden': 'true', } : { role: 'img', 'aria-labelledby': 'undrawAppreciationSvgTitle', })} > {!ariaHidden && ( <title id="undrawAppreciationSvgTitle"> {title || 'UndrawAppreciation'} </title> )} <ellipse cx="448.17846" cy="584.7146" rx="21.53369" ry="6.76007" transform="translate(-396.01217 573.65899) rotate(-69.08217)" fill="#2f2e41" /> <circle cx="408.37125" cy="617.2367" r="43.06735" transform="translate(-404.30923 700.52813) rotate(-80.78252)" fill="#2f2e41" /> <rect x="250.74566" y="430.10005" width="13.08374" height="23.44171" fill="#2f2e41" /> <rect x="276.91314" y="430.10005" width="13.08374" height="23.44171" fill="#2f2e41" /> <ellipse cx="261.6488" cy="453.81434" rx="10.90314" ry="4.08868" fill="#2f2e41" /> <ellipse cx="287.81628" cy="453.26918" rx="10.90314" ry="4.08868" fill="#2f2e41" /> <circle cx="409.4616" cy="606.33348" r="14.71922" transform="translate(-155.63358 -208.64722) rotate(-1.68323)" fill="#fff" /> <circle cx="271.4616" cy="385.39723" r="4.90643" fill="#3f3d56" /> <path d="M366.59454,577.1852c-3.47748-15.57379,7.63867-31.31043,24.82861-35.1488s33.94423,5.67511,37.42171,21.24884-7.91492,21.31762-25.10486,25.156S370.072,592.75905,366.59454,577.1852Z" transform="translate(-138 -220.93625)" fill="#e6e6e6" /> <ellipse cx="359.86311" cy="597.25319" rx="6.76007" ry="21.53369" transform="translate(-471.98369 445.52283) rotate(-64.62574)" fill="#2f2e41" /> <path d="M387.21673,632.77358c0,4.21515,10.85327,12.53857,22.89656,12.53857s23.33515-11.867,23.33515-16.08209-11.29193.81775-23.33515.81775S387.21673,628.55843,387.21673,632.77358Z" transform="translate(-138 -220.93625)" fill="#fff" /> <path d="M711.25977,500.2,664.48,546.37,558.75977,650.69l-2.13965,2.11L544.7002,664.56,519.71,639.87l-2.20019-2.17-45.69-45.13h-.00976L457.16992,578.1l-8.6499-8.55-25.76025-25.44-3.4795-3.44-41.06006-40.56a117.65792,117.65792,0,0,1-20.52-27.63c-.5-.91-.97022-1.83-1.43018-2.75A117.50682,117.50682,0,0,1,480.98,301.2h.01025c.37989.06.75.12,1.12989.2a113.60526,113.60526,0,0,1,11.91015,2.77A117.09292,117.09292,0,0,1,523.1499,317.1q1.4253.885,2.82031,1.8a118.17183,118.17183,0,0,1,18.46973,15.09l.3501-.35.3501.35a118.54248,118.54248,0,0,1,10.83007-9.58c.82959-.65,1.66993-1.29,2.50977-1.91a117.44922,117.44922,0,0,1,90.51025-21.06,111.92113,111.92113,0,0,1,11.91993,2.78q1.96507.55509,3.8999,1.2c1.04.34,2.08008.69,3.10986,1.07a116.42525,116.42525,0,0,1,24.39014,12.1q2.50488,1.63494,4.93994,3.42A117.54672,117.54672,0,0,1,711.25977,500.2Z" transform="translate(-138 -220.93625)" fill="#d9376e" /> <path d="M664.48,546.37,558.75977,650.69l-2.13965,2.11L544.7002,664.56,519.71,639.87l-2.20019-2.17-45.69-45.13c7.34034-1.71,18.62012.64,22.75,2.68,9.79,4.83,17.84034,12.76,27.78028,17.28A46.138,46.138,0,0,0,550.68018,615.66c17.81982-3.74,31.60986-17.52,43.77-31.08,12.15966-13.57,24.58984-28.13,41.67968-34.42C645.14014,546.84,654.81982,546.09,664.48,546.37Z" transform="translate(-138 -220.93625)" opacity="0.15" /> <path d="M741.33984,335.92a118.15747,118.15747,0,0,0-52.52978-30.55c-1.31983-.37-2.62988-.7-3.96-1.01A116.83094,116.83094,0,0,0,667.46,301.57c-1.02-.1-2.04-.17-3.06982-.22a115.15486,115.15486,0,0,0-15.43018.06,118.39675,118.39675,0,0,0-74.83984,33.45l-.36035-.36-.35987.36a118.61442,118.61442,0,0,0-46.6997-28.08c-.99024-.32-1.99024-.63-2.99024-.92a119.67335,119.67335,0,0,0-41.62012-4.45c-.38964.02-.77978.05-1.15966.09a118.30611,118.30611,0,0,0-69.39991,29.4c-1.82031,1.6-3.61035,3.28-5.35009,5.02A119.14261,119.14261,0,0,0,379.54,463.47c.3501.94.73,1.87006,1.12988,2.8a118.153,118.153,0,0,0,25.51026,37.95l38.91992,38.42,3.06006,3.03,84.21972,83.13,2.16992,2.15,22.12012,21.84,17.08985,16.87L741.33984,504.21A119.129,119.129,0,0,0,741.33984,335.92ZM739.23,502.08,573.75977,665.44l-14.94971-14.76-21.6499-21.37-2.16993-2.14-82.58007-81.53-3.01026-2.97L408.2998,502.09A115.19343,115.19343,0,0,1,383.54,465.37c-.3999-.93-.78027-1.86-1.12988-2.79A116.13377,116.13377,0,0,1,408.2998,338.04q2.79054-2.79,5.71-5.34H414.02a115.38082,115.38082,0,0,1,66.48-28.16q4.905-.42,9.81982-.42c1.23,0,2.4502.02,3.68018.06a116.0993,116.0993,0,0,1,29.6499,4.8c.99024.29,1.98.6,2.96.93a114.15644,114.15644,0,0,1,29.33008,14.49,115.61419,115.61419,0,0,1,16.41016,13.64l1.06006,1.06.34961-.35.35009.35,1.06006-1.06a115.674,115.674,0,0,1,85.71-33.86c1.27.04,2.54.1,3.81006.19,1.02.06,2.04.13,3.05029.23a115.12349,115.12349,0,0,1,19.08985,3.35c1.33984.34,2.66992.71,3.98974,1.12A115.9591,115.9591,0,0,1,739.23,502.08Z" transform="translate(-138 -220.93625)" fill="#3f3d56" /> <path d="M506.87988,308.71c-6.41992,5.07-13.31006,9.75-17.48,16.68-3.06982,5.12-4.3999,11.07-5.39013,16.95-1.91993,11.44-2.73975,23.16-6.5,34.12994-3.75,10.97-11.06983,21.45-21.91993,25.54-6.73,2.53-14.1499,2.39-21.31982,1.9-17.68994-1.2-35.5-4.37-51.41992-12.16-8.8999-4.36-17.53028-10.24-27.41992-10.89a25.39538,25.39538,0,0,0-6.02.33A117.494,117.494,0,0,1,480.98,301.2h.01025c.37989.06.75.12,1.12989.2a113.60526,113.60526,0,0,1,11.91015,2.77A117.48205,117.48205,0,0,1,506.87988,308.71Z" transform="translate(-138 -220.93625)" opacity="0.15" /> <path d="M224.76412,625.76982a28.74835,28.74835,0,0,0,27.7608-4.89018c9.72337-8.16107,12.77191-21.60637,15.25242-34.056L275.11419,550l-15.36046,10.57663c-11.04633,7.60609-22.34151,15.45585-29.99,26.47289s-10.987,26.0563-4.8417,37.97726Z" transform="translate(-138 -220.93625)" fill="#e6e6e6" /> <path d="M226.07713,670.35248c-1.55468-11.32437-3.15331-22.7942-2.06278-34.24.96851-10.16505,4.06971-20.09347,10.38337-28.23408a46.968,46.968,0,0,1,12.0503-10.9196c1.205-.76061,2.31413,1.14911,1.11434,1.90641a44.6513,44.6513,0,0,0-17.66194,21.31042c-3.84525,9.78036-4.46274,20.44179-3.80011,30.83136.40072,6.283,1.25,12.52474,2.1058,18.75851a1.14389,1.14389,0,0,1-.771,1.358,1.11066,1.11066,0,0,1-1.358-.771Z" transform="translate(-138 -220.93625)" fill="#f2f2f2" /> <path d="M241.05156,650.3137a21.16242,21.16242,0,0,0,18.439,9.51679c9.33414-.4431,17.11583-6.95774,24.12082-13.14262l20.71936-18.29363L290.618,627.738c-9.86142-.47193-19.97725-.91214-29.36992,2.12894s-18.05507,10.35987-19.77258,20.082Z" transform="translate(-138 -220.93625)" fill="#e6e6e6" /> <path d="M221.68349,676.86232c7.48292-13.24055,16.16246-27.95592,31.67134-32.65919a35.34188,35.34188,0,0,1,13.32146-1.37546c1.41435.12195,1.06117,2.30212-.3506,2.18039a32.83346,32.83346,0,0,0-21.259,5.62435c-5.99423,4.0801-10.66138,9.75253-14.61162,15.76788-2.41964,3.68458-4.587,7.52548-6.75478,11.36122-.69277,1.22582-2.7177.341-2.01683-.89919Z" transform="translate(-138 -220.93625)" fill="#f2f2f2" /> <circle cx="300.09051" cy="76.05079" r="43.06733" fill="#2f2e41" /> <rect x="280.4649" y="109.85048" width="13.08374" height="23.44171" fill="#2f2e41" /> <rect x="306.63238" y="109.85048" width="13.08374" height="23.44171" fill="#2f2e41" /> <ellipse cx="291.36798" cy="133.56477" rx="10.90314" ry="4.08868" fill="#2f2e41" /> <ellipse cx="317.53552" cy="133.0196" rx="10.90314" ry="4.08868" fill="#2f2e41" /> <circle cx="301.18084" cy="65.14766" r="14.71923" fill="#fff" /> <ellipse cx="444.18084" cy="289.08391" rx="4.88594" ry="4.92055" transform="translate(-212.34041 177.70056) rotate(-44.98705)" fill="#3f3d56" /> <path d="M396.31372,256.93569c-3.47748-15.57379,7.63865-31.31043,24.82866-35.14881s33.94421,5.67511,37.42169,21.24891-7.91492,21.31768-25.10486,25.156S399.79126,272.50954,396.31372,256.93569Z" transform="translate(-138 -220.93625)" fill="#e6e6e6" /> <ellipse cx="770.70947" cy="573.81404" rx="6.76007" ry="21.53369" transform="translate(-326.96946 400.5432) rotate(-39.51212)" fill="#2f2e41" /> <circle cx="808.20127" cy="616.79758" r="43.06735" transform="translate(-226.36415 -83.51221) rotate(-9.21748)" fill="#2f2e41" /> <rect x="676.74319" y="429.66089" width="13.08374" height="23.44171" fill="#2f2e41" /> <rect x="650.5757" y="429.66089" width="13.08374" height="23.44171" fill="#2f2e41" /> <ellipse cx="678.92379" cy="453.37519" rx="10.90314" ry="4.08868" fill="#2f2e41" /> <ellipse cx="652.75631" cy="452.83005" rx="10.90314" ry="4.08868" fill="#2f2e41" /> <path d="M823.27982,593.8192c-13.57764-11.21939-21.12423-21.50665-10.95965-33.80776s29.41145-13.178,42.98908-1.9586,16.34444,30.28655,6.17986,42.58766S836.85746,605.03859,823.27982,593.8192Z" transform="translate(-138 -220.93625)" fill="#d9376e" /> <circle cx="793.31102" cy="594.44957" r="14.71922" transform="translate(-155.11887 -197.37727) rotate(-1.68323)" fill="#fff" /> <circle cx="650.1378" cy="369.86765" r="4.90643" fill="#3f3d56" /> <path d="M771.06281,606.5725c-2.98056,2.98056-5.08788,12.64434-.89538,16.83684s16.51464-.26783,19.49516-3.24834-4.50917-3.35271-8.70164-7.54518S774.04337,603.59194,771.06281,606.5725Z" transform="translate(-138 -220.93625)" fill="#fff" /> <ellipse cx="841.39416" cy="654.27547" rx="6.76007" ry="21.53369" transform="translate(-316.14156 122.58618) rotate(-20.9178)" fill="#2f2e41" /> <path d="M1061,679.06375H139a1,1,0,0,1,0-2h922a1,1,0,0,1,0,2Z" transform="translate(-138 -220.93625)" fill="#ccc" /> </svg> ); }
40.195219
1,493
0.647834
true
false
false
true
1279dde1221b00049cbb798e70af1461269a1f0d
3,183
jsx
JSX
packages/terra-brand-footer/src/terra-dev-site/test/brand-footer/ManySectionsBrandFooter.test.jsx
Chris-Boyle/terra-framework
cb6dacdc64619ffeae6ff64a76ee427c8ba17b0d
[ "Apache-2.0" ]
null
null
null
packages/terra-brand-footer/src/terra-dev-site/test/brand-footer/ManySectionsBrandFooter.test.jsx
Chris-Boyle/terra-framework
cb6dacdc64619ffeae6ff64a76ee427c8ba17b0d
[ "Apache-2.0" ]
null
null
null
packages/terra-brand-footer/src/terra-dev-site/test/brand-footer/ManySectionsBrandFooter.test.jsx
Chris-Boyle/terra-framework
cb6dacdc64619ffeae6ff64a76ee427c8ba17b0d
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import BrandFooter from '../../../BrandFooter'; export default () => ( <BrandFooter isVertical sections={[ { headerText: 'Links', links: [ { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homea' }, { text: 'Cerner', href: 'https://www.cerner.com/a', target: '_blank' }, { text: 'Cerner', href: 'https://www.cerner.com/b', target: '_blank' }, { text: 'Cerner', href: 'https://www.cerner.com/c', target: '_blank' }, { text: 'Cerner', href: 'https://www.cerner.com/d', target: '_blank' }, ], }, { headerText: 'More Links', links: [ { text: 'Cerner Engineering', href: 'https://engineering.cerner.com/a' }, { text: 'Cerner Engineering', href: 'https://engineering.cerner.com/b' }, { text: 'Cerner Engineering', href: 'https://engineering.cerner.com/c' }, { text: 'Cerner Engineering', href: 'https://engineering.cerner.com/d' }, { text: 'Cerner Engineering', href: 'https://engineering.cerner.com/e' }, ], }, { headerText: 'Extra Links', links: [ { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homeb' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homec' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homed' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homee' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homef' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homeg' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homeh' }, ], }, { links: [ { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homea' }, { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homeb' }, { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homec' }, { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homed' }, ], }, { links: [ { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homea' }, { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homeb' }, { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homec' }, { text: 'No Header', href: 'http://terra-ui.com/static/#/site/homed' }, ], }, { headerText: 'Extra Links', links: [ { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homeb' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homec' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homed' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homee' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homef' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homeg' }, { text: 'Terra UI', href: 'http://terra-ui.com/static/#/site/homeh' }, ], }, ]} /> );
44.208333
83
0.518065
false
true
false
true
1279f4d22ed2e48b59eb3c85d2a2e210f55c18b4
15,910
jsx
JSX
web/react/components/admin_console/admin_sidebar.jsx
malteo/mattermost-platform
e24849efa8e2d2acee5bdb220763c34ac70682bd
[ "Apache-2.0" ]
null
null
null
web/react/components/admin_console/admin_sidebar.jsx
malteo/mattermost-platform
e24849efa8e2d2acee5bdb220763c34ac70682bd
[ "Apache-2.0" ]
null
null
null
web/react/components/admin_console/admin_sidebar.jsx
malteo/mattermost-platform
e24849efa8e2d2acee5bdb220763c34ac70682bd
[ "Apache-2.0" ]
null
null
null
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import AdminSidebarHeader from './admin_sidebar_header.jsx'; import SelectTeamModal from './select_team_modal.jsx'; import * as Utils from '../../utils/utils.jsx'; const Tooltip = ReactBootstrap.Tooltip; const OverlayTrigger = ReactBootstrap.OverlayTrigger; export default class AdminSidebar extends React.Component { constructor(props) { super(props); this.isSelected = this.isSelected.bind(this); this.handleClick = this.handleClick.bind(this); this.removeTeam = this.removeTeam.bind(this); this.showTeamSelect = this.showTeamSelect.bind(this); this.teamSelectedModal = this.teamSelectedModal.bind(this); this.teamSelectedModalDismissed = this.teamSelectedModalDismissed.bind(this); this.state = { showSelectModal: false }; } handleClick(name, teamId, e) { e.preventDefault(); this.props.selectTab(name, teamId); var tokenIndex = Utils.getUrlParameter('session_token_index'); history.pushState({name, teamId}, null, `/admin_console/${name}/${teamId || ''}?session_token_index=${tokenIndex}`); } isSelected(name, teamId) { if (this.props.selected === name) { if (name === 'team_users' || name === 'team_analytics') { if (this.props.selectedTeam != null && this.props.selectedTeam === teamId) { return 'active'; } } else { return 'active'; } } return ''; } removeTeam(teamId, e) { e.preventDefault(); Reflect.deleteProperty(this.props.selectedTeams, teamId); this.props.removeSelectedTeam(teamId); if (this.props.selected === 'team_users') { if (this.props.selectedTeam != null && this.props.selectedTeam === teamId) { this.props.selectTab('service_settings', null); } } } componentDidMount() { if ($(window).width() > 768) { $('.nav-pills__container').perfectScrollbar(); } } showTeamSelect(e) { e.preventDefault(); this.setState({showSelectModal: true}); } teamSelectedModal(teamId) { this.props.selectedTeams[teamId] = 'true'; this.setState({showSelectModal: false}); this.props.addSelectedTeam(teamId); this.forceUpdate(); } teamSelectedModalDismissed() { this.setState({showSelectModal: false}); } render() { var count = '*'; var teams = 'Loading'; const removeTooltip = ( <Tooltip id='remove-team-tooltip'>{'Remove team from sidebar menu'}</Tooltip> ); const addTeamTooltip = ( <Tooltip id='add-team-tooltip'>{'Add team from sidebar menu'}</Tooltip> ); if (this.props.teams != null) { count = '' + Object.keys(this.props.teams).length; teams = []; for (var key in this.props.selectedTeams) { if (this.props.selectedTeams.hasOwnProperty(key)) { var team = this.props.teams[key]; if (team != null) { teams.push( <ul key={'team_' + team.id} className='nav nav__sub-menu' > <li> <a href='#' onClick={this.handleClick.bind(this, 'team_users', team.id)} className={'nav__sub-menu-item ' + this.isSelected('team_users', team.id) + ' ' + this.isSelected('team_analytics', team.id)} > {team.name} <OverlayTrigger delayShow={1000} placement='top' overlay={removeTooltip} > <span className='menu-icon--right menu__close' onClick={this.removeTeam.bind(this, team.id)} style={{cursor: 'pointer'}} > {'×'} </span> </OverlayTrigger> </a> </li> <li> <ul className='nav nav__inner-menu'> <li> <a href='#' className={this.isSelected('team_users', team.id)} onClick={this.handleClick.bind(this, 'team_users', team.id)} > {'- Users'} </a> </li> <li> <a href='#' className={this.isSelected('team_analytics', team.id)} onClick={this.handleClick.bind(this, 'team_analytics', team.id)} > {'- Statistics'} </a> </li> </ul> </li> </ul> ); } } } } return ( <div className='sidebar--left sidebar--collapsable'> <div> <AdminSidebarHeader /> <div className='nav-pills__container'> <ul className='nav nav-pills nav-stacked'> <li> <ul className='nav nav__sub-menu'> <li> <h4> <span className='icon fa fa-gear'></span> <span>{'SETTINGS'}</span> </h4> </li> </ul> <ul className='nav nav__sub-menu padded'> <li> <a href='#' className={this.isSelected('service_settings')} onClick={this.handleClick.bind(this, 'service_settings', null)} > {'Service Settings'} </a> </li> <li> <a href='#' className={this.isSelected('team_settings')} onClick={this.handleClick.bind(this, 'team_settings', null)} > {'Team Settings'} </a> </li> <li> <a href='#' className={this.isSelected('sql_settings')} onClick={this.handleClick.bind(this, 'sql_settings', null)} > {'SQL Settings'} </a> </li> <li> <a href='#' className={this.isSelected('email_settings')} onClick={this.handleClick.bind(this, 'email_settings', null)} > {'Email Settings'} </a> </li> <li> <a href='#' className={this.isSelected('image_settings')} onClick={this.handleClick.bind(this, 'image_settings', null)} > {'File Settings'} </a> </li> <li> <a href='#' className={this.isSelected('log_settings')} onClick={this.handleClick.bind(this, 'log_settings', null)} > {'Log Settings'} </a> </li> <li> <a href='#' className={this.isSelected('rate_settings')} onClick={this.handleClick.bind(this, 'rate_settings', null)} > {'Rate Limit Settings'} </a> </li> <li> <a href='#' className={this.isSelected('privacy_settings')} onClick={this.handleClick.bind(this, 'privacy_settings', null)} > {'Privacy Settings'} </a> </li> <li> <a href='#' className={this.isSelected('gitlab_settings')} onClick={this.handleClick.bind(this, 'gitlab_settings', null)} > {'GitLab Settings'} </a> </li> <li> <a href='#' className={this.isSelected('legal_and_support_settings')} onClick={this.handleClick.bind(this, 'legal_and_support_settings', null)} > {'Legal and Support Settings'} </a> </li> </ul> <ul className='nav nav__sub-menu'> <li> <h4> <span className='icon fa fa-gear'></span> <span>{'TEAMS (' + count + ')'}</span> <span className='menu-icon--right'> <OverlayTrigger delayShow={1000} placement='top' overlay={addTeamTooltip} > <a href='#' onClick={this.showTeamSelect} > <i className='fa fa-plus' ></i> </a> </OverlayTrigger> </span> </h4> </li> </ul> <ul className='nav nav__sub-menu padded'> <li> {teams} </li> </ul> <ul className='nav nav__sub-menu'> <li> <h4> <span className='icon fa fa-gear'></span> <span>{'OTHER'}</span> </h4> </li> </ul> <ul className='nav nav__sub-menu padded'> <li> <a href='#' className={this.isSelected('logs')} onClick={this.handleClick.bind(this, 'logs', null)} > {'Logs'} </a> </li> </ul> </li> </ul> </div> </div> <SelectTeamModal teams={this.props.teams} show={this.state.showSelectModal} onModalSubmit={this.teamSelectedModal} onModalDismissed={this.teamSelectedModalDismissed} /> </div> ); } } AdminSidebar.propTypes = { teams: React.PropTypes.object, selectedTeams: React.PropTypes.object, removeSelectedTeam: React.PropTypes.func, addSelectedTeam: React.PropTypes.func, selected: React.PropTypes.string, selectedTeam: React.PropTypes.string, selectTab: React.PropTypes.func };
47.071006
165
0.29956
false
true
true
false
127a0bf263bb9bdd80f2cd50303da8cee0e9e059
1,792
jsx
JSX
src/pages/checkout/checkout.component.jsx
bahadirkorumaz/e-commerce-web-application
0557e96c56b213b739a1854d3c23ed0a5f37a5bb
[ "MIT" ]
1
2020-04-26T02:18:43.000Z
2020-04-26T02:18:43.000Z
src/pages/checkout/checkout.component.jsx
bahadirkorumaz/e-commerce-web-application
0557e96c56b213b739a1854d3c23ed0a5f37a5bb
[ "MIT" ]
null
null
null
src/pages/checkout/checkout.component.jsx
bahadirkorumaz/e-commerce-web-application
0557e96c56b213b739a1854d3c23ed0a5f37a5bb
[ "MIT" ]
null
null
null
import React from "react"; import { useSelector } from "react-redux"; import { selectCartTotalPrice, selectCartItems, } from "../../redux/cart/cart.selectors"; import CheckoutItem from "../../components/checkout-item/checkout-item.component"; import StripeCheckoutButton from "../../components/stripe-button/stripe-button.component"; import { CheckoutPageContainer, CheckoutHeaderContainer, CheckoutHeaderBlockContainer, TotalContainer, WarningContainer, } from "./checkout.styles"; function CheckoutPage() { const totalPrice = useSelector((state) => selectCartTotalPrice(state)); const cartItems = useSelector((state) => selectCartItems(state)); return ( <CheckoutPageContainer> <CheckoutHeaderContainer> <CheckoutHeaderBlockContainer> <span>Product</span> </CheckoutHeaderBlockContainer> <CheckoutHeaderBlockContainer> <span>Description</span> </CheckoutHeaderBlockContainer> <CheckoutHeaderBlockContainer> <span>Quantity</span> </CheckoutHeaderBlockContainer> <CheckoutHeaderBlockContainer> <span>Price</span> </CheckoutHeaderBlockContainer> <CheckoutHeaderBlockContainer> <span>Remove</span> </CheckoutHeaderBlockContainer> </CheckoutHeaderContainer> {cartItems.map((cartItem) => ( <CheckoutItem key={cartItem.id} cartItem={cartItem} /> ))} <TotalContainer>TOTAL: ${totalPrice}</TotalContainer> <WarningContainer> *Please use the following test credit card for payments* <br /> 4242 4242 4242 4242 - Exp: 01/23 - CVV: 123 </WarningContainer> <StripeCheckoutButton price={totalPrice} /> </CheckoutPageContainer> ); } export default CheckoutPage;
32.581818
90
0.6875
false
true
false
true
127a0cc268eebdc781c02a274de7918c3161da2a
330
jsx
JSX
tests/js/spec/components/textCopyInput.spec.jsx
Zhao017/sentry
8e9f0d895aec9e0ae0d6864387760944996442c4
[ "BSD-3-Clause" ]
2
2019-03-04T12:45:54.000Z
2019-03-04T12:45:55.000Z
tests/js/spec/components/textCopyInput.spec.jsx
Zhao017/sentry
8e9f0d895aec9e0ae0d6864387760944996442c4
[ "BSD-3-Clause" ]
196
2019-06-10T08:34:10.000Z
2022-02-22T01:26:13.000Z
tests/js/spec/components/textCopyInput.spec.jsx
Zhao017/sentry
8e9f0d895aec9e0ae0d6864387760944996442c4
[ "BSD-3-Clause" ]
1
2017-02-09T06:36:57.000Z
2017-02-09T06:36:57.000Z
import React from 'react'; import {shallow} from 'enzyme'; import TextCopyInput from 'app/views/settings/components/forms/textCopyInput'; describe('TextCopyInput', function() { it('renders', function() { const wrapper = shallow(<TextCopyInput>Text to Copy</TextCopyInput>); expect(wrapper).toMatchSnapshot(); }); });
30
78
0.724242
false
true
false
true
127a1079a9510a83ccf7e4581a88fb91f435cb34
2,150
jsx
JSX
src/react/components/list-button.jsx
casson/Framework7
4075c2072d4f1344379b5064a2e5f52639c4837c
[ "MIT" ]
6,618
2017-12-07T15:43:26.000Z
2022-03-31T17:31:53.000Z
src/react/components/list-button.jsx
casson/Framework7
4075c2072d4f1344379b5064a2e5f52639c4837c
[ "MIT" ]
3,450
2017-12-07T15:09:36.000Z
2022-03-30T22:39:05.000Z
src/react/components/list-button.jsx
casson/Framework7
4075c2072d4f1344379b5064a2e5f52639c4837c
[ "MIT" ]
1,536
2017-12-07T21:01:32.000Z
2022-03-22T12:46:02.000Z
import React, { forwardRef, useRef, useImperativeHandle } from 'react'; import { classNames, getExtraAttrs, isStringProp, emit } from '../shared/utils'; import { colorClasses, actionsAttrs, actionsClasses, routerAttrs, routerClasses, } from '../shared/mixins'; import { useTooltip } from '../shared/use-tooltip'; import { useRouteProps } from '../shared/use-route-props'; /* dts-props id?: string | number; className?: string; style?: React.CSSProperties; title? : string | number text? : string | number tabLink? : boolean | string tabLinkActive? : boolean link? : boolean | string href? : boolean | string target? : string tooltip? : string tooltipTrigger? : string COLOR_PROPS ROUTER_PROPS ACTIONS_PROPS onClick? : (event?: any) => void ref?: React.MutableRefObject<{el: HTMLElement | null}>; */ const ListButton = forwardRef((props, ref) => { const { className, id, style, children, title, text, tabLink, tabLinkActive, link, href, target, } = props; const extraAttrs = getExtraAttrs(props); const elRef = useRef(null); const linkElRef = useRef(null); const onClick = (e) => { emit(props, 'click', e); }; useImperativeHandle(ref, () => ({ el: elRef.current, })); useTooltip(linkElRef, props); useRouteProps(linkElRef, props); const linkAttrs = { href: typeof link === 'boolean' && typeof href === 'boolean' ? '#' : link || href, target, 'data-tab': isStringProp(tabLink) && tabLink, ...routerAttrs(props), ...actionsAttrs(props), }; const linkClasses = classNames({ 'list-button': true, 'tab-link': tabLink || tabLink === '', 'tab-link-active': tabLinkActive, ...colorClasses(props), ...routerClasses(props), ...actionsClasses(props), }); return ( <li id={id} style={style} className={className} ref={elRef} {...extraAttrs}> <a className={linkClasses} {...linkAttrs} onClick={onClick} ref={linkElRef}> {title} {text} {children} </a> </li> ); }); ListButton.displayName = 'f7-list-button'; export default ListButton;
22.631579
86
0.627907
false
true
false
true
127a1ecc68210a0e07bb55ab816adb58372a6429
5,671
jsx
JSX
condenser/src/app/components/elements/PasswordInput.jsx
scr53005/eftg-steem
93a98cf228e83d424cc15f9d54a99be9c98d8331
[ "Apache-2.0" ]
8
2018-06-24T12:47:45.000Z
2019-04-26T07:24:05.000Z
condenser/src/app/components/elements/PasswordInput.jsx
scr53005/eftg-steem
93a98cf228e83d424cc15f9d54a99be9c98d8331
[ "Apache-2.0" ]
2
2018-07-09T09:44:50.000Z
2018-10-08T14:12:11.000Z
condenser/src/app/components/elements/PasswordInput.jsx
scr53005/eftg-steem
93a98cf228e83d424cc15f9d54a99be9c98d8331
[ "Apache-2.0" ]
4
2018-07-24T15:47:37.000Z
2022-03-06T08:45:30.000Z
import React from 'react'; import PropTypes from 'prop-types'; import tt from 'counterpart'; function validatePassword(value, new_password) { if (!new_password) return ''; const length = 32; return value && value.length < length ? tt('g.password_must_be_characters_or_more', { amount: length }) : ''; } export default class PasswordInput extends React.Component { static propTypes = { inputNewPassword: PropTypes.bool, inputConfirmPassword: PropTypes.bool, disabled: PropTypes.bool, onChange: PropTypes.func.isRequired, passwordLabel: PropTypes.string.isRequired, }; constructor(props) { super(props); const passwd = { value: '', error: '' }; this.state = { oldPassword: passwd, newPassword: passwd, confirmPassword: passwd, }; this.oldPasswordChange = this.oldPasswordChange.bind(this); this.newPasswordChange = this.newPasswordChange.bind(this); this.confirmPasswordChange = this.confirmPasswordChange.bind(this); } validatePasswords(oldPassword, newPassword, confirmPassword) { let valid = oldPassword.value.length > 0 && oldPassword.error === ''; if (this.props.inputNewPassword) { valid = valid && newPassword.value.length > 0 && newPassword.error === ''; } if (this.props.inputConfirmPassword) { valid = valid && confirmPassword.value === newPassword.value; } return valid; } onChange(value) { let { oldPassword, newPassword, confirmPassword } = this.state; if (value.oldPassword) oldPassword = value.oldPassword; if (value.newPassword) newPassword = value.newPassword; if (value.confirmPassword) confirmPassword = value.confirmPassword; const res = { oldPassword: oldPassword.value, newPassword: newPassword.value, confirmPassword: confirmPassword.value, }; res.valid = this.validatePasswords( oldPassword, newPassword, confirmPassword ); this.props.onChange(res); } oldPasswordChange(e) { const value = e.target.value.trim(); const error = validatePassword(value, false); const res = { oldPassword: { value, error } }; this.setState(res); this.onChange(res); } newPasswordChange(e) { const value = e.target.value.trim(); const error = validatePassword(value, true); const res = { newPassword: { value, error } }; if (value !== this.state.confirmPassword.value) { res.confirmPassword = this.state.confirmPassword; res.confirmPassword.error = tt('g.passwords_do_not_match'); } this.setState(res); this.onChange(res); } confirmPasswordChange(e) { const value = e.target.value.trim(); let error = ''; if (value !== this.state.newPassword.value) error = tt('g.passwords_do_not_match'); const res = { confirmPassword: { value, error } }; this.setState(res); this.onChange(res); } render() { const { inputNewPassword, inputConfirmPassword, disabled, passwordLabel, } = this.props; const { oldPassword, newPassword, confirmPassword } = this.state; return ( <div className="PasswordInput"> <div> <label> {passwordLabel} <input type="password" name="oldPassword" autoComplete="off" onChange={this.oldPasswordChange} value={oldPassword.value} disabled={disabled} /> </label> <div className="error">{oldPassword.error}</div> </div> {inputNewPassword && ( <div> <label> {tt('g.new_password')} <input type="password" name="oldPassword" autoComplete="off" onChange={this.newPasswordChange} value={newPassword.value} disabled={disabled} /> </label> <div className="error">{newPassword.error}</div> </div> )} {inputNewPassword && inputConfirmPassword && ( <div> <label> {tt('g.confirm_password')} <input type="password" name="confirmPassword" autoComplete="off" onChange={this.confirmPasswordChange} value={confirmPassword.value} disabled={disabled} /> </label> <div className="error">{confirmPassword.error}</div> </div> )} </div> ); } }
35.892405
80
0.480339
false
true
true
false
127a27670d03386ecce8b762b8645381d823ee43
17,576
jsx
JSX
src/DateRangePicker.jsx
bellhops/react-daterange-picker
d6284a0d1d7aa775f95708aec80a0823402190b3
[ "Apache-2.0" ]
null
null
null
src/DateRangePicker.jsx
bellhops/react-daterange-picker
d6284a0d1d7aa775f95708aec80a0823402190b3
[ "Apache-2.0" ]
null
null
null
src/DateRangePicker.jsx
bellhops/react-daterange-picker
d6284a0d1d7aa775f95708aec80a0823402190b3
[ "Apache-2.0" ]
1
2019-02-21T19:29:53.000Z
2019-02-21T19:29:53.000Z
import React from 'react'; import PropTypes from 'prop-types'; import createClass from 'create-react-class'; import moment from './moment-range'; import Immutable from 'immutable'; import calendar from 'calendar'; import BemMixin from './utils/BemMixin'; import CustomPropTypes from './utils/CustomPropTypes'; import Legend from './Legend'; import CalendarMonth from './calendar/CalendarMonth'; import CalendarDate from './calendar/CalendarDate'; import PaginationArrow from './PaginationArrow'; import isMomentRange from './utils/isMomentRange'; import hasUpdatedValue from './utils/hasUpdatedValue'; import { getYearMonth, getYearMonthProps } from './utils/getYearMonth'; import PureRenderMixin from 'react-addons-pure-render-mixin'; const absoluteMinimum = moment(new Date(-8640000000000000 / 2)).startOf('day'); const absoluteMaximum = moment(new Date(8640000000000000 / 2)).startOf('day'); function noop() {} const DateRangePicker = createClass({ mixins: [BemMixin, PureRenderMixin], displayName: "DateRangePicker", propTypes: { fullDayStates: PropTypes.bool, onDateChange: PropTypes.func, renderDate: PropTypes.func, bemBlock: PropTypes.string, bemNamespace: PropTypes.string, className: PropTypes.string, dateStates: PropTypes.array, // an array of date ranges and their states defaultState: PropTypes.string, disableNavigation: PropTypes.bool, firstOfWeek: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]), helpMessage: PropTypes.string, initialDate: PropTypes.instanceOf(Date), initialFromValue: PropTypes.bool, initialMonth: PropTypes.number, // Overrides values derived from initialDate/initialRange initialRange: PropTypes.object, initialYear: PropTypes.number, // Overrides values derived from initialDate/initialRange locale: PropTypes.string, maximumDate: PropTypes.instanceOf(Date), minimumDate: PropTypes.instanceOf(Date), numberOfCalendars: PropTypes.number, onHighlightDate: PropTypes.func, // triggered when a date is highlighted (hovered) onHighlightRange: PropTypes.func, // triggered when a range is highlighted (hovered) onSelect: PropTypes.func, // triggered when a date or range is selectec onSelectStart: PropTypes.func, // triggered when the first date in a range is selected paginationArrowComponent: PropTypes.func, selectedLabel: PropTypes.string, selectionType: PropTypes.oneOf(['single', 'range']), singleDateRange: PropTypes.bool, showLegend: PropTypes.bool, stateDefinitions: PropTypes.object, value: CustomPropTypes.momentOrMomentRange, weekdayNames: CustomPropTypes.weekArray, }, getDefaultProps() { let date = new Date(); let initialDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()); return { bemNamespace: null, bemBlock: 'DateRangePicker', className: '', numberOfCalendars: 1, firstOfWeek: 0, fullDayStates: false, disableNavigation: false, nextLabel: '', previousLabel: '', initialDate: initialDate, initialFromValue: true, locale: moment().locale(), selectionType: 'range', singleDateRange: false, stateDefinitions: { '__default': { color: null, selectable: true, label: null, }, }, selectedLabel: "Your selected dates", defaultState: '__default', dateStates: [], showLegend: false, onSelect: noop, paginationArrowComponent: PaginationArrow, }; }, componentWillReceiveProps(nextProps) { const nextDateStates = this.getDateStates(nextProps); const nextEnabledRange = this.getEnabledRange(nextProps); const updatedState = { selectedStartDate: null, hideSelection: false, dateStates: this.state.dateStates && Immutable.is(this.state.dateStates, nextDateStates) ? this.state.dateStates : nextDateStates, enabledRange: this.state.enabledRange && this.state.enabledRange.isSame(nextEnabledRange) ? this.state.enabledRange : nextEnabledRange, }; if (hasUpdatedValue(this.props, nextProps)) { if (!nextProps.value || !this.isStartOrEndVisible(nextProps)) { const yearMonth = getYearMonthProps(nextProps); updatedState.year = yearMonth.year; updatedState.month = yearMonth.month; } } this.setState(updatedState); }, getInitialState() { let now = new Date(); let {initialYear, initialMonth, initialFromValue, value} = this.props; let year = now.getFullYear(); let month = now.getMonth(); if (Number.isInteger(initialYear) && Number.isInteger(initialMonth)) { year = initialYear; month = initialMonth; } if (initialFromValue && (moment.isMoment(value) || isMomentRange(value))) { const yearMonth = getYearMonthProps(this.props); month = yearMonth.month; year = yearMonth.year; } return { year: year, month: month, selectedStartDate: null, highlightedDate: null, highlightRange: null, hideSelection: false, enabledRange: this.getEnabledRange(this.props), dateStates: this.getDateStates(this.props), }; }, getEnabledRange(props) { let min = props.minimumDate ? moment(props.minimumDate).startOf('day') : absoluteMinimum; let max = props.maximumDate ? moment(props.maximumDate).startOf('day') : absoluteMaximum; return moment.range(min, max); }, getDateStates(props) { let {dateStates, defaultState, stateDefinitions} = props; let actualStates = []; let minDate = absoluteMinimum; let maxDate = absoluteMaximum; let dateCursor = moment(minDate).startOf('day'); // If states should always include the full day at the edges, we need to // use different boundaries for the "default state" ranges we generate // here. Otherwise the rendering code in CalenderDate cannot know if the // day is at a boundary or not. let shiftDays = this.props.fullDayStates ? 1 : 0; let defs = Immutable.fromJS(stateDefinitions); dateStates.forEach(function(s) { let r = s.range; let start = r.start.startOf('day'); let end = r.end.startOf('day'); if (!dateCursor.isSame(start, 'day')) { actualStates.push({ state: defaultState, range: moment.range( moment(dateCursor).add(shiftDays, 'day'), moment(start).subtract(shiftDays, 'day') ), }); } actualStates.push(s); dateCursor = end; }); actualStates.push({ state: defaultState, range: moment.range( moment(dateCursor).add(shiftDays, 'day'), maxDate ), }); // sanitize date states return Immutable.List(actualStates).map(function(s) { let def = defs.get(s.state); return Immutable.Map({ range: s.range, state: s.state, selectable: def.get('selectable', true), color: def.get('color'), }); }); }, isDateDisabled(date) { return !this.state.enabledRange.contains(date); }, isDateSelectable(date) { return this.dateRangesForDate(date).some(r => r.get('selectable')); }, nonSelectableStateRanges() { return this.state.dateStates.filter(d => !d.get('selectable')); }, dateRangesForDate(date) { return this.state.dateStates.filter(d => d.get('range').contains(date)); }, sanitizeRange(range, forwards) { /* Truncates the provided range at the first intersection * with a non-selectable state. Using forwards to determine * which direction to work */ let blockedRanges = this.nonSelectableStateRanges().map(r => r.get('range')); if (this.props.fullDayStates) { // range.intersect() ignores when one range ends on the same day // the other begins; for the block to work, we have to extend the // ranges by one day. blockedRanges = blockedRanges.map(r => { r = r.clone(); r.start.subtract(1, 'day'); r.end.add(1, 'day'); return r; }); } let intersect; if (forwards) { intersect = blockedRanges.find(r => range.intersect(r)); if (intersect) { return moment.range(range.start, intersect.start); } } else { intersect = blockedRanges.findLast(r => range.intersect(r)); if (intersect) { return moment.range(intersect.end, range.end); } } if (range.start.isBefore(this.state.enabledRange.start)) { return moment.range(this.state.enabledRange.start, range.end); } if (range.end.isAfter(this.state.enabledRange.end)) { return moment.range(range.start, this.state.enabledRange.end); } return range; }, highlightRange(range) { this.setState({ highlightedRange: range, highlightedDate: null, }); if (typeof this.props.onHighlightRange === 'function') { this.props.onHighlightRange(range, this.statesForRange(range)); } }, onUnHighlightDate() { this.setState({ highlightedDate: null, }); }, onSelectDate(date) { let {selectionType} = this.props; let {selectedStartDate} = this.state; if (selectionType === 'range') { if (selectedStartDate) { this.completeRangeSelection(); } else if (date && !this.isDateDisabled(date) && this.isDateSelectable(date)) { this.startRangeSelection(date); if (this.props.singleDateRange) { this.highlightRange(moment.range(date, date)); } } } else { if (!this.isDateDisabled(date) && this.isDateSelectable(date)) { this.completeSelection(); } } }, onHighlightDate(date) { let {selectionType} = this.props; let {selectedStartDate} = this.state; let datePair; let range; let forwards; if (selectionType === 'range') { if (selectedStartDate) { datePair = Immutable.List.of(selectedStartDate, date).sortBy(d => d.unix()); range = moment.range(datePair.get(0), datePair.get(1)); forwards = (range.start.unix() === selectedStartDate.unix()); range = this.sanitizeRange(range, forwards); this.highlightRange(range); } else if (!this.isDateDisabled(date) && this.isDateSelectable(date)) { this.highlightDate(date); } } else { if (!this.isDateDisabled(date) && this.isDateSelectable(date)) { this.highlightDate(date); } } }, startRangeSelection(date) { this.setState({ hideSelection: true, selectedStartDate: date, }); if (typeof this.props.onSelectStart === 'function') { this.props.onSelectStart(moment(date)); } }, statesForDate(date) { return this.state.dateStates.filter(d => date.within(d.get('range'))).map(d => d.get('state')); }, statesForRange(range) { if (range.start.isSame(range.end, 'day')) { return this.statesForDate(range.start); } return this.state.dateStates.filter(d => d.get('range').intersect(range)).map(d => d.get('state')); }, completeSelection() { let highlightedDate = this.state.highlightedDate; if (highlightedDate) { this.setState({ hideSelection: false, highlightedDate: null, }); this.props.onSelect(highlightedDate, this.statesForDate(highlightedDate)); } }, completeRangeSelection() { let range = this.state.highlightedRange; if (range && (!range.start.isSame(range.end, 'day') || this.props.singleDateRange)) { this.setState({ selectedStartDate: null, highlightedRange: null, highlightedDate: null, hideSelection: false, }); this.props.onSelect(range, this.statesForRange(range)); } }, highlightDate(date) { this.setState({ highlightedDate: date, }); if (typeof this.props.onHighlightDate === 'function') { this.props.onHighlightDate(date, this.statesForDate(date)); } }, getMonthDate() { return moment(new Date(this.state.year, this.state.month, 1)); }, isStartOrEndVisible(props) { const { value, selectionType, numberOfCalendars } = props; const isVisible = (date) => { const yearMonth = getYearMonth(date); const isSameYear = (yearMonth.year === this.state.year); const isMonthVisible = (yearMonth.month === this.state.month) || (numberOfCalendars === 2 && (yearMonth.month - 1 === this.state.month)); return isSameYear && isMonthVisible; }; if (selectionType === 'single') { return isVisible(value); } return isVisible(value.start) || isVisible(value.end); }, canMoveBack() { if (this.getMonthDate().subtract(1, 'days').isBefore(this.state.enabledRange.start)) { return false; } return true; }, moveBack() { let monthDate; if (this.canMoveBack()) { monthDate = this.getMonthDate(); monthDate.subtract(1, 'months'); this.setState({ year: monthDate.year(), month: monthDate.month(), }); if (this.props.onDateChange) { this.props.onDateChange(monthDate); } } }, canMoveForward() { if (this.getMonthDate().add(this.props.numberOfCalendars, 'months').isAfter(this.state.enabledRange.end)) { return false; } return true; }, moveForward() { let monthDate; if (this.canMoveForward()) { monthDate = this.getMonthDate(); monthDate.add(1, 'months'); this.setState({ year: monthDate.year(), month: monthDate.month(), }); if (this.props.onDateChange) { this.props.onDateChange(monthDate); } } }, changeYear(year) { let {enabledRange, month} = this.state; if (moment({years: year, months: month, date: 1}).unix() < enabledRange.start.unix()) { month = enabledRange.start.month(); } if (moment({years: year, months: month + 1, date: 1}).unix() > enabledRange.end.unix()) { month = enabledRange.end.month(); } this.setState({ year: year, month: month, }); if (this.props.onDateChange) { this.props.onDateChange({ year, month }); } }, changeMonth(date) { this.setState({ month: date, }); if (this.props.onDateChange) { this.props.onDateChange({ year: this.state.year, month: date }); } }, rangesOverlap(rangeA, rangeB) { if (rangeA.overlaps(rangeB) || rangeA.contains(rangeB.start) || rangeA.contains(rangeB.end)) { return true; } return false; }, renderCalendar(index) { let { bemBlock, bemNamespace, firstOfWeek, fullDayStates, numberOfCalendars, renderDate, selectionType, value, weekdayNames, } = this.props; let { dateStates, enabledRange, hideSelection, highlightedDate, highlightedRange, } = this.state; let monthDate = this.getMonthDate(); let year = monthDate.year(); let month = monthDate.month(); let key = `${ index}-${ year }-${ month }`; let props; monthDate.add(index, 'months'); let cal = new calendar.Calendar(firstOfWeek); let monthDates = Immutable.fromJS(cal.monthDates(monthDate.year(), monthDate.month())); let monthStart = monthDates.first().first(); let monthEnd = monthDates.last().last(); let monthRange = moment.range(monthStart, monthEnd); if (moment.isMoment(value) && !monthRange.contains(value)) { value = null; } else if (isMomentRange(value) && !(this.rangesOverlap(monthRange, value))) { value = null; } if (!moment.isMoment(highlightedDate) || !monthRange.contains(highlightedDate)) { highlightedDate = null; } if (!isMomentRange(highlightedRange) || !(this.rangesOverlap(monthRange, highlightedRange))) { highlightedRange = null; } props = { bemBlock, bemNamespace, dateStates, enabledRange, firstOfWeek, fullDayStates, hideSelection, highlightedDate, highlightedRange, index, key, renderDate, selectionType, value, weekdayNames, maxIndex: numberOfCalendars - 1, firstOfMonth: monthDate, onMonthChange: this.changeMonth, onYearChange: this.changeYear, onSelectDate: this.onSelectDate, onHighlightDate: this.onHighlightDate, onUnHighlightDate: this.onUnHighlightDate, dateRangesForDate: this.dateRangesForDate, dateComponent: CalendarDate, locale: this.props.locale, }; return <CalendarMonth {...props} />; }, render: function() { let {paginationArrowComponent: PaginationArrowComponent, className, numberOfCalendars, stateDefinitions, selectedLabel, showLegend, helpMessage} = this.props; let calendars = Immutable.Range(0, numberOfCalendars).map(this.renderCalendar); className = this.cx({element: null}) + ' ' + className; return ( <div className={className.trim()}> <PaginationArrowComponent direction="previous" onTrigger={this.moveBack} disabled={!this.canMoveBack()} /> {calendars.toJS()} <PaginationArrowComponent direction="next" onTrigger={this.moveForward} disabled={!this.canMoveForward()} /> {helpMessage ? <span className={this.cx({element: 'HelpMessage'})}>{helpMessage}</span> : null} {showLegend ? <Legend stateDefinitions={stateDefinitions} selectedLabel={selectedLabel} /> : null} </div> ); }, }); export default DateRangePicker;
29.639123
162
0.644743
false
true
false
true
127a43d2e0e295077ee285b7234f1dd7f3d18abc
3,441
jsx
JSX
React Fundamentals/Exam_prep_1/exam-prep-1/src/components/Auth/RegisterPage.jsx
NikiStanchev/SoftUni
51b0c3d8e82e3f964e8b9e0107d58d439c13908a
[ "MIT" ]
null
null
null
React Fundamentals/Exam_prep_1/exam-prep-1/src/components/Auth/RegisterPage.jsx
NikiStanchev/SoftUni
51b0c3d8e82e3f964e8b9e0107d58d439c13908a
[ "MIT" ]
null
null
null
React Fundamentals/Exam_prep_1/exam-prep-1/src/components/Auth/RegisterPage.jsx
NikiStanchev/SoftUni
51b0c3d8e82e3f964e8b9e0107d58d439c13908a
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import Input from './Input' import {withRouter} from 'react-router-dom' import {connect} from 'react-redux' import {registerAction, loginAction, redirect} from '../../actions/authActions' class RegisterPage extends Component{ constructor(props){ super(props) this.state={ name:'', email:'', password:'', repeat:'', redirect:false } this.onChangeHandler = this.onChangeHandler.bind(this) this.onSubmitHandler = this.onSubmitHandler.bind(this) } onChangeHandler(e){ this.setState({[e.target.name]: e.target.value}) } onSubmitHandler(e){ e.preventDefault() this.props.register(this.state.name, this.state.email, this.state.password) } componentWillReceiveProps(newProps){ if(newProps.registerSuccess){ this.props.login(this.state.email, this.state.password) } else if(newProps.loginSuccess){ this.props.redirect() this.props.history.push('/') } } render(){ return( <div className="container"> <div className="row space-top"> <div className="col-md-12"> <h1>Register</h1> <p>Please fill all fields.</p> </div> </div> <form onSubmit={this.onSubmitHandler}> <div className="row space-top"> <div className="col-md-4"> <Input name='name' type='text' value={this.state.name} onChange={this.onChangeHandler} label='Name' /> <Input name='email' type='text' value={this.state.email} onChange={this.onChangeHandler} label='E-mail' /> <Input name='password' type='password' value={this.state.password} onChange={this.onChangeHandler} label='Password' /> <Input name='repeat' type='password' value={this.state.repeat} onChange={this.onChangeHandler} label='Repeat password' /> <input type="submit" className="btn btn-primary" value="Register" /> </div> </div> </form> </div> ) } } function mapStateToProps(state){ return{ registerSuccess: state.register.success, loginSuccess: state.login.success } } function mapDispatchToProps(dispatch){ return{ register:(name, email, password) => dispatch(registerAction(name, email, password)), login:(email, password) => dispatch(loginAction(email, password)), redirect: ()=> dispatch(redirect()) } } export default connect(mapStateToProps, mapDispatchToProps)(withRouter(RegisterPage))
32.158879
92
0.468759
true
false
true
false
127a4ecd0c11485a15d1f85806607a6e7807d88e
6,432
jsx
JSX
apps/duellen/app/components/Resultat.jsx
anttih008/affresco
2cb99d20852de2e1df69165787b9468af20340de
[ "MIT" ]
null
null
null
apps/duellen/app/components/Resultat.jsx
anttih008/affresco
2cb99d20852de2e1df69165787b9468af20340de
[ "MIT" ]
null
null
null
apps/duellen/app/components/Resultat.jsx
anttih008/affresco
2cb99d20852de2e1df69165787b9468af20340de
[ "MIT" ]
null
null
null
import React from 'react'; import BackBtn from './BackBtn.jsx'; import EmailDialog from './EmailDialog.jsx'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import {Tabs, Tab} from 'material-ui/Tabs'; import SwipeableViews from 'react-swipeable-views'; import {FacebookShareButton, FacebookIcon, TwitterShareButton, TwitterIcon, EmailShareButton, EmailIcon} from 'react-share'; import ReactGA from 'react-ga'; const styles = { headline: { fontSize: 26, paddingTop: 16, marginBottom: 12, fontWeight: 400, }, progress: { padding: '5px', backgroundColor:'rgba(0, 188, 212, 0.1', }, border: { borderTop: '1px solid #00BCD4', }, }; ReactGA.initialize('UA-119802236-1'); export default class Resultat extends React.Component{ constructor(props){ super(props); this.state = { slideIndex: 0, player1: this.props.quizData.players.player1.name, player2: this.props.quizData.players.player2.name, player1_img: this.props.quizData.players.player1.img, player2_img: this.props.quizData.players.player2.img, player1_score: this.props.quizData.players.player1.score, player2_score: this.props.quizData.players.player2.score, questions: [[this.props.quizData.questions.question1,0], [this.props.quizData.questions.question2,1], [this.props.quizData.questions.question3,2], [this.props.quizData.questions.question4,3], [this.props.quizData.questions.question5,4], ], }; this.handleChange = this.handleChange.bind(this); } componentDidMount(){ ReactGA.pageview(window.location.pathname + window.location.search); ReactGA.event({ category: 'User', action: 'Completed Quiz' }); } // This is so you can se if you are on 'dina resultat' or 'Rätt svar' handleChange(){ if(this.state.slideIndex === 0){ this.setState({slideIndex: 1,}); }else{ this.setState({slideIndex: 0}); } }; render() { const shareUrl = 'http://hbl.fi'; const title = 'Duellen Digitalt!'; const hashtag = '#duellen'; const hashtags = ['duellen','hbl']; return ( <MuiThemeProvider> <div> <div style={{backgroundColor:'#f07e26',padding: 10}}> <BackBtn /> </div> <Tabs onChange={this.handleChange} value={this.state.slideIndex} onClick={this.handleChange} > <Tab label="Dina resultat" value={0} /> <Tab label="Rätta svar" value={1} /> </Tabs> <EmailDialog /> <SwipeableViews index={this.state.slideIndex} onChangeIndex={this.handleChange} > <div> <div style={{paddingTop: 12}}> <div style={{textAlign: 'center'}}> <h3 style={{paddingBottom: '12%', paddingTop: '12%'}}>Du fick <br/> {this.props.tally} poäng!</h3> </div> <div className="row"> <div className="col-sm-6 text-center"> <img src={this.state.player1_img} className='img-fluid rounded-circle' style={{width: 250, height:250, objectFit: 'cover'}}></img> <p>{this.state.player1} fick <br></br><b>{this.state.player1_score}</b> poäng!</p> </div> <div className="col-sm-6 text-center"> <img src={this.state.player2_img} className='img-fluid rounded-circle' style={{width: 250, height:250, objectFit: 'cover'}}></img> <p>{this.state.player2} fick <br></br><b>{this.state.player2_score}</b> poäng!</p> </div> </div> <div className="share_buttons" style={{display: 'inline-block', textAlign: 'center', width: '100%', cursor: 'pointer'}}> <p style={{padding:'5%'}}>Dela ditt resultat med vänner!</p> <FacebookShareButton style={{display: 'inline-block', margin: '5px'}} url={shareUrl} quote={title} hashtag={hashtag} className="Demo__some-network__share-button"> <FacebookIcon size={45} round /> </FacebookShareButton> <TwitterShareButton style={{display: 'inline-block', margin: '5px'}} url={shareUrl} title={title} hashtags={hashtags} className="Demo__some-network__share-button"> <TwitterIcon size={45} round /> </TwitterShareButton> <EmailShareButton style={{display: 'inline-block', margin: '5px'}} url={shareUrl} subject={title} body="body" className="Demo__some-network__share-button"> <EmailIcon size={45} round /> </EmailShareButton> </div> </div> </div> <div style={styles.slide}> <div style={{textAlign: 'left', padding: '7%', lineHeight: '1.8'}}> {this.state.questions.map(item => ( <div style={{marginBottom: '40px', borderBottom: '1px solid black'}}> <h3>{item[0].category} {item[0].question}</h3> <p style={{padding: '5px', backgroundColor:'rgba(0, 188, 212, 0.1)'}}>{this.props.right[item[1]]}</p> <p><b>5 poäng</b> {item[0].hints.hint1} <br/></p> <p><b>4 poäng</b> {item[0].hints.hint2} <br/></p> <p><b>3 poäng</b> {item[0].hints.hint3} <br/></p> <p><b>2 poäng</b> {item[0].hints.hint4} <br/></p> <p><b>1 poäng</b> {item[0].hints.hint5} <br/></p> <p>Rätt svar: {item[0].answer}</p> </div> ))} </div> </div> </SwipeableViews> </div> </MuiThemeProvider> ); } };
36.965517
148
0.508396
false
true
true
false
127a50a569929d44c1779d6288ff148ba8ff6dcb
1,463
jsx
JSX
src/applications/vaos/components/VAFacilityLocation.jsx
bmish/vets-website
5da47eee70e3c1d35a4e1f72b25e1c47b4fa3879
[ "CC0-1.0" ]
null
null
null
src/applications/vaos/components/VAFacilityLocation.jsx
bmish/vets-website
5da47eee70e3c1d35a4e1f72b25e1c47b4fa3879
[ "CC0-1.0" ]
null
null
null
src/applications/vaos/components/VAFacilityLocation.jsx
bmish/vets-website
5da47eee70e3c1d35a4e1f72b25e1c47b4fa3879
[ "CC0-1.0" ]
null
null
null
import React from 'react'; import { getRealFacilityId } from '../utils/appointment'; import FacilityAddress from './FacilityAddress'; import NewTabAnchor from './NewTabAnchor'; export default function VAFacilityLocation({ clinicName, facility, facilityName, facilityId, clinicFriendlyName, showCovidPhone, isPhone, }) { let content = null; if (!facility && !facilityId) { content = ( <NewTabAnchor href="/find-locations"> Find facility information </NewTabAnchor> ); } else if (!facility) { content = ( <NewTabAnchor href={`/find-locations/facility/vha_${getRealFacilityId(facilityId)}`} > View facility information </NewTabAnchor> ); } else if (facility) { content = ( <> {!!clinicName && ( <> {facility.name} <br /> </> )} <FacilityAddress facility={facility} showDirectionsLink clinicName={clinicFriendlyName} level={2} showCovidPhone={showCovidPhone} /> </> ); } const name = clinicName || facilityName || facility?.name; if (isPhone) { return ( <> <h2 className="vads-u-font-size--base vads-u-font-family--sans vads-u-margin-bottom--0"> {name} </h2> <div>{content}</div> </> ); } return ( <> {name} <div>{content}</div> </> ); }
20.605634
96
0.550239
false
true
false
true
127a62a63faaeb61f3c70e0fc4cbb865645cdab3
3,466
jsx
JSX
node_modules/react-onsenui/src/components/PullHook.jsx
anavdp/medishare
782b5bbaaf14eebc9fa66da992da8a3e6bb464fa
[ "MIT" ]
null
null
null
node_modules/react-onsenui/src/components/PullHook.jsx
anavdp/medishare
782b5bbaaf14eebc9fa66da992da8a3e6bb464fa
[ "MIT" ]
null
null
null
node_modules/react-onsenui/src/components/PullHook.jsx
anavdp/medishare
782b5bbaaf14eebc9fa66da992da8a3e6bb464fa
[ "MIT" ]
null
null
null
import ReactDOM from 'react-dom'; import BasicComponent from './BasicComponent.jsx'; import React from 'react'; import PropTypes from 'prop-types'; import Util from './Util.js'; /** * @original ons-pull-hook * @category control * @tutorial react/Reference/pull-hook * @description * [en] Component that adds **Pull to refresh** functionality to an `<ons-page>` element. * It can be used to perform a task when the user pulls down at the top of the page. A common usage is to refresh the data displayed in a page. [/en] * [ja][/ja] * @example return ( <PullHook onChange={this.onChange} onLoad={this.onLoad}> { (this.state.pullHookState === 'initial') ? <span > <Icon size={35} spin={false} icon='ion-arrow-down-a' /> Pull down to refresh </span> : (this.state.pullHookState === 'preaction') ? <span> <Icon size={35} spin={false} icon='ion-arrow-up-a' /> Release to refresh </span> : <span><Icon size={35} spin={true} icon='ion-load-d'></Icon> Loading data...</span> } </PullHook> ); */ class PullHook extends BasicComponent { constructor(...args) { super(...args); this.onChange = (event) => { if (this.props.onChange) { return this.props.onChange(event); } }; } componentDidMount() { super.componentDidMount(); var node = ReactDOM.findDOMNode(this); node.addEventListener('changestate', this.onChange); this._pullHook.onAction = this.props.onLoad || null; } componentWillUnmount() { var node = ReactDOM.findDOMNode(this); node.removeEventListener('changestate', this.onChange); } render() { var {...others} = this.props; ['disabled'].forEach((el) => { Util.convert(others, el); }); Util.convert(others, 'height', {fun: Util.sizeConverter}); Util.convert(others, 'thresholdHeight', {fun: Util.sizeConverter, newName: 'threshold-height'}); Util.convert(others, 'fixedContent', {newName: 'fixed-content'}); return <ons-pull-hook ref={(pullHook) => { this._pullHook = pullHook; }} {...others} />; } } PullHook.propTypes = { /** * @name onChange * @type function * @required false * @description * [en]Called when the pull hook inner state is changed. The state can be either "initial", "preaction" or "action"[/en] * [ja][/ja] */ onChange: PropTypes.func, /** * @name onLoad * @type function * @required false * @description * [en]Called when the pull hook is in the `action` state[/en] * [ja][/ja] */ onLoad: PropTypes.func, /** * @name disabled * @type bool * @description * [en] When set to true, the pull hook will be disabled.[/en] * [ja][/ja] */ disabled: PropTypes.bool, /** * @name height * @type number * @description * [en] The height of the pull hook in pixels. The default value is 64.[/en] * [ja][/ja] */ height: PropTypes.number, /** * @name thresholdHeight * @type number * @description * [en] The threshold height of the pull hook in pixels. The default value is 96.[/en] * [ja][/ja] */ thresholdHeight: PropTypes.number, /** * @name fixedContent * @type number * @description * [en] If set to true, the content of the page will not move when pulling.[/en] * [ja][/ja] */ fixedContent: PropTypes.bool }; export default PullHook;
25.865672
147
0.608482
false
true
false
true
127a667a0443f277aa3772f7448b577c7e2738c0
2,737
jsx
JSX
src/components/connection-modal/connected-step.jsx
HackEduca/scratch3-ros-gui
413e4b87ca21c7f4820b5a6f478ddf84f832da13
[ "BSD-3-Clause" ]
1
2018-11-19T03:31:53.000Z
2018-11-19T03:31:53.000Z
src/components/connection-modal/connected-step.jsx
aibotk216/scratch-gui
47b80a857c3e0a2286fde331316dbdfd05c3ae27
[ "BSD-3-Clause" ]
null
null
null
src/components/connection-modal/connected-step.jsx
aibotk216/scratch-gui
47b80a857c3e0a2286fde331316dbdfd05c3ae27
[ "BSD-3-Clause" ]
1
2018-11-19T03:31:54.000Z
2018-11-19T03:31:54.000Z
import {FormattedMessage} from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import Box from '../box/box.jsx'; import Dots from './dots.jsx'; import bluetoothIcon from './icons/bluetooth-white.svg'; import styles from './connection-modal.css'; import classNames from 'classnames'; const ConnectedStep = props => ( <Box className={styles.body}> <Box className={styles.activityArea}> <Box className={styles.centeredRow}> <div className={styles.peripheralActivity}> <img className={styles.peripheralActivityIcon} src={props.connectionIconURL} /> {props.bluetoothRequired ? <img className={styles.bluetoothConnectedIcon} src={bluetoothIcon} /> : null } </div> </Box> </Box> <Box className={styles.bottomArea}> <Box className={classNames(styles.bottomAreaItem, styles.instructions)}> <FormattedMessage defaultMessage="Connected" description="Message indicating that a device was connected" id="gui.connection.connected" /> </Box> <Dots success className={styles.bottomAreaItem} total={3} /> <div className={classNames(styles.bottomAreaItem, styles.cornerButtons)}> <button className={classNames(styles.redButton, styles.connectionButton)} onClick={props.onDisconnect} > <FormattedMessage defaultMessage="Disconnect" description="Button to disconnect the device" id="gui.connection.disconnect" /> </button> <button className={styles.connectionButton} onClick={props.onCancel} > <FormattedMessage defaultMessage="Go to Editor" description="Button to return to the editor" id="gui.connection.go-to-editor" /> </button> </div> </Box> </Box> ); ConnectedStep.propTypes = { connectionIconURL: PropTypes.string.isRequired, onCancel: PropTypes.func, onDisconnect: PropTypes.func, bluetoothRequired: PropTypes.bool, peripheralImage: PropTypes.string.isRequired }; export default ConnectedStep;
35.545455
85
0.51772
false
true
false
true
127a88bb98be332d204f65aa61a8d2b74e3650c3
565
jsx
JSX
src/components/Modal.jsx
FredDiPasqua/BEDU
bd721bd04ba4f94bdb12805af37ab3921c687337
[ "MIT" ]
null
null
null
src/components/Modal.jsx
FredDiPasqua/BEDU
bd721bd04ba4f94bdb12805af37ab3921c687337
[ "MIT" ]
null
null
null
src/components/Modal.jsx
FredDiPasqua/BEDU
bd721bd04ba4f94bdb12805af37ab3921c687337
[ "MIT" ]
null
null
null
import React from 'react'; import ReactDOM from 'react-dom' import '../assets/styles/components/Modal.scss' const Modal = (props) => { if (props.isOpen) { return null; } return ReactDOM.createPortal ( <div className="login"> <div className="containerModal"> <button onClick={props.onClose} className="closeBtn" > X </button> {props.children} </div> </div>, document.getElementById("modal") ) }; export default Modal;
21.730769
86
0.536283
false
true
false
true
127a9047c9b7c4804b8413c9eb179374ca837e30
3,787
jsx
JSX
src/components/camera-picker/cameraPicker.jsx
felixTineo/app_green
de5be21495dbc08f35e8b8c8118cee0e09cb98c1
[ "MIT" ]
null
null
null
src/components/camera-picker/cameraPicker.jsx
felixTineo/app_green
de5be21495dbc08f35e8b8c8118cee0e09cb98c1
[ "MIT" ]
3
2021-05-11T15:14:35.000Z
2022-02-27T05:24:54.000Z
src/components/camera-picker/cameraPicker.jsx
felixTineo/app_green
de5be21495dbc08f35e8b8c8118cee0e09cb98c1
[ "MIT" ]
null
null
null
import React, { useEffect, useState, useRef } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { ON_LAYOUT_CAMERAPICKER } from '../../store/actions'; import { StyleSheet, Modal, TouchableOpacity } from 'react-native'; import { View, Icon, Text, Button } from 'native-base'; import { Camera } from 'expo-camera'; import * as ImagePicker from 'expo-image-picker'; import { color } from '../../var'; export default ({ onNext, visible, onClose })=> { const [hasPermission, setHasPermission] = useState(null); const [type, setType] = useState(Camera.Constants.Type.back); const [size, setSize] = useState(null); const [disable, setDisable] = useState(false); const dispatch = useDispatch(); let camera = useRef(null); const onPermission = async() => { const { status } = await Camera.requestPermissionsAsync(); setHasPermission(status === 'granted'); } useEffect(() => { onPermission(); },[hasPermission]); useEffect(()=> { (async ()=> { const size = await camera.getAvailablePictureSizesAsync('4:3'); setSize(size[2]); })(); },[camera]); const onCameraType = () => { setType( type === Camera.Constants.Type.back ? Camera.Constants.Type.front : Camera.Constants.Type.back ) } const onSnap = async()=> { if(camera){ setDisable(true); const { uri } = await camera.takePictureAsync(); onNext(uri); } } const onPicker = async () => { let permissionResult = await ImagePicker.requestCameraRollPermissionsAsync(); if (permissionResult.granted === false) { alert("Permission to access camera roll is required!"); return; } let { uri } = await ImagePicker.launchImageLibraryAsync(); onNext(uri) } if(hasPermission){ return( <Modal animationType="slide" visible={visible} transparent={false} > {console.log(type)} <View style={styles.cameraCont}> <Camera ref={ref => { camera = ref }} style={styles.camera} type={type} ratio="4:3" pictureSize={size} > <View> <Button bordered style={styles.btnClose}> <Text onPress={onClose} style={{ color: color.prim }}>Cancelar</Text> </Button> </View> <View> <View> <TouchableOpacity style={styles.snapBtn} onPress={onSnap} /> </View> <View style={styles.cameraFooter}> <TouchableOpacity onPress={onCameraType} > <Icon style={styles.cameraFooterIcons} type="FontAwesome5" name="sync" /> </TouchableOpacity> <TouchableOpacity onPress={onPicker} > <Icon style={{ ...styles.cameraFooterIcons, marginLeft: 25 }} type="FontAwesome5" name="image" /> </TouchableOpacity> </View> </View> </Camera> </View> </Modal> ) }else { return( <View> <Text>No tines permiso</Text> </View> ) } } const styles = StyleSheet.create({ cameraCont:{ flex: 1, }, camera:{ flex: 1, justifyContent: "space-between", }, btnClose:{ margin: 10, borderColor: color.prim, alignSelf: "flex-end", }, snapBtn:{ backgroundColor: color.prim, width: 100, height: 100, borderRadius: 50, alignSelf: "center", }, cameraFooter:{ flexDirection: "row", padding: 15, }, cameraFooterIcons:{ color: color.light, } });
26.669014
115
0.546871
false
true
false
true
127a909908408ef0ca1e21f3d13410fe80fdaaab
346
jsx
JSX
src/client/App.jsx
uhlryk/egnyte-test
7e69f6eeae8895681152909852f0a62e3a51743c
[ "MIT" ]
null
null
null
src/client/App.jsx
uhlryk/egnyte-test
7e69f6eeae8895681152909852f0a62e3a51743c
[ "MIT" ]
null
null
null
src/client/App.jsx
uhlryk/egnyte-test
7e69f6eeae8895681152909852f0a62e3a51743c
[ "MIT" ]
null
null
null
import React from 'react'; import ListFile from './components/List.jsx'; class App extends React.Component { static propsTypes = { initialState: React.PropTypes.object }; constructor(props) { super(props); } render() { return ( <ListFile file={this.props.initialState.file || []} /> ); } } export default App;
18.210526
60
0.644509
false
true
true
false
127aa96c86a9a223d3da913f820ba14fb6c4d9ca
1,935
jsx
JSX
src/pages/tags.jsx
gauthamzz/gatsby-site
8ad0f2ee8f694a3d3ef0fbfc97ebcad00d2a3153
[ "MIT" ]
1
2019-05-04T19:38:01.000Z
2019-05-04T19:38:01.000Z
src/pages/tags.jsx
gauthamzz/gatsby-site
8ad0f2ee8f694a3d3ef0fbfc97ebcad00d2a3153
[ "MIT" ]
15
2018-10-17T10:17:06.000Z
2021-09-20T23:02:33.000Z
src/pages/tags.jsx
gauthamzz/gatsby-site
8ad0f2ee8f694a3d3ef0fbfc97ebcad00d2a3153
[ "MIT" ]
2
2018-10-17T09:53:36.000Z
2019-08-11T12:31:09.000Z
import React from 'react' import Link from 'gatsby-link' import Helmet from 'react-helmet' import kebabCase from 'lodash/kebabCase' import Sidebar from '../components/Sidebar' class TagsRoute extends React.Component { render() { const { title } = this.props.data.site.siteMetadata const tags = this.props.data.allMarkdownRemark.group return ( <div> <Helmet title={`All Tags - ${title}`} /> <Sidebar {...this.props} /> <div className="content"> <div className="content__inner"> <div className="page"> <h1 className="page__title">Tags</h1> <div className="page__body"> <div className="tags"> <ul className="tags__list"> {tags.map(tag => ( <li key={tag.fieldValue} className="tags__list-item"> <Link to={`/tags/${kebabCase(tag.fieldValue)}/`} className="tags__list-item-link" > {tag.fieldValue} ({tag.totalCount}) </Link> </li> ))} </ul> </div> </div> </div> </div> </div> </div> ) } } export default TagsRoute export const pageQuery = graphql` query TagsQuery { site { siteMetadata { title subtitle copyright menu { label path } author { name email telegram twitter github rss vk } } } allMarkdownRemark( limit: 2000 filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } } ) { group(field: frontmatter___tags) { fieldValue totalCount } } } `
24.493671
78
0.459948
false
true
true
false