Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 1 | import { Component } from "react"; |
| 2 | import Styles from '../styles/card.module.css'; |
| 3 | |
| 4 | class Card extends Component { |
| 5 | constructor(props) { |
| 6 | super(props); |
Samuel Shuert | 52f3777 | 2021-09-02 12:29:40 -0500 | [diff] [blame^] | 7 | this.keys = [] |
| 8 | } |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 9 | |
Samuel Shuert | 52f3777 | 2021-09-02 12:29:40 -0500 | [diff] [blame^] | 10 | nextKey() { |
| 11 | let n = this.keys.length |
| 12 | this.keys.push(n); |
| 13 | return n |
| 14 | } |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 15 | |
| 16 | render() { |
| 17 | return ( |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 18 | <div className={Styles.card} style={{ |
| 19 | backgroundImage:`linear-gradient(69.44deg, #${this.props.gradient[0]} 0%, #${this.props.gradient[1]} 100%)`, |
| 20 | margin: "0" |
| 21 | }}> |
| 22 | <img className={Styles.backgroundImage} src={`/Waves/${this.props.wave}.svg`} /> |
| 23 | <div className={Styles.panel}> |
| 24 | <div className={Styles.titleContainer}> |
| 25 | <img className={Styles.image} src={"/Icons/" + this.props.wave + ".svg"} /> |
| 26 | <h1 className={Styles.title}>{this.props.title}</h1> |
| 27 | </div> |
| 28 | <p className={Styles.subtext}>{this.props.subtext}</p> |
| 29 | <div className={Styles.buttonLayout}> |
| 30 | { |
| 31 | this.props.buttons ? this.props.buttons.map(button => { |
| 32 | return <a |
Samuel Shuert | 52f3777 | 2021-09-02 12:29:40 -0500 | [diff] [blame^] | 33 | key={this.nextKey()} |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 34 | className={Styles.button} |
| 35 | style={{backgroundColor:`#${button.color}`, color:`#${this.props.buttonText}`}} |
Samuel Shuert | 52f3777 | 2021-09-02 12:29:40 -0500 | [diff] [blame^] | 36 | href={button.link} |
| 37 | target={button.newTab ? "_blank" : undefined}>{button.text} |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 38 | </a> |
| 39 | }) : null |
| 40 | } |
| 41 | </div> |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 42 | </div> |
| 43 | </div> |
| 44 | ) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | export default Card; |