Skip to content

fix(ws): Fix UI bugs in PF Theme #306

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

Merged
merged 1 commit into from
May 7, 2025
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions workspaces/frontend/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import * as React from 'react';
import '@patternfly/react-core/dist/styles/base.css';
import './app.css';
import {
Brand,
Flex,
Masthead,
MastheadBrand,
MastheadContent,
MastheadLogo,
MastheadMain,
MastheadToggle,
Page,
Expand All @@ -13,6 +16,7 @@ import {
} from '@patternfly/react-core';
import { BarsIcon } from '@patternfly/react-icons';
import NamespaceSelector from '~/shared/components/NamespaceSelector';
import logoDarkTheme from '~/images/logo-dark-theme.svg';
import { NamespaceContextProvider } from './context/NamespaceContextProvider';
import AppRoutes from './AppRoutes';
import NavSidebar from './NavSidebar';
Expand All @@ -37,6 +41,15 @@ const App: React.FC = () => {
<BarsIcon />
</PageToggleButton>
</MastheadToggle>
{!isMUITheme() ? (
<MastheadBrand>
<MastheadLogo component="a">
<Brand src={logoDarkTheme} alt="Kubeflow" heights={{ default: '36px' }} />
</MastheadLogo>
</MastheadBrand>
) : (
''
)}
</MastheadMain>
<MastheadContent>
<Flex>
Expand Down
19 changes: 12 additions & 7 deletions workspaces/frontend/src/app/NavSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
PageSidebarBody,
} from '@patternfly/react-core';
import { useNavData, isNavDataGroup, NavDataHref, NavDataGroup } from './AppRoutes';
import { isMUITheme, LOGO_LIGHT } from './const';

const NavHref: React.FC<{ item: NavDataHref }> = ({ item }) => (
<NavItem key={item.label} data-id={item.label} itemId={item.label}>
Expand Down Expand Up @@ -49,13 +50,17 @@ const NavSidebar: React.FC = () => {
<PageSidebarBody>
<Nav id="nav-primary-simple">
<NavList id="nav-list-simple">
<NavItem>
<Brand
className="kubeflow_brand"
src={`${window.location.origin}/images/logo.svg`}
alt="Kubeflow Logo"
/>
</NavItem>
{isMUITheme() ? (
<NavItem>
<Brand
className="kubeflow_brand"
src={`${window.location.origin}/images/${LOGO_LIGHT}`}
alt="Kubeflow Logo"
/>
</NavItem>
) : (
''
)}
{navData.map((item) =>
isNavDataGroup(item) ? (
<NavGroup key={item.label} item={item} />
Expand Down
2 changes: 2 additions & 0 deletions workspaces/frontend/src/app/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ export enum Theme {

export const isMUITheme = (): boolean => STYLE_THEME === Theme.MUI;
const STYLE_THEME = process.env.STYLE_THEME || Theme.MUI;

export const LOGO_LIGHT = process.env.LOGO || 'logo.svg';
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const WorkspaceCreation: React.FunctionComponent = () => {

return (
<>
<PageGroup stickyOnBreakpoint={{ default: 'top' }}>
<PageSection isFilled={false}>
<PageGroup isFilled={false} stickyOnBreakpoint={{ default: 'top' }}>
<PageSection>
<Stack hasGutter>
<StackItem>
<Flex>
Expand Down
43 changes: 43 additions & 0 deletions workspaces/frontend/src/images/logo-dark-theme.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 10 additions & 8 deletions workspaces/frontend/src/shared/components/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,17 @@ const Filter: React.FC<FilterProps> = ({ id, onFilter, columnNames }) => {
>
<ToolbarContent>
<ToolbarToggleGroup toggleIcon={<FilterIcon />} breakpoint="xl">
<ToolbarItem id={`${id}-dropdown`}>{filterDropdown}</ToolbarItem>
<ToolbarGroup variant="filter-group">
<ToolbarItem id={`${id}-dropdown`}>{filterDropdown}</ToolbarItem>
<ToolbarItem>
<SearchInput
id={`${id}-search-input`}
placeholder={`Filter by ${activeFilter.columnName}`}
value={searchValue}
onChange={(_event, value) => onSearchChange(value)}
onClear={() => onSearchChange('')}
/>
</ToolbarItem>
{filters.map((filter) => (
<ToolbarFilter
key={`${filter.columnName}-filter`}
Expand All @@ -213,13 +222,6 @@ const Filter: React.FC<FilterProps> = ({ id, onFilter, columnNames }) => {
</ToolbarFilter>
))}
</ToolbarGroup>
<SearchInput
id={`${id}-search-input`}
placeholder={`Filter by ${activeFilter.columnName}`}
value={searchValue}
onChange={(_event, value) => onSearchChange(value)}
onClear={() => onSearchChange('')}
/>
</ToolbarToggleGroup>
</ToolbarContent>
</Toolbar>
Expand Down