Merge branch 'release' of https://github.com/appsmithorg/appsmith into release

This commit is contained in:
Automated Github Action 2020-09-26 14:06:58 +00:00
commit 84bc2420d3
2 changed files with 50 additions and 8 deletions

View File

@ -637,6 +637,9 @@ type ColorType = {
bg: ColorPalette; bg: ColorPalette;
color: ColorPalette; color: ColorPalette;
}; };
profileDropdown: {
userName: ColorPalette;
};
}; };
export const dark: ColorType = { export const dark: ColorType = {
@ -849,6 +852,9 @@ export const dark: ColorType = {
bg: darkShades[3], bg: darkShades[3],
color: darkShades[7], color: darkShades[7],
}, },
profileDropdown: {
userName: darkShades[9],
},
}; };
export const light: ColorType = { export const light: ColorType = {
@ -1061,6 +1067,9 @@ export const light: ColorType = {
bg: lightShades[3], bg: lightShades[3],
color: lightShades[7], color: lightShades[7],
}, },
profileDropdown: {
userName: lightShades[9],
},
}; };
export const theme: Theme = { export const theme: Theme = {

View File

@ -1,5 +1,5 @@
import React, { Fragment } from "react"; import React, { Fragment } from "react";
import { CommonComponentProps } from "components/ads/common"; import { CommonComponentProps, Classes } from "components/ads/common";
import { getInitialsAndColorCode } from "utils/AppsmithUtils"; import { getInitialsAndColorCode } from "utils/AppsmithUtils";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { getThemeDetails } from "selectors/themeSelectors"; import { getThemeDetails } from "selectors/themeSelectors";
@ -40,6 +40,29 @@ const ProfileMenuStyle = createGlobalStyle`
} }
`; `;
const UserInformation = styled.div`
padding: ${props => props.theme.spaces[6]}px;
display: flex;
align-items: center;
.user-name {
flex-basis: 80%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.${Classes.TEXT} {
color: ${props => props.theme.colors.profileDropdown.userName};
}
}
.user-image {
margin-right: ${props => props.theme.spaces[4]}px;
div {
cursor: default;
}
}
`;
export default function ProfileDropdown(props: TagProps) { export default function ProfileDropdown(props: TagProps) {
const themeDetails = useSelector(getThemeDetails); const themeDetails = useSelector(getThemeDetails);
@ -48,20 +71,30 @@ export default function ProfileDropdown(props: TagProps) {
themeDetails.theme.colors.appCardColors, themeDetails.theme.colors.appCardColors,
); );
const Profile = (
<ProfileImage backgroundColor={initialsAndColorCode[1]}>
<Text type={TextType.H6} highlight>
{initialsAndColorCode[0]}
</Text>
</ProfileImage>
);
return ( return (
<Fragment> <Fragment>
<ProfileMenuStyle /> <ProfileMenuStyle />
<Menu <Menu
className="profile-menu" className="profile-menu"
position={Position.BOTTOM} position={Position.BOTTOM}
target={ target={Profile}
<ProfileImage backgroundColor={initialsAndColorCode[1]}>
<Text type={TextType.H6} highlight>
{initialsAndColorCode[0]}
</Text>
</ProfileImage>
}
> >
<UserInformation>
<div className="user-image">{Profile}</div>
<div className="user-name">
<Text type={TextType.P1} highlight>
{props.userName}
</Text>
</div>
</UserInformation>
<MenuDivider />
<ThemeSwitcher /> <ThemeSwitcher />
<MenuDivider /> <MenuDivider />
<MenuItem <MenuItem