2025-05-18 14:03:18 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
|
2025-06-24 00:04:36 -07:00
|
|
|
import { Group } from '/@/shared/components/group/group';
|
|
|
|
|
import { Icon } from '/@/shared/components/icon/icon';
|
|
|
|
|
import { Stack } from '/@/shared/components/stack/stack';
|
|
|
|
|
import { Text } from '/@/shared/components/text/text';
|
|
|
|
|
import { Tooltip } from '/@/shared/components/tooltip/tooltip';
|
2022-12-19 15:59:14 -08:00
|
|
|
|
|
|
|
|
interface SettingsOptionProps {
|
2023-07-01 19:10:05 -07:00
|
|
|
control: React.ReactNode;
|
|
|
|
|
description?: React.ReactNode | string;
|
|
|
|
|
note?: string;
|
|
|
|
|
title: React.ReactNode | string;
|
2022-12-19 15:59:14 -08:00
|
|
|
}
|
|
|
|
|
|
2025-05-18 14:03:18 -07:00
|
|
|
export const SettingsOptions = ({ control, description, note, title }: SettingsOptionProps) => {
|
2023-07-01 19:10:05 -07:00
|
|
|
return (
|
|
|
|
|
<>
|
2025-07-12 11:17:54 -07:00
|
|
|
<Group justify="space-between" style={{ alignItems: 'center' }} wrap="nowrap">
|
2023-07-01 19:10:05 -07:00
|
|
|
<Stack
|
2025-06-24 00:04:36 -07:00
|
|
|
gap="xs"
|
|
|
|
|
style={{
|
2023-07-01 19:10:05 -07:00
|
|
|
alignSelf: 'flex-start',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
maxWidth: '50%',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Group>
|
2025-07-12 11:17:54 -07:00
|
|
|
<Text isNoSelect size="md">
|
2023-07-01 19:10:05 -07:00
|
|
|
{title}
|
|
|
|
|
</Text>
|
|
|
|
|
{note && (
|
2025-07-12 11:17:54 -07:00
|
|
|
<Tooltip label={note} openDelay={0}>
|
2025-06-24 00:04:36 -07:00
|
|
|
<Icon icon="info" />
|
2023-07-01 19:10:05 -07:00
|
|
|
</Tooltip>
|
|
|
|
|
)}
|
|
|
|
|
</Group>
|
|
|
|
|
{React.isValidElement(description) ? (
|
|
|
|
|
description
|
|
|
|
|
) : (
|
2025-07-12 11:17:54 -07:00
|
|
|
<Text isMuted isNoSelect size="sm">
|
2023-07-01 19:10:05 -07:00
|
|
|
{description}
|
|
|
|
|
</Text>
|
|
|
|
|
)}
|
|
|
|
|
</Stack>
|
2025-06-24 00:04:36 -07:00
|
|
|
<Group justify="flex-end">{control}</Group>
|
2023-07-01 19:10:05 -07:00
|
|
|
</Group>
|
|
|
|
|
</>
|
|
|
|
|
);
|
2022-12-19 15:59:14 -08:00
|
|
|
};
|