Skip to content

Commit a09975c

Browse files
committed
Replace custom CSS with PatternFly Sidebar on User Preferences page
Assisted by Claude code
1 parent 52099b4 commit a09975c

4 files changed

Lines changed: 20 additions & 65 deletions

File tree

frontend/packages/console-app/src/components/user-preferences/UserPreferenceForm.scss

Lines changed: 0 additions & 13 deletions
This file was deleted.

frontend/packages/console-app/src/components/user-preferences/UserPreferenceForm.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@ import { Form } from '@patternfly/react-core';
33
import type { ResolvedUserPreferenceItem } from './types';
44
import UserPreferenceField from './UserPreferenceField';
55

6-
import './UserPreferenceForm.scss';
7-
86
type UserPreferenceFormProps = { items: ResolvedUserPreferenceItem[] };
97

108
const UserPreferenceForm: FC<UserPreferenceFormProps> = ({ items }) =>
119
items && items.length > 0 ? (
12-
<Form
13-
onSubmit={(event) => event.preventDefault()}
14-
className="co-user-preference__form"
15-
role="form"
16-
>
10+
<Form onSubmit={(event) => event.preventDefault()} role="form">
1711
{items.map((item) => (
1812
<UserPreferenceField key={item.id} item={item} />
1913
))}

frontend/packages/console-app/src/components/user-preferences/UserPreferencePage.scss

Lines changed: 0 additions & 35 deletions
This file was deleted.

frontend/packages/console-app/src/components/user-preferences/UserPreferencePage.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import { useMemo, useState, useEffect, createRef } from 'react';
22
import type { FC, ReactElement, JSXElementConstructor, MouseEvent } from 'react';
33
import type { TabProps, TabContentProps } from '@patternfly/react-core';
4-
import { Tabs, Tab, TabTitleText, TabContent, PageSection } from '@patternfly/react-core';
4+
import {
5+
Tabs,
6+
Tab,
7+
TabTitleText,
8+
TabContent,
9+
PageSection,
10+
Sidebar,
11+
SidebarContent,
12+
SidebarPanel,
13+
} from '@patternfly/react-core';
514
import { useTranslation } from 'react-i18next';
615
import { useParams, useNavigate } from 'react-router';
716
import {
@@ -26,7 +35,6 @@ import type {
2635
} from './types';
2736
import UserPreferenceForm from './UserPreferenceForm';
2837
import { getUserPreferenceGroups } from './utils/getUserPreferenceGroups';
29-
import './UserPreferencePage.scss';
3038

3139
const UserPreferencePage: FC = () => {
3240
// resources and calls to hooks
@@ -78,6 +86,7 @@ const UserPreferencePage: FC = () => {
7886
);
7987
acc[1].push(
8088
<TabContent
89+
className="pf-v6-u-w-75-on-lg pf-v6-u-w-50-on-xl"
8190
key={id}
8291
eventKey={id}
8392
id={id}
@@ -117,7 +126,7 @@ const UserPreferencePage: FC = () => {
117126
};
118127
const activeTab = sortedUserPreferenceGroups.find((group) => group.id === activeTabId)?.label;
119128
return (
120-
<div className="co-user-preference-page">
129+
<>
121130
<DocumentTitle>
122131
{activeTab
123132
? t('console-app~User Preferences {{activeTab}}', { activeTab })
@@ -131,8 +140,8 @@ const UserPreferencePage: FC = () => {
131140
/>
132141
<PageSection>
133142
{userPreferenceItemResolved ? (
134-
<div className="co-user-preference-page-content">
135-
<div className="co-user-preference-page-content__tabs">
143+
<Sidebar hasGutter>
144+
<SidebarPanel variant="sticky">
136145
<Tabs
137146
activeKey={activeTabId}
138147
onSelect={handleTabClick}
@@ -142,17 +151,17 @@ const UserPreferencePage: FC = () => {
142151
>
143152
{userPreferenceTabs}
144153
</Tabs>
145-
</div>
146-
<div className="co-user-preference-page-content__tab-content">
154+
</SidebarPanel>
155+
<SidebarContent>
147156
{userPreferenceTabContents}
148157
{spotlight && spotlightElement && <Spotlight selector={spotlight} interactive />}
149-
</div>
150-
</div>
158+
</SidebarContent>
159+
</Sidebar>
151160
) : (
152161
<LoadingBox />
153162
)}
154163
</PageSection>
155-
</div>
164+
</>
156165
);
157166
};
158167

0 commit comments

Comments
 (0)