1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

made transitional Anchor component for next/cra

This commit is contained in:
Fedor Katurov 2022-01-13 14:12:39 +07:00
parent 8bac6bb2f7
commit 7658068caa
12 changed files with 57 additions and 28 deletions

View file

@ -1,5 +1,7 @@
export const CONFIG = {
API_HOST: process.env.REACT_APP_API_HOST || process.env.NEXT_PUBLIC_API_HOST || '',
REMOTE_CURRENT:
apiHost: process.env.REACT_APP_API_HOST || process.env.NEXT_PUBLIC_API_HOST || '',
remoteCurrent:
process.env.REACT_APP_REMOTE_CURRENT || process.env.NEXT_PUBLIC_REMOTE_CURRENT || '',
// transitional prop, marks migration to nextjs
isNextEnvironment: false,
};

View file

@ -68,10 +68,10 @@ export const getURLFromString = (
size?: typeof PRESETS[keyof typeof PRESETS]
): string => {
if (size) {
return (url || '').replace('REMOTE_CURRENT://', `${CONFIG.REMOTE_CURRENT}cache/${size}/`);
return (url || '').replace('REMOTE_CURRENT://', `${CONFIG.remoteCurrent}cache/${size}/`);
}
return (url || '').replace('REMOTE_CURRENT://', CONFIG.REMOTE_CURRENT);
return (url || '').replace('REMOTE_CURRENT://', CONFIG.remoteCurrent);
};
export const getURL = (

View file

@ -16,3 +16,8 @@ export type ButtonProps = React.DetailedHTMLProps<
React.ButtonHTMLAttributes<HTMLButtonElement>,
HTMLButtonElement
>;
export type LinkProps = React.DetailedHTMLProps<
React.AnchorHTMLAttributes<HTMLAnchorElement>,
HTMLAnchorElement
>;