bigbuffet-rw/app/soapbox/features/placeholder/components/placeholder-display-name.tsx

25 lines
735 B
TypeScript
Raw Normal View History

import React from 'react';
import { randomIntFromInterval, generateText } from '../utils';
2022-05-01 10:45:37 -07:00
interface IPlaceholderDisplayName {
maxLength: number,
minLength: number,
withSuffix?: boolean,
2022-05-01 10:45:37 -07:00
}
/** Fake display name to show when data is loading. */
const PlaceholderDisplayName: React.FC<IPlaceholderDisplayName> = ({ minLength, maxLength, withSuffix = true }) => {
2022-03-21 11:09:01 -07:00
const length = randomIntFromInterval(maxLength, minLength);
const acctLength = randomIntFromInterval(maxLength, minLength);
2022-03-21 11:09:01 -07:00
return (
<div className='flex flex-col text-primary-50 dark:text-primary-800'>
2022-03-21 11:09:01 -07:00
<p>{generateText(length)}</p>
{withSuffix && <p>{generateText(acctLength)}</p>}
2022-03-21 11:09:01 -07:00
</div>
);
};
2022-03-21 11:09:01 -07:00
export default PlaceholderDisplayName;