xref: /MusicFree/src/components/dialogs/index.tsx (revision 5589cdf32b2bb0f641e5ac7bf1f6152cd6b9b70e)
1import React from 'react';
2import components from './components';
3import {dialogInfoStore} from './useDialog';
4import Portal from '../base/portal';
5
6export default function () {
7    const dialogInfoState = dialogInfoStore.useValue();
8
9    const Component = dialogInfoState.name
10        ? components[dialogInfoState.name]
11        : null;
12
13    return (
14        <Portal>
15            {Component ? (
16                <Component {...(dialogInfoState.payload ?? {})} />
17            ) : null}
18        </Portal>
19    );
20}
21