| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Web.Atomic.Types.Style
Contents
Synopsis
- newtype Property = Property Text
- data Declaration = Property :. Style
- newtype Style = Style String
- class ToStyle a where
- class PropertyStyle (property :: k) value where
- propertyStyle :: value -> Style
- data None = None
- data Normal = Normal
- data Auto = Auto
- data Length
- newtype PxRem = PxRem' Int
- newtype Ms = Ms Int
- data Wrap
- data Sides a
- class ToColor a where
- colorValue :: a -> HexColor
- colorName :: a -> Text
- newtype HexColor = HexColor Text
Documentation
data Declaration Source #
Instances
| Show Declaration Source # | |
Defined in Web.Atomic.Types.Style Methods showsPrec :: Int -> Declaration -> ShowS # show :: Declaration -> String # showList :: [Declaration] -> ShowS # | |
| Eq Declaration Source # | |
Defined in Web.Atomic.Types.Style | |
| Ord Declaration Source # | |
Defined in Web.Atomic.Types.Style Methods compare :: Declaration -> Declaration -> Ordering # (<) :: Declaration -> Declaration -> Bool # (<=) :: Declaration -> Declaration -> Bool # (>) :: Declaration -> Declaration -> Bool # (>=) :: Declaration -> Declaration -> Bool # max :: Declaration -> Declaration -> Declaration # min :: Declaration -> Declaration -> Declaration # | |
class ToStyle a where Source #
Convert a type to a css style value
data Float = Right | Left instance ToStyle Float where style Right = "right" style Left = "left"
Minimal complete definition
Nothing
Instances
| ToStyle ListType Source # | |
| ToStyle BorderStyle Source # | |
Defined in Web.Atomic.CSS.Box Methods style :: BorderStyle -> Style Source # | |
| ToStyle Display Source # | |
| ToStyle FlexDirection Source # | |
Defined in Web.Atomic.CSS.Layout Methods style :: FlexDirection -> Style Source # | |
| ToStyle FlexWrap Source # | |
| ToStyle Overflow Source # | |
| ToStyle Position Source # | |
| ToStyle Visibility Source # | |
Defined in Web.Atomic.CSS.Layout Methods style :: Visibility -> Style Source # | |
| ToStyle Align Source # | |
| ToStyle WhiteSpace Source # | |
Defined in Web.Atomic.CSS.Text Methods style :: WhiteSpace -> Style Source # | |
| ToStyle Auto Source # | |
| ToStyle HexColor Source # | |
| ToStyle Length Source # | |
| ToStyle Ms Source # | |
| ToStyle None Source # | |
| ToStyle Normal Source # | |
| ToStyle PxRem Source # | |
| ToStyle Style Source # | |
| ToStyle Wrap Source # | |
| ToStyle Text Source # | |
| ToStyle String Source # | |
| ToStyle Float Source # | |
| ToStyle Int Source # | |
class PropertyStyle (property :: k) value where Source #
Reuse types that belong to more than one css property
data None = None
deriving (Show, ToClassName, ToStyle)
data Display
= Block
| Flex
deriving (Show, ToClassName, ToStyle)
instance PropertyStyle Display Display
instance PropertyStyle Display None
display :: (PropertyStyle Display d, ToClassName d, Styleable h) => d -> CSS h -> CSS h
display disp =
utility ("disp" -. disp) ["display" :. propertyStyle @Display disp]
Minimal complete definition
Nothing
Methods
propertyStyle :: value -> Style Source #
default propertyStyle :: ToStyle value => value -> Style Source #
Instances
Constructors
| None |
Instances
| ToClassName None Source # | |
Defined in Web.Atomic.Types.Style Methods toClassName :: None -> ClassName Source # | |
| ToStyle None Source # | |
| Show None Source # | |
| PropertyStyle ListType None Source # | |
Defined in Web.Atomic.CSS Methods propertyStyle :: None -> Style Source # | |
| PropertyStyle Shadow None Source # | |
Defined in Web.Atomic.CSS.Box Methods propertyStyle :: None -> Style Source # | |
| PropertyStyle Display None Source # | |
Defined in Web.Atomic.CSS.Layout Methods propertyStyle :: None -> Style Source # | |
Constructors
| Normal |
Instances
| ToClassName Normal Source # | |
Defined in Web.Atomic.Types.Style Methods toClassName :: Normal -> ClassName Source # | |
| ToStyle Normal Source # | |
| Show Normal Source # | |
| PropertyStyle WhiteSpace Normal Source # | |
Defined in Web.Atomic.CSS.Text Methods propertyStyle :: Normal -> Style Source # | |
Constructors
| Auto |
Instances
| ToClassName Auto Source # | |
Defined in Web.Atomic.Types.Style Methods toClassName :: Auto -> ClassName Source # | |
| ToStyle Auto Source # | |
| Show Auto Source # | |
| PropertyStyle Overflow Auto Source # | |
Defined in Web.Atomic.CSS.Layout Methods propertyStyle :: Auto -> Style Source # | |
Px, converted to Rem. Allows for the user to change the document font size and have the app scale accordingly. But allows the programmer to code in pixels to match a design
Instances
| ToClassName PxRem Source # | |
Defined in Web.Atomic.Types.Style Methods toClassName :: PxRem -> ClassName Source # | |
| ToStyle PxRem Source # | |
| Enum PxRem Source # | |
Defined in Web.Atomic.Types.Style | |
| Num PxRem Source # | |
| Integral PxRem Source # | |
| Real PxRem Source # | |
Defined in Web.Atomic.Types.Style Methods toRational :: PxRem -> Rational # | |
| Show PxRem Source # | |
| Eq PxRem Source # | |
| Ord PxRem Source # | |
Milliseconds, used for transitions
Instances
| ToClassName Wrap Source # | |
Defined in Web.Atomic.Types.Style Methods toClassName :: Wrap -> ClassName Source # | |
| ToStyle Wrap Source # | |
| Show Wrap Source # | |
| PropertyStyle FlexWrap Wrap Source # | |
Defined in Web.Atomic.CSS.Layout Methods propertyStyle :: Wrap -> Style Source # | |
| PropertyStyle WhiteSpace Wrap Source # | |
Defined in Web.Atomic.CSS.Text Methods propertyStyle :: Wrap -> Style Source # | |
Options for styles that support specifying various sides
border 5 border (X 2) border (TRBL 0 5 0 0)
Colors
class ToColor a where Source #
ToColor allows you to create a type containing your application's colors:
data AppColor = White | Primary | Dark deriving (Show) instance ToColor AppColor where colorValue White = "#FFF" colorValue Dark = "#333" colorValue Primary = "#00F" hello = el ~ bg Primary . color White $ "Hello"
Minimal complete definition
Methods
colorValue :: a -> HexColor Source #
Hexidecimal Color. Can be specified with or without the leading #. Recommended to use an AppColor type instead of manually using hex colors. See ToColor