File size: 794 Bytes
aa1ee73 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import { CustomFieldType } from "@/types/resume";
import { getProjectLinkHref } from "@/lib/projectLink";
const trim = (value?: string) => value?.trim() || "";
export const getCustomFieldDisplayText = (
field: Pick<CustomFieldType, "label" | "value" | "displayLabel">
) => {
const label = trim(field.label);
const value = trim(field.value);
if (field.displayLabel) {
return label || value;
}
return value;
};
export const shouldShowCustomFieldLabelPrefix = (
field: Pick<CustomFieldType, "label" | "displayLabel">
) => {
return !field.displayLabel && Boolean(trim(field.label));
};
export const getCustomFieldHref = (
field: Pick<CustomFieldType, "value" | "displayLabel">
) => {
if (!field.displayLabel) return null;
return getProjectLinkHref(field.value);
};
|