import { Component } from "react";
import Styles from '../styles/header.module.css';
import Head from 'next/head';

class Header extends Component {
    constructor(props) {
        super(props);
        this.keys = []
    }

    render() {
        return (
            <div className={Styles.header} style={{
                margin: "0"
            }} id={this.props.id ? this.props.id : null}>
                <div className={Styles.backgroundGradient} style={{
                    backgroundImage: `linear-gradient(69.44deg, #${this.props.gradient[0]} 0%, #${this.props.gradient[1]} 100%)`,
                }} />
                <Head>
                    <title>{this.props.nameOverwrite ? this.props.nameOverwrite : this.props.name} - Clicks Minute Per</title>
                    <meta name="title" content={this.props.name} />
                    <meta name="og:title" content={this.props.name} />
                    <meta name="description" content={this.props.subtext} />
                    <meta name="og:description" content={this.props.subtext} />
                    <meta name="theme-color" content={"#" + this.props.gradient[1]} />
                    <meta name="og:theme-color" content={"#" + this.props.gradient[1]} />
                    <meta name="author" content="Clicks Minute Per" />
                    <meta name="og:author" content="Clicks Minute Per" />
                </Head>
                <img draggable={false} alt="" className={Styles.backgroundImage} src={`https://assets.clicksminuteper.net/${this.props.wave}.svg`} />
                <div className={Styles.panel}>
                    <div className={Styles.titleContainer}>
                        <h1 className={Styles.title}>{this.props.name}</h1>
                    </div>
                    <p className={Styles.subtext + " " + (this.props.buttons.length ? Styles.subtextExtra : null)}>{this.props.subtext}</p>
                    <div className={Styles.buttonLayout}>
                        {
                            this.props.buttons ? this.props.buttons.map((button, index) => {
                                return <a
                                    key={index}
                                    className={Styles.button}
                                    style={{ backgroundColor: `#${button.color}`, color: `#${button.buttonText}` }}
                                    href={button.link}
                                    target={button.target ? "_blank" : null}
                                    rel="noopener">
                                    {button.text}
                                </a>
                            }) : null
                        }
                    </div>
                </div>
                <span className={Styles.arrowSpan + " " + (this.props.hideArrow ? Styles.arrowHidden : null)} draggable={false}>
                    <a href="#start" draggable={false}><img alt="Down arrow" src="https://assets.clicksminuteper.net/web/icons/arrow.svg" className={Styles.arrow} draggable={false} style={{
                        height: "49px", width: "87px"
                    }}/></a>
                </span>
            </div>
        )
    }
}

export default Header;