mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 12:25:12 -05:00
134 lines
6.3 KiB
Elm
134 lines
6.3 KiB
Elm
![]() |
module Debate.Helpers exposing (..)
|
||
|
|
||
|
import Config.Colour as T exposing (..)
|
||
|
import Config.Format as O exposing (..)
|
||
|
import Debate.Types exposing (..)
|
||
|
import Effect exposing (Effect)
|
||
|
import Element exposing (..)
|
||
|
import Element.Border as D exposing (..)
|
||
|
import Element.Font as F
|
||
|
import Html
|
||
|
import Html.Attributes as H exposing (style, title, wrap)
|
||
|
import Layouts
|
||
|
import Page exposing (Page)
|
||
|
import Route exposing (Route)
|
||
|
import Shared
|
||
|
import View exposing (View)
|
||
|
|
||
|
|
||
|
argumentMaker : Argument -> Element msg
|
||
|
argumentMaker makeRowInput =
|
||
|
let
|
||
|
argRows : List (Element msg)
|
||
|
argRows =
|
||
|
let
|
||
|
argumentFormatting =
|
||
|
[ centerX, F.center, spacing 3 ]
|
||
|
in
|
||
|
List.indexedMap
|
||
|
(\index argumentEntry ->
|
||
|
column (paragraphFormat ++ [ spacing 3, paddingEach { top = 30, right = 0, bottom = 0, left = 0 } ])
|
||
|
(List.indexedMap
|
||
|
(\premiseIndex premiseWithNotation ->
|
||
|
column argumentFormatting
|
||
|
[ paragraph paragraphHightlightedBoldText
|
||
|
[ text ("P" ++ String.fromInt (premiseIndex + 1) ++ ") ")
|
||
|
, text premiseWithNotation.premise
|
||
|
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||
|
]
|
||
|
, paragraph argumentFormatting
|
||
|
[ text premiseWithNotation.notation
|
||
|
|> el [ F.color colourTheme.highlightText, F.bold ]
|
||
|
]
|
||
|
]
|
||
|
)
|
||
|
argumentEntry.premises
|
||
|
++ [ column argumentFormatting
|
||
|
[ paragraph paragraphHightlightedBoldText
|
||
|
[ text ("C" ++ String.fromInt (index + 1) ++ ") ")
|
||
|
, text argumentEntry.conclusion
|
||
|
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||
|
]
|
||
|
, paragraph argumentFormatting
|
||
|
[ text argumentEntry.conclusionNotation
|
||
|
|> el [ F.color colourTheme.highlightText, F.bold ]
|
||
|
]
|
||
|
]
|
||
|
]
|
||
|
)
|
||
|
)
|
||
|
makeRowInput.argumentFormalization
|
||
|
in
|
||
|
column
|
||
|
[ paragraphWidth, alignLeft, spacing 8, paddingEach { top = 0, right = 0, bottom = 60, left = 0 } ]
|
||
|
[ paragraph (paragraphBoldFormat ++ [ F.size 20 ])
|
||
|
[ text makeRowInput.argumentTitle |> el [ F.color colourTheme.nonHighlightedText, F.bold ]
|
||
|
]
|
||
|
, paragraph (paragraphBoldFormat ++ [ F.size 18 ])
|
||
|
[ text "Proposition: " |> el [ F.color colourTheme.highlightText ]
|
||
|
, text makeRowInput.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||
|
]
|
||
|
, paragraph (paragraphBoldFormat ++ [ F.size 18 ])
|
||
|
[ text "Summary: " |> el [ F.color colourTheme.highlightText ]
|
||
|
, text makeRowInput.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||
|
]
|
||
|
, wrappedRow (paragraphBoldFormat ++ [ alignLeft ])
|
||
|
[ Element.table
|
||
|
[ spacing 0
|
||
|
, D.rounded 10
|
||
|
, D.width 1
|
||
|
, D.color colourTheme.nonHighlightedDarkText
|
||
|
, clip
|
||
|
]
|
||
|
{ data = makeRowInput.definitionTable
|
||
|
, columns =
|
||
|
[ { header =
|
||
|
el
|
||
|
[ F.bold
|
||
|
, D.widthEach { bottom = 1, top = 1, left = 1, right = 1 }
|
||
|
, D.color colourTheme.nonHighlightedDarkText
|
||
|
, padding 8
|
||
|
]
|
||
|
(text "Definiendum" |> el [ F.color colourTheme.highlightText ])
|
||
|
, width = fill |> maximum 50
|
||
|
, view =
|
||
|
\definition ->
|
||
|
row
|
||
|
[ F.color colourTheme.highlightText
|
||
|
, F.bold
|
||
|
, D.widthEach { bottom = 1, top = 0, left = 1, right = 1 }
|
||
|
, D.color colourTheme.nonHighlightedDarkText
|
||
|
, padding 8
|
||
|
, Element.height fill
|
||
|
]
|
||
|
[ text definition.definiendum
|
||
|
, row [ alignRight ] [ text ":=" ]
|
||
|
]
|
||
|
}
|
||
|
, { header =
|
||
|
el
|
||
|
[ F.bold
|
||
|
, D.widthEach { bottom = 1, top = 1, left = 0, right = 1 }
|
||
|
, D.color colourTheme.nonHighlightedDarkText
|
||
|
, padding 8
|
||
|
]
|
||
|
(text "Definiens" |> el [ F.color colourTheme.highlightText ])
|
||
|
, width = fill
|
||
|
, view =
|
||
|
\definition ->
|
||
|
paragraph
|
||
|
[ F.color colourTheme.nonHighlightedText
|
||
|
, F.regular
|
||
|
, D.widthEach { bottom = 1, top = 0, left = 0, right = 1 }
|
||
|
, D.color colourTheme.nonHighlightedDarkText
|
||
|
, padding 8
|
||
|
, Element.height fill
|
||
|
]
|
||
|
[ text definition.definiens ]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
, column [ centerX ] argRows
|
||
|
]
|