-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathPageMeta.tsx
43 lines (34 loc) · 1.08 KB
/
PageMeta.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {Flex} from '@gravity-ui/uikit';
import {cn} from '../../utils/cn';
import {AutoRefreshControl} from '../AutoRefreshControl/AutoRefreshControl';
import {Skeleton} from '../Skeleton/Skeleton';
import './PageMeta.scss';
const b = cn('ydb-page-meta');
interface PageMetaProps {
items: (string | undefined)[];
className?: string;
loading?: boolean;
}
const separator = '\u00a0\u00a0\u00B7\u00a0\u00a0';
export function PageMeta({items, loading}: PageMetaProps) {
const renderContent = () => {
if (loading) {
return <Skeleton className={b('skeleton')} />;
}
return items.filter((item) => Boolean(item)).join(separator);
};
return <div className={b('info')}>{renderContent()}</div>;
}
export function PageMetaWithAutorefresh({className, ...rest}: PageMetaProps) {
return (
<Flex
gap={1}
alignItems="center"
justifyContent="space-between"
className={b(null, className)}
>
<PageMeta {...rest} />
<AutoRefreshControl />
</Flex>
);
}