Skip to content

Commit 2f0e255

Browse files
committed
improve look of active tile in mahjong
1 parent 74ea76a commit 2f0e255

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/components/mahjongTile.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ export default function MahjongTile({ tile, x, y, imageUrl, active, onClick }) {
88
onClick={() => onClick(tile)}
99
className="mahjong-tile"
1010
style={{
11-
border: active ? '2px solid red' : 'none',
12-
margin: active ? 0 : 2,
1311
zIndex: 999 + tile.layer,
1412
top: y,
1513
left: x
@@ -19,8 +17,28 @@ export default function MahjongTile({ tile, x, y, imageUrl, active, onClick }) {
1917
draggable={false}
2018
src={imageUrl}
2119
alt={getTileFriendlyName(tile)}
22-
style={{ height: 64 }}
20+
style={{ height: 64, position: 'absolute' }}
2321
/>
22+
{active && (
23+
<svg
24+
width={53}
25+
height={64}
26+
viewBox="0 0 53 64"
27+
style={{ zIndex: 10000 }}
28+
>
29+
<rect
30+
x={0}
31+
y={0}
32+
height={64}
33+
width={53}
34+
fill="#ff0000"
35+
fillOpacity={0.4}
36+
stroke="#ff0000"
37+
strokeWidth={2}
38+
rx={8}
39+
/>
40+
</svg>
41+
)}
2442
</button>
2543
);
2644
}

src/components/mahjongTile.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.mahjong-tile {
2+
display: flex;
23
position: absolute;
34
background: none;
45
user-select: none;
5-
border-radius: 8px;
6+
border: none;
67
padding: 0;
78
}

0 commit comments

Comments
 (0)