blob: bab61536661ff6deea21d77298590a2bb318a8b8 [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 {
pineafanaa9c4fd2022-06-10 19:58:10 +01007 constructor(props) {
8 super(props);
Samuel Shuert52f37772021-09-02 12:29:40 -05009 }
Samuel Shuert016ea022021-09-01 16:17:24 -050010
pineafanaa9c4fd2022-06-10 19:58:10 +010011 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) => {
pineafana5ce9102021-09-02 17:21:31 +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}
pineafana5ce9102021-09-02 17:21:31 +010036 </a>
37 }) : 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 {
pineafanaa9c4fd2022-06-10 19:58:10 +010047 constructor(props) {
48 super(props);
49 }
pineafan5b612d92022-02-17 19:22:50 +000050
pineafanaa9c4fd2022-06-10 19:58:10 +010051 render() {
52 return (
pineafan5b612d92022-02-17 19:22:50 +000053 <div className={Styles.container}>
pineafanaa9c4fd2022-06-10 19:58:10 +010054 {
55 react.Children.toArray(this.props.children).map((item, index) => {
56 return <div className={Styles.item} key={index}>{item}</div>
57 })
58 }
59 </div>
pineafan5b612d92022-02-17 19:22:50 +000060 )
pineafanaa9c4fd2022-06-10 19:58:10 +010061 }
pineafan5b612d92022-02-17 19:22:50 +000062}
63
pineafanff3d4522022-05-06 19:51:02 +010064Card = withRouter(Card);
65
66export { Card, CardRow };