|
1 | 1 | import styles from "./styles.module.css"; |
2 | 2 |
|
3 | 3 | export default function ProjectCard({ project }): JSX.Element { |
4 | | - const prefix = "project_picture_"; |
5 | | - const base = `${prefix}${project.name}` |
6 | | - return ( |
7 | | - <div className="row row--no-gutters"> |
8 | | - <div |
9 | | - className={"col col--6" + " " + styles.project_text} |
10 | | - > |
11 | | - <div className={styles.project_title}>{project.title}</div> |
12 | | - <div className={styles.project_description}> |
13 | | - <project.ProjectMD /> |
14 | | - </div> |
| 4 | + const picClass = styles[`project_picture_${project.name}`] ?? ""; |
| 5 | + const isReverse = project.reverse === "true"; |
| 6 | + |
| 7 | + const textCol = ( |
| 8 | + <div className={"col col--8 " + styles.project_text}> |
| 9 | + <div className={styles.project_title}>{project.title}</div> |
| 10 | + <div className={styles.project_description}> |
| 11 | + <project.ProjectMD /> |
15 | 12 | </div> |
16 | | - <div |
17 | | - className={ |
18 | | - "col col--6 flex-full-centered padding-none" + |
19 | | - " " + |
20 | | - styles[base] |
21 | | - } |
22 | | - > |
23 | | - <div className={styles.col_project_picture}></div> |
24 | | - <img |
25 | | - src={project.pictureRoute} |
26 | | - width={project.pictureWidth} |
27 | | - height={project.pictureHeight} |
28 | | - alt={project.pictureAltText} |
29 | | - /> |
| 13 | + </div> |
| 14 | + ); |
| 15 | + |
| 16 | + const imageCol = ( |
| 17 | + <div className="col col--4 flex-full-centered padding-none"> |
| 18 | + <div className={picClass}> |
| 19 | + <img |
| 20 | + src={project.pictureRoute} |
| 21 | + alt={project.pictureAltText} |
| 22 | + className={styles.project_logo} |
| 23 | + /> |
30 | 24 | </div> |
31 | 25 | </div> |
32 | 26 | ); |
| 27 | + |
| 28 | + return ( |
| 29 | + <div className="row row--no-gutters"> |
| 30 | + {isReverse ? <>{imageCol}{textCol}</> : <>{textCol}{imageCol}</>} |
| 31 | + </div> |
| 32 | + ); |
33 | 33 | } |
0 commit comments