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