| 1 |
import React from "react"; |
| 2 |
import { cn } from "../../analytics/components/common/ui"; |
| 3 |
|
| 4 |
/** |
| 5 |
* Shared, inert building blocks for the Content Intelligence mocks. |
| 6 |
* |
| 7 |
* Everything in `mocks/` is decoration: it renders behind `LockedPreview`'s |
| 8 |
* frosted panel, which hides it from the accessibility tree (`aria-hidden`) and |
| 9 |
* kills pointer events in CSS. `aria-hidden` does not remove focusability |
| 10 |
* though — a real <button> or <a> in there would still be reachable with Tab, |
| 11 |
* putting invisible, blurred controls in the tab order. So every control in the |
| 12 |
* mocks is one of these look-alike <span>s instead, exactly as `ApiDocsMock` |
| 13 |
* does for its row actions. |
| 14 |
*/ |
| 15 |
|
| 16 |
/* Looks like `common/ui.js`'s <Btn>, minus the button. */ |
| 17 |
export function FauxBtn( { kind = "ghost", size = "md", icon, children, className } ) { |
| 18 |
return ( |
| 19 |
<span className={ cn( "bda-btn", kind, size === "sm" && "sm", className ) }> |
| 20 |
{ icon }{ children } |
| 21 |
</span> |
| 22 |
); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* The one glyph the shared analytics icon set is missing: Pro keys the |
| 27 |
* Duplicates & Overlaps module off `I.Copy`, which Free's |
| 28 |
* `analytics/components/common/icons.js` does not ship. Same lucide-style |
| 29 |
* 24×24 / 1.75-stroke construction as every icon in there, so this stays inside |
| 30 |
* the existing design language rather than starting a second one. Local to the |
| 31 |
* teaser because the teaser is the only thing in Free that needs it. |
| 32 |
*/ |
| 33 |
export function CopyIcon( { size = 16, className = "", strokeWidth = 1.75, ...rest } ) { |
| 34 |
return ( |
| 35 |
<svg width={ size } height={ size } viewBox="0 0 24 24" fill="none" stroke="currentColor" |
| 36 |
strokeWidth={ strokeWidth } strokeLinecap="round" strokeLinejoin="round" className={ className } { ...rest }> |
| 37 |
<rect x="9" y="9" width="12" height="12" rx="2" /> |
| 38 |
<path d="M6 15H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1" /> |
| 39 |
</svg> |
| 40 |
); |
| 41 |
} |
| 42 |
|
| 43 |
/* Deterministic descending series for the stale-article sparklines — stale |
| 44 |
content is, by definition, on the way down. Same shape-from-a-formula idiom |
| 45 |
as `previews.js`'s `wave()`, so the trend lines read like the ones in the |
| 46 |
Analytics teasers. */ |
| 47 |
export const decline = ( base, n = 12 ) => |
| 48 |
Array.from( { length: n }, ( _, i ) => |
| 49 |
Math.round( base * ( 1 - i / ( n * 1.6 ) ) + Math.sin( i / 1.3 ) * base * 0.06 ) ); |
| 50 |
|