support render tab footer

This commit is contained in:
SrGooglo 2023-07-12 17:14:38 +00:00
parent 9dce36f588
commit 28d5478875

View File

@ -76,7 +76,9 @@ export default class SettingTab extends React.Component {
if (this.props.withGroups) { if (this.props.withGroups) {
const group = composeGroupsFromSettingsTab(this.tab.settings) const group = composeGroupsFromSettingsTab(this.tab.settings)
return Object.entries(group).map(([groupKey, settings], index) => { return <>
{
Object.entries(group).map(([groupKey, settings], index) => {
const fromDecoratorIcon = groupsDecorators[groupKey]?.icon const fromDecoratorIcon = groupsDecorators[groupKey]?.icon
const fromDecoratorTitle = groupsDecorators[groupKey]?.title const fromDecoratorTitle = groupsDecorators[groupKey]?.title
@ -106,7 +108,17 @@ export default class SettingTab extends React.Component {
}) })
} }
return this.tab.settings.map((setting, index) => { {
this.tab.footer && React.createElement(this.tab.footer, {
ctx: this.state.processedCtx
})
}
</>
}
return <>
{
this.tab.settings.map((setting, index) => {
return <SettingItemComponent return <SettingItemComponent
key={index} key={index}
setting={setting} setting={setting}
@ -114,4 +126,12 @@ export default class SettingTab extends React.Component {
/> />
}) })
} }
{
this.tab.footer && React.createElement(this.tab.footer, {
ctx: this.state.processedCtx
})
}
</>
}
} }