import React from 'react';
import ThemeSwitch from './ThemeSwitch';
import Theme from './Theme';
import type { ThemeId } from '../../themes';

export const ThemedComponent = (
    props: Record<ThemeId, () => React.ReactElement>
) => (
    <ThemeSwitch>
        {Object.entries(props).map(([theme, Component]) => (
            <Theme key={theme} theme={theme as ThemeId}>
                {Component()}
            </Theme>
        ))}
    </ThemeSwitch>
);
