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

Use dynamic min-height for reading view container #1905

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ahmedriad1
Copy link
Collaborator

Summary

We currently specify a min-height for the reading view container to avoid CLS. However 100vh doesn't seem to fit shorter chapters. This PR takes a dynamic approach by taking the minimum of either the number of lines * 20vh or 100vh.

Screenshots

Before After
image image

@vercel
Copy link

vercel bot commented Jan 26, 2023

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

Name Status Preview Updated
quran-com ✅ Ready (Inspect) Visit Preview Jan 26, 2023 at 9:33PM (UTC)

@@ -91,6 +92,16 @@ const QuranReader = ({
QURAN_READER_OBSERVER_ID,
);

const lines = useMemo(
Copy link
Member

Choose a reason for hiding this comment

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

There is an issue with this is that:

  1. For ReadingView, the resource-intensive function of groupLinesByVerses will be executed at least twice. One time here and another inside src/components/QuranReader/ReadingView/Page.tsx.
  2. For TranslationView, this adds extra calculations and won't be used since QuranReader component is shared between both views.

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