Skip to content

Commit

Permalink
common icon logic
Browse files Browse the repository at this point in the history
  • Loading branch information
VargaJoe committed Sep 14, 2023
1 parent 66626a7 commit 7a027e1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/sensenet/src/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
} from '@material-ui/icons'
import { Repository } from '@sensenet/client-core'
import { Injector, LogLevel, PathHelper } from '@sensenet/client-utils'
import { File, GenericContent, User } from '@sensenet/default-content-types'
import { File, GenericContent, Image, User } from '@sensenet/default-content-types'
import { useInjector, useRepository } from '@sensenet/hooks-react'
import { InlineIcon } from '@iconify/react'
import circleciIcon from '@iconify-icons/logos/circleci'
Expand Down Expand Up @@ -223,6 +223,18 @@ export const defaultContentResolvers: Array<IconResolver<GenericContent>> = [
/>
) : null,
},
{
get: (item, options) =>
options.repo.schemas.isContentFromType<Image>(item, 'Image') && (!item.PageCount || item.PageCount <= 0) ? (
<img
width={options.style?.width || 32}
height={options.style?.width || 32}
alt=""
src={PathHelper.joinPaths(options.repo.configuration.repositoryUrl, item.Path)}
style={options.style}
/>
) : null,
},
{
get: (item, options) => getIconByName(item.Icon, options),
},
Expand Down

0 comments on commit 7a027e1

Please sign in to comment.