Merge pull request #383 from lbryio/single-quote-jsx

fix: updated components to use single quotes in jsx
This commit is contained in:
Bill Bittner 2018-03-08 09:30:53 -08:00 committed by GitHub
commit 18486134c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 90 additions and 91 deletions

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
const ActiveStatusBar = () => { const ActiveStatusBar = () => {
return <span className="progress-bar progress-bar--active">| </span>; return <span className='progress-bar progress-bar--active'>| </span>;
} };
export default ActiveStatusBar; export default ActiveStatusBar;

View file

@ -2,31 +2,32 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
class ExpandingTextarea extends Component { class ExpandingTextarea extends Component {
constructor (props) {
super(props);
this._handleChange = this._handleChange.bind(this);
}
componentDidMount () { componentDidMount () {
this.adjustTextarea({}); this.adjustTextarea({});
} }
render () {
const { onChange, ...rest } = this.props;
return (
<textarea
{ ...rest }
ref={x => this.el = x}
onChange={ this._handleChange.bind(this) }
/>
);
}
_handleChange (event) { _handleChange (event) {
const { onChange } = this.props; const { onChange } = this.props;
if (onChange) onChange(event); if (onChange) onChange(event);
this.adjustTextarea(event); this.adjustTextarea(event);
} }
adjustTextarea ({ target = this.el }) { adjustTextarea ({ target = this.el }) {
target.style.height = 0; target.style.height = 0;
target.style.height = `${target.scrollHeight}px`; target.style.height = `${target.scrollHeight}px`;
} }
render () {
const { ...rest } = this.props;
return (
<textarea
{...rest}
ref={x => this.el = x}
onChange={this._handleChange}
/>
);
}
} }
ExpandingTextarea.propTypes = { ExpandingTextarea.propTypes = {

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
const InactiveStatusBar = () => { const InactiveStatusBar = () => {
return <span className="progress-bar progress-bar--inactive">| </span>; return <span className='progress-bar progress-bar--inactive'>| </span>;
} };
export default InactiveStatusBar; export default InactiveStatusBar;

View file

@ -3,20 +3,20 @@ import { Link } from 'react-router-dom';
function Logo () { function Logo () {
return ( return (
<svg version="1.1" id="Layer_1" x="0px" y="0px" height="24px" viewBox="0 0 80 31" enableBackground="new 0 0 80 31" className="nav-bar-logo"> <svg version='1.1' id='Layer_1' x='0px' y='0px' height='24px' viewBox='0 0 80 31' enableBackground='new 0 0 80 31' className='nav-bar-logo'>
<Link to="/"> <Link to='/'>
<title>Logo</title> <title>Logo</title>
<desc>Spee.ch logo</desc> <desc>Spee.ch logo</desc>
<g id="About"> <g id='About'>
<g id="Publish-Form-V2-_x28_filled_x29_" transform="translate(-42.000000, -23.000000)"> <g id='Publish-Form-V2-_x28_filled_x29_' transform='translate(-42.000000, -23.000000)'>
<g id="Group-17" transform="translate(42.000000, 22.000000)"> <g id='Group-17' transform='translate(42.000000, 22.000000)'>
<text transform="matrix(1 0 0 1 0 20)" fontSize="25" fontFamily="Roboto">Spee&lt;h</text> <text transform='matrix(1 0 0 1 0 20)' fontSize='25' fontFamily='Roboto'>Spee&lt;h</text>
<g id="Group-16" transform="translate(0.000000, 30.000000)"> <g id='Group-16' transform='translate(0.000000, 30.000000)'>
<path id="Line-8" fill="none" stroke="#09F911" strokeWidth="1" strokeLinecap="square" d="M0.5,1.5h15"/> <path id='Line-8' fill='none' stroke='#09F911' strokeWidth='1' strokeLinecap='square' d='M0.5,1.5h15' />
<path id="Line-8-Copy" fill="none" stroke="#029D74" strokeWidth="1" strokeLinecap="square" d="M16.5,1.5h15"/> <path id='Line-8-Copy' fill='none' stroke='#029D74' strokeWidth='1' strokeLinecap='square' d='M16.5,1.5h15' />
<path id="Line-8-Copy-2" fill="none" stroke="#E35BD8" strokeWidth="1" strokeLinecap="square" d="M32.5,1.5h15"/> <path id='Line-8-Copy-2' fill='none' stroke='#E35BD8' strokeWidth='1' strokeLinecap='square' d='M32.5,1.5h15' />
<path id="Line-8-Copy-3" fill="none" stroke="#4156C5" strokeWidth="1" strokeLinecap="square" d="M48.5,1.5h15"/> <path id='Line-8-Copy-3' fill='none' stroke='#4156C5' strokeWidth='1' strokeLinecap='square' d='M48.5,1.5h15' />
<path id="Line-8-Copy-4" fill="none" stroke="#635688" strokeWidth="1" strokeLinecap="square" d="M64.5,1.5h15"/> <path id='Line-8-Copy-4' fill='none' stroke='#635688' strokeWidth='1' strokeLinecap='square' d='M64.5,1.5h15' />
</g> </g>
</g> </g>
</g> </g>

View file

@ -2,8 +2,8 @@ import React from 'react';
function NavBarChannelDropdown ({ channelName, handleSelection, defaultSelection, VIEW, LOGOUT }) { function NavBarChannelDropdown ({ channelName, handleSelection, defaultSelection, VIEW, LOGOUT }) {
return ( return (
<select type="text" id="nav-bar-channel-select" className="select select--arrow link--nav" onChange={handleSelection} value={defaultSelection}> <select type='text' id='nav-bar-channel-select' className='select select--arrow link--nav' onChange={handleSelection} value={defaultSelection}>
<option id="nav-bar-channel-select-channel-option">{channelName}</option> <option id='nav-bar-channel-select-channel-option'>{channelName}</option>
<option value={VIEW}>View</option> <option value={VIEW}>View</option>
<option value={LOGOUT}>Logout</option> <option value={LOGOUT}>Logout</option>
</select> </select>

View file

@ -4,13 +4,13 @@ import PropTypes from 'prop-types';
function UrlMiddle ({publishInChannel, selectedChannel, loggedInChannelName, loggedInChannelShortId}) { function UrlMiddle ({publishInChannel, selectedChannel, loggedInChannelName, loggedInChannelShortId}) {
if (publishInChannel) { if (publishInChannel) {
if (selectedChannel === loggedInChannelName) { if (selectedChannel === loggedInChannelName) {
return <span id="url-channel" className="url-text--secondary">{loggedInChannelName}:{loggedInChannelShortId} /</span>; return <span id='url-channel' className='url-text--secondary'>{loggedInChannelName}:{loggedInChannelShortId} /</span>;
} }
return <span id="url-channel-placeholder" className="url-text--secondary tooltip">@channel<span return <span id='url-channel-placeholder' className='url-text--secondary tooltip'>@channel<span
className="tooltip-text">Select a channel below</span> /</span>; className='tooltip-text'>Select a channel below</span> /</span>;
} }
return ( return (
<span id="url-no-channel-placeholder" className="url-text--secondary tooltip">xyz<span className="tooltip-text">This will be a random id</span> /</span> <span id='url-no-channel-placeholder' className='url-text--secondary tooltip'>xyz<span className='tooltip-text'>This will be a random id</span> /</span>
); );
} }

View file

@ -3,9 +3,7 @@ import View from './view';
import { selectAsset } from 'selectors/show'; import { selectAsset } from 'selectors/show';
const mapStateToProps = ({ show }) => { const mapStateToProps = ({ show }) => {
// select title
const { claimData: { title } } = selectAsset(show); const { claimData: { title } } = selectAsset(show);
// return props
return { return {
title, title,
}; };

View file

@ -3,7 +3,7 @@ import React from 'react';
const AssetTitle = ({ title }) => { const AssetTitle = ({ title }) => {
return ( return (
<div> <div>
<span className="text--large">{title}</span> <span className='text--large'>{title}</span>
</div> </div>
); );
}; };

View file

@ -24,7 +24,7 @@ class ChannelClaimsDisplay extends React.Component {
render () { render () {
const { channel: { claimsData: { claims, currentPage, totalPages } } } = this.props; const { channel: { claimsData: { claims, currentPage, totalPages } } } = this.props;
return ( return (
<div className="row row--tall"> <div className='row row--tall'>
{(claims.length > 0) ? ( {(claims.length > 0) ? (
<div> <div>
{claims.map((claim, index) => <AssetPreview {claims.map((claim, index) => <AssetPreview

View file

@ -54,15 +54,15 @@ class NavBar extends React.Component {
} }
render () { render () {
return ( return (
<div className="row row--wide nav-bar"> <div className='row row--wide nav-bar'>
<div className="row row--padded row--short flex-container--row flex-container--space-between-center"> <div className='row row--padded row--short flex-container--row flex-container--space-between-center'>
<Logo /> <Logo />
<div className="nav-bar--center"> <div className='nav-bar--center'>
<span className="nav-bar-tagline">Open-source, decentralized image and video sharing.</span> <span className='nav-bar-tagline'>Open-source, decentralized image and video sharing.</span>
</div> </div>
<div className="nav-bar--right"> <div className='nav-bar--right'>
<NavLink className="nav-bar-link link--nav" activeClassName="link--nav-active" to="/" exact={true}>Publish</NavLink> <NavLink className='nav-bar-link link--nav' activeClassName='link--nav-active' to='/' exact>Publish</NavLink>
<NavLink className="nav-bar-link link--nav" activeClassName="link--nav-active" to="/about">About</NavLink> <NavLink className='nav-bar-link link--nav' activeClassName='link--nav-active' to='/about'>About</NavLink>
{ this.props.channelName ? ( { this.props.channelName ? (
<NavBarChannelDropdown <NavBarChannelDropdown
channelName={this.props.channelName} channelName={this.props.channelName}
@ -72,7 +72,7 @@ class NavBar extends React.Component {
LOGOUT={LOGOUT} LOGOUT={LOGOUT}
/> />
) : ( ) : (
<NavLink id="nav-bar-login-link" className="nav-bar-link link--nav" activeClassName="link--nav-active" to="/login">Channel</NavLink> <NavLink id='nav-bar-login-link' className='nav-bar-link link--nav' activeClassName='link--nav-active' to='/login'>Channel</NavLink>
)} )}
</div> </div>
</div> </div>

View file

@ -24,48 +24,48 @@ class PublishMetadataInputs extends React.Component {
} }
render () { render () {
return ( return (
<div id="publish-details" className="row row--padded row--no-top row--wide"> <div id='publish-details' className='row row--padded row--no-top row--wide'>
{this.props.showMetadataInputs && ( {this.props.showMetadataInputs && (
<div> <div>
<div className="row row--no-top"> <div className='row row--no-top'>
<div className="column column--3 column--med-10 align-content-top"> <div className='column column--3 column--med-10 align-content-top'>
<label htmlFor="publish-license" className="label">Description:</label> <label htmlFor='publish-license' className='label'>Description:</label>
</div><div className="column column--7 column--sml-10"> </div><div className='column column--7 column--sml-10'>
<ExpandingTextArea <ExpandingTextArea
id="publish-description" id='publish-description'
className="textarea textarea--primary textarea--full-width" className='textarea textarea--primary textarea--full-width'
rows={1} rows={1}
maxLength={2000} maxLength={2000}
style={{ maxHeight: 200 }} style={{ maxHeight: 200 }}
name="description" name='description'
placeholder="Optional description" placeholder='Optional description'
value={this.props.description} value={this.props.description}
onChange={this.handleInput} /> onChange={this.handleInput} />
</div> </div>
</div> </div>
<div className="row row--no-top"> <div className='row row--no-top'>
<div className="column column--3 column--med-10"> <div className='column column--3 column--med-10'>
<label htmlFor="publish-license" className="label">License:</label> <label htmlFor='publish-license' className='label'>License:</label>
</div><div className="column column--7 column--sml-10"> </div><div className='column column--7 column--sml-10'>
<select type="text" name="license" id="publish-license" className="select select--primary" onChange={this.handleSelect}> <select type='text' name='license' id='publish-license' className='select select--primary' onChange={this.handleSelect}>
<option value=" ">Unspecified</option> <option value=' '>Unspecified</option>
<option value="Public Domain">Public Domain</option> <option value='Public Domain'>Public Domain</option>
<option value="Creative Commons">Creative Commons</option> <option value='Creative Commons'>Creative Commons</option>
</select> </select>
</div> </div>
</div> </div>
<div className="row row--no-top"> <div className='row row--no-top'>
<div className="column column--3"> <div className='column column--3'>
<label htmlFor="publish-nsfw" className="label">Mature:</label> <label htmlFor='publish-nsfw' className='label'>Mature:</label>
</div><div className="column column--7"> </div><div className='column column--7'>
<input className="input-checkbox" type="checkbox" id="publish-nsfw" name="nsfw" value={this.props.nsfw} onChange={this.handleInput} /> <input className='input-checkbox' type='checkbox' id='publish-nsfw' name='nsfw' value={this.props.nsfw} onChange={this.handleInput} />
</div> </div>
</div> </div>
</div> </div>
)} )}
<button className="button--secondary" onClick={this.toggleShowInputs}>{this.props.showMetadataInputs ? 'less' : 'more'}</button> <button className='button--secondary' onClick={this.toggleShowInputs}>{this.props.showMetadataInputs ? 'less' : 'more'}</button>
</div> </div>
); );
} }

View file

@ -12,7 +12,7 @@ class PublishTitleInput extends React.Component {
} }
render () { render () {
return ( return (
<input type="text" id="publish-title" className="input-text text--large input-text--full-width" name="title" placeholder="Give your post a title..." onChange={this.handleInput} value={this.props.title}/> <input type='text' id='publish-title' className='input-text text--large input-text--full-width' name='title' placeholder='Give your post a title...' onChange={this.handleInput} value={this.props.title} />
); );
} }
} }

View file

@ -2,9 +2,9 @@ import React from 'react';
import SEO from 'components/SEO'; import SEO from 'components/SEO';
import NavBar from 'containers/NavBar'; import NavBar from 'containers/NavBar';
import ErrorPage from 'components/ErrorPage'; import ErrorPage from 'components/ErrorPage';
import AssetTitle from 'components/AssetTitle'; import AssetTitle from 'containers/AssetTitle';
import AssetDisplay from 'components/AssetDisplay'; import AssetDisplay from 'containers/AssetDisplay';
import AssetInfo from 'components/AssetInfo'; import AssetInfo from 'containers/AssetInfo';
class ShowAssetDetails extends React.Component { class ShowAssetDetails extends React.Component {
render () { render () {

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import SEO from 'components/SEO'; import SEO from 'components/SEO';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import AssetDisplay from 'components/AssetDisplay'; import AssetDisplay from 'containers/AssetDisplay';
class ShowLite extends React.Component { class ShowLite extends React.Component {
render () { render () {

View file

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import ErrorPage from 'components/ErrorPage'; import ErrorPage from 'components/ErrorPage';
import ShowAssetLite from 'components/ShowAssetLite'; import ShowAssetLite from 'containers/ShowAssetLite';
import ShowAssetDetails from 'components/ShowAssetDetails'; import ShowAssetDetails from 'containers/ShowAssetDetails';
import ShowChannel from 'components/ShowChannel'; import ShowChannel from 'containers/ShowChannel';
import { CHANNEL, ASSET_LITE, ASSET_DETAILS } from 'constants/show_request_types'; import { CHANNEL, ASSET_LITE, ASSET_DETAILS } from 'constants/show_request_types';