mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-24 03:16:43 +02:00
optimize settings store
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { memo } from 'react';
|
||||
|
||||
import { Group } from '/@/shared/components/group/group';
|
||||
import { Icon } from '/@/shared/components/icon/icon';
|
||||
@@ -13,38 +13,40 @@ interface SettingsOptionProps {
|
||||
title: React.ReactNode | string;
|
||||
}
|
||||
|
||||
export const SettingsOptions = ({ control, description, note, title }: SettingsOptionProps) => {
|
||||
return (
|
||||
<>
|
||||
<Group justify="space-between" style={{ alignItems: 'center' }} wrap="nowrap">
|
||||
<Stack
|
||||
gap="xs"
|
||||
style={{
|
||||
alignSelf: 'flex-start',
|
||||
display: 'flex',
|
||||
maxWidth: '50%',
|
||||
}}
|
||||
>
|
||||
<Group>
|
||||
<Text isNoSelect size="md">
|
||||
{title}
|
||||
</Text>
|
||||
{note && (
|
||||
<Tooltip label={note} openDelay={0}>
|
||||
<Icon icon="info" />
|
||||
</Tooltip>
|
||||
export const SettingsOptions = memo(
|
||||
({ control, description, note, title }: SettingsOptionProps) => {
|
||||
return (
|
||||
<>
|
||||
<Group justify="space-between" style={{ alignItems: 'center' }} wrap="nowrap">
|
||||
<Stack
|
||||
gap="xs"
|
||||
style={{
|
||||
alignSelf: 'flex-start',
|
||||
display: 'flex',
|
||||
maxWidth: '50%',
|
||||
}}
|
||||
>
|
||||
<Group>
|
||||
<Text isNoSelect size="md">
|
||||
{title}
|
||||
</Text>
|
||||
{note && (
|
||||
<Tooltip label={note} openDelay={0}>
|
||||
<Icon icon="info" />
|
||||
</Tooltip>
|
||||
)}
|
||||
</Group>
|
||||
{React.isValidElement(description) ? (
|
||||
description
|
||||
) : (
|
||||
<Text isMuted isNoSelect size="sm">
|
||||
{description}
|
||||
</Text>
|
||||
)}
|
||||
</Group>
|
||||
{React.isValidElement(description) ? (
|
||||
description
|
||||
) : (
|
||||
<Text isMuted isNoSelect size="sm">
|
||||
{description}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
<Group justify="flex-end">{control}</Group>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
};
|
||||
</Stack>
|
||||
<Group justify="flex-end">{control}</Group>
|
||||
</Group>
|
||||
</>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user