/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { DraggableProvidedDragHandleProps } from "react-beautiful-dnd"; import { Widget, WidgetType } from "../models"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowDown, faArrowUp, faGripVertical } from "@fortawesome/free-solid-svg-icons"; import Link from "./Link"; import { useTranslation } from "react-i18next"; import WidgetTreeActionMenu from "./WidgetTreeActionMenu"; import Button from "./Button"; interface WidgetTreeItemContentProps { label: string; widget: Widget; onDelete: (widget: Widget) => void; onDuplicate: (widget: Widget) => void; className?: string; dragHandleProps?: DraggableProvidedDragHandleProps; onMoveUp?: () => void; onMoveDown?: () => void; } const WidgetTreeItemContent = ({ label, widget, dragHandleProps, className, onDelete, onDuplicate, onMoveUp, onMoveDown, }: WidgetTreeItemContentProps) => { const { t } = useTranslation(); return (
{label}
{onMoveUp ? ( ) : (
)}
{onMoveDown ? ( ) : (
)}
{widget.name}
{`(${t( widget.widgetType === WidgetType.Chart ? widget.content.chartType : widget.widgetType, )})`}
); }; export default WidgetTreeItemContent;