-
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.
* Change code order Change the code order to match the order of items as they appear in the UI from left to right. * Add "Your faction has X secrets" text * Remove "Secret" from secret items Remove the word "Secret" from individual secrets shown in the secrets list, since it's already obvious that the item is a secret. * Improve the faction part of the meta section Change the "Playing as the X Faction" part of the meta section to look better and add two faction attributes here: votes and secrets. Create a new component `AttributeFlex`, which is similar to `AttributeGrid` except it's a flex rather than a grid. This introduces no new stuff, but is an extraction of some code that was already in `FactionListItem`. The purpose of the extraction is for use in the `MetaSection` in addition to the existing use in `FactionListItem`. * Add conditional "Your" to faction description Make the faction details description start out with "Your Faction..." if the selected faction is controlled by the user.
- Loading branch information
Showing
5 changed files
with
126 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Image from "next/image" | ||
import { Tooltip } from "@mui/material" | ||
import { capitalize } from "@mui/material/utils" | ||
|
||
export interface Attribute { | ||
name: string | ||
value: number | ||
icon: string | ||
} | ||
|
||
interface AttributeGridProps { | ||
attributes: Attribute[] | ||
} | ||
|
||
const AttributeFlex = ({ attributes }: AttributeGridProps) => { | ||
// Get attribute items | ||
const getAttributeItem = (item: Attribute, index: number) => { | ||
const titleCaseName = capitalize(item.name) | ||
return ( | ||
<Tooltip key={index} title={titleCaseName} enterDelay={500} arrow> | ||
<div className="w-[64px] grid grid-cols-[30px_30px] items-center justify-center bg-white shadow-[0px_0px_2px_2px_white] rounded"> | ||
<Image | ||
src={item.icon} | ||
height={28} | ||
width={28} | ||
alt={`${titleCaseName} icon`} | ||
/> | ||
<div className="w-8 text-center text-md font-semibold"> | ||
{item.value.toString()} | ||
</div> | ||
</div> | ||
</Tooltip> | ||
) | ||
} | ||
|
||
return ( | ||
<div className="p-[2px] flex flex-wrap gap-3 select-none"> | ||
{attributes.map((attribute: Attribute, index) => | ||
getAttributeItem(attribute, index) | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export default AttributeFlex |
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
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