mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #34938 from overleaf/mj-icon-type-from-name
[web] Tidy iconTypeFromName GitOrigin-RevId: e597e2ac6cdc8a6c82a3849dbcfcffb659310c45
This commit is contained in:
committed by
Copybot
parent
25d625d4ee
commit
cfb92c3b8f
@@ -1,5 +1,5 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { newEditorIconTypeFromName } from '../util/icon-type-from-name'
|
||||
import iconTypeFromName from '../util/icon-type-from-name'
|
||||
import classnames from 'classnames'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
|
||||
@@ -20,7 +20,7 @@ function FileTreeIcon({
|
||||
<>
|
||||
<MaterialIcon
|
||||
unfilled
|
||||
type={newEditorIconTypeFromName(name)}
|
||||
type={iconTypeFromName(name)}
|
||||
className={className}
|
||||
/>
|
||||
{isLinkedFile && (
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { AvailableUnfilledIcon } from '@/shared/components/material-icon'
|
||||
|
||||
// TODO ide-redesign-cleanup: Make this the default export and remove the legacy version
|
||||
export const newEditorIconTypeFromName = (
|
||||
name: string
|
||||
): AvailableUnfilledIcon => {
|
||||
const iconTypeFromName = (name: string): AvailableUnfilledIcon => {
|
||||
let ext = name.split('.').pop()
|
||||
ext = ext ? ext.toLowerCase() : ext
|
||||
|
||||
@@ -18,3 +15,5 @@ export const newEditorIconTypeFromName = (
|
||||
}
|
||||
return 'description'
|
||||
}
|
||||
|
||||
export default iconTypeFromName
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { memo } from 'react'
|
||||
import classNames from 'classnames'
|
||||
import HistoryFileTreeItem from './history-file-tree-item'
|
||||
import { newEditorIconTypeFromName } from '../../../file-tree/util/icon-type-from-name'
|
||||
import iconTypeFromName from '../../../file-tree/util/icon-type-from-name'
|
||||
import type { FileDiff } from '../../services/types/file'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
|
||||
@@ -37,7 +37,7 @@ function HistoryFileTreeDoc({
|
||||
icons={
|
||||
<MaterialIcon
|
||||
unfilled
|
||||
type={newEditorIconTypeFromName(name)}
|
||||
type={iconTypeFromName(name)}
|
||||
className="file-tree-icon"
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user