Skip to content

Instantly share code, notes, and snippets.

@dueka
Created February 22, 2023 16:50
Show Gist options
  • Save dueka/7c5c7a0c225c748e63a7279097ad17fa to your computer and use it in GitHub Desktop.
Save dueka/7c5c7a0c225c748e63a7279097ad17fa to your computer and use it in GitHub Desktop.
Create random data
interface IData {
name?: string;
department?: string;
teamlead?: string;
role?: string;
location?: string;
lga?: string;
country?: string;
due_date?: string;
children?: JSX.Element | JSX.Element[];
// view?: () => null;
}
export const DATA: IData[] = [];
export function createRandomData(): IData {
return {
name: faker.name.fullName(),
department: faker.commerce.department(),
teamlead: faker.name.fullName(),
role: faker.random.word(),
location: faker.address.secondaryAddress(),
lga: faker.address.streetAddress(),
country: faker.address.country(),
due_date: faker.commerce.price(),
};
}
Array.from({ length: 50 }).forEach(() => {
DATA.push(createRandomData());
});
// header for data table
const header = [
{ title: "NAME", prop: "NAME" },
{ title: "DEPARTMENT", prop: "DEPARTMENT" },
{ title: "TEAM LEAD", prop: "team_lead" },
{ title: "ROLE", prop: "role" },
{ title: "LOCATION", prop: "location" },
{ title: "LGA", prop: "lga" },
{ title: "COUNTRY", prop: "country" },
{ title: "DUE DATE", prop: "due_date" },
{ title: "VIEW", prop: "view" },
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment