11import reflex as rx
2- import reflex_chakra as rc
32
43from api_admin_panel .states .base import BaseState
54from api_admin_panel .states .queries import QueryAPI , QueryState
98def item_title (title : str ):
109 return rx .hstack (
1110 rx .text (title , font_size = "var(--chakra-fontSizes-sm)" , ** text ),
12- rc .accordion_icon (),
1311 width = "100%" ,
1412 justify_content = "space-between" ,
1513 )
@@ -60,16 +58,16 @@ def create_entry(title: str, function: callable):
6058def form_item (
6159 title : str , state : list [dict [str , str ]], func : callable , event_trigger : callable
6260):
63- return rc .accordion (
64- rc . accordion_item (
65- rc . accordion_button ( item_title (title )),
66- rc . accordion_panel (
61+ return rx .accordion . root (
62+ rx . accordion . item (
63+ rx . accordion . header ( rx . accordion . trigger ( item_title (title ) )),
64+ rx . accordion . content (
6765 item_add_event (event_trigger ),
6866 width = "100%" ,
6967 display = "flex" ,
7068 justify_content = "end" ,
7169 ),
72- rc . accordion_panel (
70+ rx . accordion . content (
7371 rx .vstack (rx .foreach (state , func ), width = "100%" , spacing = "1" )
7472 ),
7573 ),
@@ -82,10 +80,10 @@ def form_item(
8280def form_body_param_item (
8381 state : list [dict [str , str ]], func : callable , event_trigger : callable
8482):
85- return rc .accordion (
86- rc . accordion_item (
87- rc . accordion_button ( item_title ("Body" )),
88- rc . accordion_panel (
83+ return rx .accordion . root (
84+ rx . accordion . item (
85+ rx . accordion . header ( rx . accordion . trigger ( item_title ("Body" ) )),
86+ rx . accordion . content (
8987 rx .match (
9088 QueryState .current_req ,
9189 (
@@ -125,10 +123,10 @@ def form_body_param_item(
125123
126124
127125def form_request_item ():
128- return rc .accordion (
129- rc . accordion_item (
130- rc . accordion_button ( item_title ("Requests" )),
131- rc . accordion_panel (
126+ return rx .accordion . root (
127+ rx . accordion . item (
128+ rx . accordion . header ( rx . accordion . trigger ( item_title ("Requests" ) )),
129+ rx . accordion . content (
132130 rx .hstack (
133131 rx .select (
134132 QueryState .req_methods ,
0 commit comments