signal-desktop/ts/components/conversation/conversation-details/PanelSection.tsx

40 lines
960 B
TypeScript
Raw Normal View History

// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import classNames from 'classnames';
import { bemGenerator } from './util';
export type Props = {
actions?: React.ReactNode;
2022-11-18 00:45:19 +00:00
children?: React.ReactNode;
borderless?: boolean;
centerTitle?: boolean;
title?: string;
};
const bem = bemGenerator('ConversationDetails-panel-section');
const borderlessClass = bem('root', 'borderless');
2022-11-18 00:45:19 +00:00
export function PanelSection({
actions,
borderless,
centerTitle,
children,
title,
2022-11-18 00:45:19 +00:00
}: Props): JSX.Element {
return (
<div
className={classNames(bem('root'), borderless ? borderlessClass : null)}
>
{(title || actions) && (
<div className={bem('header', { center: centerTitle || false })}>
{title && <div className={bem('title')}>{title}</div>}
{actions && <div>{actions}</div>}
</div>
)}
<div>{children}</div>
</div>
);
}