diff --git a/src/components/ContextDropdown/index.tsx b/src/components/ContextDropdown/index.tsx index 621cb9c1..8eef4239 100644 --- a/src/components/ContextDropdown/index.tsx +++ b/src/components/ContextDropdown/index.tsx @@ -83,23 +83,27 @@ export function ContextDropdown({ renderTitle }: ContextDropdownProps) { transition={{ duration: animationDuration }} >
-
+
{currentIndex > 0 && ( - + )} {/* Animated title */} -
+
{ }) const ModalRenderer = ({ + className, closable = false, multiScreen = false, }: { closable?: boolean multiScreen?: boolean + className?: string }) => { const { openScreen, pushScreen } = useModal() - const addScreen = () => { + const addScreen = useCallback(() => { pushScreen({ id: faker.string.uuid(), title: faker.lorem.sentence({ min: 1, max: 3 }), component:
{faker.lorem.paragraph()}
, + closable, }) - } + }, [pushScreen, closable]) useEffect(() => { openScreen({ id: '1', + closable, title: 'Lorem ipsum dolor sit amet', component: (
@@ -84,7 +88,7 @@ const ModalRenderer = ({ return (
- +
) } @@ -118,3 +122,13 @@ export const MultiScreen: Story = { ) }, } + +export const CustomClassName: Story = { + render: () => { + return ( + + + + ) + }, +} diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index 0f6e912d..0efcb7f2 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -9,15 +9,13 @@ import { } from '@radix-ui/react-dialog' import { useModal } from '@/hooks/useModal' import { cn } from '@/lib/utils' -import { IconButton } from '@/components/IconButton' import { Icon } from '../Icon' export interface ModalProps { - closable?: boolean className?: string } -export const Modal = ({ closable = false, className }: ModalProps) => { +export const Modal = ({ className }: ModalProps) => { const { screens, currentIndex, isOpen, close } = useModal() const currentScreen = screens[currentIndex] @@ -25,33 +23,27 @@ export const Modal = ({ closable = false, className }: ModalProps) => { if (!isOpen) return null if (!currentScreen) return null + const closable = currentScreen.closable + return ( {closable && ( - - } - aria-label="Close modal" - className="absolute top-4 right-4 focus:ring-0 focus:outline-none focus-visible:ring-0" - /> + )} {currentScreen.title && ( - + {currentScreen.title} )} diff --git a/src/context/ModalContext.tsx b/src/context/ModalContext.tsx index 91b3ef16..5fdecb63 100644 --- a/src/context/ModalContext.tsx +++ b/src/context/ModalContext.tsx @@ -4,6 +4,7 @@ export type Screen = { id: string title: string component: ReactNode + closable?: boolean } type ModalContextType = {