Convert most Placeholder components into TSX
This commit is contained in:
parent
5def7a087d
commit
311ec14200
11 changed files with 91 additions and 1 deletions
Binary file not shown.
|
@ -0,0 +1,22 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import PlaceholderAvatar from './placeholder_avatar';
|
||||||
|
import PlaceholderDisplayName from './placeholder_display_name';
|
||||||
|
|
||||||
|
/** Fake account to display while data is loading. */
|
||||||
|
const PlaceholderAccount: React.FC = () => {
|
||||||
|
return (
|
||||||
|
<div className='account'>
|
||||||
|
<div className='account__wrapper'>
|
||||||
|
<span className='account__display-name'>
|
||||||
|
<div className='account__avatar-wrapper'>
|
||||||
|
<PlaceholderAvatar size={36} />
|
||||||
|
</div>
|
||||||
|
<PlaceholderDisplayName minLength={3} maxLength={25} />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlaceholderAccount;
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,31 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { randomIntFromInterval, generateText } from '../utils';
|
||||||
|
|
||||||
|
import PlaceholderAvatar from './placeholder_avatar';
|
||||||
|
import PlaceholderDisplayName from './placeholder_display_name';
|
||||||
|
|
||||||
|
/** Fake chat to display while data is loading. */
|
||||||
|
const PlaceholderChat: React.FC = () => {
|
||||||
|
const messageLength = randomIntFromInterval(5, 75);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='chat-list-item chat-list-item--placeholder'>
|
||||||
|
<div className='account'>
|
||||||
|
<div className='account__wrapper'>
|
||||||
|
<div className='account__display-name'>
|
||||||
|
<div className='account__avatar-wrapper'>
|
||||||
|
<PlaceholderAvatar size={36} />
|
||||||
|
</div>
|
||||||
|
<PlaceholderDisplayName minLength={3} maxLength={25} />
|
||||||
|
<span className='chat__last-message'>
|
||||||
|
{generateText(messageLength)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlaceholderChat;
|
Binary file not shown.
|
@ -0,0 +1,20 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { generateText, randomIntFromInterval } from '../utils';
|
||||||
|
|
||||||
|
/** Fake hashtag to display while data is loading. */
|
||||||
|
const PlaceholderHashtag: React.FC = () => {
|
||||||
|
const length = randomIntFromInterval(15, 30);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='placeholder-hashtag'>
|
||||||
|
<div className='trends__item'>
|
||||||
|
<div className='trends__item__name'>
|
||||||
|
{generateText(length)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlaceholderHashtag;
|
Binary file not shown.
|
@ -0,0 +1,16 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import PlaceholderStatus from './placeholder_status';
|
||||||
|
|
||||||
|
/** Fake material status to display while data is loading. */
|
||||||
|
const PlaceholderMaterialStatus: React.FC = () => {
|
||||||
|
return (
|
||||||
|
<div className='material-status' tabIndex={-1} aria-hidden>
|
||||||
|
<div className='material-status__status' tabIndex={0}>
|
||||||
|
<PlaceholderStatus />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlaceholderMaterialStatus;
|
Binary file not shown.
|
@ -9,7 +9,8 @@ interface IPlaceholderStatus {
|
||||||
thread?: boolean
|
thread?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlaceholderStatus = ({ thread = false }: IPlaceholderStatus) => (
|
/** Fake status to display while data is loading. */
|
||||||
|
const PlaceholderStatus: React.FC<IPlaceholderStatus> = ({ thread = false }) => (
|
||||||
<div
|
<div
|
||||||
className={classNames({
|
className={classNames({
|
||||||
'status-placeholder bg-white dark:bg-slate-800': true,
|
'status-placeholder bg-white dark:bg-slate-800': true,
|
||||||
|
|
Loading…
Reference in a new issue