Update MentionTableField to use MentionTypeahead

This commit is contained in:
Justin Edmund 2023-08-21 17:27:44 -07:00
parent 6b562941c7
commit ba1bfb9e36
2 changed files with 13 additions and 8 deletions

View file

@ -1,8 +1,5 @@
import { useEffect, useState } from 'react'
import MentionEditor from '~components/common/MentionEditor'
import TableField from '~components/common/TableField' import TableField from '~components/common/TableField'
import MentionTypeahead from '../MentionTypeahead'
import styles from './index.module.scss'
interface Props interface Props
extends React.DetailedHTMLProps< extends React.DetailedHTMLProps<
@ -12,25 +9,33 @@ interface Props
label: string label: string
description?: string description?: string
placeholder?: string placeholder?: string
onUpdate: (content: string[]) => void inclusions: MentionItem[]
exclusions: MentionItem[]
onUpdate: (content: MentionItem[]) => void
} }
const MentionTableField = ({ const MentionTableField = ({
label, label,
description, description,
placeholder, placeholder,
inclusions,
exclusions,
...props ...props
}: Props) => { }: Props) => {
return ( return (
<TableField <TableField
{...props} {...props}
name={props.name || ''} name={props.name || ''}
description={description}
className="mention" className="mention"
label={label} label={label}
> >
<MentionEditor <MentionTypeahead
bound={true} label={label}
description={description}
placeholder={placeholder} placeholder={placeholder}
inclusions={inclusions}
exclusions={exclusions}
onUpdate={props.onUpdate} onUpdate={props.onUpdate}
/> />
</TableField> </TableField>

View file

@ -45,7 +45,7 @@
} }
&.mention { &.mention {
grid-template-columns: 1fr 2fr; grid-template-columns: 1fr 1fr;
} }
.left { .left {