Add info text to int field

This commit is contained in:
Eike Kettner 2020-04-23 21:46:10 +02:00
parent 84e0ebf1a2
commit 06d2c9ecba
2 changed files with 26 additions and 3 deletions

View File

@ -1,8 +1,16 @@
module Comp.IntField exposing (Model, Msg, init, update, view) module Comp.IntField exposing
( Model
, Msg
, init
, update
, view
, viewWithInfo
)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Markdown
type alias Model = type alias Model =
@ -87,7 +95,12 @@ update msg model =
view : Maybe Int -> String -> Model -> Html Msg view : Maybe Int -> String -> Model -> Html Msg
view nval classes model = view =
viewWithInfo ""
viewWithInfo : String -> Maybe Int -> String -> Model -> Html Msg
viewWithInfo info nval classes model =
div div
[ classList [ classList
[ ( classes, True ) [ ( classes, True )
@ -103,6 +116,14 @@ view nval classes model =
, onInput SetValue , onInput SetValue
] ]
[] []
, span
[ classList
[ ( "small-info", True )
, ( "hidden invisible", info == "" )
]
]
[ Markdown.toHtml [] info
]
, div , div
[ classList [ classList
[ ( "ui pointing red basic label", True ) [ ( "ui pointing red basic label", True )

View File

@ -481,7 +481,9 @@ view extraClasses model =
] ]
] ]
, Html.map RemindDaysMsg , Html.map RemindDaysMsg
(Comp.IntField.view model.remindDays (Comp.IntField.viewWithInfo
"Select items with a due date *lower than* `today+remindDays`"
model.remindDays
"required field" "required field"
model.remindDaysModel model.remindDaysModel
) )