From bf00f3e302da0221b6507b7588fd01da58be9bae Mon Sep 17 00:00:00 2001 From: Mo Gusbi Date: Fri, 17 Feb 2023 00:58:45 +0000 Subject: [PATCH] feat: avatar component --- .../project-tailwind/src/components/Alert.tsx | 14 +++++++++- .../src/components/Avatar.tsx | 23 ++++++++++++++++ .../project-tailwind/src/components/Logo.tsx | 4 +-- .../src/components/__tests__/Avatar.test.tsx | 27 +++++++++++++++++++ .../__snapshots__/Avatar.test.tsx.snap | 21 +++++++++++++++ .../__snapshots__/Logo.test.tsx.snap | 2 +- packages/project-tailwind/src/index.ts | 2 ++ .../src/stories/Avatar.stories.tsx | 17 ++++++++++++ 8 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 packages/project-tailwind/src/components/Avatar.tsx create mode 100644 packages/project-tailwind/src/components/__tests__/Avatar.test.tsx create mode 100644 packages/project-tailwind/src/components/__tests__/__snapshots__/Avatar.test.tsx.snap create mode 100644 packages/project-tailwind/src/stories/Avatar.stories.tsx diff --git a/packages/project-tailwind/src/components/Alert.tsx b/packages/project-tailwind/src/components/Alert.tsx index ecd3c871e..c0dd0221e 100644 --- a/packages/project-tailwind/src/components/Alert.tsx +++ b/packages/project-tailwind/src/components/Alert.tsx @@ -1,6 +1,13 @@ import { Transition } from '@headlessui/react'; import { XMarkIcon } from '@heroicons/react/24/solid'; -import { Fragment, ReactNode, useCallback, useEffect, useState } from 'react'; +import { + Fragment, + ReactNode, + Ref, + useCallback, + useEffect, + useState, +} from 'react'; import { Sizing, Themes, @@ -11,6 +18,9 @@ import { /** Alert component properties */ export interface IAlertProps { + /** Dismiss button reference */ + buttonRef?: Ref; + /** Sets whether alert can be dismissed or a timer, in milliseconds, to automatically dismiss */ dismissable?: boolean | number; @@ -45,6 +55,7 @@ const DISMISS_TEXT = 'Dismiss'; */ export function Alert(props: IAlertProps) { const { + buttonRef, dismissable = false, dismissText = DISMISS_TEXT, icon, @@ -167,6 +178,7 @@ export function Alert(props: IAlertProps) { {dismissable && (