{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "x-post-mockup",
  "title": "X Post Mockup",
  "description": "A realistic X (Twitter) post with a verified badge, media image, and interactive like/retweet/bookmark actions with live counts, in light or dark theme.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/x-post-mockup/x-post-mockup.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type XPostMockupTheme = \"dark\" | \"light\";\n\nexport interface XPostMockupProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  theme?: XPostMockupTheme;\n  borderRadius?: number;\n  username?: string;\n  handle?: string;\n  userAvatar?: string;\n  showVerified?: boolean;\n  tweetText?: string;\n  mediaImage?: string;\n  likesCount?: number;\n  retweetsCount?: number;\n  repliesCount?: number;\n  viewsCount?: number;\n  timePosted?: string;\n  datePosted?: string;\n  allowLike?: boolean;\n  allowRetweet?: boolean;\n  allowBookmark?: boolean;\n}\n\nfunction fmt(n: number): string {\n  if (n >= 1_000_000) return (n / 1_000_000).toFixed(1).replace(\".0\", \"\") + \"M\";\n  if (n >= 1_000) return (n / 1_000).toFixed(1).replace(\".0\", \"\") + \"K\";\n  return n.toLocaleString();\n}\n\nconst XLogo = ({ size = 18, color = \"#e7e9ea\" }: { size?: number; color?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={color}>\n    <path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.748l7.73-8.835L1.254 2.25H8.08l4.259 5.631 5.905-5.631zm-1.161 17.52h1.833L7.084 4.126H5.117z\" />\n  </svg>\n);\nconst XReply = ({ size = 20, c = \"currentColor\" }: { size?: number; c?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={c} strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\" />\n  </svg>\n);\nconst XRetweet = ({ filled, size = 20, c = \"currentColor\" }: { filled: boolean; size?: number; c?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={filled ? \"#00ba7c\" : c} strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <polyline points=\"17 1 21 5 17 9\" />\n    <path d=\"M3 11V9a4 4 0 0 1 4-4h14\" />\n    <polyline points=\"7 23 3 19 7 15\" />\n    <path d=\"M21 13v2a4 4 0 0 1-4 4H3\" />\n  </svg>\n);\nconst XHeart = ({ filled, size = 20, c = \"currentColor\" }: { filled: boolean; size?: number; c?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={filled ? \"#f91880\" : \"none\"} stroke={filled ? \"#f91880\" : c} strokeWidth=\"1.8\" strokeLinejoin=\"round\">\n    <path d=\"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z\" />\n  </svg>\n);\nconst XViews = ({ size = 20, c = \"currentColor\" }: { size?: number; c?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={c}>\n    <path d=\"M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z\" />\n  </svg>\n);\nconst XBookmark = ({ filled, size = 20, c = \"currentColor\" }: { filled: boolean; size?: number; c?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={filled ? \"#1d9bf0\" : \"none\"} stroke={filled ? \"#1d9bf0\" : c} strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z\" />\n  </svg>\n);\nconst XUpload = ({ size = 20, c = \"currentColor\" }: { size?: number; c?: string }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={c} strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8\" />\n    <polyline points=\"16 6 12 2 8 6\" />\n    <line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"15\" />\n  </svg>\n);\nconst XVerified = ({ dark = false }: { dark?: boolean }) => (\n  <svg width={18} height={18} viewBox=\"0 0 24 24\" fill={dark ? \"#fff\" : \"#1d9bf0\"}>\n    <path d=\"M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z\" />\n  </svg>\n);\n\nfunction ActionButton({\n  icon,\n  label,\n  ariaLabel,\n  onClick,\n  active = false,\n  activeColor,\n  sub,\n}: {\n  icon: React.ReactNode;\n  label?: number;\n  ariaLabel: string;\n  onClick?: () => void;\n  active?: boolean;\n  activeColor?: string;\n  sub: string;\n}) {\n  return (\n    <button\n      onClick={onClick}\n      aria-label={ariaLabel}\n      aria-pressed={onClick ? active : undefined}\n      className=\"flex items-center rounded-full border-0 bg-transparent px-1.5 py-1 text-[13px]\"\n      style={{ cursor: onClick ? \"pointer\" : \"default\", color: active ? activeColor : sub, gap: 5 }}\n    >\n      {icon}\n      {label != null && <span className=\"tabular-nums\">{fmt(label)}</span>}\n    </button>\n  );\n}\n\nexport function XPostMockup({\n  theme = \"dark\",\n  borderRadius = 16,\n  username = \"Akem\",\n  handle = \"AkemyDesign\",\n  userAvatar,\n  showVerified = true,\n  tweetText = \"Slow mornings, warm light, and a kitchen that finally feels like home. 🤍\",\n  mediaImage,\n  likesCount = 688,\n  retweetsCount = 15,\n  repliesCount = 9,\n  viewsCount = 5_600_000,\n  timePosted = \"15:51\",\n  datePosted = \"Jun 4, 2026\",\n  allowLike = true,\n  allowRetweet = true,\n  allowBookmark = true,\n  className,\n  ...props\n}: XPostMockupProps) {\n  const [liked, setLiked] = React.useState(false);\n  const [retweeted, setRetweeted] = React.useState(false);\n  const [bookmarked, setBookmarked] = React.useState(false);\n\n  const dark = theme !== \"light\";\n  const bg = dark ? \"#16181c\" : \"#fff\";\n  const text = dark ? \"#e7e9ea\" : \"#0f1419\";\n  const sub = dark ? \"#71767b\" : \"#536471\";\n  const border = dark ? \"#2f3336\" : \"#eff3f4\";\n\n  const likes = liked ? likesCount + 1 : likesCount;\n  const rts = retweeted ? retweetsCount + 1 : retweetsCount;\n\n  return (\n    <div\n      className={cn(\"box-border w-full overflow-hidden font-[-apple-system,BlinkMacSystemFont,'Segoe_UI',sans-serif]\", className)}\n      style={{ background: bg, borderRadius, border: `1px solid ${border}` }}\n      {...props}\n    >\n      <div className=\"px-4 pt-3.5\">\n        <div className=\"mb-2 flex items-start gap-2.5\">\n          <div className=\"h-[42px] w-[42px] shrink-0 overflow-hidden rounded-full\" style={{ background: dark ? \"#333\" : \"#ddd\" }}>\n            {userAvatar && <img src={userAvatar} alt={username} className=\"block h-full w-full object-cover\" />}\n          </div>\n          <div className=\"min-w-0 flex-1\">\n            <div className=\"flex min-w-0 items-center gap-1\">\n              <span className=\"overflow-hidden text-[15px] font-bold text-ellipsis whitespace-nowrap\" style={{ color: text }}>\n                {username}\n              </span>\n              {showVerified && <XVerified dark={dark} />}\n            </div>\n            <div className=\"overflow-hidden text-sm text-ellipsis whitespace-nowrap\" style={{ color: sub }}>\n              @{handle}\n            </div>\n          </div>\n          <XLogo size={20} color={dark ? \"#e7e9ea\" : \"#0f1419\"} />\n        </div>\n\n        <div className=\"mb-3 text-[15px] leading-[1.55] whitespace-pre-wrap\" style={{ color: text }}>\n          {tweetText}\n        </div>\n\n        {mediaImage && (\n          <div className=\"mb-3 overflow-hidden rounded-[14px]\" style={{ border: `1px solid ${border}` }}>\n            <img src={mediaImage} alt=\"Post media\" className=\"block max-h-80 w-full object-cover\" />\n          </div>\n        )}\n\n        <div className=\"mb-2.5 text-sm\" style={{ color: sub }}>\n          {[timePosted, datePosted].filter(Boolean).join(\" · \")}\n        </div>\n\n        <div className=\"-mx-4 h-px\" style={{ background: border }} />\n\n        <div className=\"flex flex-wrap justify-between gap-1\" style={{ padding: \"2px 0 6px\" }}>\n          <ActionButton icon={<XReply size={18} c={sub} />} label={repliesCount} ariaLabel=\"Reply\" sub={sub} />\n          <ActionButton\n            icon={<XRetweet filled={retweeted} size={18} c={sub} />}\n            label={rts}\n            onClick={() => allowRetweet && setRetweeted((v) => !v)}\n            active={retweeted}\n            activeColor=\"#00ba7c\"\n            ariaLabel={retweeted ? \"Undo Retweet\" : \"Retweet\"}\n            sub={sub}\n          />\n          <ActionButton\n            icon={<XHeart filled={liked} size={18} c={sub} />}\n            label={likes}\n            onClick={() => allowLike && setLiked((v) => !v)}\n            active={liked}\n            activeColor=\"#f91880\"\n            ariaLabel={liked ? \"Unlike\" : \"Like\"}\n            sub={sub}\n          />\n          <ActionButton icon={<XViews size={18} c={sub} />} label={viewsCount} ariaLabel=\"Views\" sub={sub} />\n          <div className=\"flex\">\n            <ActionButton\n              icon={<XBookmark filled={bookmarked} size={18} c={sub} />}\n              onClick={() => allowBookmark && setBookmarked((v) => !v)}\n              active={bookmarked}\n              activeColor=\"#1d9bf0\"\n              ariaLabel={bookmarked ? \"Remove Bookmark\" : \"Bookmark\"}\n              sub={sub}\n            />\n            <ActionButton icon={<XUpload size={18} c={sub} />} ariaLabel=\"Share\" sub={sub} />\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}