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

fix: Navbar styles and Welcome page text #19586

Merged
merged 3 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 4 additions & 5 deletions superset-frontend/src/assets/stylesheets/superset.less
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,11 @@ td.filtered {
width: 100% !important;
}

// Remove this when the jinja menu/navbar is replaced with react.
// This style already exists in that view
/*
Hides the logo while loading the page.
Emotion styles will take care of the correct styling
*/
.navbar-brand {
display: flex;
flex-direction: column;
justify-content: center;
display: none;
}

Expand Down
42 changes: 25 additions & 17 deletions superset-frontend/src/views/CRUD/welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,31 @@ const WelcomeContainer = styled.div`
`;

const WelcomeNav = styled.div`
height: 50px;
background-color: white;
.navbar-brand {
margin-left: ${({ theme }) => theme.gridUnit * 2}px;
font-weight: ${({ theme }) => theme.typography.weights.bold};
}
.switch {
float: right;
margin: ${({ theme }) => theme.gridUnit * 5}px;
display: flex;
flex-direction: row;
span {
display: block;
margin: ${({ theme }) => theme.gridUnit * 1}px;
line-height: 1;
${({ theme }) => `
height: 50px;
background-color: ${theme.colors.grayscale.light5};
& > span {
geido marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
float: left;
geido marked this conversation as resolved.
Show resolved Hide resolved
height: 50px;
geido marked this conversation as resolved.
Show resolved Hide resolved
font-size: ${theme.typography.sizes.l}px;
padding: ${theme.gridUnit * 4}px ${theme.gridUnit * 2 + 2}px;
line-height: ${theme.gridUnit * 5}px;
margin-left: ${theme.gridUnit * 2}px;
font-weight: ${theme.typography.weights.bold};
}
}
.switch {
float: right;
margin: ${theme.gridUnit * 5}px;
display: flex;
flex-direction: row;
span {
display: block;
margin: ${theme.gridUnit * 1}px;
line-height: 1;
}
}
`}
`;

export const LoadingCards = ({ cover }: LoadingProps) => (
Expand Down Expand Up @@ -275,7 +283,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
return (
<WelcomeContainer>
<WelcomeNav>
<span className="navbar-brand">Home</span>
<span>Home</span>
geido marked this conversation as resolved.
Show resolved Hide resolved
{isFeatureEnabled(FeatureFlag.THUMBNAILS) ? (
<div className="switch">
<AntdSwitch checked={checked} onChange={handleToggle} />
Expand Down
183 changes: 91 additions & 92 deletions superset-frontend/src/views/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,101 +83,100 @@ export interface MenuObjectProps extends MenuObjectChildProps {
}

const StyledHeader = styled.header`
background-color: white;
margin-bottom: 2px;
&:nth-last-of-type(2) nav {
margin-bottom: 2px;
}

.caret {
display: none;
}
.navbar-brand {
display: flex;
flex-direction: column;
justify-content: center;
/* must be exactly the height of the Antd navbar */
min-height: 50px;
padding: ${({ theme }) =>
`${theme.gridUnit}px ${theme.gridUnit * 2}px ${theme.gridUnit}px ${
theme.gridUnit * 4
}px`};
max-width: ${({ theme }) => `${theme.gridUnit * 37}px`};
img {
height: 100%;
object-fit: contain;
}
}
.navbar-brand-text {
border-left: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
border-right: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
height: 100%;
color: ${({ theme }) => theme.colors.grayscale.dark1};
padding-left: ${({ theme }) => theme.gridUnit * 4}px;
padding-right: ${({ theme }) => theme.gridUnit * 4}px;
margin-right: ${({ theme }) => theme.gridUnit * 6}px;
font-size: ${({ theme }) => theme.gridUnit * 4}px;
float: left;
display: flex;
flex-direction: column;
justify-content: center;

span {
max-width: ${({ theme }) => theme.gridUnit * 58}px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 1127px) {
display: none;
}
}
.main-nav .ant-menu-submenu-title > svg {
top: ${({ theme }) => theme.gridUnit * 5.25}px;
}
@media (max-width: 767px) {
.navbar-brand {
float: none;
}
}
.ant-menu-horizontal .ant-menu-item {
height: 100%;
line-height: inherit;
}
.ant-menu > .ant-menu-item > a {
padding: ${({ theme }) => theme.gridUnit * 4}px;
}
@media (max-width: 767px) {
.ant-menu-item {
padding: 0 ${({ theme }) => theme.gridUnit * 6}px 0
${({ theme }) => theme.gridUnit * 3}px !important;
}
.ant-menu > .ant-menu-item > a {
padding: 0px;
}
.main-nav .ant-menu-submenu-title > svg:nth-child(1) {
display: none;
}
.ant-menu-item-active > a {
&:hover {
color: ${({ theme }) => theme.colors.primary.base} !important;
background-color: transparent !important;
${({ theme }) => `
background-color: ${theme.colors.grayscale.light5};
margin-bottom: 2px;
&:nth-last-of-type(2) nav {
margin-bottom: 2px;
}
}
}
.caret {
display: none;
}
.navbar-brand {
display: flex;
flex-direction: column;
justify-content: center;
/* must be exactly the height of the Antd navbar */
min-height: 50px;
padding: ${theme.gridUnit}px ${theme.gridUnit * 2}px ${
theme.gridUnit
}px ${theme.gridUnit * 4}px;
max-width: ${theme.gridUnit * 37}px;
img {
height: 100%;
object-fit: contain;
}
}
.navbar-brand-text {
border-left: 1px solid ${theme.colors.grayscale.light2};
border-right: 1px solid ${theme.colors.grayscale.light2};
height: 100%;
color: ${theme.colors.grayscale.dark1};
padding-left: ${theme.gridUnit * 4}px;
padding-right: ${theme.gridUnit * 4}px;
margin-right: ${theme.gridUnit * 6}px;
font-size: ${theme.gridUnit * 4}px;
float: left;
display: flex;
flex-direction: column;
justify-content: center;

.ant-menu-item a {
&:hover {
color: ${({ theme }) => theme.colors.grayscale.dark1};
background-color: ${({ theme }) => theme.colors.primary.light5};
border-bottom: none;
margin: 0;
&:after {
opacity: 1;
width: 100%;
span {
max-width: ${theme.gridUnit * 58}px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 1127px) {
display: none;
}
}
}
}
.main-nav .ant-menu-submenu-title > svg {
top: ${theme.gridUnit * 5.25}px;
}
@media (max-width: 767px) {
.navbar-brand {
float: none;
}
}
.ant-menu-horizontal .ant-menu-item {
height: 100%;
line-height: inherit;
}
.ant-menu > .ant-menu-item > a {
padding: ${theme.gridUnit * 4}px;
}
@media (max-width: 767px) {
.ant-menu-item {
padding: 0 ${theme.gridUnit * 6}px 0
${theme.gridUnit * 3}px !important;
}
.ant-menu > .ant-menu-item > a {
padding: 0px;
}
.main-nav .ant-menu-submenu-title > svg:nth-child(1) {
display: none;
}
.ant-menu-item-active > a {
&:hover {
color: ${theme.colors.primary.base} !important;
background-color: transparent !important;
}
}
}
.ant-menu-item a {
&:hover {
color: ${theme.colors.grayscale.dark1};
background-color: ${theme.colors.primary.light5};
border-bottom: none;
margin: 0;
&:after {
opacity: 1;
width: 100%;
}
}
}
`}
`;
const globalStyles = (theme: SupersetTheme) => css`
.ant-menu-submenu.ant-menu-submenu-popup.ant-menu.ant-menu-light.ant-menu-submenu-placement-bottomLeft {
Expand Down