file-tree-icon.tsx 848 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { useTranslation } from 'react-i18next'
  2. import { newEditorIconTypeFromName } from '../util/icon-type-from-name'
  3. import classnames from 'classnames'
  4. import MaterialIcon from '@/shared/components/material-icon'
  5. function FileTreeIcon({
  6. isLinkedFile,
  7. name,
  8. }: {
  9. name: string
  10. isLinkedFile?: boolean
  11. }) {
  12. const { t } = useTranslation()
  13. const className = classnames('file-tree-icon', {
  14. 'linked-file-icon': isLinkedFile,
  15. })
  16. return (
  17. <>
  18. <MaterialIcon
  19. unfilled
  20. type={newEditorIconTypeFromName(name)}
  21. className={className}
  22. />
  23. {isLinkedFile && (
  24. <MaterialIcon
  25. type="open_in_new"
  26. modifier="rotate-180"
  27. className="linked-file-highlight"
  28. accessibilityLabel={t('linked_file')}
  29. />
  30. )}
  31. </>
  32. )
  33. }
  34. export default FileTreeIcon