From 4bd455c1ae92f7136003c494a3ccbd463c020ab4 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 5 Apr 2019 14:55:01 +0200 Subject: [PATCH] category fixes * remove slugify from all select values * so categories defined in form-publish.json are stored when publishing * map categories to category images * add jellyfish background as fallback image --- .../atoms/CategoryImage.module.scss | 2 +- client/src/components/atoms/CategoryImage.tsx | 35 ++++++++++++++++++- client/src/components/atoms/Form/Input.tsx | 7 +--- client/src/data/form-publish.json | 2 ++ 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/client/src/components/atoms/CategoryImage.module.scss b/client/src/components/atoms/CategoryImage.module.scss index 9ffc140..37b772e 100644 --- a/client/src/components/atoms/CategoryImage.module.scss +++ b/client/src/components/atoms/CategoryImage.module.scss @@ -5,5 +5,5 @@ background-size: cover; background-position: center; margin-bottom: $spacer / $line-height; - background-color: $brand-grey-lighter; + background-color: $body-background; } diff --git a/client/src/components/atoms/CategoryImage.tsx b/client/src/components/atoms/CategoryImage.tsx index 058290f..fbe4e13 100644 --- a/client/src/components/atoms/CategoryImage.tsx +++ b/client/src/components/atoms/CategoryImage.tsx @@ -33,75 +33,108 @@ import theology from '../../img/categories/theology.jpg' import transport from '../../img/categories/transport.jpg' import urbanplanning from '../../img/categories/urbanplanning.jpg' import visualart from '../../img/categories/visualart.jpg' +import fallback from '@oceanprotocol/art/jellyfish/jellyfish-back.svg' const categoryImageFile = (category: string) => { switch (category) { + case 'Agriculture & Bio Engineering': case 'agriculture': return agriculture + case 'Anthropology & Archeology': case 'anthroarche': return anthroarche + case 'Space & Astronomy': case 'astronomy': return astronomy + case 'Biology': case 'biology': return biology + case 'Business & Management': case 'business': return business + case 'Chemistry': case 'chemistry': return chemistry + case 'Communication & Journalism': case 'communication': return communication + case 'Computer Technology': case 'computer': return computer + case 'Dataset Of Datasets': case 'dataofdata': return dataofdata + case 'Deep Learning': case 'deeplearning': return deeplearning + case 'Demography': case 'demographics': return demographics + case 'Earth & Climate': case 'earth': return earth + case 'Economics & Finance': case 'economics-and-finance': return economics + case 'Engineering': case 'engineering': return engineering + case 'History': case 'history': return history + case 'Image Recognition': case 'imagesets': return imagesets + case 'Language': case 'language': return language + case 'Law': case 'law': return law + case 'Mathematics': case 'mathematics': return mathematics + case 'Medicine': case 'medicine': return medicine + case 'Other': case 'other': return other + case 'Performing Arts': case 'performingarts': return performingarts + case 'Philosophy': case 'philosophy': return philosophy + case 'Physics & Energy': case 'physics': return physics + case 'Politics': case 'politics': return politics + case 'Psychology': case 'psychology': return psychology + case 'Sociology': case 'sociology': return sociology + case 'Sports & Recreation': case 'sports': return sports + case 'Theology': case 'theology': return theology + case 'Transportation': case 'transport': return transport + case 'Urban Plannin': case 'urbanplanning': return urbanplanning + case 'Visual Arts & Design': case 'visualart': return visualart default: - break + return fallback } } diff --git a/client/src/components/atoms/Form/Input.tsx b/client/src/components/atoms/Form/Input.tsx index 4684a7e..1c5d339 100644 --- a/client/src/components/atoms/Form/Input.tsx +++ b/client/src/components/atoms/Form/Input.tsx @@ -98,12 +98,7 @@ export default class Input extends PureComponent { options .sort((a, b) => a.localeCompare(b)) .map((option: string, index: number) => ( - ))} diff --git a/client/src/data/form-publish.json b/client/src/data/form-publish.json index bc80928..01f56f8 100644 --- a/client/src/data/form-publish.json +++ b/client/src/data/form-publish.json @@ -68,6 +68,8 @@ "Business & Management", "Sports & Recreation", "Communication & Journalism", + "Deep Learning", + "Law", "Other" ] },