@helpwave/hightide
Version:
helpwave's component and theming library
162 lines (159 loc) • 6.44 kB
JavaScript
// src/components/Profile.tsx
import clsx3 from "clsx";
import Image from "next/image";
import Link from "next/link";
import { Github, Globe, Linkedin, Mail } from "lucide-react";
// src/components/icons/Helpwave.tsx
import { clsx } from "clsx";
import { jsx, jsxs } from "react/jsx-runtime";
var Helpwave = ({
color = "currentColor",
animate = "none",
size = 64,
...props
}) => {
const isLoadingAnimation = animate === "loading";
let svgAnimationKey = "";
if (animate === "pulse") {
svgAnimationKey = "animate-pulse";
} else if (animate === "bounce") {
svgAnimationKey = "animate-bounce";
}
if (size < 0) {
console.error("size cannot be less than 0");
size = 64;
}
return /* @__PURE__ */ jsx(
"svg",
{
width: size,
height: size,
viewBox: "0 0 888 888",
fill: "none",
strokeLinecap: "round",
strokeWidth: 48,
...props,
children: /* @__PURE__ */ jsxs("g", { className: clsx(svgAnimationKey), children: [
/* @__PURE__ */ jsx("path", { className: clsx({ "animate-wave-big-left-up": isLoadingAnimation }), d: "M144 543.235C144 423.259 232.164 326 340.92 326", stroke: color, strokeDasharray: "1000" }),
/* @__PURE__ */ jsx("path", { className: clsx({ "animate-wave-big-right-down": isLoadingAnimation }), d: "M537.84 544.104C429.084 544.104 340.92 446.844 340.92 326.869", stroke: color, strokeDasharray: "1000" }),
/* @__PURE__ */ jsx("path", { className: clsx({ "animate-wave-small-left-up": isLoadingAnimation }), d: "M462.223 518.035C462.223 432.133 525.348 362.495 603.217 362.495", stroke: color, strokeDasharray: "1000" }),
/* @__PURE__ */ jsx("path", { className: clsx({ "animate-wave-small-right-down": isLoadingAnimation }), d: "M745.001 519.773C666.696 519.773 603.218 450.136 603.218 364.233", stroke: color, strokeDasharray: "1000" })
] })
}
);
};
// src/components/ChipList.tsx
import clsx2 from "clsx";
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
var Chip = ({
children,
trailingIcon,
color = "default",
variant = "normal",
className = "",
...restProps
}) => {
const colorMapping = {
default: "text-tag-default-text bg-tag-default-background",
dark: "text-tag-dark-text bg-tag-dark-background",
red: "text-tag-red-text bg-tag-red-background",
yellow: "text-tag-yellow-text bg-tag-yellow-background",
green: "text-tag-green-text bg-tag-green-background",
blue: "text-tag-blue-text bg-tag-blue-background",
pink: "text-tag-pink-text bg-tag-pink-background"
}[color];
const colorMappingIcon = {
default: "text-tag-default-icon",
dark: "text-tag-dark-icon",
red: "text-tag-red-icon",
yellow: "text-tag-yellow-icon",
green: "text-tag-green-icon",
blue: "text-tag-blue-icon",
pink: "text-tag-pink-icon"
}[color];
return /* @__PURE__ */ jsxs2(
"div",
{
...restProps,
className: clsx2(
`row w-fit px-2 py-1`,
colorMapping,
{
"rounded-md": variant === "normal",
"rounded-full": variant === "fullyRounded"
},
className
),
children: [
children,
trailingIcon && /* @__PURE__ */ jsx2("span", { className: colorMappingIcon, children: trailingIcon })
]
}
);
};
// src/components/Profile.tsx
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
var SocialIcon = ({ type, url, size = 24 }) => {
let icon;
switch (type) {
case "mail":
icon = /* @__PURE__ */ jsx3(Mail, { size });
break;
case "linkedin":
icon = /* @__PURE__ */ jsx3(Linkedin, { size });
break;
case "github":
icon = /* @__PURE__ */ jsx3(Github, { size });
break;
case "website":
icon = /* @__PURE__ */ jsx3(Globe, { size });
break;
case "medium":
icon = /* @__PURE__ */ jsx3(Globe, { size });
break;
default:
icon = /* @__PURE__ */ jsx3(Helpwave, { size: 24 });
}
return /* @__PURE__ */ jsx3(Link, { href: url, target: "_blank", children: /* @__PURE__ */ jsx3(Chip, { color: "dark", className: "!p-2", children: icon }) });
};
var Profile = ({
name,
imageUrl,
badge,
prefix,
suffix,
roleBadge,
role,
tags,
info,
socials,
className,
imageClassName,
...divProps
}) => {
return /* @__PURE__ */ jsxs3(
"div",
{
...divProps,
className: clsx3(`col items-center text-center rounded-3xl p-3 pb-4 bg-white text-gray-900 w-min shadow-around-lg`, className),
children: [
/* @__PURE__ */ jsxs3("div", { className: "relative mb-6", children: [
/* @__PURE__ */ jsx3("div", { className: clsx3("relative rounded-xl row items-center justify-center overflow-hidden", imageClassName), children: /* @__PURE__ */ jsx3(Image, { src: imageUrl, alt: "", className: clsx3("z-[2] object-cover", imageClassName), width: 0, height: 0, style: { width: "auto", height: "auto" } }) }),
/* @__PURE__ */ jsx3("div", { className: "absolute top-[6px] left-[6px] z-[3]", children: badge }),
roleBadge && /* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-2/3 z-[4] rounded-md", children: /* @__PURE__ */ jsx3(Chip, { color: "dark", className: "font-bold px-3", children: roleBadge }) })
] }),
prefix && /* @__PURE__ */ jsx3("span", { className: "font-semibold", children: prefix }),
/* @__PURE__ */ jsx3("h2", { id: name, className: "textstyle-title-md", children: name }),
suffix && /* @__PURE__ */ jsx3("span", { className: "text-sm mb-1", children: suffix }),
role && /* @__PURE__ */ jsx3("span", { className: "font-space font-bold text-sm", children: role }),
tags && /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap mx-4 mt-2 gap-x-2 justify-center", children: tags.map((tag, index) => /* @__PURE__ */ jsx3("span", { className: "textstyle-description text-sm", children: `#${tag}` }, index)) }),
info && /* @__PURE__ */ jsx3("span", { className: "mt-2 text-sm", children: info }),
socials && /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap grow items-end justify-center gap-x-4 gap-y-2 mt-4", children: socials.map((socialIconProps, index) => /* @__PURE__ */ jsx3(SocialIcon, { ...socialIconProps, size: socialIconProps.size ?? 20 }, index)) })
]
}
);
};
export {
Profile
};
//# sourceMappingURL=Profile.mjs.map