aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ErrorMessage.tsx
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-02-19 11:32:16 +0300
committerGravatar GitHub <[email protected]>2021-02-19 11:32:16 +0300
commit010e08a633e3d83e25bc2f1518876fc8a22eab0e (patch)
treec015db3e245b75186568e3a8508fa3dd56969ab7 /src/components/ErrorMessage.tsx
parentMerge pull request #139 from python-discord/dependabot/npm_and_yarn/typescrip... (diff)
parentRemove TODO (diff)
Merge pull request #91 from python-discord/forms-submitting
Form submission validation and submitting
Diffstat (limited to 'src/components/ErrorMessage.tsx')
-rw-r--r--src/components/ErrorMessage.tsx24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/components/ErrorMessage.tsx b/src/components/ErrorMessage.tsx
new file mode 100644
index 0000000..650100d
--- /dev/null
+++ b/src/components/ErrorMessage.tsx
@@ -0,0 +1,24 @@
+/** @jsx jsx */
+import { jsx, css } from "@emotion/react";
+import colors from "../colors";
+
+interface ErrorMessageProps {
+ show: boolean,
+ message: string
+}
+
+export default function ErrorMessage(props: ErrorMessageProps): JSX.Element | null {
+ const styles = css`
+ color: ${colors.error};
+ font-size: 1.15rem;
+ line-height: 1.1rem;
+ margin: 1rem 0 0;
+ visibility: ${props.show ? "visible" : "hidden"};
+ position: absolute;
+ z-index: -1;
+ `;
+
+ return (
+ <p css={styles}>{props.message}</p>
+ );
+}