@@ -571,7 +571,8 @@ render ::
571571render state =
572572 Halogen.HTML .div
573573 [ Halogen.HTML.Properties .classes containerClasses ]
574- [ Halogen.HTML .div_
574+ [ Halogen.HTML .div
575+ [ Ocelot.HTML.Properties .css " flex flex-wrap items-start" ]
575576 (Data.FunctorWithIndex .mapWithIndex (renderItem state.placeholder) state.items)
576577 , renderTextWidth
577578 ]
@@ -585,7 +586,7 @@ renderItem ::
585586renderItem placeholder index = case _ of
586587 Display { text } -> renderItemDisplay index text
587588 Edit { inputBox } -> renderItemEdit placeholder index inputBox
588- New { inputBox } -> renderAutoSizeInput placeholder index true inputBox
589+ New { inputBox } -> renderItemNew placeholder index inputBox
589590
590591renderItemDisplay ::
591592 forall m .
@@ -622,6 +623,17 @@ renderItemEdit placeholder index inputBox =
622623 [ Ocelot.Block.Icon .delete_ ]
623624 ]
624625
626+ renderItemNew ::
627+ forall m .
628+ Placeholder ->
629+ Int ->
630+ InputBox ->
631+ ComponentHTML m
632+ renderItemNew placeholder index inputBox =
633+ Halogen.HTML .div
634+ [ Ocelot.HTML.Properties .css " block flex-1" ]
635+ [ renderAutoSizeInput placeholder index true inputBox ]
636+
625637renderAutoSizeInput ::
626638 forall m .
627639 Placeholder ->
@@ -630,29 +642,30 @@ renderAutoSizeInput ::
630642 InputBox ->
631643 ComponentHTML m
632644renderAutoSizeInput placeholder index new inputBox =
633- Halogen.HTML .div
634- [ Ocelot.HTML.Properties .css " inline-block" ]
635- [ Halogen.HTML .input
636- [ Halogen.HTML.Properties .attr (Halogen.HTML.AttrName " style" ) css
637- , Halogen.HTML.Properties .classes inputClasses
638- , Halogen.HTML.Events .onBlur \_ -> OnBlur index
639- , Halogen.HTML.Events .onFocus \_ -> OnFocus index
640- , Halogen.HTML.Events .onKeyDown (OnKeyDown index)
641- , Halogen.HTML.Events .onMouseDown (OnMouseDown index)
642- , Halogen.HTML.Events .onValueInput (OnInput index)
643- , Halogen.HTML.Properties .placeholder case new of
644- false -> " "
645- true
646- | index == 0 -> placeholder.primary.text
647- | otherwise -> placeholder.secondary.text
648- , Halogen.HTML.Properties .ref (inputRef index)
649- , Halogen.HTML.Properties .type_ Halogen.HTML.Properties.InputText
650- , Halogen.HTML.Properties .value inputBox.text
651- ]
645+ Halogen.HTML .input
646+ [ Halogen.HTML.Properties .attr (Halogen.HTML.AttrName " style" ) css
647+ , Halogen.HTML.Properties .classes inputClasses
648+ , Halogen.HTML.Events .onBlur \_ -> OnBlur index
649+ , Halogen.HTML.Events .onFocus \_ -> OnFocus index
650+ , Halogen.HTML.Events .onKeyDown (OnKeyDown index)
651+ , Halogen.HTML.Events .onMouseDown (OnMouseDown index)
652+ , Halogen.HTML.Events .onValueInput (OnInput index)
653+ , Halogen.HTML.Properties .placeholder case new of
654+ false -> " "
655+ true
656+ | index == 0 -> placeholder.primary.text
657+ | otherwise -> placeholder.secondary.text
658+ , Halogen.HTML.Properties .ref (inputRef index)
659+ , Halogen.HTML.Properties .type_ Halogen.HTML.Properties.InputText
660+ , Halogen.HTML.Properties .value inputBox.text
652661 ]
653662 where
654663 css :: String
655- css = " width: " <> show width <> " px"
664+ css =
665+ if new then
666+ " min-width: " <> show width <> " px"
667+ else
668+ " width: " <> show width <> " px"
656669
657670 width :: Number
658671 width
@@ -713,6 +726,7 @@ inputClasses =
713726 [ " my-1"
714727 , " outline-none"
715728 , " px-1"
729+ , " w-full"
716730 ]
717731 <#> Halogen.ClassName
718732
0 commit comments