Skip to content

Commit 5219886

Browse files
committed
extract TipIcon and add one to Role column header
1 parent e809f20 commit 5219886

File tree

3 files changed

+41
-11
lines changed

3 files changed

+41
-11
lines changed

app/pages/project/access/ProjectAccessPage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { Button } from '~/ui/lib/Button'
3939
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
4040
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
4141
import { TableActions, TableEmptyBox } from '~/ui/lib/Table'
42+
import { TipIcon } from '~/ui/lib/TipIcon'
4243
import { accessTypeLabel, getBadgeColor } from '~/util/access'
4344
import { groupBy, isTruthy, sortBy } from '~/util/array'
4445

@@ -130,7 +131,15 @@ export function ProjectAccessPage() {
130131
cell: (props) => accessTypeLabel(props.getValue()),
131132
}),
132133
colHelper.accessor('roleBadges', {
133-
header: 'Role',
134+
header: () => (
135+
<span className="inline-flex items-center">
136+
Role
137+
<TipIcon className="ml-2">
138+
A user or group&apos;s effective role for this project is the strongest role
139+
on either the silo or project.
140+
</TipIcon>
141+
</span>
142+
),
134143
cell: (props) => (
135144
<ListPlusCell tooltipTitle="Other roles">
136145
{props.getValue().map(({ roleName, roleSource }) => (

app/ui/lib/FieldLabel.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
import cn from 'classnames'
99
import type { ElementType, PropsWithChildren } from 'react'
1010

11-
import { Question12Icon } from '@oxide/design-system/icons/react'
12-
13-
import { Tooltip } from '~/ui/lib/Tooltip'
11+
import { TipIcon } from './TipIcon'
1412

1513
interface FieldLabelProps {
1614
id: string
@@ -43,13 +41,7 @@ export const FieldLabel = ({
4341
</span>
4442
)}
4543
</Component>
46-
{tip && (
47-
<Tooltip content={tip} placement="top">
48-
<button className="svg:pointer-events-none" type="button">
49-
<Question12Icon className="text-quinary" />
50-
</button>
51-
</Tooltip>
52-
)}
44+
{tip && <TipIcon>{tip}</TipIcon>}
5345
</div>
5446
)
5547
}

app/ui/lib/TipIcon.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
5+
*
6+
* Copyright Oxide Computer Company
7+
*/
8+
import cn from 'classnames'
9+
10+
import { Question12Icon } from '@oxide/design-system/icons/react'
11+
12+
import { Tooltip } from './Tooltip'
13+
14+
type TipIconProps = {
15+
children: React.ReactNode
16+
className?: string
17+
}
18+
export function TipIcon({ children, className }: TipIconProps) {
19+
return (
20+
<Tooltip content={children} placement="top">
21+
<button
22+
className={cn('inline-flex svg:pointer-events-none', className)}
23+
type="button"
24+
>
25+
<Question12Icon className="text-quinary" />
26+
</button>
27+
</Tooltip>
28+
)
29+
}

0 commit comments

Comments
 (0)