Skip to content

Commit 1dd57da

Browse files
committed
Revert "Push new inprogress pygame powered section"
This reverts commit 64c831b.
1 parent 64c831b commit 1dd57da

File tree

4 files changed

+54
-18
lines changed

4 files changed

+54
-18
lines changed

src/components/powered-card.tsx

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

43
export default function PoweredCard(props: any) {
54
return (
6-
<div className={styles.card} style={{ backgroundImage: `url(${props.image})` }}>
5+
<div className={styles.card}>
76
<a href={props.link}>
87
<div className={styles.name}>{props.name}</div>
98
<div className={styles.author}>{props.author}</div>

src/components/powered.tsx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,43 @@ 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 });
5362
}
5463

5564
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+
5675
return (
57-
<div className={styles.powered}>
58-
<div>
76+
<div
77+
className={styles.powered}
78+
style={{
79+
backgroundImage: `url(${currentGame.image})`,
80+
}}
81+
>
82+
<div className={styles.poweredcontainer}>
5983
<div className={styles.header}>Pygame Powered</div>
6084
Over the many years pygame has been around, there have been amazing projects created by the community.
6185
<div className={styles.poweredcards}>
6286
{games.map((data, key) => {
6387
return (
64-
<div key={key}>
65-
<PoweredCard name={data.name} author={data.author} link={data.mainlink} image={data.image} />
88+
<div key={key} onMouseEnter={this.changeBackground} data-info={key}>
89+
<PoweredCard name={data.name} author={data.author} link={data.mainlink} />
6690
</div>
6791
);
6892
})}

src/styles/powered-card.module.css

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

96
.card:hover {
@@ -15,9 +12,4 @@
1512
.name {
1613
font-size: 1.5rem;
1714
font-weight: 700;
18-
display: none;
19-
}
20-
21-
.author {
22-
display: none;
2315
}

src/styles/powered.module.css

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
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;
517
}
618

719
.header {
@@ -10,7 +22,16 @@
1022
}
1123

1224
.poweredcards {
13-
display: grid;
14-
grid-template-columns: repeat(3, 1fr);
25+
display: flex;
1526
justify-content: center;
1627
}
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)