From a724b4b38bacc631410627395b0d1190a0e8de0d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 4 Oct 2023 18:16:55 +0200
Subject: feat(components): add a VisuallyHidden component

---
 .../atoms/visually-hidden/visually-hidden.tsx      | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 src/components/atoms/visually-hidden/visually-hidden.tsx

(limited to 'src/components/atoms/visually-hidden/visually-hidden.tsx')

diff --git a/src/components/atoms/visually-hidden/visually-hidden.tsx b/src/components/atoms/visually-hidden/visually-hidden.tsx
new file mode 100644
index 0000000..a877321
--- /dev/null
+++ b/src/components/atoms/visually-hidden/visually-hidden.tsx
@@ -0,0 +1,26 @@
+import type { FC, HTMLAttributes, ReactNode } from 'react';
+import styles from './visually-hidden.module.scss';
+
+export type VisuallyHiddenProps = Omit<
+  HTMLAttributes<HTMLSpanElement>,
+  'children'
+> & {
+  /**
+   * The contents to visually hide.
+   */
+  children: ReactNode;
+};
+
+export const VisuallyHidden: FC<VisuallyHiddenProps> = ({
+  children,
+  className = '',
+  ...props
+}) => {
+  const wrapperClass = `${styles.wrapper} ${className}`;
+
+  return (
+    <span {...props} className={wrapperClass}>
+      {children}
+    </span>
+  );
+};
-- 
cgit v1.2.3

