Skip to content

Full Toolkit for Next-Level Domain Analysis

937 B
Raw Blame
'use client';

import { StarIcon } from 'lucide-react';
import type { FC } from 'react';

import { Button } from '@/components/ui/button';

import { useStargazersSummary } from '../api/stargazers-summary/hook';

export const StarButton: FC = () => {
  const { data } = useStargazersSummary();

  return (
    <Button variant="ghost" asChild className="px-2">
      <a
        href="https://github.com/wotschofsky/domain-digger"
        target="_blank"
        rel="noopener"
      >
        <StarIcon className="mr-1 h-4 w-4 fill-yellow-400 text-yellow-400" />
        {/* Wide enough for the count, so the search bar next to it stays put
            when the count replaces "Star" */}
        <span className="hidden min-w-[5ch] tabular-nums md:inline-block">
          {data?.totalStars ? data.totalStars.toLocaleString() : 'Star'}
          <span className="sr-only"> on GitHub</span>
        </span>
      </a>
    </Button>
  );
};