fix: Navbar styles and Welcome page text (#19586)

* Enhance navbar styles

* Clean up style
This commit is contained in:
Geido 2022-04-12 18:41:00 +03:00 committed by GitHub
parent 6a3220f905
commit 59dda1fa05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 116 additions and 114 deletions

View File

@ -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;
}

View File

@ -113,23 +113,27 @@ 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;
${({ theme }) => `
display: flex;
flex-direction: row;
span {
display: block;
margin: ${({ theme }) => theme.gridUnit * 1}px;
line-height: 1;
justify-content: space-between;
height: 50px;
background-color: ${theme.colors.grayscale.light5};
.welcome-header {
font-size: ${theme.typography.sizes.l}px;
padding: ${theme.gridUnit * 4}px ${theme.gridUnit * 2 + 2}px;
margin: 0 ${theme.gridUnit * 2}px;
}
}
.switch {
display: flex;
flex-direction: row;
margin: ${theme.gridUnit * 4}px;
span {
display: block;
margin: ${theme.gridUnit * 1}px;
line-height: 1;
}
}
`}
`;
export const LoadingCards = ({ cover }: LoadingProps) => (
@ -275,7 +279,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
return (
<WelcomeContainer>
<WelcomeNav>
<span className="navbar-brand">Home</span>
<h1 className="welcome-header">Home</h1>
{isFeatureEnabled(FeatureFlag.THUMBNAILS) ? (
<div className="switch">
<AntdSwitch checked={checked} onChange={handleToggle} />

View File

@ -84,101 +84,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;
}
}
}
.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%;
.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;
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 {