Skip to content

4.4: Create Story List Component #85

@justin808

Description

@justin808

Overview

Create the main story list display (Server Component).

Parent Epic: #70
Priority: P0

Prerequisites

Next Issues (after this is complete)

  • 4.5: Create Individual Story Component
  • 4.6: Create Pagination Component

Acceptance Criteria

  • app/javascript/components/Stories.tsx created (Server Component)
  • Receives stories array as props from Rails controller
  • Renders ordered list of Story components
  • Shows story rank numbers (1-30, etc.)
  • Includes pagination component
  • CSS module styling (Stories.module.css)

Implementation Notes

interface StoriesProps {
  stories: Story[];
  page: number;
  type: 'top' | 'new' | 'show' | 'ask' | 'jobs';
}

export default function Stories({ stories, page, type }: StoriesProps) {
  const startRank = (page - 1) * 30 + 1;
  return (
    <ol className={styles.list} start={startRank}>
      {stories.map((story, index) => (
        <Story key={story.id} story={story} rank={startRank + index} />
      ))}
    </ol>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    HN-RSCHacker News RSC DemoRSCReact Server Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions