import React, { Fragment } from 'react'; import classnames from 'classnames'; import ChevronIcon from '../icons/ChevronIcon'; import { Text } from '../Text/Text'; // @ts-ignore import styles from './ThemeSelector.less'; interface ThemeSelectorProps { themes: string[]; visibleThemes: string[] | undefined; activeTheme: string; onChange: (theme: string) => void; } const themeOption = (theme: string) => ( ); export const ThemeSelector = ({ themes, activeTheme, onChange, visibleThemes, }: ThemeSelectorProps) => { const options = visibleThemes && visibleThemes.length > 0 ? ( {visibleThemes.map(themeOption)} {themes .filter((theme) => !visibleThemes.some((t) => t === theme)) .map(themeOption)} ) : ( themes.map(themeOption) ); return (
); };