You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
3.0 KiB

  1. import React, { FC } from "react";
  2. import { AuthorType } from "@/data/types";
  3. import { ArrowRightIcon } from "@heroicons/react/24/solid";
  4. import Avatar from "@/shared/Avatar";
  5. import convertNumbThousand from "@/utils/convertNumbThousand";
  6. import Link from "next/link";
  7. import Image from "next/image";
  8. export interface CardAuthorBox2Props {
  9. className?: string;
  10. author: AuthorType;
  11. }
  12. const CardAuthorBox2: FC<CardAuthorBox2Props> = ({
  13. className = "",
  14. author,
  15. }) => {
  16. const { displayName, href = "/", avatar, jobName, count, bgImage } = author;
  17. return (
  18. <Link
  19. href={href}
  20. className={`nc-CardAuthorBox2 flex flex-col overflow-hidden bg-white dark:bg-neutral-900 rounded-3xl hover:shadow-xl transition-shadow ${className}`}
  21. data-nc-id="CardAuthorBox2"
  22. >
  23. <div className="relative flex-shrink-0 ">
  24. <div className="flex aspect-w-7 aspect-h-3 md:aspect-h-4 w-full h-0">
  25. <Image
  26. fill
  27. alt=""
  28. src={bgImage || ""}
  29. sizes="(max-width: 400px) 100vw, 400px"
  30. />
  31. </div>
  32. <div className="absolute top-3 inset-x-3 flex">
  33. <div className="py-1 px-4 bg-neutral-100 dark:bg-neutral-800 rounded-full flex items-center justify-center leading-none text-xs font-medium">
  34. {convertNumbThousand(count)}{" "}
  35. <ArrowRightIcon className="w-5 h-5 text-yellow-600 ml-3" />
  36. </div>
  37. </div>
  38. </div>
  39. <div className="pt-[1px] px-6 text-center flex flex-col items-center relative -translate-y-7">
  40. <svg
  41. className="h-12 text-white dark:text-neutral-900 dark:group-hover:text-neutral-800"
  42. viewBox="0 0 135 54"
  43. fill="none"
  44. xmlns="http://www.w3.org/2000/svg"
  45. >
  46. <path
  47. d="M101.911 19.8581C99.4421 17.4194 97.15 14.8065 94.6816 12.1935C94.3289 11.671 93.8 11.3226 93.271 10.8C92.9184 10.4516 92.7421 10.2774 92.3895 9.92903C85.8658 3.83226 76.8737 0 67.1763 0C57.4789 0 48.4868 3.83226 41.7868 9.92903C41.4342 10.2774 41.2579 10.4516 40.9053 10.8C40.3763 11.3226 40.0237 11.671 39.4947 12.1935C37.0263 14.8065 34.7342 17.4194 32.2658 19.8581C23.45 28.7419 11.6368 30.4839 0 30.8323V54H16.5737H32.2658H101.734H110.374H134.176V30.6581C122.539 30.3097 110.726 28.7419 101.911 19.8581Z"
  48. fill="currentColor"
  49. />
  50. </svg>
  51. <span className="absolute top-2">
  52. <Avatar
  53. containerClassName=""
  54. sizeClass="w-12 h-12 text-2xl"
  55. radius="rounded-full"
  56. imgUrl={avatar}
  57. userName={displayName}
  58. />
  59. </span>
  60. <div className="mt-6">
  61. <h2 className={`text-base font-medium`}>
  62. <span className="line-clamp-1">{displayName}</span>
  63. </h2>
  64. <span
  65. className={`block mt-1 text-sm text-neutral-500 dark:text-neutral-400`}
  66. >
  67. @{jobName}
  68. </span>
  69. </div>
  70. </div>
  71. </Link>
  72. );
  73. };
  74. export default CardAuthorBox2;