Skip to content

Commit

Permalink
dependecies
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasOsti committed Oct 22, 2024
1 parent e96504c commit 7047423
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 68 deletions.
4 changes: 4 additions & 0 deletions dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recipesEndpoint": "https://api.github.com/repos/ibexa/recipes-dev/contents/index.json?ref=flex/pull-145",
"packages": []
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
"prettier-test": "yarn prettier \"./src/bundle/Resources/**/*.{js,ts,scss}\" \"./src/bundle/ui-dev/**/*.{js,tsx}\" --check"
}
}

45 changes: 45 additions & 0 deletions src/bundle/ui-dev/src/modules/common/icon/icon.js
Original file line number Diff line number Diff line change
@@ -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 ? (
<InculdedIcon cssClass={cssClass} name={props.name} defaultIconName={props.defaultIconName} />
) : (
<UrlIcon cssClass={cssClass} name={props.name} customPath={props.customPath} />
)}
</>
);
};

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;
46 changes: 0 additions & 46 deletions src/bundle/ui-dev/src/modules/common/icon/icon.tsx

This file was deleted.

28 changes: 28 additions & 0 deletions src/bundle/ui-dev/src/modules/common/icon/urlIcon.js
Original file line number Diff line number Diff line change
@@ -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 (
<svg className={props.cssClass}>
<use xlinkHref={linkHref} />
</svg>
);
};

UrlIcon.propTypes = {
cssClass: PropTypes.string,
name: PropTypes.string,
customPath: PropTypes.string,
};

UrlIcon.defaultProps = {
customPath: null,
name: null,
cssClass: '',
};

export default UrlIcon;
20 changes: 0 additions & 20 deletions src/bundle/ui-dev/src/modules/common/icon/urlIcon.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import Icon from '../icon/icon';

interface ThumbnailProps {
Expand Down

0 comments on commit 7047423

Please sign in to comment.