Skip to content

Commit 46f5bb8

Browse files
committed
feat(wheel-of-names): initial migration from mui to bui (#7869)
Signed-off-by: Patrick Wyler <patrick_wyler@hotmail.com>
1 parent 07667be commit 46f5bb8

File tree

15 files changed

+2279
-709
lines changed

15 files changed

+2279
-709
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-wheel-of-names': minor
3+
---
4+
5+
Migrated from Material-UI to Backstage UI (BUI).

workspaces/wheel-of-names/plugins/wheel-of-names/dev/index.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import { wheelOfNamesPlugin, WheelOfNamesPage } from '../src/plugin';
1818
import { TestApiProvider } from '@backstage/test-utils';
1919
import { catalogApiRef } from '@backstage/plugin-catalog-react';
2020
import { Entity } from '@backstage/catalog-model';
21-
import { Content, Header, Page } from '@backstage/core-components';
21+
// This is a dev Backstage instance and not part of the plugin
22+
// eslint-disable-next-line @backstage/no-ui-css-imports-in-non-frontend
23+
import '@backstage/ui/css/styles.css';
2224

2325
// Sample mock data
2426
const mockUsers: Entity[] = [
@@ -201,14 +203,9 @@ app.registerPlugin(wheelOfNamesPlugin);
201203
// Wrap the page with API providers
202204
app.addPage({
203205
element: (
204-
<Page themeId="home">
205-
<Header title="Wheel of Names" />
206-
<Content>
207-
<TestApiProvider apis={[[catalogApiRef, mockCatalogApi]]}>
208-
<WheelOfNamesPage />
209-
</TestApiProvider>
210-
</Content>
211-
</Page>
206+
<TestApiProvider apis={[[catalogApiRef, mockCatalogApi]]}>
207+
<WheelOfNamesPage />
208+
</TestApiProvider>
212209
),
213210
title: 'Wheel of Names',
214211
path: '/wheel-of-names',

workspaces/wheel-of-names/plugins/wheel-of-names/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
"@backstage/frontend-plugin-api": "backstage:^",
5656
"@backstage/plugin-catalog-react": "backstage:^",
5757
"@backstage/theme": "backstage:^",
58-
"@material-ui/core": "^4.9.13",
59-
"@material-ui/icons": "^4.9.1",
60-
"@material-ui/lab": "^4.0.0-alpha.61",
58+
"@backstage/ui": "backstage:^",
59+
"@remixicon/react": "^4.2.0",
6160
"canvas-confetti": "^1.9.3",
6261
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
62+
"react-aria-components": "^1.6.2",
6363
"react-dom": "^17.0.0 || ^18.0.0",
6464
"react-router-dom": "^6.3.0",
6565
"react-use": "^17.2.4"

workspaces/wheel-of-names/plugins/wheel-of-names/src/components/Participants/EntityPicker.tsx

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

workspaces/wheel-of-names/plugins/wheel-of-names/src/components/Participants/List.tsx

Lines changed: 43 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,9 @@
1414
* limitations under the License.
1515
*/
1616
import { Fragment } from 'react';
17-
import {
18-
Typography,
19-
Button,
20-
Paper,
21-
List,
22-
ListItem,
23-
ListItemText,
24-
ListItemSecondaryAction,
25-
IconButton,
26-
Divider,
27-
Avatar,
28-
} from '@material-ui/core';
29-
import PersonIcon from '@material-ui/icons/Person';
30-
import DeleteIcon from '@material-ui/icons/Delete';
31-
import { useParticipantsStyles } from './Styles';
32-
import { Entity } from '@backstage/catalog-model';
17+
import { Text, Button } from '@backstage/ui';
18+
import { RiDeleteBin6Line } from '@remixicon/react';
19+
import classes from './Participants.module.css';
3320

3421
interface Participant {
3522
id: string;
@@ -45,17 +32,12 @@ interface ParticipantsListProps {
4532
isProcessing: boolean;
4633
}
4734

48-
export const ParticipantsList = (
49-
{
50-
participants,
51-
onRemoveParticipant,
52-
onClearAll,
53-
isProcessing,
54-
}: ParticipantsListProps,
55-
entity: Entity,
56-
) => {
57-
const classes = useParticipantsStyles();
58-
35+
export const ParticipantsList = ({
36+
participants,
37+
onRemoveParticipant,
38+
onClearAll,
39+
isProcessing,
40+
}: ParticipantsListProps) => {
5941
const getParticipantClassName = (participant: Participant) => {
6042
return participant.fromGroup
6143
? classes.groupMemberItem
@@ -69,60 +51,50 @@ export const ParticipantsList = (
6951
return (
7052
<div className={classes.selectedParticipantsContainer}>
7153
<div className={classes.participantsHeader}>
72-
<Typography variant="subtitle1">
73-
Selected Participants ({participants.length})
74-
</Typography>
54+
<Text weight="bold">Selected Participants ({participants.length})</Text>
7555

76-
<Button
77-
variant="outlined"
78-
color="secondary"
79-
size="small"
80-
onClick={onClearAll}
81-
disabled={isProcessing}
82-
startIcon={<DeleteIcon />}
83-
>
56+
<Button onClick={onClearAll} isDisabled={isProcessing}>
8457
Clear All
8558
</Button>
8659
</div>
8760

88-
<Paper className={classes.selectedParticipantsList}>
89-
<List dense>
61+
<div className={classes.selectedParticipantsList}>
62+
<ul style={{ listStyle: 'none', padding: 0, margin: 0 }}>
9063
{participants.map(participant => (
9164
<Fragment key={participant.id}>
92-
<ListItem className={getParticipantClassName(participant)}>
93-
<Avatar
94-
className={
95-
entity.kind === 'Group'
96-
? classes.groupAvatar
97-
: classes.userAvatar
98-
}
65+
<li
66+
className={getParticipantClassName(participant)}
67+
style={{
68+
display: 'flex',
69+
alignItems: 'center',
70+
padding: '12px 16px',
71+
borderBottom: '1px solid var(--bui-border)',
72+
}}
73+
>
74+
<div style={{ flex: 1 }}>
75+
<Text>{participant.displayName || participant.name}</Text>
76+
{participant.fromGroup && (
77+
<Text
78+
variant="body-small"
79+
className={classes.groupInfoText}
80+
>
81+
From group: {participant.fromGroup}
82+
</Text>
83+
)}
84+
</div>
85+
<Button
86+
variant="secondary"
87+
aria-label="Remove participant"
88+
onClick={() => onRemoveParticipant(participant.id)}
89+
isDisabled={isProcessing}
9990
>
100-
<PersonIcon />
101-
</Avatar>
102-
<ListItemText
103-
primary={participant.displayName || participant.name}
104-
secondary={
105-
participant.fromGroup
106-
? `From group: ${participant.fromGroup}`
107-
: undefined
108-
}
109-
/>
110-
<ListItemSecondaryAction>
111-
<IconButton
112-
edge="end"
113-
aria-label="delete"
114-
onClick={() => onRemoveParticipant(participant.id)}
115-
disabled={isProcessing}
116-
>
117-
<DeleteIcon fontSize="small" />
118-
</IconButton>
119-
</ListItemSecondaryAction>
120-
</ListItem>
121-
<Divider component="li" />
91+
<RiDeleteBin6Line size={18} />
92+
</Button>
93+
</li>
12294
</Fragment>
12395
))}
124-
</List>
125-
</Paper>
96+
</ul>
97+
</div>
12698
</div>
12799
);
128100
};

0 commit comments

Comments
 (0)