AItool commited on
Commit
102f9a9
·
verified ·
1 Parent(s): aab4a1f

Update testnavbar.py

Browse files
Files changed (1) hide show
  1. testnavbar.py +30 -29
testnavbar.py CHANGED
@@ -51,35 +51,36 @@ PaymentMethod = Card(
51
  def ProductCard(p):
52
  # Card does lots of boilerplate classes so you can just pass in the content
53
  return Card(
54
- # width:100% makes the image take the full width so we are guarenteed that we won't
55
- # have the image cut off or not large enough. Because all our images are a consistent
56
- # size we do not need to worry about stretching or skewing the image, this is ideal.
57
- # If you have images of different sizes, you will need to use object-fit:cover and/or
58
- # height to either strech, shrink, or crop the image. It is much better to adjust your
59
- # images to be a consistent size upfront so you don't have to handle edge cases of
60
- # different images skeweing/stretching differently.
61
- Img(src=p["img"], alt=p["name"], style="width:100%"),
62
- # All components can take a cls argument to add additional styling - `mt-2` adds margin
63
- # to the top (see spacing tutorial for details on spacing).
64
- #
65
- # Often adding space makes a site look more put together - usually the 2 - 5 range is a
66
- # good choice
67
- H4(p["name"], cls="mt-3 text-lg font-semibold"),
68
- # There are helpful Enums, such as TextPresetsT, ButtonT, ContainerT, etc that allow for easy
69
- # discoverability of class options.
70
- # bold_sm is helpful for things that you want to look like regular text, but stand out
71
- # visually for emphasis.
72
- p["price"], cls=(TextPresets.bold_sm, "text-gray-700 mt-1"),
73
- # ButtonT.primary is useful for actions you really want the user to take (like adding
74
- # something to the cart) - these stand out visually. For dangerous actions (like
75
- # deleting something) you generally would want to use ButtonT.destructive. For UX actions
76
- # that aren't a goal of the page (like cancelling something that hasn't been submitted)
77
- # you generally want the default styling.
78
- Button("Add to cart", cls=(ButtonT.primary, "mt-2"),
79
- # HTMX can be used as normal on any component
80
- hx_get=product_detail.to(product_name=p['name']),
81
- hx_push_url='true',
82
- hx_target='body'))
 
83
 
84
  @rt
85
  def index():
 
51
  def ProductCard(p):
52
  # Card does lots of boilerplate classes so you can just pass in the content
53
  return Card(
54
+ # width:100% makes the image take the full width so we are guarenteed that we won't
55
+ # have the image cut off or not large enough. Because all our images are a consistent
56
+ # size we do not need to worry about stretching or skewing the image, this is ideal.
57
+ # If you have images of different sizes, you will need to use object-fit:cover and/or
58
+ # height to either strech, shrink, or crop the image. It is much better to adjust your
59
+ # images to be a consistent size upfront so you don't have to handle edge cases of
60
+ # different images skeweing/stretching differently.
61
+ Img(src=p["img"], alt=p["name"], style="width:100%"),
62
+ # All components can take a cls argument to add additional styling - `mt-2` adds margin
63
+ # to the top (see spacing tutorial for details on spacing).
64
+ #
65
+ # Often adding space makes a site look more put together - usually the 2 - 5 range is a
66
+ # good choice
67
+ H4(p["name"], cls="mt-3 text-lg font-semibold"),
68
+ # There are helpful Enums, such as TextPresetsT, ButtonT, ContainerT, etc that allow for easy
69
+ # discoverability of class options.
70
+ # bold_sm is helpful for things that you want to look like regular text, but stand out
71
+ # visually for emphasis.
72
+ P(p["price"], cls=(TextPresets.bold_sm, "text-gray-700 mt-1")),
73
+ # ButtonT.primary is useful for actions you really want the user to take (like adding
74
+ # something to the cart) - these stand out visually. For dangerous actions (like
75
+ # deleting something) you generally would want to use ButtonT.destructive. For UX actions
76
+ # that aren't a goal of the page (like cancelling something that hasn't been submitted)
77
+ # you generally want the default styling.
78
+ Button("Add to cart", cls=(ButtonT.primary, "mt-2"),
79
+ # HTMX can be used as normal on any component
80
+ hx_get=product_detail.to(product_name=p['name']),
81
+ hx_push_url='true',
82
+ hx_target='body')
83
+ )
84
 
85
  @rt
86
  def index():