Skip to content

Commit

Permalink
Fix/Displaying emoji picker modal (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryczko authored May 10, 2023
1 parent b339d06 commit e783f9d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
31 changes: 23 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"start:emulator": "firebase emulators:exec 'npm start'"
},
"dependencies": {
"@headlessui/react": "^1.6.2",
"@headlessui/react": "^1.7.14",
"@heroicons/react": "^1.0.6",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/features/surveys/components/EmojiPicker/EmojiPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function EmojiPicker({
<StyledDialog
onClose={() => setDisplayPicker(false)}
isOpen={displayPicker}
contentClassName="w-[400px] p-0"
content={
<Picker
onEmojiClick={!addEmoji ? onEmojiClick : onEmojiClickAdd}
Expand Down Expand Up @@ -113,7 +114,7 @@ function EmojiPicker({
name: 'Flags',
},
]}
width={400}
width={'100%'}
height={400}
/>
}
Expand Down
10 changes: 9 additions & 1 deletion src/shared/components/StyledDialog/StyledDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { Fragment } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import clsx from 'clsx';

interface StyledDialogProps {
title?: string;
content: React.ReactNode;
isOpen: boolean;
onClose: () => void;
contentClassName?: string;
}

export default function StyledDialog({
title = '',
content,
isOpen,
onClose,
contentClassName = '',
}: StyledDialogProps) {
return (
<Transition appear show={isOpen} as={Fragment}>
Expand Down Expand Up @@ -40,7 +43,12 @@ export default function StyledDialog({
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="flex w-auto max-w-md flex-col justify-center overflow-hidden rounded-md bg-white p-6 text-left shadow-xl transition-all">
<Dialog.Panel
className={clsx(
'flex w-auto max-w-md flex-col justify-center overflow-hidden rounded-md bg-white p-6 text-left shadow-xl transition-all',
contentClassName
)}
>
<Dialog.Title
as="h3"
className="text-lg font-medium leading-6 text-zinc-900"
Expand Down

0 comments on commit e783f9d

Please sign in to comment.