2021-08-05 10:42:37 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
title: string,
|
|
|
|
subtitle?: string,
|
|
|
|
multirow?: boolean, // Displays the Value widget(s) below the Label instead of on the right.
|
|
|
|
useVerticalSeparator?: boolean, // Show a separator line between Label and Value. Useful when there are multiple Values.
|
2021-11-01 19:51:23 +01:00
|
|
|
disabled?: boolean,
|
2022-02-25 11:34:53 +01:00
|
|
|
highlighted?: boolean,
|
2021-08-05 10:42:37 +02:00
|
|
|
children?: React$Node,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function SettingsRow(props: Props) {
|
2022-02-25 11:34:53 +01:00
|
|
|
const { title, subtitle, multirow, useVerticalSeparator, disabled, highlighted, children } = props;
|
2021-08-05 10:42:37 +02:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={classnames('card__main-actions settings__row', {
|
|
|
|
'section__actions--between': !multirow,
|
2022-02-11 19:50:55 +01:00
|
|
|
'opacity-30': disabled,
|
2022-02-25 11:34:53 +01:00
|
|
|
'card--highlightedActive': highlighted,
|
2021-08-05 10:42:37 +02:00
|
|
|
})}
|
|
|
|
>
|
|
|
|
<div className="settings__row--title">
|
|
|
|
<p>{title}</p>
|
|
|
|
{subtitle && <p className="settings__row--subtitle">{subtitle}</p>}
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
className={classnames('settings__row--value', {
|
|
|
|
'settings__row--value--multirow': multirow,
|
|
|
|
'settings__row--value--vertical-separator': useVerticalSeparator,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
{children && children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|