Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): rebuild home page related components
- Loading branch information
1 parent
33b0e69
commit 3f76b8d
Showing
12 changed files
with
408 additions
and
393 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { isLinkExternal } from "@vuepress/shared"; | ||
import { defineComponent, h } from "vue"; | ||
import { RouterLink } from "vue-router"; | ||
|
||
import Icon from "@theme-hope/components/Icon"; | ||
|
||
import type { PropType, VNode } from "vue"; | ||
import type { ThemeProjectHomeFeatureItemOptions } from "../../shared/index.js"; | ||
|
||
import "../styles/feature-panel.scss"; | ||
|
||
export default defineComponent({ | ||
name: "FeaturePanel", | ||
|
||
props: { | ||
/** | ||
* Feature config | ||
*/ | ||
items: { | ||
type: Object as PropType<ThemeProjectHomeFeatureItemOptions[]>, | ||
default: (): ThemeProjectHomeFeatureItemOptions[] => | ||
[] as ThemeProjectHomeFeatureItemOptions[], | ||
}, | ||
|
||
/** | ||
* Feature header | ||
*/ | ||
header: { | ||
type: String, | ||
default: "", | ||
}, | ||
}, | ||
|
||
setup(props) { | ||
return (): VNode => | ||
h("div", { class: "feature-panel" }, [ | ||
props.header | ||
? h("h2", { class: "feature-header" }, props.header) | ||
: null, | ||
props.items.length | ||
? h( | ||
"div", | ||
{ class: "features" }, | ||
props.items.map((feature) => { | ||
const children = [ | ||
h("h3", [ | ||
h(Icon, { icon: feature.icon }), | ||
h("span", { innerHTML: feature.title }), | ||
]), | ||
h("p", { innerHTML: feature.details }), | ||
]; | ||
|
||
return feature.link | ||
? isLinkExternal(feature.link) | ||
? h( | ||
"a", | ||
{ | ||
class: "feature link", | ||
href: feature.link, | ||
role: "navigation", | ||
"aria-label": feature.title, | ||
target: "_blank", | ||
}, | ||
children | ||
) | ||
: h( | ||
RouterLink, | ||
{ | ||
class: "feature link", | ||
to: feature.link, | ||
role: "navigation", | ||
"aria-label": feature.title, | ||
}, | ||
() => children | ||
) | ||
: h("div", { class: "feature" }, children); | ||
}) | ||
) | ||
: null, | ||
]); | ||
}, | ||
}); |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.