'use client'

import type * as React from 'react'
import { Button } from '@admin/components/ui/button'
import { SigmaIcon } from 'lucide-react'

export interface MathButtonProps extends Omit<React.ComponentProps<typeof Button>, 'type'> {
  text?: string
}

export function MathButton({ children, text, ...props }: MathButtonProps) {
  return (
    <Button type="button" variant="ghost" size={text ? 'sm' : 'icon-sm'} {...props}>
      {children ?? (
        <>
          <SigmaIcon />
          {text ? <span className="tiptap-button-text">{text}</span> : null}
        </>
      )}
    </Button>
  )
}
