Display symbols in card text

This commit is contained in:
Correl Roush 2023-01-11 17:26:34 -05:00
parent c13a45fa86
commit ac1be0e3ef
2 changed files with 3 additions and 9 deletions

View file

@ -394,7 +394,7 @@ viewCardBrowser model =
(viewCard { width = 192, height = 272 } copy) (viewCard { width = 192, height = 272 } copy)
:: (E.row [ E.spacing 5, E.centerX ] <| List.map UI.priceBadge (prices copy.card)) :: (E.row [ E.spacing 5, E.centerX ] <| List.map UI.priceBadge (prices copy.card))
:: E.paragraph [ Font.heavy, Font.size 24, Font.center, Font.color UI.colors.title ] [ E.text copy.card.name ] :: E.paragraph [ Font.heavy, Font.size 24, Font.center, Font.color UI.colors.title ] [ E.text copy.card.name ]
:: List.map (\text -> E.paragraph [ Font.size 16 ] [ E.text text ]) :: List.map (Symbol.text model.symbols 16)
(String.lines copy.card.oracleText) (String.lines copy.card.oracleText)
details = details =

View file

@ -78,12 +78,6 @@ symbolTextParser available =
toElement : Int -> Text -> E.Element msg toElement : Int -> Text -> E.Element msg
toElement size symbolText = toElement size symbolText =
let let
padding =
size // 6
fontSize =
size - padding
symbol : Symbol -> E.Element msg symbol : Symbol -> E.Element msg
symbol s = symbol s =
E.image E.image
@ -96,7 +90,7 @@ toElement size symbolText =
in in
case symbolText of case symbolText of
Text s -> Text s ->
E.el [ Font.size size, E.height <| E.px size ] <| E.text s E.text s
Inline s -> Inline s ->
symbol s symbol s
@ -104,6 +98,6 @@ toElement size symbolText =
text : Dict String Symbol -> Int -> String -> E.Element msg text : Dict String Symbol -> Int -> String -> E.Element msg
text available size string = text available size string =
E.row [ E.spacing (size // 10) ] <| E.paragraph [ E.spacing (size // 10), Font.size size ] <|
List.map (toElement size) <| List.map (toElement size) <|
(P.run (symbolTextParser available) string |> Result.withDefault []) (P.run (symbolTextParser available) string |> Result.withDefault [])