Skip to Content
BBRICKSv0.7.4
PR PortalStatus and icons

useDecisionTagsVisible

True while the nearest DecisionTagsProvider shows the inline tags (false without one).

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

Examples

Open decisions

DecisionsCard sits in AppShell's sidebarCard slot: the open codes (each one's question is its tooltip) and a switch. The app keeps the switch's state and hands it to a DecisionTagsProvider around the page, so every inline DecisionTag shows or hides with it. variant="open" is the "Open · R10" pill that always shows, in place of a value nobody has decided.

Code
import { useState } from 'react';
import { Card, DecisionTag, DecisionTagsProvider, DecisionsCard } from '@ergasti/bricks';

const OPEN = [
  { id: 'C3', question: 'Can a brand opt out of a TRNDR-wide challenge?' },
  { id: 'R10', question: 'What a tier gives creators' },
  { id: 'S4', question: 'Can PR add or remove tiers?' },
  { id: 'T4', question: 'When challenge rewards are paid' },
  { id: 'GS1', question: 'Damaged or extra units: brand collects within 14 days?' },
  { id: 'GS2', question: 'Can PR launch a gift challenge with fewer gifts than planned?' },
];

function Sidebar() {
  const [show, setShow] = useState(true);
  return (
    <DecisionTagsProvider visible={show}>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(248px, 1fr))', gap: 16, alignItems: 'start' }}>
        <div style={{ maxWidth: 248, padding: 14, borderRadius: 18, background: '#141414' }}>
          <DecisionsCard decisions={OPEN} showTags={show} onShowTagsChange={setShow} />
        </div>
        <Card>
          <Card.Header title={<>Needs you<DecisionTag id="S12" /></>} sub="Most urgent first" />
          <p style={{ margin: 0 }}>Affiliate program<DecisionTag id="P6" question="Who can change a program?" /></p>
          <p>What creators get: <DecisionTag id="R10" question="What a tier gives creators" variant="open" /></p>
        </Card>
      </div>
    </DecisionTagsProvider>
  );
}

Codes you can focus

tip="focus" makes each code a tab stop that shows its question in its own tooltip on hover and keyboard focus (Escape hides it), so keyboard users can read it too. The default 'title' uses the browser's tooltip, which only a mouse shows.

Code
import { useState } from 'react';
import { DecisionsCard } from '@ergasti/bricks';

const OPEN = [
  { id: 'C3', question: 'Can a brand opt out of a TRNDR-wide challenge?' },
  { id: 'R10', question: 'What a tier gives creators' },
  { id: 'S4', question: 'Can PR add or remove tiers?' },
  { id: 'T4', question: 'When challenge rewards are paid' },
  { id: 'GS1', question: 'Damaged or extra units: brand collects within 14 days?' },
  { id: 'GS2', question: 'Can PR launch a gift challenge with fewer gifts than planned?' },
];

function FocusTips() {
  const [show, setShow] = useState(false);
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(248px, 1fr))', gap: 16, alignItems: 'start' }}>
      {(['title', 'focus'] as const).map((tip) => (
        <div key={tip} style={{ maxWidth: 248, padding: 14, borderRadius: 18, background: '#141414' }}>
          <DecisionsCard decisions={OPEN.slice(0, 4)} tip={tip} showTags={show} onShowTagsChange={setShow} />
        </div>
      ))}
    </div>
  );
}

Signature

function useDecisionTagsVisible(): boolean

Returns

boolean

useLanguage · Sidebar · DecisionTagsProvider · DecisionsCard · Card · DecisionTag · DecisionLine · IconSquare

Source

src/pr/decisions/DecisionTag.tsx (line 44) on GitHub.

On this page