ry-blocks/src/Yoga.purs
Mark Eibes 8049bd80dc
rip (#4)
* Port Storybook

* Remove extrablatt

* Improve cluster

* Magic Johnson

* Remove mentions of Plumage

And delete some unnecessary stuff

* Hä

* I have changed the code files

* Reexports for typeahead

* Bring Select back

* Fix dark mode of select

* Move out react-aria

* Export select properly

* Make select work I guess
2022-11-25 13:38:19 +01:00

82 lines
1.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module Yoga where
import Data.Function as DF
import Prim.Row (class Lacks, class Union)
import React.Basic.DOM (Props_div, Props_span, Props_button)
import React.Basic.DOM as R
import React.Basic.Emotion as Emotion
import React.Basic.Hooks (JSX, ReactComponent)
import React.Basic.Hooks as Hooks
import Record as Record
import Type.Proxy (Proxy(..))
import Unsafe.Coerce (unsafeCoerce)
div' ∷
∀ attrs attrs_. Union attrs attrs_ Props_div ⇒ ReactComponent (Record attrs)
div' = R.div'
span' ∷
∀ attrs attrs_. Union attrs attrs_ Props_span ⇒ ReactComponent (Record attrs)
span' = R.span'
button' ∷
∀ attrs attrs_.
Union attrs attrs_ Props_button ⇒
ReactComponent (Record attrs)
button' = R.button'
el ∷
∀ props.
Lacks "children" props ⇒
ReactComponent { children ∷ Array JSX | props } →
Record props →
Array JSX →
JSX
el x props children =
(Hooks.element)
x
(Record.insert (Proxy ∷ Proxy "children") children props)
infixl 5 el as </
infixr 0 DF.apply as />
leaf ∷
∀ props.
Lacks "children" props ⇒
ReactComponent { | props } →
Record props →
JSX
leaf x props = Hooks.element x props
infixl 5 leaf as </>
styled ∷
∀ props.
Lacks "children" props ⇒
ReactComponent { children ∷ Array JSX | props } →
{ css ∷ Emotion.Style | props } →
Array JSX →
JSX
styled x props children =
( unsafeCoerce Emotion.element ∷
∀ r. ReactComponent { | r } → { css ∷ Emotion.Style | r } → JSX
) x
(Record.insert (Proxy ∷ Proxy "children") children props)
infixl 5 styled as </*
styledLeaf ∷
∀ props.
ReactComponent { | props } →
{ css ∷ Emotion.Style | props } →
JSX
styledLeaf x =
( unsafeCoerce Emotion.element ∷
∀ r. ReactComponent { | r } → { css ∷ Emotion.Style | r } → JSX
) x
infixl 5 styledLeaf as </*>
infixl 12 Record.disjointUnion as