mirror of https://github.com/mastodon/mastodon
Rewrite `<Skeleton/>` as FC and TS (#25055)
This commit is contained in:
parent
711a037660
commit
8066118d1f
|
@ -4,7 +4,7 @@ import api from 'mastodon/api';
|
||||||
import { FormattedNumber } from 'react-intl';
|
import { FormattedNumber } from 'react-intl';
|
||||||
import { Sparklines, SparklinesCurve } from 'react-sparklines';
|
import { Sparklines, SparklinesCurve } from 'react-sparklines';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
|
|
||||||
const percIncrease = (a, b) => {
|
const percIncrease = (a, b) => {
|
||||||
let percent;
|
let percent;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||||
import api from 'mastodon/api';
|
import api from 'mastodon/api';
|
||||||
import { FormattedNumber } from 'react-intl';
|
import { FormattedNumber } from 'react-intl';
|
||||||
import { roundTo10 } from 'mastodon/utils/numbers';
|
import { roundTo10 } from 'mastodon/utils/numbers';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
|
|
||||||
export default class Dimension extends React.PureComponent {
|
export default class Dimension extends React.PureComponent {
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { List } from 'immutable';
|
||||||
import type { Account } from '../../types/resources';
|
import type { Account } from '../../types/resources';
|
||||||
import { autoPlayGif } from '../initial_state';
|
import { autoPlayGif } from '../initial_state';
|
||||||
|
|
||||||
import Skeleton from './skeleton';
|
import { Skeleton } from './skeleton';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
account?: Account;
|
account?: Account;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { DisplayName } from 'mastodon/components/display_name';
|
import { DisplayName } from 'mastodon/components/display_name';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
size?: number;
|
size?: number;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import ShortNumber from 'mastodon/components/short_number';
|
import ShortNumber from 'mastodon/components/short_number';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
class SilentErrorBoundary extends React.Component {
|
class SilentErrorBoundary extends React.Component {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { fetchServer } from 'mastodon/actions/server';
|
import { fetchServer } from 'mastodon/actions/server';
|
||||||
import ShortNumber from 'mastodon/components/short_number';
|
import ShortNumber from 'mastodon/components/short_number';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
import Account from 'mastodon/containers/account_container';
|
import Account from 'mastodon/containers/account_container';
|
||||||
import { domain } from 'mastodon/initial_state';
|
import { domain } from 'mastodon/initial_state';
|
||||||
import { ServerHeroImage } from 'mastodon/components/server_hero_image';
|
import { ServerHeroImage } from 'mastodon/components/server_hero_image';
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
const Skeleton = ({ width, height }) => <span className='skeleton' style={{ width, height }}>‌</span>;
|
|
||||||
|
|
||||||
Skeleton.propTypes = {
|
|
||||||
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
||||||
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Skeleton;
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
width?: number | string;
|
||||||
|
height?: number | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Skeleton: React.FC<Props> = ({ width, height }) => (
|
||||||
|
<span className='skeleton' style={{ width, height }}>
|
||||||
|
‌
|
||||||
|
</span>
|
||||||
|
);
|
|
@ -8,7 +8,7 @@ import LinkFooter from 'mastodon/features/ui/components/link_footer';
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'mastodon/actions/server';
|
import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'mastodon/actions/server';
|
||||||
import Account from 'mastodon/containers/account_container';
|
import Account from 'mastodon/containers/account_container';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
import { Icon } from 'mastodon/components/icon';
|
import { Icon } from 'mastodon/components/icon';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { ServerHeroImage } from 'mastodon/components/server_hero_image';
|
import { ServerHeroImage } from 'mastodon/components/server_hero_image';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||||
import { Blurhash } from 'mastodon/components/blurhash';
|
import { Blurhash } from 'mastodon/components/blurhash';
|
||||||
import { accountsCountRenderer } from 'mastodon/components/hashtag';
|
import { accountsCountRenderer } from 'mastodon/components/hashtag';
|
||||||
import ShortNumber from 'mastodon/components/short_number';
|
import ShortNumber from 'mastodon/components/short_number';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export default class Story extends React.PureComponent {
|
export default class Story extends React.PureComponent {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Helmet } from 'react-helmet';
|
||||||
import { FormattedMessage, FormattedDate, injectIntl, defineMessages } from 'react-intl';
|
import { FormattedMessage, FormattedDate, injectIntl, defineMessages } from 'react-intl';
|
||||||
import Column from 'mastodon/components/column';
|
import Column from 'mastodon/components/column';
|
||||||
import api from 'mastodon/api';
|
import api from 'mastodon/api';
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
title: { id: 'privacy_policy.title', defaultMessage: 'Privacy Policy' },
|
title: { id: 'privacy_policy.title', defaultMessage: 'Privacy Policy' },
|
||||||
|
|
Loading…
Reference in New Issue