From 0b1b9f181db6c43a8bbc9b2b2d6ab48a51003b2d Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Fri, 6 Jul 2018 12:11:31 +0200 Subject: [PATCH] add enum for icons types Feature #13765 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- src/components/empty-state/empty-state.tsx | 4 ++-- src/components/icon/icon.tsx | 15 ++++++++++++--- .../details-panel/details-panel.tsx | 12 ++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/components/empty-state/empty-state.tsx b/src/components/empty-state/empty-state.tsx index b048e327..205053b5 100644 --- a/src/components/empty-state/empty-state.tsx +++ b/src/components/empty-state/empty-state.tsx @@ -6,11 +6,11 @@ import * as React from 'react'; import Typography from '@material-ui/core/Typography'; import { WithStyles, withStyles, StyleRulesCallback } from '@material-ui/core/styles'; import { ArvadosTheme } from 'src/common/custom-theme'; -import IconBase from '../icon/icon'; +import IconBase, { IconTypes } from '../icon/icon'; export interface EmptyStateDataProps { message: string; - icon: string; + icon: IconTypes; details?: string; } diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx index 3682b775..c420a19c 100644 --- a/src/components/icon/icon.tsx +++ b/src/components/icon/icon.tsx @@ -8,15 +8,24 @@ import CloseAnnouncement from '@material-ui/icons/Announcement'; import CloseIcon from '@material-ui/icons/Close'; import FolderIcon from '@material-ui/icons/Folder'; +export enum IconTypes { + ANNOUNCEMENT = 'announcement', + FOLDER = 'folder', + CLOSE = 'close', + PROJECT = 'project', + COLLECTION = 'collection', + PROCESS = 'process' +} + interface IconBaseDataProps { - icon: string; + icon: IconTypes; className?: string; } type IconBaseProps = IconBaseDataProps; interface IconBaseState { - icon: string; + icon: IconTypes; } const getSpecificIcon = (props: any) => ({ @@ -30,7 +39,7 @@ const getSpecificIcon = (props: any) => ({ class IconBase extends React.Component { state = { - icon: '', + icon: IconTypes.FOLDER, }; render() { diff --git a/src/views-components/details-panel/details-panel.tsx b/src/views-components/details-panel/details-panel.tsx index f47dfa06..6bf04c4f 100644 --- a/src/views-components/details-panel/details-panel.tsx +++ b/src/views-components/details-panel/details-panel.tsx @@ -14,7 +14,7 @@ import Typography from '@material-ui/core/Typography'; import Grid from '@material-ui/core/Grid'; import * as classnames from "classnames"; import EmptyState from '../../components/empty-state/empty-state'; -import IconBase from '../../components/icon/icon'; +import IconBase, { IconTypes } from '../../components/icon/icon'; export interface DetailsPanelDataProps { onCloseDrawer: () => void; @@ -50,13 +50,13 @@ class DetailsPanel extends React.Component { {renderHeader} {/* TODO: renderHeader */} - + Tutorial pipeline {/* End */} - + @@ -67,12 +67,12 @@ class DetailsPanel extends React.Component { {tabsValue === 0 && this.renderTabContainer( {renderDetails} - - + Projects @@ -82,7 +82,7 @@ class DetailsPanel extends React.Component { {tabsValue === 1 && this.renderTabContainer( {renderActivity} - + )} -- 2.30.2