import { OPEN_DROPDOWN, CLOSE_DROPDOWN, TOGGLE_DROPDOWN, } from '../constants' export interface OpenDropdownAction { type: '@@cosmo-ui/OPEN_DROPDOWN' key: string } export interface CloseDropdownAction { type: '@@cosmo-ui/CLOSE_DROPDOWN' key: string } export interface ToggleDropdownAction { type: '@@cosmo-ui/TOGGLE_DROPDOWN' key: string } export type DropdownAction = ToggleDropdownAction | OpenDropdownAction | CloseDropdownAction export const openDropdown = (key: string) => ({ key, type: OPEN_DROPDOWN }) export const closeDropdown = (key: string) => ({ key, type: CLOSE_DROPDOWN }) export const toggleDropdown = (key: string) => ({ key, type: TOGGLE_DROPDOWN })