First version of new ui based on tailwind

This drops fomantic-ui as css toolkit and introduces tailwindcss. With
tailwind there are no predefined components, but it's very easy to
create those. So customizing the look&feel is much simpler, most of
the time no additional css is needed.

This requires a complete rewrite of the markup + styles. Luckily all
logic can be kept as is. The now old ui is not removed, it is still
available by using a request header `Docspell-Ui` with a value of `1`
for the old ui and `2` for the new ui.

Another addition is "dev mode", where docspell serves assets with a
no-cache header, to disable browser caching. This makes developing a
lot easier.
This commit is contained in:
Eike Kettner
2021-01-29 20:48:27 +01:00
parent 442b76c5af
commit dd935454c9
140 changed files with 15077 additions and 214 deletions

View File

@ -5,16 +5,22 @@ module Comp.MarkdownInput exposing
, update
, view
, viewCheatLink
, viewCheatLink2
, viewContent
, viewContent2
, viewEditLink
, viewEditLink2
, viewPreviewLink
, viewPreviewLink2
, viewSplitLink
, viewSplitLink2
)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import Markdown
import Styles as S
type Display
@ -51,6 +57,10 @@ update txt msg model =
( { model | display = dsp }, txt )
--- View
viewContent : String -> Model -> Html Msg
viewContent txt model =
case model.display of
@ -172,3 +182,94 @@ splitDisplay txt =
]
]
]
--- View2
viewContent2 : String -> Model -> Html Msg
viewContent2 txt model =
case model.display of
Edit ->
editDisplay2 txt
Preview ->
previewDisplay2 txt
Split ->
splitDisplay2 txt
viewEditLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg
viewEditLink2 classes model =
a
[ onClick (SetDisplay Edit)
, classes (model.display == Edit)
, href "#"
]
[ text "Edit"
]
viewPreviewLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg
viewPreviewLink2 classes model =
a
[ onClick (SetDisplay Preview)
, classes (model.display == Preview)
, href "#"
]
[ text "Preview"
]
viewSplitLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg
viewSplitLink2 classes model =
a
[ onClick (SetDisplay Split)
, classes (model.display == Split)
, href "#"
]
[ text "Split"
]
viewCheatLink2 : String -> Model -> Html msg
viewCheatLink2 classes model =
a
[ class classes
, target "_new"
, href model.cheatSheetUrl
]
[ i [ class "fa fa-question mr-2" ] []
, text "Supports Markdown"
]
editDisplay2 : String -> Html Msg
editDisplay2 txt =
textarea
[ class S.textAreaInput
, class "h-full"
, onInput SetText
, placeholder "Add notes here"
, value txt
]
[]
previewDisplay2 : String -> Html Msg
previewDisplay2 txt =
Markdown.toHtml [ class "markdown-preview" ] txt
splitDisplay2 : String -> Html Msg
splitDisplay2 txt =
div [ class "flex flex-row justify-evenly" ]
[ div [ class "w-1/2" ]
[ editDisplay2 txt
]
, div [ class "w-1/2" ]
[ previewDisplay2 txt
]
]