SPB Git

Repository Public

primitives.tsx 4.3 KB 145 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : agentilab-web8 * File             : components/ui/primitives.tsx9 * Module           : User Interface10 * Repository       : https://git.spboucher.ai/agentilab-web11 * Project Website  : Not specified12 * Created          : 2026-12-0513 * Last Modified    : 2026-12-0514 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : Proprietary34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import Link from 'next/link';44import type { ReactNode } from 'react';4546export function Container({ children, className = '' }: { children: ReactNode; className?: string }) {47  return <div className={`container ${className}`.trim()}>{children}</div>;48}4950interface SectionProps {51  children: ReactNode;52  tone?: 'light' | 'dark';53  className?: string;54  id?: string;55  labelledBy?: string;56}5758/** Section de page. `tone` bascule les jetons de couleur (alternance clair / sombre). */59export function Section({ children, tone = 'light', className = '', id, labelledBy }: SectionProps) {60  return (61    <section id={id} data-tone={tone} aria-labelledby={labelledBy} className={`section ${className}`.trim()}>62      <Container>{children}</Container>63    </section>64  );65}6667interface SectionHeadingProps {68  id?: string;69  eyebrow?: string;70  title: string;71  intro?: string;72  level?: 'h1' | 'h2';73}7475export function SectionHeading({ id, eyebrow, title, intro, level = 'h2' }: SectionHeadingProps) {76  const Tag = level;77  return (78    <div className="heading">79      {eyebrow ? <span className="eyebrow">{eyebrow}</span> : null}80      <Tag id={id}>{title}</Tag>81      {intro ? <p>{intro}</p> : null}82    </div>83  );84}8586interface ButtonLinkProps {87  href: string;88  children: ReactNode;89  variant?: 'primary' | 'secondary';90}9192export function ButtonLink({ href, children, variant = 'primary' }: ButtonLinkProps) {93  return (94    <Link href={href} className={`btn btn--${variant}`}>95      {children}96    </Link>97  );98}99100export function ArrowLink({ href, children }: { href: string; children: ReactNode }) {101  return (102    <Link href={href} className="arrow-link">103      {children}104    </Link>105  );106}107108interface ExternalLinkProps {109  href: string;110  children: ReactNode;111  /** Texte lu après le libellé, p. ex. « (site externe) ». */112  externalLabel: string;113  /** Langue de la destination si elle diffère de celle de la page. */114  hrefLang?: string;115  className?: string;116}117118/** Lien sortant : explicite pour les lecteurs d’écran, sans fuite de référent ni accès à window.opener. */119export function ExternalLink({ href, children, externalLabel, hrefLang, className = 'arrow-link ext' }: ExternalLinkProps) {120  return (121    <a href={href} className={className} rel="noopener noreferrer" hrefLang={hrefLang}>122      {children}123      <span className="sr-only"> {externalLabel}</span>124    </a>125  );126}127128export function EmptyState({ title, text, children }: { title: string; text: string; children?: ReactNode }) {129  return (130    <div className="empty">131      <h3>{title}</h3>132      <p>{text}</p>133      {children}134    </div>135  );136}137138export function Notice({ children }: { children: ReactNode }) {139  return (140    <p className="notice" role="note">141      {children}142    </p>143  );144}145
Files main
Menu

Theme