blob: 0673883e748f27dbe4ce09975074de3561018151 [file] [log] [blame]
Samuel Shuert016ea022021-09-01 16:17:24 -05001import { Component } from "react";
pineafane0283a82022-02-13 10:05:56 +00002import Styles from '../styles/Components/card.module.css';
pineafan5b612d92022-02-17 19:22:50 +00003import react from 'react'
Samuel Shuert016ea022021-09-01 16:17:24 -05004
5class Card extends Component {
6 constructor(props) {
7 super(props);
pineafan5b612d92022-02-17 19:22:50 +00008 this.state = {
9 clicked: false,
10 }
Samuel Shuert52f37772021-09-02 12:29:40 -050011 }
Samuel Shuert016ea022021-09-01 16:17:24 -050012
13 render() {
14 return (
pineafan5b612d92022-02-17 19:22:50 +000015 <div className={Styles.card + " " + (this.state.clicked ? Styles.clicked : "")} style={{
pineafana5ce9102021-09-02 17:21:31 +010016 margin: "0"
pineafan5b612d92022-02-17 19:22:50 +000017 }} onClick={() => { this.setState({clicked: !this.state.clicked}) }}>
18 <div className={Styles.backgroundGradient + " " + (this.state.clicked ? Styles.clicked : "")} style={{
pineafana841c762021-11-14 21:21:04 +000019 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} />
pineafana5ce9102021-09-02 17:21:31 +010022 <div className={Styles.panel}>
23 <div className={Styles.titleContainer}>
pineafan5b612d92022-02-17 19:22:50 +000024 <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"} />
pineafana5ce9102021-09-02 17:21:31 +010025 <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 Shuert604e31d2021-09-02 16:06:20 -050030 this.props.buttons ? this.props.buttons.map((button, i) => {
pineafana5ce9102021-09-02 17:21:31 +010031 return <a
Samuel Shuert604e31d2021-09-02 16:06:20 -050032 key={i}
pineafana5ce9102021-09-02 17:21:31 +010033 className={Styles.button}
34 style={{backgroundColor:`#${button.color}`, color:`#${this.props.buttonText}`}}
Samuel Shuert52f37772021-09-02 12:29:40 -050035 href={button.link}
pineafanaed30242021-09-04 09:33:40 +010036 target={button.newTab ? "_blank" : undefined}
pineafan0a178732022-02-09 21:00:05 +000037 rel="noreferrer">{button.text}
pineafana5ce9102021-09-02 17:21:31 +010038 </a>
39 }) : null
40 }
41 </div>
Samuel Shuert016ea022021-09-01 16:17:24 -050042 </div>
43 </div>
44 )
45 }
46}
47
pineafan5b612d92022-02-17 19:22:50 +000048class 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
67export { Card, CardRow };