Skip to content

Commit

Permalink
Merge pull request #487 from Esri/feat/account-tile-updates
Browse files Browse the repository at this point in the history
Feat/account tile updates
  • Loading branch information
joeyHarig authored Jul 19, 2021
2 parents cfdefcd + 0307bf6 commit 9e29759
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
12 changes: 9 additions & 3 deletions src/AccountTile/AccountTile-styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { CalciteTheme as theme } from '../CalciteThemeProvider';

// Calcite components
import { CalciteP } from '../Elements';
import HandleVerticalIcon from 'calcite-ui-icons-react/HandleVerticalIcon';
import Avatar from '../Avatar';

const StyledAccountTile = styled.div`
Expand All @@ -32,7 +33,8 @@ const StyledAccountTile = styled.div`
background-color: ${props =>
props.open ? props.theme.palette.offWhite : props.theme.palette.white};
${props => props.clickable &&
${props =>
props.clickable &&
css`
&:hover {
background-color: ${props.theme.palette.offWhite};
Expand Down Expand Up @@ -73,7 +75,6 @@ const StyledP = styled(CalciteP)`
`;

const StyledIconWrapper = styled.span`
width: 48px;
display: flex;
align-items: center;
justify-content: space-between;
Expand All @@ -86,12 +87,17 @@ const StyledTextWrapper = styled.span`
overflow: hidden;
`;

const StyledHandleVerticalIcon = styled(HandleVerticalIcon)`
margin-left: ${props => (props.marginLeft ? '0.5rem' : '0')};
`;

export {
StyledAccountTile,
StyledContentWrapper,
StyledAvatarContainer,
StyledOrgAvatar,
StyledIconWrapper,
StyledTextWrapper,
StyledP
StyledP,
StyledHandleVerticalIcon
};
27 changes: 16 additions & 11 deletions src/AccountTile/AccountTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
StyledOrgAvatar,
StyledIconWrapper,
StyledTextWrapper,
StyledP
StyledP,
StyledHandleVerticalIcon
} from './AccountTile-styled';

import Avatar from '../Avatar';
Expand All @@ -29,7 +30,6 @@ import { MenuItem } from '../Menu';
import Popover from '../Popover';
import Menu from '../Menu';

import HandleVerticalIcon from 'calcite-ui-icons-react/HandleVerticalIcon';
import CheckCircleIcon from 'calcite-ui-icons-react/CheckCircleIcon';
import ExclamationMarkTriangleIcon from 'calcite-ui-icons-react/ExclamationMarkTriangleIcon';

Expand All @@ -44,7 +44,7 @@ const AccountTile = ({
expiredText,
authenticatedText,
clickable,
hideIcons,
hideAuthentication,
...other
}) => {
const [isOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -135,8 +135,8 @@ const AccountTile = ({
</StyledP>
</StyledTextWrapper>
</StyledContentWrapper>
{!hideIcons && (
<StyledIconWrapper>
<StyledIconWrapper>
{!hideAuthentication && (
<Tooltip
title={isAuthenticated ? authenticatedText : expiredText}
placement="top"
Expand All @@ -159,9 +159,14 @@ const AccountTile = ({
/>
)}
</Tooltip>
{actions.length !== 0 && <HandleVerticalIcon scale={16} />}
</StyledIconWrapper>
)}
)}
{clickable && actions.length !== 0 && (
<StyledHandleVerticalIcon
scale={16}
marginLeft={!hideAuthentication}
/>
)}
</StyledIconWrapper>
</StyledAccountTile>
}
>
Expand Down Expand Up @@ -202,8 +207,8 @@ AccountTile.propTypes = {
}),
/** Can the time be clicked (false will disable hover effects and pointer events) */
clickable: PropTypes.bool,
/** Should the account tiles be hidden */
hideIcons: PropTypes.bool
/** Should the account tile authentication be hidden */
hideAuthentication: PropTypes.bool
};

AccountTile.defaultProps = {
Expand All @@ -213,7 +218,7 @@ AccountTile.defaultProps = {
authenticatedText: 'Signed in',
expiredText: 'Session expired',
clickable: true,
hideIcons: false
hideAuthentication: false
};

AccountTile.displayName = 'AccountTile';
Expand Down
2 changes: 1 addition & 1 deletion src/AccountTile/doc/AccountTile.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ import AccountTile from 'calcite-react/AccountTile';
userThumbnail={placeholders.userThumbnail}
orgThumbnail={placeholders.orgThumbnail}
clickable={false}
hideIcons={true}
hideAuthentication={true}
/>
);
}
Expand Down

0 comments on commit 9e29759

Please sign in to comment.