pleroma/app/soapbox/features/placeholder/components/placeholder-status.tsx

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-02-06 10:01:03 -08:00
import clsx from 'clsx';
import React from 'react';
import { HStack } from 'soapbox/components/ui';
2022-03-21 11:09:01 -07:00
2022-11-15 11:00:40 -08:00
import PlaceholderAvatar from './placeholder-avatar';
import PlaceholderDisplayName from './placeholder-display-name';
import PlaceholderStatusContent from './placeholder-status-content';
2022-03-21 11:09:01 -07:00
interface IPlaceholderStatus {
thread?: boolean
}
/** Fake status to display while data is loading. */
const PlaceholderStatus: React.FC<IPlaceholderStatus> = ({ thread = false }) => (
2022-03-21 11:09:01 -07:00
<div
2023-02-06 10:01:03 -08:00
className={clsx({
'status-placeholder bg-white dark:bg-primary-900': true,
'shadow-xl dark:shadow-none sm:rounded-xl px-4 py-6 sm:p-5': !thread,
2022-03-21 11:09:01 -07:00
})}
>
<div className='w-full animate-pulse overflow-hidden'>
<div>
<HStack space={3} alignItems='center'>
2023-02-01 14:13:42 -08:00
<div className='shrink-0'>
2022-03-21 11:09:01 -07:00
<PlaceholderAvatar size={42} />
</div>
<div className='min-w-0 flex-1'>
<PlaceholderDisplayName minLength={3} maxLength={25} />
</div>
</HStack>
2022-03-21 11:09:01 -07:00
</div>
2023-02-01 14:13:42 -08:00
<div className='status__content-wrapper mt-4'>
2022-03-21 11:09:01 -07:00
<PlaceholderStatusContent minLength={5} maxLength={120} />
</div>
</div>
</div>
);
export default React.memo(PlaceholderStatus);