Last active
January 17, 2020 17:19
-
-
Save pburtchaell/92439b69aa40329e7d89493aa73a5de0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @public | |
* Returns all design components | |
* */ | |
export default function useCanvas() { | |
let components = null | |
let canvas = null | |
try { | |
// @ts-ignore | |
canvas = require("./canvas.tsx") | |
components = canvas | |
.filter(key => key.endsWith("__")) | |
.map(key => ({ | |
key, | |
displayName: key.replace(/_/g, " "), | |
})) | |
} catch (error) { | |
throw new Error("canvas.tsx can not be found") | |
} | |
return { | |
components, | |
canvas, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment