Skip to content

YPE-2573 - Center Bible card content#243

Open
cameronapak wants to merge 5 commits into
mainfrom
codex/ype-2573-card-content-width
Open

YPE-2573 - Center Bible card content#243
cameronapak wants to merge 5 commits into
mainfrom
codex/ype-2573-card-content-width

Conversation

@cameronapak
Copy link
Copy Markdown
Collaborator

@cameronapak cameronapak commented May 21, 2026

Summary

  • remove fixed max-width behavior from BibleCard while centering its 600px content group
  • apply the same centered content treatment to VerseOfTheDay
  • add Storybook wide-container coverage and align default stories with full-width usage

Ticket

https://lifechurch.atlassian.net/browse/YPE-2573

BibleCard centered content group VerseOfTheDay centered content group

Test plan

  • pnpm --filter @youversion/platform-react-ui test -- bible-card.test.tsx verse-of-the-day.test.tsx
  • pnpm --filter @youversion/platform-react-ui test:integration -- bible-card.stories.tsx
  • pnpm --filter @youversion/platform-react-ui test:integration -- bible-card.stories.tsx verse-of-the-day.stories.tsx

Greptile Summary

This PR removes the fixed max-w-md constraint from BibleCard and VerseOfTheDay, allowing both components to fill their container at full width while keeping content readable by centering it at a 600px max-width via a new card-content Tailwind utility. The [data-slot='yv-bible-renderer'] CSS now accepts a --yv-reader-max-width custom property (defaulting to 65ch) so standalone BibleTextView consumers retain their readability constraint.

  • global.css: Adds @utility card-content (width: 100%; max-width: 600px; margin-inline: auto) and both components wrap their inner content in a div with this class.
  • bible-reader.css: Converts the hard-coded max-width: 65ch to var(--yv-reader-max-width, 65ch), preserving the default while enabling per-context overrides.
  • Stories / tests: Default stories switch to fullscreen layout; new WideContainer integration stories with play functions verify centering and width constraints in a 900 px container.

Confidence Score: 5/5

Safe to merge — changes are purely additive layout adjustments with no logic mutations.

The change replaces a fixed max-w-md cap with a centered 600px content wrapper, adds box-border to the outer section, and converts one hard-coded CSS max-width to a CSS custom property that defaults to the same value. All three layers — CSS utility, component JSX, and tests — are consistent with each other. The --yv-reader-max-width fallback preserves existing behaviour for standalone BibleTextView consumers. Integration stories exercise real browser geometry through play functions. No data-fetching paths, auth logic, or public API shapes are touched.

No files require special attention.

Important Files Changed

Filename Overview
packages/ui/src/styles/global.css Adds the new card-content Tailwind utility that centers content at 600 px; definition is clean and well-scoped.
packages/core/src/styles/bible-reader.css Converts hard-coded max-width: 65ch to a CSS custom property with the same default, preserving backward compatibility for standalone BibleTextView consumers.
packages/ui/src/components/bible-card.tsx Removes max-w-md, adds box-border, and wraps all card content in the new card-content div; refactor is clean with no functional regressions.
packages/ui/src/components/verse-of-the-day.tsx Mirrors the BibleCard treatment — drops max-w-md and gap-3 from the section, wraps inner content with card-content flex flex-col gap-3; gap behaviour is preserved.
packages/ui/src/components/bible-card.stories.tsx Adds a WideContainer integration story with a play function that verifies centering and width constraints in a 900 px viewport; assertions are sensible.
packages/ui/src/components/verse-of-the-day.stories.tsx Parallel WideContainer story added for VerseOfTheDay; same geometry assertions as the BibleCard story.
packages/ui/src/components/bible-card.test.tsx New unit test verifies class-level structural changes; approach is appropriate for JSDOM.
packages/ui/src/components/verse-of-the-day.test.tsx New unit test mirrors the BibleCard test structure and correctly asserts class-based layout changes.
.changeset/pretty-bibles-sit.md Minor-bump changeset; bump level is appropriate for a public layout behaviour change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before
        S1["section\n(max-w-md, p-6)"]
        S1 --> H1["Header div"]
        S1 --> A1["AnimatedHeight\n(BibleTextView)"]
        S1 --> F1["Footer / Attribution"]
    end

    subgraph After
        S2["section\n(w-full, box-border, p-6)"]
        S2 --> CC["div.card-content\n(max-w: 600px, mx: auto)"]
        CC --> H2["Header div"]
        CC --> A2["AnimatedHeight\n(BibleTextView — max-w: 65ch)"]
        CC --> F2["Footer / Attribution"]
    end

    style CC fill:#e0f2fe,stroke:#0284c7
Loading

Reviews (3): Last reviewed commit: "Merge origin/main into codex/ype-2573-ca..." | Re-trigger Greptile

Remove the outer BibleCard max width while keeping the rendered card content centered at a readable line length. This lets host layouts size the card while preserving balanced whitespace inside wide containers.
Center the VerseOfTheDay content within a full-width card and update Storybook framing for realistic width behavior. Keep card shells border-box so full-width cards fit narrow containers without adding minimum widths.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: a382db7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-react-ui Minor
vite-react Patch
@youversion/platform-core Minor
@youversion/platform-react-hooks Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Add a minor changeset for the card layout update so the UI package version captures the new full-width centered card behavior.
@cameronapak cameronapak marked this pull request as ready for review May 21, 2026 17:35
Comment thread packages/core/src/styles/bible-reader.css
Comment thread packages/ui/src/components/verse.test.tsx Outdated
Comment thread packages/ui/src/components/bible-card.tsx Outdated
Comment thread packages/ui/src/components/bible-card.tsx Outdated
Keep BibleTextView readable by default while moving card layout constraints into Tailwind classes. Remove tests that only checked inline style state instead of real layout behavior.
@cameronapak cameronapak changed the title Center Bible card content YPE-2573 - Center Bible card content May 22, 2026
@cameronapak cameronapak requested a review from Dustin-Kelley June 1, 2026 14:29
Resolve conflicts in bible-card.tsx and verse-of-the-day.tsx by keeping the
card-content wrapper layout from this branch while preserving main's
onFootnotePress support and i18n aria-label/share strings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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