mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
feat: added proposition page
This commit is contained in:
parent
81b3c4b106
commit
6a9280118c
9 changed files with 264 additions and 35 deletions
27
frontend/src/Config/Colour.elm
Normal file
27
frontend/src/Config/Colour.elm
Normal file
|
@ -0,0 +1,27 @@
|
|||
module Config.Colour exposing (..)
|
||||
|
||||
import Element exposing (..)
|
||||
import Element.Background as B
|
||||
import Element.Font as F
|
||||
import Html.Attributes as H exposing (style)
|
||||
|
||||
|
||||
type alias Theme =
|
||||
{ nonHighlightedText : Color
|
||||
, nonHighlightedDarkText : Color
|
||||
, highlightText : Color
|
||||
, highlightTextHover : Color
|
||||
, backgroundColour : Color
|
||||
, debugColour : Color
|
||||
}
|
||||
|
||||
|
||||
colourTheme : Theme
|
||||
colourTheme =
|
||||
{ nonHighlightedText = rgb255 212 212 212
|
||||
, nonHighlightedDarkText = rgb255 126 126 126
|
||||
, highlightText = rgb255 204 102 0
|
||||
, highlightTextHover = rgb255 120 60 0
|
||||
, backgroundColour = rgb255 40 40 40
|
||||
, debugColour = rgb255 227 28 121
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
module Config.Theme exposing (..)
|
||||
module Config.Format exposing (..)
|
||||
|
||||
import Config.Colour exposing (..)
|
||||
import Element exposing (..)
|
||||
import Element.Background as B
|
||||
import Element.Font as F
|
||||
|
@ -25,27 +26,6 @@ pageList =
|
|||
]
|
||||
|
||||
|
||||
type alias Theme =
|
||||
{ nonHighlightedText : Color
|
||||
, nonHighlightedDarkText : Color
|
||||
, highlightText : Color
|
||||
, highlightTextHover : Color
|
||||
, backgroundColour : Color
|
||||
, debugColour : Color
|
||||
}
|
||||
|
||||
|
||||
colourTheme : Theme
|
||||
colourTheme =
|
||||
{ nonHighlightedText = rgb255 212 212 212
|
||||
, nonHighlightedDarkText = rgb255 126 126 126
|
||||
, highlightText = rgb255 204 102 0
|
||||
, highlightTextHover = rgb255 120 60 0
|
||||
, backgroundColour = rgb255 40 40 40
|
||||
, debugColour = rgb255 227 28 121
|
||||
}
|
||||
|
||||
|
||||
transitionStyle : Attribute msg
|
||||
transitionStyle =
|
||||
htmlAttribute <| style "transition" "all .2s"
|
||||
|
@ -119,10 +99,24 @@ paragraphLinkFormat =
|
|||
]
|
||||
|
||||
|
||||
paragraphSpacing : Attribute msg
|
||||
paragraphSpacing =
|
||||
spacing 8
|
||||
|
||||
|
||||
paragraphText : List (Attr () msg)
|
||||
paragraphText =
|
||||
[ F.color colourTheme.nonHighlightedText
|
||||
, spacing 8
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
]
|
||||
|
||||
|
||||
paragraphHightlightedBoldText : List (Attr () msg)
|
||||
paragraphHightlightedBoldText =
|
||||
[ F.color colourTheme.highlightText
|
||||
, F.bold
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
]
|
||||
|
||||
|
@ -149,6 +143,11 @@ paragraphAlignLeft =
|
|||
[ alignLeft, paragraphWidth ]
|
||||
++ paragraphText
|
||||
|
||||
paragraphAlignCenter : List (Attr () msg)
|
||||
paragraphAlignCenter =
|
||||
[ centerX, paragraphWidth ]
|
||||
++ paragraphText
|
||||
|
||||
|
||||
paragraphColumnFormat : List (Attribute msg)
|
||||
paragraphColumnFormat =
|
|
@ -1,7 +1,5 @@
|
|||
module Config.Identity exposing (..)
|
||||
|
||||
import Element exposing (..)
|
||||
|
||||
|
||||
type alias PageInput =
|
||||
{ pageHome : String
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
module Layouts.Navbar exposing (Model, Msg, Props, layout)
|
||||
|
||||
import Config.Identity as ID exposing (..)
|
||||
import Config.Theme as T exposing (..)
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.Identity as I exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element exposing (..)
|
||||
import Element.Background as B
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
module Pages.Dodgers exposing (Model, Msg, page)
|
||||
|
||||
import Config.Identity exposing (dodgersName)
|
||||
import Config.Theme as T exposing (..)
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.Identity as I exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element exposing (..)
|
||||
import Element.Font as F
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
module Pages.Home_ exposing (Model, Msg, page)
|
||||
|
||||
import Config.Identity as ID exposing (..)
|
||||
import Config.Theme as T exposing (..)
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.Identity as I exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element exposing (..)
|
||||
import Html.Attributes as H exposing (style)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
module Pages.Platforms exposing (Model, Msg, page)
|
||||
|
||||
import Config.Identity as ID exposing (..)
|
||||
import Config.Theme as T exposing (..)
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.Identity as I exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element exposing (..)
|
||||
import Element.Font as F
|
||||
|
|
200
frontend/src/Pages/Propositions.elm
Normal file
200
frontend/src/Pages/Propositions.elm
Normal file
|
@ -0,0 +1,200 @@
|
|||
module Pages.Propositions exposing (Model, Msg, page)
|
||||
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.Identity as I exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element exposing (..)
|
||||
import Element.Font as F
|
||||
import Html
|
||||
import Html.Attributes as H exposing (style)
|
||||
import Layouts
|
||||
import Page exposing (Page)
|
||||
import Route exposing (Route)
|
||||
import Shared
|
||||
import View exposing (View)
|
||||
|
||||
|
||||
page : Shared.Model -> Route () -> Page Model Msg
|
||||
page shared route =
|
||||
Page.new
|
||||
{ init = init
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
, view = view
|
||||
}
|
||||
|> Page.withLayout toLayout
|
||||
|
||||
|
||||
toLayout : Model -> Layouts.Layout Msg
|
||||
toLayout model =
|
||||
Layouts.Navbar {}
|
||||
|
||||
|
||||
|
||||
-- INIT
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
init : () -> ( Model, Effect Msg )
|
||||
init () =
|
||||
( {}
|
||||
, Effect.none
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- UPDATE
|
||||
|
||||
|
||||
type Msg
|
||||
= NoOp
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Effect Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
NoOp ->
|
||||
( model
|
||||
, Effect.none
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- SUBSCRIPTIONS
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
Sub.none
|
||||
|
||||
|
||||
|
||||
-- VIEW
|
||||
|
||||
|
||||
view : Model -> View Msg
|
||||
view model =
|
||||
{ title = propositionsName
|
||||
, attributes = []
|
||||
, element = propositionsContainer
|
||||
}
|
||||
|
||||
|
||||
propositionsContainer : Element msg
|
||||
propositionsContainer =
|
||||
topLevelContainer propositionsList
|
||||
|
||||
|
||||
propositionsList : Element msg
|
||||
propositionsList =
|
||||
column
|
||||
pageList
|
||||
propositions
|
||||
|
||||
|
||||
type alias MakeRowInput =
|
||||
{ propositionTitle : String
|
||||
, propositionSummary : String
|
||||
, definitionTable : List Definition
|
||||
, argumentFormalization : List ArgumentEntry
|
||||
}
|
||||
|
||||
|
||||
type alias ArgumentEntry =
|
||||
{ premises : List String
|
||||
, conclusion : String
|
||||
}
|
||||
|
||||
|
||||
type alias Definition =
|
||||
{ definiendum : String
|
||||
, definiens : String
|
||||
}
|
||||
|
||||
|
||||
makeRow : MakeRowInput -> Element msg
|
||||
makeRow makeRowInput =
|
||||
let
|
||||
argRows : List (Element msg)
|
||||
argRows =
|
||||
List.indexedMap
|
||||
(\index argumentEntry ->
|
||||
column paragraphFormat
|
||||
(List.indexedMap
|
||||
(\premiseIndex premise ->
|
||||
row paragraphHightlightedBoldText
|
||||
[ text ("P" ++ String.fromInt (premiseIndex + 1) ++ ")")
|
||||
, text premise |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||||
]
|
||||
)
|
||||
argumentEntry.premises
|
||||
++ [ row paragraphHightlightedBoldText
|
||||
[ text ("C" ++ String.fromInt (index + 1) ++ ")")
|
||||
, text argumentEntry.conclusion |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||||
]
|
||||
]
|
||||
)
|
||||
)
|
||||
makeRowInput.argumentFormalization
|
||||
in
|
||||
column
|
||||
[ paragraphWidth, alignLeft, spacing 8 ]
|
||||
[ row paragraphBoldFormat
|
||||
[ text "Proposition:" |> el [ F.color colourTheme.highlightText ]
|
||||
, text makeRowInput.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||||
]
|
||||
, row paragraphBoldFormat
|
||||
[ text "Summary:" |> el [ F.color colourTheme.highlightText ]
|
||||
, text makeRowInput.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
|
||||
]
|
||||
, row (paragraphBoldFormat ++ [ alignLeft ])
|
||||
[ Element.table [ spacing 8 ]
|
||||
{ data = makeRowInput.definitionTable
|
||||
, columns =
|
||||
[ { header = el [ F.bold ] (text "Definiendum" |> el [ F.color colourTheme.highlightText ])
|
||||
, width = fill
|
||||
, view =
|
||||
\definition ->
|
||||
text definition.definiendum |> el [ F.color colourTheme.nonHighlightedText, F.regular]
|
||||
}
|
||||
, { header = el [ F.bold ] (text "Definiens" |> el [ F.color colourTheme.highlightText ])
|
||||
, width = fill
|
||||
, view =
|
||||
\definition ->
|
||||
text definition.definiens |> el [ F.color colourTheme.nonHighlightedText, F.regular]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, column [ centerX, paragraphSpacing ] argRows
|
||||
]
|
||||
|
||||
|
||||
propositions =
|
||||
List.map makeRow
|
||||
[ { propositionTitle = "String"
|
||||
, propositionSummary = "String"
|
||||
, definitionTable =
|
||||
[ { definiendum = "Term 1"
|
||||
, definiens = "Definition 1"
|
||||
}
|
||||
, { definiendum = "Term 2"
|
||||
, definiens = "Definition 2"
|
||||
}
|
||||
]
|
||||
, argumentFormalization =
|
||||
[ { premises =
|
||||
[ "First premise"
|
||||
, "Second premise"
|
||||
, "Third premise"
|
||||
, "Fourth premise"
|
||||
]
|
||||
, conclusion = "Conclusion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -1,7 +1,8 @@
|
|||
module Pages.Services exposing (Model, Msg, page)
|
||||
|
||||
import Config.Identity as ID exposing (..)
|
||||
import Config.Theme as T exposing (..)
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.Identity as I exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element exposing (..)
|
||||
import Element.Font as F
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue