lbry-desktop/ui/component/settingsRow/view.jsx

51 lines
1.6 KiB
React
Raw Normal View History

2021-08-05 10:42:37 +02:00
// @flow
import React from 'react';
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.
disabled?: boolean,
highlighted?: boolean,
membersOnly?: boolean,
2021-08-05 10:42:37 +02:00
children?: React$Node,
};
export default function SettingsRow(props: Props) {
const { title, subtitle, multirow, useVerticalSeparator, disabled, highlighted, membersOnly, children } = props;
2021-08-05 10:42:37 +02:00
return (
<div
className={classnames('card__main-actions settings-row', {
2021-08-05 10:42:37 +02:00
'section__actions--between': !multirow,
'opacity-40': disabled,
'card--highlightedActive': highlighted,
2021-08-05 10:42:37 +02:00
})}
>
<div className="settings-row__title">
<span>
{title}
{membersOnly && (
<Button className="settings-row__members-only" navigate={`/$/${PAGES.ODYSEE_MEMBERSHIP}`}>
{'PREMIUM'}
</Button>
)}
</span>
{subtitle && <p className="settings-row__subtitle">{subtitle}</p>}
2021-08-05 10:42:37 +02:00
</div>
<div
className={classnames('settings-row__value', {
'settings-row__value--multirow': multirow,
'settings-row__vertical-separator': useVerticalSeparator,
'content__non-clickable': disabled,
2021-08-05 10:42:37 +02:00
})}
>
{children && children}
</div>
</div>
);
}