Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 24x 77x 7x | import React from 'react' import { Item } from '../../types/lastWill' import { TextInput } from '../Form/TextInput/TextInput' import { Headline } from '../Headline/Headline' import { IconButton } from '../IconButton/IconButton' import { Tooltip } from '../Tooltip/Tooltip' export type SuccessionHeirProps = { /** Sets the name of the Heir */ name: string /** Sets the name for the input field to connect with Formik */ inputFieldName: string /** Array of Items that are assigned to this heir */ items: Item[] /** Click Handler for the edit icon */ onClick: () => void /** Custom datacy for testing. */ datacy?: string } /** * SuccessionHeir component */ export const SuccessionHeir: React.FC<SuccessionHeirProps> = ({ name, inputFieldName, items, onClick, datacy }) => { return ( <div datacy={datacy} className="flex w-auto max-w-xl flex-col rounded-xl border-2 border-gray-100 px-8 py-6"> <div className="mb-4 flex items-center justify-between"> <Headline title={name} className="w-auto truncate md:text-lg" hasMargin={false} level={3}> {name} </Headline> <div className="flex items-center"> <TextInput datacy={`textinput-${datacy}`} className="pr-6 text-right" type="number" width="w-24" hasBottomMargin={false} name={inputFieldName} min={0} max={100} /> <p className="z-10 -ml-6">%</p> </div> </div> {/* Items */} <div className="flex h-full w-full justify-between"> <div className="w-5/6"> <p className="mb-1 w-full">{`Gegenstรคnde${items.length > 0 ? ` (${items.length})` : ''}`}</p> {items.slice(0, 2).map((item) => ( <p title={item.name} datacy={`${datacy}-item-${item.name}`} className="truncate text-gray-500" key={item.id} > {item.name} </p> ))} {items.length >= 3 && <p className="text-gray-500">und weitere...</p>} </div> <div className="flex h-full items-end"> <Tooltip content="Bearbeiten"> <IconButton datacy={`${datacy}-edit`} onClick={onClick} icon="edit" className="text-lg text-gray-500" /> </Tooltip> </div> </div> </div> ) } |