Fix custom domain trust center design
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -53,3 +53,4 @@ export {
|
||||
export { promisifyMutation } from "./relay";
|
||||
export { fileType, fileSize } from "./file";
|
||||
export { formatDatetime, formatDate } from "./date";
|
||||
export { getLogoUrl, getTrustCenterUrl } from "./trustCenter";
|
||||
|
||||
22
packages/helpers/src/trustCenter.ts
Normal file
22
packages/helpers/src/trustCenter.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export function getLogoUrl(logoPath: string): string {
|
||||
const path = window.location.pathname;
|
||||
const trustMatch = path.match(/^\/trust\/([^/]+)/);
|
||||
|
||||
if (!trustMatch) {
|
||||
return `/logos/${logoPath}`;
|
||||
}
|
||||
|
||||
const slug = trustMatch[1];
|
||||
return `/trust/${slug}/logos/${logoPath}`;
|
||||
}
|
||||
|
||||
export function getTrustCenterUrl(path: string): string {
|
||||
const currentPath = window.location.pathname;
|
||||
const trustMatch = currentPath.match(/^\/trust\/([^/]+)/);
|
||||
|
||||
if (!trustMatch) {
|
||||
return `/${path}`;
|
||||
}
|
||||
|
||||
return `../${path}`;
|
||||
}
|
||||
Reference in New Issue
Block a user