Skip to content

Commit

Permalink
synced fifthtry internal ftd with open source one
Browse files Browse the repository at this point in the history
* update

* updated version

* Header get values

* header functions

Co-authored-by: Abrar <[email protected]>
Co-authored-by: Amit Upadhyay <[email protected]>
  • Loading branch information
3 people authored Apr 30, 2021
1 parent ca520d6 commit 492863c
Show file tree
Hide file tree
Showing 50 changed files with 8,748 additions and 13 deletions.
19 changes: 12 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ftd"
version = "0.1.0"
version = "0.1.2"
authors = [
"Amit Upadhyay <[email protected]>",
"mxfunc <[email protected]>",
Expand All @@ -12,21 +12,26 @@ include = ["src/**/*", "Cargo.toml"]
readme = "README.md"
keywords = ["fifthtry"]
edition = "2018"
"repository" = "https://github.com/fifthtry/ftd"
repository = "https://github.com/fifthtry/ftd"

[dependencies]
Inflector = "0.11.4"
comrak = "0.7.0"
failure = "0.1"
lazy_static = "1"
linked-hash-map = { version = "0.5.4", features = ["serde_impl"]}
percent-encoding = "2.1.0"
pest = "2"
pest_derive = "2"
serde = "1"
serde_derive = "1"
syntect = "4"
thiserror = "1"
unindent = "0.1.3"
Inflector = "0.11.4"
css-color-parser = "0.1.2"
slug = "0.1.4"
katex = "0.3"
realm-lang = "0.1.0"
observer = "0.2.5"

[dev-dependencies]
diffy = "0.2.0"
indoc = "0.3"
pretty_assertions = "0.6"
pretty_assertions = "0.6"
61 changes: 61 additions & 0 deletions Lib.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module Lib exposing (..)

import Element as E
import Element.Background as Bg
import Element.Border as EB
import Element.Events as EE
import Element.Font as EF
import Element.Region as ER
import F
import Realm.Utils as RU
import Style as ST
import System as S


linkButton : String -> String -> F.Element msg
linkButton text url =
F.e1 E.link [ E.pointer ] { url = url, label = RU.text [] text }


msgButton : String -> msg -> F.Element msg
msgButton t msg =
F.e1 E.el [ E.pointer, EE.onClick msg ] (E.text t)


error : String -> F.Element msg
error t =
F.e1 E.el [ E.paddingXY 16 0, EF.color S.red4, EF.size 14 ] (E.text t)


submit : String -> msg -> F.Element msg
submit label msg =
F.e1 RU.button
[ EB.width 1
, EB.color ST.success
, E.paddingXY 20 7
, Bg.color ST.success
, EF.color ST.primary
, E.mouseOver [ Bg.color ST.success, EF.color ST.primary ]
, EB.rounded 2
, E.focused []
]
{ onPress = Just msg, label = ST.p_14 [ RU.maxContent ] <| E.text label }


submitWithError : String -> F.Element msg
submitWithError label =
F.e1 RU.button
[ EB.width 1
, E.paddingXY 20 7
, EB.color ST.disabled
, EF.color ST.primary
, Bg.color ST.disabled
, EB.rounded 2
, E.focused []
]
{ onPress = Nothing, label = ST.p_14 [ RU.maxContent ] <| E.text label }


pageTitle : String -> F.Element msg
pageTitle t =
F.e1 RU.text [ EF.size 32, EF.bold, ER.heading 1 ] t
67 changes: 67 additions & 0 deletions Lib/CreateUsername.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module Lib.CreateUsername exposing (..)

import Element as E
import Element.Background as Bg
import Element.Border as EB
import Element.Events as EE
import Element.Font as EF
import Element.Input as EI
import F
import Realm.Utils as RU
import System as S


page : F.FocusableStringField msg -> msg -> E.Element msg -> E.Element msg -> F.Element msg
page u submit sub usernameAvailable =
let
heading : E.Element msg
heading =
E.el
[ EB.color S.gray4
, E.width E.fill
, E.paddingXY 18 12
, Bg.color S.green2
, EF.color S.green6
]
<|
E.text "Create Username"

usernameLabel : EI.Label msg
usernameLabel =
EI.labelAbove [ E.paddingXY 4 0 ] (E.text "Username")

usernamePlaceholder : EI.Placeholder msg
usernamePlaceholder =
EI.placeholder [] (E.text "username")

username : E.Element msg
username =
E.el [ E.paddingXY 14 0, E.width E.fill, RU.onEnter submit ] <|
EI.username
[ E.width E.fill
, EI.focusedOnLoad
, EE.onFocus (u.focus True)
, EE.onLoseFocus (u.focus False)
]
{ onChange = u.message
, text = u.value
, placeholder = Just usernamePlaceholder
, label = usernameLabel
}
in
F.e E.column
[ E.centerX
, E.centerY
, E.width S.s384
, E.spacing 12
, Bg.color S.gray7
, EB.color S.green2
, EB.width S.border4
, EB.rounded S.borderRadius4
]
[ heading
, username
, u.error
, usernameAvailable
, sub
]
Loading

0 comments on commit 492863c

Please sign in to comment.