Skip to content

Commit

Permalink
added cursor property
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey committed Aug 29, 2014
1 parent 98911bd commit 15367c4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/Clay/Display.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ module Clay.Display

, VerticalAlign(..)
, baseline, middle, vAlignSub, textTop, textBottom, vAlignTop, vAlignBottom

-- * Cursor

, Cursor(..)
, crosshair, cursorDefault, pointer, move, eResize, neResize, nwResize, nResize, seResize, swResize, sResize, wResize, cursorText, wait, cursorProgress, help, cursorUrl

)
where
Expand All @@ -76,6 +81,7 @@ import Clay.Size
import Clay.Property
import Clay.Stylesheet
import Clay.Common
import Data.Text (Text)

-------------------------------------------------------------------------------

Expand Down Expand Up @@ -237,3 +243,35 @@ textTop = VerticalAlignValue "text-top"
textBottom = VerticalAlignValue "text-bottom"
vAlignTop = VerticalAlignValue "top"
vAlignBottom = VerticalAlignValue "bottom"

-------------------------------------------------------------------------------

class (Val a) => Cursor a where
cursor :: a -> Css
cursor = key "cursor"

newtype CursorValue a = CursorValue Value deriving (Val,Inherit,Auto)

instance Cursor (CursorValue a)

crosshair,cursorDefault,pointer,move,eResize,neResize,nwResize,nResize,seResize,swResize,sResize,wResize,cursorText,wait,cursorProgress,help :: CursorValue Value

crosshair = CursorValue "crosshair"
cursorDefault = CursorValue "cursorDefault"
pointer = CursorValue "pointer"
move = CursorValue "move"
eResize = CursorValue "e-resize"
neResize = CursorValue "ne-resize"
nwResize = CursorValue "nw-resize"
nResize = CursorValue "n-resize"
seResize = CursorValue "se-resize"
swResize = CursorValue "sw-resize"
sResize = CursorValue "sResize"
wResize = CursorValue "sResize"
cursorText = CursorValue "text"
wait = CursorValue "wait"
cursorProgress = CursorValue "progress"
help = CursorValue "help"

cursorUrl :: Text -> CursorValue Value
cursorUrl u = CursorValue $ value ("url(\"" <> u <> "\")")

0 comments on commit 15367c4

Please sign in to comment.