Skip to content

Commit

Permalink
feat: add design system for Modal (#5206)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint authored Aug 5, 2024
2 parents 0f627a0 + ef2f8a0 commit e989b15
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
72 changes: 72 additions & 0 deletions apps/web/src/components/Design/ModalDesign.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { ShoppingBagIcon } from '@heroicons/react/24/outline';
import { Button, Card, CardHeader, Modal } from '@hey/ui';
import { type FC, useState } from 'react';

const ModalDesign: FC = () => {
const [showXsModal, setShowXsModal] = useState(false);
const [showSmModal, setShowSmModal] = useState(false);
const [showMdModal, setShowMdModal] = useState(false);
const [showLgModal, setShowLgModal] = useState(false);

const children = (
<div className="p-5">The quick brown fox jumps over the lazy dog.</div>
);

return (
<Card>
<CardHeader title="Modals" />
<Modal
icon={<ShoppingBagIcon className="size-5" />}
onClose={() => setShowXsModal(false)}
show={showXsModal}
size="xs"
title="Extra small modal"
>
{children}
</Modal>
<Modal
icon={<ShoppingBagIcon className="size-5" />}
onClose={() => setShowSmModal(false)}
show={showSmModal}
size="sm"
title="Small modal"
>
{children}
</Modal>
<Modal
icon={<ShoppingBagIcon className="size-5" />}
onClose={() => setShowMdModal(false)}
show={showMdModal}
size="md"
title="Medium modal"
>
{children}
</Modal>
<Modal
icon={<ShoppingBagIcon className="size-5" />}
onClose={() => setShowLgModal(false)}
show={showLgModal}
size="lg"
title="Large modal"
>
{children}
</Modal>
<div className="m-5 flex gap-5">
<Button onClick={() => setShowXsModal(true)} outline>
Show extra small modal
</Button>
<Button onClick={() => setShowSmModal(true)} outline>
Show small modal
</Button>
<Button onClick={() => setShowMdModal(true)} outline>
Show medium modal
</Button>
<Button onClick={() => setShowLgModal(true)} outline>
Show large modal
</Button>
</div>
</Card>
);
};

export default ModalDesign;
2 changes: 2 additions & 0 deletions apps/web/src/components/Design/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { GridItemTwelve } from '@hey/ui/src/GridLayout';

import AlertDesign from './AlertDesign';
import ButtonsDesign from './ButtonsDesign';
import ModalDesign from './ModalDesign';
import ProfilesDesign from './ProfilesDesign';
import TypographyDesign from './TypographyDesign';

Expand All @@ -15,6 +16,7 @@ const Design: NextPage = () => {
<TypographyDesign />
<ButtonsDesign />
<AlertDesign />
<ModalDesign />
<ProfilesDesign />
</GridItemTwelve>
</GridLayout>
Expand Down

1 comment on commit e989b15

@vercel
Copy link

@vercel vercel bot commented on e989b15 Aug 5, 2024

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:

web – ./

web-git-main-heyxyz.vercel.app
heyxyz.vercel.app
hey.xyz
web-heyxyz.vercel.app

Please sign in to comment.