feat(layer): add PageHero, PageSection, PageCard components and enhance ButtonA#5
feat(layer): add PageHero, PageSection, PageCard components and enhance ButtonA#5
Conversation
…ce ButtonA - Add new PageHero MDC component for landing page hero section with headline, title, description, and links - Add new PageSection MDC component for structured content sections with customizable layout - Add new PageCard MDC component for displaying card-based content - Enhance ButtonA component to support size and variant props (lg, outline, etc.) - Update index.md to use new MDC components with improved semantic structure - Update index.vue with proper 404 error handling and comprehensive SEO meta tags - Improve page layout by removing unnecessary prose styling from landing page Closes #docs-index
Summary of ChangesHello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the documentation layer by introducing a suite of new Markdown-compatible (MDC) components, Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces several new and useful MDC components (PageHero, PageSection, PageCard) for building documentation pages and enhances the existing ButtonA component. The changes are well-structured and improve the content layer significantly. My review focuses on ensuring the correct usage of MDC syntax, preventing a functional regression in the ButtonA component, and improving the design and clarity of the new code. I've identified a few high-priority issues related to MDC syntax and component props that should be addressed.
apps/docs/content/index.md
Outdated
| ::PageHero | ||
| #headline | ||
| docs-please | ||
|
|
||
| # Write beautiful docs with Markdown. | ||
| #title | ||
| Write beautiful docs with Markdown. | ||
|
|
||
| Ship fast, flexible, and SEO-optimized documentation with beautiful design out of the box. | ||
| #description | ||
| Ship fast, flexible, and SEO-optimized documentation with beautiful design out of the box. Built with **shadcn-vue** and **Nuxt Content**. | ||
|
|
||
| Built with **shadcn-vue** and **Nuxt Content**. | ||
| #links | ||
| :::ButtonA{to="/docs/getting-started/introduction" size="lg"} | ||
| Get Started | ||
| ::: | ||
|
|
||
| ::div{.flex.flex-wrap.justify-center.gap-4.mt-8} | ||
| ::ButtonA{to="/docs"} | ||
| Get Started | ||
| :: | ||
|
|
||
| ::ButtonA{to="https://github.com/pleaseai/docs" target="\_blank" external} | ||
| GitHub | ||
| :: | ||
| :::ButtonA{to="https://github.com/pleaseai/docs" target="_blank" variant="outline" size="lg"} | ||
| GitHub | ||
| ::: | ||
| :: | ||
|
|
||
| ::PageSection{headline="Features"} | ||
| #title | ||
| Everything you need for documentation | ||
|
|
||
| #description | ||
| A complete documentation solution with modern tooling and beautiful design. | ||
|
|
||
| :::div{.grid.grid-cols-1.md:grid-cols-2.lg:grid-cols-3.gap-6.mt-8} | ||
| ::::PageCard{title="shadcn-vue Components" icon="lucide:component"} | ||
| #description | ||
| Beautiful, accessible UI components built with Reka UI primitives and styled with Tailwind CSS. | ||
| :::: |
There was a problem hiding this comment.
There are several issues with the MDC (Markdown Components) syntax regarding the number of colons used, which will likely cause rendering errors.
-
Components with slots: Components that use named slots (like
#headline,#title, etc.) must be wrapped with three colons (:::), not two (::). This applies toPageHero(line 8) and allPageSectioncomponents (lines 28, 68, 97). Their closing tags must also be:::. -
Nested components: When nesting components, each level of nesting should add a colon. The current implementation is inconsistent. Based on Nuxt Content's documentation, if
PageSectionis:::(3 colons), a component inside its default slot like thedivon line 35 should be::::(4 colons), andPageCards inside thatdiv(e.g., line 36) should be:::::(5 colons). Similarly,ButtonAinsidePageHero's#linksslot should be::::.
This needs to be corrected throughout the file for the components to render correctly.
| <NuxtLink | ||
| :to="to" | ||
| :href="href" | ||
| :target="target" | ||
| :rel="rel" | ||
| :external="external" | ||
| > | ||
| <slot /> | ||
| </NuxtLink> |
There was a problem hiding this comment.
By explicitly binding only a few props to NuxtLink, you are losing support for all other NuxtLinkProps that were previously supported with v-bind="props". This is a regression, as props like activeClass or replace will no longer work.
To fix this while still separating the Button props, you can create a computed property that contains only the NuxtLinkProps and then use v-bind on the NuxtLink component.
First, add this to your <script> section:
import { computed } from 'vue'
// ... after props definition
const nuxtLinkProps = computed(() => {
const { variant, size, ...rest } = props
return rest
})Then, you can use it in the template with this suggestion.
<NuxtLink v-bind="nuxtLinkProps">
<slot />
</NuxtLink>
| const props = defineProps<{ | ||
| title?: string | ||
| description?: string | ||
| icon?: string | ||
| to?: NuxtLinkProps['to'] | ||
| target?: string | ||
| orientation?: 'vertical' | 'horizontal' | ||
| class?: HTMLAttributes['class'] | ||
| }>() |
There was a problem hiding this comment.
The component is designed to act as a link when the to prop is provided. However, it only accepts to and target props for linking, limiting its capabilities. It would be more flexible if it accepted all NuxtLinkProps, similar to how the ButtonA component is being refactored. This would allow using props like external, rel, activeClass, etc.
You could change the props definition to extend NuxtLinkProps and then separate the props to be passed to NuxtLink.
Example of updated script:
import type { HTMLAttributes } from 'vue'
import type { NuxtLinkProps } from '#app'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '~/components/ui/card'
interface Props extends NuxtLinkProps {
title?: string
description?: string
icon?: string
orientation?: 'vertical' | 'horizontal'
class?: HTMLAttributes['class']
}
const props = defineProps<Props>()
const isLink = computed(() => !!props.to)
const linkProps = computed(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { title, description, icon, orientation, class: klass, ...rest } = props
return rest
})And in the template, you would bind these props to the NuxtLink component:
<component
:is="isLink ? 'NuxtLink' : 'div'"
v-bind="isLink ? linkProps : {}"
...
>This would make the component much more versatile.
| </div> | ||
| </div> | ||
| <ContentRenderer | ||
| v-if="page" |
- Rename ButtonA to UButton - Rename PageHero to UPageHero - Rename PageSection to UPageSection - Rename PageCard to UPageCard - Update index.md to use kebab-case component names (u-button, u-page-hero, etc.)
There was a problem hiding this comment.
Pull request overview
This PR introduces three new MDC components (PageHero, PageSection, PageCard) for building documentation landing pages and enhances the ButtonA component with flexible styling options. The changes modernize the documentation layer with reusable, well-structured components while improving SEO and error handling.
Key changes:
- New MDC components for hero sections, page sections, and cards with flexible layout options
- Enhanced ButtonA with configurable size and variant props
- Improved index.vue with proper 404 handling and comprehensive SEO meta tags
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/layer/app/pages/index.vue | Added 404 error handling and SEO meta tags with fallback values |
| packages/layer/app/components/content/PageSection.vue | New flexible section component with horizontal/vertical orientation and slot-based content |
| packages/layer/app/components/content/PageHero.vue | New hero component for landing pages with customizable layout and content slots |
| packages/layer/app/components/content/PageCard.vue | New card component with optional link functionality and flexible content structure |
| packages/layer/app/components/content/ButtonA.vue | Enhanced with size and variant props; removed hardcoded margin class |
| apps/docs/content/index.md | Refactored to use new PageHero, PageSection, and PageCard components with improved semantic structure |
Comments suppressed due to low confidence (2)
packages/layer/app/components/content/ButtonA.vue:22
- The removal of the
mt-6class could be a breaking change for existing usage. Components that previously relied on this margin will now need to add it manually. Consider documenting this breaking change in the PR description or migration guide.
packages/layer/app/components/content/ButtonA.vue:30 - [nitpick] Explicitly spreading individual props instead of using
v-bind="props"reduces flexibility. This approach requires updating the component whenever newNuxtLinkPropsare needed. Consider keepingv-bind="props"or usingv-bind="$attrs"with properinheritAttrs: falseconfiguration to maintain better extensibility.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/docs/content/index.md
Outdated
| Start writing your documentation in Markdown. | ||
| ``` | ||
| :: | ||
|
|
There was a problem hiding this comment.
The horizontal rule syntax ---- (4 dashes) is non-standard. Standard Markdown uses either --- (3 dashes), *** (3 asterisks), or ___ (3 underscores) for horizontal rules. Using 4 dashes may not render correctly in all Markdown parsers.
apps/docs/content/index.md
Outdated
| :::: | ||
| ::: | ||
| :: | ||
|
|
There was a problem hiding this comment.
The horizontal rule syntax ---- (4 dashes) is non-standard. Standard Markdown uses either --- (3 dashes), *** (3 asterisks), or ___ (3 underscores) for horizontal rules. Using 4 dashes may not render correctly in all Markdown parsers.
| ::ButtonA{to="https://github.com/pleaseai/docs" target="\_blank" external} | ||
| GitHub | ||
| :: | ||
| :::u-button{to="https://github.com/pleaseai/docs" target="_blank" variant="outline" size="lg"} |
There was a problem hiding this comment.
Using target="_blank" without rel="noopener noreferrer" on external links enables reverse tabnabbing, allowing the opened page to access window.opener and potentially navigate the original tab to a malicious site. An attacker controlling https://github.com/pleaseai/docs (or any external URL opened in a new tab) could exploit this to phish users or hijack the session context. Fix by adding rel="noopener noreferrer" to the link via the ButtonA component or directly in MDC, e.g., :::ButtonA{to="https://..." target="_blank" rel="noopener noreferrer"} or by enforcing rel on all external target="_blank" links inside ButtonA.
| :::u-button{to="https://github.com/pleaseai/docs" target="_blank" variant="outline" size="lg"} | |
| :::u-button{to="https://github.com/pleaseai/docs" target="_blank" rel="noopener noreferrer" variant="outline" size="lg"} |
- Update index.md with improved hero section and feature cards grid - Add UPageGrid component for responsive grid layouts - Add FloatingNuxt component with hover animation effect - Add spotlight prop to UPageCard for group hover effects - Reorder UPageCard slots to show content above media (Docus pattern) - Install and configure @nuxt/icon module for icon support - Add shadcn-vue dependency for CLI tooling
- Add info, warning, success, error variants to Alert component - Enhance Callout with type support (note, tip, warning, caution) - Create shortcut components (Note, Tip, Warning, Caution) - Add default padding to TabsContent component - Update landing page to showcase new callout types
Summary
This PR adds three new MDC (Markdown Components) for the documentation layer and enhances the existing ButtonA component with more flexible styling options.
Changes
sizeandvariantprops for better customization (supports 'lg' size and 'outline' variant)Implementation Details
The new components are inspired by Nuxt UI and Docus design patterns, providing reusable building blocks for documentation sites. The ButtonA enhancements maintain backward compatibility while allowing more design flexibility.
Test plan
bun dev)Related Issue
This work implements the component architecture for the docs-please landing page.