From e3493974f91d07723008cdb8c7466a5ff8407cb5 Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Wed, 11 Jul 2018 15:15:49 +0200 Subject: [PATCH 1/1] change code after CR Feature #13764 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- .../items/abstract-item.tsx | 1 + .../items/collection-item.tsx | 6 +- .../items/empty-item.tsx | 6 +- .../items/process-item.tsx | 6 +- .../items/project-item.tsx | 6 +- src/components/empty-state/empty-state.tsx | 7 +- src/components/icon/icon.tsx | 74 ++++++++++--------- src/components/side-panel/side-panel.tsx | 8 +- .../details-panel/details-panel.tsx | 2 +- .../main-app-bar/main-app-bar.tsx | 8 +- 10 files changed, 64 insertions(+), 60 deletions(-) diff --git a/src/components/details-panel-factory/items/abstract-item.tsx b/src/components/details-panel-factory/items/abstract-item.tsx index d5e46a26..d4038703 100644 --- a/src/components/details-panel-factory/items/abstract-item.tsx +++ b/src/components/details-panel-factory/items/abstract-item.tsx @@ -4,6 +4,7 @@ import * as React from 'react'; import { DetailsPanelResource } from '../../../views-components/details-panel/details-panel'; +import { IconType } from '../../icon/icon'; export default abstract class AbstractItem { diff --git a/src/components/details-panel-factory/items/collection-item.tsx b/src/components/details-panel-factory/items/collection-item.tsx index 1c8bd00f..dab8101a 100644 --- a/src/components/details-panel-factory/items/collection-item.tsx +++ b/src/components/details-panel-factory/items/collection-item.tsx @@ -13,11 +13,11 @@ import { ResourceKind } from '../../../models/resource'; export default class CollectionItem extends AbstractItem { - getIcon(className?: string): React.ReactElement { - return CollectionIcon(className); + getIcon(className?: string) { + return ; } - buildDetails(): React.ReactElement { + buildDetails() { return
diff --git a/src/components/details-panel-factory/items/empty-item.tsx b/src/components/details-panel-factory/items/empty-item.tsx index 356ccc2c..0edfe84f 100644 --- a/src/components/details-panel-factory/items/empty-item.tsx +++ b/src/components/details-panel-factory/items/empty-item.tsx @@ -10,11 +10,11 @@ import { EmptyResource } from '../../../models/empty'; export default class EmptyItem extends AbstractItem { - getIcon(className?: string): React.ReactElement { - return ProjectsIcon(className); + getIcon(className?: string) { + return ; } - buildDetails(): React.ReactElement { + buildDetails() { return ; } diff --git a/src/components/details-panel-factory/items/process-item.tsx b/src/components/details-panel-factory/items/process-item.tsx index 66a6071b..215c5312 100644 --- a/src/components/details-panel-factory/items/process-item.tsx +++ b/src/components/details-panel-factory/items/process-item.tsx @@ -13,11 +13,11 @@ import { resourceLabel } from '../../../common/labels'; export default class ProcessItem extends AbstractItem { - getIcon(className?: string): React.ReactElement { - return ProcessIcon(className); + getIcon(className?: string){ + return ; } - buildDetails(): React.ReactElement { + buildDetails() { return
diff --git a/src/components/details-panel-factory/items/project-item.tsx b/src/components/details-panel-factory/items/project-item.tsx index 6d8ad04e..ae694e5c 100644 --- a/src/components/details-panel-factory/items/project-item.tsx +++ b/src/components/details-panel-factory/items/project-item.tsx @@ -13,11 +13,11 @@ import { resourceLabel } from '../../../common/labels'; export default class ProjectItem extends AbstractItem { - getIcon(className?: string): React.ReactElement { - return ProjectIcon(className); + getIcon(className?: string) { + return ; } - buildDetails(): React.ReactElement { + buildDetails() { return
{/* Missing attr */} diff --git a/src/components/empty-state/empty-state.tsx b/src/components/empty-state/empty-state.tsx index 3c21eca3..8a36213e 100644 --- a/src/components/empty-state/empty-state.tsx +++ b/src/components/empty-state/empty-state.tsx @@ -6,10 +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 { IconType } from '../icon/icon'; export interface EmptyStateDataProps { message: string; - icon: (className?: string) => React.ReactElement; + icon: IconType; details?: string; } @@ -18,10 +19,10 @@ type EmptyStateProps = EmptyStateDataProps & WithStyles; class EmptyState extends React.Component { render() { - const { classes, message, details, icon, children } = this.props; + const { classes, message, details, icon: Icon, children } = this.props; return ( - {icon(classes.icon)} + {message} { details && {details} } { children && {children} } diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx index 9c0faac0..e80fee8e 100644 --- a/src/components/icon/icon.tsx +++ b/src/components/icon/icon.tsx @@ -33,39 +33,41 @@ import Search from '@material-ui/icons/Search'; import Star from '@material-ui/icons/Star'; import StarBorder from '@material-ui/icons/StarBorder'; -export const AddFavoriteIcon = (className?: string) => ; -export const AdvancedIcon = (className?: string) => ; -export const CustomizeTableIcon = (className?: string) => ; -export const CopyIcon = (className?: string) => ; -export const CollectionIcon = (className?: string) => ; -export const CloseIcon = (className?: string) => ; -export const DefaultIcon = (className?: string) => ; -export const DetailsIcon = (className?: string) => ; -export const DownloadIcon = (className?: string) => ; -export const FavoriteIcon = (className?: string) => ; -export const HelpIcon = (className?: string) => ; -export const LogIcon = (className?: string) => ; -export const MoreOptionsIcon = (className?: string) => ; -export const MoveToIcon = (className?: string) => ; -export const NewProjectIcon = (className?: string) => ; -export const NotificationIcon = (className?: string) => ; -export const PaginationDownIcon = (className?: string) => ; -export const PaginationLeftArrowIcon = (className?: string) => ; -export const PaginationRightArrowIcon = (className?: string) => ; -export const ProcessIcon = (className?: string) => ; -export const ProjectIcon = (className?: string) => ; -export const ProjectsIcon = (className?: string) => ; -export const ProvenanceGraphIcon = (className?: string) => ; -export const RecentIcon = (className?: string) => ; -export const RemoveIcon = (className?: string) => ; -export const RemoveFavoriteIcon = (className?: string) => ; -export const RenameIcon = (className?: string) => ; -export const ReRunProcessIcon = (className?: string) => ; -export const SearchIcon = (className?: string) => ; -export const ShareIcon = (className?: string) => ; -export const ShareMeIcon = (className?: string) => ; -export const SidePanelRightArrowIcon = (className?: string) => ; -export const TrashIcon = (className?: string) => ; -export const UserPanelIcon = (className?: string) => ; -export const UsedByIcon = (className?: string) => ; -export const WorkflowIcon = (className?: string) => ; \ No newline at end of file +export type IconType = React.SFC<{ className?: string }>; + +export const AddFavoriteIcon: IconType = (props) => ; +export const AdvancedIcon: IconType = (props) => ; +export const CustomizeTableIcon: IconType = (props) => ; +export const CopyIcon: IconType = (props) => ; +export const CollectionIcon: IconType = (props) => ; +export const CloseIcon: IconType = (props) => ; +export const DefaultIcon: IconType = (props) => ; +export const DetailsIcon: IconType = (props) => ; +export const DownloadIcon: IconType = (props) => ; +export const FavoriteIcon: IconType = (props) => ; +export const HelpIcon: IconType = (props) => ; +export const LogIcon: IconType = (props) => ; +export const MoreOptionsIcon: IconType = (props) => ; +export const MoveToIcon: IconType = (props) => ; +export const NewProjectIcon: IconType = (props) => ; +export const NotificationIcon: IconType = (props) => ; +export const PaginationDownIcon: IconType = (props) => ; +export const PaginationLeftArrowIcon: IconType = (props) => ; +export const PaginationRightArrowIcon: IconType = (props) => ; +export const ProcessIcon: IconType = (props) => ; +export const ProjectIcon: IconType = (props) => ; +export const ProjectsIcon: IconType = (props) => ; +export const ProvenanceGraphIcon: IconType = (props) => ; +export const RecentIcon: IconType = (props) => ; +export const RemoveIcon: IconType = (props) => ; +export const RemoveFavoriteIcon: IconType = (props) => ; +export const RenameIcon: IconType = (props) => ; +export const ReRunProcessIcon: IconType = (props) => ; +export const SearchIcon: IconType = (props) => ; +export const ShareIcon: IconType = (props) => ; +export const ShareMeIcon: IconType = (props) => ; +export const SidePanelRightArrowIcon: IconType = (props) => ; +export const TrashIcon: IconType = (props) => ; +export const UserPanelIcon: IconType = (props) => ; +export const UsedByIcon: IconType = (props) => ; +export const WorkflowIcon: IconType = (props) => ; \ No newline at end of file diff --git a/src/components/side-panel/side-panel.tsx b/src/components/side-panel/side-panel.tsx index 361d127a..eedc499f 100644 --- a/src/components/side-panel/side-panel.tsx +++ b/src/components/side-panel/side-panel.tsx @@ -7,13 +7,13 @@ import { ReactElement } from 'react'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; import { ArvadosTheme } from '../../common/custom-theme'; import { List, ListItem, ListItemText, ListItemIcon, Collapse, Typography } from "@material-ui/core"; -import { SidePanelRightArrowIcon } from '../icon/icon'; +import { SidePanelRightArrowIcon, IconType } from '../icon/icon'; import * as classnames from "classnames"; export interface SidePanelItem { id: string; name: string; - icon: (className?: string) => React.ReactElement; + icon: IconType; active?: boolean; open?: boolean; margin?: boolean; @@ -40,11 +40,11 @@ class SidePanel extends React.Component> { {it.openAble ? ( toggleOpen(it.id)} className={iconArrowContainer}> - {SidePanelRightArrowIcon(this.getIconClassNames(it.open, it.active))} + ) : null} - {it.icon(`${icon} ${it.margin ? projectIconMargin : ''}`)} + {} diff --git a/src/views-components/details-panel/details-panel.tsx b/src/views-components/details-panel/details-panel.tsx index 7fa6d34c..f2212fc5 100644 --- a/src/views-components/details-panel/details-panel.tsx +++ b/src/views-components/details-panel/details-panel.tsx @@ -58,7 +58,7 @@ class DetailsPanel extends React.Component { - {CloseIcon()} + {} diff --git a/src/views-components/main-app-bar/main-app-bar.tsx b/src/views-components/main-app-bar/main-app-bar.tsx index ce9ddb7b..30eee0d2 100644 --- a/src/views-components/main-app-bar/main-app-bar.tsx +++ b/src/views-components/main-app-bar/main-app-bar.tsx @@ -74,7 +74,7 @@ export const MainAppBar: React.SFC = (props) => { onContextMenu={props.onContextMenu} /> } - { DetailsIcon() } + { } ; @@ -86,16 +86,16 @@ const renderMenuForUser = ({ user, menuItems, onMenuItemClick }: MainAppBarProps <> - {NotificationIcon()} + {} - + } id="account-menu"> {getUserFullname(user)} {renderMenuItems(menuItems.accountMenu, onMenuItemClick)} - + } id="help-menu"> {renderMenuItems(menuItems.helpMenu, onMenuItemClick)} -- 2.30.2