addons/isl/src/DropdownFields.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import {Divider} from 'isl-components/Divider';
b69ab319import {Icon} from 'isl-components/Icon';
b69ab3110
b69ab3111import './DropdownFields.css';
b69ab3112
b69ab3113export function DropdownFields({
b69ab3114 title,
b69ab3115 icon,
b69ab3116 children,
b69ab3117 className,
b69ab3118 ...rest
b69ab3119}: {
b69ab3120 title: React.ReactNode;
b69ab3121 icon: string;
b69ab3122 children: React.ReactNode;
b69ab3123 'data-testid'?: string;
b69ab3124 className?: string;
b69ab3125}) {
b69ab3126 return (
b69ab3127 <div className={'dropdown-fields' + (className != null ? ` ${className}` : '')} {...rest}>
b69ab3128 <div className="dropdown-fields-header">
b69ab3129 <Icon icon={icon} size="M" />
b69ab3130 <strong role="heading">{title}</strong>
b69ab3131 </div>
b69ab3132 <Divider />
b69ab3133 <div className="dropdown-fields-content">{children}</div>
b69ab3134 </div>
b69ab3135 );
b69ab3136}
b69ab3137
b69ab3138export function DropdownField({
b69ab3139 title,
b69ab3140 children,
b69ab3141 ...rest
b69ab3142}: {
b69ab3143 title: React.ReactNode;
b69ab3144 children: React.ReactNode;
b69ab3145} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'title'>) {
b69ab3146 return (
b69ab3147 <div className="dropdown-field">
b69ab3148 <strong>{title}</strong>
b69ab3149 <div {...rest}>{children}</div>
b69ab3150 </div>
b69ab3151 );
b69ab3152}