Skip to Content
BBRICKSv0.7.4
PR PortalBrands

RequestChallengeCard

The brand portal's Challenges card as the PR portal's View as brand shows it (the v3 mock's P.viewas): "Brands can ask TRNDR for a challenge." and a full-width "Request a challenge", disabled while PR only views (no onRequest), with why as its description.

import { RequestChallengeCard } from '@ergasti/bricks';

Examples

View as brand

The brand's Challenges card with "Request a challenge" disabled while PR only views; the button's description says why. Pass onRequest in the brand portal itself.

Code
import { RequestChallengeCard } from '@ergasti/bricks';

function ViewAsBrand() {
  return <div style={{ maxWidth: 360 }}><RequestChallengeCard /></div>;
}

In Arabic

Pinned to Arabic
Code (not run)
import { RequestChallengeCard } from '@ergasti/bricks';

function Arabic() {
  return <div style={{ maxWidth: 360 }}><RequestChallengeCard /></div>;
}

Props

Prop

Type

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prRequestChallenge, or with the component's own prop where it has one. A {name} is a value the component fills in.

prRequestChallenge
KeyEnglishArabic
titleChallengesالتحديات
textBrands can ask TRNDR for a challenge.البراندات تقدر تطلب تحدي من TRNDR.
requestRequest a challengeاطلب تحدي
readOnlyRead only while you view as the brand.للقراية بس وإنت بتتفرج كأنك البراند.

Design guidance

How the BRICKS design system uses RequestChallengeCard. Written in docs/content/components/RequestChallengeCard.md; the props above are read from the code, which wins where the two disagree.

The brand's "Challenges" card as View as brand shows it: "Brands can ask TRNDR for a challenge." and a full-width "Request a challenge", disabled while PR only views; use it inside ReadOnlyFrame on the PR Portal's View as brand page.

It is the PR v3 mock's P.viewas side card (.card.s4 with <p class="muted"> and <button class="btn wide" disabled>). Before 0.7 the screen drew it as a Card with a disabled Button; use RequestChallengeCard instead, because it also says why the button cannot be used: with no onRequest the button is disabled and described by the card's text and a visually hidden "Read only while you view as the brand.".

Anatomy

  1. Card: title "Challenges".
  2. Text (muted, no margin): "Brands can ask TRNDR for a challenge." (text), plus, when disabled, a visually hidden reason.
  3. Button: full-width (kit-pr-wide), default variant, "Request a challenge", aria-describedby the text (and the reason when disabled).

Variants

PropLookWhen to use
no onRequest (default)Button disabledView as brand: PR is only looking.
onRequestButton enabledThe brand's own portal, where the brand can ask.
textYour lineDifferent copy for the card.
disabledReasonYour screen-reader reasonA reason other than viewing as the brand.

States

StateHow
DisabledNo onRequest. Inside ReadOnlyFrame the whole panel is also inert.
EnabledonRequest: hover, focus-visible and press as Button.

Usage

// PR Portal › Brand detail › View as brand: the brand's creators beside its Challenges card, read only
import { Button, Card, PageGrid, ReadOnlyFrame, RequestChallengeCard, ViewAsBanner } from '@ergasti/bricks';

export function ViewAsGlowLab({ exit }: { exit: () => void }) {
  return (
    <>
      <ViewAsBanner brandName="Glow Lab" onExit={exit} />
      <ReadOnlyFrame>
        <PageGrid split="8-4" align="start">
          <Card title="Your creators" actions={<Button size="sm" disabled>Invite</Button>}>
            <p style={{ margin: 0 }}>Sara Ali, Nour Hassan</p>
          </Card>
          <RequestChallengeCard />
        </PageGrid>
      </ReadOnlyFrame>
    </>
  );
}
// Where the brand can act: the button opens the request form
import { RequestChallengeCard } from '@ergasti/bricks';

export function BrandChallengesCard({ openRequest }: { openRequest: () => void }) {
  return <RequestChallengeCard onRequest={openRequest} />;
}

Where it appears

  • PR Portal › Brand detail › View as brand › the side column next to "Your creators" (PR · View as brand).

Guidelines

Do

  • Leave onRequest out in View as brand, so the button is disabled with its reason.
  • Keep it inside ReadOnlyFrame there, with ViewAsBanner above.

Don't

  • Don't hide the button in View as brand; PR should see what the brand sees.
  • Don't make it raspberry here: the mock draws a plain wide button in this read-only view.
  • Don't use it for the Brand dashboard's own request flow ("+ Request a challenge" on Motivation); that is a Button variant="rasp" and ChallengeRequestForm.

RTL and Arabic

  • Mirrors with the card. Its words: "التحديات", "البراندات تقدر تطلب تحدي من TRNDR.", "اطلب تحدي", "للقراية بس وإنت بتتفرج كأنك البراند.".

Tokens

--ink-3 (text); card and button tokens.

Accessibility

  • The button is described (aria-describedby) by the card's text, and when disabled also by the hidden reason, so a screen reader hears what it does and why it is unavailable.
  • Inside ReadOnlyFrame the card is inert and not read at all; the banner above explains the view.
  • A native disabled <button>.

Found in the source

  • ARIA attributes set: aria-describedby.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Button · Card · useLanguage · AdjustWalletDialog · BrandAvatar · BrandCell · BrandDetailHeader

Source

src/pr/programs/RequestChallengeCard.tsx (line 42) on GitHub.

On this page