import { Link } from '@inertiajs/react';

type Props = {
  href?: string;
  compact?: boolean;
};

export function BrandMark({ href = '/', compact = false }: Props) {
  return (
    <Link href={href} className="brand-mark" aria-label="دانشیار من">
      <span className="brand-logo">
        <img
          src="/assets/images/logo/logo.png"
          alt=""
          onError={(event) => {
            event.currentTarget.style.display = 'none';
            const fallback = event.currentTarget.nextElementSibling as HTMLElement | null;
            if (fallback) {
              fallback.style.display = 'inline-flex';
            }
          }}
        />
        <span>د</span>
      </span>
      {!compact ? (
        <span>
          <strong>دانشیار من</strong>
          <small>اتوماسیون هوشمند مدارس</small>
        </span>
      ) : null}
    </Link>
  );
}
