import { css } from '@emotion/css'; import Skeleton from 'react-loading-skeleton'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, Card, LinkButton, ModalsController, Stack, useStyles2 } from '@grafana/ui'; import { attachSkeleton, SkeletonComponent } from '@grafana/ui/src/unstable'; import { t, Trans } from 'app/core/internationalization'; import { contextSrv } from 'app/core/services/context_srv'; import { DashNavButton } from 'app/features/dashboard/components/DashNav/DashNavButton'; import { ShareModal } from './ShareModal'; import { Playlist } from './types'; interface Props { setStartPlaylist: (playlistItem: Playlist) => void; setPlaylistToDelete: (playlistItem: Playlist) => void; playlist: Playlist; } const PlaylistCardComponent = ({ playlist, setStartPlaylist, setPlaylistToDelete }: Props) => { return ( {playlist.name} {({ showModal, hideModal }) => ( { showModal(ShareModal, { playlistUid: playlist.uid, onDismiss: hideModal, }); }} /> )} {contextSrv.isEditor && ( <> Edit playlist )} ); }; const PlaylistCardSkeleton: SkeletonComponent = ({ rootProps }) => { const skeletonStyles = useStyles2(getSkeletonStyles); return ( {contextSrv.isEditor && ( <> )} ); }; export const PlaylistCard = attachSkeleton(PlaylistCardComponent, PlaylistCardSkeleton); function getSkeletonStyles(theme: GrafanaTheme2) { return { button: css({ lineHeight: 1, }), }; }