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: Make spacings in Settings menu more consistent #11709

Merged
merged 1 commit into from
Nov 19, 2020
Merged
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
35 changes: 25 additions & 10 deletions superset-frontend/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ const StyledHeader = styled.header`
display: flex;
align-items: center;
}

.ant-menu {
.ant-menu-item-group-title {
padding-bottom: ${({ theme }) => theme.gridUnit}px;
}
.ant-menu-item {
margin-bottom: ${({ theme }) => theme.gridUnit * 2}px;
}
.about-section {
margin: ${({ theme }) => theme.gridUnit}px 0
${({ theme }) => theme.gridUnit * 2}px;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use :last-child so this can be more generic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those styles are needed not for any last child but specifically for "About us" section. That section is a bit "hacked" as "Version" and "SHA" are not defined as menu items - we don't want them to be clickable or highlighted on hover. Because of that, default Antd styles from Menu were not applied there and I added those styles to make it look nicer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, we may still generalize it something like MetaMenuItem in case this pattern is used elsewhere. But let's not over-optimize for now.

}
`;

export function Menu({
Expand Down Expand Up @@ -196,16 +209,18 @@ export function Menu({
key="about-section"
title={t('About')}
>
{navbarRight.version_string && (
<li className="version-info">
<span>Version: {navbarRight.version_string}</span>
</li>
)}
{navbarRight.version_sha && (
<li className="version-info">
<span>SHA: {navbarRight.version_sha}</span>
</li>
)}
<div className="about-section">
{navbarRight.version_string && (
<li className="version-info">
<span>Version: {navbarRight.version_string}</span>
</li>
)}
{navbarRight.version_sha && (
<li className="version-info">
<span>SHA: {navbarRight.version_sha}</span>
</li>
)}
</div>
</DropdownMenu.ItemGroup>,
]}
</DropdownMenu>
Expand Down