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

Aperta
#681 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
16h 28m
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qoretechnologies/reqore

Tutte le issue di qoretechnologies/reqore

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.