From 05bc7477e774fb539fdbaa2f5a07754bea1208db Mon Sep 17 00:00:00 2001 From: "Planoetscher Daniel (Student Com20)" <daniel.planoetscher@stud-inf.unibz.it> Date: Sun, 11 Apr 2021 22:30:19 +0200 Subject: [PATCH] code refactoring --- client/src/components/ui/Project/project.scss | 2 -- client/src/components/ui/TextInput/index.tsx | 15 +++++---------- client/src/pages/Home/home.scss | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/client/src/components/ui/Project/project.scss b/client/src/components/ui/Project/project.scss index f3ff924..8814318 100644 --- a/client/src/components/ui/Project/project.scss +++ b/client/src/components/ui/Project/project.scss @@ -1,4 +1,3 @@ - @use 'styles/settings'as s; .project { @@ -80,4 +79,3 @@ line-height: 1.8; } } - diff --git a/client/src/components/ui/TextInput/index.tsx b/client/src/components/ui/TextInput/index.tsx index ee44fa0..1613beb 100644 --- a/client/src/components/ui/TextInput/index.tsx +++ b/client/src/components/ui/TextInput/index.tsx @@ -10,20 +10,15 @@ interface Props { export default function TextInput({ label, name, type }: Props) { type = type ? type : 'text'; - let field = ( - <input type={type} required name={name} id={name} /> - ); - - if (type === 'textarea') { - field = ( - <textarea name={name} id={name} required></textarea> - ) - } return ( <div className={'input-field' + (type === 'textarea' ? ' textarea' : '')}> <label htmlFor={name}>{label}</label> - {field} + { + type === 'textarea' ? + (<textarea name={name} id={name} required></textarea>) + : (<input type={type} required name={name} id={name} />) + } </div> ); } diff --git a/client/src/pages/Home/home.scss b/client/src/pages/Home/home.scss index e085d9c..a1681c5 100644 --- a/client/src/pages/Home/home.scss +++ b/client/src/pages/Home/home.scss @@ -469,4 +469,4 @@ footer { background: s.$accent; } } -} \ No newline at end of file +} -- GitLab