ReqoreTier: no props for the card's internal spacing, and currency is dropped for numeric-string prices

Open
#681 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start by locating the ReqoreTier implementation and its tests or stories; the issue does not name their paths. Check how it composes the header, price-detail block, and feature-list control groups, and how currency rendering handles string prices. Done means consumers can control the described spacing through props and numeric-string prices display currency without adding a symbol to custom text; update or add coverage for both behaviors.

Written by the indexing model from the issue text.

Description

What the landing page needs

ReqoreTier is the pricing-card component on the Qorus marketing site's /pricing
page (5 plans, dark and light, live plans from the Qorus SaaS product catalog with a
CMS snapshot as the fallback). Two things about it can only be reached today by
writing CSS against Reqore's internal DOM, which is exactly what we are asked not to
do in consuming repos.

1. No control over the spacing inside the card

The Tier hard-codes its internal structure:

<ReqoreControlGroup horizontalAlign='center' vertical gapSize='big'>   // name / price / description / action
  …
</ReqoreControlGroup>
<ReqoreVerticalSpacer height={20} />
<ReqoreControlGroup vertical>                                          // the feature list
  {featureList.map(…)}
</ReqoreControlGroup>

The gapSize='big' group puts the same gap under priceDetail ("per month") as it
puts everywhere else, which is too much for a card that also carries a description
and a feature list. With no prop for it, the site patches it from outside:

const TiersGrid = styled(ReqoreColumns)`
  .reqore-spacer + .reqore-control-group > .reqore-control-group:nth-child(2):not(:has(.reqore-icon)) {
    .reqore-paragraph:last-child { padding-bottom: 16px; }
    & + * { margin-top: -16px; }
  }
`;

That selector is a guess about Reqore's DOM, and it has already misfired once: the
feature list is also "a .reqore-spacer followed by a control group", so the rule
matched the second feature row too and pulled the third row 16px up over it — visible
as soon as a feature's text wrapped to two lines. The :not(:has(.reqore-icon)) above
is the workaround. Any change to the Tier's markup breaks it again, silently.

Ask: props for the spacing the Tier composes — e.g. gapSize for the header
group, and featureListProps / priceDetailProps (or IReqoreControlGroupProps
passthroughs) so a consumer can set gapSize/padded on the feature list and the
price block with props instead of selectors.

2. currency is dropped when price is a numeric string

price is typed string | number, but the currency symbol is only rendered when
isNumber(price):

{currency && currencyPosition === 'before' && isNumber(price) ? currency : undefined}
{price}

Prices arriving from an API or a CMS are text ("55", "0"), so
<ReqoreTier price="55" currency="$" /> renders 55 with no symbol, while
price={55} renders $55. The guard is clearly there so price="Custom" gets no
symbol — but it also swallows the common case. The site works around it by parsing
the amount and passing a number:

const amount = /^\d+(\.\d+)?$/.test(tier.price) ? Number(tier.price) : undefined;
<ReqoreTier price={amount ?? tier.price} currency={amount === undefined ? '' : symbol} … />

Ask: render the currency whenever the price is numeric or parses as a number
(!isNaN(Number(price))), so a numeric string behaves like a number; or expose the
decision as a prop. Either way the fix belongs in the Tier, not in every consumer.

What we did meanwhile

Both workarounds are in the landing page (src/pages/PricingPage.tsx), with comments
pointing at the reason, plus a story play test (expectNoVerticalOverlap) that fails
if the spacing selector ever collapses the feature rows again. We will drop both when
the props land.

Filed from the Qorus SaaS landing page; the site may not change Reqore itself.

Dominant language
TypeScript
Stars
4
Forks
0
Avg merge
16h 28m
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from qoretechnologies/reqore

All issues in qoretechnologies/reqore

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.