On a phone the composer opened at the top of the feed whether or not the feed was scrolled there, and a reply, quote or edit opened inside its card's 228px column. New PhoneSheet shows them as a sheet from the bottom of the screen below md, over a dimmed page, with a heading and a close button (a tap outside or Escape closes it too); from md they stay in place as before. On a phone a new post starts from a round button under the thumb (the feed keeps room for it at the bottom), and the tabs' Post button shows from md. Opening the composer scrolls the feed to its top, and the composer's words take the focus (DTextarea.Element). Picking a suggested mention or hashtag keeps the focus, and the phone's keyboard, in the words (DButton.KeepFocus, and the words are focused again). The character count sits under the words instead of over their last line, and the visibility menu names each choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
78 lines
2.4 KiB
Plaintext
78 lines
2.4 KiB
Plaintext
@inherits DComponentBase
|
|
|
|
@* daisyUI Button: https://daisyui.com/components/button/ . Renders an <a> when Href is set. *@
|
|
@if (Href is null)
|
|
{
|
|
<button @attributes="AdditionalAttributes" type="@Type" class="@CssClass" disabled="@Disabled" @onclick="OnClick"
|
|
@onmousedown:preventDefault="KeepFocus">
|
|
@ChildContent
|
|
</button>
|
|
}
|
|
else
|
|
{
|
|
<a @attributes="AdditionalAttributes" href="@(Disabled ? null : Href)" class="@CssClass" role="button"
|
|
aria-disabled="@(Disabled ? "true" : null)" tabindex="@(Disabled ? "-1" : null)" @onclick="OnClick">
|
|
@ChildContent
|
|
</a>
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
|
[Parameter] public DColor Color { get; set; }
|
|
[Parameter] public DButtonVariant Variant { get; set; }
|
|
[Parameter] public DSize Size { get; set; }
|
|
[Parameter] public DButtonShape Shape { get; set; }
|
|
/// <summary>Pressed look (btn-active); the neo theme renders it inset.</summary>
|
|
[Parameter] public bool Active { get; set; }
|
|
[Parameter] public bool Disabled { get; set; }
|
|
[Parameter] public string Type { get; set; } = "button";
|
|
[Parameter] public string Href { get; set; }
|
|
[Parameter] public EventCallback<MouseEventArgs> OnClick { get; set; }
|
|
/// <summary>Pressing it doesn't take the focus from where it is (a chip that writes into a focused textarea).</summary>
|
|
[Parameter] public bool KeepFocus { get; set; }
|
|
|
|
string CssClass => Cx("btn", ColorClass, VariantClass, SizeClass, ShapeClass,
|
|
Active ? "btn-active" : null, Disabled && Href is not null ? "btn-disabled" : null, Class);
|
|
|
|
string ColorClass => Color switch
|
|
{
|
|
DColor.Neutral => "btn-neutral",
|
|
DColor.Primary => "btn-primary",
|
|
DColor.Secondary => "btn-secondary",
|
|
DColor.Accent => "btn-accent",
|
|
DColor.Info => "btn-info",
|
|
DColor.Success => "btn-success",
|
|
DColor.Warning => "btn-warning",
|
|
DColor.Error => "btn-error",
|
|
_ => null
|
|
};
|
|
|
|
string VariantClass => Variant switch
|
|
{
|
|
DButtonVariant.Outline => "btn-outline",
|
|
DButtonVariant.Dash => "btn-dash",
|
|
DButtonVariant.Soft => "btn-soft",
|
|
DButtonVariant.Ghost => "btn-ghost",
|
|
DButtonVariant.Link => "btn-link",
|
|
_ => null
|
|
};
|
|
|
|
string SizeClass => Size switch
|
|
{
|
|
DSize.Xs => "btn-xs",
|
|
DSize.Sm => "btn-sm",
|
|
DSize.Lg => "btn-lg",
|
|
DSize.Xl => "btn-xl",
|
|
_ => null
|
|
};
|
|
|
|
string ShapeClass => Shape switch
|
|
{
|
|
DButtonShape.Wide => "btn-wide",
|
|
DButtonShape.Block => "btn-block",
|
|
DButtonShape.Square => "btn-square",
|
|
DButtonShape.Circle => "btn-circle",
|
|
_ => null
|
|
};
|
|
}
|