Skip to content

Commit

Permalink
Add Dialog to components (#185)
Browse files Browse the repository at this point in the history
* Add Dialog to components

* Add option to showOverlay
  • Loading branch information
vineethasok authored Oct 22, 2023
1 parent cfd54fa commit 2a21226
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from "react";
import { ReactNode } from "react";
import * as RadixDialog from "@radix-ui/react-dialog";
import styled, { keyframes } from "styled-components";
import { Button, Icon, Spacer, Title } from "@/components";
Expand All @@ -16,11 +16,7 @@ const Trigger = styled(RadixDialog.Trigger)`
cursor: pointer;
`;

interface DialogTriggerProps extends RadixDialog.DialogTriggerProps {
children: React.ReactNode;
}

const DialogTrigger = ({ children, ...props }: DialogTriggerProps) => {
const DialogTrigger = ({ children, ...props }: RadixDialog.DialogTriggerProps) => {
return <Trigger {...props}>{children}</Trigger>;
};

Expand Down Expand Up @@ -100,13 +96,14 @@ const CloseButton = ({ onClose }: { onClose?: () => void }) => (
</RadixDialog.Close>
);

interface DialogContentProps extends RadixDialog.DialogContentProps {
export interface DialogContentProps extends RadixDialog.DialogContentProps {
title: string;
showClose?: boolean;
forceMount?: true;
container?: HTMLElement | null;
children: ReactNode;
onClose?: () => void;
showOverlay?: boolean;
}

const DialogContent = ({
Expand All @@ -116,13 +113,14 @@ const DialogContent = ({
onClose,
forceMount,
container,
showOverlay = true,
}: DialogContentProps) => {
return (
<RadixDialog.Portal
forceMount={forceMount}
container={container}
>
<DialogOverlay />
{showOverlay && <DialogOverlay />}
<ContentArea>
<TitleArea>
<Title
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export { CardSecondary } from "./CardSecondary/CardSecondary";
export { CardPrimary } from "./CardPrimary/CardPrimary";
export { Checkbox } from "./Checkbox/Checkbox";
export { CodeBlock } from "./CodeBlock/CodeBlock";
export { Dialog } from "./Dialog/Dialog";
export { EllipsisContent } from "./EllipsisContent/EllipsisContent";
export { Flyout } from "./Flyout/Flyout";
export { InlineCodeBlock } from "./CodeBlock/InlineCodeBlock";
Expand Down
2 changes: 2 additions & 0 deletions src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export type { SelectOptionListItem } from "./Select/common/types";
export type { MultiSelectProps } from "./Select/MultiSelect";
export type { PanelProps } from "./Panel/Panel";
export type { FlyoutProps, FlyoutFooterProps, FlyoutHeaderProps } from "./Flyout/Flyout";
export type { DialogContentProps } from "./Dialog/Dialog";
export type { DialogProps, DialogTriggerProps } from "@radix-ui/react-dialog";

export type States = "default" | "active" | "disabled" | "error" | "hover";
export type HorizontalDirection = "start" | "end";
Expand Down

1 comment on commit 2a21226

@vercel
Copy link

@vercel vercel bot commented on 2a21226 Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

click-ui – ./

click-ui.vercel.app
click-ui-clickhouse.vercel.app
click-ui-git-main-clickhouse.vercel.app

Please sign in to comment.