Skip to content

Commit

Permalink
chore: update based on design team's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarajohn committed Nov 21, 2023
1 parent c35291d commit fddbe69
Show file tree
Hide file tree
Showing 11 changed files with 484 additions and 135 deletions.
1 change: 0 additions & 1 deletion src/ui/Navigation/components/ClientSelector/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/ui/Navigation/components/Drawer/Drawer.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const DrawerContainer = styled.div<{
isDesktop: boolean;
}>`
${transition(0.2, 'width')};
width: ${({ expanded }) => (expanded ? rem('308px') : 0)};
width: ${({ expanded }) => (expanded ? rem(252) : 0)};
background-color: ${({ theme }) => theme.palette.white};
position: ${({ isDesktop }) => (isDesktop ? 'relative' : 'absolute')};
left: ${({ theme, isDesktop }) => (isDesktop ? 0 : getGlobalNavWidth(theme))};
Expand Down
5 changes: 3 additions & 2 deletions src/ui/Navigation/components/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type SwitchOrganization } from '../../../../providers/Organizations';
import { type Organization } from '../../../../store/organizations';
import { MenuIcon, MenuItemText } from '../../common.styles';
import { type MenuItem } from '../../types';
import ClientSelector from '../ClientSelector';
import OrganizationSelector from '../OrganizationSelector';
import {
DrawerContainer,
ExtrasContainer,
Expand Down Expand Up @@ -87,7 +87,8 @@ function Drawer(props: DrawerProps) {
const orgSwitcherElement = useMemo(() => {
return (
<OrgSwitcherWrapper>
<ClientSelector
<OrganizationSelector
disabled={organizations.length <= 1}
tagText={''}
dataTestId={'organization-picker'}
onSelect={async (option: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@ export const Button = styled.button`
cursor: pointer;
height: calc(9 * ${({ theme }) => `${theme.spacing.sm}`});
:hover {
:not([disabled]):hover {
background-color: ${({ theme }) => `${theme.utils.getColor('lightGrey', 50)}`};
}
> span {
padding-right: ${({ theme }) => theme.spacing.sm};
display: inline-block;
&[disabled] {
cursor: default;
}
`;

export const SelectedOrg = styled.span`
padding-right: ${({ theme }) => theme.spacing.sm};
display: inline-block;
font-weight: ${({ theme }) => theme.typography.weights.medium};
`;

export const ButtonTextWrapper = styled.div`
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import {
ButtonTextWrapper,
ChevronWrapper,
Option,
SelectedOrg,
Tag,
Wrapper,
} from './ClientSelector.styles';
} from './OrganizationSelector.styles';

export type Props = {
/** Items that are being declared as menu options */
Expand All @@ -32,7 +33,7 @@ export type TestProps = {
dataTestId?: string;
};

function ClientSelector(props: Props & TestProps) {
function OrganizationSelector(props: Props & TestProps) {
const {
items,
disabled,
Expand All @@ -57,16 +58,18 @@ function ClientSelector(props: Props & TestProps) {
>
<ButtonContentWrapper>
<ButtonTextWrapper theme={theme}>
<span>{buttonText}</span>
<SelectedOrg>{buttonText}</SelectedOrg>
{tagText && (
<Tag theme={theme} textColor={textColor}>
{tagText}
</Tag>
)}
</ButtonTextWrapper>
<ChevronWrapper theme={theme}>
<FlippableArrow expanded={open} color={textColor} size={11} />
</ChevronWrapper>
{disabled ? null : (
<ChevronWrapper theme={theme}>
<FlippableArrow expanded={open} color={textColor} size={11} />
</ChevronWrapper>
)}
</ButtonContentWrapper>
</Button>

Expand All @@ -89,4 +92,4 @@ function ClientSelector(props: Props & TestProps) {
);
}

export default ClientSelector;
export default OrganizationSelector;
1 change: 1 addition & 0 deletions src/ui/Navigation/components/OrganizationSelector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './OrganizationSelector';
185 changes: 185 additions & 0 deletions src/ui/TopBar/components/FancyUserMenu/UserMenu.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { Theme } from '@orfium/ictinus';
import { getFocus } from '@orfium/ictinus/dist/theme/states';
import { rem } from 'polished';

const AVATAR_SIZE_COLLAPSED = 36;
const AVATAR_SIZE_EXPANDED = 46;

export const Anchor = styled.div`
position: relative;
height: ${rem(AVATAR_SIZE_COLLAPSED)};
`;

export const MenuOuterWrapper = styled.div`
--max-width: auto;
--max-height: auto;
--min-width: ${rem(AVATAR_SIZE_COLLAPSED)};
--min-height: ${rem(AVATAR_SIZE_COLLAPSED)};
border: ${rem(1)} solid ${({ theme }) => theme.utils.getColor('lightGrey', 200)};
border-radius: ${rem(8)};
box-shadow: ${({ theme }) => theme.elevation['04']};
background-color: #fff;
padding: ${({ theme }) => theme.spacing.md};
transition: padding 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease,
border-color 0.25s ease, width 0.25s ease, height 0.25s ease;
width: var(--max-width);
height: var(--max-height);
overflow: hidden;
position: absolute;
top: 0;
right: 0;
[data-menu-header] {
transition: padding 0.25s ease;
}
[data-menu-header] > div,
[data-menu-options] {
transition: opacity 0.15s ease;
opacity: 1;
visibility: visible;
}
&.collapsed {
width: var(--min-width);
height: var(--min-height);
padding: 1px; // fixes weird 1px clipping issue between this and the img
background-color: transparent;
box-shadow: none;
border-color: transparent;
cursor: pointer;
&:focus-visible {
outline: ${({ theme }) => getFocus({ theme }).styleOutline};
}
[data-menu-header] {
padding: 0;
}
[data-menu-header] > div,
[data-menu-options] {
opacity: 0;
visibility: hidden;
}
}
`;

export const MenuInnerWrapper = styled.div`
min-width: ${rem(310)};
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing.md};
`;

export const Header = styled.div`
display: flex;
gap: ${({ theme }) => theme.spacing.sm};
padding: 0 ${({ theme }) => theme.spacing.sm};
align-items: center;
> img {
width: ${rem(AVATAR_SIZE_EXPANDED)};
height: ${rem(AVATAR_SIZE_EXPANDED)};
border-radius: 50%;
}
> div {
display: flex;
flex-direction: column;
gap: ${rem(4)};
}
&.collapsed {
img {
width: ${rem(AVATAR_SIZE_COLLAPSED)};
height: ${rem(AVATAR_SIZE_COLLAPSED)};
}
}
`;

export const UsernameWrapper = styled.div`
display: flex;
gap: ${rem(4)};
justify-content: flex-start;
align-items: center;
`;

export const Tag = styled.span`
font-size: ${({ theme }) => theme.typography.fontSizes[12]};
font-weight: ${({ theme }) => theme.typography.weights.medium};
padding: ${({ theme }) => theme.spacing.xsm};
background-color: ${({ theme }) => theme.utils.getColor('blue', 100)};
color: ${({ theme }) => theme.utils.getColor('blue', 600)};
border-radius: ${rem(2)};
align-self: start;
`;

export const Username = styled.div`
font-weight: ${({ theme }) => theme.typography.weights.bold};
font-size: ${({ theme }) => theme.typography.fontSizes['18']};
`;

export const Email = styled.div`
color: ${({ theme }) => theme.utils.getColor('lightGrey', 650)};
font-weight: ${({ theme }) => theme.typography.weights.medium};
font-size: ${({ theme }) => theme.typography.fontSizes['12']};
`;

const listColumn = css`
display: flex;
flex-direction: column;
gap: ${rem(8)};
`;

export const MenuList = styled.div`
${listColumn};
`;

export const PrimarySection = styled.div`
${listColumn};
`;

const menuItemStyles = (theme: Theme) => css`
padding: ${theme.spacing.md};
display: flex;
justify-content: space-between;
background-color: transparent;
border-radius: ${rem(4)};
cursor: pointer;
transform: scale(1);
transition: transform 0.15s ease, background-color 0.15s ease;
user-select: none;
color: #0e0e17 !important;
&:active {
transform: scale(0.95);
}
&:hover {
background-color: ${theme.utils.getColor('darkBlue', null, 'pale')};
}
&:focus-visible {
outline: ${getFocus({ theme }).styleOutline};
}
`;

export const MenuItem = styled.a`
${({ theme }) => menuItemStyles(theme)};
text-decoration: none;
`;

export const SecondarySection = styled.div`
${listColumn};
border-top: 1px solid ${({ theme }) => theme.utils.getColor('lightGrey', 200)};
padding-top: ${({ theme }) => theme.spacing.md}};
`;

export const LogoutButton = styled.button`
border: none;
width: 100%;
${({ theme }) => menuItemStyles(theme)};
`;
Loading

0 comments on commit fddbe69

Please sign in to comment.