// @flow import * as React from 'react'; import styled from 'styled-components'; import { useToggle } from 'react-use'; import { motion } from 'framer-motion'; import SvgIcon from '../svg-icon'; import Button from '../button'; import ListGroupItem from './list-group-item'; import UnitTestRequestSelector from './unit-test-request-selector'; type Props = {| item: Object, children?: React.Node, onDeleteTest?: () => void, onRunTest?: () => void, testNameEditable?: React.Node, testsRunning?: Object, onSetActiveRequest: () => void, selectedRequestId?: string, selectableRequests: Array<{ name: string, request: { _id: string } }>, |}; const StyledResultListItem: React.ComponentType<{}> = styled(ListGroupItem)` padding: 0 var(--padding-sm); > div:first-of-type { display: flex; flex-direction: row; align-items: flex-start; align-items: center; } svg { fill: var(--hl-xl); } h2 { font-size: var(--font-size-md); font-weight: var(--font-weight-normal); margin: 0px; } button { padding: 0px var(--padding-sm); } `; const StyledUnitTestContent: React.ComponentType<{}> = styled(motion.div)` display: block; height: 0px; overflow: hidden; `; const UnitTestItem = ({ item, children, onDeleteTest, onRunTest, testNameEditable, testsRunning, onSetActiveRequest, selectedRequestId, selectableRequests, }: Props) => { const [isToggled, toggle] = useToggle(false); const toggleIconRotation = -90; return (

{testNameEditable}

{isToggled &&
{children}
}
); }; export default UnitTestItem;