import React, { SFC } from "react"
import { Media } from "Utils/Responsive"
import { ArtistSearchPreviewQueryRenderer as ArtistSearchPreview } from "./Grids/ArtistSearch"
import { MerchandisableArtworksPreviewQueryRenderer as MerchandisableArtworksPreview } from "./Grids/MerchandisableArtworks"

export interface SearchPreviewProps {
  entityID: string
  entityType: string
}

const previewComponents = {
  Artist: ArtistSearchPreview,
  default: MerchandisableArtworksPreview
}

export const SearchPreview: SFC<SearchPreviewProps> = ({
  entityID,
  entityType,
}) => {
  const Preview = previewComponents[entityType] || previewComponents.default

  return (
    <Media greaterThan="xs">
      <Preview entityID={entityID} />
    </Media>
  )
}

import React, { SFC } from "react"
import { Media } from "Utils/Responsive"
import { ArtistSearchPreviewQueryRenderer as ArtistSearchPreview } from "./Grids/ArtistSearch"
import { MerchandisableArtworksPreviewQueryRenderer as MerchandisableArtworksPreview } from "./Grids/MerchandisableArtworks"

export interface SearchPreviewProps {
  entityID: string
  entityType: string
}

const map = {
  Artist: ArtistSearchPreview,
  default: MerchandisableArtworksPreview
}

export const SearchPreview: SFC<SearchPreviewProps> = ({
  entityID,
  entityType,
}) => {
  const Preview = map[entityType] || map.default

  return (
    <Media greaterThan="xs">
      <Preview entityID={entityID} />
    </Media>
  )
}

--- 
+++ 
@@ -8,7 +8,7 @@
   entityType: string
 }
 
-const map = {
+const previewComponents = {
   Artist: ArtistSearchPreview,
   default: MerchandisableArtworksPreview
 }
@@ -17,7 +17,7 @@
   entityID,
   entityType,
 }) => {
-  const Preview = map[entityType] || map.default
+  const Preview = previewComponents[entityType] || previewComponents.default
 
   return (
     <Media greaterThan="xs">
Improve name of component map
