From 56b5c9eb4a78b0e3bae6724440b91e105b4e12d2 Mon Sep 17 00:00:00 2001 From: carlos-kryha <97608823+carlos-kryha@users.noreply.github.com> Date: Fri, 17 Nov 2023 09:26:26 +0100 Subject: [PATCH] Remove text transformations when displaying character names (#96) KREAd is designed to keep character names unique, but the frontend applies text-transformations (capitalizes first letter) to character names. Since names are case-sensitive, this can lead to confusion when displaying character names that differ only in casing (eg Test vs test). This pr removes text-transformation css in components that display character names. --------- Co-authored-by: Privilege Mendes <20317699+privilegemendes@users.noreply.github.com> Co-authored-by: Axel Verheul Co-authored-by: Xabier <146219902+snthtcs@users.noreply.github.com> Co-authored-by: Xabier Almazor Co-authored-by: Xabier Almazor Co-authored-by: Wietze Co-authored-by: Xabier Almazor Telek Co-authored-by: Nick K Co-authored-by: Nick Koster Co-authored-by: Pandelis Symeonidis Co-authored-by: Pandelis Symeonidis <54764628+Pandelissym@users.noreply.github.com> Co-authored-by: MangoDream1 Co-authored-by: Synthetics Co-authored-by: Synthetics --- .../components/asset-card/item-card-inventory.tsx | 2 +- frontend/src/components/asset-card/styles.ts | 3 --- frontend/src/components/atoms/text.ts | 13 +++++++------ .../character-detail/character-detail.tsx | 2 +- .../components/shop-card/character-shop-card.tsx | 4 ++-- frontend/src/components/shop-card/styles.ts | 5 +++++ .../canvas/character-cards/character-cards.tsx | 3 ++- .../containers/canvas/character-cards/styles.ts | 10 ++++++++++ .../detail-section-header.tsx | 2 +- frontend/src/pages/buy/confirmation.tsx | 5 ++--- frontend/src/pages/buy/styles.ts | 7 +++++++ .../src/pages/create-character/confirmation.tsx | 2 +- frontend/src/pages/landing/landing.tsx | 5 +++-- frontend/src/pages/landing/styles.ts | 9 ++++++++- frontend/src/pages/sell/confirmation.tsx | 11 ++--------- frontend/src/pages/sell/information.tsx | 4 ++-- frontend/src/pages/sell/styles.ts | 15 ++++++++++++++- 17 files changed, 68 insertions(+), 34 deletions(-) diff --git a/frontend/src/components/asset-card/item-card-inventory.tsx b/frontend/src/components/asset-card/item-card-inventory.tsx index cb7e93835..3a3cdcf3e 100644 --- a/frontend/src/components/asset-card/item-card-inventory.tsx +++ b/frontend/src/components/asset-card/item-card-inventory.tsx @@ -80,7 +80,7 @@ export const ItemCardInventory: FC = ({ item, selectItem }) => { - {item.equippedTo} + {item.equippedTo} )} diff --git a/frontend/src/components/asset-card/styles.ts b/frontend/src/components/asset-card/styles.ts index 07474fc77..e03a57bd9 100644 --- a/frontend/src/components/asset-card/styles.ts +++ b/frontend/src/components/asset-card/styles.ts @@ -123,9 +123,6 @@ export const AssetTitleText = styled.h3` font-weight: ${fontWeight.medium}; font-size: 16px; line-height: 20px; - :first-letter { - text-transform: capitalize; - } @media (max-width: ${breakpoints.mobile}) { overflow: hidden; white-space: nowrap; diff --git a/frontend/src/components/atoms/text.ts b/frontend/src/components/atoms/text.ts index 84c363bf0..3c7f42fb8 100644 --- a/frontend/src/components/atoms/text.ts +++ b/frontend/src/components/atoms/text.ts @@ -3,6 +3,7 @@ import { breakpoints, color, fontSize, fontWeight } from "../../design"; interface TextProps { customColor?: string; + preserveCase?: boolean; } export const Heading = styled.h1` @@ -12,7 +13,7 @@ export const Heading = styled.h1` white-space: pre-wrap; font-weight: ${fontWeight.light}; :first-letter { - text-transform: capitalize; + ${({ preserveCase }): string => `text-transform: ${preserveCase ? "none" : "capitalize"};`}; } ${({ customColor }): string => `color: ${customColor || color.black};`}; `; @@ -35,7 +36,7 @@ export const Label = styled.p` line-height: 15px; letter-spacing: 0.04em; :first-letter { - text-transform: capitalize; + ${({ preserveCase }): string => `text-transform: ${preserveCase ? "none" : "capitalize"};`}; } ${({ customColor }): string => `color: ${customColor || color.darkGrey};`}; `; @@ -54,7 +55,7 @@ export const MenuItemName = styled.h3` font-size: ${fontSize.title}; line-height: 22px; :first-letter { - text-transform: capitalize; + ${({ preserveCase }): string => `text-transform: ${preserveCase ? "none" : "capitalize"};`}; } ${({ customColor }): string => `color: ${customColor || color.black};`}; `; @@ -124,17 +125,17 @@ export const ButtonText = styled.h3` font-size: 14px; line-height: 15px; :first-letter { - text-transform: capitalize; + ${({ preserveCase }): string => `text-transform: ${preserveCase ? "none" : "capitalize"};`}; } ${({ customColor }): string => `color: ${customColor || color.black};`}; `; -export const SectionHeader = styled.h1` +export const SectionHeader = styled.h1` font-size: 32px; font-weight: ${fontWeight.regular}; line-height: 40px; :first-letter { - text-transform: capitalize; + ${({ preserveCase }): string => `text-transform: ${preserveCase ? "none" : "capitalize"};`}; } min-width: 200px; `; diff --git a/frontend/src/components/character-detail/character-detail.tsx b/frontend/src/components/character-detail/character-detail.tsx index e5510bdb2..30c60bc0b 100644 --- a/frontend/src/components/character-detail/character-detail.tsx +++ b/frontend/src/components/character-detail/character-detail.tsx @@ -43,7 +43,7 @@ export const CharacterDetail: FC = ({ character, onClick - {character.name} + {character.name} {character.origin} {text.param.id(character.id)} diff --git a/frontend/src/components/shop-card/character-shop-card.tsx b/frontend/src/components/shop-card/character-shop-card.tsx index 8d6409c8c..578c9e800 100644 --- a/frontend/src/components/shop-card/character-shop-card.tsx +++ b/frontend/src/components/shop-card/character-shop-card.tsx @@ -6,7 +6,7 @@ import { color } from "../../design"; import { BoldLabel, ButtonText, PrimaryButton, TitleText } from "../atoms"; import { PriceInIst } from "../price-in-ist"; import { BaseCharacter } from "../base-character"; -import { Content, Element, Footer, ImageContainer, InfoContainer, PriceContainer, Product, Tag, TitleWrapper } from "./styles"; +import { CharacterTitle, Content, Element, Footer, ImageContainer, InfoContainer, PriceContainer, Product, Tag, TitleWrapper } from "./styles"; import { useViewport } from "../../hooks"; import { calculateCharacterLevels } from "../../util"; @@ -34,7 +34,7 @@ export const CharacterShopCard: FC = ({ character, onCli - {character.character.name} + {character.character.name} {(text.param.titles as any)[character.character.title]}