<commit_before>import { JSXInternal } from 'preact/src/jsx';
import TargetedEvent = JSXInternal.TargetedEvent;
import TargetedMouseEvent = JSXInternal.TargetedMouseEvent;

import { FunctionComponent } from 'preact';

const baseClass = `rounded px-4 py-1.75 font-bold text-sm fit-content`;

type ButtonType = 'normal' | 'primary' | 'danger';

const buttonClasses: { [type in ButtonType]: string } = {
  normal: `${baseClass} bg-default color-text border-neutral border-solid border-gray-300 border-1 focus:bg-contrast hover:bg-contrast`,
  primary: `${baseClass} no-border bg-info color-info-contrast hover:brightness-130 focus:brightness-130`,
  danger: `${baseClass} bg-default color-danger border-neutral border-solid border-gray-300 border-1 focus:bg-contrast hover:bg-contrast`,
};

export const Button: FunctionComponent<{
  className?: string;
  type: ButtonType;
  label: string;
  onClick: (event: TargetedEvent<HTMLFormElement> | TargetedMouseEvent<HTMLButtonElement>) => void;
  disabled?: boolean;
}> = ({ type, label, className = '', onClick, disabled = false }) => {
  const buttonClass = buttonClasses[type];
  const cursorClass = disabled ? 'cursor-default' : 'cursor-pointer';

  return (
    <button
      className={`${buttonClass} ${cursorClass} ${className}`}
      onClick={(e) => {
        onClick(e);
        e.preventDefault();
      }}
      disabled={disabled}
    >
      {label}
    </button>
  );
};<commit_msg>fix: preferences pane buttons border color<commit_after>import { JSXInternal } from 'preact/src/jsx';
import TargetedEvent = JSXInternal.TargetedEvent;
import TargetedMouseEvent = JSXInternal.TargetedMouseEvent;

import { FunctionComponent } from 'preact';

const baseClass = `rounded px-4 py-1.75 font-bold text-sm fit-content`;

type ButtonType = 'normal' | 'primary' | 'danger';

const buttonClasses: { [type in ButtonType]: string } = {
  normal: `${baseClass} bg-default color-text border-solid border-gray-300 border-1 focus:bg-contrast hover:bg-contrast`,
  primary: `${baseClass} no-border bg-info color-info-contrast hover:brightness-130 focus:brightness-130`,
  danger: `${baseClass} bg-default color-danger border-solid border-gray-300 border-1 focus:bg-contrast hover:bg-contrast`,
};

export const Button: FunctionComponent<{
  className?: string;
  type: ButtonType;
  label: string;
  onClick: (event: TargetedEvent<HTMLFormElement> | TargetedMouseEvent<HTMLButtonElement>) => void;
  disabled?: boolean;
}> = ({ type, label, className = '', onClick, disabled = false }) => {
  const buttonClass = buttonClasses[type];
  const cursorClass = disabled ? 'cursor-default' : 'cursor-pointer';

  return (
    <button
      className={`${buttonClass} ${cursorClass} ${className}`}
      onClick={(e) => {
        onClick(e);
        e.preventDefault();
      }}
      disabled={disabled}
    >
      {label}
    </button>
  );
};
{'fraction_non_alphanumeric': 0.1413685307398402, 'fraction_numerical': 0.012504341785342132, 'mean_word_length': 4.433962264150943, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5097659', 'n_tokens_mistral': 892, 'n_tokens_neox': 866, 'n_words': 207}