Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/account tile updates #487

Merged
merged 4 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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