From cc29df30339e623a5c673f42aab467116702d1a4 Mon Sep 17 00:00:00 2001 From: Sboonny Date: Thu, 26 Jan 2023 18:03:57 +0000 Subject: [PATCH] refactor(client): clean extra FormGroup component in personal info --- client/src/components/helpers/grid.tsx | 23 ++++++ client/src/components/helpers/index.ts | 1 + client/src/components/settings/about.tsx | 89 ++++++++++++------------ 3 files changed, 67 insertions(+), 46 deletions(-) create mode 100644 client/src/components/helpers/grid.tsx diff --git a/client/src/components/helpers/grid.tsx b/client/src/components/helpers/grid.tsx new file mode 100644 index 00000000000..48d2e30dce9 --- /dev/null +++ b/client/src/components/helpers/grid.tsx @@ -0,0 +1,23 @@ +import React from 'react'; + +interface GridProps extends React.HTMLAttributes { + children: React.ReactNode; +} + +const GridStyle = { + display: 'grid', + gap: '15px', + marginBottom: '15px' +}; + +const Grid = ({ children, ...rest }: GridProps) => { + return ( +
+ {children} +
+ ); +}; + +Grid.displayName = 'Grid'; + +export default Grid; diff --git a/client/src/components/helpers/index.ts b/client/src/components/helpers/index.ts index d58dd56ae09..d85852dbfba 100644 --- a/client/src/components/helpers/index.ts +++ b/client/src/components/helpers/index.ts @@ -1,5 +1,6 @@ export { default as ButtonSpacer } from './button-spacer'; export { default as FullWidthRow } from './full-width-row'; +export { default as Grid } from './grid'; export { default as SlimWidthRow } from './slim-width-row'; export { default as Loader } from './loader'; export { default as SkeletonSprite } from './skeleton-sprite'; diff --git a/client/src/components/settings/about.tsx b/client/src/components/settings/about.tsx index 4b3f1aa8d16..73089c8887f 100644 --- a/client/src/components/settings/about.tsx +++ b/client/src/components/settings/about.tsx @@ -1,5 +1,4 @@ import { - FormGroup, ControlLabel, FormControl, HelpBlock, @@ -9,7 +8,7 @@ import React, { Component } from 'react'; import { TFunction, withTranslation } from 'react-i18next'; import isURL from 'validator/lib/isURL'; -import { FullWidthRow, Spacer } from '../helpers'; +import { FullWidthRow, Grid, Spacer } from '../helpers'; import BlockSaveButton from '../helpers/form/block-save-button'; import SoundSettings from './sound'; import ThemeSettings, { Themes } from './theme'; @@ -79,7 +78,6 @@ class AboutSettings extends Component { picture === formValues.picture && about === formValues.about ) { - // eslint-disable-next-line react/no-did-update-set-state return this.setState({ originalValues: { name, @@ -216,49 +214,48 @@ class AboutSettings extends Component { {t('settings.headings.personal-info')}
-
- - - {t('settings.labels.name')} - - - - - - {t('settings.labels.location')} - - - - - - {t('settings.labels.picture')} - - - {this.showImageValidationWarning()} - - - - {t('settings.labels.about')} - - - -
+ + + {t('settings.labels.name')} + + + + {t('settings.labels.location')} + + + + {t('settings.labels.picture')} + + + {this.showImageValidationWarning()} + + {t('settings.labels.about')} + + + {t('buttons.save')}{' '}