import icons from '../icons/css/icons.css'
import { capitalize } from './stringHelpers'

export const getIcon = (taxonomy) => (
  icons[`icon${capitalize(taxonomy)}`] + ` icon-${taxonomy}`
)

export const taxonomiesWithIcons = (taxonomies) => (
  taxonomies.map(taxonomy => (
    { id: taxonomy, name: capitalize(taxonomy), icon: getIcon(taxonomy) }
  ))
)

export const relevantTaxonomies = (services) => {
  const servicesList = Object.values(services)
  return Array.from(new Set(servicesList.map(service => service.taxonomy)))
}

@@ -82,16 +82,151 @@
 lpers'%0A%0A
+const taxonomyLabels = %7B%0A  food: %22Food%22,%0A  housing: %22Shelter%22,%0A  hygiene: %22Hygiene%22,%0A  medical: %22Medical%22,%0A  technology: %22Computer%22%0A%7D%0A%0A
 export c
@@ -409,16 +409,22 @@
  (%0A    %7B
+%0A     
  id: tax
@@ -433,36 +433,52 @@
 omy,
+%0A     
  name: 
-capitalize(taxonomy),
+taxonomyLabels%5Btaxonomy%5D,%0A     
  ico
@@ -497,16 +497,20 @@
 axonomy)
+%0A   
  %7D%0A  ))%0A

Add taxonomy labels