Skip to content

Commit 32211bf

Browse files
author
Daniel Harvey
committed
Add bits
1 parent b6fbbf7 commit 32211bf

File tree

7 files changed

+32
-119
lines changed

7 files changed

+32
-119
lines changed

packages.dhall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let additions =
2727
, "unordered-collections"
2828
, "cssom"
2929
]
30-
"../purs-cssom"
30+
"../purescript-stylesheet"
3131
"v0.0.1"
3232
}
3333

src/Internal/Consumer.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..))
77
import Data.Symbol (class IsSymbol)
88

99
import React as React
10-
import PursUI (CSSRuleSet, PursUI, addStyle)
10+
import Stylesheet (CSSRuleSet, Stylesheet, addStyle)
1111

1212
import React.Stylesheet.Internal.Types
1313

@@ -16,7 +16,7 @@ import React.Stylesheet.Internal.Types
1616
styleConsumer
1717
:: forall props label localState
1818
. IsSymbol label
19-
=> React.Context (Maybe (PursUI label))
19+
=> React.Context (Maybe (Stylesheet label))
2020
-> props
2121
-> localState
2222
-> CSSRuleSet props

src/Internal/Provider.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import Prelude (bind, pure, ($))
44
import Data.Maybe (Maybe(..))
55
import Data.Symbol (class IsSymbol)
66
import React as React
7-
import PursUI
7+
import Stylesheet
88

99
-- | Internal function for creating a Purescript React class that providers the
1010
-- | Radox store through React Context
1111
styleProvider
1212
:: forall label
1313
. IsSymbol label
14-
=> React.Context (Maybe (PursUI label))
14+
=> React.Context (Maybe (Stylesheet label))
1515
-> React.ReactClass { children :: Array React.ReactElement }
1616
styleProvider context
1717
= React.pureComponent "Provider" component
1818
where
1919
component this = do
20-
(stylesheet :: PursUI label) <- createBlankStyleSheet
20+
(stylesheet :: Stylesheet label) <- createBlankStylesheet
2121
pure $ { state : { }
2222
, render : render' this stylesheet
2323
}

src/Internal/StyleContext.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module React.Stylesheet.Internal.StyleContext where
33
import Data.Maybe (Maybe(..))
44
import Data.Symbol (class IsSymbol, SProxy)
55
import React as React
6-
import PursUI (PursUI)
6+
import Stylesheet (Stylesheet)
77
import React.Stylesheet.Internal.Types
88
import React.Stylesheet.Internal.Provider (styleProvider)
99
import React.Stylesheet.Internal.Consumer (styleConsumer)
@@ -16,7 +16,7 @@ createStyleContext
1616
=> SProxy label
1717
-> StyleContext label
1818
createStyleContext label =
19-
let myContext = React.createContext (Nothing :: Maybe (PursUI label))
19+
let myContext = React.createContext (Nothing :: Maybe (Stylesheet label))
2020
in { provider : styleProvider myContext
2121
, consumer : styleConsumer myContext
2222
}

src/Internal/Types.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module React.Stylesheet.Internal.Types where
22

33
import React as React
4-
import PursUI
4+
import Stylesheet
55

66
type StyleRenderMethod props localState
77
= (

src/StyleProvider.purs

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/Styled/Div.purs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,46 @@
1-
module App.Components.Styled.Div (div) where
1+
module React.Stylesheet.Styled.Div where
22

33
import Prelude (map, ($))
44
import Data.Array (intercalate)
55
import React.DOM.Props as Props
66
import React as React
77
import React.DOM as RDom
88

9-
import StyleProvider
9+
import React.Stylesheet.Internal.StyleContext
10+
import React.Stylesheet.Internal.Types
1011

11-
import PursUI (CSSRuleSet, CSSSelector(..))
12+
import Stylesheet (CSSRuleSet, CSSSelector(..))
1213

1314
construct
14-
:: forall props
15-
. (Array Props.Props -> Array React.ReactElement -> React.ReactElement)
15+
:: forall props label
16+
. StyleContext label
17+
-> (Array Props.Props -> Array React.ReactElement -> React.ReactElement)
1618
-> CSSRuleSet props
1719
-> props
1820
-> Array React.ReactElement
1921
-> React.ReactElement
20-
construct element cssRule props children
22+
construct styleContext element cssRule props children
2123
= styleContext.consumer props {} cssRule renderDiv
2224
where
2325
renderDiv { classNames }
2426
= RDom.div [ Props.className (toClassNames classNames) ]
2527
children
2628

27-
div
28-
:: forall props
29-
. CSSRuleSet props
30-
-> props
31-
-> Array React.ReactElement
32-
-> React.ReactElement
33-
div = construct RDom.div
29+
things styleContext
30+
= let construct' = construct styleContext
31+
in { a: construct' RDom.a
32+
, abbr: construct' RDom.abbr
33+
, address: construct' RDom.address
34+
, article: construct' RDom.article
35+
, aside: construct' RDom.aside
36+
, audio: construct' RDom.audio
37+
, b: construct' RDom.b
38+
, bdi: construct' RDom.bdi
39+
, bdo: construct' RDom.bdo
40+
, big: construct' RDom.big
41+
, blockquote: construct' RDom.blockquote
42+
, div: construct' RDom.div
43+
}
3444

3545
toClassNames :: Array CSSSelector -> String
3646
toClassNames as

0 commit comments

Comments
 (0)