import React, { FC, memo, useCallback } from '../../../lib/teact/teact'; import useLang from '../../../hooks/useLang'; import Button from '../../ui/Button'; type OwnProps = { activeTab: SymbolMenuTabs; onSwitchTab: (tab: SymbolMenuTabs) => void; onRemoveSymbol: () => void; onSearchOpen: (type: 'stickers' | 'gifs') => void; }; export enum SymbolMenuTabs { 'Emoji', 'Stickers', 'GIFs', } // Getting enum string values for display in Tabs. // See: https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings export const SYMBOL_MENU_TAB_TITLES = Object.values(SymbolMenuTabs) .filter((value): value is string => typeof value === 'string'); const SYMBOL_MENU_TAB_ICONS = { [SymbolMenuTabs.Emoji]: 'icon-smile', [SymbolMenuTabs.Stickers]: 'icon-stickers', [SymbolMenuTabs.GIFs]: 'icon-gifs', }; const SymbolMenuFooter: FC = ({ activeTab, onSwitchTab, onRemoveSymbol, onSearchOpen, }) => { const lang = useLang(); function renderTabButton(tab: SymbolMenuTabs) { return ( ); } const handleSearchOpen = useCallback(() => { onSearchOpen(activeTab === SymbolMenuTabs.Stickers ? 'stickers' : 'gifs'); }, [activeTab, onSearchOpen]); function stopPropagation(event: any) { event.stopPropagation(); } return (
{activeTab !== SymbolMenuTabs.Emoji && ( )} {renderTabButton(SymbolMenuTabs.Emoji)} {renderTabButton(SymbolMenuTabs.Stickers)} {renderTabButton(SymbolMenuTabs.GIFs)} {activeTab === SymbolMenuTabs.Emoji && ( )}
); }; export default memo(SymbolMenuFooter);