+
+
+
+
+
+ {if let Some(text) = persona_primary_text {
+ Either::Left(
+ view! {
{(text.children)()} },
+ )
+ } else {
+ Either::Right(move || {
+ if let Some(name) = name.get() {
+ Either::Left(
+ view! {
{name} },
+ )
+ } else {
+ Either::Right(())
+ }
+ })
+ }}
+ {if let Some(text) = persona_secondary_text {
+ Either::Left(
+ view! {
{(text.children)()} },
+ )
+ } else {
+ Either::Right(())
+ }}
+ {if let Some(text) = persona_tertiary_text {
+ Either::Left(
+ view! {
{(text.children)()} },
+ )
+ } else {
+ Either::Right(())
+ }}
+ {if let Some(text) = persona_quaternary_text {
+ Either::Left(
+ view! {
{(text.children)()} },
+ )
+ } else {
+ Either::Right(())
+ }}
+
+
+
+
+
+
+
+ }
+}
diff --git a/thaw/src/persona/persona.css b/thaw/src/persona/persona.css
new file mode 100644
index 00000000..919df764
--- /dev/null
+++ b/thaw/src/persona/persona.css
@@ -0,0 +1,96 @@
+.thaw-persona {
+ display: inline-grid;
+ grid-auto-rows: max-content;
+ grid-auto-flow: column;
+ justify-items: start;
+ grid-template-columns: max-content [middle] auto;
+}
+
+.thaw-persona.thaw-persona--center:not(.thaw-persona--below) {
+ /* This template is needed to make sure the Avatar is centered when it takes up more space than the text lines */
+ grid-template-rows: 1fr [primary] max-content [secondary] max-content [tertiary] max-content [quaternary] max-content 1fr;
+}
+
+.thaw-persona--before {
+ justify-items: end;
+ grid-template-columns: auto [middle] max-content;
+}
+
+.thaw-persona--below {
+ grid-auto-flow: unset;
+ justify-items: center;
+ grid-template-columns: unset;
+}
+
+.thaw-persona:not(.thaw-persona--below) .thaw-persona__avatar {
+ grid-row-start: span 5;
+}
+
+.thaw-persona--start .thaw-persona__avatar {
+ align-self: start;
+}
+
+.thaw-persona--center .thaw-persona__avatar {
+ align-self: center;
+}
+
+.thaw-persona.thaw-persona--center:not(.thaw-persona--below)
+ .thaw-persona__avatar {
+ grid-row-start: span 6;
+}
+
+.thaw-persona--after .thaw-persona__avatar {
+ margin-right: var(--thaw-persona__avatar-spacing);
+}
+
+.thaw-persona--below .thaw-persona__avatar {
+ margin-bottom: var(--thaw-persona__avatar-spacing);
+}
+
+.thaw-persona--before .thaw-persona__avatar {
+ margin-left: var(--thaw-persona__avatar-spacing);
+}
+
+.thaw-persona__primary-text {
+ display: block;
+ color: var(--colorNeutralForeground1);
+ font-family: var(--fontFamilyBase);
+ font-size: var(--fontSizeBase300);
+ font-weight: var(--fontWeightRegular);
+ line-height: var(--lineHeightBase300);
+}
+
+.thaw-persona__secondary-text {
+ margin-top: -2px;
+}
+
+.thaw-persona__secondary-text,
+.thaw-persona__tertiary-text,
+.thaw-persona__quaternary-text {
+ display: block;
+ color: var(--colorNeutralForeground2);
+ font-family: var(--fontFamilyBase);
+ font-size: var(--fontSizeBase200);
+ font-weight: var(--fontWeightRegular);
+ line-height: var(--lineHeightBase200);
+}
+
+.thaw-persona.thaw-persona--center:not(.thaw-persona--below)
+ .thaw-persona__primary-text {
+ grid-row-start: primary;
+}
+
+.thaw-persona.thaw-persona--center:not(.thaw-persona--below)
+ .thaw-persona__secondary-text {
+ grid-row-start: secondary;
+}
+
+.thaw-persona.thaw-persona--center:not(.thaw-persona--below)
+ .thaw-persona__tertiary-text {
+ grid-row-start: tertiary;
+}
+
+.thaw-persona.thaw-persona--center:not(.thaw-persona--below)
+ .thaw-persona__quaternary-text {
+ grid-row-start: quaternary;
+}
diff --git a/thaw/src/persona/types.rs b/thaw/src/persona/types.rs
new file mode 100644
index 00000000..ccc84671
--- /dev/null
+++ b/thaw/src/persona/types.rs
@@ -0,0 +1,90 @@
+use leptos::prelude::*;
+
+#[slot]
+pub struct PersonaPrimaryText {
+ children: Children,
+}
+
+#[slot]
+pub struct PersonaSecondaryText {
+ children: Children,
+}
+
+#[slot]
+pub struct PersonaTertiaryText {
+ children: Children,
+}
+
+#[slot]
+pub struct PersonaQuaternaryText {
+ children: Children,
+}
+
+#[derive(Debug, Default, Clone, PartialEq)]
+pub enum PersonaTextAlignment {
+ #[default]
+ Start,
+ Center,
+}
+
+impl PersonaTextAlignment {
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ Self::Start => "start",
+ Self::Center => "center",
+ }
+ }
+}
+
+#[derive(Debug, Default, Clone, PartialEq)]
+pub enum PersonaTextPosition {
+ Before,
+ #[default]
+ After,
+ Below,
+}
+
+impl PersonaTextPosition {
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ Self::Before => "before",
+ Self::After => "after",
+ Self::Below => "below",
+ }
+ }
+}
+
+#[derive(Debug, Default, Clone, PartialEq)]
+pub enum PersonaSize {
+ ExtraSmall,
+ Small,
+ #[default]
+ Medium,
+ Large,
+ ExtraLarge,
+ Huge,
+}
+
+impl PersonaSize {
+ pub(crate) fn as_avatar_size(&self) -> u8 {
+ match self {
+ Self::ExtraSmall => 20,
+ Self::Small => 28,
+ Self::Medium => 32,
+ Self::Large => 36,
+ Self::ExtraLarge => 40,
+ Self::Huge => 56,
+ }
+ }
+
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ Self::ExtraSmall => "extra-small",
+ Self::Small => "small",
+ Self::Medium => "medium",
+ Self::Large => "large",
+ Self::ExtraLarge => "extra-large",
+ Self::Huge => "huge",
+ }
+ }
+}