Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 1 | import { Component } from "react"; |
pineafan | e0283a8 | 2022-02-13 10:05:56 +0000 | [diff] [blame] | 2 | import Styles from '../styles/Components/card.module.css'; |
pineafan | 5b612d9 | 2022-02-17 19:22:50 +0000 | [diff] [blame^] | 3 | import react from 'react' |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 4 | |
| 5 | class Card extends Component { |
| 6 | constructor(props) { |
| 7 | super(props); |
pineafan | 5b612d9 | 2022-02-17 19:22:50 +0000 | [diff] [blame^] | 8 | this.state = { |
| 9 | clicked: false, |
| 10 | } |
Samuel Shuert | 52f3777 | 2021-09-02 12:29:40 -0500 | [diff] [blame] | 11 | } |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 12 | |
| 13 | render() { |
| 14 | return ( |
pineafan | 5b612d9 | 2022-02-17 19:22:50 +0000 | [diff] [blame^] | 15 | <div className={Styles.card + " " + (this.state.clicked ? Styles.clicked : "")} style={{ |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 16 | margin: "0" |
pineafan | 5b612d9 | 2022-02-17 19:22:50 +0000 | [diff] [blame^] | 17 | }} onClick={() => { this.setState({clicked: !this.state.clicked}) }}> |
| 18 | <div className={Styles.backgroundGradient + " " + (this.state.clicked ? Styles.clicked : "")} style={{ |
pineafan | a841c76 | 2021-11-14 21:21:04 +0000 | [diff] [blame] | 19 | backgroundImage: `linear-gradient(69.44deg, #${this.props.gradient[0]} 0%, #${this.props.gradient[1]} 100%)` |
| 20 | }} /> |
| 21 | <img alt="" className={Styles.backgroundImage} src={`https://assets.clicksminuteper.net/web/waves/card/${this.props.wave}.svg`} draggable={false} /> |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 22 | <div className={Styles.panel}> |
| 23 | <div className={Styles.titleContainer}> |
pineafan | 5b612d9 | 2022-02-17 19:22:50 +0000 | [diff] [blame^] | 24 | <img alt="Project icon" className={Styles.image + " " + (this.state.clicked ? Styles.clicked : "")} src={"https://assets.clicksminuteper.net/" + (this.props.icon ? this.props.icon : this.props.wave) + ".svg"} /> |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 25 | <h1 className={Styles.title}>{this.props.title}</h1> |
| 26 | </div> |
| 27 | <p className={Styles.subtext}>{this.props.subtext}</p> |
| 28 | <div className={Styles.buttonLayout}> |
| 29 | { |
Samuel Shuert | 604e31d | 2021-09-02 16:06:20 -0500 | [diff] [blame] | 30 | this.props.buttons ? this.props.buttons.map((button, i) => { |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 31 | return <a |
Samuel Shuert | 604e31d | 2021-09-02 16:06:20 -0500 | [diff] [blame] | 32 | key={i} |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 33 | className={Styles.button} |
| 34 | style={{backgroundColor:`#${button.color}`, color:`#${this.props.buttonText}`}} |
Samuel Shuert | 52f3777 | 2021-09-02 12:29:40 -0500 | [diff] [blame] | 35 | href={button.link} |
pineafan | aed3024 | 2021-09-04 09:33:40 +0100 | [diff] [blame] | 36 | target={button.newTab ? "_blank" : undefined} |
pineafan | 0a17873 | 2022-02-09 21:00:05 +0000 | [diff] [blame] | 37 | rel="noreferrer">{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 | |
pineafan | 5b612d9 | 2022-02-17 19:22:50 +0000 | [diff] [blame^] | 48 | class CardRow extends Component { |
| 49 | constructor(props) { |
| 50 | super(props); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | render() { |
| 55 | return ( |
| 56 | <div className={Styles.container}> |
| 57 | { |
| 58 | react.Children.toArray(this.props.children).map((item, index) => { |
| 59 | return <div className={Styles.item} key={index}>{item}</div> |
| 60 | }) |
| 61 | } |
| 62 | </div> |
| 63 | ) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | export { Card, CardRow }; |