Skip to content

Commit b231d96

Browse files
authored
Merge pull request #70 from garyb/font-style
Add font-style values
2 parents 5ad759b + 33be0ba commit b231d96

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/CSS.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CSS.Display (Display(..), Position(..), absolute, block, display, display
99
import CSS.Elements (a, abbr, address, area, article, aside, audio, b, bdi, bdo, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, datalist, dd, del, details, dfn, div, dl, dt, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, html, i, iframe, img, input, ins, kbd, label, legend, li, main, map, mark, meter, nav, object, ol, optgroup, output, p, pre, progress, q, s, samp, section, small, span, strong, sub, summary, sup, tbody, td, textarea, tfoot, th, thead, tr, u, ul, var) as X
1010
import CSS.Flexbox (class FlexEnd, class FlexStart, class SpaceAround, class SpaceBetween, class Stretch, AlignContentValue(..), AlignItemsValue(..), AlignSelfValue(..), FlexDirection(..), FlexWrap(..), JustifyContentValue(..), alignContent, alignItems, alignSelf, column, columnReverse, flexBasis, flexDirection, flexEnd, flexFlow, flexGrow, flexShrink, flexStart, flexWrap, justifyContent, nowrap, order, row, rowReverse, spaceAround, spaceBetween, stretch, wrap, wrapReverse) as X
1111
import CSS.FontFace (FontFaceFormat(..), FontFaceSrc(..), fontFaceFamily, fontFaceSrc, formatName) as X
12-
import CSS.Font (FontWeight(..), GenericFontFamily(..), bold, bolder, color, fontFamily, fontSize, fontWeight, lighter, sansSerif, weight) as X
12+
import CSS.Font (FontStyle, FontWeight(..), GenericFontFamily(..), bold, bolder, color, fontFamily, fontSize, fontStyle, fontWeight, italic, lighter, oblique, sansSerif, weight) as X
1313
import CSS.Geometry (bottom, height, left, margin, marginBottom, marginLeft, marginRight, marginTop, maxHeight, maxWidth, minHeight, minWidth, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, right, top, width) as X
1414
import CSS.Gradient (Extend, Radial, Ramp, circle, circular, closestCorner, closestSide, ellipse, elliptical, farthestCorner, farthestSide, hGradient, hRepeatingGradient, linearGradient, radialGradient, repeatingLinearGradient, repeatingRadialGradient, vGradient, vRepeatingGradient) as X
1515
import CSS.Property (class Val, Key(..), Literal(..), Prefixed(..), Value(..), cast, noCommas, plain, quote, value, (!)) as X

src/CSS/Font.purs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,33 @@ weight i = FontWeight $ value i
6666

6767
fontWeight :: FontWeight -> CSS
6868
fontWeight = key $ fromString "font-weight"
69+
70+
newtype FontStyle = FontStyle Value
71+
72+
derive instance eqFontStyle :: Eq FontStyle
73+
derive instance ordFontStyle :: Ord FontStyle
74+
derive instance genericFontStyle :: Generic FontStyle
75+
76+
instance valFontStyle :: Val FontStyle where
77+
value (FontStyle v) = v
78+
79+
instance normalFontStyle :: Normal FontStyle where
80+
normal = FontStyle (fromString "normal")
81+
82+
instance initialFontStyle :: Initial FontStyle where
83+
initial = FontStyle (fromString "initial")
84+
85+
instance inheritFontStyle :: Inherit FontStyle where
86+
inherit = FontStyle (fromString "inherit")
87+
88+
instance unsetFontStyle :: Unset FontStyle where
89+
unset = FontStyle (fromString "unset")
90+
91+
italic :: FontStyle
92+
italic = FontStyle $ fromString "italic"
93+
94+
oblique :: FontStyle
95+
oblique = FontStyle $ fromString "oblique"
96+
97+
fontStyle :: FontStyle -> CSS
98+
fontStyle = key $ fromString "font-style"

0 commit comments

Comments
 (0)