aboutsummaryrefslogtreecommitdiff
path: root/src/server/Design/Global.hs
blob: 25b7d95a71be0fa2837022d0986db6ef287148de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{-# LANGUAGE OverloadedStrings #-}

module Design.Global
  ( globalDesign
  ) where

import qualified Prelude
import Prelude

import Data.Monoid ((<>))

import Clay

import Data.Text.Lazy (Text)
import qualified Clay.Display as D

import Design.Color as C

globalDesign :: Text
globalDesign = renderWith compact [] global

iconFontSize :: Integer
iconFontSize = 32

global :: Css
global = do

  header ? do
    let headerHeight = 150

    h1 ? do
      fontSize (px 40)
      textAlign (alignSide sideCenter)
      color C.brown
      lineHeight (px headerHeight)

    button # ".signOut" ? do
      let iconHeight = 50
      let sideMargin = ((headerHeight - iconHeight) `Prelude.div` 2)
      position absolute
      top (px 0)
      right (px 10)
      marginTop (px sideMargin)
      marginRight (px sideMargin)
      height (px iconHeight)
      lineHeight (px iconHeight)
      backgroundColor C.white
      color C.brown
      borderWidth (px 0)
      fontSize (px iconFontSize)
      hover & transform (scale 1.2 1.2)

  ".payments" ? do
    form # ".add" ? do
      let inputHeight = 40
      width (pct 80)
      marginLeft auto
      marginRight auto
      marginBottom (px 45)
      clearFix

      ".name" <> ".cost" ? do
        position relative
        width (pct 49)
        label ? do
          display inlineBlock
          width (pct 25)
          paddingRight (pct 5)
        input ? defaultInput inputHeight

      ".name" ? do
        float floatLeft
        input ? width (pct 70)

      ".cost" ? do
        float floatRight
        input ? do
          width (pct 45)
          marginRight (pct 5)
        button ? do
          defaultButton
          width (pct 20)
          height (px inputHeight)

      input # ".error" ? borderColor C.red
      ".errorMessage" ? do
        position absolute
        color C.red
        top (px (inputHeight + 10))
        left (px 0)

    table ? do
      width (pct 100)
      textAlign (alignSide (sideCenter))
      "border-spacing" -: "10 px"

      th ? do
        backgroundColor C.brown
        color C.white
        fontSize (px iconFontSize)
        lineHeight (px 70)

      tr ? do
        fontSize (px 20)
        lineHeight (px 60)
        nthChild "odd" & backgroundColor C.lightGrey

  ".signIn" ? do

    form ? do
      let inputHeight = 50
      width (px 500)
      marginTop (px 50)
      marginLeft auto
      marginRight auto

      input ? do
        defaultInput inputHeight
        display block
        width (pct 100)
        marginBottom (px 10)

      button ? do
        defaultButton
        display block
        width (pct 100)
        height (px inputHeight)

    ".result" ? do
      marginTop (px 40)
      textAlign (alignSide sideCenter)
      ".success" ? color C.green
      ".error" ? color C.red

clearFix :: Css
clearFix =
  after & do
    content (stringContent "")
    display D.table
    clear both

defaultButton :: Css
defaultButton = do
  backgroundColor C.brown
  color C.white
  borderWidth (px 0)
  borderRadius (px 3) (px 3) (px 3) (px 3)

defaultInput :: Integer -> Css
defaultInput inputHeight = do
  height (px inputHeight)
  padding (px 10) (px 10) (px 10) (px 10)
  borderRadius (px 0) (px 0) (px 0) (px 0)
  border solid (px 1) C.grey
  focus & borderColor C.green