AItool commited on
Commit
4b507bf
·
verified ·
1 Parent(s): 8abff3a

from int to str

Browse files
Files changed (1) hide show
  1. testnavbar.py +6 -20
testnavbar.py CHANGED
@@ -93,11 +93,10 @@ def ProductCard(p):
93
  # that aren't a goal of the page (like cancelling something that hasn't been submitted)
94
  # you generally want the default styling.
95
  Button("Add to cart", cls=(ButtonT.primary, "mt-3 w-full"),
96
- # HTMX can be used as normal on any component
97
- hx_get=product_detail.to(product_name=p['name']),
98
- hx_push_url='true',
99
- hx_target='body'),
100
- cls="shadow-lg rounded-lg overflow-hidden bg-white hover:shadow-xl transition-shadow"
101
  )
102
 
103
  # Define this once, at module level (top of file is best)
@@ -127,35 +126,24 @@ def index():
127
  )
128
 
129
  @rt
130
- def product_detail(product_name: str):
131
  return (
132
  Title("Product Detail"),
133
  Grid(
134
  Div(
135
  H3(product_name, cls="text-xl font-semibold mb-4"),
136
- # render_md is a helper that renders markdown into HTML using frankenui styles.
137
  render_md(example_product_description.format(product_name=product_name))
138
  ),
139
  Div(
140
  H3("Order", cls="text-lg font-semibold mb-3"),
141
- # Form automatically has a class of 'space-y-3' for a margin between each child.
142
  Form(
143
- # Product info (read-only)
144
  LabelInput("Product", id="name", value=product_name, readonly=True,
145
  cls="bg-gray-100 cursor-not-allowed"),
146
- LabelInput("Price", id="price", value=price, readonly=True,
147
  cls="bg-gray-100 cursor-not-allowed"),
148
-
149
- # Order details
150
  LabelInput("Quantity", id="quantity", placeholder="1"),
151
-
152
- # Customer info
153
  LabelInput("Email", id="email", placeholder="accountemail@example.com"),
154
-
155
- # Payment section
156
  Div(PaymentMethod, cls="space-y-4 mt-4"),
157
-
158
- # Actions
159
  Button("Add to order", cls=(ButtonT.primary, "w-full mt-4")),
160
  Button("Continue shopping",
161
  cls=(ButtonT.secondary, "w-full mt-2"),
@@ -164,8 +152,6 @@ def product_detail(product_name: str):
164
  hx_target="body")
165
  )
166
  ),
167
- # Grid has defaults and args for cols at different breakpoints, but you can pass in
168
- # your own to customize responsiveness.
169
  cols_lg=2,
170
  cls="gap-8 p-6"
171
  )
 
93
  # that aren't a goal of the page (like cancelling something that hasn't been submitted)
94
  # you generally want the default styling.
95
  Button("Add to cart", cls=(ButtonT.primary, "mt-3 w-full"),
96
+ hx_get=product_detail.to(product_name=p['name'], product_price=p['price']),
97
+ hx_push_url='true',
98
+ hx_target='body'),
99
+ cls="shadow-lg rounded-lg overflow-hidden bg-white hover:shadow-xl transition-shadow"
 
100
  )
101
 
102
  # Define this once, at module level (top of file is best)
 
126
  )
127
 
128
  @rt
129
+ def product_detail(product_name: str, product_price: str):
130
  return (
131
  Title("Product Detail"),
132
  Grid(
133
  Div(
134
  H3(product_name, cls="text-xl font-semibold mb-4"),
 
135
  render_md(example_product_description.format(product_name=product_name))
136
  ),
137
  Div(
138
  H3("Order", cls="text-lg font-semibold mb-3"),
 
139
  Form(
 
140
  LabelInput("Product", id="name", value=product_name, readonly=True,
141
  cls="bg-gray-100 cursor-not-allowed"),
142
+ LabelInput("Price", id="price", value=product_price, readonly=True,
143
  cls="bg-gray-100 cursor-not-allowed"),
 
 
144
  LabelInput("Quantity", id="quantity", placeholder="1"),
 
 
145
  LabelInput("Email", id="email", placeholder="accountemail@example.com"),
 
 
146
  Div(PaymentMethod, cls="space-y-4 mt-4"),
 
 
147
  Button("Add to order", cls=(ButtonT.primary, "w-full mt-4")),
148
  Button("Continue shopping",
149
  cls=(ButtonT.secondary, "w-full mt-2"),
 
152
  hx_target="body")
153
  )
154
  ),
 
 
155
  cols_lg=2,
156
  cls="gap-8 p-6"
157
  )