xref: /MusicFree/src/components/dialogs/index.tsx (revision e650bfb34226e2a09d15cbf7832c4805a87cd60e)
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