diff --git a/assets/icons/ui/ArrowRight.tsx b/assets/icons/ui/ArrowRight.tsx new file mode 100644 index 0000000..57edcbb --- /dev/null +++ b/assets/icons/ui/ArrowRight.tsx @@ -0,0 +1,26 @@ +import { IArrowRightProps } from "./ArrowRight.types"; + +const ArrowRight = ({ + strokeWidth, + stroke, + addClassName, +}: IArrowRightProps) => ( + +); + +export default ArrowRight; + diff --git a/assets/icons/ui/ArrowRight.types.ts b/assets/icons/ui/ArrowRight.types.ts new file mode 100644 index 0000000..d89cf5c --- /dev/null +++ b/assets/icons/ui/ArrowRight.types.ts @@ -0,0 +1,8 @@ +interface IArrowRightProps { + stroke: string; + strokeWidth: string; + addClassName?: string; +} + +export type { IArrowRightProps }; + diff --git a/components/BlogCard/BlogCard.tsx b/components/BlogCard/BlogCard.tsx index 6cc6ed2..6e0ffa3 100644 --- a/components/BlogCard/BlogCard.tsx +++ b/components/BlogCard/BlogCard.tsx @@ -1,5 +1,9 @@ +"use server"; + import { memo } from "react"; import Image from "next/image"; +import ArrowRight from "@/assets/icons/ui/ArrowRight"; +import { formatButtonVariantClassName } from "@/lib/utils/formatting"; import { ITagProps, IBlogCardProps, IButtonProps } from "./BlogCard.types"; const Tag: React.FC = ({ tag }) => ( @@ -14,31 +18,30 @@ const Button: React.FC = ({ children, variant = "primary", ...rest -}) => ( - -); + + ); +}; const BlogCard: React.FC = memo( ({ imageUrl, tags, title, description }) => ( @@ -47,7 +50,9 @@ const BlogCard: React.FC = memo( A picture for the blog post diff --git a/lib/utils/formatting.ts b/lib/utils/formatting.ts index 13719cd..af7b866 100644 --- a/lib/utils/formatting.ts +++ b/lib/utils/formatting.ts @@ -1,5 +1,5 @@ /** - * + * * @param firstName The first name of the user * @param lastName The last name of the user * @returns A formatted full name with proper capitalization @@ -13,4 +13,28 @@ const formatFullName = (firstName: string, lastName: string): string => { return `${capitalizedFirstName} ${capitalizedLastName}`; }; -export { formatFullName }; +/** + * + * @param variant The variant of the button + * @param baseClasses The base classes for the button + * @param addClassName Additional classes to add to the button (optional) + * @returns A formatted className for the button based on the variant + */ + +const formatButtonVariantClassName = ( + variant: string, + baseClasses: string, + addClassName?: string +): string => { + switch (variant) { + case "primary": + return `${baseClasses} hover:cursor-pointer text-indigo-700 hover:text-custom-indigo-hover focus:ring-violet-200 focus:ring focus:outline-none rounded-md ${addClassName ? addClassName : ""}`; + case "disabled": + return `${baseClasses} hover:cursor-default text-custom-slate-disabled ${addClassName ? addClassName : ""}`; + default: + return `${baseClasses} ${addClassName ? addClassName : ""}`; + } +}; + +export { formatFullName, formatButtonVariantClassName }; + diff --git a/tailwind.config.ts b/tailwind.config.ts index 81c4632..fc2ccd1 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -4,6 +4,8 @@ const config: Config = { content: [ "./components/**/*.{js,ts,jsx,tsx,mdx}", "./app/**/*.{js,ts,jsx,tsx,mdx}", + "./assets/**/*.{js,ts,jsx,tsx,mdx}", + "./lib/**/*.{js,ts,jsx,tsx,mdx}", ], theme: { extend: { @@ -14,6 +16,10 @@ const config: Config = { }, fontFamily: { "noto-sans": ["Noto Sans", "sans-serif"], + }, + colors: { + "custom-indigo-hover": "#3730A3", + "custom-slate-disabled": "#A3A3A3", } }, },