feat: landing page + smart components

This commit is contained in:
Liyas Thomas
2021-07-02 05:01:29 +00:00
committed by GitHub
parent fb93db6ad4
commit a130cfcadb
23 changed files with 1124 additions and 55 deletions

18
assets/js/getLinkTag.js Normal file
View File

@@ -0,0 +1,18 @@
const DEFAULT_TAG = "button"
const ANCHOR_TAG = "a"
const FRAMEWORK_LINK = "NuxtLink" // or "router-link", "g-link"...
const getLinkTag = ({ to, blank }) => {
if (!to) {
return DEFAULT_TAG
} else if (blank) {
return ANCHOR_TAG
} else if (/^\/(?!\/).*$/.test(to)) {
// regex101.com/r/LU1iFL/1
return FRAMEWORK_LINK
} else {
return ANCHOR_TAG
}
}
export { getLinkTag as default, ANCHOR_TAG, FRAMEWORK_LINK }