Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltips, Popover, Modal, Offcanvas #591

Closed
jbomhold3 opened this issue May 26, 2023 · 1 comment
Closed

Tooltips, Popover, Modal, Offcanvas #591

jbomhold3 opened this issue May 26, 2023 · 1 comment
Labels
Backlog help wanted Extra attention is needed

Comments

@jbomhold3
Copy link
Collaborator

jbomhold3 commented May 26, 2023

  • Track Tooltips, Popover, Modal, OffCanvas in service.
  • Modal, Offcanvas backdrop should only show on first open.
  • Add Dynamic rendering for Tooltips, Popover, Modal, OffCanvas
  • In each toggle on ShowAsync we need to prerender the component before it continues the show method for animations and remove it after hidden

Example Goal

Modal.cs

public class Modal 
{
    public ConcurrentDictionary<string, dynamicType<object>> Children = new();
    public BSModal Add<T>(Action<T> params, string id= Guid.NewGuid.ToString()) where T : class, new()
    {
         var result = new T();
         T parameters;
         params.Invoke(parameters);
         result.Fragment = // Build component match attribute for parameters
         if(!Children .TryAdd(id, result, out _)
         {
               throw("Blah");
         }
        return parameters.ObjectReferance;
    }
    public void Remove<T>(T blah) 
    {
        // Remove
    }
    public void Remove<T>(string name) 
    {
       // Remove
    }
    
    [JSInvokable]
    public override async Task InteropEventCallback(string id, CallerName name, EventType type,
            Dictionary<string, string>? classList, JavascriptEvent? e)
    {
    //loop children see if event is related do actions
    }
}

MainLayout

@Body
<BSDynamics/>

Any other component

private BSModal _blah;
protected override OnInitialized
{
_blah = BlazorStrap.Modal.Add<ModalComponent>(params, "optionalStringName");
}
public async Task ShowModalAsync()
{
    await _blah.ShowAsync();
    // Or
    BlazorStrap.Modal.ShowAsync("optionalStringName");
}

ModalComponent.razor

<BSModal DataId="modal1" @ref="ObjectReferance">
    <Header>Modal Title</Header>
    <Content>Woohoo, you're reading this text in a modal!</Content>
    <Footer Context="modal">
        <BSButton MarginStart="Margins.Auto" Color="BSColor.Secondary" @onclick="modal.HideAsync">Close</BSButton>
        <BSButton Color="BSColor.Primary">Save changes</BSButton>
    </Footer>
</BSModal>

ModalComponent.razor.cs

   public partial ModalComponent : IDynamicInterface<BSModal?>
   {
        public BSModal? ObjectReferance {get;set;}  // This is on the interface
   }
@jbomhold3 jbomhold3 added help wanted Extra attention is needed Backlog labels May 26, 2023
@jbomhold3
Copy link
Collaborator Author

Changed the way the core interop works this is no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant