0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

Updated AdminX implementation

This commit is contained in:
Ronald Langeveld 2024-03-11 15:10:55 +02:00
parent 3880cdf6d3
commit 6e4cba14dc
3 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import '@tryghost/unsplash-selector/styles/index.css';
import Portal from '../../utils/portal';
import {DefaultHeaderTypes, PhotoType, UnsplashSearchModal} from '@tryghost/unsplash-selector';
import {DefaultHeaderTypes, PhotoType, UnsplashProvider, UnsplashSearchModal} from '@tryghost/unsplash-selector';
import {useMemo} from 'react';
interface UnsplashModalProps {
onClose: () => void;
@ -8,13 +9,17 @@ interface UnsplashModalProps {
unsplashConf: {
defaultHeaders: DefaultHeaderTypes;
};
}
export const UnsplashSelector : React.FC<UnsplashModalProps> = ({onClose, onImageInsert, unsplashConf}) => {
const providerUnsplash = useMemo(() => {
return new UnsplashProvider(unsplashConf.defaultHeaders);
}, [unsplashConf]);
return (
<Portal classNames='admin-x-settings'>
<UnsplashSearchModal
unsplashConf={unsplashConf}
unsplashProvider={providerUnsplash}
onClose={onClose}
onImageInsert={onImageInsert}
/>

View file

@ -40,7 +40,6 @@ export class InMemoryUnsplashProvider implements IUnsplashProvider {
(photo.alt_description && photo.alt_description.toLowerCase().includes(term.toLowerCase()))
);
this.SEARCH_IS_RUNNING = false;
return filteredPhotos;
}

View file

@ -1,3 +1,4 @@
export {default as UnsplashSearchModal} from './UnsplashSearchModal';
export type {DefaultHeaderTypes, Photo as PhotoType} from './UnsplashTypes';
export {UnsplashProvider} from './api/UnsplashProvider';
import './styles/index.css';