import React, { Component } from 'react' import { Route, Link } from 'react-router-dom' import { history } from '../store' const icons = { upload: { title: 'Upload', image: '/static/img/add.svg', // svg: , // svg: // svg: svg: , }, new: { title: 'New', image: '/static/img/add.svg', svg: , // svg: , // svg: }, save: { title: 'Export', image: '/static/img/save.svg', svg: , }, saved: { title: 'Saved', image: '/static/img/folder.svg', svg: , }, recent: { title: 'Recent', image: '/static/img/history.svg', svg: , }, random: { title: 'Random', image: '/static/img/random.svg', // svg: , svg: }, menu: { title: 'Menu', image: '/static/img/menu.svg', svg: , }, list: { title: 'List', image: '/static/img/view_list.svg', svg: , }, edit: { title: 'Edit', image: '/static/img/edit.svg', svg: }, delete: { title: 'Delete', image: '/static/img/delete.svg', svg: }, back: { title: 'Back', image: '/static/img/back.svg', svg: , }, image_search: { title: 'Search', image: '/static/img/image_search.svg', svg: , }, search: { title: 'Search', image: '/static/img/search.svg', svg: , }, open_in_new: { title: 'Open', image: '/static/img/open_in_new.svg', svg: , }, test: { title: 'Test', image: '/static/img/fastfood.svg', svg: }, // export: { // title: 'Export', // image: '/static/img/export.svg', // svg: , // }, } const goBack = () => history.goBack() export const MenuButton = ({ name, href, onClick, label, children, className }) => { const { svg, title } = icons[name] if (name === 'back') { onClick = goBack } if (href) { return (
{svg}
{label === false ? "" : title} {children} ) } else { return (
{svg}
{label === false ? "" : title} {children}
) } } export const SmallMenuButton = (props) => ( ) export const MenuRoute = ({ component: Component, props, ...rest }) => ( ( )}/> )