Skip to content

Commit 46da8f3

Browse files
authored
rewrite inkeep (#1228)
1 parent 4a9e610 commit 46da8f3

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

pcweb/components/docpage/navbar/inkeep.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@
88
from reflex.vars import Var
99

1010

11-
class Search(rx.Component):
12-
tag = "SearchBar"
11+
class InkeepSearchBar(rx.NoSSRComponent):
12+
tag = "InkeepSearchBar"
13+
library = "@inkeep/uikit-js"
1314

14-
special_props: List[Var] = [Var("{...searchBarProps}")]
15-
16-
is_open: Var[bool] = False
17-
18-
on_close: EventHandler[lambda: []]
19-
20-
on_shortcut_key_pressed: EventHandler[lambda: []]
2115

16+
class Search(rx.el.Div):
2217
class_name: Var[str] = "max-w-[256px] max-h-[32px]"
2318

2419
def add_imports(self):
2520
"""Add the imports for the component."""
2621
return {
27-
"next/dynamic": {ImportVar(tag="dynamic", is_default=True)},
2822
"react": {ImportVar(tag="useContext")},
2923
"$/utils/context": {ImportVar(tag="ColorModeContext")},
3024
}
@@ -33,12 +27,7 @@ def add_hooks(self):
3327
"""Add the hooks for the component."""
3428
return [
3529
"const { resolvedColorMode } = useContext(ColorModeContext)",
36-
"""const SearchBar = dynamic(
37-
() => import('@inkeep/uikit').then((mod) => mod.InkeepSearchBar),
38-
{
39-
ssr: false,
40-
},
41-
);
30+
"""
4231
const supportFormConfig = {
4332
heading: "Contact support",
4433
fields: [
@@ -237,5 +226,14 @@ def add_hooks(self):
237226
};""",
238227
]
239228

229+
@classmethod
230+
def create(cls):
231+
"""Create the search component."""
232+
return super().create(
233+
InkeepSearchBar.create(
234+
special_props=[Var("{...searchBarProps}")],
235+
)
236+
)
237+
240238

241239
inkeep = Search.create

0 commit comments

Comments
 (0)