-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Implement remove game feature (#9)
* ✨ Implement remove game feature * 🐛 Fix translation of success msg and category reset when lang changed
- Loading branch information
1 parent
850da6d
commit 12c9f4f
Showing
19 changed files
with
425 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
befffd863be894f9d2020ecf996aa7d3 | ||
91d42f500b55f4558761a99b0a09d77d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
|
||
function Emoji({ children, ariaLabel }) { | ||
return ( | ||
<span className="emoji" role="img" aria-label={ariaLabel}> | ||
{children} | ||
</span> | ||
); | ||
} | ||
|
||
export default Emoji; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
import Emoji from "./Emoji"; | ||
import "./GameList.scss"; | ||
|
||
const getClassName = (g) => { | ||
let className = ""; | ||
if (!g.hsk) className += "unsaved "; | ||
if (g.deleted) className += "mark-deleted"; | ||
return className; | ||
}; | ||
|
||
function GameList({ games, onToggleDelete }) { | ||
return ( | ||
<div className="ListBox"> | ||
<ul role="listbox"> | ||
{games.map((g, i) => ( | ||
<li key={`${g.filename}${g.srcPath}${g.id}`} className={getClassName(g)}> | ||
{g.name} | ||
<button className="delete-btn btn btn-sm" onClick={onToggleDelete(i)}> | ||
<span className="emoji" role="img" aria-label="delete icon"></span> | ||
<Emoji ariaLabel="delete icon">{g.deleted ? "✅" : "❌"}</Emoji> | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default GameList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@import "variables.scss"; | ||
|
||
.ListBox { | ||
position: relative; | ||
border: 0.1rem solid var(--color-border-secondary); | ||
border-radius: 0.5em; | ||
> ul { | ||
margin: 0; | ||
overflow: auto; | ||
height: 14.4rem; | ||
> li { | ||
list-style: none; | ||
padding: 0 1rem; | ||
height: 2.4rem; | ||
line-height: 2.4rem; | ||
position: relative; | ||
z-index: 10000; | ||
|
||
&.unsaved { | ||
font-weight: 700; | ||
color: var(--color-gh-blue); | ||
position: relative; | ||
&::before { | ||
content: "* "; | ||
position: absolute; | ||
left: 0; | ||
padding: 0.2rem; | ||
} | ||
} | ||
|
||
&.mark-deleted { | ||
text-decoration: line-through; | ||
color: var(--color-text-disabled); | ||
} | ||
|
||
> .delete-btn { | ||
visibility: hidden; | ||
position: absolute; | ||
right: 2em; | ||
top: 0.5em; | ||
} | ||
|
||
&:hover { | ||
background-color: var(--color-gh-blue); | ||
color: white; | ||
> .delete-btn { | ||
visibility: visible; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.