File size: 951 Bytes
9b906ea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
40
41
42
43
44
45
46
import React from "react";
import { cn } from "#/utils/utils";

const MENU_SECTION_HEADING_PADDING = "px-2 pb-1 pt-1";
const MENU_SECTION_HEADING_TEXT =
  "text-[11px] font-semibold uppercase tracking-wide text-[var(--oh-muted)]";

export function MenuHeading({
  children,
  suffix,
}: {
  children: React.ReactNode;
  suffix?: React.ReactNode;
}) {
  if (suffix != null) {
    return (
      <div
        role="presentation"
        className={cn(
          "flex items-baseline justify-between gap-2",
          MENU_SECTION_HEADING_PADDING,
        )}
      >
        <span
          className={cn(
            "min-w-0 truncate text-left",
            MENU_SECTION_HEADING_TEXT,
          )}
        >
          {children}
        </span>
        {suffix}
      </div>
    );
  }

  return (
    <div
      role="presentation"
      className={cn(MENU_SECTION_HEADING_PADDING, MENU_SECTION_HEADING_TEXT)}
    >
      {children}
    </div>
  );
}