|
@@ -1,11 +1,13 @@
|
|
|
import { useCallback, useState, useRef } from 'react'
|
|
import { useCallback, useState, useRef } from 'react'
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
-import { Tag } from '../../../../../../../app/src/Features/Tags/types'
|
|
|
|
|
|
|
+import { Tag as TagType } from '../../../../../../../app/src/Features/Tags/types'
|
|
|
import Icon from '../../../../../shared/components/icon'
|
|
import Icon from '../../../../../shared/components/icon'
|
|
|
import { useProjectListContext } from '../../../context/project-list-context'
|
|
import { useProjectListContext } from '../../../context/project-list-context'
|
|
|
import { removeProjectFromTag } from '../../../util/api'
|
|
import { removeProjectFromTag } from '../../../util/api'
|
|
|
import classnames from 'classnames'
|
|
import classnames from 'classnames'
|
|
|
import { getTagColor } from '../../../util/tag'
|
|
import { getTagColor } from '../../../util/tag'
|
|
|
|
|
+import Tag from '@/features/ui/components/bootstrap-5/tag'
|
|
|
|
|
+import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
|
|
|
|
|
type InlineTagsProps = {
|
|
type InlineTagsProps = {
|
|
|
projectId: string
|
|
projectId: string
|
|
@@ -27,7 +29,7 @@ function InlineTags({ projectId, ...props }: InlineTagsProps) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type InlineTagProps = {
|
|
type InlineTagProps = {
|
|
|
- tag: Tag
|
|
|
|
|
|
|
+ tag: TagType
|
|
|
projectId: string
|
|
projectId: string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -57,38 +59,62 @@ function InlineTag({ tag, projectId }: InlineTagProps) {
|
|
|
const handleCloseMouseOut = () => setClassNames('')
|
|
const handleCloseMouseOut = () => setClassNames('')
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
|
|
|
- <div
|
|
|
|
|
- className={classnames('tag-label', classNames)}
|
|
|
|
|
- onClick={handleLabelClick}
|
|
|
|
|
- ref={tagLabelRef}
|
|
|
|
|
- >
|
|
|
|
|
- <button
|
|
|
|
|
- className="label label-default tag-label-name"
|
|
|
|
|
- aria-label={t('select_tag', { tagName: tag.name })}
|
|
|
|
|
- ref={tagBtnRef}
|
|
|
|
|
- onClick={() => selectTag(tag._id)}
|
|
|
|
|
- >
|
|
|
|
|
- <span
|
|
|
|
|
- style={{
|
|
|
|
|
- color: getTagColor(tag),
|
|
|
|
|
|
|
+ <BootstrapVersionSwitcher
|
|
|
|
|
+ bs3={
|
|
|
|
|
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={classnames('tag-label', classNames)}
|
|
|
|
|
+ onClick={handleLabelClick}
|
|
|
|
|
+ ref={tagLabelRef}
|
|
|
|
|
+ >
|
|
|
|
|
+ <button
|
|
|
|
|
+ className="label label-default tag-label-name"
|
|
|
|
|
+ aria-label={t('select_tag', { tagName: tag.name })}
|
|
|
|
|
+ ref={tagBtnRef}
|
|
|
|
|
+ onClick={() => selectTag(tag._id)}
|
|
|
|
|
+ >
|
|
|
|
|
+ <span
|
|
|
|
|
+ style={{
|
|
|
|
|
+ color: getTagColor(tag),
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Icon type="circle" aria-hidden="true" />
|
|
|
|
|
+ </span>{' '}
|
|
|
|
|
+ {tag.name}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ {/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
|
|
|
|
|
+ <button
|
|
|
|
|
+ className="label label-default tag-label-remove"
|
|
|
|
|
+ aria-label={t('remove_tag', { tagName: tag.name })}
|
|
|
|
|
+ onClick={() => handleRemoveTag(tag._id, projectId)}
|
|
|
|
|
+ onMouseOver={handleCloseMouseOver}
|
|
|
|
|
+ onMouseOut={handleCloseMouseOut}
|
|
|
|
|
+ >
|
|
|
|
|
+ <span aria-hidden="true">×</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+ bs5={
|
|
|
|
|
+ <Tag
|
|
|
|
|
+ prepend={
|
|
|
|
|
+ <i
|
|
|
|
|
+ className="badge-tag-circle"
|
|
|
|
|
+ style={{ backgroundColor: getTagColor(tag) }}
|
|
|
|
|
+ />
|
|
|
|
|
+ }
|
|
|
|
|
+ contentProps={{
|
|
|
|
|
+ 'aria-label': t('select_tag', { tagName: tag.name }),
|
|
|
|
|
+ onClick: () => selectTag(tag._id),
|
|
|
|
|
+ }}
|
|
|
|
|
+ closeBtnProps={{
|
|
|
|
|
+ onClick: () => handleRemoveTag(tag._id, projectId),
|
|
|
}}
|
|
}}
|
|
|
|
|
+ className="ms-2"
|
|
|
>
|
|
>
|
|
|
- <Icon type="circle" aria-hidden="true" />
|
|
|
|
|
- </span>{' '}
|
|
|
|
|
- {tag.name}
|
|
|
|
|
- </button>
|
|
|
|
|
- {/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
|
|
|
|
|
- <button
|
|
|
|
|
- className="label label-default tag-label-remove"
|
|
|
|
|
- aria-label={t('remove_tag', { tagName: tag.name })}
|
|
|
|
|
- onClick={() => handleRemoveTag(tag._id, projectId)}
|
|
|
|
|
- onMouseOver={handleCloseMouseOver}
|
|
|
|
|
- onMouseOut={handleCloseMouseOut}
|
|
|
|
|
- >
|
|
|
|
|
- <span aria-hidden="true">×</span>
|
|
|
|
|
- </button>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ {tag.name}
|
|
|
|
|
+ </Tag>
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|