/* * Copyright (c) 2015 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause */ import React, { type FC, type ReactNode } from 'react'; import { Flipped, Flipper, spring } from 'react-flip-toolkit'; import { type Device } from '../../deviceSlice'; const changesOnReorder = (devices: Device[]) => devices.map(device => device.serialNumber).join('\n'); export const AnimatedList: FC<{ children: ReactNode; devices: Device[]; }> = ({ children, devices }) => ( {children} ); type onAppear = React.ComponentProps['onAppear']; type onExit = React.ComponentProps['onExit']; const fadeIn: onAppear = element => spring({ values: { opacity: [0, 1], scale: [0, 1], }, // @ts-expect-error Library types not correct onUpdate: ({ opacity, scale }) => { element.style.opacity = opacity; element.style.transform = `scaleY(${scale})`; }, }); const fadeOut: onExit = (element, _, removeElement) => spring({ values: { opacity: [1, 0], scale: [1, 0], }, // @ts-expect-error Library types not correct onUpdate: ({ opacity, scale }) => { element.style.opacity = opacity; element.style.transform = `scaleY(${scale})`; }, onComplete: () => { removeElement(); }, }); export const AnimatedItem: FC<{ itemKey: string; children: ReactNode; isOnlyChild: boolean; }> = ({ children, itemKey, isOnlyChild }) => (
  • {children}
  • );