components.rs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. use maud::{html, Markup};
  2. pub fn info_card(title: &str, items: Vec<(&str, String)>) -> Markup {
  3. html! {
  4. div class="card" {
  5. h2 style="font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.5; padding-bottom: 1rem; border-bottom: 1px solid hsl(var(--border)); margin-bottom: 0;" { (title) }
  6. div style="margin-top: 1.5rem;" {
  7. @for (label, value) in items {
  8. div class="info-item" {
  9. span class="info-label" { (label) ":" }
  10. span class="info-value" { (value) }
  11. }
  12. }
  13. }
  14. }
  15. }
  16. }
  17. pub fn form_card(title: &str, form_content: Markup) -> Markup {
  18. html! {
  19. div class="card" {
  20. h2 style="font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.5; padding-bottom: 1rem; border-bottom: 1px solid hsl(var(--border)); margin-bottom: 0;" { (title) }
  21. div style="margin-top: 1.5rem;" {
  22. (form_content)
  23. }
  24. }
  25. }
  26. }
  27. pub fn success_message(message: &str) -> Markup {
  28. html! {
  29. div class="success" { (message) }
  30. }
  31. }
  32. pub fn error_message(message: &str) -> Markup {
  33. html! {
  34. div class="error" { (message) }
  35. }
  36. }
  37. pub fn invoice_display_card(
  38. invoice_text: &str,
  39. amount: &str,
  40. details: Vec<(&str, String)>,
  41. back_url: &str,
  42. ) -> Markup {
  43. html! {
  44. div class="card" {
  45. div style="display: flex; justify-content: space-between; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid hsl(var(--border)); margin-bottom: 1.5rem;" {
  46. h3 style="font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.5; margin: 0;" { "Invoice Details" }
  47. }
  48. // Amount highlight section at the top
  49. div class="invoice-amount-section" {
  50. div class="invoice-amount-label" { "Amount" }
  51. div class="invoice-amount-value" { (amount) }
  52. }
  53. // Invoice display section - under the amount
  54. div class="invoice-display-section" {
  55. div class="invoice-label" { "Invoice" }
  56. div class="invoice-display-container" {
  57. textarea readonly class="invoice-textarea" { (invoice_text) }
  58. }
  59. }
  60. // Invoice details section - after the invoice with increased spacing
  61. div class="invoice-details-section" style="margin-top: 2.5rem;" {
  62. h4 style="font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.5; margin: 0 0 1rem 0;" { "Details" }
  63. @for (label, value) in details {
  64. div class="info-item" {
  65. span class="info-label" { (label) ":" }
  66. span class="info-value" { (value) }
  67. }
  68. }
  69. }
  70. // Back button at bottom left - no border lines
  71. div style="margin-top: 2rem;" {
  72. a href=(back_url) style="text-decoration: none;" {
  73. button class="button-outline" style="padding: 0.5rem 1rem; font-size: 0.875rem;" { "Back" }
  74. }
  75. }
  76. }
  77. }
  78. }