| 1 | use topcoat::{ |
| 2 | Result, |
| 3 | view::{Attributes, View, class, component, view}, |
| 4 | }; |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | const CARD: &str = "flex flex-col gap-5 rounded-xl border border-border bg-background py-6 \ |
| 14 | text-foreground shadow-sm"; |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | #[component] |
| 40 | pub async fn card(#[default] mut attrs: Attributes, #[default] child: View) -> Result { |
| 41 | view! { <div class=(class!(CARD, attrs.remove("class"))) (attrs)>(child)</div> } |
| 42 | } |
| 43 | |
| 44 | |
| 45 | |
| 46 | #[component] |
| 47 | pub async fn card_header(#[default] mut attrs: Attributes, #[default] child: View) -> Result { |
| 48 | view! { |
| 49 | <div |
| 50 | class=(class!("flex flex-col gap-1.5 px-6", attrs.remove("class"))) |
| 51 | (attrs) |
| 52 | > |
| 53 | (child) |
| 54 | </div> |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | |
| 59 | #[component] |
| 60 | pub async fn card_title(#[default] mut attrs: Attributes, #[default] child: View) -> Result { |
| 61 | view! { |
| 62 | <h3 class=(class!("leading-none font-semibold", attrs.remove("class"))) (attrs)> |
| 63 | (child) |
| 64 | </h3> |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | |
| 69 | #[component] |
| 70 | pub async fn card_description(#[default] mut attrs: Attributes, #[default] child: View) -> Result { |
| 71 | view! { |
| 72 | <p |
| 73 | class=(class!("text-sm text-muted-foreground", attrs.remove("class"))) |
| 74 | (attrs) |
| 75 | > |
| 76 | (child) |
| 77 | </p> |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | |
| 82 | #[component] |
| 83 | pub async fn card_content(#[default] mut attrs: Attributes, #[default] child: View) -> Result { |
| 84 | view! { <div class=(class!("px-6", attrs.remove("class"))) (attrs)>(child)</div> } |
| 85 | } |
| 86 | |
| 87 | |
| 88 | #[component] |
| 89 | pub async fn card_footer(#[default] mut attrs: Attributes, #[default] child: View) -> Result { |
| 90 | view! { |
| 91 | <div |
| 92 | class=(class!("flex items-center gap-2 px-6", attrs.remove("class"))) |
| 93 | (attrs) |
| 94 | > |
| 95 | (child) |
| 96 | </div> |
| 97 | } |
| 98 | } |