From 0ef145be19d3ec0880cece45399c2b83950b4510 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 10 Jul 2020 17:09:02 -0300 Subject: [PATCH] 15610: Uses only ExpansionPanel as the top 2 panels on collection's view. This is to make both ExpansionPanels be by each other without any separation when both are collapsed, saving a little more vertical space. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/common/custom-theme.ts | 16 +++ .../collection-panel/collection-panel.tsx | 106 ++++-------------- 2 files changed, 38 insertions(+), 84 deletions(-) diff --git a/src/common/custom-theme.ts b/src/common/custom-theme.ts index 169358dc..270a81d6 100644 --- a/src/common/custom-theme.ts +++ b/src/common/custom-theme.ts @@ -103,6 +103,22 @@ export const themeOptions: ArvadosThemeOptions = { fontSize: '1.25rem' } }, + MuiExpansionPanel: { + expanded: { + marginTop: '8px', + } + }, + MuiExpansionPanelSummary: { + content: { + '&$expanded': { + margin: 0, + }, + color: grey700, + fontSize: '1.25rem', + margin: 0, + }, + expanded: {}, + }, MuiMenuItem: { root: { padding: '8px 16px' diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index 5771a736..953e5b4c 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -4,12 +4,10 @@ import * as React from 'react'; import { - StyleRulesCallback, WithStyles, withStyles, Card, - CardHeader, IconButton, CardContent, Grid, Tooltip + StyleRulesCallback, WithStyles, withStyles, + IconButton, Grid, Tooltip, Typography, ExpansionPanel, + ExpansionPanelSummary, ExpansionPanelDetails } from '@material-ui/core'; -import MuiExpansionPanel from '@material-ui/core/ExpansionPanel'; -import MuiExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; -import MuiExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; import { connect, DispatchProp } from "react-redux"; import { RouteComponentProps } from 'react-router'; import { ArvadosTheme } from '~/common/custom-theme'; @@ -35,10 +33,7 @@ import { getProgressIndicator } from '~/store/progress-indicator/progress-indica import { COLLECTION_PANEL_LOAD_FILES, loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions'; type CssRules = 'root' - | 'card' - | 'cardHeader' | 'filesCard' - | 'cardContent' | 'iconHeader' | 'tag' | 'label' @@ -47,61 +42,16 @@ type CssRules = 'root' | 'centeredLabel' | 'readOnlyIcon'; -const ExpansionPanel = withStyles({ - root: { - margin: 0, - padding: 0, - } -})(MuiExpansionPanel); - -const ExpansionPanelSummary = withStyles({ - root: { - margin: 0, - padding: 0, - }, - content: { - '&$expanded': { - margin: 0, - padding: 0, - }, - margin: 0, - padding: 0, - }, - expanded: {}, -})(MuiExpansionPanelSummary); - -const ExpansionPanelDetails = withStyles({ - root: { - margin: 0, - padding: 0, - } -})(MuiExpansionPanelDetails); - const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { display: 'flex', flexFlow: 'column', height: 'calc(100vh - 130px)', // (100% viewport height) - (top bar + breadcrumbs) }, - card: { - marginBottom: theme.spacing.unit * 2, - }, - cardHeader: { - paddingTop: theme.spacing.unit, - paddingBottom: 0, - }, filesCard: { marginBottom: theme.spacing.unit * 2, flex: 1, }, - cardContent: { - width: '100%', - paddingTop: 0, - paddingBottom: theme.spacing.unit, - '&:last-child': { - paddingBottom: theme.spacing.unit, - } - }, iconHeader: { fontSize: '1.875rem', color: theme.customs.colors.yellow700 @@ -167,35 +117,27 @@ export const CollectionPanel = withStyles(styles)( const { classes, item, dispatch, isWritable, isLoadingFiles, tooManyFiles } = this.props; return item ?
- - - }> - + }> + - } - title={ - - - {item.name} - {isWritable || - - - - } - - } - titleTypographyProps={this.titleProps} - subheader={item.description} - subheaderTypographyProps={this.titleProps} /> + + {item.name} + {isWritable || + + + + } + - + + {item.description} + @@ -225,18 +167,15 @@ export const CollectionPanel = withStyles(styles)( - - - - + }> - + {"Properties"} - - + + {isWritable && } @@ -262,9 +201,8 @@ export const CollectionPanel = withStyles(styles)( } - + -