Skip to content

ProjectView

Full page view for displaying detailed project information. Uses compound component pattern with section-based content.

Import

tsx
import { ProjectView } from '@manningworks/projex'

Usage

tsx
<ProjectView project={project} onBack={() => router.push('/')}>
  <ProjectView.Section name="background" project={project} />
  <ProjectView.Section name="why" project={project} />
  <ProjectView.Section name="stack" project={project} />
  <ProjectView.Section name="struggles" project={project} />
  <ProjectView.Section name="timeline" project={project} />
  <ProjectView.Section name="posts" project={project} />
  <ProjectView.Stats project={project} />
  <ProjectView.Links project={project} />
  <ProjectView.Commits project={project} />
</ProjectView>

Props

ProjectView (Root)

PropTypeRequiredDescription
projectProjexProjectYesProject data to display
onBack() => voidNoCallback for back button click
childrenReact.ReactNodeYesChild components to render

ProjectView.Section

PropTypeRequiredDescription
projectProjexProjectYesProject data to display
namestringYesSection name: background, why, stack, struggles, timeline, posts

Returns null if the specified section data is empty.

ProjectView.Stats

PropTypeRequiredDescription
projectProjexProjectYesProject data to display

Returns null if project.stats is empty.

PropTypeRequiredDescription
projectProjexProjectYesProject data to display

Returns null if no links are available.

ProjectView.Commits

PropTypeRequiredDescription
projectProjexProjectYesProject data to display

Returns null if project.commits is empty or undefined. Available for GitHub and hybrid project types only.

Requires the commits field to be set in project configuration or global options:

ts
// Per-project commits
{
  id: 'my-project',
  type: 'github',
  repo: 'user/repo',
  commits: 10
}

// Global commits in defineProjects
defineProjects([...projects], { commits: 5 })

Data Attributes

AttributeValueDescription
data-projex-view-Root view container
data-projex-view-section-Section container
data-projex-view-section-namebackground | why | ...Section name
data-projex-view-stats-Stats container
data-projex-view-links-Links container
data-projex-tag-Individual tag (for stack)
data-projex-struggle-Struggle item
data-projex-struggle-typechallenge | learningStruggle type
data-projex-timeline-date-Timeline date
data-projex-timeline-note-Timeline note
data-projex-post-title-Post title
data-projex-post-date-Post date
data-projex-post-link-Post link
data-projex-link-Link element
data-projex-link-typegithub | live | docs | demo | npm | app-store | play-store | product-hunt | customLink type
data-projex-link-labelstringCustom link label
data-projex-statstars | forks | downloads | version | upvotes | commentsStat type
data-projex-commits-Commits container
data-projex-commits-header-Commits section header
data-projex-commit-list-Commit list container
data-projex-commit-Individual commit item
data-projex-commit-message-Commit message
data-projex-commit-date-Commit date
data-projex-commit-link-Commit link
data-projex-commit-author-Commit author

Example

tsx
import { ProjectView } from '@manningworks/projex'
import { useRouter } from 'next/navigation'

function ProjectPage({ project }) {
  const router = useRouter()
  
  return (
    <ProjectView project={project} onBack={() => router.push('/')}>
      <ProjectView.Section name="background" project={project} />
      <ProjectView.Section name="why" project={project} />
      <ProjectView.Section name="stack" project={project} />
      <ProjectView.Section name="struggles" project={project} />
      <ProjectView.Section name="timeline" project={project} />
      <ProjectView.Stats project={project} />
      <ProjectView.Links project={project} />
      <ProjectView.Commits project={project} />
    </ProjectView>
  )
}

Section Content Handling

The Section component handles different data types:

  • String (background, why): Renders as text
  • String array (stack): Renders as tags
  • Struggle array: Renders with type styling
  • Timeline array: Renders date/note pairs
  • Posts array: Renders title, date, and optional link