Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create a reuseable dialog component #181

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions app/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { cn } from "../../lib/utils/cn";

type DialogProperties = {
headerText: string;
description?: string;
footer: React.ReactNode[];
};
const Dialog = ({ headerText, description, footer }: DialogProperties) => {
return (
<div className="flex flex-col p-6 gap-4 bg-white rounded-[6px] max-w-[512px] w-auto">
<header className="flex flex-col gap-2">
<h2 className="text-lg font-semibold text-primary">{headerText}</h2>
{description && (
<p className="font-normal text-sm leading-[1.05rem] text-muted-foreground text-pretty">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you creating your own dialog? Weren't you told to use ShadCN dialog component?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the issue requirements, I wasn't asked to use Shadcn-UI.

The Shadcn-UI Dialog component requires a close icon to close the dialog and a trigger button to display it, but these were not mentioned in the requirements and also not in the figma file.

I have attached the figma link for the component in the PR description for your reference.

Should I still go ahead and implement them anyway?

Copy link
Contributor

Choose a reason for hiding this comment

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

Meet @SirhmVFX on slack to install it. he's @fullstackmechanic on slack

{description}
</p>
)}
</header>
<footer className=" flex flex-row w-full justify-end gap-2">
{footer.map((item, index) => (
<div key={index} className={cn("font-normal text-sm text-[#0F172A]")}>
{item}
</div>
))}
</footer>
</div>
);
};
export default Dialog;
2 changes: 1 addition & 1 deletion app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MetaFunction } from "@remix-run/node";
import { Button } from "~/components/ui/button";
import { Button } from "../components/ui/button";

export const meta: MetaFunction = () => {
return [
Expand Down
Loading