diff --git a/src/components/Header/Cart.component.tsx b/src/components/Header/Cart.component.tsx index f8690540d..a3beaaede 100644 --- a/src/components/Header/Cart.component.tsx +++ b/src/components/Header/Cart.component.tsx @@ -50,7 +50,7 @@ const Cart = ({ stickyNav }: ICartProps) => { {productCount && ( {productCount} diff --git a/src/components/Index/Hero.component.tsx b/src/components/Index/Hero.component.tsx index fb324273c..d2cfdd4f4 100644 --- a/src/components/Index/Hero.component.tsx +++ b/src/components/Index/Hero.component.tsx @@ -1,5 +1,5 @@ import Image from 'next/image'; -import Link from 'next/link'; +import Button from '../UI/Button.component'; /** * Renders Hero section for Index page @@ -25,12 +25,12 @@ const Hero = () => (

Stripete Zig Zag Pute Sett

- Se Utvalget - + diff --git a/src/components/UI/Button.component.tsx b/src/components/UI/Button.component.tsx index 2883d8c34..c73cd162d 100644 --- a/src/components/UI/Button.component.tsx +++ b/src/components/UI/Button.component.tsx @@ -1,4 +1,5 @@ import { ReactNode } from 'react'; +import Link from 'next/link'; type TButtonColors = 'red' | 'blue'; @@ -8,6 +9,8 @@ interface IButtonProps { color?: TButtonColors; children: ReactNode; fullWidth?: boolean; + isHero?: boolean; + href?: string; } /** @@ -26,21 +29,41 @@ const Button = ({ color = 'blue', children, fullWidth = false, -}: IButtonProps) => ( - -); + isHero = false, + href, +}: IButtonProps) => { + const getColorClasses = (buttonColor: TButtonColors) => { + if (buttonColor === 'blue') { + return 'bg-blue-500 hover:bg-blue-600'; + } + return 'bg-red-500 hover:bg-red-600'; + }; + + const buttonClasses = isHero + ? 'inline-block px-8 py-4 text-sm tracking-wider uppercase bg-white bg-opacity-90 text-gray-900 hover:bg-gray-400 hover:bg-opacity-95 hover:text-white hover:shadow-md' + : `px-2 lg:px-4 py-2 font-bold border border-gray-400 border-solid rounded text-white ${getColorClasses(color)}`; + + const classes = `${buttonClasses} ease-in-out transition-all duration-300 disabled:opacity-50 ${ + fullWidth ? 'w-full md:w-auto' : '' + }`; + + if (href && isHero) { + return ( + + {children} + + ); + } + + return ( + + ); +}; export default Button;