Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Collapse type class resolves naming collision, #225. #227

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions src/Clay/Border.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module Clay.Border
, borderBottomLeftRadius, borderBottomRightRadius

-- * Collapsing borders model for a table
, BorderCollapse
, separate
, borderCollapse
, borderSpacing, borderSpacing2
)
Expand All @@ -37,7 +39,6 @@ import Clay.Stylesheet
import Clay.Color
import Clay.Common
import Clay.Size
import Clay.Display

newtype Stroke = Stroke Value
deriving (Val, Other, Inherit, Auto, None)
Expand Down Expand Up @@ -158,19 +159,13 @@ borderBottomRightRadius a b = key "border-bottom-right-radius" (a ! b)

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

{- newtype Collapse = Collapse Value
deriving (Val, Initial, Inherit, Other)
newtype BorderCollapse = BorderCollapse Value
deriving (Val, Other, Inherit, Initial, Unset, Collapse)

collapseCollapse, collapseSeparate :: Collapse
separate :: BorderCollapse
separate = BorderCollapse "separate"

collapseCollapse = Collapse "collapse"
collapseSeparate = Collapse "separate" -}

{- Due conflict with Visibility collapse
Preferred just to add separate to Visibility
Because (borderCollapse collapseCollapse) sounds bad -}

borderCollapse :: Visibility -> Css
borderCollapse :: BorderCollapse -> Css
borderCollapse = key "border-collapse"

borderSpacing :: Size a -> Css
Expand Down
4 changes: 4 additions & 0 deletions src/Clay/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class All a where all :: a
class Auto a where auto :: a
class Baseline a where baseline :: a
class Center a where center :: a
class Collapse a where collapse :: a
class Inherit a where inherit :: a
class None a where none :: a
class Normal a where normal :: a
Expand All @@ -41,6 +42,8 @@ baselineValue :: Value
baselineValue = "baseline"
centerValue :: Value
centerValue = "center"
collapseValue :: Value
collapseValue = "collapse"
inheritValue :: Value
inheritValue = "inherit"
normalValue :: Value
Expand All @@ -60,6 +63,7 @@ instance All Value where all = allValue
instance Auto Value where auto = autoValue
instance Baseline Value where baseline = baselineValue
instance Center Value where center = centerValue
instance Collapse Value where collapse = collapseValue
instance Inherit Value where inherit = inheritValue
instance Normal Value where normal = normalValue
instance None Value where none = noneValue
Expand Down
8 changes: 1 addition & 7 deletions src/Clay/Display.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module Clay.Display
-- * Visibility.

, Visibility
, collapse, separate

, visibility

Expand Down Expand Up @@ -186,12 +185,7 @@ overflowY = key "overflow-y"
-------------------------------------------------------------------------------

newtype Visibility = Visibility Value
deriving (Val, Other, Auto, Inherit, Hidden, Visible)

separate, collapse :: Visibility

collapse = Visibility "collapse"
separate = Visibility "separate"
deriving (Val, Other, Auto, Inherit, Hidden, Visible, Collapse)

visibility :: Visibility -> Css
visibility = key "visibility"
Expand Down