feat: add explore-logo

This commit is contained in:
FutureMeng 2025-02-14 13:34:51 +08:00
parent b99ce6686b
commit 358a294336
8 changed files with 40 additions and 0 deletions

View File

@ -156,6 +156,7 @@ const defaultTheme = {
transitionTiming: 0.3, transitionTiming: 0.3,
gridUnit: 4, gridUnit: 4,
brandIconMaxWidth: 37, brandIconMaxWidth: 37,
brandIconExploreMaxWidth: 150,
}; };
export type SupersetTheme = typeof defaultTheme; export type SupersetTheme = typeof defaultTheme;

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -167,6 +167,7 @@ export const DEFAULT_COMMON_BOOTSTRAP_DATA: CommonBootstrapData = {
brand: { brand: {
path: '', path: '',
icon: '', icon: '',
explore_icon: '',
alt: '', alt: '',
tooltip: '', tooltip: '',
text: '', text: '',

View File

@ -172,6 +172,7 @@ const mockedProps = {
brand: { brand: {
path: '/superset/welcome/', path: '/superset/welcome/',
icon: '/static/assets/images/superset-logo-horiz.png', icon: '/static/assets/images/superset-logo-horiz.png',
explore_icon: '/static/assets/images/explore-logo.png',
alt: 'Superset', alt: 'Superset',
width: '126', width: '126',
tooltip: '', tooltip: '',

View File

@ -52,6 +52,33 @@ const StyledHeader = styled.header`
.caret { .caret {
display: none; display: none;
} }
.navbar-brand-explore-container {
display: flex;
flex-direction: column;
justify-content: center;
}
.navbar-brand-explore {
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 * theme.brandIconExploreMaxWidth}px;
img {
height: 100%;
object-fit: contain;
}
&:focus {
border-color: transparent;
}
&:focus-visible {
border-color: ${theme.colors.primary.dark1};
}
}
.navbar-brand { .navbar-brand {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -242,6 +269,11 @@ export function Menu({
}; };
return ( return (
<StyledHeader className="top" id="main-menu" role="navigation"> <StyledHeader className="top" id="main-menu" role="navigation">
<Row className="navbar-brand-explore-container">
<a className="navbar-brand-explore" href={brand.path} tabIndex={-2}>
<img src={brand.explore_icon} alt={brand.alt} />
</a>
</Row>
<Row> <Row>
<Col md={16} xs={24}> <Col md={16} xs={24}>
<Tooltip <Tooltip

View File

@ -88,6 +88,7 @@ export type ChartResponse = {
export interface BrandProps { export interface BrandProps {
path: string; path: string;
icon: string; icon: string;
explore_icon: string | undefined;
alt: string; alt: string;
tooltip: string; tooltip: string;
text: string; text: string;

View File

@ -313,6 +313,9 @@ APP_NAME = "Superset"
# Specify the App icon # Specify the App icon
APP_ICON = "/static/assets/images/superset-logo-horiz.png" APP_ICON = "/static/assets/images/superset-logo-horiz.png"
# Specify the Explore icon
EXPLORE_ICON = "/static/assets/images/explore-logo.png"
# Specify where clicking the logo would take the user' # Specify where clicking the logo would take the user'
# Default value of None will take you to '/superset/welcome' # Default value of None will take you to '/superset/welcome'
# You can also specify a relative URL e.g. '/superset/welcome' or '/dashboards/list' # You can also specify a relative URL e.g. '/superset/welcome' or '/dashboards/list'

View File

@ -257,6 +257,7 @@ def menu_data(user: User) -> dict[str, Any]:
"brand": { "brand": {
"path": appbuilder.app.config["LOGO_TARGET_PATH"] or "/superset/welcome/", "path": appbuilder.app.config["LOGO_TARGET_PATH"] or "/superset/welcome/",
"icon": appbuilder.app_icon, "icon": appbuilder.app_icon,
"explore_icon": appbuilder.app.config["EXPLORE_ICON"],
"alt": appbuilder.app_name, "alt": appbuilder.app_name,
"tooltip": appbuilder.app.config["LOGO_TOOLTIP"], "tooltip": appbuilder.app.config["LOGO_TOOLTIP"],
"text": brand_text, "text": brand_text,