aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2021-02-05 17:41:15 +0200
committerGravatar ks129 <[email protected]>2021-02-05 17:41:15 +0200
commit6c88ec320843b1cfa461539c77592251db7d06cb (patch)
tree3ba8a39e98bdf260004f5517f94dcb0bd2b6d8fd /src/components
parentUse border-color: transparent instead border: none (diff)
Toggle visibility instead returning null when no error should be shown
Diffstat (limited to 'src/components')
-rw-r--r--src/components/ErrorMessage.tsx17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/components/ErrorMessage.tsx b/src/components/ErrorMessage.tsx
index 982bdb9..3342434 100644
--- a/src/components/ErrorMessage.tsx
+++ b/src/components/ErrorMessage.tsx
@@ -7,17 +7,14 @@ interface ErrorMessageProps {
message: string
}
-const styles = css`
- color: ${colors.error};
- font-size: 1.15rem;
- line-height: 1.1rem;
- margin: 1rem 0 0;
-`;
-
export default function ErrorMessage(props: ErrorMessageProps): JSX.Element | null {
- if (!props.show) {
- return null;
- }
+ const styles = css`
+ color: ${colors.error};
+ font-size: 1.15rem;
+ line-height: 1.1rem;
+ margin: 1rem 0 0;
+ visibilty: ${props.show ? "visible" : "hidden"}
+ `;
return (
<p css={styles}>{props.message}</p>