/** * @jsxRuntime classic * @jsx jsx */ import { memo, type MemoExoticComponent } from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766 import { css, jsx } from '@emotion/react'; import type { DraggableProvided, DraggableStateSnapshot } from 'react-beautiful-dnd'; import { token } from '@atlaskit/tokens'; import type { Item } from '../../examples/data/tasks'; import type { RbdApi } from './types'; const cardStyles = css({ display: 'flex', padding: 16, position: 'relative', alignItems: 'center', justifyContent: 'center', gap: token('space.100'), flexDirection: 'row', background: token('elevation.surface.raised'), borderRadius: 4, boxShadow: `0px 0px 1px rgba(9, 30, 66, 0.31), 0px 1px 1px rgba(9, 30, 66, 0.25)`, userSelect: 'none', marginBottom: token('space.100'), }); const cardDraggingStyles = css({ boxShadow: token('elevation.shadow.overlay'), }); const idStyles = css({ position: 'absolute', top: token('space.100'), right: token('space.100'), color: token('color.text.disabled'), fontSize: '10px', }); function DragIcon({ state }: { state: DraggableState }) { return ( ); } type DraggableState = 'idle' | 'generate-preview' | 'dragging'; const cardText: { [State in DraggableState]: string } = { 'generate-preview': 'Drag preview', idle: 'Draggable', dragging: 'Draggable source', }; const cardTextStyles = css({ margin: 0, }); const cardTextDraggingStyles = css({ color: token('color.text.disabled'), }); function CardText({ state }: { state: DraggableState }) { return (

{cardText[state]}

); } type CardProps = { item: Item; index: number; draggableId: string; rbdApi: RbdApi; }; export function CardInner({ provided, snapshot, item, }: { provided: DraggableProvided; snapshot: DraggableStateSnapshot; item: Item; }): jsx.JSX.Element { const state = snapshot.isDragging ? 'dragging' : 'idle'; return (
ID: {item.itemId}
); } export const Card: MemoExoticComponent< ({ item, index, draggableId, rbdApi }: CardProps) => jsx.JSX.Element > = memo(({ item, index, draggableId, rbdApi }: CardProps): jsx.JSX.Element => { const { Draggable } = rbdApi; return ( {(provided, snapshot) => { return ; }} ); });