Skip to content
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

feat(components): update dropdown menu title style #16617

Open
wants to merge 2 commits into
base: edge
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ describe('DropdownMenu', () => {
currentOption: mockOptions[0],
dropdownType: 'neutral',
title: 'Custom Dropdown',
caption: 'Select an option',
tooltipText: 'This is a tooltip',
}
render(props)

expect(screen.getByText('Custom Dropdown')).toBeInTheDocument()
expect(screen.getByText('Select an option')).toBeInTheDocument()
expect(screen.getByText('Option 1')).toBeInTheDocument()
})

Expand Down
23 changes: 7 additions & 16 deletions components/src/molecules/DropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { Flex } from '../../primitives'
import { Icon } from '../../icons'
import { useHoverTooltip } from '../../tooltips'
import { useOnClickOutside } from '../../interaction-enhancers'
import { LegacyStyledText } from '../../atoms/StyledText/LegacyStyledText'
import { MenuItem } from '../../atoms/MenuList/MenuItem'
import { Tooltip } from '../../atoms/Tooltip'
import { StyledText } from '../../atoms/StyledText'
Expand Down Expand Up @@ -55,8 +54,6 @@ export interface DropdownMenuProps {
dropdownType?: DropdownBorder
/** dropdown title */
title?: string
/** dropdown item caption */
caption?: string | null
/** text for tooltip */
tooltipText?: string | null
/** html tabindex property */
Expand All @@ -79,7 +76,6 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
width = '9.125rem',
dropdownType = 'rounded',
title,
caption,
tooltipText,
tabIndex = 0,
error,
Expand Down Expand Up @@ -197,14 +193,10 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
}
`
return (
<Flex
flexDirection={DIRECTION_COLUMN}
ref={dropDownMenuWrapperRef}
gridGap={SPACING.spacing4}
>
<Flex flexDirection={DIRECTION_COLUMN} ref={dropDownMenuWrapperRef}>
{title !== null ? (
<Flex gridGap={SPACING.spacing8} paddingBottom={SPACING.spacing8}>
<StyledText desktopStyle="captionRegular" color={COLORS.grey60}>
<StyledText desktopStyle="bodyDefaultRegular" color={COLORS.grey60}>
{title}
</StyledText>
{tooltipText != null ? (
Expand All @@ -222,7 +214,11 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
) : null}
</Flex>
) : null}
<Flex flexDirection={DIRECTION_COLUMN} position={POSITION_RELATIVE}>
<Flex
flexDirection={DIRECTION_COLUMN}
position={POSITION_RELATIVE}
paddingBottom={SPACING.spacing4}
>
<Flex
onClick={(e: MouseEvent) => {
e.preventDefault()
Expand Down Expand Up @@ -302,11 +298,6 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
</Flex>
)}
</Flex>
{caption != null ? (
<LegacyStyledText as="label" color={COLORS.grey60}>
{caption}
</LegacyStyledText>
) : null}
{error != null ? (
<StyledText desktopStyle="bodyDefaultRegular" color={COLORS.red50}>
{error}
Expand Down
Loading