File size: 996 Bytes
cd8bd0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use client";

import React from "react";
import { cn } from "@/shared/utils/cn";
import { DOCS_TOKENS } from "./tokens";

type CalloutType = "info" | "warning" | "danger";

interface CalloutProps {
  type: CalloutType;
  title: string;
  children: React.ReactNode;
  className?: string;
}

export default function Callout({ type, title, children, className }: CalloutProps) {
  const theme = DOCS_TOKENS.colors[type];

  return (
    <div
      role="note"
      aria-labelledby="callout-title"
      className={cn(
        "relative overflow-hidden rounded-lg border-l-4 p-4 my-4 transition-colors",
        "bg-bg-subtle border-border",
        className
      )}
      style={{ borderLeftColor: theme.border }}
    >
      <div className="flex items-start gap-3">
        <div id="callout-title" className="font-semibold text-sm text-text-main">
          {title}
        </div>
        <div className="text-sm leading-relaxed text-text-muted">{children}</div>
      </div>
    </div>
  );
}