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

add <DropdownMenu.Label /> #583

Merged
merged 2 commits into from
Sep 27, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/famous-maps-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@status-im/components": patch
---

add `<DropdownMenu.Label />`
10 changes: 8 additions & 2 deletions packages/components/src/dropdown-menu/dropdown-menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ import { DropdownMenu } from '.'

import type { Meta, StoryObj } from '@storybook/react'

const meta: Meta = {
const meta: Meta<{ label: boolean; search: boolean }> = {
title: 'Components/Dropdown Menu',
args: {
label: true,
search: true,
},
argTypes: {},
parameters: {
design: {
Expand All @@ -39,7 +43,9 @@ const meta: Meta = {
<DropdownButton>Open</DropdownButton>

<DropdownMenu.Content sideOffset={10}>
<DropdownMenu.Search placeholder="Search by" />
{args.label && <DropdownMenu.Label>Label</DropdownMenu.Label>}

{args.search && <DropdownMenu.Search placeholder="Search by" />}

<DropdownMenu.Item
icon={<EditIcon />}
Expand Down
19 changes: 19 additions & 0 deletions packages/components/src/dropdown-menu/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ export const Content = forwardRef<

Content.displayName = DropdownMenu.Content.displayName

/**
* Label
*/

export const Label = forwardRef<
React.ElementRef<typeof DropdownMenu.Label>,
React.ComponentPropsWithoutRef<typeof DropdownMenu.Label>
>((props, ref) => {
return (
<DropdownMenu.Label
{...props}
ref={ref}
className="p-2 text-13 font-medium text-neutral-50 dark:text-neutral-40"
/>
)
})

Label.displayName = DropdownMenu.Label.displayName

/**
* Search
*/
Expand Down
Loading