@yangsaiyam/helper
v1.12.7
Published
Shared key-value mappings for Korre projects.
Readme
korre-mapping
Shared key-value mappings for Korre projects.
Install
SSH:
pnpm add git+ssh://[email protected]:your-org/korre-mapping.gitHTTPS:
pnpm add github:your-org/korre-mappingUse
import { CAREER_LOCATION, getLabelByKey } from "@korre/mapping";
const label = getLabelByKey(CAREER_LOCATION, 1);
// KualaLumpurimport { CAREER_JOB_TYPE, getOptionByKey } from "@korre/mapping";
type CareerCardProps = {
career: {
title: string;
jobType: number;
};
};
export default function CareerCard({ career }: CareerCardProps) {
const jobType = getOptionByKey(CAREER_JOB_TYPE, career.jobType);
return (
<div>
<h2>{career.title}</h2>
<p>{jobType?.value ?? "Unknown"}</p>
</div>
);
}Structure
src/
├─ career/
│ └─ index.ts
├─ contact-form/
│ └─ index.ts
├─ files/
│ └─ index.ts
├─ shared/
│ ├─ helpers.ts
│ └─ types.ts
└─ index.tsExports
CAREER_JOB_TYPECAREER_CATEGORYCAREER_MODECAREER_LOCATIONROUTESROUTEbuildLocalizedRoutebuildRoutePathNamerouteLabelKeyroutePathKeyCONTACT_FORM_ENQUIRY_TYPEFILE_STATUSFILE_ORIGINgetOptionByKeygetLabelByKeygetI18nKeyByKeytoRecord
Update mappings
Update src/index.ts, then commit and push:
git add .
git commit -m "update mappings"
git pushIn consuming repos:
pnpm update @korre/mapping