-
-
Notifications
You must be signed in to change notification settings - Fork 16
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 #73 from KingDarBoja/feat/unit-description-card
Feat: Unit Description Card
- Loading branch information
Showing
6 changed files
with
91 additions
and
2 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,65 @@ | ||
import React from "react"; | ||
import { Flex, Image, Text, Title, Tooltip } from "@mantine/core"; | ||
|
||
/** | ||
* These fields can be found at `sbps` inside each unit object. | ||
* | ||
* Most locstrings and symbol / icons are within: | ||
* - `squadexts` -> `template_reference` which gives the group within the | ||
* Essence editor as `sbpextensions\\squad_ui_ext`. | ||
* - The sibling `race_list` contains a list with an object `race_data/info`. In this | ||
* object the locstring values can be found. | ||
* | ||
* Specific paths defined per property. | ||
*/ | ||
type UnitDescription = { | ||
/** Locstring value. Found at `screen_name/locstring/value`. */ | ||
screen_name: string; | ||
/** Locstring value. Found at `help_text/locstring/value`. */ | ||
help_text: string; | ||
/** Locstring value. Found at `brief_text/locstring/value`. */ | ||
brief_text: string; | ||
/** File path. Found at `symbol_icon_name`. */ | ||
symbol_icon_name: string; | ||
/** File path. Found at `icon_name`. */ | ||
icon_name: string; | ||
}; | ||
|
||
export const UnitDescriptionCard = (desc: UnitDescription) => ( | ||
<> | ||
<Flex direction="row" align="center" gap={16}> | ||
<Image | ||
width={96} | ||
height={96} | ||
fit="contain" | ||
src={`/icons/${desc.icon_name}.png`} | ||
alt={desc.screen_name} | ||
/> | ||
<Flex direction="column" gap={4}> | ||
<Title order={6} transform="capitalize" color="yellow.4"> | ||
{desc.help_text} | ||
</Title> | ||
<Tooltip label={desc.screen_name}> | ||
<Title order={4} transform="capitalize" lineClamp={1} color="dimmed"> | ||
{desc.screen_name} | ||
</Title> | ||
</Tooltip> | ||
{/* Symbol horizontal aligned with brief text. */} | ||
<Flex direction="row" align="center" gap={4}> | ||
<Image | ||
width={32} | ||
height={32} | ||
fit="contain" | ||
src={`/icons/${desc.symbol_icon_name}.png`} | ||
alt={`${desc.screen_name} symbol`} | ||
/> | ||
<Tooltip label={desc.brief_text}> | ||
<Text fz="xs" fw={700} lineClamp={2} color="dimmed"> | ||
{desc.brief_text} | ||
</Text> | ||
</Tooltip> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
</> | ||
); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.