{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n \n );\n }\n}\n"}}},{"rowIdx":1113,"cells":{"path":{"kind":"string","value":"docs/src/pages/components/menus/CustomizedMenus.js"},"repo_name":{"kind":"string","value":"lgollut/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport InboxIcon from '@material-ui/icons/MoveToInbox';\nimport DraftsIcon from '@material-ui/icons/Drafts';\nimport SendIcon from '@material-ui/icons/Send';\n\nconst StyledMenu = withStyles({\n paper: {\n border: '1px solid #d3d4d5',\n },\n})((props) => (\n \n));\n\nconst StyledMenuItem = withStyles((theme) => ({\n root: {\n '&:focus': {\n backgroundColor: theme.palette.primary.main,\n '& .MuiListItemIcon-root, & .MuiListItemText-primary': {\n color: theme.palette.common.white,\n },\n },\n },\n}))(MenuItem);\n\nexport default function CustomizedMenus() {\n const [anchorEl, setAnchorEl] = React.useState(null);\n\n const handleClick = (event) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n return (\n
\n \n Open Menu\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n );\n}\n"}}},{"rowIdx":1114,"cells":{"path":{"kind":"string","value":"src/js/components/input-ssn.js"},"repo_name":{"kind":"string","value":"training4developers/react_redux_12122016"},"content":{"kind":"string","value":"import React from 'react';\n\n\nexport class InputSSN extends React.Component {\n\n\tstatic propTypes = {\n\t\tonChange: React.PropTypes.func,\n\t\tvalue: React.PropTypes.string,\n\t\tname: React.PropTypes.string\n\t};\n\n\tonChange = (e) => {\n\t\te.target.value = e.target.value.replace('-', '');\n\t\te.target.value = e.target.value.replace('-', '');\n\t\te.target.value = e.target.value.slice(0, 9);\n\t\tthis.props.onChange(e);\n\t}\n\n\trender() {\n\n\t\tlet ssn = this.props.value;\n\n\t\tif (ssn.length > 2) {\n\t\t\tssn = ssn.slice(0,3) + '-' + ssn.slice(3);\n\t\t}\n\n\t\tif (ssn.length > 5) {\n\t\t\tssn = ssn.slice(0,6) + '-' + ssn.slice(6);\n\t\t}\t\t\n\n\t\treturn ;\n\n\t}\n\n}"}}},{"rowIdx":1115,"cells":{"path":{"kind":"string","value":"src/components/migration/Migrate2.js"},"repo_name":{"kind":"string","value":"safex/safex_wallet"},"content":{"kind":"string","value":"import React from 'react';\n\nimport {createSafexAddress, verify_safex_address, structureSafexKeys} from '../../utils/migration';\nimport {openMigrationAlert, closeMigrationAlert} from '../../utils/modals';\n\nconst fs = window.require('fs');\nimport {encrypt} from \"../../utils/utils\";\nimport MigrationAlert from \"../migration//partials/MigrationAlert\";\n\nvar swg = window.require('safex-addressjs');\nconst fileDownload = require('react-file-download');\n\n//Set the Safex Address\nexport default class Migrate2 extends React.Component {\n constructor(props) {\n super(props);\n this.state =\n {\n loading: true,\n status_text: \"\",\n create_address: false,\n safex_address: \"\",\n safex_spend_pub: \"\",\n safex_spend_sec: \"\",\n safex_view_pub: \"\",\n safex_view_sec: \"\",\n safex_checksum: \"\",\n safex_key: {},\n safex_keys: {},\n migration_alert: false,\n migration_alert_text: '',\n all_field_filled: false,\n used_addresses: false,\n existing_addresses: false,\n };\n\n this.setSafexAddress = this.setSafexAddress.bind(this);\n this.createSafexKey = this.createSafexKey.bind(this);\n this.saveSafexKeys = this.saveSafexKeys.bind(this);\n this.setYourKeys = this.setYourKeys.bind(this);\n this.selectKey = this.selectKey.bind(this);\n this.setOpenMigrationAlert = this.setOpenMigrationAlert.bind(this);\n this.setCloseMigrationAlert = this.setCloseMigrationAlert.bind(this);\n this.startOver = this.startOver.bind(this);\n this.checkFields = this.checkFields.bind(this);\n this.usedAddresses = this.usedAddresses.bind(this);\n this.existingAddresses = this.existingAddresses.bind(this);\n this.exportNewWalletAddress = this.exportNewWalletAddress.bind(this);\n }\n\n componentDidMount() {\n try {\n var json = JSON.parse(localStorage.getItem('wallet'));\n } catch (e) {\n this.setOpenMigrationAlert('Error parsing the wallet data.');\n }\n this.setState({\n safex_keys: json.safex_keys,\n loading: false\n })\n }\n\n setSafexAddress(e) {\n e.preventDefault();\n }\n\n //generates a new random safex key set\n createSafexKey() {\n this.setState({create_address: true, loading: true});\n\n const safex_keys = createSafexAddress();\n localStorage.setItem('new_wallet_address', JSON.stringify(safex_keys));\n\n this.setState({\n safex_key: safex_keys,\n safex_address: safex_keys.public_addr,\n safex_spend_pub: safex_keys.spend.pub,\n safex_spend_sec: safex_keys.spend.sec,\n safex_view_pub: safex_keys.view.pub,\n safex_view_sec: safex_keys.view.sec,\n loading: false,\n });\n }\n\n //use this after safex keys were generated\n saveSafexKeys() {\n //in here do the logic for modifying the wallet file data info\n try {\n var json = JSON.parse(localStorage.getItem('wallet'));\n } catch (e) {\n this.setOpenMigrationAlert('Error parsing the wallet data.');\n }\n\n if (json.hasOwnProperty('safex_keys')) {\n json['safex_keys'].push(this.state.safex_key);\n } else {\n json['safex_keys'] = [];\n json['safex_keys'].push(this.state.safex_key);\n }\n\n var index = -1;\n\n for (var key in json.keys) {\n if (json.keys[key].public_key === this.props.data.address) {\n index = key;\n json.keys[key]['migration_data'] = {};\n json.keys[key]['migration_data'].safex_keys = this.state.safex_key;\n json.keys[key].migration_progress = 2;\n\n }\n }\n\n var algorithm = 'aes-256-ctr';\n var password = localStorage.getItem('password');\n var cipher_text = encrypt(JSON.stringify(json), algorithm, password);\n\n fs.writeFile(localStorage.getItem('wallet_path'), cipher_text, (err) => {\n if (err) {\n console.log('Problem communicating to the wallet file.');\n this.setOpenMigrationAlert('Problem communicating to the wallet file.');\n } else {\n try {\n localStorage.setItem('wallet', JSON.stringify(json));\n var json2 = JSON.parse(localStorage.getItem('wallet'));\n console.log(json2.keys[index].migration_data);\n this.exportNewWalletAddress();\n this.props.setMigrationProgress(2);\n } catch (e) {\n console.log(e);\n this.setOpenMigrationAlert('An error adding a key to the wallet. Please contact team@safex.io');\n }\n }\n });\n }\n\n //use this if the keys are provided by the user\n setYourKeys(e) {\n e.preventDefault();\n if (e.target.spend_key.value === '' || e.target.view_key.value === '' || e.target.safex_address.value === '') {\n this.setOpenMigrationAlert('Fill out all the fields');\n } else {\n\n let duplicate = false;\n\n //here check for duplicates\n for (var key in this.state.safex_keys) {\n console.log(this.state.safex_keys[key].spend.sec)\n if (this.state.safex_keys[key].spend.sec === e.target.spend_key.value &&\n this.state.safex_keys[key].view.sec === e.target.view_key.value &&\n this.state.safex_keys[key].public_addr === e.target.safex_address.value) {\n duplicate = true;\n console.log(\"duplicate detected\")\n }\n }\n\n\n\n if (verify_safex_address(e.target.spend_key.value,\n e.target.view_key.value,\n e.target.safex_address.value)) {\n const safex_keys = structureSafexKeys(e.target.spend_key.value, e.target.view_key.value);\n\n try {\n var json = JSON.parse(localStorage.getItem('wallet'));\n } catch (e) {\n console.log('Error parsing the wallet data.');\n this.setOpenMigrationAlert('Error parsing the wallet data.');\n }\n if (json.hasOwnProperty('safex_keys') && duplicate === false) {\n json['safex_keys'].push(safex_keys);\n } else if (duplicate === false) {\n json['safex_keys'] = [];\n json['safex_keys'].push(safex_keys);\n }\n\n var index = -1;\n\n for (var key in json.keys) {\n if (json.keys[key].public_key === this.props.data.address) {\n index = key;\n json.keys[key]['migration_data'] = {};\n json.keys[key]['migration_data'].safex_keys = safex_keys;\n json.keys[key].migration_progress = 2;\n }\n }\n\n var algorithm = 'aes-256-ctr';\n var password = localStorage.getItem('password');\n var cipher_text = encrypt(JSON.stringify(json), algorithm, password);\n\n fs.writeFile(localStorage.getItem('wallet_path'), cipher_text, (err) => {\n if (err) {\n console.log('Problem communicating to the wallet file.');\n this.setOpenMigrationAlert('Problem communicating to the wallet file.');\n } else {\n try {\n localStorage.setItem('wallet', JSON.stringify(json));\n this.setState({\n safex_key: safex_keys,\n safex_address: safex_keys.public_addr,\n safex_spend_pub: safex_keys.spend.pub,\n safex_spend_sec: safex_keys.spend.sec,\n safex_view_pub: safex_keys.view.pub,\n safex_view_sec: safex_keys.view.sec,\n loading: false,\n });\n this.props.setMigrationProgress(2);\n } catch (e) {\n console.log(e);\n this.setOpenMigrationAlert('An error adding a key to the wallet. Please contact team@safex.io');\n }\n }\n });\n } else {\n console.log('Incorrect keys');\n this.setOpenMigrationAlert('Incorrect keys or duplicate');\n }\n }\n }\n\n //use this for selected key from dropdown menu\n selectKey(e) {\n e.preventDefault();\n if (e.target.address_selection.value.length > 0) {\n try {\n var json = JSON.parse(localStorage.getItem('wallet'));\n } catch (e) {\n console.log('Error parsing the wallet data.');\n this.setOpenMigrationAlert('Error parsing the wallet data.');\n }\n\n var key_index = -1;\n var x_index = -1;\n\n for (var key in json.keys) {\n if (json.keys[key].public_key === this.props.data.address) {\n key_index = key;\n for (var x_key in json.safex_keys) {\n if (json.safex_keys[x_key].public_addr === e.target.address_selection.value) {\n x_index = x_key;\n json.keys[key_index]['migration_data'] = {};\n json.keys[key_index]['migration_data'].safex_keys = json.safex_keys[x_index];\n json.keys[key_index].migration_progress = 2;\n }\n }\n }\n }\n\n if (x_index != -1 && key_index != -1) {\n var algorithm = 'aes-256-ctr';\n var password = localStorage.getItem('password');\n var cipher_text = encrypt(JSON.stringify(json), algorithm, password);\n\n fs.writeFile(localStorage.getItem('wallet_path'), cipher_text, (err) => {\n if (err) {\n this.setOpenMigrationAlert('Problem communicating to the wallet file.');\n } else {\n try {\n localStorage.setItem('wallet', JSON.stringify(json));\n var json2 = JSON.parse(localStorage.getItem('wallet'));\n this.setState({\n safex_key: json2.safex_keys[x_index],\n safex_address: json2.safex_keys[x_index].public_addr,\n safex_spend_pub: json2.safex_keys[x_index].spend.pub,\n safex_spend_sec: json2.safex_keys[x_index].spend.sec,\n safex_view_pub: json2.safex_keys[x_index].view.pub,\n safex_view_sec: json2.safex_keys[x_index].view.sec,\n loading: false,\n });\n this.props.setMigrationProgress(2);\n } catch (e) {\n console.log(e);\n this.setOpenMigrationAlert('An error adding a key to the wallet. Please contact team@safex.io');\n }\n }\n });\n } else {\n console.log('Key does not exist');\n this.setOpenMigrationAlert('Key does not exist');\n }\n } else {\n console.log('No key from your list has been selected');\n this.setOpenMigrationAlert('No key from your list has been selected');\n }\n }\n\n startOver() {\n this.setState({\n create_address: false,\n used_addresses: false,\n existing_addresses: false,\n all_field_filled: false,\n })\n }\n\n setOpenMigrationAlert(message) {\n openMigrationAlert(this, message);\n }\n\n setCloseMigrationAlert() {\n closeMigrationAlert(this);\n }\n\n checkFields() {\n var safex_address = document.getElementById('safex_address').value;\n var spend_key = document.getElementById('spend_key').value;\n var view_key = document.getElementById('view_key').value;\n\n if (safex_address !== '' && spend_key !== '' && view_key !== '') {\n this.setState({\n all_field_filled: true\n })\n } else {\n this.setState({\n all_field_filled: false\n })\n }\n }\n\n usedAddresses() {\n this.setState({\n used_addresses: true\n })\n }\n\n existingAddresses() {\n this.setState({\n existing_addresses: true\n })\n }\n\n exportNewWalletAddress() {\n var wallet_data = JSON.parse(localStorage.getItem('new_wallet_address'));\n var new_wallet = \"\";\n\n new_wallet += \"Public address: \" + wallet_data.public_addr + '\\n';\n new_wallet += \"Spendkey \" + '\\n';\n new_wallet += \"pub: \" + wallet_data.spend.pub + '\\n';\n new_wallet += \"sec: \" + wallet_data.spend.sec + '\\n';\n new_wallet += \"Viewkey \" + '\\n';\n new_wallet += \"pub: \" + wallet_data.view.pub + '\\n';\n new_wallet += \"sec: \" + wallet_data.view.sec + '\\n';\n var date = Date.now();\n\n fileDownload(new_wallet, date + 'new_wallet_address.txt');\n }\n\n render() {\n var options = [];\n if (this.state.safex_keys) {\n Object.keys(this.state.safex_keys).map(key => {\n options.push(\n \n {this.state.safex_keys[key].public_addr}\n )\n });\n }\n\n return (\n
\n

Step 2/4 - Selecting The Safex Key

\n {\n this.state.create_address\n ?\n
\n
\n
\n \"New\n
\n
\n

Migrate to new Safex address

\n
\n
\n

\n The following wallet information is to control your coins, do not share it.
\n Sharing this information can and will result in total loss of your Safex Tokens and\n Safex Cash.
\n Keep this information safe at all times!\n

\n

Wallet Address

\n \n {/*

{this.state.safex_address}

*/}\n

Spend Key

\n

public: {this.state.safex_spend_pub}

\n

secret: {this.state.safex_spend_sec}

\n

View key

\n

public: {this.state.safex_view_pub}

\n

secret: {this.state.safex_view_sec}

\n\n \n \n
\n :\n
\n {\n this.state.used_addresses\n ?\n
\n
\n
\n \"My\n
\n
\n

Your previously used Safex addresses

\n
\n
\n
\n \n \n
\n \n
\n :\n
\n {\n this.state.existing_addresses\n ?\n
\n
\n
\n \"Enter\n
\n
\n

Migration using my existing Safex\n address

\n
\n
\n\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n\n Set\n your address\n \n \n \n
\n :\n
\n
\n
\n \n \"Cube\"/\n New Address\n \n

Create new address

\n
\n
\n \n

Previously used address

\n
\n
\n \n

Use My Safex address

\n
\n
\n
\n }\n
\n }\n
\n }\n\n \n
\n )\n }\n}"}}},{"rowIdx":1116,"cells":{"path":{"kind":"string","value":"app/routes.js"},"repo_name":{"kind":"string","value":"ideal-life-generator/react-full-stack-starter"},"content":{"kind":"string","value":"import React from 'react';\nimport { IndexRoute, Route } from 'react-router';\nimport { routerActions } from 'react-router-redux';\nimport { UserAuthWrapper } from 'redux-auth-wrapper';\nimport Root from './containers/Root';\nimport Home from './containers/Home';\nimport Users from './containers/Users';\nimport Login from './containers/Login';\nimport Signup from './containers/Signup';\nimport Profile from './containers/Profile';\n\nconst UserIsAuthenticated = UserAuthWrapper({\n authSelector: ({ user }) => user,\n predicate: ({ isAuthenticated }) => isAuthenticated,\n redirectAction: routerActions.replace,\n wrapperDisplayName: 'UserIsAuthenticated',\n});\n\nconst UserIsNotAuthenticated = UserAuthWrapper({\n authSelector: ({ user }) => user,\n predicate: ({ isAuthenticated }) => !isAuthenticated,\n redirectAction: routerActions.replace,\n wrapperDisplayName: 'UserIsNotAuthenticated',\n failureRedirectPath: (state, ownProps) => ownProps.location.query.redirect || '/',\n allowRedirectBack: false,\n});\n\nexport default (\n \n \n \n \n \n \n \n);\n\n// https://github.com/acdlite/redux-router\n"}}},{"rowIdx":1117,"cells":{"path":{"kind":"string","value":"lib/components/ErrorPage.js"},"repo_name":{"kind":"string","value":"hanford/filepizza"},"content":{"kind":"string","value":"import ErrorStore from '../stores/ErrorStore'\nimport React from 'react'\nimport Spinner from './Spinner'\n\nexport default class ErrorPage extends React.Component {\n\n constructor() {\n super()\n this.state = ErrorStore.getState()\n\n this._onChange = () => {\n this.setState(ErrorStore.getState())\n }\n }\n\n componentDidMount() {\n ErrorStore.listen(this._onChange)\n }\n\n componentDidUnmount() {\n ErrorStore.unlisten(this._onChange)\n }\n\n render() {\n return
\n\n \n\n

FilePizza

\n

\n {this.state.status}: {this.state.message}\n

\n\n {this.state.stack\n ?
{this.state.stack}
\n : null}\n\n
\n }\n\n}\n"}}},{"rowIdx":1118,"cells":{"path":{"kind":"string","value":"imports/ui/components/resident-details/accounts/private-account/edit-pa-bill/continuation.js"},"repo_name":{"kind":"string","value":"gagpmr/app-met"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { browserHistory } from 'react-router';\nimport * as Styles from '/imports/modules/styles.js';\nimport { UpdateResident } from '/imports/api/residents/methods.js';\n\nvar DatePicker = require('react-datepicker');\nvar moment = require('moment');\nrequire('/imports/ui/layouts/react-datepicker.css');\n\nexport class ContinuationTableBody extends React.Component {\n constructor(props) {\n super(props);\n this.keyPressed = this.keyPressed.bind(this);\n this.alterPaid = this.alterPaid.bind(this);\n this.submitForm = this.submitForm.bind(this);\n this.changeStartDate = this.changeStartDate.bind(this);\n this.changeEndDate = this.changeEndDate.bind(this);\n this.state = {\n IsPaid: null,\n StartDate: null,\n EndDate: null\n };\n }\n\n keyPressed(event) {\n if (event.key === \"Enter\") {\n this.submitForm(event);\n }\n }\n\n submitForm(e) {\n e.preventDefault();\n var startdate = moment.utc().utcOffset(+ 5.5).format('DD-MM-YYYY');\n var enddate = moment.utc().utcOffset(+ 5.5).format('DD-MM-YYYY');\n if (this.state.StartDate !== null) {\n startdate = this.state.StartDate.format('DD-MM-YYYY');\n } else {\n startdate = moment(this.props.bill.StartDate).format('DD-MM-YYYY');\n }\n if (this.state.EndDate !== null) {\n enddate = this.state.EndDate.format('DD-MM-YYYY');\n } else {\n enddate = moment(this.props.bill.EndDate).format('DD-MM-YYYY');\n }\n var paid = $('#IsPaid').is(\":checked\");\n if (this.props.resident && this.props.bill) {\n var residentId = this.props.resident._id;\n var data = {\n ResidentId: residentId,\n PaBillId: this.props.bill._id,\n StartDate: startdate,\n EndDate: enddate,\n EditPaContinuationBill: true,\n IsPaid: paid\n }\n UpdateResident.call({ data: data });\n browserHistory.push('/resident-details/' + residentId);\n }\n }\n\n alterPaid(e) {\n if (e.target.checked) {\n this.setState({ IsPaid: true });\n }\n if (!e.target.checked) {\n this.setState({ IsPaid: false });\n }\n }\n\n changeStartDate(date) {\n this.setState({ StartDate: date });\n }\n\n changeEndDate(date) {\n this.setState({ EndDate: date });\n }\n\n render() {\n var startdate = null;\n var enddate = null;\n var ispaid = null;\n if (this.props.bill !== undefined) {\n ispaid = this.props.bill.IsPaid;\n }\n if (this.state.StartDate !== null) {\n startdate = this.state.StartDate;\n } else {\n startdate = moment.utc().utcOffset(+ 5.5);\n }\n if (this.state.EndDate !== null) {\n enddate = this.state.EndDate;\n } else {\n enddate = moment.utc().utcOffset(+ 5.5);\n }\n return (\n \n \n Start Date\n \n \n \n \n \n End Date\n \n \n \n \n \n Is Paid\n \n \n \n \n \n \n Save\n \n \n \n )\n }\n }\n\nContinuationTableBody.propTypes = {\n bill: React.PropTypes.object,\n resident: React.PropTypes.object\n };\n"}}},{"rowIdx":1119,"cells":{"path":{"kind":"string","value":"public/js/components/user_instructor.js"},"repo_name":{"kind":"string","value":"AC287/wdi_final_arrowlense2.0_FE"},"content":{"kind":"string","value":"import React from 'react'\nimport {Link} from 'react-router'\nimport Firebase from 'firebase'\n\nimport EditImgUrl from './user_img_edit.js'\nimport CreateClass from './class_new.js'\n\nexport default React.createClass({\n contextTypes: {\n user: React.PropTypes.string,\n userid: React.PropTypes.string,\n userinfo: React.PropTypes.object,\n classes: React.PropTypes.object,\n router: React.PropTypes.object.isRequired,\n },\n\n renderClasses: function(key) {\n return(\n \n )\n },\n\n filterActive: function(key){\n return this.context.classes[key].active===true\n },\n\n filterInactive: function(key){\n return this.context.classes[key].active===false\n },\n\n render: function(){\n\n return(\n
\n
\n
\n \n
\n
\n \n
\n
\n

Name: {this.context.userinfo.firstname} {this.context.userinfo.lastname}

\n

Email: {this.context.userinfo.email}

\n

Instructor ID: {this.context.userinfo.instructorid}

\n
\n
\n \n \n
\n
\n
\n
\n
\n

My Classes

\n
\n
\n
\n

Active

\n
\n {Object.keys(this.context.classes)\n .filter(this.filterActive)\n .map(this.renderClasses)}\n
\n
\n
\n

Inactive

\n
\n {Object.keys(this.context.classes)\n .filter(this.filterInactive)\n .map(this.renderClasses)}\n
\n
\n
\n
\n
\n )\n }\n})\n\nconst Classes = React.createClass({\n render: function(){\n return(\n \n
\n
\n

{this.props.details.name}

\n
\n
\n

{this.props.details.semester} {this.props.details.year}

\n
\n
\n

{this.props.details.description}

\n
\n
\n \n )\n }\n})\n"}}},{"rowIdx":1120,"cells":{"path":{"kind":"string","value":"test/test_helper.js"},"repo_name":{"kind":"string","value":"Eleutherado/ReactBasicBlog"},"content":{"kind":"string","value":"import _$ from 'jquery';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport TestUtils from 'react-addons-test-utils';\nimport jsdom from 'jsdom';\nimport chai, { expect } from 'chai';\nimport chaiJquery from 'chai-jquery';\nimport { Provider } from 'react-redux';\nimport { createStore } from 'redux';\nimport reducers from '../src/reducers';\n\nglobal.document = jsdom.jsdom('');\nglobal.window = global.document.defaultView;\nglobal.navigator = global.window.navigator;\nconst $ = _$(window);\n\nchaiJquery(chai, chai.util, $);\n\nfunction renderComponent(ComponentClass, props = {}, state = {}) {\n const componentInstance = TestUtils.renderIntoDocument(\n \n \n \n );\n\n return $(ReactDOM.findDOMNode(componentInstance));\n}\n\n$.fn.simulate = function(eventName, value) {\n if (value) {\n this.val(value);\n }\n TestUtils.Simulate[eventName](this[0]);\n};\n\nexport {renderComponent, expect};\n"}}},{"rowIdx":1121,"cells":{"path":{"kind":"string","value":"packages/mineral-ui-icons/src/IconVerticalAlignTop.js"},"repo_name":{"kind":"string","value":"mineral-ui/mineral-ui"},"content":{"kind":"string","value":"/* @flow */\nimport React from 'react';\nimport Icon from 'mineral-ui/Icon';\n\nimport type { IconProps } from 'mineral-ui/Icon/types';\n\n/* eslint-disable prettier/prettier */\nexport default function IconVerticalAlignTop(props: IconProps) {\n const iconProps = {\n rtl: false,\n ...props\n };\n\n return (\n \n \n \n \n \n );\n}\n\nIconVerticalAlignTop.displayName = 'IconVerticalAlignTop';\nIconVerticalAlignTop.category = 'editor';\n"}}},{"rowIdx":1122,"cells":{"path":{"kind":"string","value":"example/app/src/index.js"},"repo_name":{"kind":"string","value":"aurbano/react-ds"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './example.css';\nimport './react-ds.css';\nimport Examples from './Examples';\nimport registerServiceWorker from './registerServiceWorker';\n\nReactDOM.render(, document.getElementById('root'));\nregisterServiceWorker();\n"}}},{"rowIdx":1123,"cells":{"path":{"kind":"string","value":"src/components/Main1.js"},"repo_name":{"kind":"string","value":"chris-deng/gallery-by-react"},"content":{"kind":"string","value":"/**\n * Created by dengbingyu on 2016/10/28.\n */\nrequire('normalize.css/normalize.css');\nrequire('styles/App.scss');\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n//获取图片相关的数据\nlet imageDatas = require('json!../data/imageDatas.json');\n\n\nimageDatas = ((imageDatasArr)=>{ // 将图片的url加入的图片object数组中\n for(var i=0,len=imageDatasArr.length;i Math.floor(Math.random()*(high-low)+low);\n\n// 拿到0-30度角里面的随机角度值\nvar getRandomRotate = ()=> {\n return (Math.random()>0.5?'':'-') + Math.ceil(Math.random()*30);\n};\n\n// 创建单个图片组件\nclass SingleImgComp extends React.Component {\n constructor(props){\n super(props);\n this.handleClick=this.handleClick.bind(this); // 坑,为什么呢?\n }\n // 图片翻转点击事件\n handleClick(e){\n\n this.props.inverse(); // 执行翻转动作\n\n e.stopPropagation();\n e.preventDefault();\n }\n render(){\n let styleObj = {}; // 样式对象\n\n if(this.props.arragneStyle.pos){\n styleObj = this.props.arragneStyle.pos;\n }\n if(this.props.arragneStyle.rotate){\n // ['-webkit-','-moz-','-o-',''].forEach((value)=>{\n // styleObj[value+'transform'] = 'rotate(' + this.props.arragneStyle.rotate + 'deg)';\n // });\n styleObj['transform'] = 'rotate(' + this.props.arragneStyle.rotate + 'deg)';\n }\n\n var figureClassName = 'img-figure';\n figureClassName += this.props.arragneStyle.isInverse?' is-Inverse':'';\n return (\n
\n {this.props.data.title}\n
\n

{this.props.data.title}

\n
\n

{this.props.data.desc}

\n
\n
\n
\n );\n }\n}\n\n\nclass GalleryByReactApp extends React.Component {\n constructor(props){\n super(props);\n\n this.Constant = { // 初始化每张图片的坐标范围,用于盛放各个分区的坐标范围\n centerPos: {\n left:0,\n top:0\n },\n hsec:{ // 水平区域坐标\n hLeftSecX:[0,0], // 水平区域左分区x轴的坐标范围\n hRightSecX:[0,0], // 水平区域右分区x轴的坐标范围\n hY: [0,0] // 水平区域y的取值相同\n },\n vsec:{ // 垂直方向只有上分区\n leftX: [0,0],\n topY: [0,0]\n }\n };\n this.state = { // 真正的图片坐标\n imgsArrangeArr: [ // 图片坐标数组\n // {\n // pos:{\n // top:0,\n // left:0\n // },\n // rotate:0,\n // isInverse: false // 是否翻转\n // }\n ]\n };\n }\n\n inverse(index){ // 翻转图片的函数\n return () => {\n let imgsArrangeArr = this.state.imgsArrangeArr;\n imgsArrangeArr[index].isInverse = !imgsArrangeArr[index].isInverse;\n\n this.setState({\n imgsArrangeArr: imgsArrangeArr\n });\n }\n }\n\n // 布局页面图片的坐标\n rearrange(centerIndex){\n let arrangeImgArr = this.state.imgsArrangeArr,\n Constant = this.Constant,\n centerPos = Constant.centerPos,\n hLeftSecRangeX = Constant.hsec.hLeftSecX,\n hRightSecRangeX = Constant.hsec.hRightSecX,\n hY = Constant.hsec.hY,\n vLeftX = Constant.vsec.leftX, // 上分区\n vTopY = Constant.vsec.topY;\n\n // 根据居中图片的下标,插入中心图片的坐标\n let centerImgPosArr = arrangeImgArr.splice(centerIndex,1); // 取出了中心图片的元素\n centerImgPosArr[0] = {\n pos : centerPos // 将中心图片的坐标插入,居中的图片不需要旋转\n };\n\n // 上分区图片位置\n let imgTopArr = [], //用于放置上分区图片\n topNum = Math.floor(Math.random()*2); // 上分区图片的个数,0或者1\n\n let topImgIndex = Math.floor(Math.random()*(arrangeImgArr.length - topNum)); // 随机取出放置在上分区图片的下标\n imgTopArr = arrangeImgArr.splice(topImgIndex,topNum); // 位于上分区的图片数组\n\n imgTopArr && imgTopArr.forEach((value,index)=>{ // 填充上分区图片的位置信息\n imgTopArr[index] = {\n pos:{\n top: getRandomPos(vTopY[0],vTopY[1]),\n left: getRandomPos(vLeftX[0],vLeftX[1])\n },\n rotate: getRandomRotate()\n }\n });\n\n // 左分区和右分区图片位置信息\n for (let i=0,len=arrangeImgArr.length,k=len/2;i{\n if(!this.state.imgsArrangeArr[index]){ // 如果对应下标中午位置信息,则填充\n this.state.imgsArrangeArr[index] = {\n pos: {\n left:0,\n top:0\n },\n rotate:0,\n isInverse: false // 默认为正面\n }\n }\n imgFigures.push()\n });\n\n\n return (\n
\n
\n {imgFigures}\n
\n \n
\n );\n }\n}\n\nGalleryByReactApp.defaultProps = {};\n\nexport default GalleryByReactApp;\n"}}},{"rowIdx":1124,"cells":{"path":{"kind":"string","value":"src/javascript/index.js"},"repo_name":{"kind":"string","value":"knowbody/redux-react-router-example-app"},"content":{"kind":"string","value":"import 'babel/polyfill';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport injectTapEventPlugin from 'react-tap-event-plugin';\nimport createHashHistory from 'history/lib/createHashHistory';\nimport Root from './Root';\n\n/*\n Needed for onTouchTap\n Can go away when react 1.0 release\n Check this repo:\n https://github.com/zilverline/react-tap-event-plugin\n*/\ninjectTapEventPlugin();\n\nrender(, document.getElementById('root'));\n"}}},{"rowIdx":1125,"cells":{"path":{"kind":"string","value":"src/index.js"},"repo_name":{"kind":"string","value":"tavofigse/flip-the-reactomster"},"content":{"kind":"string","value":"import React from 'react'\nimport ReactDOM from 'react-dom'\nimport { Provider } from 'react-redux'\nimport { Router, browserHistory } from 'react-router'\nimport { syncHistoryWithStore } from 'react-router-redux'\nimport routes from './routes'\nimport configureStore from './store/configureStore'\nimport './styles/app.scss'\n\nconst store = configureStore()\n\nconst history = syncHistoryWithStore(browserHistory, store)\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n)\n"}}},{"rowIdx":1126,"cells":{"path":{"kind":"string","value":"src/js/components/icons/base/Sync.js"},"repo_name":{"kind":"string","value":"kylebyerly-hp/grommet"},"content":{"kind":"string","value":"// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP\n\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport CSSClassnames from '../../../utils/CSSClassnames';\nimport Intl from '../../../utils/Intl';\nimport Props from '../../../utils/Props';\n\nconst CLASS_ROOT = CSSClassnames.CONTROL_ICON;\nconst COLOR_INDEX = CSSClassnames.COLOR_INDEX;\n\nexport default class Icon extends Component {\n render () {\n const { className, colorIndex } = this.props;\n let { a11yTitle, size, responsive } = this.props;\n let { intl } = this.context;\n\n const classes = classnames(\n CLASS_ROOT,\n `${CLASS_ROOT}-sync`,\n className,\n {\n [`${CLASS_ROOT}--${size}`]: size,\n [`${CLASS_ROOT}--responsive`]: responsive,\n [`${COLOR_INDEX}-${colorIndex}`]: colorIndex\n }\n );\n\n a11yTitle = a11yTitle || Intl.getMessage(intl, 'sync');\n\n const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));\n return ;\n }\n};\n\nIcon.contextTypes = {\n intl: PropTypes.object\n};\n\nIcon.defaultProps = {\n responsive: true\n};\n\nIcon.displayName = 'Sync';\n\nIcon.icon = true;\n\nIcon.propTypes = {\n a11yTitle: PropTypes.string,\n colorIndex: PropTypes.string,\n size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),\n responsive: PropTypes.bool\n};\n\n"}}},{"rowIdx":1127,"cells":{"path":{"kind":"string","value":"src/components/LoginForm/LoginForm.js"},"repo_name":{"kind":"string","value":"TackleboxBeta/betabox-seed"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport { reduxForm, Field, propTypes } from 'redux-form';\nimport loginValidation from './loginValidation';\nimport ValidationInput from '../ValidationInput/ValidationInput';\n\n@reduxForm({\n form: 'login',\n validate: loginValidation\n})\nexport default class LoginForm extends Component {\n static propTypes = {\n ...propTypes\n };\n\n render() {\n const { handleSubmit, error } = this.props;\n\n return (\n
\n \n \n {error &&

{error}

}\n
\n
\n \n
\n \n
\n \n );\n }\n}\n"}}},{"rowIdx":1128,"cells":{"path":{"kind":"string","value":"js/react/catch-of-the-day/node_modules/re-base/examples/github-notetaker/app/components/Notes/Notes.js"},"repo_name":{"kind":"string","value":"austinjalexander/sandbox"},"content":{"kind":"string","value":"import React from 'react';\nimport NotesList from './NotesList';\nimport AddNote from './AddNote';\n\nclass Notes extends React.Component{\n render(){\n return (\n
\n

Notes for {this.props.username}

\n \n \n
\n )\n }\n};\n\nNotes.propTypes = {\n username: React.PropTypes.string.isRequired,\n notes: React.PropTypes.array.isRequired,\n addNote: React.PropTypes.func.isRequired\n};\n\nexport default Notes;\n"}}},{"rowIdx":1129,"cells":{"path":{"kind":"string","value":"src/components/app.js"},"repo_name":{"kind":"string","value":"fab1o/YouTube-Viewer"},"content":{"kind":"string","value":"import React, { Component } from 'react';\n\nexport default class App extends Component {\n render() {\n return (\n
React simple starter
\n );\n }\n}\n"}}},{"rowIdx":1130,"cells":{"path":{"kind":"string","value":"src/containers/CSM/CSM.js"},"repo_name":{"kind":"string","value":"UncleYee/crm-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport ReduxTableSelect from 'components/Form/NoLabel/ReduxTableSelect';\nimport MonthRangePicker from 'components/DatePicker/MonthRangePicker';\nimport {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';\nimport moment from 'moment';\nimport Modal from 'react-bootstrap/lib/Modal';\nimport Button from 'react-bootstrap/lib/Button';\nimport {connect} from 'react-redux';\nimport {getCSMInfo} from 'redux/modules/csm';\n\nconst styles = {\n header: {\n height: 34,\n position: 'relative'\n },\n Menu: {\n left: 20,\n width: 210,\n float: 'left',\n position: 'relative'\n },\n time: {\n width: 200,\n float: 'left'\n },\n div: {\n float: 'none',\n position: 'relative',\n top: 20,\n width: 1200\n },\n root: {\n backgroundColor: 'white',\n width: '100%',\n minHeight: '660px',\n position: 'absolute'\n }\n};\n\n@connect((state) => ({\n csmInfo: state.csm.csmInfo || {},\n}), {\n getCSMInfo,\n})\nexport default class CSM extends React.Component {\n static propTypes = {\n name: React.PropTypes.string,\n csmInfo: React.PropTypes.object,\n getCSMInfo: React.PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n showTips: false,\n startDate: null,\n endDate: null,\n type: 0,\n defaultStart: null,\n defaultEnd: null,\n tableData: [],\n userNumStart: null, // 规模起始值\n userNumEnd: null // 规模最大值\n };\n }\n\n componentWillMount() {\n const nowdays = new Date();\n let year = nowdays.getFullYear();\n let month = nowdays.getMonth();\n if ( month === 0) {\n month = 12;\n year = year - 1;\n }\n if (month < 10) {\n month = '0' + month;\n }\n const myDate = new Date(year, month, 0);\n const lastDay = year + '-' + month + '-' + myDate.getDate();\n const end = moment(new Date(lastDay));\n const start = moment(new Date(lastDay)).add(-6, 'months').add(5, 'days');\n const startDate = moment(start).format('YYYY-MM');\n const endDate = moment(end).format('YYYY-MM');\n this.setState({defaultStart: start, defaultEnd: end, startDate: startDate, endDate: endDate});\n this.props.getCSMInfo(this.state.type, startDate, endDate);\n }\n\n\n // 时间段变化进行查询\n CSMInfo = (start, end) => {\n this.setState({startDate: start, endDate: end});\n this.props.getCSMInfo(this.state.type, this.state.startDate, this.state.endDate, this.state.userNumStart, this.state.userNumEnd);\n }\n\n // type 变化进行查询\n changeValue = (type) => {\n this.setState({type: type});\n this.props.getCSMInfo(type, this.state.startDate, this.state.endDate, this.state.userNumStart, this.state.userNumEnd);\n }\n\n // 规模变化查询\n changeScale = (value) => {\n const getCsmInfo = () => this.props.getCSMInfo(this.state.type, this.state.startDate, this.state.endDate, this.state.userNumStart, this.state.userNumEnd);\n switch (value) {\n case '0':\n this.setState({userNumStart: 1, userNumEnd: 20});\n break;\n case '1':\n this.setState({userNumStart: 21, userNumEnd: 100});\n break;\n case '2':\n this.setState({userNumStart: 101, userNumEnd: 999999});\n break;\n default:\n break;\n }\n // 事件队列 加入最后 等待上面的 setState 完成再执行 不需要使用异步\n setTimeout(getCsmInfo);\n }\n\n defaultMonthRange = () => {\n return {\n start: this.state.defaultStart,\n end: this.state.defaultEnd\n };\n }\n\n close = () => {\n this.setState({showTips: false});\n }\n render() {\n const headConfig = this.props.csmInfo.titles || [];\n const tableData = this.props.csmInfo.rows || [];\n const tableOption = {\n noDataText: '无数据'\n };\n const options = [\n {value: '0', label: '客户总使用次数'},\n {value: '1', label: '客户当月活跃人数'},\n {value: '2', label: '人均使用次数'}\n ];\n const scaleOptions = [\n {value: '0', label: '1 ~ 20人'},\n {value: '1', label: '21 ~ 100人'},\n {value: '2', label: '100人以上'}\n ];\n return (\n
\n \u0005
\n
\n \n
\n {\n
\n \n
\n }\n
\n \n
\n
\n
\n \n 客成经理\n {\n headConfig.map((item, index) => {item.title})\n }\n \n
\n \n \n 请选择结单状态\n \n\n \n 您选择的时间范围有误,时间范围必须在6-12个月之间,请重新选择!\n \n\n \n \n \n \n
\n );\n }\n}\n"}}},{"rowIdx":1131,"cells":{"path":{"kind":"string","value":"app/components/FormMessages/index.js"},"repo_name":{"kind":"string","value":"acebusters/ab-web"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport {\n baseColor,\n black,\n} from '../../variables';\n\nconst FormError = styled.span`\n margin: 0;\n padding: 0.5em 1em;\n font-size: 0.8em;\n font-family: $text-font-stack;\n float: left;\n color: ${baseColor};\n width: 100%;\n`;\n\nconst FormWarning = styled.span`\n margin: 0;\n padding: 0.5em 1em;\n font-size: 0.8em;\n font-family: $text-font-stack;\n float: left;\n color: ${black};\n width: 100%;\n`;\n\nexport function ErrorMessage(props) {\n return (\n \n {props.error}\n \n );\n}\n\nErrorMessage.propTypes = {\n error: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n};\n\nexport function WarningMessage(props) {\n return (\n \n {props.warning}\n \n );\n}\n\nWarningMessage.propTypes = {\n warning: PropTypes.string,\n};\n"}}},{"rowIdx":1132,"cells":{"path":{"kind":"string","value":"todo/src/index.js"},"repo_name":{"kind":"string","value":"iamwangxupeng/react-reflux-webpack-es6"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Todo from './components/todo';\nimport csss from './style/main.css';\n\nReactDOM.render(\n \n ,\n document.querySelector('#app')\n);"}}},{"rowIdx":1133,"cells":{"path":{"kind":"string","value":"src/svg-icons/notification/more.js"},"repo_name":{"kind":"string","value":"ngbrown/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet NotificationMore = (props) => (\n \n \n \n);\nNotificationMore = pure(NotificationMore);\nNotificationMore.displayName = 'NotificationMore';\nNotificationMore.muiName = 'SvgIcon';\n\nexport default NotificationMore;\n"}}},{"rowIdx":1134,"cells":{"path":{"kind":"string","value":"src/views/PointerEventsContainer.js"},"repo_name":{"kind":"string","value":"half-shell/react-navigation"},"content":{"kind":"string","value":"/* @flow */\n\nimport React from 'react';\n\nimport invariant from 'fbjs/lib/invariant';\n\nimport AnimatedValueSubscription from './AnimatedValueSubscription';\n\nimport type {\n NavigationSceneRendererProps,\n} from '../TypeDefinition';\n\ntype Props = NavigationSceneRendererProps;\n\nconst MIN_POSITION_OFFSET = 0.01;\n\n/**\n * Create a higher-order component that automatically computes the\n * `pointerEvents` property for a component whenever navigation position\n * changes.\n */\nexport default function create(\n Component: ReactClass<*>,\n): ReactClass<*> {\n class Container extends React.Component {\n _component: any;\n _onComponentRef: (view: any) => void;\n _onPositionChange: (data: {value: number}) => void;\n _pointerEvents: string;\n _positionListener: ?AnimatedValueSubscription;\n\n props: Props;\n\n constructor(props: Props, context: any) {\n super(props, context);\n this._pointerEvents = this._computePointerEvents();\n }\n\n componentWillMount(): void {\n this._onPositionChange = this._onPositionChange.bind(this);\n this._onComponentRef = this._onComponentRef.bind(this);\n }\n\n componentDidMount(): void {\n this._bindPosition(this.props);\n }\n\n componentWillUnmount(): void {\n this._positionListener && this._positionListener.remove();\n }\n\n componentWillReceiveProps(nextProps: Props): void {\n this._bindPosition(nextProps);\n }\n\n render() {\n this._pointerEvents = this._computePointerEvents();\n return (\n \n );\n }\n\n _onComponentRef(component: any): void {\n this._component = component;\n if (component) {\n invariant(\n typeof component.setNativeProps === 'function',\n 'component must implement method `setNativeProps`',\n );\n }\n }\n\n _bindPosition(props: NavigationSceneRendererProps): void {\n this._positionListener && this._positionListener.remove();\n this._positionListener = new AnimatedValueSubscription(\n props.position,\n this._onPositionChange,\n );\n }\n\n _onPositionChange(): void {\n if (this._component) {\n const pointerEvents = this._computePointerEvents();\n if (this._pointerEvents !== pointerEvents) {\n this._pointerEvents = pointerEvents;\n this._component.setNativeProps({ pointerEvents });\n }\n }\n }\n\n _computePointerEvents(): string {\n const {\n navigationState,\n position,\n scene,\n } = this.props;\n\n if (scene.isStale || navigationState.index !== scene.index) {\n // The scene isn't focused.\n return scene.index > navigationState.index ?\n 'box-only' :\n 'none';\n }\n\n const offset = position.__getAnimatedValue() - navigationState.index;\n if (Math.abs(offset) > MIN_POSITION_OFFSET) {\n // The positon is still away from scene's index.\n // Scene's children should not receive touches until the position\n // is close enough to scene's index.\n return 'box-only';\n }\n\n return 'auto';\n }\n }\n return Container;\n}\n"}}},{"rowIdx":1135,"cells":{"path":{"kind":"string","value":"src/components/Schedule.js"},"repo_name":{"kind":"string","value":"MathMesquita/conf"},"content":{"kind":"string","value":"import React from 'react';\nimport { css } from 'glamor';\nimport Text from './Text';\n\nconst styles = {\n container: css({\n background: '#fff',\n width: '100vw',\n paddingBottom: '2em',\n alignItems: 'center',\n '@media(max-width: 720px)': {\n alignSelf: 'auto',\n },\n }),\n list: css({\n listStyle: 'none',\n padding: 0,\n maxWidth: '1000px',\n margin: '0 auto',\n }),\n disclaimer: css({\n padding: 0,\n maxWidth: '1000px',\n margin: '30px auto',\n textAlign: 'right',\n }),\n event: css({\n display: 'flex',\n borderTop: '1px solid #333',\n padding: '1em 0 0.5em',\n justifyContent: 'space-around',\n ' div': {},\n ' h2': {\n margin: '0 0 0.3em 0',\n ' span': {\n fontSize: '0.7em',\n },\n },\n ' h3': {\n fontWeight: 'lighter',\n fontSize: '1.3em',\n margin: 0,\n },\n }),\n time: css({\n fontSize: '1.7em',\n paddingLeft: '1.3em',\n whiteSpace: 'nowrap',\n }),\n desc: css({\n width: '100%',\n padding: '0.2em 1.3em',\n }),\n};\n\nconst eventsList = [\n {\n title: 'Abertura do Teatro e Credenciamento',\n time: '8:00 am',\n },\n {\n title: 'Welcome Coffee',\n time: '8:30 am',\n },\n {\n title: 'Abertura React Brasil',\n time: '9:00 am',\n },\n {\n title: 'Raphael Amorim',\n description: 'Scratching React Fiber',\n time: '9:10 am',\n },\n {\n title: 'Fernando Daciuk',\n description: 'The magic world of tests with Jest',\n time: '9:40 am',\n },\n {\n title: 'Kete Rufino e Christino Milfont',\n description: 'Transformando um front-end legado em uma React SPA',\n time: '10:10 am',\n },\n {\n title: 'Marcelo Camargo',\n description: \"Let's dive into Babel: How everything works\",\n time: '10:35 am',\n },\n {\n title: 'James Baxley',\n description: 'Statically Typing your GraphQL App',\n time: '10:55 am',\n },\n {\n title: 'Desconferência: Fishbowl',\n time: '11:30 am',\n },\n {\n title: 'Almoço',\n time: '12:00 pm',\n },\n {\n title: 'Clara Battesini',\n description: 'MobX: The light side of the force',\n time: '1:30 pm',\n },\n {\n title: 'Henrique Sosa',\n description: 'Gorgeous Apps with React Motion and Animations',\n time: '1:40 pm',\n },\n {\n title: 'João Gonçalves',\n description: 'Show do Milhão React PWA (Caso de Sucesso)',\n time: '1:50 pm',\n },\n {\n title: 'Raphael Costa',\n description:\n 'Building the Pipefy mobile app in 3 weeks with React Native, GraphQL and Apollo',\n time: '2:00 pm',\n },\n {\n title: 'Sashko Stubailo',\n description: 'The GraphQL and Apollo stack: connecting everything together',\n time: '2:25 pm',\n },\n {\n title: 'Sebastian Ferrari',\n description: 'Why React is good for business',\n time: '3:05 pm',\n },\n {\n title: 'Coffee Break',\n time: '3:30 pm',\n },\n {\n title: 'Matheus Marsiglio',\n description: 'Isomorphic React + Redux App',\n time: '4:00 pm',\n },\n {\n title: 'Matheus Lima',\n description: 'O que tem de Funcional no React',\n time: '4:25 pm',\n },\n {\n title: 'Keuller Magalhães',\n description: 'React Performance from Scratch',\n time: '4:35 pm',\n },\n {\n title: 'Geisy Domiciano',\n description:\n 'Continuos Integration / Continuos Deployment com create-react-app',\n time: '4:45 pm',\n },\n {\n title: 'Sibelius Seraphini',\n description: 'Relay Modern',\n time: '4:55 pm',\n },\n {\n title: 'Desconferência: Fishbowl',\n time: '5:15 pm',\n },\n {\n title: 'Sorteios',\n time: '5:45 pm',\n },\n {\n title: 'Encerramento',\n time: '6:00 pm',\n },\n {\n title: 'AfterParty',\n description: 'Mono Club by An English Thing',\n time: '6:30 pm',\n },\n];\n\nconst Event = ({ title, time, worksIn = false, worksLink, description }) =>\n
  • \n
    \n {time}\n
    \n
    \n

    \n {title}\n {worksIn &&\n \n {worksIn}\n }\n

    \n {description &&\n

    \n {description}\n

    }\n
    \n
  • ;\n\nconst Schedule = ({ events = eventsList }) =>\n
    \n \n
      \n {events.map(event => )}\n
    \n

    Horário sujeito a alteração sem aviso prévio

    \n
    ;\n\nexport default Schedule;\n"}}},{"rowIdx":1136,"cells":{"path":{"kind":"string","value":"app/containers/HomePage/Loadable.js"},"repo_name":{"kind":"string","value":"mxstbr/react-boilerplate"},"content":{"kind":"string","value":"/**\n * Asynchronously loads the component for HomePage\n */\n\nimport React from 'react';\nimport loadable from 'utils/loadable';\nimport LoadingIndicator from 'components/LoadingIndicator';\n\nexport default loadable(() => import('./index'), {\n fallback: ,\n});\n"}}},{"rowIdx":1137,"cells":{"path":{"kind":"string","value":"src/layouts/CoreLayout/CoreLayout.js"},"repo_name":{"kind":"string","value":"joris77/admin-web"},"content":{"kind":"string","value":"import React from 'react'\nimport { Layout, Panel } from 'react-toolbox'\nimport Header from '../../components/Header'\nimport './CoreLayout.scss'\nimport '../../styles/core.scss'\nimport GlobalMessage from 'components/GlobalMessage'\n\nexport const CoreLayout = ({ children }) => (\n \n \n
    \n \n {children}\n \n \n)\n\nexport default CoreLayout\n"}}},{"rowIdx":1138,"cells":{"path":{"kind":"string","value":"src/scenes/SearchScreen/components/RepoSearchBar/index.js"},"repo_name":{"kind":"string","value":"msanatan/GitHubProjects"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport {\n SearchBar,\n} from 'react-native-elements';\n\nexport default class RepoSearchBar extends Component {\n constructor(props) {\n super(props)\n this.handleChangeText = this.handleChangeText.bind(this);\n }\n\n render() {\n return (\n \n );\n }\n\n handleChangeText(newUsername) {\n this.props.onChangeText(newUsername);\n }\n}\n\n"}}},{"rowIdx":1139,"cells":{"path":{"kind":"string","value":"docs/src/app/pages/components/RadioGroup/ExampleRadioGroupDescription.js"},"repo_name":{"kind":"string","value":"GetAmbassador/react-ions"},"content":{"kind":"string","value":"import React from 'react'\nimport RadioGroup from 'react-ions/lib/components/Radio/RadioGroup'\nimport Radio from 'react-ions/lib/components/Radio/Radio'\nimport Input from 'react-ions/lib/components/Input'\nimport style from './style.scss'\n\nconst radioOptions = [\n {\n value: 'welcome_email',\n label: 'Send welcome email',\n description: 'Send an email welcoming your contact to your program.'\n }, {\n value: 'payment_update_email',\n label: 'Send update payment email',\n description: 'Send a payment update email to your contact.'\n }\n]\n\nclass ExampleRadioGroupDescription extends React.Component {\n constructor(props) {\n super(props)\n }\n\n getRadioBlocks = () => {\n return radioOptions.map((option, index) => {\n return \n })\n }\n\n render() {\n return (\n
    \n \n {this.getRadioBlocks()}\n \n
    \n )\n }\n}\n\nexport default ExampleRadioGroupDescription\n"}}},{"rowIdx":1140,"cells":{"path":{"kind":"string","value":"src/calendar/header/index.js"},"repo_name":{"kind":"string","value":"eals/react-native-calender-pn-wix-extended"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport { ActivityIndicator } from 'react-native';\nimport { View, Text, TouchableOpacity, Image } from 'react-native';\nimport XDate from 'xdate';\nimport PropTypes from 'prop-types';\nimport styleConstructor from './style';\nimport { weekDayNames } from '../../dateutils';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport theme from '../../../../../components/theme';\nimport moment from 'moment';\n\n\nclass CalendarHeader extends Component {\n static propTypes = {\n theme: PropTypes.object,\n hideArrows: PropTypes.bool,\n month: PropTypes.instanceOf(XDate),\n addMonth: PropTypes.func,\n showIndicator: PropTypes.bool,\n firstDay: PropTypes.number,\n renderArrow: PropTypes.func,\n hideDayNames: PropTypes.bool,\n };\n\n constructor(props) {\n super(props);\n this.style = styleConstructor(props.theme);\n this.addMonth = this.addMonth.bind(this);\n this.substractMonth = this.substractMonth.bind(this);\n }\n\n nextMonth(next){\n var month = [\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\",\"Jan\"];\n\n return month[next-1];\n }\n\n twoMonth(next){\n var month = [\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\",\"Jan\",\"Feb\"];\n return month[next-1];\n }\n\n addMonth() {\n this.props.addMonth(1);\n }\n\n substractMonth() {\n this.props.addMonth(-1);\n }\n\n shouldComponentUpdate(nextProps) {\n if (\n nextProps.month.toString('yyyy MM') !==\n this.props.month.toString('yyyy MM')\n ) {\n return true;\n }\n if (nextProps.showIndicator !== this.props.showIndicator) {\n return true;\n }\n return false;\n }\n\n render() {\n let leftArrow = ;\n let rightArrow = ;\n let weekDaysNames = weekDayNames(this.props.firstDay);\n if (!this.props.hideArrows) {\n leftArrow = (\n \n {this.props.renderArrow\n ? this.props.renderArrow('left')\n : }\n \n );\n rightArrow = (\n \n {this.props.renderArrow\n ? this.props.renderArrow('right')\n : }\n \n );\n }\n let indicator;\n if (this.props.showIndicator) {\n indicator = ;\n }\n return (\n \n \n \n {leftArrow}\n \n {this.props.month.toString(this.props.monthFormat ? this.props.monthFormat : 'MMM')}\n \n \n {this.nextMonth(this.props.month.toString(this.props.monthFormat ? this.props.monthFormat : 'M'))}\n \n \n {this.twoMonth(this.props.month.toString(this.props.monthFormat ? this.props.monthFormat : 'M'))}\n \n {rightArrow}\n \n \n \n {moment().format(\"MMMM\")}\n \n \n {moment().format(\"DD, YYYY\")}\n \n \n \n \n \n \n \n \n \n {\n !this.props.hideDayNames &&\n \n {weekDaysNames.map((day, idx) => {\n if(moment().format(\"ddd\") == day){\n return(\n \n \n {day.toUpperCase()}\n \n )\n }\n else {\n return(\n \n \n {day.toUpperCase()}\n \n )}\n })}\n \n }\n \n \n );\n }\n}\n\nexport default CalendarHeader;\n"}}},{"rowIdx":1141,"cells":{"path":{"kind":"string","value":"classic/src/scenes/mailboxes/src/Scenes/AppScene/ServiceTab/ServiceInfoDrawer/ServiceInstallInfo.js"},"repo_name":{"kind":"string","value":"wavebox/waveboxapp"},"content":{"kind":"string","value":"import PropTypes from 'prop-types'\nimport React from 'react'\nimport { accountActions, accountStore } from 'stores/account'\nimport { withStyles } from '@material-ui/core/styles'\nimport shallowCompare from 'react-addons-shallow-compare'\nimport DoneIcon from '@material-ui/icons/Done'\nimport ServiceInfoPanelActionButton from 'wbui/ServiceInfoPanelActionButton'\nimport ServiceInfoPanelActions from 'wbui/ServiceInfoPanelActions'\nimport ServiceInfoPanelBody from 'wbui/ServiceInfoPanelBody'\nimport ServiceInfoPanelContent from 'wbui/ServiceInfoPanelContent'\nimport ServiceReducer from 'shared/AltStores/Account/ServiceReducers/ServiceReducer'\nimport ReactMarkdown from 'react-markdown'\nimport WBRPCRenderer from 'shared/WBRPCRenderer'\n\nconst styles = {\n markdown: {\n '& img': {\n maxWidth: '100%'\n }\n },\n buttonIcon: {\n marginRight: 6\n }\n}\n\nclass Link extends React.Component {\n render () {\n const { href, children, ...passProps } = this.props\n return (\n WBRPCRenderer.wavebox.openExternal(href)}>\n {children}\n \n )\n }\n}\n\n@withStyles(styles)\nclass ServiceInstallInfo extends React.Component {\n /* **************************************************************************/\n // Class\n /* **************************************************************************/\n\n static propTypes = {\n serviceId: PropTypes.string.isRequired\n }\n\n /* **************************************************************************/\n // Component Lifecycle\n /* **************************************************************************/\n\n componentDidMount () {\n accountStore.listen(this.accountUpdated)\n }\n\n componentWillUnmount () {\n accountStore.unlisten(this.accountUpdated)\n }\n\n componentWillReceiveProps (nextProps) {\n if (this.props.serviceId !== nextProps.serviceId) {\n this.setState({\n ...this.deriveServiceInfo(nextProps.serviceId, accountStore.getState())\n })\n }\n }\n\n /* **************************************************************************/\n // Data lifecycle\n /* **************************************************************************/\n\n state = (() => {\n return {\n ...this.deriveServiceInfo(this.props.serviceId, accountStore.getState())\n }\n })()\n\n accountUpdated = (accountState) => {\n this.setState({\n ...this.deriveServiceInfo(this.props.serviceId, accountState)\n })\n }\n\n /**\n * Gets the service info from the account state\n * @param serviceId: the id of the service\n * @param accountState: the current account state\n * @return a state update object\n */\n deriveServiceInfo (serviceId, accountState) {\n const service = accountState.getService(serviceId)\n return {\n installText: service ? service.installText : ''\n }\n }\n\n /* **************************************************************************/\n // UI Events\n /* **************************************************************************/\n\n /**\n * Handles a link being clicked\n */\n handleLinkClick = (url, text, title) => {\n WBRPCRenderer.wavebox.openExternal(url)\n }\n\n /* **************************************************************************/\n // Rendering\n /* **************************************************************************/\n\n shouldComponentUpdate (nextProps, nextState) {\n return shallowCompare(this, nextProps, nextState)\n }\n\n render () {\n const {\n serviceId,\n classes,\n ...passProps\n } = this.props\n const {\n installText\n } = this.state\n\n return (\n \n \n \n \n \n {\n accountActions.reduceService(serviceId, ServiceReducer.setHasSeenInstallInfo, true)\n }}>\n \n Done\n \n \n \n )\n }\n}\n\nexport default ServiceInstallInfo\n"}}},{"rowIdx":1142,"cells":{"path":{"kind":"string","value":"MobileApp/node_modules/react-native-elements/src/badge/badge.js"},"repo_name":{"kind":"string","value":"VowelWeb/CoinTradePros.com"},"content":{"kind":"string","value":"import PropTypes from 'prop-types';\nimport React from 'react';\nimport { Text, View, StyleSheet, TouchableOpacity } from 'react-native';\nimport colors from '../config/colors';\n\nconst Badge = props => {\n const {\n containerStyle,\n textStyle,\n wrapperStyle,\n onPress,\n component,\n value,\n children,\n element,\n ...attributes\n } = props;\n\n if (element) return element;\n\n let Component = View;\n let childElement = (\n {value}\n );\n\n if (children) {\n childElement = children;\n }\n\n if (children && value) {\n console.error('Badge can only contain either child element or value');\n }\n\n if (!component && onPress) {\n Component = TouchableOpacity;\n }\n\n if (React.isValidElement(component)) {\n Component = component;\n }\n\n return (\n \n \n {childElement}\n \n \n );\n};\n\nBadge.propTypes = {\n containerStyle: View.propTypes.style,\n wrapperStyle: View.propTypes.style,\n textStyle: Text.propTypes.style,\n children: PropTypes.element,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onPress: PropTypes.func,\n component: PropTypes.func,\n element: PropTypes.element,\n};\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n },\n badge: {\n padding: 12,\n paddingTop: 3,\n paddingBottom: 3,\n backgroundColor: colors.grey1,\n borderRadius: 20,\n alignItems: 'center',\n justifyContent: 'center',\n },\n text: {\n fontSize: 14,\n color: 'white',\n },\n});\n\nexport default Badge;\n"}}},{"rowIdx":1143,"cells":{"path":{"kind":"string","value":"src/svg-icons/action/highlight-off.js"},"repo_name":{"kind":"string","value":"w01fgang/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet ActionHighlightOff = (props) => (\n \n \n \n);\nActionHighlightOff = pure(ActionHighlightOff);\nActionHighlightOff.displayName = 'ActionHighlightOff';\nActionHighlightOff.muiName = 'SvgIcon';\n\nexport default ActionHighlightOff;\n"}}},{"rowIdx":1144,"cells":{"path":{"kind":"string","value":"js/jqwidgets/demos/react/app/kanban/disablecollapse/app.js"},"repo_name":{"kind":"string","value":"luissancheza/sice"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport JqxKanban from '../../../jqwidgets-react/react_jqxkanban.js';\n\nclass App extends React.Component {\n render() {\n let fields = [\n { name: 'id', type: 'string' },\n { name: 'status', map: 'state', type: 'string' },\n { name: 'text', map: 'label', type: 'string' },\n { name: 'tags', type: 'string' },\n { name: 'color', map: 'hex', type: 'string' },\n { name: 'resourceId', type: 'number' }\n ];\n let source =\n {\n localData: [\n { id: '1161', state: 'new', label: 'Make a new Dashboard', tags: 'dashboard', hex: '#36c7d0', resourceId: 3 },\n { id: '1645', state: 'work', label: 'Prepare new release', tags: 'release', hex: '#ff7878', resourceId: 1 },\n { id: '9213', state: 'new', label: 'One item added to the cart', tags: 'cart', hex: '#96c443', resourceId: 3 },\n { id: '6546', state: 'done', label: 'Edit Item Price', tags: 'price, edit', hex: '#ff7878', resourceId: 4 },\n { id: '9034', state: 'new', label: 'Login 404 issue', tags: 'issue, login', hex: '#96c443' }\n ],\n dataType: 'array',\n dataFields: fields\n };\n let dataAdapter = new $.jqx.dataAdapter(source);\n let resourcesAdapterFunc = () => {\n let resourcesSource =\n {\n localData: [\n { id: 0, name: 'No name', image: '../../jqwidgets/styles/images/common.png', common: true },\n { id: 1, name: 'Andrew Fuller', image: '../../images/andrew.png' },\n { id: 2, name: 'Janet Leverling', image: '../../images/janet.png' },\n { id: 3, name: 'Steven Buchanan', image: '../../images/steven.png' },\n { id: 4, name: 'Nancy Davolio', image: '../../images/nancy.png' },\n { id: 5, name: 'Michael Buchanan', image: '../../images/Michael.png' },\n { id: 6, name: 'Margaret Buchanan', image: '../../images/margaret.png' },\n { id: 7, name: 'Robert Buchanan', image: '../../images/robert.png' },\n { id: 8, name: 'Laura Buchanan', image: '../../images/Laura.png' },\n { id: 9, name: 'Laura Buchanan', image: '../../images/Anne.png' }\n ],\n dataType: 'array',\n dataFields: [\n { name: 'id', type: 'number' },\n { name: 'name', type: 'string' },\n { name: 'image', type: 'string' },\n { name: 'common', type: 'boolean' }\n ]\n };\n let resourcesDataAdapter = new $.jqx.dataAdapter(resourcesSource);\n return resourcesDataAdapter;\n }\n\n let columns =\n [\n { text: 'Backlog', dataField: 'new', maxItems: 4 },\n { text: 'In Progress', dataField: 'work', maxItems: 2 },\n { text: 'Done', dataField: 'done', collapsible: false, maxItems: 5 }\n ];\n\n let columnRenderer = (element, collapsedElement, column) => {\n setTimeout(() => {\n let columnItems = this.refs.myKanban.getColumnItems(column.dataField).length;\n // update header's status.\n element.find('.jqx-kanban-column-header-status').html(' (' + columnItems + '/' + column.maxItems + ')');\n // update collapsed header's status.\n collapsedElement.find('.jqx-kanban-column-header-status').html(' (' + columnItems + '/' + column.maxItems + ')');\n });\n };\n return (\n \n )\n }\n}\n\nReactDOM.render(, document.getElementById('app'));"}}},{"rowIdx":1145,"cells":{"path":{"kind":"string","value":"docs/src/app/components/pages/components/DatePicker/ExampleInline.js"},"repo_name":{"kind":"string","value":"IsenrichO/mui-with-arrows"},"content":{"kind":"string","value":"import React from 'react';\nimport DatePicker from 'material-ui/DatePicker';\n\n/**\n * Inline Date Pickers are displayed below the input, rather than as a modal dialog.\n */\nconst DatePickerExampleInline = () => (\n
    \n \n \n
    \n);\n\nexport default DatePickerExampleInline;\n"}}},{"rowIdx":1146,"cells":{"path":{"kind":"string","value":"app/components/Item/Background/Background.js"},"repo_name":{"kind":"string","value":"TriPSs/popcorn-time-desktop"},"content":{"kind":"string","value":"// @flow\nimport React from 'react'\nimport classNames from 'classnames'\n\nimport type { Props } from './BackgroundTypes'\nimport classes from './Background.scss'\n\nexport const Background = ({ backgroundImage }: Props) => (\n \n \n\n
    \n
    \n
    \n)\n\nexport default Background\n"}}},{"rowIdx":1147,"cells":{"path":{"kind":"string","value":"blueprints/view/files/__root__/views/__name__View/__name__View.js"},"repo_name":{"kind":"string","value":"llukasxx/school-organizer-front"},"content":{"kind":"string","value":"import React from 'react'\n\ntype Props = {\n\n};\nexport class <%= pascalEntityName %> extends React.Component {\n props: Props;\n\n render () {\n return (\n
    \n )\n }\n}\n\nexport default <%= pascalEntityName %>\n"}}},{"rowIdx":1148,"cells":{"path":{"kind":"string","value":"actor-apps/app-web/src/app/components/modals/create-group/ContactItem.react.js"},"repo_name":{"kind":"string","value":"Johnnywang1221/actor-platform"},"content":{"kind":"string","value":"import React from 'react';\n\nimport AvatarItem from 'components/common/AvatarItem.react';\n\nclass ContactItem extends React.Component {\n static propTypes = {\n contact: React.PropTypes.object,\n onToggle: React.PropTypes.func\n }\n\n constructor(props) {\n super(props);\n\n this.onToggle = this.onToggle.bind(this);\n this.state = {\n isSelected: false\n };\n }\n\n onToggle() {\n const isSelected = !this.state.isSelected;\n\n this.setState({\n isSelected: isSelected\n });\n\n this.props.onToggle(this.props.contact, isSelected);\n }\n\n render() {\n let contact = this.props.contact;\n\n let icon;\n\n if (this.state.isSelected) {\n icon = 'check_box';\n } else {\n icon = 'check_box_outline_blank';\n }\n\n return (\n
  • \n \n\n
    \n \n {contact.name}\n \n
    \n\n
    \n {icon}\n
    \n
  • \n );\n }\n}\n\nexport default ContactItem;\n"}}},{"rowIdx":1149,"cells":{"path":{"kind":"string","value":"blueocean-material-icons/src/js/components/svg-icons/communication/vpn-key.js"},"repo_name":{"kind":"string","value":"kzantow/blueocean-plugin"},"content":{"kind":"string","value":"import React from 'react';\nimport SvgIcon from '../../SvgIcon';\n\nconst CommunicationVpnKey = (props) => (\n \n \n \n);\nCommunicationVpnKey.displayName = 'CommunicationVpnKey';\nCommunicationVpnKey.muiName = 'SvgIcon';\n\nexport default CommunicationVpnKey;\n"}}},{"rowIdx":1150,"cells":{"path":{"kind":"string","value":"frontend/capitolwords-spa/src/components/HomePage/HomePage.js"},"repo_name":{"kind":"string","value":"propublica/Capitol-Words"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\n\nimport { routeToPhraseSearch } from '../../actions/search-actions';\n\nimport SearchInput from '../SearchInput/SearchInput';\n\nimport './HomePage.css';\n\nimport {\n isSearching,\n isSearchFailure,\n isSearchSuccess,\n searchResultList,\n searchDelta\n} from '../../selectors/phrase-search-selectors';\n\n\nclass HomePage extends Component {\n static propTypes = {\n isSearching: PropTypes.bool.isRequired,\n isSearchFailure: PropTypes.bool.isRequired,\n isSearchSuccess: PropTypes.bool.isRequired,\n searchResultList: PropTypes.array,\n searchDelta: PropTypes.number\n };\n\n render() {\n const { routeToPhraseSearch } = this.props;\n\n return (\n
    \n
    \n

    Capitol Words

    \n

    Dig up some data on the words our legislators use every day.

    \n
    \n
    \n \n
    \n
    \n
    {routeToPhraseSearch('Poverty')}}>Poverty
    \n
    {routeToPhraseSearch('Russian Interference')}}>Russian Interference
    \n
    {routeToPhraseSearch('Education')}}>Education
    \n
    {routeToPhraseSearch('Tax Cuts')}}>Tax Cuts
    \n
    \n
    \n );\n }\n\n}\n\n\nexport default connect(state => ({\n isSearching: isSearching(state),\n isSearchFailure: isSearchFailure(state),\n isSearchSuccess: isSearchSuccess(state),\n searchDelta: searchDelta(state),\n searchResultList: searchResultList(state),\n}),\n{\n routeToPhraseSearch,\n})(HomePage);\n"}}},{"rowIdx":1151,"cells":{"path":{"kind":"string","value":"packages/cf-component-dropdown/src/Dropdown.js"},"repo_name":{"kind":"string","value":"koddsson/cf-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport { canUseDOM } from 'exenv';\nimport { createComponent } from 'cf-style-container';\n\nimport DropdownRegistry from './DropdownRegistry';\n\nconst styles = ({ theme, align }) => ({\n position: 'absolute',\n zIndex: 1,\n minWidth: '10.66667rem',\n margin: '0.5em 0 0',\n padding: '0.33333rem 0',\n listStyle: 'none',\n background: theme.colorWhite,\n border: `1px solid ${theme.colorGrayLight}`,\n borderRadius: theme.borderRadius,\n boxShadow: '0 3px 10px rgba(0, 0, 0, 0.2)',\n\n left: align === 'left' ? 0 : 'initial',\n right: align === 'right' ? 0 : 'initial',\n\n textAlign: theme.textAlign,\n\n animationName: {\n '0%': {\n display: 'none',\n opacity: 0\n },\n '1%': {\n display: 'block',\n opacity: 0,\n top: '80%'\n },\n '100%': {\n display: 'none',\n opacity: 1,\n top: '102%'\n }\n },\n animationDuration: '150ms',\n animationTimingFunction: 'ease-out',\n\n '&::before': {\n content: \"''\",\n display: 'block',\n position: 'absolute',\n bottom: '100%',\n border: 'solid transparent',\n borderWidth: '10px',\n borderTopWidth: 0,\n borderBottomColor: theme.colorWhite,\n left: align === 'left' ? '10px' : 'initial',\n right: align === 'right' ? '10px' : 'initial'\n }\n});\n\nclass Dropdown extends React.Component {\n getChildContext() {\n return {\n dropdownRegistry: this.dropdownRegistry\n };\n }\n\n constructor(props, context) {\n super(props, context);\n this.dropdownRegistry = new DropdownRegistry();\n this.handleDocumentClick = this.handleDocumentClick.bind(this);\n this.handleDocumentKeydown = this.handleDocumentKeydown.bind(this);\n }\n\n componentDidMount() {\n if (canUseDOM) {\n global.document.addEventListener('keydown', this.handleDocumentKeydown);\n global.document.addEventListener('click', this.handleDocumentClick);\n }\n }\n\n componentWillUnmount() {\n if (canUseDOM) {\n global.document.removeEventListener(\n 'keydown',\n this.handleDocumentKeydown\n );\n global.document.removeEventListener('click', this.handleDocumentClick);\n }\n }\n\n handleDocumentKeydown(event) {\n const keyCode = event.keyCode;\n\n if (keyCode === 40) {\n // down\n event.preventDefault();\n this.dropdownRegistry.focusNext();\n } else if (keyCode === 38) {\n // up\n event.preventDefault();\n this.dropdownRegistry.focusPrev();\n } else if (keyCode === 27) {\n // esc\n this.props.onClose();\n }\n }\n\n handleDocumentClick() {\n this.props.onClose();\n }\n\n render() {\n return (\n
      \n {this.props.children}\n
    \n );\n }\n}\n\nDropdown.propTypes = {\n onClose: PropTypes.func.isRequired,\n align: PropTypes.oneOf(['left', 'right']),\n children: PropTypes.node\n};\n\nDropdown.defaultProps = {\n align: 'left'\n};\n\nDropdown.childContextTypes = {\n dropdownRegistry: PropTypes.instanceOf(DropdownRegistry).isRequired\n};\n\nexport default createComponent(styles, Dropdown);\n"}}},{"rowIdx":1152,"cells":{"path":{"kind":"string","value":"app/stories/index.js"},"repo_name":{"kind":"string","value":"atralice/reactDockerizeBoilerplate"},"content":{"kind":"string","value":"import React from 'react';\n\nimport { storiesOf } from '@storybook/react';\nimport { action } from '@storybook/addon-actions';\nimport { linkTo } from '@storybook/addon-links';\n\nimport { Button, Welcome } from '@storybook/react/demo';\n\nstoriesOf('Welcome', module).add('to Storybook', () => );\n\nstoriesOf('Button', module)\n .add('with text', () => )\n .add('with some emoji', () => );\n"}}},{"rowIdx":1153,"cells":{"path":{"kind":"string","value":"packages/mineral-ui-icons/src/IconImageAspectRatio.js"},"repo_name":{"kind":"string","value":"mineral-ui/mineral-ui"},"content":{"kind":"string","value":"/* @flow */\nimport React from 'react';\nimport Icon from 'mineral-ui/Icon';\n\nimport type { IconProps } from 'mineral-ui/Icon/types';\n\n/* eslint-disable prettier/prettier */\nexport default function IconImageAspectRatio(props: IconProps) {\n const iconProps = {\n rtl: false,\n ...props\n };\n\n return (\n \n \n \n \n \n );\n}\n\nIconImageAspectRatio.displayName = 'IconImageAspectRatio';\nIconImageAspectRatio.category = 'image';\n"}}},{"rowIdx":1154,"cells":{"path":{"kind":"string","value":"Libraries/Utilities/throwOnWrongReactAPI.js"},"repo_name":{"kind":"string","value":"esauter5/react-native"},"content":{"kind":"string","value":"/**\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule throwOnWrongReactAPI\n * @flow\n */\n\n'use strict';\n\nfunction throwOnWrongReactAPI(key: string) {\n throw new Error(\n`Seems you're trying to access 'ReactNative.${key}' from the 'react-native' package. Perhaps you meant to access 'React.${key}' from the 'react' package instead?\n\nFor example, instead of:\n\n import React, { Component, View } from 'react-native';\n\nYou should now do:\n\n import React, { Component } from 'react';\n import { View } from 'react-native';\n\nCheck the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1\n`);\n}\n\nmodule.exports = throwOnWrongReactAPI;\n"}}},{"rowIdx":1155,"cells":{"path":{"kind":"string","value":"src/components/Footer.js"},"repo_name":{"kind":"string","value":"SaKKo/react-redux-todo-boilerplate"},"content":{"kind":"string","value":"import React from 'react';\nimport { connect } from 'react-redux';\n\nimport { setVisibilityFilter } from '../actions/actions';\nimport { SHOW_ALL,SHOW_ACTIVE,SHOW_COMPLETED } from '../constants/ActionTypes';\nimport Link from './Link';\n\nconst mapStateProps = (\n state,\n ownProps\n) => {\n return {\n active:\n ownProps.filter ===\n state.visibilityFilter\n };\n};\nconst mapDispatchProps = (\n dispatch,\n ownProps\n) => {\n return {\n onClick: () => {\n dispatch(\n setVisibilityFilter(ownProps.filter)\n );\n }\n };\n};\n\nconst FilterLink = connect(\n mapStateProps,\n mapDispatchProps\n)(Link);\n\nconst Footer = () => (\n

    \n Show:\n {' '}\n \n All\n \n {', '}\n \n Active\n \n {', '}\n \n Completed\n \n

    \n);\n\nexport default Footer;\n"}}},{"rowIdx":1156,"cells":{"path":{"kind":"string","value":"src/index.js"},"repo_name":{"kind":"string","value":"Warm-men/Investment-by-react"},"content":{"kind":"string","value":"import React from 'react'\nimport { render } from 'react-dom'\nimport { hashHistory } from 'react-router'\n\nimport RouteMap from './router/routeMap'\n\nrender(\n ,\n document.getElementById('app')\n);\n"}}},{"rowIdx":1157,"cells":{"path":{"kind":"string","value":"src/views/components/notification/notification.js"},"repo_name":{"kind":"string","value":"connorbanderson/CoinREXX"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nimport './notification.css';\n\n\nclass Notification extends Component {\n static propTypes = {\n action: PropTypes.func.isRequired,\n actionLabel: PropTypes.string.isRequired,\n dismiss: PropTypes.func.isRequired,\n display: PropTypes.bool.isRequired,\n duration: PropTypes.number,\n message: PropTypes.string.isRequired\n };\n\n componentDidMount() {\n this.startTimer();\n }\n\n componentWillReceiveProps(nextProps) {\n if (nextProps.display) {\n this.startTimer();\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n }\n\n clearTimer() {\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n }\n\n startTimer() {\n this.clearTimer();\n this.timerId = setTimeout(() => {\n this.props.dismiss();\n }, this.props.duration || 5000);\n }\n\n render() {\n return (\n
    \n

    this.message = c}>{this.props.message}

    \n this.button = c}\n type=\"button\">{this.props.actionLabel}\n
    \n );\n }\n}\n\nexport default Notification;\n"}}},{"rowIdx":1158,"cells":{"path":{"kind":"string","value":"src/Well.js"},"repo_name":{"kind":"string","value":"JimiHFord/react-bootstrap"},"content":{"kind":"string","value":"import React from 'react';\nimport classNames from 'classnames';\nimport BootstrapMixin from './BootstrapMixin';\n\nconst Well = React.createClass({\n mixins: [BootstrapMixin],\n\n getDefaultProps() {\n return {\n bsClass: 'well'\n };\n },\n\n render() {\n let classes = this.getBsClassSet();\n\n return (\n
    \n {this.props.children}\n
    \n );\n }\n});\n\nexport default Well;\n"}}},{"rowIdx":1159,"cells":{"path":{"kind":"string","value":"src/js/components/icons/base/Book.js"},"repo_name":{"kind":"string","value":"kylebyerly-hp/grommet"},"content":{"kind":"string","value":"// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP\n\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport CSSClassnames from '../../../utils/CSSClassnames';\nimport Intl from '../../../utils/Intl';\nimport Props from '../../../utils/Props';\n\nconst CLASS_ROOT = CSSClassnames.CONTROL_ICON;\nconst COLOR_INDEX = CSSClassnames.COLOR_INDEX;\n\nexport default class Icon extends Component {\n render () {\n const { className, colorIndex } = this.props;\n let { a11yTitle, size, responsive } = this.props;\n let { intl } = this.context;\n\n const classes = classnames(\n CLASS_ROOT,\n `${CLASS_ROOT}-book`,\n className,\n {\n [`${CLASS_ROOT}--${size}`]: size,\n [`${CLASS_ROOT}--responsive`]: responsive,\n [`${COLOR_INDEX}-${colorIndex}`]: colorIndex\n }\n );\n\n a11yTitle = a11yTitle || Intl.getMessage(intl, 'book');\n\n const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));\n return ;\n }\n};\n\nIcon.contextTypes = {\n intl: PropTypes.object\n};\n\nIcon.defaultProps = {\n responsive: true\n};\n\nIcon.displayName = 'Book';\n\nIcon.icon = true;\n\nIcon.propTypes = {\n a11yTitle: PropTypes.string,\n colorIndex: PropTypes.string,\n size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),\n responsive: PropTypes.bool\n};\n\n"}}},{"rowIdx":1160,"cells":{"path":{"kind":"string","value":"app/containers/CardForm.js"},"repo_name":{"kind":"string","value":"wenwuwu/redux-restful-example"},"content":{"kind":"string","value":"\nimport React from 'react'\nimport { connect } from 'react-redux'\nimport { bindActionCreators } from 'redux'\nimport CardForm from '../components/CardForm'\nimport * as ActionCreators from '../actions'\nimport _ from 'underscore'\n\nfunction mapStateToProps (state, ownProps) {\n const card = _.find(state.cards, {id: ownProps.cardId})\n return card ? card : {}\n}\nconst CardFormWrapper = connect(\n mapStateToProps,\n dispatch => bindActionCreators(ActionCreators, dispatch)\n)(CardForm)\n\nexport default CardFormWrapper\n"}}},{"rowIdx":1161,"cells":{"path":{"kind":"string","value":"packages/linter-ui-default/lib/tooltip/message.js"},"repo_name":{"kind":"string","value":"luizpicolo/.atom"},"content":{"kind":"string","value":"/* @flow */\n\nimport * as url from 'url'\nimport React from 'react'\nimport marked from 'marked'\n\nimport { visitMessage, openExternally, openFile, applySolution, getActiveTextEditor, sortSolutions } from '../helpers'\nimport type TooltipDelegate from './delegate'\nimport type { Message, LinterMessage } from '../types'\nimport FixButton from './fix-button'\n\nfunction findHref(el: ?Element): ?string {\n while (el && !el.classList.contains('linter-line')) {\n if (el instanceof HTMLAnchorElement) {\n return el.href\n }\n el = el.parentElement\n }\n return null\n}\n\ntype Props = {\n message: Message,\n delegate: TooltipDelegate,\n}\n\ntype State = {\n description?: string,\n descriptionShow?: boolean,\n}\n\nclass MessageElement extends React.Component {\n state: State = {\n description: '',\n descriptionShow: false,\n }\n\n componentDidMount() {\n this.props.delegate.onShouldUpdate(() => {\n this.setState({})\n })\n this.props.delegate.onShouldExpand(() => {\n if (!this.state.descriptionShow) {\n this.toggleDescription()\n }\n })\n this.props.delegate.onShouldCollapse(() => {\n if (this.state.descriptionShow) {\n this.toggleDescription()\n }\n })\n }\n\n // NOTE: Only handling messages v2 because v1 would be handled by message-legacy component\n onFixClick(): void {\n const message = this.props.message\n const textEditor = getActiveTextEditor()\n if (message.version === 2 && message.solutions && message.solutions.length) {\n applySolution(textEditor, message.version, sortSolutions(message.solutions)[0])\n }\n }\n\n openFile = (ev: Event) => {\n if (!(ev.target instanceof HTMLElement)) {\n return\n }\n const href = findHref(ev.target)\n if (!href) {\n return\n }\n // parse the link. e.g. atom://linter?file=&row=&column=\n const { protocol, hostname, query } = url.parse(href, true)\n const file = query && query.file\n if (protocol !== 'atom:' || hostname !== 'linter' || !file) {\n return\n }\n const row = query && query.row ? parseInt(query.row, 10) : 0\n const column = query && query.column ? parseInt(query.column, 10) : 0\n openFile(file, { row, column })\n }\n\n canBeFixed(message: LinterMessage): boolean {\n if (message.version === 1 && message.fix) {\n return true\n } else if (message.version === 2 && message.solutions && message.solutions.length) {\n return true\n }\n return false\n }\n\n toggleDescription(result: ?string = null) {\n const newStatus = !this.state.descriptionShow\n const description = this.state.description || this.props.message.description\n\n if (!newStatus && !result) {\n this.setState({ descriptionShow: false })\n return\n }\n if (typeof description === 'string' || result) {\n const descriptionToUse = marked(result || description)\n this.setState({ descriptionShow: true, description: descriptionToUse })\n } else if (typeof description === 'function') {\n this.setState({ descriptionShow: true })\n if (this.descriptionLoading) {\n return\n }\n this.descriptionLoading = true\n new Promise(function(resolve) {\n resolve(description())\n })\n .then(response => {\n if (typeof response !== 'string') {\n throw new Error(`Expected result to be string, got: ${typeof response}`)\n }\n this.toggleDescription(response)\n })\n .catch(error => {\n console.log('[Linter] Error getting descriptions', error)\n this.descriptionLoading = false\n if (this.state.descriptionShow) {\n this.toggleDescription()\n }\n })\n } else {\n console.error('[Linter] Invalid description detected, expected string or function but got:', typeof description)\n }\n }\n\n props: Props\n descriptionLoading: boolean = false\n\n render() {\n const { message, delegate } = this.props\n\n return (\n \n {message.description && (\n this.toggleDescription()}>\n \n \n )}\n \n {this.canBeFixed(message) && this.onFixClick()} />}\n {delegate.showProviderName ? `${message.linterName}: ` : ''}\n {message.excerpt}\n {' '}\n {message.reference &&\n message.reference.file && (\n visitMessage(message, true)}>\n \n \n )}\n {message.url && (\n openExternally(message)}>\n \n \n )}\n {this.state.descriptionShow && (\n \n )}\n \n )\n }\n}\n\nmodule.exports = MessageElement\n"}}},{"rowIdx":1162,"cells":{"path":{"kind":"string","value":"client/index.js"},"repo_name":{"kind":"string","value":"LinearAtWorst/cogile"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport ReactRoutes from './routes/routes.js';\nimport { Provider } from 'react-redux';\nimport { createStore, applyMiddleware } from 'redux';\n\nimport reducers from './reducers';\n\nconst createStoreWithMiddleware = applyMiddleware()(createStore);\n\nReactDOM.render(\n \n {ReactRoutes}\n \n, document.getElementById('app'));"}}},{"rowIdx":1163,"cells":{"path":{"kind":"string","value":"examples/js/selection/externally-managed-selection.js"},"repo_name":{"kind":"string","value":"echaouchna/react-bootstrap-tab"},"content":{"kind":"string","value":"/* eslint max-len: 0 */\nimport React from 'react';\nimport { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';\n\n\nconst products = [];\n\nfunction addProducts(quantity) {\n const startId = products.length;\n for (let i = 0; i < quantity; i++) {\n const id = startId + i;\n products.push({\n id: id,\n name: 'Item name ' + id,\n price: 2100 + i\n });\n }\n}\n\naddProducts(100);\n\nexport default class ExternallyManagedSelection extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n selected: [],\n currPage: 1\n };\n }\n\n render() {\n const {\n currPage\n } = this.state;\n const onRowSelect = ({ id }, isSelected) => {\n if (isSelected && this.state.selected.length !== 2) {\n this.setState({\n selected: [ ...this.state.selected, id ].sort(),\n currPage: this.refs.table.state.currPage\n });\n } else {\n this.setState({ selected: this.state.selected.filter(it => it !== id) });\n }\n return false;\n };\n\n const selectRowProp = {\n mode: 'checkbox',\n clickToSelect: true,\n onSelect: onRowSelect,\n selected: this.state.selected\n };\n\n const options = {\n sizePerPageList: [ 5, 10, 15, 20 ],\n sizePerPage: 10,\n page: currPage,\n sortName: 'id',\n sortOrder: 'desc'\n };\n\n return (\n \n Product ID\n Product Name\n Product Price\n \n );\n }\n}\n"}}},{"rowIdx":1164,"cells":{"path":{"kind":"string","value":"examples/huge-apps/routes/Profile/components/Profile.js"},"repo_name":{"kind":"string","value":"dmitrigrabov/react-router"},"content":{"kind":"string","value":"import React from 'react'\n\nclass Profile extends React.Component {\n render() {\n return (\n
    \n

    Profile

    \n
    \n )\n }\n}\n\nexport default Profile\n"}}},{"rowIdx":1165,"cells":{"path":{"kind":"string","value":"node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js"},"repo_name":{"kind":"string","value":"kaizensauce/campari-app"},"content":{"kind":"string","value":"import React from 'react';\n// It's important to not define HelloWorld component right in this file\n// because in that case it will do full page reload on change\nimport HelloWorld from './HelloWorld.jsx';\n\nReact.render(, document.getElementById('react-root'));\n"}}},{"rowIdx":1166,"cells":{"path":{"kind":"string","value":"js/components/tab/configTab.js"},"repo_name":{"kind":"string","value":"ChiragHindocha/stay_fit"},"content":{"kind":"string","value":"\nimport React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport { Container, Header, Title, Button, Icon, Tabs, Tab, Text, Right, Left, Body, TabHeading } from 'native-base';\nimport { Actions } from 'react-native-router-flux';\n\nimport { actions } from 'react-native-navigation-redux-helpers';\nimport myTheme from '../../themes/base-theme';\n\nimport TabOne from './tabOne';\nimport TabTwo from './tabTwo';\nimport TabThree from './tabThree';\n\nconst {\n popRoute,\n} = actions;\n\nclass ConfigTab extends Component { // eslint-disable-line\n\n static propTypes = {\n popRoute: React.PropTypes.func,\n navigation: React.PropTypes.shape({\n key: React.PropTypes.string,\n }),\n }\n popRoute() {\n this.props.popRoute(this.props.navigation.key);\n }\n\n render() {\n return (\n \n
    \n \n \n \n \n Advanced Tabs\n \n \n
    \n \n Camera}>\n \n \n No Icon}>\n \n \n }>\n \n \n \n
    \n );\n }\n}\n\nfunction bindAction(dispatch) {\n return {\n popRoute: key => dispatch(popRoute(key)),\n };\n}\n\nconst mapStateToProps = state => ({\n navigation: state.cardNavigation,\n themeState: state.drawer.themeState,\n});\n\nexport default connect(mapStateToProps, bindAction)(ConfigTab);\n"}}},{"rowIdx":1167,"cells":{"path":{"kind":"string","value":"app/javascript/mastodon/features/standalone/public_timeline/index.js"},"repo_name":{"kind":"string","value":"musashino205/mastodon"},"content":{"kind":"string","value":"import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { expandPublicTimeline, expandCommunityTimeline } from 'mastodon/actions/timelines';\nimport Masonry from 'react-masonry-infinite';\nimport { List as ImmutableList, Map as ImmutableMap } from 'immutable';\nimport DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';\nimport { debounce } from 'lodash';\nimport LoadingIndicator from 'mastodon/components/loading_indicator';\n\nconst mapStateToProps = (state, { local }) => {\n const timeline = state.getIn(['timelines', local ? 'community' : 'public'], ImmutableMap());\n\n return {\n statusIds: timeline.get('items', ImmutableList()),\n isLoading: timeline.get('isLoading', false),\n hasMore: timeline.get('hasMore', false),\n };\n};\n\nexport default @connect(mapStateToProps)\nclass PublicTimeline extends React.PureComponent {\n\n static propTypes = {\n dispatch: PropTypes.func.isRequired,\n statusIds: ImmutablePropTypes.list.isRequired,\n isLoading: PropTypes.bool.isRequired,\n hasMore: PropTypes.bool.isRequired,\n local: PropTypes.bool,\n };\n\n componentDidMount () {\n this._connect();\n }\n\n componentDidUpdate (prevProps) {\n if (prevProps.local !== this.props.local) {\n this._connect();\n }\n }\n\n _connect () {\n const { dispatch, local } = this.props;\n\n dispatch(local ? expandCommunityTimeline() : expandPublicTimeline());\n }\n\n handleLoadMore = () => {\n const { dispatch, statusIds, local } = this.props;\n const maxId = statusIds.last();\n\n if (maxId) {\n dispatch(local ? expandCommunityTimeline({ maxId }) : expandPublicTimeline({ maxId }));\n }\n }\n\n setRef = c => {\n this.masonry = c;\n }\n\n handleHeightChange = debounce(() => {\n if (!this.masonry) {\n return;\n }\n\n this.masonry.forcePack();\n }, 50)\n\n render () {\n const { statusIds, hasMore, isLoading } = this.props;\n\n const sizes = [\n { columns: 1, gutter: 0 },\n { mq: '415px', columns: 1, gutter: 10 },\n { mq: '640px', columns: 2, gutter: 10 },\n { mq: '960px', columns: 3, gutter: 10 },\n { mq: '1255px', columns: 3, gutter: 10 },\n ];\n\n const loader = (isLoading && statusIds.isEmpty()) ? : undefined;\n\n return (\n \n {statusIds.map(statusId => (\n
    \n \n
    \n )).toArray()}\n
    \n );\n }\n\n}\n"}}},{"rowIdx":1168,"cells":{"path":{"kind":"string","value":"source/components/SectionPanel/Body.js"},"repo_name":{"kind":"string","value":"mikey1384/twin-kle"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport { stringIsEmpty } from 'helpers/stringHelpers';\n\nBody.propTypes = {\n emptyMessage: PropTypes.string,\n searchQuery: PropTypes.string,\n isSearching: PropTypes.bool,\n isEmpty: PropTypes.bool,\n loadMoreButtonShown: PropTypes.bool,\n statusMsgStyle: PropTypes.string,\n content: PropTypes.node\n};\n\nexport default function Body({\n emptyMessage,\n searchQuery,\n isSearching,\n isEmpty,\n statusMsgStyle,\n content,\n loadMoreButtonShown\n}) {\n return (\n
    \n {(!stringIsEmpty(searchQuery) && isSearching) ||\n (isEmpty && !loadMoreButtonShown) ? (\n
    \n {searchQuery && isSearching\n ? 'Searching...'\n : searchQuery\n ? 'No Results'\n : emptyMessage}\n
    \n ) : (\n content\n )}\n
    \n );\n}\n"}}},{"rowIdx":1169,"cells":{"path":{"kind":"string","value":"src/svg-icons/navigation/close.js"},"repo_name":{"kind":"string","value":"pomerantsev/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet NavigationClose = (props) => (\n \n \n \n);\nNavigationClose = pure(NavigationClose);\nNavigationClose.displayName = 'NavigationClose';\nNavigationClose.muiName = 'SvgIcon';\n\nexport default NavigationClose;\n"}}},{"rowIdx":1170,"cells":{"path":{"kind":"string","value":"src/svg-icons/av/note.js"},"repo_name":{"kind":"string","value":"ArcanisCz/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet AvNote = (props) => (\n \n \n \n);\nAvNote = pure(AvNote);\nAvNote.displayName = 'AvNote';\nAvNote.muiName = 'SvgIcon';\n\nexport default AvNote;\n"}}},{"rowIdx":1171,"cells":{"path":{"kind":"string","value":"Header.js"},"repo_name":{"kind":"string","value":"srserx/react-native-ui-common"},"content":{"kind":"string","value":"import React from 'react';\nimport { View, Text } from 'react-native';\n\nconst Header = (props) => {\n const { viewStyle, textStyle } = styles;\n return (\n \n {props.headerText}\n \n );\n};\n\nconst styles = {\n viewStyle: {\n backgroundColor: '#F8F8F8',\n justifyContent: 'center',\n alignItems: 'center',\n height: 60,\n paddingTop: 15,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.2,\n elevation: 2,\n position: 'relative'\n },\n textStyle: {\n fontSize: 20\n }\n};\n\nexport { Header };\n"}}},{"rowIdx":1172,"cells":{"path":{"kind":"string","value":"test/ApiProvider.js"},"repo_name":{"kind":"string","value":"sborrazas/redux-apimap"},"content":{"kind":"string","value":"import test from 'ava';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport spy from 'spy';\n\nimport './setupDom';\nimport createApi from '../src/createApi';\nimport ApiProvider from '../src/ApiProvider';\n\nconst api = createApi({}, {});\n\ntest('Enforce rendering a single child', (t) => {\n const cns = spy(console, 'error');\n cns.mock();\n\n t.notThrows(() => {\n TestUtils.renderIntoDocument(\n \n
    \n ,\n );\n });\n\n t.is(cns.calls.length, 0);\n cns.reset();\n cns.mock();\n\n t.throws(() => {\n TestUtils.renderIntoDocument(\n \n
    \n ,\n );\n TestUtils.renderIntoDocument();\n });\n\n t.is(cns.calls.length, 1);\n cns.reset();\n cns.mock();\n\n t.throws(() => {\n TestUtils.renderIntoDocument(\n \n
    \n
    \n ,\n );\n });\n\n t.is(cns.calls.length, 1);\n cns.restore();\n});\n"}}},{"rowIdx":1173,"cells":{"path":{"kind":"string","value":"src/js/containers/Dashboard/DashboardAssetsLayer/index.js"},"repo_name":{"kind":"string","value":"grommet/grommet-cms-boilerplate"},"content":{"kind":"string","value":"/* @flow */\nimport React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport Box from 'grommet/components/Box';\nimport Button from 'grommet/components/Button';\nimport Layer from 'grommet/components/Layer';\nimport { AssetTile } from 'grommet-cms/components/Dashboard';\nimport { getAssets } from 'grommet-cms/containers/Assets/actions';\nimport AssetForm from 'grommet-cms/containers/Dashboard/DashboardAssetPage';\nimport { PageHeader } from 'grommet-cms/components';\nimport type { Asset } from 'grommet-cms/containers/Assets/flowTypes';\n\ntype Props = {\n error: string,\n posts: Array,\n request: boolean\n};\n\nexport class DashboardAssetsLayer extends Component {\n state: {\n addNewAsset: boolean\n };\n\n _onAssetFormSubmit: () => void;\n _onAddAssetClick: () => void;\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n addNewAsset: false\n };\n\n this._onAssetFormSubmit = this._onAssetFormSubmit.bind(this);\n this._onAddAssetClick = this._onAddAssetClick.bind(this);\n }\n\n componentDidMount() {\n this.props.dispatch(getAssets());\n }\n\n _onAddAssetClick() {\n this.setState({ addNewAsset: true });\n }\n\n _onAssetFormSubmit() {\n // Refresh Assets list.\n this.props.dispatch((getAssets()))\n .then(() => {\n this.setState({ addNewAsset: false });\n });\n }\n\n render() {\n const assets = (\n this.props.posts\n && this.props.posts.length > 0\n && !this.state.addNewAsset)\n ? this.props.posts.map(({_id, path, title}) =>\n )\n : undefined;\n\n const assetForm = (this.state.addNewAsset)\n ?\n \n : undefined;\n\n return (\n \n \n \n \n \n }\n />\n {assetForm}\n \n {assets}\n \n \n );\n }\n};\n\nfunction mapStateToProps(state, props) {\n const { error, posts, request } = state.assets;\n return {\n error,\n posts,\n request\n };\n}\n\nexport default connect(mapStateToProps)(DashboardAssetsLayer);\n"}}},{"rowIdx":1174,"cells":{"path":{"kind":"string","value":"app/Calendar/__tests__/DayPicker.spec.js"},"repo_name":{"kind":"string","value":"sgrepo/react-calendar-multiday"},"content":{"kind":"string","value":"// import React from 'react'\n// import Enzyme, {mount} from 'enzyme'\n// import Adapter from 'enzyme-adapter-react-16'\n// import Calendar from '../Calendar'\n// import DayWrapper from '../DayWrapper'\n// import toJson from 'enzyme-to-json'\n// import {equals, range, inc} from 'ramda'\n// import jsdom from 'jsdom'\n\n// Enzyme.configure({ adapter: new Adapter() })\n// var exposedProperties = ['window', 'navigator', 'document']\n\n// global.document = jsdom.jsdom('')\n// global.window = document.defaultView\n// Object.keys(document.defaultView).forEach((property) => {\n// if (typeof global[property] === 'undefined') {\n// exposedProperties.push(property)\n// global[property] = document.defaultView[property]\n// }\n// })\n\n// global.navigator = {\n// userAgent: 'node.js',\n// }\n\n// // const dayPicker = mount()\n\n"}}},{"rowIdx":1175,"cells":{"path":{"kind":"string","value":"native/components/speechBubble/SpeechBubble.js"},"repo_name":{"kind":"string","value":"miukimiu/react-kawaii"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport paths from './paths';\nimport Face from '../common/face/Face';\nimport getUniqueId from '../../utils/getUniqueId';\nimport Wrapper from '../common/wrapper/Wrapper';\n\nimport Svg, { G, Path, Use, Defs, Mask } from 'react-native-svg';\n\nconst SpeechBubble = ({ size, color, mood, className }) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);\n\nSpeechBubble.propTypes = {\n /**\n * Size of the width\n * */\n size: PropTypes.number,\n mood: PropTypes.oneOf([\n 'sad',\n 'shocked',\n 'happy',\n 'blissful',\n 'lovestruck',\n 'excited',\n 'ko'\n ]),\n\n /**\n * Hex color\n */\n color: PropTypes.string\n};\n\nSpeechBubble.defaultProps = {\n size: 150,\n mood: 'blissful',\n color: '#83D1FB'\n};\n\nexport default SpeechBubble;\n"}}},{"rowIdx":1176,"cells":{"path":{"kind":"string","value":"src/app/development/DevelopmentTable.js"},"repo_name":{"kind":"string","value":"cityofasheville/simplicity2"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport AccessibleReactTable, { CellFocusWrapper } from 'accessible-react-table';\nimport expandingRows from '../../shared/react_table_hoc/ExpandingRows';\nimport DevelopmentDetail from './DevelopmentDetail';\nimport Icon from '../../shared/Icon';\nimport { IM_HOME2, IM_MAP5, IM_OFFICE, IM_DIRECTION, IM_LIBRARY2, IM_FIRE, IM_USERS4, IM_COOK, IM_CITY, LI_WALKING, IM_MUG } from '../../shared/iconConstants';\nimport createFilterRenderer from '../../shared/FilterRenderer';\n\nconst getIcon = (type, isExpanded) => {\n switch (type) {\n case 'Commercial':\n return ;\n case 'Residential':\n return ;\n case 'Sign':\n return ;\n case 'Historical':\n return ;\n case 'Fire':\n return ;\n case 'Event-Temporary Use':\n return ;\n case 'Outdoor Vendor':\n return ;\n case 'Development':\n return ;\n case 'Right of Way':\n return ;\n case 'Over The Counter':\n return ;\n default:\n return ;\n }\n};\n\nconst FilterRenderer = createFilterRenderer('Search...');\n\nclass DevelopmentTable extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n urlString: '',\n };\n }\n\n componentDidMount() {\n this.setState({\n urlString: [this.props.location.pathname, '?entity=', this.props.location.query.entity, '&id=', this.props.location.query.id, '&entities=', this.props.location.query.entities, '&label=', this.props.location.query.label, '&within=', document.getElementById('extent').value, '&during=', document.getElementById('time').value, '&hideNavbar=', this.props.location.query.hideNavbar, '&search=', this.props.location.query.search, '&view=map', '&x=', this.props.location.query.x, '&y=', this.props.location.query.y].join('')\n })\n }\n\n render() {\n const ExpandableAccessibleReactTable = expandingRows(AccessibleReactTable);\n\n const dataColumns = [\n {\n Header: 'Project',\n accessor: 'application_name',\n minWidth: 250,\n innerFocus: true,\n Cell: row => (\n \n {(focusRef, focusable) => (\n \n \n {/* e.stopPropagation()}\n >*/}\n \n {row.value}\n {/**/}\n \n \n )}\n \n ),\n Filter: FilterRenderer,\n },\n {\n Header: 'Type',\n accessor: 'permit_type',\n minWidth: 150,\n Cell: row => (\n \n {getIcon(row.value, row.isExpanded)}\n {row.value}\n \n ),\n Filter: FilterRenderer,\n },\n {\n Header: 'Contractor',\n accessor: 'contractor_name',\n minWidth: 150,\n Filter: FilterRenderer,\n },\n {\n Header: 'Applied Date',\n id: 'applied_date',\n accessor: permit => ({moment.utc(permit.applied_date).format('M/DD/YYYY')}),\n width: 110,\n Filter: FilterRenderer,\n filterMethod: (filter, row) => {\n const id = filter.pivotId || filter.id;\n return row[id] !== undefined ? String(row[id].props.children).toLowerCase().indexOf(filter.value.toLowerCase()) > -1 : true;\n },\n },\n {\n Header: 'Permit #',\n accessor: 'permit_number',\n width: 115,\n Filter: FilterRenderer,\n },\n ];\n\n return (\n
    \n
    \n {this.props.data.length < 1 ?\n
    No results found
    \n :\n
    \n 20}\n defaultPageSize={this.props.data.length <= 20 ? this.props.data.length : 20}\n filterable\n defaultFilterMethod={(filter, row) => {\n const id = filter.pivotId || filter.id;\n return row[id] !== undefined ? String(row[id]).toLowerCase().indexOf(filter.value.toLowerCase()) > -1 : true;\n }}\n getTdProps={() => {\n return {\n style: {\n whiteSpace: 'normal',\n },\n };\n }}\n getTrProps={(state, rowInfo) => {\n return {\n style: {\n cursor: 'pointer',\n background: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? '#4077a5' : 'none',\n color: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? '#fff' : '',\n fontWeight: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? 'bold' : 'normal',\n fontSize: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? '1.2em' : '1em',\n },\n };\n }}\n SubComponent={row => (\n
    \n \n
    \n )}\n />\n
    \n }\n
    \n
    \n );\n }\n}\n\nDevelopmentTable.propTypes = {\n data: PropTypes.array, // eslint-disable-line\n};\n\nexport default DevelopmentTable;\n"}}},{"rowIdx":1177,"cells":{"path":{"kind":"string","value":"src/pages/client/listpage.js"},"repo_name":{"kind":"string","value":"vgarcia692/wutmi_frontend"},"content":{"kind":"string","value":"import React from 'react';\nimport { Link } from 'react-router';\nimport { Table, Button, Row, Col } from 'react-bootstrap';\nimport styles from './style.css';\nimport CustomAxios from '../../common/components/CustomAxios';\nimport NewClientForm from '../../common/components/NewClientForm';\nimport LoadingGifModal from '../../common/components/LoadingGifModal';\nimport dateFormat from 'dateFormat';\n\nexport default class ClientListPage extends React.Component {\n constructor() {\n super()\n this.state = {\n data: [],\n modalShow: false,\n loadingShow: false\n }\n\n this.showModal = this.showModal.bind(this);\n this.closeModal = this.closeModal.bind(this);\n this.refreshData = this.refreshData.bind(this);\n this.showLoading = this.showLoading.bind(this);\n this.hideLoading = this.hideLoading.bind(this);\n }\n\n componentDidMount() {\n this.getData();\n }\n \n getData() {\n this.showLoading();\n const axios = CustomAxios.wAxios; \n axios.get('/basic_clients_data/')\n .then(function (response) {\n const results = response.data.results;\n var data = [];\n results.forEach(function(client,index) {\n data.push(\n \n {index + 1}\n {client.first_name + ' ' + client.last_name}\n {client.atoll.name}\n {dateFormat(client.created_at, 'fullDate')}\n \n );\n });\n this.setState({ data:data });\n this.hideLoading();\n }.bind(this))\n .catch(function (error) {\n console.log(error);\n });\n }\n\n showModal() {\n this.setState(() => ({\n modalShow: true\n }))\n }\n\n closeModal() {\n this.setState(() => ({\n modalShow: false\n }))\n }\n\n showLoading() {\n this.setState({\n loadingShow: true\n });\n }\n\n hideLoading() {\n this.setState({\n loadingShow: false\n });\n }\n\n refreshData() {\n this.setState(() => ({\n modalShow: false\n }))\n\n // Refresh data from Database\n this.getData();\n console.log('data refreshed');\n }\n\n render() {\n \n return (\n
    \n

    Client Listing

    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {this.state.data}\n \n
    #NameAtollInput Date
    \n
    \n this.refreshData()} />\n \n
    \n );\n }\n}\n"}}},{"rowIdx":1178,"cells":{"path":{"kind":"string","value":"src/svg-icons/device/add-alarm.js"},"repo_name":{"kind":"string","value":"pradel/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet DeviceAddAlarm = (props) => (\n \n \n \n);\nDeviceAddAlarm = pure(DeviceAddAlarm);\nDeviceAddAlarm.displayName = 'DeviceAddAlarm';\n\nexport default DeviceAddAlarm;\n"}}},{"rowIdx":1179,"cells":{"path":{"kind":"string","value":"app/components/events/comments/CommentList.js"},"repo_name":{"kind":"string","value":"alexko13/block-and-frame"},"content":{"kind":"string","value":"import React from 'react';\nimport Comment from './CommentItem';\nimport moment from 'moment';\n\nconst CommentList = (props) => {\n return (\n
    \n
    \n

    Comments

    \n {\n props.commentData.map((comment) => {\n return (\n \n );\n })\n }\n
    \n
    \n \n \n
    \n
    \n Add Reply\n
    \n
    \n\n
    \n
    \n );\n};\n\nmodule.exports = CommentList;\n"}}},{"rowIdx":1180,"cells":{"path":{"kind":"string","value":"app/javascript/plugins/email_pension/SelectTarget.js"},"repo_name":{"kind":"string","value":"SumOfUs/Champaign"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport { FormattedMessage } from 'react-intl';\nimport Input from '../../components/SweetInput/SweetInput';\nimport FormGroup from '../../components/Form/FormGroup';\n\nclass SelectTarget extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n searching: false,\n not_found: false,\n postcode: '',\n targets: [],\n };\n }\n\n getTarget = postcode => {\n this.setState({ postcode: postcode });\n\n if (!postcode) return;\n if (postcode.length < 5) return;\n\n this.setState({ searching: true, not_found: false });\n fetch(`${this.props.endpoint}${postcode}`)\n .then(resp => {\n if (resp.ok) {\n return resp.json();\n }\n throw new Error('not found.');\n })\n .then(json => {\n this.setState({ targets: json, searching: false });\n const data = { postcode, targets: json };\n this.props.handler(data);\n })\n .catch(e => {\n this.setState({ not_found: true, targets: [], searching: false });\n console.log('error', e);\n });\n };\n\n renderTarget({ id, title, first_name, last_name }) {\n return (\n

    \n {title} {first_name} {last_name}\n

    \n );\n }\n\n render() {\n let targets;\n\n if (this.state.not_found) {\n targets = (\n \n );\n } else {\n targets = this.state.targets.length ? (\n this.state.targets.map(target => this.renderTarget(target))\n ) : (\n \n );\n }\n\n return (\n
    \n \n \n }\n value={this.state.postcode}\n onChange={value => this.getTarget(value)}\n errorMessage={this.props.error}\n />\n \n \n
    \n

    \n \n

    \n
    \n {this.state.searching ? (\n \n ) : (\n targets\n )}\n
    \n
    \n
    \n
    \n );\n }\n}\n\nexport default SelectTarget;\n"}}},{"rowIdx":1181,"cells":{"path":{"kind":"string","value":"packages/icons/src/md/action/SettingsBluetooth.js"},"repo_name":{"kind":"string","value":"suitejs/suitejs"},"content":{"kind":"string","value":"import React from 'react';\nimport IconBase from '@suitejs/icon-base';\n\nfunction MdSettingsBluetooth(props) {\n return (\n \n \n \n );\n}\n\nexport default MdSettingsBluetooth;\n"}}},{"rowIdx":1182,"cells":{"path":{"kind":"string","value":"src/js/components/icons/base/Diamond.js"},"repo_name":{"kind":"string","value":"kylebyerly-hp/grommet"},"content":{"kind":"string","value":"// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP\n\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport CSSClassnames from '../../../utils/CSSClassnames';\nimport Intl from '../../../utils/Intl';\nimport Props from '../../../utils/Props';\n\nconst CLASS_ROOT = CSSClassnames.CONTROL_ICON;\nconst COLOR_INDEX = CSSClassnames.COLOR_INDEX;\n\nexport default class Icon extends Component {\n render () {\n const { className, colorIndex } = this.props;\n let { a11yTitle, size, responsive } = this.props;\n let { intl } = this.context;\n\n const classes = classnames(\n CLASS_ROOT,\n `${CLASS_ROOT}-diamond`,\n className,\n {\n [`${CLASS_ROOT}--${size}`]: size,\n [`${CLASS_ROOT}--responsive`]: responsive,\n [`${COLOR_INDEX}-${colorIndex}`]: colorIndex\n }\n );\n\n a11yTitle = a11yTitle || Intl.getMessage(intl, 'diamond');\n\n const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));\n return ;\n }\n};\n\nIcon.contextTypes = {\n intl: PropTypes.object\n};\n\nIcon.defaultProps = {\n responsive: true\n};\n\nIcon.displayName = 'Diamond';\n\nIcon.icon = true;\n\nIcon.propTypes = {\n a11yTitle: PropTypes.string,\n colorIndex: PropTypes.string,\n size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),\n responsive: PropTypes.bool\n};\n\n"}}},{"rowIdx":1183,"cells":{"path":{"kind":"string","value":"src/select/multiselect/OptionGroupRenderer.js"},"repo_name":{"kind":"string","value":"sthomas1618/react-crane"},"content":{"kind":"string","value":"import React from 'react'\nimport PropTypes from 'prop-types'\n\nimport { isValueEqual } from '../utils'\n\nfunction OptionGroupRenderer(props) {\n const { groupTitleKey, groupValueKey, option, optionDisabledKey, value, valueKey } = props\n const checked =\n value &&\n value.length &&\n value.some(\n (val) =>\n isValueEqual(option, val, groupValueKey) ||\n (option.options &&\n option.options.length &&\n option.options.some((opt) => isValueEqual(opt, val, valueKey)))\n )\n const isDisabled = option[optionDisabledKey]\n\n const onChange = (e) => {\n e.preventDefault()\n }\n const controlId = `group-${option[groupValueKey]}`\n\n return (\n \n \n \n )\n}\n\nOptionGroupRenderer.propTypes = {\n groupTitleKey: PropTypes.string.isRequired,\n groupValueKey: PropTypes.string.isRequired,\n option: PropTypes.object.isRequired,\n optionDisabledKey: PropTypes.string,\n value: PropTypes.oneOfType([\n PropTypes.array,\n PropTypes.number,\n PropTypes.object,\n PropTypes.string\n ]).isRequired,\n valueKey: PropTypes.string.isRequired\n}\n\nOptionGroupRenderer.defaultProps = {\n optionDisabledKey: 'isDisabled'\n}\n\nexport default OptionGroupRenderer\n"}}},{"rowIdx":1184,"cells":{"path":{"kind":"string","value":"lib/ui/src/modules/ui/routes.js"},"repo_name":{"kind":"string","value":"jribeiro/storybook"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Layout from './containers/layout';\nimport LeftPanel from './containers/left_panel';\nimport DownPanel from './containers/down_panel';\nimport ShortcutsHelp from './containers/shortcuts_help';\nimport SearchBox from './containers/search_box';\n\nexport default function(injectDeps, { clientStore, provider, domNode }) {\n // generate preview\n const Preview = () => {\n const state = clientStore.getAll();\n const preview = provider.renderPreview(state.selectedKind, state.selectedStory);\n return preview;\n };\n\n const root = (\n
    \n }\n preview={() => }\n downPanel={() => }\n />\n \n \n
    \n );\n ReactDOM.render(root, domNode);\n}\n"}}},{"rowIdx":1185,"cells":{"path":{"kind":"string","value":"src/Parser/HolyPaladin/Modules/Talents/AuraOfMercy.js"},"repo_name":{"kind":"string","value":"Yuyz0112/WoWAnalyzer"},"content":{"kind":"string","value":"import React from 'react';\n\nimport SPELLS from 'common/SPELLS';\nimport SpellIcon from 'common/SpellIcon';\nimport SpellLink from 'common/SpellLink';\nimport { formatNumber } from 'common/format';\n\nimport Module from 'Parser/Core/Module';\nimport AbilityTracker from 'Parser/Core/Modules/AbilityTracker';\n\nimport StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox';\n\nclass AuraOfMercy extends Module {\n static dependencies = {\n abilityTracker: AbilityTracker,\n };\n\n on_initialized() {\n if (!this.owner.error) {\n this.active = this.owner.selectedCombatant.hasTalent(SPELLS.AURA_OF_MERCY_TALENT.id);\n }\n }\n\n get healing() {\n const abilityTracker = this.abilityTracker;\n const getAbility = spellId => abilityTracker.getAbility(spellId);\n\n return (getAbility(SPELLS.AURA_OF_MERCY_HEAL.id).healingEffective + getAbility(SPELLS.AURA_OF_MERCY_HEAL.id).healingAbsorbed);\n }\n get hps() {\n return this.healing / this.owner.fightDuration * 1000;\n }\n\n suggestions(when) {\n when(this.auraOfSacrificeHps).isLessThan(30000)\n .addSuggestion((suggest, actual, recommended) => {\n return suggest(The healing done by your is low. Try to find a better moment to cast it or consider changing to or which can be more reliable.)\n .icon(SPELLS.AURA_OF_SACRIFICE_TALENT.icon)\n .actual(`${formatNumber(actual)} HPS`)\n .recommended(`>${formatNumber(recommended)} HPS is recommended`)\n .regular(recommended - 5000).major(recommended - 10000);\n });\n }\n statistic() {\n return (\n }\n value={`${formatNumber(this.hps)} HPS`}\n label=\"Healing done\"\n />\n );\n }\n statisticOrder = STATISTIC_ORDER.OPTIONAL();\n}\n\nexport default AuraOfMercy;\n"}}},{"rowIdx":1186,"cells":{"path":{"kind":"string","value":"packages/core/admin/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js"},"repo_name":{"kind":"string","value":"wistityhq/strapi"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Box } from '@strapi/design-system/Box';\nimport { Flex } from '@strapi/design-system/Flex';\nimport { Link } from '@strapi/design-system/Link';\nimport { Typography } from '@strapi/design-system/Typography';\nimport Cog from '@strapi/icons/Cog';\nimport { useIntl } from 'react-intl';\nimport get from 'lodash/get';\nimport { Grid, GridItem } from '@strapi/design-system/Grid';\nimport useLayoutDnd from '../../../hooks/useLayoutDnd';\nimport getTrad from '../../../utils/getTrad';\n\nconst ComponentFieldList = ({ componentUid }) => {\n const { componentLayouts } = useLayoutDnd();\n const { formatMessage } = useIntl();\n const componentData = get(componentLayouts, [componentUid], {});\n const componentLayout = get(componentData, ['layouts', 'edit'], []);\n\n return (\n \n {componentLayout.map((row, index) => (\n // eslint-disable-next-line react/no-array-index-key\n \n {row.map(rowContent => (\n \n \n \n {rowContent.name}\n \n \n \n ))}\n \n ))}\n \n }\n to={`/content-manager/components/${componentUid}/configurations/edit`}\n >\n {formatMessage({\n id: getTrad('components.FieldItem.linkToComponentLayout'),\n defaultMessage: \"Set the component's layout\",\n })}\n \n \n \n );\n};\n\nComponentFieldList.propTypes = {\n componentUid: PropTypes.string.isRequired,\n};\n\nexport default ComponentFieldList;\n"}}},{"rowIdx":1187,"cells":{"path":{"kind":"string","value":"pollard/components/SongInput.js"},"repo_name":{"kind":"string","value":"spencerliechty/pollard"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport classNames from 'classnames';\n\nimport mergeStyles from '../lib/mergeStyles';\n\n\nexport default class SongInput extends Component {\n handleChange(event) {\n this.props.updateSong({\n idx: this.props.songIdx,\n key: this.props.label,\n val: event.target.value\n });\n }\n\n render() {\n let gridStyle = mergeStyles({\n marginTop: 5\n });\n\n let labelId = \"label-\" + this.props.label;\n\n return (\n \n
    \n { this.props.label }\n this.handleChange(e) }\n />\n
    \n
    \n );\n }\n}\n"}}},{"rowIdx":1188,"cells":{"path":{"kind":"string","value":"src/svg-icons/file/file-download.js"},"repo_name":{"kind":"string","value":"tan-jerene/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet FileFileDownload = (props) => (\n \n \n \n);\nFileFileDownload = pure(FileFileDownload);\nFileFileDownload.displayName = 'FileFileDownload';\nFileFileDownload.muiName = 'SvgIcon';\n\nexport default FileFileDownload;\n"}}},{"rowIdx":1189,"cells":{"path":{"kind":"string","value":"src/components/Separator/Separator.js"},"repo_name":{"kind":"string","value":"jmoguelruiz/react-common-components"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nclass Separator extends Component{\n\n getStyle(){\n return {\n color : \"#f4f5f8\",\n margin: \"20px -10px\",\n width : \"100%\"\n };\n }\n\n render(){\n\n const { style } = this.props;\n\n return(\n
    \n );\n\n }\n}\n\nSeparator.propTypes = {\n /**\n * Style\n */\n style : PropTypes.object\n};\n\nexport default Separator;"}}},{"rowIdx":1190,"cells":{"path":{"kind":"string","value":"docs/src/app/components/pages/components/TimePicker/ExampleSimple.js"},"repo_name":{"kind":"string","value":"barakmitz/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport TimePicker from 'material-ui/TimePicker';\n\nconst TimePickerExampleSimple = () => (\n
    \n \n \n \n
    \n);\n\nexport default TimePickerExampleSimple;\n"}}},{"rowIdx":1191,"cells":{"path":{"kind":"string","value":"src/Alert.js"},"repo_name":{"kind":"string","value":"erictherobot/react-bootstrap"},"content":{"kind":"string","value":"import React from 'react';\nimport classNames from 'classnames';\nimport BootstrapMixin from './BootstrapMixin';\n\nconst Alert = React.createClass({\n mixins: [BootstrapMixin],\n\n propTypes: {\n onDismiss: React.PropTypes.func,\n dismissAfter: React.PropTypes.number,\n closeLabel: React.PropTypes.string\n },\n\n getDefaultProps() {\n return {\n bsClass: 'alert',\n bsStyle: 'info',\n closeLabel: 'Close Alert'\n };\n },\n\n renderDismissButton() {\n return (\n \n &times;\n \n );\n },\n\n renderSrOnlyDismissButton() {\n return (\n \n {this.props.closeLabel}\n \n );\n },\n\n render() {\n let classes = this.getBsClassSet();\n let isDismissable = !!this.props.onDismiss;\n\n classes['alert-dismissable'] = isDismissable;\n\n return (\n
    \n {isDismissable ? this.renderDismissButton() : null}\n {this.props.children}\n {isDismissable ? this.renderSrOnlyDismissButton() : null}\n
    \n );\n },\n\n componentDidMount() {\n if (this.props.dismissAfter && this.props.onDismiss) {\n this.dismissTimer = setTimeout(this.props.onDismiss, this.props.dismissAfter);\n }\n },\n\n componentWillUnmount() {\n clearTimeout(this.dismissTimer);\n }\n});\n\nexport default Alert;\n"}}},{"rowIdx":1192,"cells":{"path":{"kind":"string","value":"src/js/components/nodes/registerNodes/driverFields/DriverFields.js"},"repo_name":{"kind":"string","value":"knowncitizen/tripleo-ui"},"content":{"kind":"string","value":"/**\n * Copyright 2017 Red Hat Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License. You may obtain\n * a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\nimport { defineMessages, injectIntl } from 'react-intl';\nimport { Field } from 'redux-form';\nimport { format, required } from 'redux-form-validators';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nimport HorizontalInput from '../../../ui/reduxForm/HorizontalInput';\nimport HorizontalTextarea from '../../../ui/reduxForm/HorizontalTextarea';\nimport { IPV4_REGEX, FQDN_REGEX, PORT_REGEX } from '../../../../utils/regex';\n\nconst messages = defineMessages({\n ipOrFqdnValidatorMessage: {\n id: 'DriverFields.ipOrFqdnValidatorMessage',\n defaultMessage: 'Please enter a valid IPv4 Address or a valid FQDN.'\n },\n portValidationMessage: {\n id: 'DriverFields.portValidationMessage',\n defaultMessage: 'Please enter valid Port number (0 - 65535)'\n }\n});\n\nexport const DriverFields = ({\n addressLabel,\n intl: { formatMessage },\n passwordLabel,\n portLabel,\n node,\n userLabel\n}) => (\n
    \n \n \n \n \n
    \n);\nDriverFields.propTypes = {\n addressLabel: PropTypes.string.isRequired,\n intl: PropTypes.object.isRequired,\n node: PropTypes.string.isRequired,\n passwordLabel: PropTypes.string.isRequired,\n portLabel: PropTypes.string.isRequired,\n userLabel: PropTypes.string.isRequired\n};\n\nexport default injectIntl(DriverFields);\n"}}},{"rowIdx":1193,"cells":{"path":{"kind":"string","value":"client/src/components/role/RoleUpdate.js"},"repo_name":{"kind":"string","value":"FlevianK/cp2-document-management-system"},"content":{"kind":"string","value":"import React from 'react';\nimport { connect } from 'react-redux';\nimport { Link, browserHistory } from 'react-router';\nimport { bindActionCreators } from 'redux';\nimport Dialog from 'material-ui/Dialog';\nimport FlatButton from 'material-ui/FlatButton';\nimport RaisedButton from 'material-ui/RaisedButton';\nimport MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';\nimport PropTypes from 'prop-types';\nimport toastr from 'toastr';\nimport { Input } from '../../containers';\nimport * as roleAction from '../../actions/roleAction';\nimport DashboardHeader from '../common/DashboardHeader';\n\nexport class RoleUpdate extends React.Component {\n /**\n * RoleUpdate class\n * It is for updating role description\n */\n constructor(props) {\n super(props);\n this.state = {\n roles: {\n roleId: this.props.params.roleId\n },\n open: true\n };\n this.onRoleChange = this.onRoleChange.bind(this);\n this.onRoleUpdate = this.onRoleUpdate.bind(this);\n this.handleClose = this.handleClose.bind(this);\n }\n\n componentWillMount() {\n this.props.actions.loadRole(this.props.params);\n }\n\n componentWillReceiveProps(nextProps) {\n const role = nextProps.roles;\n this.setState({\n roles: role\n });\n }\n\n onRoleChange(event) {\n event.preventDefault();\n const field = event.target.name;\n const roles = this.state.roles;\n roles[field] = event.target.value;\n return this.setState({ roles });\n }\n\n onRoleUpdate(event) {\n event.preventDefault();\n this.props.actions.updateRole(this.state.roles)\n .then(() => {\n this.setState({ open: false });\n browserHistory.push('/roles');\n })\n .catch((error) => {\n toastr.error(error.response.data.message);\n });\n }\n\n handleClose() {\n this.setState({ open: false });\n browserHistory.push('/roles');\n }\n\n render() {\n console.log(this.props, \"llll\")\n const { roles } = this.props;\n const actions = [\n ,\n ];\n return (\n
    \n \n
    \n \n \n
    \n
    \n

    Role: {this.state.roles.title}

    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n );\n }\n}\nRoleUpdate.propTypes = {\n roles: PropTypes.object,\n actions: PropTypes.object,\n params: PropTypes.object,\n};\n\nconst mapStateToProps = (state, ownProps) => ({\n roles: state.roles\n});\n\nconst mapDispatchToProps = dispatch => ({\n actions: bindActionCreators(roleAction, dispatch)\n});\n\nexport default connect(mapStateToProps, mapDispatchToProps)(RoleUpdate);\n"}}},{"rowIdx":1194,"cells":{"path":{"kind":"string","value":"app/main.js"},"repo_name":{"kind":"string","value":"mapbox/osm-comments-frontend"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './components/Application';\nimport ContentContainer from './containers/Content';\nimport NotesList from './components/NotesList';\nimport ChangesetsList from './components/ChangesetsList';\nimport { Router, Route, IndexRoute, Redirect } from 'react-router';\nimport createHistory from 'history/lib/createHashHistory';\n\nconst history = createHistory({\n queryKey: false\n});\n\nconst routes = (\n \n \n \n \n \n \n \n);\n\nReactDOM.render(routes, document.getElementById('application'));\n"}}},{"rowIdx":1195,"cells":{"path":{"kind":"string","value":"examples/with-yarn-workspaces/packages/bar/index.js"},"repo_name":{"kind":"string","value":"BlancheXu/test"},"content":{"kind":"string","value":"import React from 'react'\n\nconst Bar = () => bar\n\nexport default Bar\n"}}},{"rowIdx":1196,"cells":{"path":{"kind":"string","value":"docs/client/components/pages/Image/gettingStarted.js"},"repo_name":{"kind":"string","value":"koaninc/draft-js-plugins"},"content":{"kind":"string","value":"// It is important to import the Editor which accepts plugins.\n// eslint-disable-next-line import/no-unresolved\nimport Editor from 'draft-js-plugins-editor';\n// eslint-disable-next-line import/no-unresolved\nimport createImagePlugin from 'draft-js-image-plugin';\nimport React from 'react';\n\nconst imagePlugin = createImagePlugin();\n\n// The Editor accepts an array of plugins. In this case, only the imagePlugin\n// is passed in, although it is possible to pass in multiple plugins.\nconst MyEditor = ({ editorState, onChange }) => (\n \n);\n\nexport default MyEditor;\n"}}},{"rowIdx":1197,"cells":{"path":{"kind":"string","value":"lib/FocusTrap.js"},"repo_name":{"kind":"string","value":"danauclair/react-hotkeys"},"content":{"kind":"string","value":"import React from 'react';\n\nconst FocusTrap = React.createClass({\n\n propTypes: {\n onFocus: React.PropTypes.func,\n onBlur: React.PropTypes.func,\n focusName: React.PropTypes.string, // Currently unused\n component: React.PropTypes.any\n },\n\n getDefaultProps() {\n return {\n component: 'div'\n }\n },\n\n render() {\n const Component = this.props.component;\n\n return (\n \n {this.props.children}\n \n );\n }\n\n});\n\nexport default FocusTrap;\n"}}},{"rowIdx":1198,"cells":{"path":{"kind":"string","value":"src/components/NotFoundPage.js"},"repo_name":{"kind":"string","value":"mgavaudan/react-hack"},"content":{"kind":"string","value":"import React from 'react';\nimport { Link } from 'react-router';\n\nconst NotFoundPage = () => {\n return (\n
    \n

    \n 404 Page Not Found\n

    \n Go back to homepage \n
    \n );\n};\n\nexport default NotFoundPage;\n"}}},{"rowIdx":1199,"cells":{"path":{"kind":"string","value":"src/PageHeader.js"},"repo_name":{"kind":"string","value":"blue68/react-bootstrap"},"content":{"kind":"string","value":"import React from 'react';\nimport classNames from 'classnames';\n\nconst PageHeader = React.createClass({\n render() {\n return (\n
    \n

    {this.props.children}

    \n
    \n );\n }\n});\n\nexport default PageHeader;\n"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":11,"numItemsPerPage":100,"numTotalItems":410387,"offset":1100,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NjU2NDkwNSwic3ViIjoiL2RhdGFzZXRzL2hjaGF1dHJhbi9yZWFjdF9yZXBvcyIsImV4cCI6MTc1NjU2ODUwNSwiaXNzIjoiaHR0cHM6Ly9odWdnaW5nZmFjZS5jbyJ9.kImrE6T_CKidslxtjxPOjdkRhPL9z-FxoB24CKxpRoMNU0uSaPWvelyi7kzJrzlQdiBLSGvMorcnc4ko7RvdBw","displayUrls":true},"discussionsStats":{"closed":0,"open":0,"total":0},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
    path
    stringlengths
    5
    195
    repo_name
    stringlengths
    5
    79
    content
    stringlengths
    25
    1.01M
    docs/app/Examples/modules/Checkbox/Types/CheckboxExampleToggle.js
    Rohanhacker/Semantic-UI-React
    import React from 'react' import { Checkbox } from 'semantic-ui-react' const CheckboxExampleToggle = () => ( <Checkbox toggle /> ) export default CheckboxExampleToggle
    docs/app/Examples/views/Feed/Content/FeedExampleImageLabelShorthand.js
    shengnian/shengnian-ui-react
    import React from 'react' import { Feed } from 'shengnian-ui-react' const FeedExampleImageLabelShorthand = () => ( <Feed> <Feed.Event image='/assets/images/avatar/small/elliot.jpg' content='You added Elliot Fu to the group Coworkers' /> <Feed.Event> <Feed.Label image='/assets/images/avatar/small/elliot.jpg' /> <Feed.Content content='You added Elliot Fu to the group Coworkers' /> </Feed.Event> </Feed> ) export default FeedExampleImageLabelShorthand
    internals/templates/app.js
    Rohitbels/KolheshwariIndustries
    /** * app.js * * This is the entry file for the application, only setup and boilerplate * code. */ import 'babel-polyfill'; /* eslint-disable import/no-unresolved, import/extensions */ // Load the manifest.json file and the .htaccess file import '!file?name=[name].[ext]!./manifest.json'; import 'file?name=[name].[ext]!./.htaccess'; /* eslint-enable import/no-unresolved, import/extensions */ // Import all the third party stuff import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { applyRouterMiddleware, Router, browserHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import { useScroll } from 'react-router-scroll'; import LanguageProvider from 'containers/LanguageProvider'; import configureStore from './store'; // Import i18n messages import { translationMessages } from './i18n'; // Import the CSS reset, which HtmlWebpackPlugin transfers to the build folder import 'sanitize.css/sanitize.css'; // Create redux store with history // this uses the singleton browserHistory provided by react-router // Optionally, this could be changed to leverage a created history // e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();` const initialState = {}; const store = configureStore(initialState, browserHistory); // Sync history and store, as the react-router-redux reducer // is under the non-default key ("routing"), selectLocationState // must be provided for resolving how to retrieve the "route" in the state import { selectLocationState } from 'containers/App/selectors'; const history = syncHistoryWithStore(browserHistory, store, { selectLocationState: selectLocationState(), }); // Set up the router, wrapping all Routes in the App component import App from 'containers/App'; import createRoutes from './routes'; const rootRoute = { component: App, childRoutes: createRoutes(store), }; const render = (translatedMessages) => { ReactDOM.render( <Provider store={store}> <LanguageProvider messages={translatedMessages}> <Router history={history} routes={rootRoute} render={ // Scroll to top when going to a new page, imitating default browser // behaviour applyRouterMiddleware(useScroll()) } /> </LanguageProvider> </Provider>, document.getElementById('app') ); }; // Hot reloadable translation json files if (module.hot) { // modules.hot.accept does not accept dynamic dependencies, // have to be constants at compile-time module.hot.accept('./i18n', () => { render(translationMessages); }); } // Chunked polyfill for browsers without Intl support if (!window.Intl) { (new Promise((resolve) => { resolve(System.import('intl')); })) .then(() => Promise.all([ System.import('intl/locale-data/jsonp/de.js'), ])) .then(() => render(translationMessages)) .catch((err) => { throw err; }); } else { render(translationMessages); } // Install ServiceWorker and AppCache in the end since // it's not most important operation and if main code fails, // we do not want it installed import { install } from 'offline-plugin/runtime'; install();
    app/navigation.js
    david1820/react-native-boilerplate
    import React from 'react'; import PropTypes from 'prop-types'; import { StyleSheet, StatusBar, View } from 'react-native'; import { connect } from 'react-redux'; import { addNavigationHelpers } from 'react-navigation'; import AppNavigator from './routes'; const AppWithNavigationState = ({ dispatch, nav }) => ( <View style={styles.container}> <StatusBar barStyle="dark-content" /> <AppNavigator navigation={addNavigationHelpers({ dispatch, state: nav })} /> </View> ); AppWithNavigationState.propTypes = { dispatch: PropTypes.func.isRequired, nav: PropTypes.object.isRequired, }; const mapStateToProps = state => ({ nav: state.nav, }); const styles = StyleSheet.create({ container: { flex: 1, }, }); export default connect(mapStateToProps)(AppWithNavigationState);
    packages/slate-html-serializer/benchmark/html-serializer/serialize.js
    6174/slate
    /** @jsx h */ /* eslint-disable react/jsx-key */ import Html from '../..' import React from 'react' import h from '../../test/helpers/h' import parse5 from 'parse5' // eslint-disable-line import/no-extraneous-dependencies const html = new Html({ parseHtml: parse5.parseFragment, rules: [ { serialize(obj, children) { switch (obj.kind) { case 'block': { switch (obj.type) { case 'paragraph': return React.createElement('p', {}, children) case 'quote': return React.createElement('blockquote', {}, children) } } case 'mark': { switch (obj.type) { case 'bold': return React.createElement('strong', {}, children) case 'italic': return React.createElement('em', {}, children) } } } } } ] }) export default function (state) { html.serialize(state) } export const input = ( <state> <document> {Array.from(Array(10)).map(() => ( <quote> <paragraph> This is editable <b>rich</b> text, <i>much</i> better than a textarea! </paragraph> </quote> ))} </document> </state> )
    src/svg-icons/maps/edit-location.js
    rhaedes/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let MapsEditLocation = (props) => ( <SvgIcon {...props}> <path d="M12 2C8.14 2 5 5.14 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.86-3.14-7-7-7zm-1.56 10H9v-1.44l3.35-3.34 1.43 1.43L10.44 12zm4.45-4.45l-.7.7-1.44-1.44.7-.7c.15-.15.39-.15.54 0l.9.9c.15.15.15.39 0 .54z"/> </SvgIcon> ); MapsEditLocation = pure(MapsEditLocation); MapsEditLocation.displayName = 'MapsEditLocation'; export default MapsEditLocation;
    docs/app/Examples/elements/List/Variations/ListExampleRelaxed.js
    shengnian/shengnian-ui-react
    import React from 'react' import { Image, List } from 'shengnian-ui-react' const ListExampleRelaxed = () => ( <List relaxed> <List.Item> <Image avatar src='/assets/images/avatar/small/daniel.jpg' /> <List.Content> <List.Header as='a'>Daniel Louise</List.Header> <List.Description>Last seen watching <a><b>Arrested Development</b></a> just now.</List.Description> </List.Content> </List.Item> <List.Item> <Image avatar src='/assets/images/avatar/small/stevie.jpg' /> <List.Content> <List.Header as='a'>Stevie Feliciano</List.Header> <List.Description>Last seen watching <a><b>Bob's Burgers</b></a> 10 hours ago.</List.Description> </List.Content> </List.Item> <List.Item> <Image avatar src='/assets/images/avatar/small/elliot.jpg' /> <List.Content> <List.Header as='a'>Elliot Fu</List.Header> <List.Description>Last seen watching <a><b>The Godfather Part 2</b></a> yesterday.</List.Description> </List.Content> </List.Item> </List> ) export default ListExampleRelaxed
    src/useScroll.js
    taion/react-router-scroll
    import React from 'react'; import ScrollBehavior from 'scroll-behavior'; import ScrollBehaviorContext from './ScrollBehaviorContext'; function defaultCreateScrollBehavior(config) { return new ScrollBehavior(config); } export default function useScroll(shouldUpdateScrollOrConfig) { let shouldUpdateScroll; let createScrollBehavior; if ( !shouldUpdateScrollOrConfig || typeof shouldUpdateScrollOrConfig === 'function' ) { shouldUpdateScroll = shouldUpdateScrollOrConfig; createScrollBehavior = defaultCreateScrollBehavior; } else { ({ shouldUpdateScroll, createScrollBehavior = defaultCreateScrollBehavior, } = shouldUpdateScrollOrConfig); } return { renderRouterContext: (child, props) => ( <ScrollBehaviorContext shouldUpdateScroll={shouldUpdateScroll} createScrollBehavior={createScrollBehavior} routerProps={props} > {child} </ScrollBehaviorContext> ), }; }
    src/subheader-win.js
    danielmoll/component-win-articlepage
    import ArticleSubheaderContainer from '@economist/component-articletemplate/lib/subheader'; import React from 'react'; import { defaultGenerateClassNameList } from '@economist/component-variantify'; const extendedSubheaderItemClasses = [ 'margin-l-1', 'gutter-l', ]; export default function WinSubheader({ generateClassNameList = defaultGenerateClassNameList, sectionName, byline, publishDate, }) { return ( <ArticleSubheaderContainer generateClassNameList={generateClassNameList}> <h2 itemProp="byline" className={[ ...generateClassNameList('article-template__byline'), ...extendedSubheaderItemClasses, ].join(' ')} > {byline} </h2> <time itemProp="publishDate" dateTime={publishDate.raw} className={[ ...generateClassNameList('article-template__pubdate'), ...extendedSubheaderItemClasses, ].join(' ')} > {publishDate.formatted} </time> <h2 itemProp="section" className={[ ...generateClassNameList('article-template__section-name'), ...extendedSubheaderItemClasses, ].join(' ')} > {sectionName} </h2> </ArticleSubheaderContainer> ); } if (process.env.NODE_ENV !== 'production') { WinSubheader.propTypes = { generateClassNameList: React.PropTypes.func, sectionName: React.PropTypes.string, byline: React.PropTypes.string, publishDate: React.PropTypes.shape({ raw: React.PropTypes.string, formatted: React.PropTypes.string, }), }; }
    src/pages/generic.js
    pascalwhoop/pascalwhoop.github.io
    import React from 'react' import Helmet from 'react-helmet' import Layout from '../components/layout' import pic11 from '../assets/images/pic11.jpg' const Generic = (props) => ( <Layout> <Helmet> <title>Generic - Forty by HTML5 UP</title> <meta name="description" content="Generic Page" /> </Helmet> <div id="main" className="alt"> <section id="one"> <div className="inner"> <header className="major"> <h1>Generic</h1> </header> <span className="image main"><img src={pic11} alt="" /></span> <p>Donec eget ex magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque venenatis dolor imperdiet dolor mattis sagittis. Praesent rutrum sem diam, vitae egestas enim auctor sit amet. Pellentesque leo mauris, consectetur id ipsum sit amet, fergiat. Pellentesque in mi eu massa lacinia malesuada et a elit. Donec urna ex, lacinia in purus ac, pretium pulvinar mauris. Curabitur sapien risus, commodo eget turpis at, elementum convallis elit. Pellentesque enim turpis, hendrerit.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dapibus rutrum facilisis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam tristique libero eu nibh porttitor fermentum. Nullam venenatis erat id vehicula viverra. Nunc ultrices eros ut ultricies condimentum. Mauris risus lacus, blandit sit amet venenatis non, bibendum vitae dolor. Nunc lorem mauris, fringilla in aliquam at, euismod in lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In non lorem sit amet elit placerat maximus. Pellentesque aliquam maximus risus, vel sed vehicula.</p> <p>Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque venenatis dolor imperdiet dolor mattis sagittis. Praesent rutrum sem diam, vitae egestas enim auctor sit amet. Pellentesque leo mauris, consectetur id ipsum sit amet, fersapien risus, commodo eget turpis at, elementum convallis elit. Pellentesque enim turpis, hendrerit tristique lorem ipsum dolor.</p> </div> </section> </div> </Layout> ) export default Generic
    components/Session.js
    sunday-school/sundayschool.rocks
    import React from 'react' import MD from './MD' import Header from './Header' import SessionTitle from './SessionTitle' const Session = (session) => <div> <Header><SessionTitle {...session} /></Header> <h2>Agenda</h2> {MD(session.agenda)} </div> export default Session
    examples/huge-apps/routes/Course/routes/Announcements/components/Announcements.js
    Jastrzebowski/react-router
    import React from 'react'; class Announcements extends React.Component { render () { return ( <div> <h3>Announcements</h3> {this.props.children || <p>Choose an announcement from the sidebar.</p>} </div> ); } } export default Announcements;
    packages/site/pages/_document.js
    InventingWithMonster/redshift
    import React from 'react'; import Document, { Head, Main, NextScript } from 'next/document'; import { ServerStyleSheet } from 'styled-components'; import Analytics from '~/templates/global/Analytics'; export default class PageTemplate extends Document { render() { const stylesheet = new ServerStyleSheet(); const main = stylesheet.collectStyles(<Main />); const styleTags = stylesheet.getStyleElement(); return ( <html lang="en"> <Head> <meta charSet="UTF-8" /> <meta name="viewport" content="initial-scale=1.0, width=device-width" /> <meta name="og:locale" property="og:locale" content="en_US" /> <link href="https://fonts.googleapis.com/css?family=Inconsolata:400|PT+Sans:400,700" rel="stylesheet" /> <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png" /> <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@popmotionjs" /> <link rel="shortcut icon" href="/images/favicon.ico" /> {styleTags} <Analytics /> </Head> <body id="root"> {main} <NextScript /> </body> </html> ); } }
    docs/src/pages/components/menus/CustomizedMenus.js
    lgollut/material-ui
    import React from 'react'; import { withStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import Menu from '@material-ui/core/Menu'; import MenuItem from '@material-ui/core/MenuItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; import InboxIcon from '@material-ui/icons/MoveToInbox'; import DraftsIcon from '@material-ui/icons/Drafts'; import SendIcon from '@material-ui/icons/Send'; const StyledMenu = withStyles({ paper: { border: '1px solid #d3d4d5', }, })((props) => ( <Menu elevation={0} getContentAnchorEl={null} anchorOrigin={{ vertical: 'bottom', horizontal: 'center', }} transformOrigin={{ vertical: 'top', horizontal: 'center', }} {...props} /> )); const StyledMenuItem = withStyles((theme) => ({ root: { '&:focus': { backgroundColor: theme.palette.primary.main, '& .MuiListItemIcon-root, & .MuiListItemText-primary': { color: theme.palette.common.white, }, }, }, }))(MenuItem); export default function CustomizedMenus() { const [anchorEl, setAnchorEl] = React.useState(null); const handleClick = (event) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; return ( <div> <Button aria-controls="customized-menu" aria-haspopup="true" variant="contained" color="primary" onClick={handleClick} > Open Menu </Button> <StyledMenu id="customized-menu" anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose} > <StyledMenuItem> <ListItemIcon> <SendIcon fontSize="small" /> </ListItemIcon> <ListItemText primary="Sent mail" /> </StyledMenuItem> <StyledMenuItem> <ListItemIcon> <DraftsIcon fontSize="small" /> </ListItemIcon> <ListItemText primary="Drafts" /> </StyledMenuItem> <StyledMenuItem> <ListItemIcon> <InboxIcon fontSize="small" /> </ListItemIcon> <ListItemText primary="Inbox" /> </StyledMenuItem> </StyledMenu> </div> ); }
    src/js/components/input-ssn.js
    training4developers/react_redux_12122016
    import React from 'react'; export class InputSSN extends React.Component { static propTypes = { onChange: React.PropTypes.func, value: React.PropTypes.string, name: React.PropTypes.string }; onChange = (e) => { e.target.value = e.target.value.replace('-', ''); e.target.value = e.target.value.replace('-', ''); e.target.value = e.target.value.slice(0, 9); this.props.onChange(e); } render() { let ssn = this.props.value; if (ssn.length > 2) { ssn = ssn.slice(0,3) + '-' + ssn.slice(3); } if (ssn.length > 5) { ssn = ssn.slice(0,6) + '-' + ssn.slice(6); } return <input type="text" name={this.props.name} value={ssn} onChange={this.onChange} />; } }
    src/components/migration/Migrate2.js
    safex/safex_wallet
    import React from 'react'; import {createSafexAddress, verify_safex_address, structureSafexKeys} from '../../utils/migration'; import {openMigrationAlert, closeMigrationAlert} from '../../utils/modals'; const fs = window.require('fs'); import {encrypt} from "../../utils/utils"; import MigrationAlert from "../migration//partials/MigrationAlert"; var swg = window.require('safex-addressjs'); const fileDownload = require('react-file-download'); //Set the Safex Address export default class Migrate2 extends React.Component { constructor(props) { super(props); this.state = { loading: true, status_text: "", create_address: false, safex_address: "", safex_spend_pub: "", safex_spend_sec: "", safex_view_pub: "", safex_view_sec: "", safex_checksum: "", safex_key: {}, safex_keys: {}, migration_alert: false, migration_alert_text: '', all_field_filled: false, used_addresses: false, existing_addresses: false, }; this.setSafexAddress = this.setSafexAddress.bind(this); this.createSafexKey = this.createSafexKey.bind(this); this.saveSafexKeys = this.saveSafexKeys.bind(this); this.setYourKeys = this.setYourKeys.bind(this); this.selectKey = this.selectKey.bind(this); this.setOpenMigrationAlert = this.setOpenMigrationAlert.bind(this); this.setCloseMigrationAlert = this.setCloseMigrationAlert.bind(this); this.startOver = this.startOver.bind(this); this.checkFields = this.checkFields.bind(this); this.usedAddresses = this.usedAddresses.bind(this); this.existingAddresses = this.existingAddresses.bind(this); this.exportNewWalletAddress = this.exportNewWalletAddress.bind(this); } componentDidMount() { try { var json = JSON.parse(localStorage.getItem('wallet')); } catch (e) { this.setOpenMigrationAlert('Error parsing the wallet data.'); } this.setState({ safex_keys: json.safex_keys, loading: false }) } setSafexAddress(e) { e.preventDefault(); } //generates a new random safex key set createSafexKey() { this.setState({create_address: true, loading: true}); const safex_keys = createSafexAddress(); localStorage.setItem('new_wallet_address', JSON.stringify(safex_keys)); this.setState({ safex_key: safex_keys, safex_address: safex_keys.public_addr, safex_spend_pub: safex_keys.spend.pub, safex_spend_sec: safex_keys.spend.sec, safex_view_pub: safex_keys.view.pub, safex_view_sec: safex_keys.view.sec, loading: false, }); } //use this after safex keys were generated saveSafexKeys() { //in here do the logic for modifying the wallet file data info try { var json = JSON.parse(localStorage.getItem('wallet')); } catch (e) { this.setOpenMigrationAlert('Error parsing the wallet data.'); } if (json.hasOwnProperty('safex_keys')) { json['safex_keys'].push(this.state.safex_key); } else { json['safex_keys'] = []; json['safex_keys'].push(this.state.safex_key); } var index = -1; for (var key in json.keys) { if (json.keys[key].public_key === this.props.data.address) { index = key; json.keys[key]['migration_data'] = {}; json.keys[key]['migration_data'].safex_keys = this.state.safex_key; json.keys[key].migration_progress = 2; } } var algorithm = 'aes-256-ctr'; var password = localStorage.getItem('password'); var cipher_text = encrypt(JSON.stringify(json), algorithm, password); fs.writeFile(localStorage.getItem('wallet_path'), cipher_text, (err) => { if (err) { console.log('Problem communicating to the wallet file.'); this.setOpenMigrationAlert('Problem communicating to the wallet file.'); } else { try { localStorage.setItem('wallet', JSON.stringify(json)); var json2 = JSON.parse(localStorage.getItem('wallet')); console.log(json2.keys[index].migration_data); this.exportNewWalletAddress(); this.props.setMigrationProgress(2); } catch (e) { console.log(e); this.setOpenMigrationAlert('An error adding a key to the wallet. Please contact [email protected]'); } } }); } //use this if the keys are provided by the user setYourKeys(e) { e.preventDefault(); if (e.target.spend_key.value === '' || e.target.view_key.value === '' || e.target.safex_address.value === '') { this.setOpenMigrationAlert('Fill out all the fields'); } else { let duplicate = false; //here check for duplicates for (var key in this.state.safex_keys) { console.log(this.state.safex_keys[key].spend.sec) if (this.state.safex_keys[key].spend.sec === e.target.spend_key.value && this.state.safex_keys[key].view.sec === e.target.view_key.value && this.state.safex_keys[key].public_addr === e.target.safex_address.value) { duplicate = true; console.log("duplicate detected") } } if (verify_safex_address(e.target.spend_key.value, e.target.view_key.value, e.target.safex_address.value)) { const safex_keys = structureSafexKeys(e.target.spend_key.value, e.target.view_key.value); try { var json = JSON.parse(localStorage.getItem('wallet')); } catch (e) { console.log('Error parsing the wallet data.'); this.setOpenMigrationAlert('Error parsing the wallet data.'); } if (json.hasOwnProperty('safex_keys') && duplicate === false) { json['safex_keys'].push(safex_keys); } else if (duplicate === false) { json['safex_keys'] = []; json['safex_keys'].push(safex_keys); } var index = -1; for (var key in json.keys) { if (json.keys[key].public_key === this.props.data.address) { index = key; json.keys[key]['migration_data'] = {}; json.keys[key]['migration_data'].safex_keys = safex_keys; json.keys[key].migration_progress = 2; } } var algorithm = 'aes-256-ctr'; var password = localStorage.getItem('password'); var cipher_text = encrypt(JSON.stringify(json), algorithm, password); fs.writeFile(localStorage.getItem('wallet_path'), cipher_text, (err) => { if (err) { console.log('Problem communicating to the wallet file.'); this.setOpenMigrationAlert('Problem communicating to the wallet file.'); } else { try { localStorage.setItem('wallet', JSON.stringify(json)); this.setState({ safex_key: safex_keys, safex_address: safex_keys.public_addr, safex_spend_pub: safex_keys.spend.pub, safex_spend_sec: safex_keys.spend.sec, safex_view_pub: safex_keys.view.pub, safex_view_sec: safex_keys.view.sec, loading: false, }); this.props.setMigrationProgress(2); } catch (e) { console.log(e); this.setOpenMigrationAlert('An error adding a key to the wallet. Please contact [email protected]'); } } }); } else { console.log('Incorrect keys'); this.setOpenMigrationAlert('Incorrect keys or duplicate'); } } } //use this for selected key from dropdown menu selectKey(e) { e.preventDefault(); if (e.target.address_selection.value.length > 0) { try { var json = JSON.parse(localStorage.getItem('wallet')); } catch (e) { console.log('Error parsing the wallet data.'); this.setOpenMigrationAlert('Error parsing the wallet data.'); } var key_index = -1; var x_index = -1; for (var key in json.keys) { if (json.keys[key].public_key === this.props.data.address) { key_index = key; for (var x_key in json.safex_keys) { if (json.safex_keys[x_key].public_addr === e.target.address_selection.value) { x_index = x_key; json.keys[key_index]['migration_data'] = {}; json.keys[key_index]['migration_data'].safex_keys = json.safex_keys[x_index]; json.keys[key_index].migration_progress = 2; } } } } if (x_index != -1 && key_index != -1) { var algorithm = 'aes-256-ctr'; var password = localStorage.getItem('password'); var cipher_text = encrypt(JSON.stringify(json), algorithm, password); fs.writeFile(localStorage.getItem('wallet_path'), cipher_text, (err) => { if (err) { this.setOpenMigrationAlert('Problem communicating to the wallet file.'); } else { try { localStorage.setItem('wallet', JSON.stringify(json)); var json2 = JSON.parse(localStorage.getItem('wallet')); this.setState({ safex_key: json2.safex_keys[x_index], safex_address: json2.safex_keys[x_index].public_addr, safex_spend_pub: json2.safex_keys[x_index].spend.pub, safex_spend_sec: json2.safex_keys[x_index].spend.sec, safex_view_pub: json2.safex_keys[x_index].view.pub, safex_view_sec: json2.safex_keys[x_index].view.sec, loading: false, }); this.props.setMigrationProgress(2); } catch (e) { console.log(e); this.setOpenMigrationAlert('An error adding a key to the wallet. Please contact [email protected]'); } } }); } else { console.log('Key does not exist'); this.setOpenMigrationAlert('Key does not exist'); } } else { console.log('No key from your list has been selected'); this.setOpenMigrationAlert('No key from your list has been selected'); } } startOver() { this.setState({ create_address: false, used_addresses: false, existing_addresses: false, all_field_filled: false, }) } setOpenMigrationAlert(message) { openMigrationAlert(this, message); } setCloseMigrationAlert() { closeMigrationAlert(this); } checkFields() { var safex_address = document.getElementById('safex_address').value; var spend_key = document.getElementById('spend_key').value; var view_key = document.getElementById('view_key').value; if (safex_address !== '' && spend_key !== '' && view_key !== '') { this.setState({ all_field_filled: true }) } else { this.setState({ all_field_filled: false }) } } usedAddresses() { this.setState({ used_addresses: true }) } existingAddresses() { this.setState({ existing_addresses: true }) } exportNewWalletAddress() { var wallet_data = JSON.parse(localStorage.getItem('new_wallet_address')); var new_wallet = ""; new_wallet += "Public address: " + wallet_data.public_addr + '\n'; new_wallet += "Spendkey " + '\n'; new_wallet += "pub: " + wallet_data.spend.pub + '\n'; new_wallet += "sec: " + wallet_data.spend.sec + '\n'; new_wallet += "Viewkey " + '\n'; new_wallet += "pub: " + wallet_data.view.pub + '\n'; new_wallet += "sec: " + wallet_data.view.sec + '\n'; var date = Date.now(); fileDownload(new_wallet, date + 'new_wallet_address.txt'); } render() { var options = []; if (this.state.safex_keys) { Object.keys(this.state.safex_keys).map(key => { options.push( <option key={key} value={this.state.safex_keys[key].public_addr}> {this.state.safex_keys[key].public_addr} </option>) }); } return ( <div> <p>Step 2/4 - Selecting The Safex Key</p> { this.state.create_address ? <div> <div className="set-your-key-head"> <div className="set-your-key-left"> <img src="images/migration/cube.png" alt="New Key"/> </div> <div className="set-your-key-right"> <h3 className="green-text">Migrate to new Safex address</h3> </div> </div> <p className="red-text"> The following wallet information is to control your coins, do not share it. <br/> Sharing this information can and will result in total loss of your Safex Tokens and Safex Cash.<br/> Keep this information safe at all times! </p> <p>Wallet Address</p> <input type="text" className="new-address-input" defaultValue={this.state.safex_address} /> {/* <p>{this.state.safex_address}</p> */} <p>Spend Key</p> <p>public: {this.state.safex_spend_pub}</p> <p>secret: {this.state.safex_spend_sec}</p> <p>View key</p> <p>public: {this.state.safex_view_pub}</p> <p>secret: {this.state.safex_view_sec}</p> <button className="button-shine" onClick={this.startOver}>Go back</button> <button className="button-shine green-btn" onClick={this.saveSafexKeys}>Back up my Safex Keys and continue </button> </div> : <div> { this.state.used_addresses ? <div> <div className="set-your-key-head"> <div className="set-your-key-left"> <img src="images/migration/my-keys.png" alt="My Keys"/> </div> <div className="set-your-key-right"> <h3 className="purple-text">Your previously used Safex addresses</h3> </div> </div> <form className="previuously-used-form" onSubmit={this.selectKey}> <select name="address_selection"> {options} </select> <button className="button-shine green-btn">Set address</button> </form> <button className="button-shine" onClick={this.startOver}>Go back</button> </div> : <div> { this.state.existing_addresses ? <div> <div className="set-your-key-head"> <div className="set-your-key-left"> <img src="images/migration/enter-key.png" alt="Enter Key"/> </div> <div className="set-your-key-right"> <h3 className="blue-text">Migration using my existing Safex address</h3> </div> </div> <form onSubmit={this.setYourKeys}> <div className="form-group"> <input className="col-xs-8" name="safex_address" placeholder="Safex address" id="safex_address" onChange={this.checkFields}/> <label className="col-xs-4 col-form-label" htmlFor="safex_address">If you already have Safex address, enter it here</label> </div> <div className="form-group"> <input className="col-xs-8" name="spend_key" placeholder="Secret spend key" id="spend_key" onChange={this.checkFields}/> <label className="col-xs-4 col-form-label" htmlFor="spend_key">Enter your Safex address secret spend key here</label> </div> <div className="form-group"> <input className="col-xs-8" name="view_key" placeholder="Secret view key" id="view_key" onChange={this.checkFields}/> <label className="col-xs-4 col-form-label" htmlFor="view_key">Enter your Safex address secret view key here</label> </div> <button className={this.state.all_field_filled ? "button-shine green-btn" : "button-shine"}>Set your address </button> </form> <button className="button-shine" onClick={this.startOver}>Go back </button> </div> : <div className="address-wrap-inner"> <div className="migrate-btns-wrap"> <div className="col-xs-4 btn-wrap"> <button className={this.state.create_address ? "active" : ""} onClick={this.createSafexKey}> <img src="images/migration/cube.png" alt="Cube"/> <span>New Address</span> </button> <p>Create new address</p> </div> <div className="col-xs-4 btn-wrap"> <button className={this.state.my_address ? "active" : ""} onClick={this.usedAddresses}> <img src="images/migration/my-keys.png" alt="My Keys"/> <span>Previously Used</span> </button> <p>Previously used address</p> </div> <div className="col-xs-4 btn-wrap"> <button className={this.state.enter_address ? "active" : ""} onClick={this.existingAddresses}> <img src="images/migration/enter-key.png" alt="Enter Key"/> <span>My Address</span> </button> <p>Use My Safex address</p> </div> </div> </div> } </div> } </div> } <MigrationAlert migrationAlert={this.state.migration_alert} migrationAlertText={this.state.migration_alert_text} closeMigrationAlert={this.setCloseMigrationAlert} /> </div> ) } }
    app/routes.js
    ideal-life-generator/react-full-stack-starter
    import React from 'react'; import { IndexRoute, Route } from 'react-router'; import { routerActions } from 'react-router-redux'; import { UserAuthWrapper } from 'redux-auth-wrapper'; import Root from './containers/Root'; import Home from './containers/Home'; import Users from './containers/Users'; import Login from './containers/Login'; import Signup from './containers/Signup'; import Profile from './containers/Profile'; const UserIsAuthenticated = UserAuthWrapper({ authSelector: ({ user }) => user, predicate: ({ isAuthenticated }) => isAuthenticated, redirectAction: routerActions.replace, wrapperDisplayName: 'UserIsAuthenticated', }); const UserIsNotAuthenticated = UserAuthWrapper({ authSelector: ({ user }) => user, predicate: ({ isAuthenticated }) => !isAuthenticated, redirectAction: routerActions.replace, wrapperDisplayName: 'UserIsNotAuthenticated', failureRedirectPath: (state, ownProps) => ownProps.location.query.redirect || '/', allowRedirectBack: false, }); export default ( <Route path="/" component={Root}> <IndexRoute component={Home} /> <Route path="/users" component={Users} /> <Route path="/login" component={UserIsNotAuthenticated((Login))} /> <Route path="/signup" component={UserIsNotAuthenticated(Signup)} /> <Route path="/profile" component={UserIsAuthenticated(Profile)} /> </Route> ); // https://github.com/acdlite/redux-router
    lib/components/ErrorPage.js
    hanford/filepizza
    import ErrorStore from '../stores/ErrorStore' import React from 'react' import Spinner from './Spinner' export default class ErrorPage extends React.Component { constructor() { super() this.state = ErrorStore.getState() this._onChange = () => { this.setState(ErrorStore.getState()) } } componentDidMount() { ErrorStore.listen(this._onChange) } componentDidUnmount() { ErrorStore.unlisten(this._onChange) } render() { return <div className="page"> <Spinner dir="up" /> <h1 className="with-subtitle">FilePizza</h1> <p className="subtitle"> <strong>{this.state.status}:</strong> {this.state.message} </p> {this.state.stack ? <pre>{this.state.stack}</pre> : null} </div> } }
    imports/ui/components/resident-details/accounts/private-account/edit-pa-bill/continuation.js
    gagpmr/app-met
    import React from 'react'; import ReactDOM from 'react-dom'; import { browserHistory } from 'react-router'; import * as Styles from '/imports/modules/styles.js'; import { UpdateResident } from '/imports/api/residents/methods.js'; var DatePicker = require('react-datepicker'); var moment = require('moment'); require('/imports/ui/layouts/react-datepicker.css'); export class ContinuationTableBody extends React.Component { constructor(props) { super(props); this.keyPressed = this.keyPressed.bind(this); this.alterPaid = this.alterPaid.bind(this); this.submitForm = this.submitForm.bind(this); this.changeStartDate = this.changeStartDate.bind(this); this.changeEndDate = this.changeEndDate.bind(this); this.state = { IsPaid: null, StartDate: null, EndDate: null }; } keyPressed(event) { if (event.key === "Enter") { this.submitForm(event); } } submitForm(e) { e.preventDefault(); var startdate = moment.utc().utcOffset(+ 5.5).format('DD-MM-YYYY'); var enddate = moment.utc().utcOffset(+ 5.5).format('DD-MM-YYYY'); if (this.state.StartDate !== null) { startdate = this.state.StartDate.format('DD-MM-YYYY'); } else { startdate = moment(this.props.bill.StartDate).format('DD-MM-YYYY'); } if (this.state.EndDate !== null) { enddate = this.state.EndDate.format('DD-MM-YYYY'); } else { enddate = moment(this.props.bill.EndDate).format('DD-MM-YYYY'); } var paid = $('#IsPaid').is(":checked"); if (this.props.resident && this.props.bill) { var residentId = this.props.resident._id; var data = { ResidentId: residentId, PaBillId: this.props.bill._id, StartDate: startdate, EndDate: enddate, EditPaContinuationBill: true, IsPaid: paid } UpdateResident.call({ data: data }); browserHistory.push('/resident-details/' + residentId); } } alterPaid(e) { if (e.target.checked) { this.setState({ IsPaid: true }); } if (!e.target.checked) { this.setState({ IsPaid: false }); } } changeStartDate(date) { this.setState({ StartDate: date }); } changeEndDate(date) { this.setState({ EndDate: date }); } render() { var startdate = null; var enddate = null; var ispaid = null; if (this.props.bill !== undefined) { ispaid = this.props.bill.IsPaid; } if (this.state.StartDate !== null) { startdate = this.state.StartDate; } else { startdate = moment.utc().utcOffset(+ 5.5); } if (this.state.EndDate !== null) { enddate = this.state.EndDate; } else { enddate = moment.utc().utcOffset(+ 5.5); } return ( <tbody> <tr> <th>Start Date</th> <td> <DatePicker autoFocus="autofocus" tabIndex={ 1 } dateFormat="DD-MM-YYYY" selected={ startdate } onChange={ this.changeStartDate }/> </td> </tr> <tr> <th>End Date</th> <td> <DatePicker tabIndex={ 1 } dateFormat="DD-MM-YYYY" selected={ enddate } onChange={ this.changeEndDate }/> </td> </tr> <tr> <th>Is Paid</th> <td style={ Styles.PaddingThreeLeft }> <input style={ Styles.WidthEightyPaddingZeroLeft } type="checkbox" id="IsPaid" onKeyDown={ this.keyPressed } onChange={ this.alterPaid } defaultChecked={ ispaid }/> </td> </tr> <tr> <th className="text-center" colSpan="2"> <a onClick={ this.submitForm } onKeyDown={ this.keyPressed } href="">Save</a> </th> </tr> </tbody> ) } } ContinuationTableBody.propTypes = { bill: React.PropTypes.object, resident: React.PropTypes.object };
    public/js/components/user_instructor.js
    AC287/wdi_final_arrowlense2.0_FE
    import React from 'react' import {Link} from 'react-router' import Firebase from 'firebase' import EditImgUrl from './user_img_edit.js' import CreateClass from './class_new.js' export default React.createClass({ contextTypes: { user: React.PropTypes.string, userid: React.PropTypes.string, userinfo: React.PropTypes.object, classes: React.PropTypes.object, router: React.PropTypes.object.isRequired, }, renderClasses: function(key) { return( <Classes key={key} details={this.context.classes[key]} router={this.context.router}/> ) }, filterActive: function(key){ return this.context.classes[key].active===true }, filterInactive: function(key){ return this.context.classes[key].active===false }, render: function(){ return( <div className="container-fluid"> <div className="row"> <div className="col-md-3 imgdiv"> <img src={this.context.userinfo.imgurl} className="profileimage"/> <br/> <br/> <EditImgUrl /> </div> <div className="col-md-4"> <p>Name: <strong>{this.context.userinfo.firstname} {this.context.userinfo.lastname}</strong></p> <p>Email: {this.context.userinfo.email}</p> <p>Instructor ID: {this.context.userinfo.instructorid}</p> </div> <div className="col-md-5"> <button type="button" className="btn btn-default btn-lg btn-block"> Create A Blog </button> <CreateClass /> </div> </div> <hr/> <div> <div className="container title"> <h3>My Classes</h3> </div> <div className="row"> <div className="col-md-6"> <h4>Active</h4> <div className="renderclasses"> {Object.keys(this.context.classes) .filter(this.filterActive) .map(this.renderClasses)} </div> </div> <div className="col-md-6"> <h4>Inactive</h4> <div className="renderclasses"> {Object.keys(this.context.classes) .filter(this.filterInactive) .map(this.renderClasses)} </div> </div> </div> </div> </div> ) } }) const Classes = React.createClass({ render: function(){ return( <Link to={`/class/${this.props.details.id}`}> <div className="row container-fluid"> <div className="col-sm-3 borderline"> <p><strong>{this.props.details.name}</strong></p> </div> <div className="col-sm-3 borderline"> <p>{this.props.details.semester} {this.props.details.year}</p> </div> <div className="col-sm-6 borderline"> <p>{this.props.details.description}</p> </div> </div> </Link> ) } })
    test/test_helper.js
    Eleutherado/ReactBasicBlog
    import _$ from 'jquery'; import React from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-addons-test-utils'; import jsdom from 'jsdom'; import chai, { expect } from 'chai'; import chaiJquery from 'chai-jquery'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducers from '../src/reducers'; global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); global.window = global.document.defaultView; global.navigator = global.window.navigator; const $ = _$(window); chaiJquery(chai, chai.util, $); function renderComponent(ComponentClass, props = {}, state = {}) { const componentInstance = TestUtils.renderIntoDocument( <Provider store={createStore(reducers, state)}> <ComponentClass {...props} /> </Provider> ); return $(ReactDOM.findDOMNode(componentInstance)); } $.fn.simulate = function(eventName, value) { if (value) { this.val(value); } TestUtils.Simulate[eventName](this[0]); }; export {renderComponent, expect};
    packages/mineral-ui-icons/src/IconVerticalAlignTop.js
    mineral-ui/mineral-ui
    /* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconVerticalAlignTop(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <path d="M8 11h3v10h2V11h3l-4-4-4 4zM4 3v2h16V3H4z"/> </g> </Icon> ); } IconVerticalAlignTop.displayName = 'IconVerticalAlignTop'; IconVerticalAlignTop.category = 'editor';
    example/app/src/index.js
    aurbano/react-ds
    import React from 'react'; import ReactDOM from 'react-dom'; import './example.css'; import './react-ds.css'; import Examples from './Examples'; import registerServiceWorker from './registerServiceWorker'; ReactDOM.render(<Examples />, document.getElementById('root')); registerServiceWorker();
    src/components/Main1.js
    chris-deng/gallery-by-react
    /** * Created by dengbingyu on 2016/10/28. */ require('normalize.css/normalize.css'); require('styles/App.scss'); import React from 'react'; import ReactDOM from 'react-dom'; //获取图片相关的数据 let imageDatas = require('json!../data/imageDatas.json'); imageDatas = ((imageDatasArr)=>{ // 将图片的url加入的图片object数组中 for(var i=0,len=imageDatasArr.length;i<len;i++){ let singleImgDate = imageDatasArr[i]; singleImgDate.imageURL= require('../images/' + singleImgDate.fileName); imageDatasArr[i] = singleImgDate; } return imageDatasArr; })(imageDatas); // 拿到一个范围内的随机值 var getRandomPos = (low,high) => Math.floor(Math.random()*(high-low)+low); // 拿到0-30度角里面的随机角度值 var getRandomRotate = ()=> { return (Math.random()>0.5?'':'-') + Math.ceil(Math.random()*30); }; // 创建单个图片组件 class SingleImgComp extends React.Component { constructor(props){ super(props); this.handleClick=this.handleClick.bind(this); // 坑,为什么呢? } // 图片翻转点击事件 handleClick(e){ this.props.inverse(); // 执行翻转动作 e.stopPropagation(); e.preventDefault(); } render(){ let styleObj = {}; // 样式对象 if(this.props.arragneStyle.pos){ styleObj = this.props.arragneStyle.pos; } if(this.props.arragneStyle.rotate){ // ['-webkit-','-moz-','-o-',''].forEach((value)=>{ // styleObj[value+'transform'] = 'rotate(' + this.props.arragneStyle.rotate + 'deg)'; // }); styleObj['transform'] = 'rotate(' + this.props.arragneStyle.rotate + 'deg)'; } var figureClassName = 'img-figure'; figureClassName += this.props.arragneStyle.isInverse?' is-Inverse':''; return ( <figure className={ figureClassName } style={styleObj} onClick={this.handleClick}> <img src={this.props.data.imageURL} alt={this.props.data.title} /> <figcaption> <h2 className="img-title">{this.props.data.title}</h2> <div className="img-back" onClick={this.handleClick}> <p>{this.props.data.desc}</p> </div> </figcaption> </figure> ); } } class GalleryByReactApp extends React.Component { constructor(props){ super(props); this.Constant = { // 初始化每张图片的坐标范围,用于盛放各个分区的坐标范围 centerPos: { left:0, top:0 }, hsec:{ // 水平区域坐标 hLeftSecX:[0,0], // 水平区域左分区x轴的坐标范围 hRightSecX:[0,0], // 水平区域右分区x轴的坐标范围 hY: [0,0] // 水平区域y的取值相同 }, vsec:{ // 垂直方向只有上分区 leftX: [0,0], topY: [0,0] } }; this.state = { // 真正的图片坐标 imgsArrangeArr: [ // 图片坐标数组 // { // pos:{ // top:0, // left:0 // }, // rotate:0, // isInverse: false // 是否翻转 // } ] }; } inverse(index){ // 翻转图片的函数 return () => { let imgsArrangeArr = this.state.imgsArrangeArr; imgsArrangeArr[index].isInverse = !imgsArrangeArr[index].isInverse; this.setState({ imgsArrangeArr: imgsArrangeArr }); } } // 布局页面图片的坐标 rearrange(centerIndex){ let arrangeImgArr = this.state.imgsArrangeArr, Constant = this.Constant, centerPos = Constant.centerPos, hLeftSecRangeX = Constant.hsec.hLeftSecX, hRightSecRangeX = Constant.hsec.hRightSecX, hY = Constant.hsec.hY, vLeftX = Constant.vsec.leftX, // 上分区 vTopY = Constant.vsec.topY; // 根据居中图片的下标,插入中心图片的坐标 let centerImgPosArr = arrangeImgArr.splice(centerIndex,1); // 取出了中心图片的元素 centerImgPosArr[0] = { pos : centerPos // 将中心图片的坐标插入,居中的图片不需要旋转 }; // 上分区图片位置 let imgTopArr = [], //用于放置上分区图片 topNum = Math.floor(Math.random()*2); // 上分区图片的个数,0或者1 let topImgIndex = Math.floor(Math.random()*(arrangeImgArr.length - topNum)); // 随机取出放置在上分区图片的下标 imgTopArr = arrangeImgArr.splice(topImgIndex,topNum); // 位于上分区的图片数组 imgTopArr && imgTopArr.forEach((value,index)=>{ // 填充上分区图片的位置信息 imgTopArr[index] = { pos:{ top: getRandomPos(vTopY[0],vTopY[1]), left: getRandomPos(vLeftX[0],vLeftX[1]) }, rotate: getRandomRotate() } }); // 左分区和右分区图片位置信息 for (let i=0,len=arrangeImgArr.length,k=len/2;i<len;i++){ let secLOR = null; // 存放左分区或者右分区x的坐标 if(i<k){ // 左分区 secLOR = hLeftSecRangeX; }else { secLOR = hRightSecRangeX; } arrangeImgArr[i]={ pos : { top: getRandomPos(hY[0],hY[1]), left: getRandomPos(secLOR[0],secLOR[1]) }, rotate: getRandomRotate() } } //前面分割了arrangeImgArr,取居中和上分区图片元素出来,现在合并进去 if(imgTopArr && imgTopArr){ // 填充上分区图片位置信息 arrangeImgArr.splice(topImgIndex,0,imgTopArr[0]); } arrangeImgArr.splice(centerIndex,0,centerImgPosArr[0]); // 填充居中图片的位置信息 this.setState({ imgsArrangeArr: arrangeImgArr }); } componentDidMount(){ // 给初始化的变量赋值 let stageDom = ReactDOM.findDOMNode(this.refs.stage), // 舞台dom元素 stageWidth = stageDom.scrollWidth, // 舞台宽度 stageHeight = stageDom.scrollHeight, // 舞台高度 halfStageW = Math.ceil(stageWidth / 2), // 舞台宽一半 halfStageH = Math.ceil(stageHeight/2); // 舞台高一半 let imgFigDom = ReactDOM.findDOMNode(this.refs.imgFigure0), // 图片的dom元素,因为每张图片的宽高相同,所以这里取imgFigure0 imgFigWidth = imgFigDom.scrollWidth, // 图片宽 imgFigHeight = imgFigDom.scrollHeight, halfImgW = Math.ceil(imgFigWidth/2), halfImgH = Math.ceil(imgFigHeight/2); let centerPos = { // 中心图片的坐标 left: halfStageW - halfImgW, top: halfStageH - halfImgH }; this.Constant.centerPos = centerPos; // 水平方向--左侧分区x的坐标范围 this.Constant.hsec.hLeftSecX[0] = - halfImgW; this.Constant.hsec.hLeftSecX[1] = halfStageW - halfImgW*3; // 水平方向--右侧分区x的坐标范围 this.Constant.hsec.hRightSecX[0] = halfStageW + halfImgW; this.Constant.hsec.hRightSecX[1] = stageWidth - halfImgW; // 水平方向--y的取值方位 this.Constant.hsec.hY[0] = - halfImgH; this.Constant.hsec.hY[1] = stageHeight - halfImgH; // 垂直方向--上分区x的取值范围 this.Constant.vsec.leftX[0] = halfStageW - halfImgW; this.Constant.vsec.leftX[1] = halfStageW; // 垂直方向--上分区y的取值范围 this.Constant.vsec.topY[0] = -halfImgH; this.Constant.vsec.topY[1] = halfStageH - halfImgH*3; this.rearrange(0); // 将第0张图片作为中心图片布局页面 } render(){ let controllerUtils = []; let imgFigures = []; imageDatas.forEach((value,index)=>{ if(!this.state.imgsArrangeArr[index]){ // 如果对应下标中午位置信息,则填充 this.state.imgsArrangeArr[index] = { pos: { left:0, top:0 }, rotate:0, isInverse: false // 默认为正面 } } imgFigures.push(<SingleImgComp data={value} arragneStyle={this.state.imgsArrangeArr[index]} inverse={this.inverse(index)} ref={'imgFigure'+index} />) }); return ( <section className="stage" ref="stage"> <section className="img-sec"> {imgFigures} </section> <nav className="controller-nav"> {controllerUtils} </nav> </section> ); } } GalleryByReactApp.defaultProps = {}; export default GalleryByReactApp;
    src/javascript/index.js
    knowbody/redux-react-router-example-app
    import 'babel/polyfill'; import React from 'react'; import { render } from 'react-dom'; import injectTapEventPlugin from 'react-tap-event-plugin'; import createHashHistory from 'history/lib/createHashHistory'; import Root from './Root'; /* Needed for onTouchTap Can go away when react 1.0 release Check this repo: https://github.com/zilverline/react-tap-event-plugin */ injectTapEventPlugin(); render(<Root />, document.getElementById('root'));
    src/index.js
    tavofigse/flip-the-reactomster
    import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import { Router, browserHistory } from 'react-router' import { syncHistoryWithStore } from 'react-router-redux' import routes from './routes' import configureStore from './store/configureStore' import './styles/app.scss' const store = configureStore() const history = syncHistoryWithStore(browserHistory, store) ReactDOM.render( <Provider store={store}> <Router history={history} routes={routes} /> </Provider>, document.getElementById('root') )
    src/js/components/icons/base/Sync.js
    kylebyerly-hp/grommet
    // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-sync`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'sync'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M5,19 L16,19 C19.866,19 23,15.866 23,12 L23,9 M8,15 L4,19 L8,23 M19,5 L8,5 C4.134,5 1,8.134 1,12 L1,15 M16,1 L20,5 L16,9"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'Sync'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
    src/components/LoginForm/LoginForm.js
    TackleboxBeta/betabox-seed
    import React, { Component } from 'react'; import { reduxForm, Field, propTypes } from 'redux-form'; import loginValidation from './loginValidation'; import ValidationInput from '../ValidationInput/ValidationInput'; @reduxForm({ form: 'login', validate: loginValidation }) export default class LoginForm extends Component { static propTypes = { ...propTypes }; render() { const { handleSubmit, error } = this.props; return ( <form className="form-horizontal" onSubmit={handleSubmit}> <Field name="email" type="text" component={ValidationInput} label="Email" /> <Field name="password" type="password" component={ValidationInput} label="Password" /> {error && <p className="text-danger"><strong>{error}</strong></p>} <div className="row"> <div className="col-xs-2"> <button className="btn btn-success" type="submit"> <i className="fa fa-sign-in" />{' '}Log In </button> </div> <div className="col-xs-10"> <a className="btn btn-warning" href="/forgotpassword"> Forgot Password </a> </div> </div> </form> ); } }
    js/react/catch-of-the-day/node_modules/re-base/examples/github-notetaker/app/components/Notes/Notes.js
    austinjalexander/sandbox
    import React from 'react'; import NotesList from './NotesList'; import AddNote from './AddNote'; class Notes extends React.Component{ render(){ return ( <div> <h3> Notes for {this.props.username} </h3> <AddNote username={this.props.username} addNote={this.props.addNote} /> <NotesList notes={this.props.notes} /> </div> ) } }; Notes.propTypes = { username: React.PropTypes.string.isRequired, notes: React.PropTypes.array.isRequired, addNote: React.PropTypes.func.isRequired }; export default Notes;
    src/components/app.js
    fab1o/YouTube-Viewer
    import React, { Component } from 'react'; export default class App extends Component { render() { return ( <div>React simple starter</div> ); } }
    src/containers/CSM/CSM.js
    UncleYee/crm-ui
    import React from 'react'; import ReduxTableSelect from 'components/Form/NoLabel/ReduxTableSelect'; import MonthRangePicker from 'components/DatePicker/MonthRangePicker'; import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; import moment from 'moment'; import Modal from 'react-bootstrap/lib/Modal'; import Button from 'react-bootstrap/lib/Button'; import {connect} from 'react-redux'; import {getCSMInfo} from 'redux/modules/csm'; const styles = { header: { height: 34, position: 'relative' }, Menu: { left: 20, width: 210, float: 'left', position: 'relative' }, time: { width: 200, float: 'left' }, div: { float: 'none', position: 'relative', top: 20, width: 1200 }, root: { backgroundColor: 'white', width: '100%', minHeight: '660px', position: 'absolute' } }; @connect((state) => ({ csmInfo: state.csm.csmInfo || {}, }), { getCSMInfo, }) export default class CSM extends React.Component { static propTypes = { name: React.PropTypes.string, csmInfo: React.PropTypes.object, getCSMInfo: React.PropTypes.func, }; constructor(props) { super(props); this.state = { showTips: false, startDate: null, endDate: null, type: 0, defaultStart: null, defaultEnd: null, tableData: [], userNumStart: null, // 规模起始值 userNumEnd: null // 规模最大值 }; } componentWillMount() { const nowdays = new Date(); let year = nowdays.getFullYear(); let month = nowdays.getMonth(); if ( month === 0) { month = 12; year = year - 1; } if (month < 10) { month = '0' + month; } const myDate = new Date(year, month, 0); const lastDay = year + '-' + month + '-' + myDate.getDate(); const end = moment(new Date(lastDay)); const start = moment(new Date(lastDay)).add(-6, 'months').add(5, 'days'); const startDate = moment(start).format('YYYY-MM'); const endDate = moment(end).format('YYYY-MM'); this.setState({defaultStart: start, defaultEnd: end, startDate: startDate, endDate: endDate}); this.props.getCSMInfo(this.state.type, startDate, endDate); } // 时间段变化进行查询 CSMInfo = (start, end) => { this.setState({startDate: start, endDate: end}); this.props.getCSMInfo(this.state.type, this.state.startDate, this.state.endDate, this.state.userNumStart, this.state.userNumEnd); } // type 变化进行查询 changeValue = (type) => { this.setState({type: type}); this.props.getCSMInfo(type, this.state.startDate, this.state.endDate, this.state.userNumStart, this.state.userNumEnd); } // 规模变化查询 changeScale = (value) => { const getCsmInfo = () => this.props.getCSMInfo(this.state.type, this.state.startDate, this.state.endDate, this.state.userNumStart, this.state.userNumEnd); switch (value) { case '0': this.setState({userNumStart: 1, userNumEnd: 20}); break; case '1': this.setState({userNumStart: 21, userNumEnd: 100}); break; case '2': this.setState({userNumStart: 101, userNumEnd: 999999}); break; default: break; } // 事件队列 加入最后 等待上面的 setState 完成再执行 不需要使用异步 setTimeout(getCsmInfo); } defaultMonthRange = () => { return { start: this.state.defaultStart, end: this.state.defaultEnd }; } close = () => { this.setState({showTips: false}); } render() { const headConfig = this.props.csmInfo.titles || []; const tableData = this.props.csmInfo.rows || []; const tableOption = { noDataText: '无数据' }; const options = [ {value: '0', label: '客户总使用次数'}, {value: '1', label: '客户当月活跃人数'}, {value: '2', label: '人均使用次数'} ]; const scaleOptions = [ {value: '0', label: '1 ~ 20人'}, {value: '1', label: '21 ~ 100人'}, {value: '2', label: '100人以上'} ]; return ( <div style={styles.root}> <div style={styles.header}> <div style={styles.Menu}> <ReduxTableSelect getInfo={this.changeValue} name="csm" options={options} defaultValue="0"/> </div> { <div style={styles.Menu}> <ReduxTableSelect getInfo={this.changeScale} name="scale" options={scaleOptions} placeholder="请选择客户规模"/> </div> } <div style={styles.Menu}> <MonthRangePicker onSelect={this.CSMInfo} defaultValue={this.defaultMonthRange()}/> </div> </div> <div style={styles.div}> <BootstrapTable options={tableOption} bodyStyle={{height: 530, overflow: 'auto'}} data={tableData} headerStyle={{background: '#e6e7e8'}}> <TableHeaderColumn dataField="support_mananger_name" isKey width="100">客成经理</TableHeaderColumn> { headConfig.map((item, index) => <TableHeaderColumn key={index} dataField={item.title} dataSort width="100">{item.title}</TableHeaderColumn>) } </BootstrapTable> </div> <Modal show={this.state.showTips} onHide={this.close}> <Modal.Header closeButton> <Modal.Title>请选择结单状态</Modal.Title> </Modal.Header> <Modal.Body > 您选择的时间范围有误,时间范围必须在6-12个月之间,请重新选择! </Modal.Body> <Modal.Footer> <Button onClick={this.close}>关闭</Button> </Modal.Footer> </Modal> </div> ); } }
    app/components/FormMessages/index.js
    acebusters/ab-web
    import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import { baseColor, black, } from '../../variables'; const FormError = styled.span` margin: 0; padding: 0.5em 1em; font-size: 0.8em; font-family: $text-font-stack; float: left; color: ${baseColor}; width: 100%; `; const FormWarning = styled.span` margin: 0; padding: 0.5em 1em; font-size: 0.8em; font-family: $text-font-stack; float: left; color: ${black}; width: 100%; `; export function ErrorMessage(props) { return ( <FormError> <strong>{props.error}</strong> </FormError> ); } ErrorMessage.propTypes = { error: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), }; export function WarningMessage(props) { return ( <FormWarning> <strong>{props.warning}</strong> </FormWarning> ); } WarningMessage.propTypes = { warning: PropTypes.string, };
    todo/src/index.js
    iamwangxupeng/react-reflux-webpack-es6
    import React from 'react'; import ReactDOM from 'react-dom'; import Todo from './components/todo'; import csss from './style/main.css'; ReactDOM.render( <Todo> </Todo>, document.querySelector('#app') );
    src/svg-icons/notification/more.js
    ngbrown/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationMore = (props) => ( <SvgIcon {...props}> <path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.97.89 1.66.89H22c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/> </SvgIcon> ); NotificationMore = pure(NotificationMore); NotificationMore.displayName = 'NotificationMore'; NotificationMore.muiName = 'SvgIcon'; export default NotificationMore;
    src/views/PointerEventsContainer.js
    half-shell/react-navigation
    /* @flow */ import React from 'react'; import invariant from 'fbjs/lib/invariant'; import AnimatedValueSubscription from './AnimatedValueSubscription'; import type { NavigationSceneRendererProps, } from '../TypeDefinition'; type Props = NavigationSceneRendererProps; const MIN_POSITION_OFFSET = 0.01; /** * Create a higher-order component that automatically computes the * `pointerEvents` property for a component whenever navigation position * changes. */ export default function create( Component: ReactClass<*>, ): ReactClass<*> { class Container extends React.Component<any, Props, any> { _component: any; _onComponentRef: (view: any) => void; _onPositionChange: (data: {value: number}) => void; _pointerEvents: string; _positionListener: ?AnimatedValueSubscription; props: Props; constructor(props: Props, context: any) { super(props, context); this._pointerEvents = this._computePointerEvents(); } componentWillMount(): void { this._onPositionChange = this._onPositionChange.bind(this); this._onComponentRef = this._onComponentRef.bind(this); } componentDidMount(): void { this._bindPosition(this.props); } componentWillUnmount(): void { this._positionListener && this._positionListener.remove(); } componentWillReceiveProps(nextProps: Props): void { this._bindPosition(nextProps); } render() { this._pointerEvents = this._computePointerEvents(); return ( <Component {...this.props} pointerEvents={this._pointerEvents} onComponentRef={this._onComponentRef} /> ); } _onComponentRef(component: any): void { this._component = component; if (component) { invariant( typeof component.setNativeProps === 'function', 'component must implement method `setNativeProps`', ); } } _bindPosition(props: NavigationSceneRendererProps): void { this._positionListener && this._positionListener.remove(); this._positionListener = new AnimatedValueSubscription( props.position, this._onPositionChange, ); } _onPositionChange(): void { if (this._component) { const pointerEvents = this._computePointerEvents(); if (this._pointerEvents !== pointerEvents) { this._pointerEvents = pointerEvents; this._component.setNativeProps({ pointerEvents }); } } } _computePointerEvents(): string { const { navigationState, position, scene, } = this.props; if (scene.isStale || navigationState.index !== scene.index) { // The scene isn't focused. return scene.index > navigationState.index ? 'box-only' : 'none'; } const offset = position.__getAnimatedValue() - navigationState.index; if (Math.abs(offset) > MIN_POSITION_OFFSET) { // The positon is still away from scene's index. // Scene's children should not receive touches until the position // is close enough to scene's index. return 'box-only'; } return 'auto'; } } return Container; }
    src/components/Schedule.js
    MathMesquita/conf
    import React from 'react'; import { css } from 'glamor'; import Text from './Text'; const styles = { container: css({ background: '#fff', width: '100vw', paddingBottom: '2em', alignItems: 'center', '@media(max-width: 720px)': { alignSelf: 'auto', }, }), list: css({ listStyle: 'none', padding: 0, maxWidth: '1000px', margin: '0 auto', }), disclaimer: css({ padding: 0, maxWidth: '1000px', margin: '30px auto', textAlign: 'right', }), event: css({ display: 'flex', borderTop: '1px solid #333', padding: '1em 0 0.5em', justifyContent: 'space-around', ' div': {}, ' h2': { margin: '0 0 0.3em 0', ' span': { fontSize: '0.7em', }, }, ' h3': { fontWeight: 'lighter', fontSize: '1.3em', margin: 0, }, }), time: css({ fontSize: '1.7em', paddingLeft: '1.3em', whiteSpace: 'nowrap', }), desc: css({ width: '100%', padding: '0.2em 1.3em', }), }; const eventsList = [ { title: 'Abertura do Teatro e Credenciamento', time: '8:00 am', }, { title: 'Welcome Coffee', time: '8:30 am', }, { title: 'Abertura React Brasil', time: '9:00 am', }, { title: 'Raphael Amorim', description: 'Scratching React Fiber', time: '9:10 am', }, { title: 'Fernando Daciuk', description: 'The magic world of tests with Jest', time: '9:40 am', }, { title: 'Kete Rufino e Christino Milfont', description: 'Transformando um front-end legado em uma React SPA', time: '10:10 am', }, { title: 'Marcelo Camargo', description: "Let's dive into Babel: How everything works", time: '10:35 am', }, { title: 'James Baxley', description: 'Statically Typing your GraphQL App', time: '10:55 am', }, { title: 'Desconferência: Fishbowl', time: '11:30 am', }, { title: 'Almoço', time: '12:00 pm', }, { title: 'Clara Battesini', description: 'MobX: The light side of the force', time: '1:30 pm', }, { title: 'Henrique Sosa', description: 'Gorgeous Apps with React Motion and Animations', time: '1:40 pm', }, { title: 'João Gonçalves', description: 'Show do Milhão React PWA (Caso de Sucesso)', time: '1:50 pm', }, { title: 'Raphael Costa', description: 'Building the Pipefy mobile app in 3 weeks with React Native, GraphQL and Apollo', time: '2:00 pm', }, { title: 'Sashko Stubailo', description: 'The GraphQL and Apollo stack: connecting everything together', time: '2:25 pm', }, { title: 'Sebastian Ferrari', description: 'Why React is good for business', time: '3:05 pm', }, { title: 'Coffee Break', time: '3:30 pm', }, { title: 'Matheus Marsiglio', description: 'Isomorphic React + Redux App', time: '4:00 pm', }, { title: 'Matheus Lima', description: 'O que tem de Funcional no React', time: '4:25 pm', }, { title: 'Keuller Magalhães', description: 'React Performance from Scratch', time: '4:35 pm', }, { title: 'Geisy Domiciano', description: 'Continuos Integration / Continuos Deployment com create-react-app', time: '4:45 pm', }, { title: 'Sibelius Seraphini', description: 'Relay Modern', time: '4:55 pm', }, { title: 'Desconferência: Fishbowl', time: '5:15 pm', }, { title: 'Sorteios', time: '5:45 pm', }, { title: 'Encerramento', time: '6:00 pm', }, { title: 'AfterParty', description: 'Mono Club by An English Thing', time: '6:30 pm', }, ]; const Event = ({ title, time, worksIn = false, worksLink, description }) => <li {...styles.event}> <div {...styles.time}> {time} </div> <div {...styles.desc}> <h2> {title} {worksIn && <span> {worksIn} </span>} </h2> {description && <h3> {description} </h3>} </div> </li>; const Schedule = ({ events = eventsList }) => <section {...styles.container}> <Text title="Programa" /> <ol {...styles.list}> {events.map(event => <Event {...event} />)} </ol> <p {...styles.disclaimer}>Horário sujeito a alteração sem aviso prévio</p> </section>; export default Schedule;
    app/containers/HomePage/Loadable.js
    mxstbr/react-boilerplate
    /** * Asynchronously loads the component for HomePage */ import React from 'react'; import loadable from 'utils/loadable'; import LoadingIndicator from 'components/LoadingIndicator'; export default loadable(() => import('./index'), { fallback: <LoadingIndicator />, });
    src/layouts/CoreLayout/CoreLayout.js
    joris77/admin-web
    import React from 'react' import { Layout, Panel } from 'react-toolbox' import Header from '../../components/Header' import './CoreLayout.scss' import '../../styles/core.scss' import GlobalMessage from 'components/GlobalMessage' export const CoreLayout = ({ children }) => ( <Layout> <Panel> <Header /> <GlobalMessage /> {children} </Panel> </Layout> ) export default CoreLayout
    src/scenes/SearchScreen/components/RepoSearchBar/index.js
    msanatan/GitHubProjects
    import React, { Component } from 'react'; import { SearchBar, } from 'react-native-elements'; export default class RepoSearchBar extends Component { constructor(props) { super(props) this.handleChangeText = this.handleChangeText.bind(this); } render() { return ( <SearchBar lightTheme placeholder='Search for user...' autoCapitalize='none' onChangeText={this.handleChangeText} /> ); } handleChangeText(newUsername) { this.props.onChangeText(newUsername); } }
    docs/src/app/pages/components/RadioGroup/ExampleRadioGroupDescription.js
    GetAmbassador/react-ions
    import React from 'react' import RadioGroup from 'react-ions/lib/components/Radio/RadioGroup' import Radio from 'react-ions/lib/components/Radio/Radio' import Input from 'react-ions/lib/components/Input' import style from './style.scss' const radioOptions = [ { value: 'welcome_email', label: 'Send welcome email', description: 'Send an email welcoming your contact to your program.' }, { value: 'payment_update_email', label: 'Send update payment email', description: 'Send a payment update email to your contact.' } ] class ExampleRadioGroupDescription extends React.Component { constructor(props) { super(props) } getRadioBlocks = () => { return radioOptions.map((option, index) => { return <Radio key={index} value={option.value} label={option.label} description={option.description} /> }) } render() { return ( <div> <RadioGroup name='child-description-group' changeCallback={this.handleChange}> {this.getRadioBlocks()} </RadioGroup> </div> ) } } export default ExampleRadioGroupDescription
    src/calendar/header/index.js
    eals/react-native-calender-pn-wix-extended
    import React, { Component } from 'react'; import { ActivityIndicator } from 'react-native'; import { View, Text, TouchableOpacity, Image } from 'react-native'; import XDate from 'xdate'; import PropTypes from 'prop-types'; import styleConstructor from './style'; import { weekDayNames } from '../../dateutils'; import Icon from 'react-native-vector-icons/Ionicons'; import theme from '../../../../../components/theme'; import moment from 'moment'; class CalendarHeader extends Component { static propTypes = { theme: PropTypes.object, hideArrows: PropTypes.bool, month: PropTypes.instanceOf(XDate), addMonth: PropTypes.func, showIndicator: PropTypes.bool, firstDay: PropTypes.number, renderArrow: PropTypes.func, hideDayNames: PropTypes.bool, }; constructor(props) { super(props); this.style = styleConstructor(props.theme); this.addMonth = this.addMonth.bind(this); this.substractMonth = this.substractMonth.bind(this); } nextMonth(next){ var month = ["Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan"]; return month[next-1]; } twoMonth(next){ var month = ["Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb"]; return month[next-1]; } addMonth() { this.props.addMonth(1); } substractMonth() { this.props.addMonth(-1); } shouldComponentUpdate(nextProps) { if ( nextProps.month.toString('yyyy MM') !== this.props.month.toString('yyyy MM') ) { return true; } if (nextProps.showIndicator !== this.props.showIndicator) { return true; } return false; } render() { let leftArrow = <View />; let rightArrow = <View />; let weekDaysNames = weekDayNames(this.props.firstDay); if (!this.props.hideArrows) { leftArrow = ( <TouchableOpacity onPress={this.substractMonth} style={this.style.arrow} > {this.props.renderArrow ? this.props.renderArrow('left') : <Image source={require('../img/previous.png')} style={this.style.arrowImage} />} </TouchableOpacity> ); rightArrow = ( <TouchableOpacity onPress={this.addMonth} style={this.style.arrow}> {this.props.renderArrow ? this.props.renderArrow('right') : <Image source={require('../img/next.png')} style={this.style.arrowImage} />} </TouchableOpacity> ); } let indicator; if (this.props.showIndicator) { indicator = <ActivityIndicator />; } return ( <View style={{}}> <Image style={this.style.proBg} source={require('../img/proBgg.png')}> <View style={{flex:1,flexDirection:'row',alignSelf:'center',marginBottom:-25}}> {leftArrow} <Text style={{color:"#fff",fontSize:18,alignSelf:'flex-end',marginBottom:35,marginRight:25,borderBottomWidth:1,borderColor:'#fff'}}> {this.props.month.toString(this.props.monthFormat ? this.props.monthFormat : 'MMM')} </Text> <Text style={{color:"#DBAEAF",fontSize:18,alignSelf:'flex-end',marginBottom:35,marginRight:25}}> {this.nextMonth(this.props.month.toString(this.props.monthFormat ? this.props.monthFormat : 'M'))} </Text> <Text style={{color:"#C36D6F",fontSize:18,alignSelf:'flex-end',marginBottom:35,}}> {this.twoMonth(this.props.month.toString(this.props.monthFormat ? this.props.monthFormat : 'M'))} </Text> {rightArrow} <View style={{flexDirection:'column',flex:1}}> <View style={{alignSelf:'flex-end'}}> <Text style={{fontSize:18,alignSelf:'center',color:"#fff"}}> {moment().format("MMMM")} </Text> <Text style={{fontSize:22,alignSelf:'center',color:"#fff"}}> {moment().format("DD, YYYY")} </Text> <View style={{width: 80, alignSelf:'center',height:80,borderRadius:40,backgroundColor:"white",borderRadius:40,borderWidth:5,borderColor:'rgba(193, 192, 192, 0.53)',justifyContent:'center'}}> <Icon size={42} name="ios-calendar" style={{color: theme.themeColor, alignSelf:'center' }} /> </View> </View> </View> </View> </Image> <View style={{borderBottomWidth:1,borderColor:'#ECECEC',marginBottom:10,paddingBottom:10,backgroundColor:"#F9F9F9"}}> { !this.props.hideDayNames && <View style={this.style.week}> {weekDaysNames.map((day, idx) => { if(moment().format("ddd") == day){ return( <View key={idx} style={{flexDirection:'column'}}> <View style={{height:15,width:15,borderRadius:10,backgroundColor:"#E81B21",alignSelf:'center',borderWidth:2,borderColor:"#F6CDCE",marginBottom:10,paddingBottom:10}}></View> <Text style={[this.style.dayHeader,{color:"#E81B21"}]} numberOfLines={1}>{day.toUpperCase()}</Text> </View> ) } else { return( <View key={idx} style={{flexDirection:'column'}}> <View style={{height:15,width:15,borderRadius:10,backgroundColor:"#BBBBBB",alignSelf:'center',marginBottom:10,paddingBottom:10}}></View> <Text style={[this.style.dayHeader,{color:"#626262"}]} numberOfLines={1}>{day.toUpperCase()}</Text> </View> )} })} </View> } </View> </View> ); } } export default CalendarHeader;
    classic/src/scenes/mailboxes/src/Scenes/AppScene/ServiceTab/ServiceInfoDrawer/ServiceInstallInfo.js
    wavebox/waveboxapp
    import PropTypes from 'prop-types' import React from 'react' import { accountActions, accountStore } from 'stores/account' import { withStyles } from '@material-ui/core/styles' import shallowCompare from 'react-addons-shallow-compare' import DoneIcon from '@material-ui/icons/Done' import ServiceInfoPanelActionButton from 'wbui/ServiceInfoPanelActionButton' import ServiceInfoPanelActions from 'wbui/ServiceInfoPanelActions' import ServiceInfoPanelBody from 'wbui/ServiceInfoPanelBody' import ServiceInfoPanelContent from 'wbui/ServiceInfoPanelContent' import ServiceReducer from 'shared/AltStores/Account/ServiceReducers/ServiceReducer' import ReactMarkdown from 'react-markdown' import WBRPCRenderer from 'shared/WBRPCRenderer' const styles = { markdown: { '& img': { maxWidth: '100%' } }, buttonIcon: { marginRight: 6 } } class Link extends React.Component { render () { const { href, children, ...passProps } = this.props return ( <a {...passProps} href='#' onClick={() => WBRPCRenderer.wavebox.openExternal(href)}> {children} </a> ) } } @withStyles(styles) class ServiceInstallInfo extends React.Component { /* **************************************************************************/ // Class /* **************************************************************************/ static propTypes = { serviceId: PropTypes.string.isRequired } /* **************************************************************************/ // Component Lifecycle /* **************************************************************************/ componentDidMount () { accountStore.listen(this.accountUpdated) } componentWillUnmount () { accountStore.unlisten(this.accountUpdated) } componentWillReceiveProps (nextProps) { if (this.props.serviceId !== nextProps.serviceId) { this.setState({ ...this.deriveServiceInfo(nextProps.serviceId, accountStore.getState()) }) } } /* **************************************************************************/ // Data lifecycle /* **************************************************************************/ state = (() => { return { ...this.deriveServiceInfo(this.props.serviceId, accountStore.getState()) } })() accountUpdated = (accountState) => { this.setState({ ...this.deriveServiceInfo(this.props.serviceId, accountState) }) } /** * Gets the service info from the account state * @param serviceId: the id of the service * @param accountState: the current account state * @return a state update object */ deriveServiceInfo (serviceId, accountState) { const service = accountState.getService(serviceId) return { installText: service ? service.installText : '' } } /* **************************************************************************/ // UI Events /* **************************************************************************/ /** * Handles a link being clicked */ handleLinkClick = (url, text, title) => { WBRPCRenderer.wavebox.openExternal(url) } /* **************************************************************************/ // Rendering /* **************************************************************************/ shouldComponentUpdate (nextProps, nextState) { return shallowCompare(this, nextProps, nextState) } render () { const { serviceId, classes, ...passProps } = this.props const { installText } = this.state return ( <ServiceInfoPanelContent {...passProps}> <ServiceInfoPanelBody actions={1}> <ReactMarkdown className={classes.markdown} source={installText} skipHtml renderers={{ link: Link, linkReference: Link }} /> </ServiceInfoPanelBody> <ServiceInfoPanelActions actions={1}> <ServiceInfoPanelActionButton color='primary' variant='contained' onClick={() => { accountActions.reduceService(serviceId, ServiceReducer.setHasSeenInstallInfo, true) }}> <DoneIcon className={classes.buttonIcon} /> Done </ServiceInfoPanelActionButton> </ServiceInfoPanelActions> </ServiceInfoPanelContent> ) } } export default ServiceInstallInfo
    MobileApp/node_modules/react-native-elements/src/badge/badge.js
    VowelWeb/CoinTradePros.com
    import PropTypes from 'prop-types'; import React from 'react'; import { Text, View, StyleSheet, TouchableOpacity } from 'react-native'; import colors from '../config/colors'; const Badge = props => { const { containerStyle, textStyle, wrapperStyle, onPress, component, value, children, element, ...attributes } = props; if (element) return element; let Component = View; let childElement = ( <Text style={[styles.text, textStyle && textStyle]}>{value}</Text> ); if (children) { childElement = children; } if (children && value) { console.error('Badge can only contain either child element or value'); } if (!component && onPress) { Component = TouchableOpacity; } if (React.isValidElement(component)) { Component = component; } return ( <View style={[styles.container && wrapperStyle && wrapperStyle]}> <Component style={[styles.badge, containerStyle && containerStyle]} onPress={onPress} {...attributes} > {childElement} </Component> </View> ); }; Badge.propTypes = { containerStyle: View.propTypes.style, wrapperStyle: View.propTypes.style, textStyle: Text.propTypes.style, children: PropTypes.element, value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), onPress: PropTypes.func, component: PropTypes.func, element: PropTypes.element, }; const styles = StyleSheet.create({ container: { flexDirection: 'row', }, badge: { padding: 12, paddingTop: 3, paddingBottom: 3, backgroundColor: colors.grey1, borderRadius: 20, alignItems: 'center', justifyContent: 'center', }, text: { fontSize: 14, color: 'white', }, }); export default Badge;
    src/svg-icons/action/highlight-off.js
    w01fgang/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionHighlightOff = (props) => ( <SvgIcon {...props}> <path d="M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/> </SvgIcon> ); ActionHighlightOff = pure(ActionHighlightOff); ActionHighlightOff.displayName = 'ActionHighlightOff'; ActionHighlightOff.muiName = 'SvgIcon'; export default ActionHighlightOff;
    js/jqwidgets/demos/react/app/kanban/disablecollapse/app.js
    luissancheza/sice
    import React from 'react'; import ReactDOM from 'react-dom'; import JqxKanban from '../../../jqwidgets-react/react_jqxkanban.js'; class App extends React.Component { render() { let fields = [ { name: 'id', type: 'string' }, { name: 'status', map: 'state', type: 'string' }, { name: 'text', map: 'label', type: 'string' }, { name: 'tags', type: 'string' }, { name: 'color', map: 'hex', type: 'string' }, { name: 'resourceId', type: 'number' } ]; let source = { localData: [ { id: '1161', state: 'new', label: 'Make a new Dashboard', tags: 'dashboard', hex: '#36c7d0', resourceId: 3 }, { id: '1645', state: 'work', label: 'Prepare new release', tags: 'release', hex: '#ff7878', resourceId: 1 }, { id: '9213', state: 'new', label: 'One item added to the cart', tags: 'cart', hex: '#96c443', resourceId: 3 }, { id: '6546', state: 'done', label: 'Edit Item Price', tags: 'price, edit', hex: '#ff7878', resourceId: 4 }, { id: '9034', state: 'new', label: 'Login 404 issue', tags: 'issue, login', hex: '#96c443' } ], dataType: 'array', dataFields: fields }; let dataAdapter = new $.jqx.dataAdapter(source); let resourcesAdapterFunc = () => { let resourcesSource = { localData: [ { id: 0, name: 'No name', image: '../../jqwidgets/styles/images/common.png', common: true }, { id: 1, name: 'Andrew Fuller', image: '../../images/andrew.png' }, { id: 2, name: 'Janet Leverling', image: '../../images/janet.png' }, { id: 3, name: 'Steven Buchanan', image: '../../images/steven.png' }, { id: 4, name: 'Nancy Davolio', image: '../../images/nancy.png' }, { id: 5, name: 'Michael Buchanan', image: '../../images/Michael.png' }, { id: 6, name: 'Margaret Buchanan', image: '../../images/margaret.png' }, { id: 7, name: 'Robert Buchanan', image: '../../images/robert.png' }, { id: 8, name: 'Laura Buchanan', image: '../../images/Laura.png' }, { id: 9, name: 'Laura Buchanan', image: '../../images/Anne.png' } ], dataType: 'array', dataFields: [ { name: 'id', type: 'number' }, { name: 'name', type: 'string' }, { name: 'image', type: 'string' }, { name: 'common', type: 'boolean' } ] }; let resourcesDataAdapter = new $.jqx.dataAdapter(resourcesSource); return resourcesDataAdapter; } let columns = [ { text: 'Backlog', dataField: 'new', maxItems: 4 }, { text: 'In Progress', dataField: 'work', maxItems: 2 }, { text: 'Done', dataField: 'done', collapsible: false, maxItems: 5 } ]; let columnRenderer = (element, collapsedElement, column) => { setTimeout(() => { let columnItems = this.refs.myKanban.getColumnItems(column.dataField).length; // update header's status. element.find('.jqx-kanban-column-header-status').html(' (' + columnItems + '/' + column.maxItems + ')'); // update collapsed header's status. collapsedElement.find('.jqx-kanban-column-header-status').html(' (' + columnItems + '/' + column.maxItems + ')'); }); }; return ( <JqxKanban ref='myKanban' resources={resourcesAdapterFunc()} source={dataAdapter} columns={columns} columnRenderer={columnRenderer} /> ) } } ReactDOM.render(<App />, document.getElementById('app'));
    docs/src/app/components/pages/components/DatePicker/ExampleInline.js
    IsenrichO/mui-with-arrows
    import React from 'react'; import DatePicker from 'material-ui/DatePicker'; /** * Inline Date Pickers are displayed below the input, rather than as a modal dialog. */ const DatePickerExampleInline = () => ( <div> <DatePicker hintText="Portrait Inline Dialog" container="inline" /> <DatePicker hintText="Landscape Inline Dialog" container="inline" mode="landscape" /> </div> ); export default DatePickerExampleInline;
    app/components/Item/Background/Background.js
    TriPSs/popcorn-time-desktop
    // @flow import React from 'react' import classNames from 'classnames' import type { Props } from './BackgroundTypes' import classes from './Background.scss' export const Background = ({ backgroundImage }: Props) => ( <div className={classes.background__container}> <div className={classNames(classes.background__poster, 'animated fadeIn')} style={{ backgroundImage: `url(${backgroundImage})` }}> <div className={classes.background__overlay} /> </div> </div> ) export default Background
    blueprints/view/files/__root__/views/__name__View/__name__View.js
    llukasxx/school-organizer-front
    import React from 'react' type Props = { }; export class <%= pascalEntityName %> extends React.Component { props: Props; render () { return ( <div></div> ) } } export default <%= pascalEntityName %>
    actor-apps/app-web/src/app/components/modals/create-group/ContactItem.react.js
    Johnnywang1221/actor-platform
    import React from 'react'; import AvatarItem from 'components/common/AvatarItem.react'; class ContactItem extends React.Component { static propTypes = { contact: React.PropTypes.object, onToggle: React.PropTypes.func } constructor(props) { super(props); this.onToggle = this.onToggle.bind(this); this.state = { isSelected: false }; } onToggle() { const isSelected = !this.state.isSelected; this.setState({ isSelected: isSelected }); this.props.onToggle(this.props.contact, isSelected); } render() { let contact = this.props.contact; let icon; if (this.state.isSelected) { icon = 'check_box'; } else { icon = 'check_box_outline_blank'; } return ( <li className="contacts__list__item row"> <AvatarItem image={contact.avatar} placeholder={contact.placeholder} size="small" title={contact.name}/> <div className="col-xs"> <span className="title"> {contact.name} </span> </div> <div className="controls"> <a className="material-icons" onClick={this.onToggle}>{icon}</a> </div> </li> ); } } export default ContactItem;
    blueocean-material-icons/src/js/components/svg-icons/communication/vpn-key.js
    kzantow/blueocean-plugin
    import React from 'react'; import SvgIcon from '../../SvgIcon'; const CommunicationVpnKey = (props) => ( <SvgIcon {...props}> <path d="M12.65 10C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H17v4h4v-4h2v-4H12.65zM7 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/> </SvgIcon> ); CommunicationVpnKey.displayName = 'CommunicationVpnKey'; CommunicationVpnKey.muiName = 'SvgIcon'; export default CommunicationVpnKey;
    frontend/capitolwords-spa/src/components/HomePage/HomePage.js
    propublica/Capitol-Words
    import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { routeToPhraseSearch } from '../../actions/search-actions'; import SearchInput from '../SearchInput/SearchInput'; import './HomePage.css'; import { isSearching, isSearchFailure, isSearchSuccess, searchResultList, searchDelta } from '../../selectors/phrase-search-selectors'; class HomePage extends Component { static propTypes = { isSearching: PropTypes.bool.isRequired, isSearchFailure: PropTypes.bool.isRequired, isSearchSuccess: PropTypes.bool.isRequired, searchResultList: PropTypes.array, searchDelta: PropTypes.number }; render() { const { routeToPhraseSearch } = this.props; return ( <div className="HomePage-container"> <div className="Title"> <h3>Capitol Words</h3> <p>Dig up some data on the words our legislators use every day.</p> </div> <div className="HomePage-searchInput"> <SearchInput variant="blue" onSubmit={routeToPhraseSearch}/> </div> <div className="QuickOptions-container"> <div className="QuickOption" onClick={() => {routeToPhraseSearch('Poverty')}}>Poverty</div> <div className="QuickOption" onClick={() => {routeToPhraseSearch('Russian Interference')}}>Russian Interference</div> <div className="QuickOption" onClick={() => {routeToPhraseSearch('Education')}}>Education</div> <div className="QuickOption" onClick={() => {routeToPhraseSearch('Tax Cuts')}}>Tax Cuts</div> </div> </div> ); } } export default connect(state => ({ isSearching: isSearching(state), isSearchFailure: isSearchFailure(state), isSearchSuccess: isSearchSuccess(state), searchDelta: searchDelta(state), searchResultList: searchResultList(state), }), { routeToPhraseSearch, })(HomePage);
    packages/cf-component-dropdown/src/Dropdown.js
    koddsson/cf-ui
    import React from 'react'; import PropTypes from 'prop-types'; import { canUseDOM } from 'exenv'; import { createComponent } from 'cf-style-container'; import DropdownRegistry from './DropdownRegistry'; const styles = ({ theme, align }) => ({ position: 'absolute', zIndex: 1, minWidth: '10.66667rem', margin: '0.5em 0 0', padding: '0.33333rem 0', listStyle: 'none', background: theme.colorWhite, border: `1px solid ${theme.colorGrayLight}`, borderRadius: theme.borderRadius, boxShadow: '0 3px 10px rgba(0, 0, 0, 0.2)', left: align === 'left' ? 0 : 'initial', right: align === 'right' ? 0 : 'initial', textAlign: theme.textAlign, animationName: { '0%': { display: 'none', opacity: 0 }, '1%': { display: 'block', opacity: 0, top: '80%' }, '100%': { display: 'none', opacity: 1, top: '102%' } }, animationDuration: '150ms', animationTimingFunction: 'ease-out', '&::before': { content: "''", display: 'block', position: 'absolute', bottom: '100%', border: 'solid transparent', borderWidth: '10px', borderTopWidth: 0, borderBottomColor: theme.colorWhite, left: align === 'left' ? '10px' : 'initial', right: align === 'right' ? '10px' : 'initial' } }); class Dropdown extends React.Component { getChildContext() { return { dropdownRegistry: this.dropdownRegistry }; } constructor(props, context) { super(props, context); this.dropdownRegistry = new DropdownRegistry(); this.handleDocumentClick = this.handleDocumentClick.bind(this); this.handleDocumentKeydown = this.handleDocumentKeydown.bind(this); } componentDidMount() { if (canUseDOM) { global.document.addEventListener('keydown', this.handleDocumentKeydown); global.document.addEventListener('click', this.handleDocumentClick); } } componentWillUnmount() { if (canUseDOM) { global.document.removeEventListener( 'keydown', this.handleDocumentKeydown ); global.document.removeEventListener('click', this.handleDocumentClick); } } handleDocumentKeydown(event) { const keyCode = event.keyCode; if (keyCode === 40) { // down event.preventDefault(); this.dropdownRegistry.focusNext(); } else if (keyCode === 38) { // up event.preventDefault(); this.dropdownRegistry.focusPrev(); } else if (keyCode === 27) { // esc this.props.onClose(); } } handleDocumentClick() { this.props.onClose(); } render() { return ( <ul className={this.props.className} role="menu"> {this.props.children} </ul> ); } } Dropdown.propTypes = { onClose: PropTypes.func.isRequired, align: PropTypes.oneOf(['left', 'right']), children: PropTypes.node }; Dropdown.defaultProps = { align: 'left' }; Dropdown.childContextTypes = { dropdownRegistry: PropTypes.instanceOf(DropdownRegistry).isRequired }; export default createComponent(styles, Dropdown);
    app/stories/index.js
    atralice/reactDockerizeBoilerplate
    import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; import { Button, Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />); storiesOf('Button', module) .add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>) .add('with some emoji', () => <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>);
    packages/mineral-ui-icons/src/IconImageAspectRatio.js
    mineral-ui/mineral-ui
    /* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconImageAspectRatio(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <path d="M16 10h-2v2h2v-2zm0 4h-2v2h2v-2zm-8-4H6v2h2v-2zm4 0h-2v2h2v-2zm8-6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12z"/> </g> </Icon> ); } IconImageAspectRatio.displayName = 'IconImageAspectRatio'; IconImageAspectRatio.category = 'image';
    Libraries/Utilities/throwOnWrongReactAPI.js
    esauter5/react-native
    /** * Copyright (c) 2015-present, Facebook, Inc. * 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. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule throwOnWrongReactAPI * @flow */ 'use strict'; function throwOnWrongReactAPI(key: string) { throw new Error( `Seems you're trying to access 'ReactNative.${key}' from the 'react-native' package. Perhaps you meant to access 'React.${key}' from the 'react' package instead? For example, instead of: import React, { Component, View } from 'react-native'; You should now do: import React, { Component } from 'react'; import { View } from 'react-native'; Check the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1 `); } module.exports = throwOnWrongReactAPI;
    src/components/Footer.js
    SaKKo/react-redux-todo-boilerplate
    import React from 'react'; import { connect } from 'react-redux'; import { setVisibilityFilter } from '../actions/actions'; import { SHOW_ALL,SHOW_ACTIVE,SHOW_COMPLETED } from '../constants/ActionTypes'; import Link from './Link'; const mapStateProps = ( state, ownProps ) => { return { active: ownProps.filter === state.visibilityFilter }; }; const mapDispatchProps = ( dispatch, ownProps ) => { return { onClick: () => { dispatch( setVisibilityFilter(ownProps.filter) ); } }; }; const FilterLink = connect( mapStateProps, mapDispatchProps )(Link); const Footer = () => ( <p> Show: {' '} <FilterLink filter={SHOW_ALL}> All </FilterLink> {', '} <FilterLink filter={SHOW_ACTIVE}> Active </FilterLink> {', '} <FilterLink filter={SHOW_COMPLETED}> Completed </FilterLink> </p> ); export default Footer;
    src/index.js
    Warm-men/Investment-by-react
    import React from 'react' import { render } from 'react-dom' import { hashHistory } from 'react-router' import RouteMap from './router/routeMap' render( <RouteMap history={hashHistory}/>, document.getElementById('app') );
    src/views/components/notification/notification.js
    connorbanderson/CoinREXX
    import React, { Component } from 'react'; import PropTypes from 'prop-types'; import './notification.css'; class Notification extends Component { static propTypes = { action: PropTypes.func.isRequired, actionLabel: PropTypes.string.isRequired, dismiss: PropTypes.func.isRequired, display: PropTypes.bool.isRequired, duration: PropTypes.number, message: PropTypes.string.isRequired }; componentDidMount() { this.startTimer(); } componentWillReceiveProps(nextProps) { if (nextProps.display) { this.startTimer(); } } componentWillUnmount() { this.clearTimer(); } clearTimer() { if (this.timerId) { clearTimeout(this.timerId); } } startTimer() { this.clearTimer(); this.timerId = setTimeout(() => { this.props.dismiss(); }, this.props.duration || 5000); } render() { return ( <div className="notification"> <p className="notification__message" ref={c => this.message = c}>{this.props.message}</p> <button className="btn notification__button" onClick={this.props.action} ref={c => this.button = c} type="button">{this.props.actionLabel}</button> </div> ); } } export default Notification;
    src/Well.js
    JimiHFord/react-bootstrap
    import React from 'react'; import classNames from 'classnames'; import BootstrapMixin from './BootstrapMixin'; const Well = React.createClass({ mixins: [BootstrapMixin], getDefaultProps() { return { bsClass: 'well' }; }, render() { let classes = this.getBsClassSet(); return ( <div {...this.props} className={classNames(this.props.className, classes)}> {this.props.children} </div> ); } }); export default Well;
    src/js/components/icons/base/Book.js
    kylebyerly-hp/grommet
    // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-book`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'book'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M10,1 L10,11 L13,9 L16,11 L16,1 M5.5,18 C4.11928813,18 3,19.1192881 3,20.5 C3,21.8807119 4.11928813,23 5.5,23 L22,23 M3,20.5 L3,3.5 C3,2.11928813 4.11928813,1 5.5,1 L21,1 L21,18.0073514 L5.49217286,18.0073514 M20.5,18 C19.1192881,18 18,19.1192881 18,20.5 C18,21.8807119 19.1192881,23 20.5,23 L20.5,23"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'Book'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
    app/containers/CardForm.js
    wenwuwu/redux-restful-example
    import React from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import CardForm from '../components/CardForm' import * as ActionCreators from '../actions' import _ from 'underscore' function mapStateToProps (state, ownProps) { const card = _.find(state.cards, {id: ownProps.cardId}) return card ? card : {} } const CardFormWrapper = connect( mapStateToProps, dispatch => bindActionCreators(ActionCreators, dispatch) )(CardForm) export default CardFormWrapper
    packages/linter-ui-default/lib/tooltip/message.js
    luizpicolo/.atom
    /* @flow */ import * as url from 'url' import React from 'react' import marked from 'marked' import { visitMessage, openExternally, openFile, applySolution, getActiveTextEditor, sortSolutions } from '../helpers' import type TooltipDelegate from './delegate' import type { Message, LinterMessage } from '../types' import FixButton from './fix-button' function findHref(el: ?Element): ?string { while (el && !el.classList.contains('linter-line')) { if (el instanceof HTMLAnchorElement) { return el.href } el = el.parentElement } return null } type Props = { message: Message, delegate: TooltipDelegate, } type State = { description?: string, descriptionShow?: boolean, } class MessageElement extends React.Component<Props, State> { state: State = { description: '', descriptionShow: false, } componentDidMount() { this.props.delegate.onShouldUpdate(() => { this.setState({}) }) this.props.delegate.onShouldExpand(() => { if (!this.state.descriptionShow) { this.toggleDescription() } }) this.props.delegate.onShouldCollapse(() => { if (this.state.descriptionShow) { this.toggleDescription() } }) } // NOTE: Only handling messages v2 because v1 would be handled by message-legacy component onFixClick(): void { const message = this.props.message const textEditor = getActiveTextEditor() if (message.version === 2 && message.solutions && message.solutions.length) { applySolution(textEditor, message.version, sortSolutions(message.solutions)[0]) } } openFile = (ev: Event) => { if (!(ev.target instanceof HTMLElement)) { return } const href = findHref(ev.target) if (!href) { return } // parse the link. e.g. atom://linter?file=<path>&row=<number>&column=<number> const { protocol, hostname, query } = url.parse(href, true) const file = query && query.file if (protocol !== 'atom:' || hostname !== 'linter' || !file) { return } const row = query && query.row ? parseInt(query.row, 10) : 0 const column = query && query.column ? parseInt(query.column, 10) : 0 openFile(file, { row, column }) } canBeFixed(message: LinterMessage): boolean { if (message.version === 1 && message.fix) { return true } else if (message.version === 2 && message.solutions && message.solutions.length) { return true } return false } toggleDescription(result: ?string = null) { const newStatus = !this.state.descriptionShow const description = this.state.description || this.props.message.description if (!newStatus && !result) { this.setState({ descriptionShow: false }) return } if (typeof description === 'string' || result) { const descriptionToUse = marked(result || description) this.setState({ descriptionShow: true, description: descriptionToUse }) } else if (typeof description === 'function') { this.setState({ descriptionShow: true }) if (this.descriptionLoading) { return } this.descriptionLoading = true new Promise(function(resolve) { resolve(description()) }) .then(response => { if (typeof response !== 'string') { throw new Error(`Expected result to be string, got: ${typeof response}`) } this.toggleDescription(response) }) .catch(error => { console.log('[Linter] Error getting descriptions', error) this.descriptionLoading = false if (this.state.descriptionShow) { this.toggleDescription() } }) } else { console.error('[Linter] Invalid description detected, expected string or function but got:', typeof description) } } props: Props descriptionLoading: boolean = false render() { const { message, delegate } = this.props return ( <linter-message class={message.severity} onClick={this.openFile}> {message.description && ( <a href="#" onClick={() => this.toggleDescription()}> <span className={`icon linter-icon icon-${this.state.descriptionShow ? 'chevron-down' : 'chevron-right'}`} /> </a> )} <linter-excerpt> {this.canBeFixed(message) && <FixButton onClick={() => this.onFixClick()} />} {delegate.showProviderName ? `${message.linterName}: ` : ''} {message.excerpt} </linter-excerpt>{' '} {message.reference && message.reference.file && ( <a href="#" onClick={() => visitMessage(message, true)}> <span className="icon linter-icon icon-alignment-aligned-to" /> </a> )} {message.url && ( <a href="#" onClick={() => openExternally(message)}> <span className="icon linter-icon icon-link" /> </a> )} {this.state.descriptionShow && ( <div dangerouslySetInnerHTML={{ __html: this.state.description || 'Loading...', }} className="linter-line" /> )} </linter-message> ) } } module.exports = MessageElement
    client/index.js
    LinearAtWorst/cogile
    import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import ReactRoutes from './routes/routes.js'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import reducers from './reducers'; const createStoreWithMiddleware = applyMiddleware()(createStore); ReactDOM.render( <Provider store={createStoreWithMiddleware(reducers)}> {ReactRoutes} </Provider> , document.getElementById('app'));
    examples/js/selection/externally-managed-selection.js
    echaouchna/react-bootstrap-tab
    /* eslint max-len: 0 */ import React from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; const products = []; function addProducts(quantity) { const startId = products.length; for (let i = 0; i < quantity; i++) { const id = startId + i; products.push({ id: id, name: 'Item name ' + id, price: 2100 + i }); } } addProducts(100); export default class ExternallyManagedSelection extends React.Component { constructor(props) { super(props); this.state = { selected: [], currPage: 1 }; } render() { const { currPage } = this.state; const onRowSelect = ({ id }, isSelected) => { if (isSelected && this.state.selected.length !== 2) { this.setState({ selected: [ ...this.state.selected, id ].sort(), currPage: this.refs.table.state.currPage }); } else { this.setState({ selected: this.state.selected.filter(it => it !== id) }); } return false; }; const selectRowProp = { mode: 'checkbox', clickToSelect: true, onSelect: onRowSelect, selected: this.state.selected }; const options = { sizePerPageList: [ 5, 10, 15, 20 ], sizePerPage: 10, page: currPage, sortName: 'id', sortOrder: 'desc' }; return ( <BootstrapTable ref='table' data={ products } selectRow={ selectRowProp } pagination={ true } options={ options }> <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> </BootstrapTable> ); } }
    examples/huge-apps/routes/Profile/components/Profile.js
    dmitrigrabov/react-router
    import React from 'react' class Profile extends React.Component { render() { return ( <div> <h2>Profile</h2> </div> ) } } export default Profile
    node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
    kaizensauce/campari-app
    import React from 'react'; // It's important to not define HelloWorld component right in this file // because in that case it will do full page reload on change import HelloWorld from './HelloWorld.jsx'; React.render(<HelloWorld />, document.getElementById('react-root'));
    js/components/tab/configTab.js
    ChiragHindocha/stay_fit
    import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Container, Header, Title, Button, Icon, Tabs, Tab, Text, Right, Left, Body, TabHeading } from 'native-base'; import { Actions } from 'react-native-router-flux'; import { actions } from 'react-native-navigation-redux-helpers'; import myTheme from '../../themes/base-theme'; import TabOne from './tabOne'; import TabTwo from './tabTwo'; import TabThree from './tabThree'; const { popRoute, } = actions; class ConfigTab extends Component { // eslint-disable-line static propTypes = { popRoute: React.PropTypes.func, navigation: React.PropTypes.shape({ key: React.PropTypes.string, }), } popRoute() { this.props.popRoute(this.props.navigation.key); } render() { return ( <Container> <Header hasTabs> <Left> <Button transparent onPress={() => Actions.pop()}> <Icon name="arrow-back" /> </Button> </Left> <Body> <Title> Advanced Tabs</Title> </Body> <Right /> </Header> <Tabs style={{ elevation: 3 }}> <Tab heading={<TabHeading><Icon name="camera" /><Text>Camera</Text></TabHeading>}> <TabOne /> </Tab> <Tab heading={<TabHeading><Text>No Icon</Text></TabHeading>}> <TabTwo /> </Tab> <Tab heading={<TabHeading><Icon name="apps" /></TabHeading>}> <TabThree /> </Tab> </Tabs> </Container> ); } } function bindAction(dispatch) { return { popRoute: key => dispatch(popRoute(key)), }; } const mapStateToProps = state => ({ navigation: state.cardNavigation, themeState: state.drawer.themeState, }); export default connect(mapStateToProps, bindAction)(ConfigTab);
    app/javascript/mastodon/features/standalone/public_timeline/index.js
    musashino205/mastodon
    import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { expandPublicTimeline, expandCommunityTimeline } from 'mastodon/actions/timelines'; import Masonry from 'react-masonry-infinite'; import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container'; import { debounce } from 'lodash'; import LoadingIndicator from 'mastodon/components/loading_indicator'; const mapStateToProps = (state, { local }) => { const timeline = state.getIn(['timelines', local ? 'community' : 'public'], ImmutableMap()); return { statusIds: timeline.get('items', ImmutableList()), isLoading: timeline.get('isLoading', false), hasMore: timeline.get('hasMore', false), }; }; export default @connect(mapStateToProps) class PublicTimeline extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, statusIds: ImmutablePropTypes.list.isRequired, isLoading: PropTypes.bool.isRequired, hasMore: PropTypes.bool.isRequired, local: PropTypes.bool, }; componentDidMount () { this._connect(); } componentDidUpdate (prevProps) { if (prevProps.local !== this.props.local) { this._connect(); } } _connect () { const { dispatch, local } = this.props; dispatch(local ? expandCommunityTimeline() : expandPublicTimeline()); } handleLoadMore = () => { const { dispatch, statusIds, local } = this.props; const maxId = statusIds.last(); if (maxId) { dispatch(local ? expandCommunityTimeline({ maxId }) : expandPublicTimeline({ maxId })); } } setRef = c => { this.masonry = c; } handleHeightChange = debounce(() => { if (!this.masonry) { return; } this.masonry.forcePack(); }, 50) render () { const { statusIds, hasMore, isLoading } = this.props; const sizes = [ { columns: 1, gutter: 0 }, { mq: '415px', columns: 1, gutter: 10 }, { mq: '640px', columns: 2, gutter: 10 }, { mq: '960px', columns: 3, gutter: 10 }, { mq: '1255px', columns: 3, gutter: 10 }, ]; const loader = (isLoading && statusIds.isEmpty()) ? <LoadingIndicator key={0} /> : undefined; return ( <Masonry ref={this.setRef} className='statuses-grid' hasMore={hasMore} loadMore={this.handleLoadMore} sizes={sizes} loader={loader}> {statusIds.map(statusId => ( <div className='statuses-grid__item' key={statusId}> <DetailedStatusContainer id={statusId} compact measureHeight onHeightChange={this.handleHeightChange} /> </div> )).toArray()} </Masonry> ); } }
    source/components/SectionPanel/Body.js
    mikey1384/twin-kle
    import React from 'react'; import PropTypes from 'prop-types'; import { stringIsEmpty } from 'helpers/stringHelpers'; Body.propTypes = { emptyMessage: PropTypes.string, searchQuery: PropTypes.string, isSearching: PropTypes.bool, isEmpty: PropTypes.bool, loadMoreButtonShown: PropTypes.bool, statusMsgStyle: PropTypes.string, content: PropTypes.node }; export default function Body({ emptyMessage, searchQuery, isSearching, isEmpty, statusMsgStyle, content, loadMoreButtonShown }) { return ( <div> {(!stringIsEmpty(searchQuery) && isSearching) || (isEmpty && !loadMoreButtonShown) ? ( <div className={statusMsgStyle}> {searchQuery && isSearching ? 'Searching...' : searchQuery ? 'No Results' : emptyMessage} </div> ) : ( content )} </div> ); }
    src/svg-icons/navigation/close.js
    pomerantsev/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NavigationClose = (props) => ( <SvgIcon {...props}> <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/> </SvgIcon> ); NavigationClose = pure(NavigationClose); NavigationClose.displayName = 'NavigationClose'; NavigationClose.muiName = 'SvgIcon'; export default NavigationClose;
    src/svg-icons/av/note.js
    ArcanisCz/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvNote = (props) => ( <SvgIcon {...props}> <path d="M22 10l-6-6H4c-1.1 0-2 .9-2 2v12.01c0 1.1.9 1.99 2 1.99l16-.01c1.1 0 2-.89 2-1.99v-8zm-7-4.5l5.5 5.5H15V5.5z"/> </SvgIcon> ); AvNote = pure(AvNote); AvNote.displayName = 'AvNote'; AvNote.muiName = 'SvgIcon'; export default AvNote;
    Header.js
    srserx/react-native-ui-common
    import React from 'react'; import { View, Text } from 'react-native'; const Header = (props) => { const { viewStyle, textStyle } = styles; return ( <View style={viewStyle}> <Text style={textStyle}>{props.headerText}</Text> </View> ); }; const styles = { viewStyle: { backgroundColor: '#F8F8F8', justifyContent: 'center', alignItems: 'center', height: 60, paddingTop: 15, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.2, elevation: 2, position: 'relative' }, textStyle: { fontSize: 20 } }; export { Header };
    test/ApiProvider.js
    sborrazas/redux-apimap
    import test from 'ava'; import React from 'react'; import TestUtils from 'react-addons-test-utils'; import spy from 'spy'; import './setupDom'; import createApi from '../src/createApi'; import ApiProvider from '../src/ApiProvider'; const api = createApi({}, {}); test('Enforce rendering a single child', (t) => { const cns = spy(console, 'error'); cns.mock(); t.notThrows(() => { TestUtils.renderIntoDocument( <ApiProvider api={api}> <div /> </ApiProvider>, ); }); t.is(cns.calls.length, 0); cns.reset(); cns.mock(); t.throws(() => { TestUtils.renderIntoDocument( <ApiProvider api={api}> <div /> </ApiProvider>, ); TestUtils.renderIntoDocument(<ApiProvider api={api} />); }); t.is(cns.calls.length, 1); cns.reset(); cns.mock(); t.throws(() => { TestUtils.renderIntoDocument( <ApiProvider api={api}> <div /> <div /> </ApiProvider>, ); }); t.is(cns.calls.length, 1); cns.restore(); });
    src/js/containers/Dashboard/DashboardAssetsLayer/index.js
    grommet/grommet-cms-boilerplate
    /* @flow */ import React, { Component } from 'react'; import { connect } from 'react-redux'; import Box from 'grommet/components/Box'; import Button from 'grommet/components/Button'; import Layer from 'grommet/components/Layer'; import { AssetTile } from 'grommet-cms/components/Dashboard'; import { getAssets } from 'grommet-cms/containers/Assets/actions'; import AssetForm from 'grommet-cms/containers/Dashboard/DashboardAssetPage'; import { PageHeader } from 'grommet-cms/components'; import type { Asset } from 'grommet-cms/containers/Assets/flowTypes'; type Props = { error: string, posts: Array<Asset>, request: boolean }; export class DashboardAssetsLayer extends Component { state: { addNewAsset: boolean }; _onAssetFormSubmit: () => void; _onAddAssetClick: () => void; constructor(props: Props) { super(props); this.state = { addNewAsset: false }; this._onAssetFormSubmit = this._onAssetFormSubmit.bind(this); this._onAddAssetClick = this._onAddAssetClick.bind(this); } componentDidMount() { this.props.dispatch(getAssets()); } _onAddAssetClick() { this.setState({ addNewAsset: true }); } _onAssetFormSubmit() { // Refresh Assets list. this.props.dispatch((getAssets())) .then(() => { this.setState({ addNewAsset: false }); }); } render() { const assets = ( this.props.posts && this.props.posts.length > 0 && !this.state.addNewAsset) ? this.props.posts.map(({_id, path, title}) => <AssetTile id={_id} title={title} path={path} key={`asset-${_id}`} size="small" showControls={false} onClick={this.props.onAssetSelect.bind(this, {_id, path, title})} />) : undefined; const assetForm = (this.state.addNewAsset) ? <AssetForm params={{ id: 'create' }} onSubmit={this._onAssetFormSubmit} /> : undefined; return ( <Layer flush={true} onClose={this.props.onClose}> <PageHeader title="Assets" controls={ <Box direction="row" pad={{ between: 'medium' }}> <Button onClick={this._onAddAssetClick}> Add Asset </Button> <Button onClick={this.props.onClose}> Exit </Button> </Box> } /> {assetForm} <Box full="horizontal" direction="row" pad="medium" justify="center" wrap={true}> {assets} </Box> </Layer> ); } }; function mapStateToProps(state, props) { const { error, posts, request } = state.assets; return { error, posts, request }; } export default connect(mapStateToProps)(DashboardAssetsLayer);
    app/Calendar/__tests__/DayPicker.spec.js
    sgrepo/react-calendar-multiday
    // import React from 'react' // import Enzyme, {mount} from 'enzyme' // import Adapter from 'enzyme-adapter-react-16' // import Calendar from '../Calendar' // import DayWrapper from '../DayWrapper' // import toJson from 'enzyme-to-json' // import {equals, range, inc} from 'ramda' // import jsdom from 'jsdom' // Enzyme.configure({ adapter: new Adapter() }) // var exposedProperties = ['window', 'navigator', 'document'] // global.document = jsdom.jsdom('') // global.window = document.defaultView // Object.keys(document.defaultView).forEach((property) => { // if (typeof global[property] === 'undefined') { // exposedProperties.push(property) // global[property] = document.defaultView[property] // } // }) // global.navigator = { // userAgent: 'node.js', // } // // const dayPicker = mount(<Calendar />)
    native/components/speechBubble/SpeechBubble.js
    miukimiu/react-kawaii
    import React from 'react'; import PropTypes from 'prop-types'; import paths from './paths'; import Face from '../common/face/Face'; import getUniqueId from '../../utils/getUniqueId'; import Wrapper from '../common/wrapper/Wrapper'; import Svg, { G, Path, Use, Defs, Mask } from 'react-native-svg'; const SpeechBubble = ({ size, color, mood, className }) => ( <Wrapper className={className}> <Svg width={size} height={size} version="1.1" viewBox="0 0 134 134" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" > <Defs> <Path d={paths.shape} id="kawaii-speechBubble__shape--path" /> <Path d={paths.shadow} id="kawaii-speechBubble__shadow--path" /> </Defs> <G id="Kawaii-speechBubble"> <G id="Kawaii-speechBubble__body"> <Mask fill="#fff"> <Use xlinkHref="#kawaii-speechBubble__shape--path" href="#kawaii-speechBubble__shape--path" /> </Mask> <Use id="Kawaii-speechBubble__shape" fill={color} xlinkHref="#kawaii-speechBubble__shape--path" href="#kawaii-speechBubble__shape--path" /> <Mask fill="#fff"> <Use xlinkHref="#kawaii-speechBubble__shadow--path" href="#kawaii-speechBubble__shadow--path" /> </Mask> <Use id="Kawaii-speechBubble__shadow" fill="#000" opacity=".1" xlinkHref="#kawaii-speechBubble__shadow--path" href="#kawaii-speechBubble__shadow--path" /> </G> <Face mood={mood} transform="translate(34 57)" uniqueId={getUniqueId()} /> </G> </Svg> </Wrapper> ); SpeechBubble.propTypes = { /** * Size of the width * */ size: PropTypes.number, mood: PropTypes.oneOf([ 'sad', 'shocked', 'happy', 'blissful', 'lovestruck', 'excited', 'ko' ]), /** * Hex color */ color: PropTypes.string }; SpeechBubble.defaultProps = { size: 150, mood: 'blissful', color: '#83D1FB' }; export default SpeechBubble;
    src/app/development/DevelopmentTable.js
    cityofasheville/simplicity2
    import React from 'react'; import PropTypes from 'prop-types'; import moment from 'moment'; import AccessibleReactTable, { CellFocusWrapper } from 'accessible-react-table'; import expandingRows from '../../shared/react_table_hoc/ExpandingRows'; import DevelopmentDetail from './DevelopmentDetail'; import Icon from '../../shared/Icon'; import { IM_HOME2, IM_MAP5, IM_OFFICE, IM_DIRECTION, IM_LIBRARY2, IM_FIRE, IM_USERS4, IM_COOK, IM_CITY, LI_WALKING, IM_MUG } from '../../shared/iconConstants'; import createFilterRenderer from '../../shared/FilterRenderer'; const getIcon = (type, isExpanded) => { switch (type) { case 'Commercial': return <Icon path={IM_OFFICE} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Residential': return <Icon path={IM_HOME2} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Sign': return <Icon path={IM_DIRECTION} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Historical': return <Icon path={IM_LIBRARY2} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Fire': return <Icon path={IM_FIRE} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Event-Temporary Use': return <Icon path={IM_USERS4} size={25} viewBox="0 0 24 24" color={isExpanded ? '#fff' : '#4077a5'} />; case 'Outdoor Vendor': return <Icon path={IM_COOK} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Development': return <Icon path={IM_CITY} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; case 'Right of Way': return <Icon path={LI_WALKING} size={25} viewBox="0 0 24 24" color={isExpanded ? '#fff' : '#4077a5'} />; case 'Over The Counter': return <Icon path={IM_MUG} size={25} color={isExpanded ? '#fff' : '#4077a5'} />; default: return <svg xmlns="http://www.w3.org/2000/svg" height="25px" transform="translate(0,4)" version="1.1" viewBox="0 0 16 16" width="25px"><g fill="none" fillRule="evenodd" id="Icons with numbers" stroke="none" strokeWidth="1"><g fill={isExpanded ? '#fff' : '#4077a5'} id="Group" transform="translate(-528.000000, -576.000000)"><path d="M536,592 C531.581722,592 528,588.418278 528,584 C528,579.581722 531.581722,576 536,576 C540.418278,576 544,579.581722 544,584 C544,588.418278 540.418278,592 536,592 Z M541,586 C542.10457,586 543,585.10457 543,584 C543,582.89543 542.10457,582 541,582 C539.89543,582 539,582.89543 539,584 C539,585.10457 539.89543,586 541,586 Z M531,586 C532.10457,586 533,585.10457 533,584 C533,582.89543 532.10457,582 531,582 C529.89543,582 529,582.89543 529,584 C529,585.10457 529.89543,586 531,586 Z M536,586 C537.10457,586 538,585.10457 538,584 C538,582.89543 537.10457,582 536,582 C534.89543,582 534,582.89543 534,584 C534,585.10457 534.89543,586 536,586 Z M536,586" id="Oval 12 copy" /></g></g></svg>; } }; const FilterRenderer = createFilterRenderer('Search...'); class DevelopmentTable extends React.Component { constructor(props) { super(props); this.state = { urlString: '', }; } componentDidMount() { this.setState({ urlString: [this.props.location.pathname, '?entity=', this.props.location.query.entity, '&id=', this.props.location.query.id, '&entities=', this.props.location.query.entities, '&label=', this.props.location.query.label, '&within=', document.getElementById('extent').value, '&during=', document.getElementById('time').value, '&hideNavbar=', this.props.location.query.hideNavbar, '&search=', this.props.location.query.search, '&view=map', '&x=', this.props.location.query.x, '&y=', this.props.location.query.y].join('') }) } render() { const ExpandableAccessibleReactTable = expandingRows(AccessibleReactTable); const dataColumns = [ { Header: 'Project', accessor: 'application_name', minWidth: 250, innerFocus: true, Cell: row => ( <CellFocusWrapper> {(focusRef, focusable) => ( <span> <span> {/*<a title="Click to show permit in map" href={[ this.state.urlString, '&zoomToPoint=', [row.original.y, row.original.x].join(','), ].join('')} style={{ color: row.isExpanded ? 'white' : '#4077a5' }} tabIndex={focusable ? 0 : -1} ref={focusRef} onClick={e => e.stopPropagation()} >*/} <Icon path={IM_MAP5} size={23} /> <span style={{ marginLeft: '5px' }}>{row.value}</span> {/*</a>*/} </span> </span> )} </CellFocusWrapper> ), Filter: FilterRenderer, }, { Header: 'Type', accessor: 'permit_type', minWidth: 150, Cell: row => ( <span> <span title={row.original.permit_type}>{getIcon(row.value, row.isExpanded)}</span> <span style={{ marginLeft: '5px' }}>{row.value}</span> </span> ), Filter: FilterRenderer, }, { Header: 'Contractor', accessor: 'contractor_name', minWidth: 150, Filter: FilterRenderer, }, { Header: 'Applied Date', id: 'applied_date', accessor: permit => (<span>{moment.utc(permit.applied_date).format('M/DD/YYYY')}</span>), width: 110, Filter: FilterRenderer, filterMethod: (filter, row) => { const id = filter.pivotId || filter.id; return row[id] !== undefined ? String(row[id].props.children).toLowerCase().indexOf(filter.value.toLowerCase()) > -1 : true; }, }, { Header: 'Permit #', accessor: 'permit_number', width: 115, Filter: FilterRenderer, }, ]; return ( <div> <div className="col-sm-12"> {this.props.data.length < 1 ? <div className="alert alert-info">No results found</div> : <div style={{ marginTop: '10px' }}> <ExpandableAccessibleReactTable ariaLabel="Development" data={this.props.data} columns={dataColumns} showPagination={this.props.data.length > 20} defaultPageSize={this.props.data.length <= 20 ? this.props.data.length : 20} filterable defaultFilterMethod={(filter, row) => { const id = filter.pivotId || filter.id; return row[id] !== undefined ? String(row[id]).toLowerCase().indexOf(filter.value.toLowerCase()) > -1 : true; }} getTdProps={() => { return { style: { whiteSpace: 'normal', }, }; }} getTrProps={(state, rowInfo) => { return { style: { cursor: 'pointer', background: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? '#4077a5' : 'none', color: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? '#fff' : '', fontWeight: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? 'bold' : 'normal', fontSize: rowInfo !== undefined && Object.keys(state.expanded).includes(rowInfo.viewIndex.toString()) && state.expanded[rowInfo.viewIndex] ? '1.2em' : '1em', }, }; }} SubComponent={row => ( <div style={{ paddingLeft: '34px', paddingRight: '34px', paddingBottom: '15px', backgroundColor: '#f6fcff', borderRadius: '0px', border: '2px solid #4077a5', }} > <DevelopmentDetail data={row.original} standalone={false} /> </div> )} /> </div> } </div> </div> ); } } DevelopmentTable.propTypes = { data: PropTypes.array, // eslint-disable-line }; export default DevelopmentTable;
    src/pages/client/listpage.js
    vgarcia692/wutmi_frontend
    import React from 'react'; import { Link } from 'react-router'; import { Table, Button, Row, Col } from 'react-bootstrap'; import styles from './style.css'; import CustomAxios from '../../common/components/CustomAxios'; import NewClientForm from '../../common/components/NewClientForm'; import LoadingGifModal from '../../common/components/LoadingGifModal'; import dateFormat from 'dateFormat'; export default class ClientListPage extends React.Component { constructor() { super() this.state = { data: [], modalShow: false, loadingShow: false } this.showModal = this.showModal.bind(this); this.closeModal = this.closeModal.bind(this); this.refreshData = this.refreshData.bind(this); this.showLoading = this.showLoading.bind(this); this.hideLoading = this.hideLoading.bind(this); } componentDidMount() { this.getData(); } getData() { this.showLoading(); const axios = CustomAxios.wAxios; axios.get('/basic_clients_data/') .then(function (response) { const results = response.data.results; var data = []; results.forEach(function(client,index) { data.push( <tr key={index}> <th>{index + 1}</th> <th><Link to={'/home/client/'+ client.pk} >{client.first_name + ' ' + client.last_name}</Link></th> <th>{client.atoll.name}</th> <th>{dateFormat(client.created_at, 'fullDate')}</th> </tr> ); }); this.setState({ data:data }); this.hideLoading(); }.bind(this)) .catch(function (error) { console.log(error); }); } showModal() { this.setState(() => ({ modalShow: true })) } closeModal() { this.setState(() => ({ modalShow: false })) } showLoading() { this.setState({ loadingShow: true }); } hideLoading() { this.setState({ loadingShow: false }); } refreshData() { this.setState(() => ({ modalShow: false })) // Refresh data from Database this.getData(); console.log('data refreshed'); } render() { return ( <div className={styles.content}> <h1 className={styles.heading}>Client Listing</h1> <Row> <Button bsStyle="success" className={styles.addButton} onClick={this.showModal}>+</Button> </Row> <Row> <Table striped bordered condensed hover responsive> <thead> <tr> <th>#</th> <th>Name</th> <th>Atoll</th> <th>Input Date</th> </tr> </thead> <tbody> {this.state.data} </tbody> </Table> </Row> <NewClientForm show={this.state.modalShow} onHide={this.closeModal} onAdd={()=>this.refreshData()} /> <LoadingGifModal show={this.state.loadingShow} onHide={this.hideLoading} label='Loading Clients...'/> </div> ); } }
    src/svg-icons/device/add-alarm.js
    pradel/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceAddAlarm = (props) => ( <SvgIcon {...props}> <path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-11h-2v3H8v2h3v3h2v-3h3v-2h-3V9z"/> </SvgIcon> ); DeviceAddAlarm = pure(DeviceAddAlarm); DeviceAddAlarm.displayName = 'DeviceAddAlarm'; export default DeviceAddAlarm;
    app/components/events/comments/CommentList.js
    alexko13/block-and-frame
    import React from 'react'; import Comment from './CommentItem'; import moment from 'moment'; const CommentList = (props) => { return ( <div className="ui segment"> <div className="ui comments"> <h3 className="ui dividing header">Comments</h3> { props.commentData.map((comment) => { return ( <Comment username={comment.username} timeCreated={moment(comment.timeCreated).calendar()} text={comment.text} /> ); }) } <form className="ui reply form" onSubmit={props.preventDefaultSubmit} > <div className="field"> <label></label> <textarea rows="2" value={props.reply} onChange={props.handleReplyChange} ></textarea> </div> <div className="ui labeled submit icon button" onClick={props.handleSubmit} > <i className="icon edit"></i> Add Reply </div> </form> </div> </div> ); }; module.exports = CommentList;
    app/javascript/plugins/email_pension/SelectTarget.js
    SumOfUs/Champaign
    import React, { Component } from 'react'; import { FormattedMessage } from 'react-intl'; import Input from '../../components/SweetInput/SweetInput'; import FormGroup from '../../components/Form/FormGroup'; class SelectTarget extends Component { constructor(props) { super(props); this.state = { searching: false, not_found: false, postcode: '', targets: [], }; } getTarget = postcode => { this.setState({ postcode: postcode }); if (!postcode) return; if (postcode.length < 5) return; this.setState({ searching: true, not_found: false }); fetch(`${this.props.endpoint}${postcode}`) .then(resp => { if (resp.ok) { return resp.json(); } throw new Error('not found.'); }) .then(json => { this.setState({ targets: json, searching: false }); const data = { postcode, targets: json }; this.props.handler(data); }) .catch(e => { this.setState({ not_found: true, targets: [], searching: false }); console.log('error', e); }); }; renderTarget({ id, title, first_name, last_name }) { return ( <p key={id}> {title} {first_name} {last_name} </p> ); } render() { let targets; if (this.state.not_found) { targets = ( <FormattedMessage id="email_tool.form.representative.not_found" defaultMessage="Sorry, we couldn't find a target with this location." /> ); } else { targets = this.state.targets.length ? ( this.state.targets.map(target => this.renderTarget(target)) ) : ( <FormattedMessage id="email_tool.form.representative.search_pending" defaultMessage="Please enter your postal code above." /> ); } return ( <div> <FormGroup> <Input name="postcode" type="text" label={ <FormattedMessage id="email_tool.form.representative.postal_code" defaultMessage="Enter your postal code" /> } value={this.state.postcode} onChange={value => this.getTarget(value)} errorMessage={this.props.error} /> </FormGroup> <FormGroup> <div className="target-panel"> <h3> <FormattedMessage id="email_tool.form.representative.selected_targets" defaultMessage="Representatives" /> </h3> <div className="target-panel-body"> {this.state.searching ? ( <FormattedMessage id="email_tool.form.representative.searching" defaultMessage="Searching for your representative" /> ) : ( targets )} </div> </div> </FormGroup> </div> ); } } export default SelectTarget;
    packages/icons/src/md/action/SettingsBluetooth.js
    suitejs/suitejs
    import React from 'react'; import IconBase from '@suitejs/icon-base'; function MdSettingsBluetooth(props) { return ( <IconBase viewBox="0 0 48 48" {...props}> <path d="M23 48h4v-4h-4v4zm-8 0h4v-4h-4v4zm16 0h4v-4h-4v4zm5.41-36.59L27.83 20l8.58 8.59L25 40h-2V24.83L13.83 34 11 31.17 22.17 20 11 8.83 13.83 6 23 15.17V0h2l11.41 11.41zM27 7.66v7.51l3.76-3.75L27 7.66zm3.76 20.93L27 24.83v7.51l3.76-3.75z" /> </IconBase> ); } export default MdSettingsBluetooth;
    src/js/components/icons/base/Diamond.js
    kylebyerly-hp/grommet
    // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-diamond`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'diamond'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M6,3 L18,3 L22,9 L12,21 L2,9 L6,3 Z M2,9 L22,9 M11,3 L7,9 L12,20 M13,3 L17,9 L12,20"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'Diamond'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
    src/select/multiselect/OptionGroupRenderer.js
    sthomas1618/react-crane
    import React from 'react' import PropTypes from 'prop-types' import { isValueEqual } from '../utils' function OptionGroupRenderer(props) { const { groupTitleKey, groupValueKey, option, optionDisabledKey, value, valueKey } = props const checked = value && value.length && value.some( (val) => isValueEqual(option, val, groupValueKey) || (option.options && option.options.length && option.options.some((opt) => isValueEqual(opt, val, valueKey))) ) const isDisabled = option[optionDisabledKey] const onChange = (e) => { e.preventDefault() } const controlId = `group-${option[groupValueKey]}` return ( <span> <label htmlFor={controlId}> <input id={controlId} checked={checked} disabled={isDisabled} onChange={onChange} type="checkbox" /> {option[groupTitleKey]} </label> </span> ) } OptionGroupRenderer.propTypes = { groupTitleKey: PropTypes.string.isRequired, groupValueKey: PropTypes.string.isRequired, option: PropTypes.object.isRequired, optionDisabledKey: PropTypes.string, value: PropTypes.oneOfType([ PropTypes.array, PropTypes.number, PropTypes.object, PropTypes.string ]).isRequired, valueKey: PropTypes.string.isRequired } OptionGroupRenderer.defaultProps = { optionDisabledKey: 'isDisabled' } export default OptionGroupRenderer
    lib/ui/src/modules/ui/routes.js
    jribeiro/storybook
    import React from 'react'; import ReactDOM from 'react-dom'; import Layout from './containers/layout'; import LeftPanel from './containers/left_panel'; import DownPanel from './containers/down_panel'; import ShortcutsHelp from './containers/shortcuts_help'; import SearchBox from './containers/search_box'; export default function(injectDeps, { clientStore, provider, domNode }) { // generate preview const Preview = () => { const state = clientStore.getAll(); const preview = provider.renderPreview(state.selectedKind, state.selectedStory); return preview; }; const root = ( <div> <Layout leftPanel={() => <LeftPanel />} preview={() => <Preview />} downPanel={() => <DownPanel />} /> <ShortcutsHelp /> <SearchBox /> </div> ); ReactDOM.render(root, domNode); }
    src/Parser/HolyPaladin/Modules/Talents/AuraOfMercy.js
    Yuyz0112/WoWAnalyzer
    import React from 'react'; import SPELLS from 'common/SPELLS'; import SpellIcon from 'common/SpellIcon'; import SpellLink from 'common/SpellLink'; import { formatNumber } from 'common/format'; import Module from 'Parser/Core/Module'; import AbilityTracker from 'Parser/Core/Modules/AbilityTracker'; import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox'; class AuraOfMercy extends Module { static dependencies = { abilityTracker: AbilityTracker, }; on_initialized() { if (!this.owner.error) { this.active = this.owner.selectedCombatant.hasTalent(SPELLS.AURA_OF_MERCY_TALENT.id); } } get healing() { const abilityTracker = this.abilityTracker; const getAbility = spellId => abilityTracker.getAbility(spellId); return (getAbility(SPELLS.AURA_OF_MERCY_HEAL.id).healingEffective + getAbility(SPELLS.AURA_OF_MERCY_HEAL.id).healingAbsorbed); } get hps() { return this.healing / this.owner.fightDuration * 1000; } suggestions(when) { when(this.auraOfSacrificeHps).isLessThan(30000) .addSuggestion((suggest, actual, recommended) => { return suggest(<span>The healing done by your <SpellLink id={SPELLS.AURA_OF_SACRIFICE_TALENT.id} /> is low. Try to find a better moment to cast it or consider changing to <SpellLink id={SPELLS.AURA_OF_MERCY_TALENT.id} /> or <SpellLink id={SPELLS.DEVOTION_AURA_TALENT.id} /> which can be more reliable.</span>) .icon(SPELLS.AURA_OF_SACRIFICE_TALENT.icon) .actual(`${formatNumber(actual)} HPS`) .recommended(`>${formatNumber(recommended)} HPS is recommended`) .regular(recommended - 5000).major(recommended - 10000); }); } statistic() { return ( <StatisticBox icon={<SpellIcon id={SPELLS.AURA_OF_MERCY_TALENT.id} />} value={`${formatNumber(this.hps)} HPS`} label="Healing done" /> ); } statisticOrder = STATISTIC_ORDER.OPTIONAL(); } export default AuraOfMercy;
    packages/core/admin/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js
    wistityhq/strapi
    import React from 'react'; import PropTypes from 'prop-types'; import { Box } from '@strapi/design-system/Box'; import { Flex } from '@strapi/design-system/Flex'; import { Link } from '@strapi/design-system/Link'; import { Typography } from '@strapi/design-system/Typography'; import Cog from '@strapi/icons/Cog'; import { useIntl } from 'react-intl'; import get from 'lodash/get'; import { Grid, GridItem } from '@strapi/design-system/Grid'; import useLayoutDnd from '../../../hooks/useLayoutDnd'; import getTrad from '../../../utils/getTrad'; const ComponentFieldList = ({ componentUid }) => { const { componentLayouts } = useLayoutDnd(); const { formatMessage } = useIntl(); const componentData = get(componentLayouts, [componentUid], {}); const componentLayout = get(componentData, ['layouts', 'edit'], []); return ( <Box padding={3}> {componentLayout.map((row, index) => ( // eslint-disable-next-line react/no-array-index-key <Grid gap={4} key={index}> {row.map(rowContent => ( <GridItem key={rowContent.name} col={rowContent.size}> <Box paddingTop={2}> <Flex alignItems="center" background="neutral0" paddingLeft={3} paddingRight={3} height={`${32 / 16}rem`} hasRadius borderColor="neutral200" > <Typography textColor="neutral800">{rowContent.name}</Typography> </Flex> </Box> </GridItem> ))} </Grid> ))} <Box paddingTop={2}> <Link startIcon={<Cog />} to={`/content-manager/components/${componentUid}/configurations/edit`} > {formatMessage({ id: getTrad('components.FieldItem.linkToComponentLayout'), defaultMessage: "Set the component's layout", })} </Link> </Box> </Box> ); }; ComponentFieldList.propTypes = { componentUid: PropTypes.string.isRequired, }; export default ComponentFieldList;
    pollard/components/SongInput.js
    spencerliechty/pollard
    import React, { Component } from 'react'; import classNames from 'classnames'; import mergeStyles from '../lib/mergeStyles'; export default class SongInput extends Component { handleChange(event) { this.props.updateSong({ idx: this.props.songIdx, key: this.props.label, val: event.target.value }); } render() { let gridStyle = mergeStyles({ marginTop: 5 }); let labelId = "label-" + this.props.label; return ( <div style={ gridStyle }> <div className="input-group"> <span className="input-group-addon" id={ labelId }>{ this.props.label }</span> <input type="text" tabIndex='2' className={ "form-control " + labelId } aria-describedby={ labelId } value={ this.props.val } onChange={ (e) => this.handleChange(e) } /> </div> </div> ); } }
    src/svg-icons/file/file-download.js
    tan-jerene/material-ui
    import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let FileFileDownload = (props) => ( <SvgIcon {...props}> <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/> </SvgIcon> ); FileFileDownload = pure(FileFileDownload); FileFileDownload.displayName = 'FileFileDownload'; FileFileDownload.muiName = 'SvgIcon'; export default FileFileDownload;
    src/components/Separator/Separator.js
    jmoguelruiz/react-common-components
    import React, { Component } from 'react'; import PropTypes from 'prop-types'; class Separator extends Component{ getStyle(){ return { color : "#f4f5f8", margin: "20px -10px", width : "100%" }; } render(){ const { style } = this.props; return( <hr style = {style ? style : this.getStyle()}/> ); } } Separator.propTypes = { /** * Style */ style : PropTypes.object }; export default Separator;
    docs/src/app/components/pages/components/TimePicker/ExampleSimple.js
    barakmitz/material-ui
    import React from 'react'; import TimePicker from 'material-ui/TimePicker'; const TimePickerExampleSimple = () => ( <div> <TimePicker hintText="12hr Format" /> <TimePicker format="24hr" hintText="24hr Format" /> <TimePicker disabled={true} format="24hr" hintText="Disabled TimePicker" /> </div> ); export default TimePickerExampleSimple;
    src/Alert.js
    erictherobot/react-bootstrap
    import React from 'react'; import classNames from 'classnames'; import BootstrapMixin from './BootstrapMixin'; const Alert = React.createClass({ mixins: [BootstrapMixin], propTypes: { onDismiss: React.PropTypes.func, dismissAfter: React.PropTypes.number, closeLabel: React.PropTypes.string }, getDefaultProps() { return { bsClass: 'alert', bsStyle: 'info', closeLabel: 'Close Alert' }; }, renderDismissButton() { return ( <button type="button" className="close" onClick={this.props.onDismiss} aria-hidden="true"> <span>&times;</span> </button> ); }, renderSrOnlyDismissButton() { return ( <button type="button" className="close sr-only" onClick={this.props.onDismiss}> {this.props.closeLabel} </button> ); }, render() { let classes = this.getBsClassSet(); let isDismissable = !!this.props.onDismiss; classes['alert-dismissable'] = isDismissable; return ( <div {...this.props} role="alert" className={classNames(this.props.className, classes)}> {isDismissable ? this.renderDismissButton() : null} {this.props.children} {isDismissable ? this.renderSrOnlyDismissButton() : null} </div> ); }, componentDidMount() { if (this.props.dismissAfter && this.props.onDismiss) { this.dismissTimer = setTimeout(this.props.onDismiss, this.props.dismissAfter); } }, componentWillUnmount() { clearTimeout(this.dismissTimer); } }); export default Alert;
    src/js/components/nodes/registerNodes/driverFields/DriverFields.js
    knowncitizen/tripleo-ui
    /** * Copyright 2017 Red Hat Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import { defineMessages, injectIntl } from 'react-intl'; import { Field } from 'redux-form'; import { format, required } from 'redux-form-validators'; import PropTypes from 'prop-types'; import React from 'react'; import HorizontalInput from '../../../ui/reduxForm/HorizontalInput'; import HorizontalTextarea from '../../../ui/reduxForm/HorizontalTextarea'; import { IPV4_REGEX, FQDN_REGEX, PORT_REGEX } from '../../../../utils/regex'; const messages = defineMessages({ ipOrFqdnValidatorMessage: { id: 'DriverFields.ipOrFqdnValidatorMessage', defaultMessage: 'Please enter a valid IPv4 Address or a valid FQDN.' }, portValidationMessage: { id: 'DriverFields.portValidationMessage', defaultMessage: 'Please enter valid Port number (0 - 65535)' } }); export const DriverFields = ({ addressLabel, intl: { formatMessage }, passwordLabel, portLabel, node, userLabel }) => ( <div> <Field name={`${node}.pm_addr`} component={HorizontalInput} id={`${node}.pm_addr`} label={addressLabel} validate={[ format({ with: new RegExp(IPV4_REGEX.source + '|' + FQDN_REGEX.source), message: formatMessage(messages.ipOrFqdnValidatorMessage) }), required() ]} required /> <Field name={`${node}.pm_port`} component={HorizontalInput} id={`${node}.pm_port`} label={portLabel} type="number" min={0} max={65535} validate={[ format({ with: PORT_REGEX, message: formatMessage(messages.portValidationMessage), allowBlank: true }) ]} /> <Field name={`${node}.pm_user`} component={HorizontalInput} id={`${node}.pm_user`} label={userLabel} validate={required()} required /> <Field name={`${node}.pm_password`} component={HorizontalTextarea} id={`${node}.pm_password`} label={passwordLabel} validate={required()} required /> </div> ); DriverFields.propTypes = { addressLabel: PropTypes.string.isRequired, intl: PropTypes.object.isRequired, node: PropTypes.string.isRequired, passwordLabel: PropTypes.string.isRequired, portLabel: PropTypes.string.isRequired, userLabel: PropTypes.string.isRequired }; export default injectIntl(DriverFields);
    client/src/components/role/RoleUpdate.js
    FlevianK/cp2-document-management-system
    import React from 'react'; import { connect } from 'react-redux'; import { Link, browserHistory } from 'react-router'; import { bindActionCreators } from 'redux'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import RaisedButton from 'material-ui/RaisedButton'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import PropTypes from 'prop-types'; import toastr from 'toastr'; import { Input } from '../../containers'; import * as roleAction from '../../actions/roleAction'; import DashboardHeader from '../common/DashboardHeader'; export class RoleUpdate extends React.Component { /** * RoleUpdate class * It is for updating role description */ constructor(props) { super(props); this.state = { roles: { roleId: this.props.params.roleId }, open: true }; this.onRoleChange = this.onRoleChange.bind(this); this.onRoleUpdate = this.onRoleUpdate.bind(this); this.handleClose = this.handleClose.bind(this); } componentWillMount() { this.props.actions.loadRole(this.props.params); } componentWillReceiveProps(nextProps) { const role = nextProps.roles; this.setState({ roles: role }); } onRoleChange(event) { event.preventDefault(); const field = event.target.name; const roles = this.state.roles; roles[field] = event.target.value; return this.setState({ roles }); } onRoleUpdate(event) { event.preventDefault(); this.props.actions.updateRole(this.state.roles) .then(() => { this.setState({ open: false }); browserHistory.push('/roles'); }) .catch((error) => { toastr.error(error.response.data.message); }); } handleClose() { this.setState({ open: false }); browserHistory.push('/roles'); } render() { console.log(this.props, "llll") const { roles } = this.props; const actions = [ <FlatButton style={{ color: "red", margin: " 0 15% 0 15%", padding: " 0 4% 0 4% " }} label="Cancel" primary={true} onClick={this.handleClose} />, <FlatButton style={{ color: "green", margin: " 0 15% 0 15%", padding: " 0 4% 0 4% " }} label="Update" primary={true} keyboardFocused={true} onClick={this.onRoleUpdate} />]; return ( <div> <DashboardHeader /> <div> <MuiThemeProvider> <Dialog actions={actions} modal={false} open={this.state.open} onRequestClose={this.handleClose} > <div className="row"> <div className="col s10 offset-m1"> <p>Role: {this.state.roles.title}</p> </div> </div> <form> <Input name="description" label="Description" type="text" value={this.state.roles.description} onChange={this.onRoleChange} /> </form> </Dialog> </MuiThemeProvider> </div> </div> ); } } RoleUpdate.propTypes = { roles: PropTypes.object, actions: PropTypes.object, params: PropTypes.object, }; const mapStateToProps = (state, ownProps) => ({ roles: state.roles }); const mapDispatchToProps = dispatch => ({ actions: bindActionCreators(roleAction, dispatch) }); export default connect(mapStateToProps, mapDispatchToProps)(RoleUpdate);
    app/main.js
    mapbox/osm-comments-frontend
    import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/Application'; import ContentContainer from './containers/Content'; import NotesList from './components/NotesList'; import ChangesetsList from './components/ChangesetsList'; import { Router, Route, IndexRoute, Redirect } from 'react-router'; import createHistory from 'history/lib/createHashHistory'; const history = createHistory({ queryKey: false }); const routes = ( <Router history={history}> <Redirect from="/" to="changesets/" /> <Route path="/" component={App}> <Route path="notes/" component={NotesList} /> <Route path="changesets/" component={ChangesetsList} /> </Route> </Router> ); ReactDOM.render(routes, document.getElementById('application'));
    examples/with-yarn-workspaces/packages/bar/index.js
    BlancheXu/test
    import React from 'react' const Bar = () => <strong>bar</strong> export default Bar
    docs/client/components/pages/Image/gettingStarted.js
    koaninc/draft-js-plugins
    // It is important to import the Editor which accepts plugins. // eslint-disable-next-line import/no-unresolved import Editor from 'draft-js-plugins-editor'; // eslint-disable-next-line import/no-unresolved import createImagePlugin from 'draft-js-image-plugin'; import React from 'react'; const imagePlugin = createImagePlugin(); // The Editor accepts an array of plugins. In this case, only the imagePlugin // is passed in, although it is possible to pass in multiple plugins. const MyEditor = ({ editorState, onChange }) => ( <Editor editorState={editorState} onChange={onChange} plugins={[imagePlugin]} /> ); export default MyEditor;
    lib/FocusTrap.js
    danauclair/react-hotkeys
    import React from 'react'; const FocusTrap = React.createClass({ propTypes: { onFocus: React.PropTypes.func, onBlur: React.PropTypes.func, focusName: React.PropTypes.string, // Currently unused component: React.PropTypes.any }, getDefaultProps() { return { component: 'div' } }, render() { const Component = this.props.component; return ( <Component tabIndex="-1" {...this.props}> {this.props.children} </Component> ); } }); export default FocusTrap;
    src/components/NotFoundPage.js
    mgavaudan/react-hack
    import React from 'react'; import { Link } from 'react-router'; const NotFoundPage = () => { return ( <div> <h4> 404 Page Not Found </h4> <Link to='/'> Go back to homepage </Link> </div> ); }; export default NotFoundPage;
    src/PageHeader.js
    blue68/react-bootstrap
    import React from 'react'; import classNames from 'classnames'; const PageHeader = React.createClass({ render() { return ( <div {...this.props} className={classNames(this.props.className, 'page-header')}> <h1>{this.props.children}</h1> </div> ); } }); export default PageHeader;