blob: 00a2df49d30be393ef71c8c543de7d8f04bda976 [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'
pineafanff3d4522022-05-06 19:51:02 +01004import { withRouter } from "next/router";
Samuel Shuert016ea022021-09-01 16:17:24 -05005
6class Card extends Component {
7 constructor(props) {
8 super(props);
Samuel Shuert52f37772021-09-02 12:29:40 -05009 }
Samuel Shuert016ea022021-09-01 16:17:24 -050010
11 render() {
12 return (
pineafanff3d4522022-05-06 19:51:02 +010013 <div className={Styles.card} style={{
pineafana5ce9102021-09-02 17:21:31 +010014 margin: "0"
pineafanff3d4522022-05-06 19:51:02 +010015 }} onClick={this.props.url ? () => { this.props.router.push(this.props.url)} : null}>
16 <div className={Styles.backgroundGradient} style={{
pineafana841c762021-11-14 21:21:04 +000017 backgroundImage: `linear-gradient(69.44deg, #${this.props.gradient[0]} 0%, #${this.props.gradient[1]} 100%)`
18 }} />
pineafanff3d4522022-05-06 19:51:02 +010019 <img alt="" className={Styles.backgroundImage} src={`https://assets.clicks.codes/web/waves/card/${this.props.wave}.svg`} draggable={false} />
20 <div className={Styles.panel} onClick={() => { this.props.url ? () => { this.props.router.push(this.props.url)} : null}}>
pineafana5ce9102021-09-02 17:21:31 +010021 <div className={Styles.titleContainer}>
pineafanff3d4522022-05-06 19:51:02 +010022 <img alt="Project icon" className={Styles.image} src={"https://assets.clicks.codes/" + (this.props.icon ? this.props.icon : this.props.wave) + ".svg"} />
pineafana5ce9102021-09-02 17:21:31 +010023 <h1 className={Styles.title}>{this.props.title}</h1>
24 </div>
25 <p className={Styles.subtext}>{this.props.subtext}</p>
26 <div className={Styles.buttonLayout}>
27 {
Samuel Shuert604e31d2021-09-02 16:06:20 -050028 this.props.buttons ? this.props.buttons.map((button, i) => {
pineafan3b0852d2022-05-06 20:39:59 +010029 return <a
Samuel Shuert604e31d2021-09-02 16:06:20 -050030 key={i}
pineafana5ce9102021-09-02 17:21:31 +010031 className={Styles.button}
32 style={{backgroundColor:`#${button.color}`, color:`#${this.props.buttonText}`}}
Samuel Shuert52f37772021-09-02 12:29:40 -050033 href={button.link}
pineafanaed30242021-09-04 09:33:40 +010034 target={button.newTab ? "_blank" : undefined}
pineafan0a178732022-02-09 21:00:05 +000035 rel="noreferrer">{button.text}
pineafan3b0852d2022-05-06 20:39:59 +010036 </a>
pineafana5ce9102021-09-02 17:21:31 +010037 }) : null
38 }
39 </div>
Samuel Shuert016ea022021-09-01 16:17:24 -050040 </div>
41 </div>
pineafanff3d4522022-05-06 19:51:02 +010042 );
43 }
Samuel Shuert016ea022021-09-01 16:17:24 -050044}
45
pineafan5b612d92022-02-17 19:22:50 +000046class CardRow extends Component {
47 constructor(props) {
48 super(props);
49 }
50
pineafan5b612d92022-02-17 19:22:50 +000051 render() {
52 return (
53 <div className={Styles.container}>
54 {
55 react.Children.toArray(this.props.children).map((item, index) => {
56 return <div className={Styles.item} key={index}>{item}</div>
57 })
58 }
59 </div>
60 )
61 }
62}
63
pineafanff3d4522022-05-06 19:51:02 +010064Card = withRouter(Card);
65
66export { Card, CardRow };