| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | import {Divider} from 'isl-components/Divider'; |
| 9 | import {Icon} from 'isl-components/Icon'; |
| 10 | |
| 11 | import './DropdownFields.css'; |
| 12 | |
| 13 | export function DropdownFields({ |
| 14 | title, |
| 15 | icon, |
| 16 | children, |
| 17 | className, |
| 18 | ...rest |
| 19 | }: { |
| 20 | title: React.ReactNode; |
| 21 | icon: string; |
| 22 | children: React.ReactNode; |
| 23 | 'data-testid'?: string; |
| 24 | className?: string; |
| 25 | }) { |
| 26 | return ( |
| 27 | <div className={'dropdown-fields' + (className != null ? ` ${className}` : '')} {...rest}> |
| 28 | <div className="dropdown-fields-header"> |
| 29 | <Icon icon={icon} size="M" /> |
| 30 | <strong role="heading">{title}</strong> |
| 31 | </div> |
| 32 | <Divider /> |
| 33 | <div className="dropdown-fields-content">{children}</div> |
| 34 | </div> |
| 35 | ); |
| 36 | } |
| 37 | |
| 38 | export function DropdownField({ |
| 39 | title, |
| 40 | children, |
| 41 | ...rest |
| 42 | }: { |
| 43 | title: React.ReactNode; |
| 44 | children: React.ReactNode; |
| 45 | } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'title'>) { |
| 46 | return ( |
| 47 | <div className="dropdown-field"> |
| 48 | <strong>{title}</strong> |
| 49 | <div {...rest}>{children}</div> |
| 50 | </div> |
| 51 | ); |
| 52 | } |
| 53 | |