diff --git a/bindings/headlessui/Headlessui.res b/bindings/headlessui/Headlessui.res new file mode 100644 index 00000000..c2ed18d8 --- /dev/null +++ b/bindings/headlessui/Headlessui.res @@ -0,0 +1,83 @@ +module Popover = { + type popoverChildrenRenderProps = {@as("open") open_: bool} + + @module("@headlessui/react") @react.component + external make: ( + ~as_: string=?, + ~children: popoverChildrenRenderProps => React.element=?, + ~className: string=?, + ) => React.element = "Popover" + + module Overlay = { + @module("@headlessui/react") @scope("Popover") @react.component + external make: (~as_: string=?, ~children: 'children=?, ~className: string=?) => React.element = + "Overlay" + } + + module Button = { + @module("@headlessui/react") @scope("Popover") @react.component + external make: (~as_: string=?, ~children: 'children=?, ~className: string=?) => React.element = + "Button" + } + + module Panel = { + @module("@headlessui/react") @scope("Popover") @react.component + external make: ( + ~as_: string=?, + ~focus: bool=?, + ~static: bool=?, + ~unmount: bool=?, + ~children: 'children=?, + ~className: string=?, + ) => React.element = "Panel" + } + + module Group = { + @module("@headlessui/react") @scope("Popover") @react.component + external make: (~as_: string=?, ~children: 'children=?, ~className: string=?) => React.element = + "Group" + } +} + +module Transition = { + @module("@headlessui/react") @react.component + external make: ( + ~show: bool, + ~as_: string=?, + ~appear: bool=?, + ~unmount: bool=?, + ~enter: string=?, + ~enterFrom: string=?, + ~enterTo: string=?, + ~leave: string=?, + ~leaveFrom: string=?, + ~leaveTo: string=?, + ~beforeEnter: unit => unit=?, + ~afterEnter: unit => unit=?, + ~beforeLeave: unit => unit=?, + ~afterLeave: unit => unit=?, + ~children: 'children=?, + ~className: string=?, + ) => React.element = "Transition" + + module Child = { + @module("@headlessui/react") @scope("Transition") @react.component + external make: ( + ~as_: string=?, + ~appear: bool=?, + ~unmount: bool=?, + ~enter: string=?, + ~enterFrom: string=?, + ~enterTo: string=?, + ~leave: string=?, + ~leaveFrom: string=?, + ~leaveTo: string=?, + ~beforeEnter: unit => unit=?, + ~afterEnter: unit => unit=?, + ~beforeLeave: unit => unit=?, + ~afterLeave: unit => unit=?, + ~children: 'children, + ~className: string=?, + ) => React.element = "Child" + } +} diff --git a/bsconfig.json b/bsconfig.json index 21aabb16..b4a1b770 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -16,6 +16,10 @@ { "dir": "src" }, + { + "dir": "bindings", + "subdirs": true + }, { "dir": "pages", "subdirs": true diff --git a/package.json b/package.json index 88296068..9a4c7077 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@glennsl/bs-json": "^5.0.2", + "@headlessui/react": "^1.2.0", "@rescript/react": "^0.10.3", "bs-platform": "9.0.2", "next": "^10.2.0", diff --git a/src/FlyoutMenu.res b/src/FlyoutMenu.res new file mode 100644 index 00000000..a9553fb3 --- /dev/null +++ b/src/FlyoutMenu.res @@ -0,0 +1,75 @@ +module Popover = Headlessui.Popover +module Transition = Headlessui.Transition +module Link = Next.Link + +type item = { + name: string, + description: string, + href: string, + icon: React.element, +} + +@react.component +let make = (~name, ~items) => + + {({open_}) => <> + + {React.string(name)} + + + + + + +
+
+ {Array.mapi( + (idx, item: NavEntry.t) => + + + + {item.icon} + +
+

+ {React.string(item.label)} +

+

{React.string(item.text)}

+
+
+ , + items, + )->React.array} +
+
+
+
+ } +
diff --git a/src/HeaderNavigation.res b/src/HeaderNavigation.res index 8facb94a..6771c9a9 100644 --- a/src/HeaderNavigation.res +++ b/src/HeaderNavigation.res @@ -52,165 +52,9 @@ let make = (~content) => {
diff --git a/tailwind.config.js b/tailwind.config.js index c9aaf7f0..eaee5d02 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,8 +1,5 @@ module.exports = { - future: { - removeDeprecatedGapUtilities: true, - purgeLayersByDefault: true, - }, + mode: 'jit', purge: { // Specify the paths to all of the template files in your project content: [ diff --git a/yarn.lock b/yarn.lock index d30b5504..f55f1cf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -87,6 +87,11 @@ resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.1.1.tgz#9daf5745156fd84b8e9889a2dc721f0c58e894aa" integrity sha512-CAEbWH7OIur6jEOzaai83jq3FmKmv4PmX1JYfs9IrYcGEVI/lyL1EXJGCj7eFVJ0bg5QR8LMxBlEtA+xKiLpFw== +"@headlessui/react@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.2.0.tgz#e48652bfce82ddf73d7f331faeb9db6526ee6874" + integrity sha512-19DkLz8gDgbi+WvkoTzi9vs0NK9TJf94vbYhMzB4LYJo03Kili0gmvXT9CiKZoxXZ7YAvy/b1U1oQKEnjWrqxw== + "@next/env@10.2.0": version "10.2.0" resolved "https://registry.yarnpkg.com/@next/env/-/env-10.2.0.tgz#154dbce2efa3ad067ebd20b7d0aa9aed775e7c97" @@ -2147,7 +2152,6 @@ once@^1.3.0: "ood@git://github.com/ocaml/ood.git#main": version "0.0.0" - uid b37db9c51a252a7152be99c53346fd565ea7df65 resolved "git://github.com/ocaml/ood.git#b37db9c51a252a7152be99c53346fd565ea7df65" dependencies: bs-platform "9.0.2"