Skip to content

Commit

Permalink
feat: accept JSX.Element for various dropdown items (#129)
Browse files Browse the repository at this point in the history
* Update SandpackPreset label to accept JSX.Element

* Update BlockTypeSelect.tsx to accept JSX.Element in select items

* Update select.tsx to accept JSX.Element in SelectProps

* Update toolbar.tsx to accept JSX.Element in dropdown
  • Loading branch information
forhappy authored Oct 17, 2023
1 parent 5de52ad commit ec8eca1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/plugins/sandpack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface SandpackPreset {
/**
* The label of the preset, displayed in the sandpack button dropdown.
*/
label: string
label: string | JSX.Element
/**
* The meta string that will be used to identify the preset from the fenced code block. e.g. "live react"
*/
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/toolbar/components/BlockTypeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const BlockTypeSelect = () => {
if (!hasQuote && !hasHeadings) {
return null
}
const items: { label: string; value: BlockType }[] = [{ label: 'Paragraph', value: 'paragraph' }]
const items: { label: string | JSX.Element; value: BlockType }[] = [{ label: 'Paragraph', value: 'paragraph' }]

if (hasQuote) {
items.push({ label: 'Quote', value: 'quote' })
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/toolbar/primitives/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface SelectProps<T extends string> {
onChange: (value: T) => void
triggerTitle: string
placeholder: string
items: ({ label: string; value: T } | 'separator')[]
items: ({ label: string | JSX.Element; value: T } | 'separator')[]
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/toolbar/primitives/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export interface ButtonOrDropdownButtonProps<T extends string> {
/**
* The label to show in the dropdown.
*/
label: string
label: string | JSX.Element
}[]
}

Expand Down

0 comments on commit ec8eca1

Please sign in to comment.