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 TopReaderBadgeModal #3740

Merged
merged 11 commits into from
Nov 1, 2024
Merged

feat: create TopReaderBadgeModal #3740

merged 11 commits into from
Nov 1, 2024

Conversation

omBratteng
Copy link
Member

@omBratteng omBratteng commented Oct 31, 2024

Changes

Depends on dailydotdev/daily-api#2376

TODO:

  • Download image

Events

Did you introduce any new tracking events?

https://docs.google.com/spreadsheets/d/18Lv7zXges9QfVX5VYL1a-Hyl0e1sQ3sLr0OK8YZWKXI/edit?gid=1801144038#gid=1801144038

Experiment

Did you introduce any new experiments?

Manual Testing

Caution

Please make sure existing components are not breaking/affected by this PR

AS-662

Preview domain

https://as-662-top-reader-modal.preview.app.daily.dev

Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Nov 1, 2024 11:37am
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Nov 1, 2024 11:37am

Copy link
Contributor

@rebelchris rebelchris left a comment

Choose a reason for hiding this comment

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

Minor questions

Download badge
</Button>

{!isMobile && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this specific condition, the modals have their generic use-case for mobile/desktop buttons already right?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the design, the close button is at the bottom. Usually they're a X button at the top right. And when it's on mobile, it already comes with close button on the drawer, so I need to hide it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can set displayCloseButton: false on drawerProps and then always render this button instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

diff --git a/packages/shared/src/components/modals/badges/TopReaderBadgeModal.tsx b/packages/shared/src/components/modals/badges/TopReaderBadgeModal.tsx
index e535994f..578d9a7d 100644
--- a/packages/shared/src/components/modals/badges/TopReaderBadgeModal.tsx
+++ b/packages/shared/src/components/modals/badges/TopReaderBadgeModal.tsx
@@ -86,6 +86,9 @@ const TopReaderBadgeModal = (
       isDrawerOnMobile
       onAfterClose={() => onAfterClose(topReaderBadge.keyword.value)}
       onAfterOpen={() => onAfterOpen(topReaderBadge.keyword.value)}
+      drawerProps={{
+        displayCloseButton: false,
+      }}
     >
       <Modal.Body className="flex flex-col items-center justify-center gap-4 text-center">
         <h1 className="font-bold typo-title1">
@@ -108,15 +111,13 @@ const TopReaderBadgeModal = (
           Download badge
         </Button>
 
-        {!isMobile && (
-          <Button
-            className="w-full max-w-80"
-            variant={ButtonVariant.Float}
-            onClick={onRequestClose}
-          >
-            Close
-          </Button>
-        )}
+        <Button
+          className={classNames('w-full', !isMobile && 'max-w-80')}
+          variant={ButtonVariant.Float}
+          onClick={onRequestClose}
+        >
+          Close
+        </Button>
       </Modal.Body>
     </Modal>
   );

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah guess it's easier in case they change copy or something silly 🤪

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to hide drawer button and use inline button instead.

@omBratteng omBratteng merged commit ccad5fd into AS-510 Nov 1, 2024
9 checks passed
@omBratteng omBratteng deleted the AS-662-top-reader-modal branch November 1, 2024 11:39
omBratteng added a commit that referenced this pull request Nov 1, 2024
omBratteng added a commit that referenced this pull request Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants