2021-08-05 10:42:37 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2022-03-18 08:43:11 +01:00
|
|
|
import Button from 'component/button';
|
|
|
|
import * as PAGES from 'constants/pages';
|
2021-08-05 10:42:37 +02:00
|
|
|
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,
|
2022-03-17 01:22:48 +01:00
|
|
|
membersOnly?: boolean,
|
2021-08-05 10:42:37 +02:00
|
|
|
children?: React$Node,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function SettingsRow(props: Props) {
|
2022-03-17 01:22:48 +01:00
|
|
|
const { title, subtitle, multirow, useVerticalSeparator, disabled, highlighted, membersOnly, children } = props;
|
2021-08-05 10:42:37 +02:00
|
|
|
return (
|
|
|
|
<div
|
2022-03-16 17:32:59 +01:00
|
|
|
className={classnames('card__main-actions settings-row', {
|
2021-08-05 10:42:37 +02:00
|
|
|
'section__actions--between': !multirow,
|
2022-03-22 02:55:18 +01:00
|
|
|
'opacity-40': disabled,
|
2022-02-25 11:34:53 +01:00
|
|
|
'card--highlightedActive': highlighted,
|
2021-08-05 10:42:37 +02:00
|
|
|
})}
|
|
|
|
>
|
2022-03-16 17:32:59 +01:00
|
|
|
<div className="settings-row__title">
|
2022-03-17 01:22:48 +01:00
|
|
|
<span>
|
|
|
|
{title}
|
2022-03-18 08:43:11 +01:00
|
|
|
{membersOnly && (
|
|
|
|
<Button className="settings-row__members-only" navigate={`/$/${PAGES.ODYSEE_MEMBERSHIP}`}>
|
|
|
|
{'PREMIUM'}
|
|
|
|
</Button>
|
|
|
|
)}
|
2022-03-17 01:22:48 +01:00
|
|
|
</span>
|
2022-03-16 17:32:59 +01:00
|
|
|
{subtitle && <p className="settings-row__subtitle">{subtitle}</p>}
|
2021-08-05 10:42:37 +02:00
|
|
|
</div>
|
|
|
|
<div
|
2022-03-16 17:32:59 +01:00
|
|
|
className={classnames('settings-row__value', {
|
|
|
|
'settings-row__value--multirow': multirow,
|
|
|
|
'settings-row__vertical-separator': useVerticalSeparator,
|
2022-04-05 08:48:02 +02:00
|
|
|
'non-clickable': disabled,
|
2021-08-05 10:42:37 +02:00
|
|
|
})}
|
|
|
|
>
|
|
|
|
{children && children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|