import { css, cx } from '@emotion/css'; import React, { FC, MouseEvent } from 'react'; import { GrafanaTheme } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { Icon, IconButton, useStyles } from '@grafana/ui'; import { TagBadge } from '../../core/components/TagFilter/TagBadge'; import { PlaylistItem } from './types'; interface PlaylistTableRowProps { first: boolean; last: boolean; item: PlaylistItem; onMoveUp: (item: PlaylistItem) => void; onMoveDown: (item: PlaylistItem) => void; onDelete: (item: PlaylistItem) => void; } export const PlaylistTableRow: FC = ({ item, onDelete, onMoveDown, onMoveUp, first, last }) => { const styles = useStyles(getStyles); const onDeleteClick = (event: MouseEvent) => { event.preventDefault(); onDelete(item); }; const onMoveDownClick = (event: MouseEvent) => { event.preventDefault(); onMoveDown(item); }; const onMoveUpClick = (event: MouseEvent) => { event.preventDefault(); onMoveUp(item); }; return ( {item.type === 'dashboard_by_id' ? ( {item.title} ) : null} {item.type === 'dashboard_by_tag' ? ( ) : null} {!first ? ( ) : null} {!last ? ( ) : null} ); }; function getStyles(theme: GrafanaTheme) { return { td: css` label: td; line-height: 28px; max-width: 335px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; `, item: css` label: item; span { margin-left: ${theme.spacing.xs}; } `, settings: css` label: settings; text-align: right; `, }; }