Skip to content

Commit 64c831b

Browse files
committed
Push new inprogress pygame powered section
1 parent 6ef7708 commit 64c831b

File tree

4 files changed

+18
-54
lines changed

4 files changed

+18
-54
lines changed

src/components/powered-card.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import styles from '@/styles/powered-card.module.css';
2+
import Image from 'next/image';
23

34
export default function PoweredCard(props: any) {
45
return (
5-
<div className={styles.card}>
6+
<div className={styles.card} style={{ backgroundImage: `url(${props.image})` }}>
67
<a href={props.link}>
78
<div className={styles.name}>{props.name}</div>
89
<div className={styles.author}>{props.author}</div>

src/components/powered.tsx

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,43 +50,19 @@ const games = [
5050
class Powered extends React.Component<any, any> {
5151
constructor(props: any) {
5252
super(props);
53-
this.state = {
54-
currentGameId: 0,
55-
};
56-
this.changeBackground = this.changeBackground.bind(this);
57-
}
58-
59-
changeBackground(e: any) {
60-
const data = Object.assign({}, e.target.dataset);
61-
this.setState({ currentGameId: data.info });
6253
}
6354

6455
render() {
65-
// TODO: clean this up
66-
if (this.state.currentGameId === undefined) {
67-
this.setState({ currentGameId: 0 });
68-
}
69-
70-
var currentGame = games[this.state.currentGameId];
71-
if (currentGame === undefined) {
72-
currentGame = games[0];
73-
}
74-
7556
return (
76-
<div
77-
className={styles.powered}
78-
style={{
79-
backgroundImage: `url(${currentGame.image})`,
80-
}}
81-
>
82-
<div className={styles.poweredcontainer}>
57+
<div className={styles.powered}>
58+
<div>
8359
<div className={styles.header}>Pygame Powered</div>
8460
Over the many years pygame has been around, there have been amazing projects created by the community.
8561
<div className={styles.poweredcards}>
8662
{games.map((data, key) => {
8763
return (
88-
<div key={key} onMouseEnter={this.changeBackground} data-info={key}>
89-
<PoweredCard name={data.name} author={data.author} link={data.mainlink} />
64+
<div key={key}>
65+
<PoweredCard name={data.name} author={data.author} link={data.mainlink} image={data.image} />
9066
</div>
9167
);
9268
})}

src/styles/powered-card.module.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.card {
2-
margin: 20px;
3-
padding: 15px;
2+
width: 384px;
3+
height: 208px;
4+
background-position: center center;
5+
background-repeat: no-repeat;
6+
background-size: cover;
47
}
58

69
.card:hover {
@@ -12,4 +15,9 @@
1215
.name {
1316
font-size: 1.5rem;
1417
font-weight: 700;
18+
display: none;
19+
}
20+
21+
.author {
22+
display: none;
1523
}

src/styles/powered.module.css

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22
display: flex;
33
justify-content: center;
44
align-items: center;
5-
min-height: 80vh;
6-
background-color: grey;
7-
background-blend-mode: multiply;
8-
background-repeat: no-repeat;
9-
background-position: center center;
10-
background-size: cover;
11-
image-rendering: crisp-edges;
12-
}
13-
14-
.poweredcontainer {
15-
width: 1200px;
16-
max-width: 90vw;
175
}
186

197
.header {
@@ -22,16 +10,7 @@
2210
}
2311

2412
.poweredcards {
25-
display: flex;
13+
display: grid;
14+
grid-template-columns: repeat(3, 1fr);
2615
justify-content: center;
2716
}
28-
29-
@media only screen and (max-width: 950px) {
30-
.poweredcards {
31-
display: block;
32-
}
33-
.powered {
34-
padding-top: 50px;
35-
padding-bottom: 50px;
36-
}
37-
}

0 commit comments

Comments
 (0)