Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Weird stuff is happening with Html.Styled.Lazy #522

Open
Kurren123 opened this issue May 30, 2020 · 0 comments
Open

Bug: Weird stuff is happening with Html.Styled.Lazy #522

Kurren123 opened this issue May 30, 2020 · 0 comments

Comments

@Kurren123
Copy link

Minimal ellie example

Code from the ellie example:

module Main exposing (main)

import Browser
import Html.Styled exposing (..)
import Html.Styled.Lazy exposing (..)
import Css exposing (..)
import Html.Styled.Attributes exposing (css)

strings = 
    [ "A" , "B", "C"]

viewString : String -> Html msg 
viewString str =
     let 
         strColour = 
             if str == "A" 
             then rgb 166 11 0
             else rgb 0 110 29
     in 
         option [ css [ color strColour ] ] [ text str ]

viewStrings : Html msg
viewStrings =     
    strings
        |> List.map (\txt -> lazy viewString txt )
        |> select [  ]

view _ =
    viewStrings
    |> toUnstyled


main : Program () () ()
main =
    Browser.sandbox
        { init = ()
        , view = view
        , update = \_ _ -> ()
        }

I want to colour the individual options differently.

Without lazy:
image

With lazy:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant