From 6972f593e29ba3ff57615eb33abe79503b67ce6a Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 25 Sep 2023 14:13:46 +0300 Subject: [PATCH] refactor: make renderHelpButton a component (#51620) Co-authored-by: Oliver Eyton-Williams --- client/src/components/settings/internet.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/components/settings/internet.tsx b/client/src/components/settings/internet.tsx index 088b7e0484b..cfb970f90a9 100644 --- a/client/src/components/settings/internet.tsx +++ b/client/src/components/settings/internet.tsx @@ -34,6 +34,10 @@ type InternetState = { originalValues: Socials; }; +function Info({ message }: { message: string }) { + return message ? {message} : null; +} + class InternetSettings extends Component { static displayName: string; constructor(props: InternetProps) { @@ -148,9 +152,6 @@ class InternetSettings extends Component { return null; }; - renderHelpBlock = (validationMessage: string) => - validationMessage ? {validationMessage} : null; - renderCheck = (url: string, validation: string | null) => url && validation === 'success' ? ( @@ -198,7 +199,7 @@ class InternetSettings extends Component { value={githubProfile} /> {this.renderCheck(githubProfile, githubProfileValidation)} - {this.renderHelpBlock(githubProfileValidationMessage)} + { value={linkedin} /> {this.renderCheck(linkedin, linkedinValidation)} - {this.renderHelpBlock(linkedinValidationMessage)} + { value={twitter} /> {this.renderCheck(twitter, twitterValidation)} - {this.renderHelpBlock(twitterValidationMessage)} + { value={website} /> {this.renderCheck(website, websiteValidation)} - {this.renderHelpBlock(websiteValidationMessage)} +