The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/components/admin/settings/Section.js

34 lines
1.0 KiB

import { Accordion, Button, FieldGroup, Paragraph } from '@rocket.chat/fuselage';
import React from 'react';
import { useTranslation } from '../../providers/TranslationProvider';
import { Setting } from './Setting';
import { useSection } from './SettingsState';
export function Section({ children, groupId, hasReset = true, help, sectionName, solo }) {
const section = useSection(groupId, sectionName);
const t = useTranslation();
const handleResetSectionClick = () => {
section.reset();
};
return <Accordion.Item noncollapsible={solo || !section.name} title={section.name && t(section.name)}>
{help && <Paragraph hintColor>{help}</Paragraph>}
<FieldGroup>
{section.settings.map((settingId) => <Setting key={settingId} settingId={settingId} />)}
{hasReset && section.canReset && <Button
children={t('Reset_section_settings')}
className='reset-group'
danger
data-section={section.name}
ghost
onClick={handleResetSectionClick}
/>}
{children}
</FieldGroup>
</Accordion.Item>;
}