module Web.View.Layout where
import Data.Function
import Data.Text
import Web.View.Element
import Web.View.Style
import Web.View.Types
import Web.View.View (View, tag)
layout :: Mod c -> View c () -> View c ()
layout :: forall c. Mod c -> View c () -> View c ()
layout Mod c
f = Mod c -> View c () -> View c ()
forall c. Mod c -> View c () -> View c ()
el (Mod c
forall c. Mod c
root Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
f)
root :: Mod c
root :: forall c. Mod c
root = Mod c
forall c. Mod c
flexCol Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
forall c. Mod c
fillViewport
where
fillViewport :: Mod c
fillViewport =
Class -> Mod c
forall c. Class -> Mod c
addClass (Class -> Mod c) -> Class -> Mod c
forall a b. (a -> b) -> a -> b
$
ClassName -> Class
cls ClassName
"layout"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"width" Text
"100vw"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"height" Text
"100vh"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"min-height" Text
"100vh"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"z-index" Text
"0"
col :: Mod c -> View c () -> View c ()
col :: forall c. Mod c -> View c () -> View c ()
col Mod c
f = Mod c -> View c () -> View c ()
forall c. Mod c -> View c () -> View c ()
el (Mod c
forall c. Mod c
flexCol Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
f)
row :: Mod c -> View c () -> View c ()
row :: forall c. Mod c -> View c () -> View c ()
row Mod c
f = Mod c -> View c () -> View c ()
forall c. Mod c -> View c () -> View c ()
el (Mod c
forall c. Mod c
flexRow Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
f)
grow :: Mod c
grow :: forall c. Mod c
grow = Class -> Mod c
forall c. Class -> Mod c
addClass (Class -> Mod c) -> Class -> Mod c
forall a b. (a -> b) -> a -> b
$ ClassName -> Class
cls ClassName
"grow" Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Int Text
"flex-grow" Int
1
space :: View c ()
space :: forall c. View c ()
space = Mod c -> View c () -> View c ()
forall c. Mod c -> View c () -> View c ()
el Mod c
forall c. Mod c
grow View c ()
forall c. View c ()
none
collapse :: Mod c
collapse :: forall c. Mod c
collapse = Class -> Mod c
forall c. Class -> Mod c
addClass (Class -> Mod c) -> Class -> Mod c
forall a b. (a -> b) -> a -> b
$ ClassName -> Class
cls ClassName
"collapse" Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Int Text
"min-width" Int
0
scroll :: Mod c
scroll :: forall c. Mod c
scroll = Class -> Mod c
forall c. Class -> Mod c
addClass (Class -> Mod c) -> Class -> Mod c
forall a b. (a -> b) -> a -> b
$ ClassName -> Class
cls ClassName
"scroll" Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"overflow" Text
"auto"
nav :: Mod c -> View c () -> View c ()
nav :: forall c. Mod c -> View c () -> View c ()
nav Mod c
f = Text -> Mod c -> View c () -> View c ()
forall c. Text -> Mod c -> View c () -> View c ()
tag Text
"nav" (Mod c
f Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
forall c. Mod c
flexCol)
stack :: Mod c -> View c () -> View c ()
stack :: forall c. Mod c -> View c () -> View c ()
stack Mod c
f =
Text -> Mod c -> View c () -> View c ()
forall c. Text -> Mod c -> View c () -> View c ()
tag Text
"div" (Mod c
f Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
forall c. Mod c
container Mod c -> Mod c -> Mod c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod c
forall c. Mod c
absChildren)
where
container :: Mod c
container =
Class -> Mod c
forall c. Class -> Mod c
addClass (Class -> Mod c) -> Class -> Mod c
forall a b. (a -> b) -> a -> b
$
ClassName -> Class
cls ClassName
"stack"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"position" Text
"relative"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"display" Text
"grid"
absChildren :: Mod c
absChildren =
Class -> Mod c
forall c. Class -> Mod c
addClass (Class -> Mod c) -> Class -> Mod c
forall a b. (a -> b) -> a -> b
$
Selector -> Styles -> Class
Class Selector
absSelector Styles
forall a. Monoid a => a
mempty
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"position" Text
"relative"
Class -> (Class -> Class) -> Class
forall a b. a -> (a -> b) -> b
& forall val. ToStyleValue val => Text -> val -> Class -> Class
prop @Text Text
"grid-area" Text
"1 / 1"
absSelector :: Selector
absSelector = (ClassName -> Selector
selector ClassName
"abs-childs"){child = Just AllChildren}