Skip to content

Commit

Permalink
fix(facelift): support icon right in large menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Nov 2, 2023
1 parent a119ef0 commit 71ec3f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SelectIcon} from '@sanity/icons'
import {CheckmarkIcon, SelectIcon} from '@sanity/icons'
import {Button, MenuButton, Menu, MenuButtonProps, Box, Label, Stack, Card} from '@sanity/ui'
import React, {useCallback, useMemo, useState} from 'react'
import styled from 'styled-components'
Expand Down Expand Up @@ -101,6 +101,9 @@ export function WorkspaceMenuButton(props: WorkspaceMenuButtonProps) {
onClick={handleSelectWorkspace}
pressed={workspace.name === activeWorkspace.name}
selected={workspace.name === activeWorkspace.name}
iconRight={
workspace.name === activeWorkspace.name ? CheckmarkIcon : undefined
}
badgeText={STATE_TITLES[state]}
preview={<WorkspacePreviewIcon icon={workspace.icon} size="large" />}
text={workspace?.title || workspace.name}
Expand Down
6 changes: 6 additions & 0 deletions packages/sanity/src/ui/menuItem/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export const MenuItem = forwardRef(function MenuItem(
{badgeText}
</Badge>
)}
{iconRight && (
<Text size={FONT_SIZE}>
{isValidElement(iconRight) && iconRight}
{isValidElementType(iconRight) && createElement(iconRight)}
</Text>
)}
</Flex>
)
}
Expand Down

0 comments on commit 71ec3f9

Please sign in to comment.