Add reusable UI components and refactor utilities for clarity#71
Open
pedrolucasvsr wants to merge 5 commits intomainfrom
Open
Add reusable UI components and refactor utilities for clarity#71pedrolucasvsr wants to merge 5 commits intomainfrom
pedrolucasvsr wants to merge 5 commits intomainfrom
Conversation
Introduce a set of reusable UI primitives and utilities: Button (with variants), Card (with variants), Container (with variants), SectionTitle (with variants), Navbar, Footer, FileExplorer/FileItem (with variants), ScrollIndicator (animated with framer-motion), and a central ui index export. Add a cn utility that composes clsx + tailwind-merge for safe Tailwind class merging. Update package.json to include class-variance-authority, clsx, framer-motion and tailwind-merge required by the new components.
Update UI components to use centralized cn util and add JSDoc-style component comments. Renamed lp-code/src/lib/utils/cn.ts -> lp-code/src/lib/cn.ts (with a brief docstring) and updated imports across Button, Card, Container, FileExplorer, FileItem, Footer, NavBar, ScrollIndicator, and SectionTitle. Removed scrollIndicator.variants.ts (deleted). Minor internal comments and small cleanup (forwardRef notes, animation/scroll comments) to improve clarity and maintainability.
Member
oEnzoRibas
requested changes
Mar 7, 2026
Member
oEnzoRibas
left a comment
There was a problem hiding this comment.
Adiconar Testes com @testing-library/react para cada componente conforme exemplo feito como o component Button.
Ex: Button.test.tsx
import { render, screen } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
import { describe, it, expect, vi } from "vitest"
import { Button } from "./Button"
describe("Button component",
() => {
/**
* Testa se o botão renderiza o texto corretamente
*
* */
it("renders button text", () => {
render(<Button>Click</Button>)
const btn = screen.getByRole("button")
expect(btn).toBeInTheDocument()
expect(btn).toHaveTextContent("Click")
})
/**
* Testa se a variante primária é aplicada por padrão
*/
it("applies primary variant by default", () => {
render(<Button>Click</Button>)
const btn = screen.getByRole("button")
expect(btn.className).toContain("bg-blue-600")
})
/**
* Testa se a variante secundária é aplicada quando especificada
*/
it("applies secondary variant", () => {
render(<Button variant="secondary">Click</Button>)
const btn = screen.getByRole("button")
expect(btn.className).toContain("bg-gray-200")
})
/**
* Testa se o evento onClick é disparado corretamente
*/
it("fires onClick", async () => {
const user = userEvent.setup()
const handleClick = vi.fn()
render(<Button onClick={handleClick}>Click</Button>)
const btn = screen.getByRole("button")
await user.click(btn)
expect(handleClick).toHaveBeenCalledTimes(1)
})
})Também adicionar Documentação nos testes.
Para rodar os testes:
npx vitest
oEnzoRibas
reviewed
Mar 7, 2026
Add Vitest + React Testing Library unit tests for several UI components: Card, Container, FileExplorer, FileItem, Footer, NavBar, ScrollIndicator, and SectionTitle. Each test file checks basic rendering and common behaviors (children/prop rendering, role queries, presence of expected text, and container class application) to improve coverage and catch regressions.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Criação base do componentes reutilizáveis sem o design final