Skip to content

programmatic video rendering framework that is actually fast

2.2 KB
Raw Blame
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Cx from "rescript-classnames/src/Cx.bs.js";
import * as Curry from "rescript/lib/es6/curry.js";
import * as React from "react";
import * as Tooltip from "./Tooltip.bs.js";

var focusRing = "outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-surface)]";

function IconButton(Props) {
  var label = Props.label;
  var onClick = Props.onClick;
  var children = Props.children;
  var shortcut = Props.shortcut;
  var variantOpt = Props.variant;
  var sizeOpt = Props.size;
  var pressed = Props.pressed;
  var classNameOpt = Props.className;
  var variant = variantOpt !== undefined ? variantOpt : /* Ghost */0;
  var size = sizeOpt !== undefined ? sizeOpt : /* Md */0;
  var className = classNameOpt !== undefined ? classNameOpt : "";
  var tmp;
  switch (variant) {
    case /* Ghost */0 :
        tmp = "text-secondary hover:bg-primary-ghost-hover hover:text-default active:bg-primary-ghost-active";
        break;
    case /* Solid */1 :
        tmp = "bg-primary-solid text-primary-solid hover:bg-primary-solid-hover active:bg-primary-solid-active";
        break;
    case /* Brand */2 :
        tmp = "bg-brand text-on-brand hover:bg-brand-hover active:bg-brand-active";
        break;
    
  }
  var button = React.createElement("button", {
        "aria-label": label,
        className: Cx.cx([
              "inline-flex shrink-0 items-center justify-center rounded-full transition-colors duration-150 [&>svg]:size-5",
              focusRing,
              size ? "size-10" : "size-9",
              tmp,
              className
            ]),
        type: "button",
        onClick: (function (param) {
            return Curry._1(onClick, undefined);
          })
      }, children);
  var tmp$1 = {
    children: pressed !== undefined ? React.cloneElement(button, {
            "aria-pressed": pressed
          }) : button,
    content: label
  };
  if (shortcut !== undefined) {
    tmp$1.shortcut = shortcut;
  }
  return React.createElement(Tooltip.make, tmp$1);
}

var make = IconButton;

export {
  focusRing ,
  make ,
  
}
/* react Not a pure module */