B OpenNebula/one#7136: Refactor InternalWrapper to assign styles according to necessity (#3753)

Signed-off-by: Miguel E. Ruiz <mruiz@opennebula.io>
This commit is contained in:
Miguel E. Ruiz authored and GitHub committed 2025-08-06 12:57:26 +02:00
1 parent 29a294df39
commit d42bb97b8e
2 files changed
+22 -9

No files matched your search

@@ -52,6 +52,9 @@ const style = () => ({
justifyContent: 'space-between',
width: '100%',
}),
internalLegend: css({
marginTop: '9px',
}),
})
/**
@@ -130,16 +133,28 @@ const Settings = () => {
{!isLoading && (
<Box className={classes.content}>
<FormProvider {...methods}>
<InternalWrapper title={T.ThemeMode}>
<InternalWrapper
title={T.ThemeMode}
innerClassName={classes.internalLegend}
>
<FormWithSchema cy={'settings-ui'} fields={FIELDS_THEME} />
</InternalWrapper>
<InternalWrapper title={T.DataTablesStyles}>
<InternalWrapper
title={T.DataTablesStyles}
innerClassName={classes.internalLegend}
>
<FormWithSchema cy={'settings-ui'} fields={FIELDS_DATATABLE} />
</InternalWrapper>
<InternalWrapper title={T.Animations}>
<InternalWrapper
title={T.Animations}
innerClassName={classes.internalLegend}
>
<FormWithSchema cy={'settings-ui'} fields={FIELDS_ANIMATIONS} />
</InternalWrapper>
<InternalWrapper title={T.Others}>
<InternalWrapper
title={T.Others}
innerClassName={classes.internalLegend}
>
<FormWithSchema
cy={'settings-ui'}
fields={FIELDS_OTHERS({ views, userView, zones })}
@@ -35,9 +35,6 @@ const styles = ({ typography }) => ({
marginBottom: typography.pxToRem(24),
display: 'inline-table',
}),
internalLegend: css({
borderBottom: 0,
}),
internalWrapper: css({
display: 'grid',
gridTemplateColumns: '140px 1fr',
@@ -70,12 +67,12 @@ const Wrapper = ({ children }) => {
title: PropTypes.string,
}
const InternalWrapper = ({ children, title = '' }) => (
const InternalWrapper = ({ children, title = '', innerClassName }) => (
<Box
className={classes.internalWrapper}
gridTemplateColumns={{ sm: '1fr' }}
>
<Typography className={classes.internalLegend} component="legend">
<Typography className={innerClassName} component="legend">
<Translate word={title} />
</Typography>
<Box>{children}</Box>
@@ -84,6 +81,7 @@ const Wrapper = ({ children }) => {
InternalWrapper.propTypes = {
children: PropTypes.node,
title: PropTypes.string,
innerClassName: PropTypes.string,
}
return (