-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-9109: Enabling TypeScript (ts-loader) with Webpack Encore
- Loading branch information
Showing
11 changed files
with
121 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(function (document) { | ||
const searchForm = document.querySelector('.ibexa-search-form') as HTMLFormElement | null; | ||
const searchInput = document.querySelector('.ibexa-search-form__search-input') as HTMLInputElement | null; | ||
const headerSearchInput = document.querySelector('.ibexa-global-search__input') as HTMLInputElement | null; | ||
const languageSelector = document.querySelector( | ||
'.ibexa-filters__item--language-selector .ibexa-filters__select', | ||
) as HTMLSelectElement | null; | ||
const headerSearchSubmitBtn = document.querySelector( | ||
'.ibexa-main-header .ibexa-input-text-wrapper__action-btn--search', | ||
) as HTMLButtonElement | null; | ||
|
||
if (!headerSearchInput || !searchInput || !searchForm) { | ||
return; | ||
} | ||
|
||
const submitForm = () => { | ||
searchInput.value = headerSearchInput.value; | ||
searchForm.submit(); | ||
}; | ||
const handleHeaderSearchBtnClick = (event: MouseEvent) => { | ||
event.preventDefault(); | ||
|
||
submitForm(); | ||
}; | ||
|
||
headerSearchInput.value = searchInput.value; | ||
|
||
headerSearchSubmitBtn?.addEventListener('click', handleHeaderSearchBtnClick, false); | ||
languageSelector?.addEventListener('change', submitForm, false); | ||
})(document); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 <InculdedIcon cssClass={cssClass} name={name} defaultIconName={defaultIconName} />; | ||
} | ||
|
||
return <UrlIcon cssClass={cssClass} name={name} customPath={customPath} />; | ||
}; | ||
|
||
export default Icon; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 ( | ||
<svg className={cssClass}> | ||
<use xlinkHref={linkHref} /> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default UrlIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "ts-config-ibexa/tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@ibexa-admin-ui/*": ["./*"], | ||
"@ibexa-admin-ui-helpers/*": ["src/bundle/Resources/public/js/scripts/helpers/*"] | ||
} | ||
}, | ||
} |