[Glitch] Use JSX syntax for Fragments

Port 5a16bd7bf4 to glitch-soc
This commit is contained in:
Claire
2023-05-28 14:56:24 +02:00
parent 8278907ff7
commit a0bc0619ca
31 changed files with 110 additions and 127 deletions

View File

@@ -1,4 +1,3 @@
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { Avatar } from './avatar';
@@ -97,10 +96,10 @@ class Account extends ImmutablePureComponent {
if (hidden) {
return (
<Fragment>
<>
{account.get('display_name')}
{account.get('username')}
</Fragment>
</>
);
}
@@ -128,10 +127,10 @@ class Account extends ImmutablePureComponent {
hidingNotificationsButton = <IconButton active icon='bell-slash' title={intl.formatMessage(messages.mute_notifications, { name: account.get('username') })} onClick={this.handleMuteNotifications} />;
}
buttons = (
<Fragment>
<>
<IconButton active icon='volume-up' title={intl.formatMessage(messages.unmute, { name: account.get('username') })} onClick={this.handleMute} />
{hidingNotificationsButton}
</Fragment>
</>
);
} else if (defaultAction === 'mute') {
buttons = <IconButton icon='volume-off' title={intl.formatMessage(messages.mute, { name: account.get('username') })} onClick={this.handleMute} />;

View File

@@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'flavours/glitch/api';
import { FormattedNumber } from 'react-intl';
@@ -62,25 +62,25 @@ export default class Counter extends PureComponent {
if (loading) {
content = (
<Fragment>
<>
<span className='sparkline__value__total'><Skeleton width={43} /></span>
<span className='sparkline__value__change'><Skeleton width={43} /></span>
</Fragment>
</>
);
} else {
const measure = data[0];
const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1);
content = (
<Fragment>
<>
<span className='sparkline__value__total'>{measure.human_value || <FormattedNumber value={measure.total} />}</span>
{measure.previous_total && (<span className={classNames('sparkline__value__change', { positive: percentChange > 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'}<FormattedNumber value={percentChange} style='percent' /></span>)}
</Fragment>
</>
);
}
const inner = (
<Fragment>
<>
<div className='sparkline__value'>
{content}
</div>
@@ -96,7 +96,7 @@ export default class Counter extends PureComponent {
</Sparklines>
)}
</div>
</Fragment>
</>
);
if (href) {

View File

@@ -1,4 +1,4 @@
import { PureComponent, cloneElement, Children, Fragment } from 'react';
import { PureComponent, cloneElement, Children } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { IconButton } from './icon_button';
@@ -306,7 +306,7 @@ export default class Dropdown extends PureComponent {
);
return (
<Fragment>
<>
<span ref={this.setTargetRef}>
{button}
</span>
@@ -329,7 +329,7 @@ export default class Dropdown extends PureComponent {
</div>
)}
</Overlay>
</Fragment>
</>
);
}

View File

@@ -1,5 +1,5 @@
// @ts-check
import { Component, Fragment } from 'react';
import { Component } from 'react';
import { Sparklines, SparklinesCurve } from 'react-sparklines';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
@@ -70,7 +70,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className, description
<div className={classNames('trends__item', className)}>
<div className='trends__item__name'>
<Permalink href={href} to={to}>
{name ? <Fragment>#<span>{name}</span></Fragment> : <Skeleton width={50} />}
{name ? <>#<span>{name}</span></> : <Skeleton width={50} />}
</Permalink>
{description ? (

View File

@@ -138,7 +138,7 @@ export class IconButton extends React.PureComponent<Props, States> {
}
let contents = (
<React.Fragment>
<>
<Icon id={icon} fixedWidth aria-hidden='true' />{' '}
{typeof counter !== 'undefined' && (
<span className='icon-button__counter'>
@@ -146,7 +146,7 @@ export class IconButton extends React.PureComponent<Props, States> {
</span>
)}
{this.props.label}
</React.Fragment>
</>
);
if (href != null) {

View File

@@ -5,14 +5,12 @@ import Trends from 'flavours/glitch/features/getting_started/containers/trends_c
import AccountNavigation from 'flavours/glitch/features/account/navigation';
const DefaultNavigation = () => (
<>
{showTrends && (
<>
<div className='flex-spacer' />
<Trends />
</>
)}
</>
showTrends ? (
<>
<div className='flex-spacer' />
<Trends />
</>
) : null
);
class NavigationPortal extends PureComponent {