-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from frudolph77/showCryptCardLabel
show ID,Symbol,Color of Verification/Crypt Card
- Loading branch information
Showing
8 changed files
with
154 additions
and
99 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Typography from "@mui/material/Typography"; | ||
import { FC } from "react"; | ||
import { CryptCard } from "../hooks/useCriteriaCard"; | ||
|
||
type CryptCardProps = { | ||
card?: CryptCard; | ||
}; | ||
|
||
const CryptCardLabel: FC<CryptCardProps> = (props) => { | ||
const {card} = props; | ||
// `${color <= 2 ? "black" : "white"}` // contrast | ||
return (!card) ? <></> : | ||
<Typography | ||
component="span" | ||
fontSize="12px" | ||
fontFamily={"Plus Jakarta Sans"} | ||
p={0.25} | ||
px={1} | ||
sx={(theme) => ({ | ||
color: "black", | ||
background: `${["#2db563", "#febc12", "#58b3da", "#7f66ad"][card.color]}`, | ||
borderTopRightRadius: "8px", | ||
borderBottomLeftRadius: "8px", | ||
height: "min-content", | ||
})} | ||
> | ||
{card.id} {['◊', '#', '/', '¤'][card.color]} | ||
</Typography> | ||
}; | ||
|
||
export default CryptCardLabel; |
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,55 @@ | ||
import { CriteriaCard } from "../hooks/useCriteriaCard"; | ||
import { Letter } from "../store/slices/commentsSlice"; | ||
import { FC } from "react"; | ||
import { useTheme } from "@mui/material/styles"; | ||
import Box from "@mui/material/Box"; | ||
import IconButton from "@mui/material/IconButton"; | ||
import SingleCharLabel from "./SingleCharLabel"; | ||
import Incorrect from "@mui/icons-material/HorizontalRuleRounded"; | ||
|
||
type LettersProps = { | ||
card: Undefinable<CriteriaCard>; | ||
verifier: Verifier; | ||
letters: Undefinable<Letter[]> | ||
toggleLetter: (verifier: Verifier) => void; | ||
}; | ||
|
||
const Letters: FC<LettersProps> = ({card, verifier, letters, toggleLetter}) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
!card?.nightmare ? <></> : | ||
<Box display={"flex"} justifyContent={"center"}> | ||
{letters?.map((letter) => ( | ||
<Box key={letter.letter} position="relative"> | ||
<IconButton | ||
id={`digit-code__${verifier}-${letter.letter}-button`} | ||
color="primary" | ||
sx={{ | ||
height: theme.spacing(6), | ||
width: theme.spacing(6), | ||
}} | ||
onClick={() => toggleLetter(letter.letter)} | ||
> | ||
<SingleCharLabel>{letter.letter}</SingleCharLabel> | ||
<Box | ||
position="absolute" | ||
top={4} | ||
left={4} | ||
sx={{color: theme.palette.text.primary}} | ||
> | ||
{letter.isIrrelevant && ( | ||
<Incorrect | ||
fontSize="large" | ||
sx={{transform: "rotate(-45deg)"}} | ||
/> | ||
)} | ||
</Box> | ||
</IconButton> | ||
</Box> | ||
))} | ||
</Box> | ||
) | ||
} | ||
|
||
export default Letters; |
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 { FC } from "react"; | ||
import Box from "@mui/material/Box"; | ||
import SingleCharLabel from "./SingleCharLabel"; | ||
import { CriteriaCard } from "../hooks/useCriteriaCard"; | ||
|
||
type VerifierProps = { | ||
card: Undefinable<CriteriaCard>; | ||
verifier: Verifier; | ||
}; | ||
|
||
const VerifierLabel: FC<VerifierProps> = ({card, verifier}) => { | ||
|
||
return ( | ||
card?.nightmare ? <></> : | ||
<Box | ||
zIndex={1} | ||
px={2} | ||
sx={(theme) => ({ | ||
background: theme.palette.primary.main, | ||
color: theme.palette.common.white, | ||
borderTopLeftRadius: theme.spacing(1), | ||
borderBottomRightRadius: theme.spacing(3), | ||
})} | ||
> | ||
<SingleCharLabel white>{verifier}</SingleCharLabel> | ||
</Box> | ||
) | ||
} | ||
|
||
export default VerifierLabel; |
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