From 704742358e3acb71a1f9a58b291041bc66fcf2d8 Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Mon, 21 Oct 2024 14:58:16 +0200 Subject: [PATCH] dependecies --- dependencies.json | 4 ++ package.json | 1 - .../ui-dev/src/modules/common/icon/icon.js | 45 ++++++++++++++++++ .../ui-dev/src/modules/common/icon/icon.tsx | 46 ------------------- .../ui-dev/src/modules/common/icon/urlIcon.js | 28 +++++++++++ .../src/modules/common/icon/urlIcon.tsx | 20 -------- .../modules/common/thumbnail/thumbnail.tsx | 1 - 7 files changed, 77 insertions(+), 68 deletions(-) create mode 100644 dependencies.json create mode 100644 src/bundle/ui-dev/src/modules/common/icon/icon.js delete mode 100644 src/bundle/ui-dev/src/modules/common/icon/icon.tsx create mode 100644 src/bundle/ui-dev/src/modules/common/icon/urlIcon.js delete mode 100644 src/bundle/ui-dev/src/modules/common/icon/urlIcon.tsx diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 0000000000..0215f662e3 --- /dev/null +++ b/dependencies.json @@ -0,0 +1,4 @@ +{ + "recipesEndpoint": "https://api.github.com/repos/ibexa/recipes-dev/contents/index.json?ref=flex/pull-145", + "packages": [] +} \ No newline at end of file diff --git a/package.json b/package.json index 80028e6e0b..f172bf5eb1 100644 --- a/package.json +++ b/package.json @@ -14,4 +14,3 @@ "prettier-test": "yarn prettier \"./src/bundle/Resources/**/*.{js,ts,scss}\" \"./src/bundle/ui-dev/**/*.{js,tsx}\" --check" } } - diff --git a/src/bundle/ui-dev/src/modules/common/icon/icon.js b/src/bundle/ui-dev/src/modules/common/icon/icon.js new file mode 100644 index 0000000000..1ffc236f90 --- /dev/null +++ b/src/bundle/ui-dev/src/modules/common/icon/icon.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import { isExternalInstance } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper'; +import { createCssClassNames } from '../helpers/css.class.names'; + +import UrlIcon from './urlIcon'; +import InculdedIcon from './inculdedIcon'; + +const Icon = (props) => { + const cssClass = createCssClassNames({ + 'ibexa-icon': true, + [props.extraClasses]: true, + }); + + const isIconIncluded = props.useIncludedIcon || isExternalInstance(); + + return ( + <> + {isIconIncluded ? ( + + ) : ( + + )} + + ); +}; + +Icon.propTypes = { + extraClasses: PropTypes.string, + name: PropTypes.string, + customPath: PropTypes.string, + useIncludedIcon: PropTypes.bool, + defaultIconName: PropTypes.string, +}; + +Icon.defaultProps = { + customPath: null, + name: null, + extraClasses: null, + useIncludedIcon: false, + defaultIconName: 'about-info', +}; + +export default Icon; diff --git a/src/bundle/ui-dev/src/modules/common/icon/icon.tsx b/src/bundle/ui-dev/src/modules/common/icon/icon.tsx deleted file mode 100644 index 6ba27919b2..0000000000 --- a/src/bundle/ui-dev/src/modules/common/icon/icon.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; - -import { isExternalInstance } from '@ibexa-admin-ui-helpers/context.helper'; -import { createCssClassNames } from '../helpers/css.class.names'; - -import UrlIcon from './urlIcon'; -import InculdedIcon from './inculdedIcon'; - -interface BaseIconProps { - extraClasses?: string; - useIncludedIcon?: boolean; - defaultIconName?: string | null; -} -interface NameIconProps extends BaseIconProps { - name: string; - customPath?: string | null; -} -interface CustomPathIconProps extends BaseIconProps { - name?: string | null; - customPath: string; -} - -type IconProps = NameIconProps | CustomPathIconProps; - -const Icon = ({ - name = null, - customPath = null, - extraClasses = '', - useIncludedIcon = false, - defaultIconName = 'about-info', -}: IconProps) => { - const cssClass = createCssClassNames({ - 'ibexa-icon': true, - [extraClasses]: true, - }); - - const isIconIncluded = useIncludedIcon || isExternalInstance(); - - if (isIconIncluded) { - return ; - } - - return ; -}; - -export default Icon; diff --git a/src/bundle/ui-dev/src/modules/common/icon/urlIcon.js b/src/bundle/ui-dev/src/modules/common/icon/urlIcon.js new file mode 100644 index 0000000000..edf997e00d --- /dev/null +++ b/src/bundle/ui-dev/src/modules/common/icon/urlIcon.js @@ -0,0 +1,28 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import { getIconPath } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/icon.helper'; + +const UrlIcon = (props) => { + const linkHref = props.customPath ?? getIconPath(props.name); + + return ( + + + + ); +}; + +UrlIcon.propTypes = { + cssClass: PropTypes.string, + name: PropTypes.string, + customPath: PropTypes.string, +}; + +UrlIcon.defaultProps = { + customPath: null, + name: null, + cssClass: '', +}; + +export default UrlIcon; diff --git a/src/bundle/ui-dev/src/modules/common/icon/urlIcon.tsx b/src/bundle/ui-dev/src/modules/common/icon/urlIcon.tsx deleted file mode 100644 index e706aa94c4..0000000000 --- a/src/bundle/ui-dev/src/modules/common/icon/urlIcon.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { getIconPath } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/icon.helper'; - -interface UrlIconProps { - cssClass?: string; - name?: string | null; - customPath?: string | null; -} - -const UrlIcon = ({ cssClass = '', name = null, customPath = null }: UrlIconProps) => { - const linkHref = customPath ?? getIconPath(name); - - return ( - - - - ); -}; - -export default UrlIcon; diff --git a/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx b/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx index 6e3fcf577c..77f468eff1 100644 --- a/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx +++ b/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import Icon from '../icon/icon'; interface ThumbnailProps {