Some cosmetic changes.

- Reverse order of Expand/Compact icons in DataListToolbar to Compact/Expand.
- Make Expanded the default view for Access Lists.
- Make role badge styling closer to Chip component styling.
This commit is contained in:
Kia Lam
2019-03-04 14:38:58 -05:00
parent 86a92fefe7
commit 35ecd83214
3 changed files with 58 additions and 22 deletions

View File

@@ -16,6 +16,7 @@ import {
import BasicChip from '../BasicChip/BasicChip'; import BasicChip from '../BasicChip/BasicChip';
import Pagination from '../Pagination'; import Pagination from '../Pagination';
import DataListToolbar from '../DataListToolbar'; import DataListToolbar from '../DataListToolbar';
import Tooltip from '../Tooltip';
import { import {
parseQueryString, parseQueryString,
@@ -46,6 +47,15 @@ const hiddenStyle = {
display: 'none', display: 'none',
}; };
const badgeStyle = {
borderRadius: 'var(--pf-global--BorderRadius--sm)',
height: '24px',
}
const badgeTextStyle = {
lineHeight: '24px',
}
const Detail = ({ label, value, url, isBadge, customStyles }) => { const Detail = ({ label, value, url, isBadge, customStyles }) => {
let detail = null; let detail = null;
if (value) { if (value) {
@@ -57,8 +67,8 @@ const Detail = ({ label, value, url, isBadge, customStyles }) => {
</Link>) : (<Text component={TextVariants.h6} style={detailLabelStyle}>{label}</Text> </Link>) : (<Text component={TextVariants.h6} style={detailLabelStyle}>{label}</Text>
)} )}
{isBadge ? ( {isBadge ? (
<Badge isRead> <Badge style={badgeStyle} isRead>
<Text component={TextVariants.p} style={detailValueStyle}>{value}</Text> <Text component={TextVariants.p} style={{...detailValueStyle, ...badgeTextStyle}}>{value}</Text>
</Badge> </Badge>
) : ( ) : (
<Text component={TextVariants.p} style={detailValueStyle}>{value}</Text> <Text component={TextVariants.p} style={detailValueStyle}>{value}</Text>
@@ -93,7 +103,7 @@ class AccessList extends React.Component {
count: null, count: null,
sortOrder: 'ascending', sortOrder: 'ascending',
sortedColumnKey: 'username', sortedColumnKey: 'username',
isCompact: true, isCompact: false,
}; };
this.fetchOrgAccessList = this.fetchOrgAccessList.bind(this); this.fetchOrgAccessList = this.fetchOrgAccessList.bind(this);
@@ -321,12 +331,30 @@ class AccessList extends React.Component {
: userRolesWrapperStyle} : userRolesWrapperStyle}
> >
<Text component={TextVariants.h6} style={detailLabelStyle}>{i18n._(t`User Roles`)}</Text> <Text component={TextVariants.h6} style={detailLabelStyle}>{i18n._(t`User Roles`)}</Text>
{result.userRoles.map(role => ( {result.userRoles.map(role => {
<BasicChip // Show tooltips for associated Org/Team of role name displayed
key={role.id} if (role.summary_fields.resource_name) {
text={role.name} return (
/> <Tooltip
))} message={role.summary_fields.resource_name}
position="top"
key={role.id}
>
<BasicChip
key={role.id}
text={role.name}
/>
</Tooltip>
)
} else {
return (
<BasicChip
key={role.id}
text={role.name}
/>
)
}
})}
</ul> </ul>
)} )}
{result.teamRoles.length > 0 && ( {result.teamRoles.length > 0 && (

View File

@@ -261,16 +261,6 @@ class DataListToolbar extends React.Component {
</ToolbarGroup> </ToolbarGroup>
{showExpandCollapse && ( {showExpandCollapse && (
<ToolbarGroup> <ToolbarGroup>
<ToolbarItem>
<Button
variant="plain"
aria-label={i18n._(t`Expand`)}
onClick={this.onExpand}
style={!isCompact ? ToolbarActiveStyle : null}
>
<EqualsIcon />
</Button>
</ToolbarItem>
<ToolbarItem> <ToolbarItem>
<Button <Button
variant="plain" variant="plain"
@@ -281,6 +271,16 @@ class DataListToolbar extends React.Component {
<BarsIcon /> <BarsIcon />
</Button> </Button>
</ToolbarItem> </ToolbarItem>
<ToolbarItem>
<Button
variant="plain"
aria-label={i18n._(t`Expand`)}
onClick={this.onExpand}
style={!isCompact ? ToolbarActiveStyle : null}
>
<EqualsIcon />
</Button>
</ToolbarItem>
{ (showDelete || addUrl) && ( { (showDelete || addUrl) && (
<VerticalSeparator /> <VerticalSeparator />
)} )}

View File

@@ -1,6 +1,11 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const toolTipContent = {
padding: '10px',
minWidth: '100px',
}
class Tooltip extends React.Component { class Tooltip extends React.Component {
transforms = { transforms = {
top: { top: {
@@ -42,7 +47,10 @@ class Tooltip extends React.Component {
const { const {
isDisplayed isDisplayed
} = this.state; } = this.state;
if (message === '') {
return null;
}
return ( return (
<span <span
style={{ position: 'relative' }} style={{ position: 'relative' }}
@@ -56,8 +64,8 @@ class Tooltip extends React.Component {
style={{ position: 'absolute', zIndex: '10', ...this.transforms[position] }} style={{ position: 'absolute', zIndex: '10', ...this.transforms[position] }}
className={`pf-c-tooltip pf-m-${position}`} className={`pf-c-tooltip pf-m-${position}`}
> >
<div className="pf-c-tooltip__arrow" /> <div className="pf-c-tooltip__arrow"/>
<div className="pf-c-tooltip__content"> <div className="pf-c-tooltip__content" style={toolTipContent}>
{ message } { message }
</div> </div>
</div> </div>