Reduce repeated inline layout styles - #25
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the styling of several components, including StoryClusterCard, WorkspaceSettingsSection, and WorkspaceSourcesSection, by replacing inline styles with a new set of standardized CSS utility classes defined in base.css. The documentation has been updated to include these new layout utilities. Feedback identifies a potential hydration mismatch in StoryClusterCard caused by using new Date() in the render path and recommends removing redundant font-family declarations from the new CSS classes to improve maintainability.
| </strong> | ||
| <span style={workspaceStyles.bodyText}> | ||
| <span className="workspace-text-body"> | ||
| {story.source} | {formatRelativeDate(story.publishedAt, new Date(), "Nieznany czas publikacji")} |
There was a problem hiding this comment.
Using new Date() directly within the render path can cause hydration mismatches in Next.js/React, as the server-rendered timestamp may differ from the client-side one. Consider using a stable reference or a hook that handles time-dependent rendering only after hydration. This issue also appears on line 158.
| .workspace-text-title { | ||
| margin: 0; | ||
| color: var(--text); | ||
| font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif; |
There was a problem hiding this comment.
The font-family property is redundant here because it is already defined globally on the :root and body elements (lines 30 and 47). Removing it from this and other text utility classes (.workspace-text-body, .workspace-text-caption) will keep the CSS more concise and maintainable.
| font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif; | |
| font-size: 1.06rem; |
| .workspace-text-body { | ||
| margin: 0; | ||
| color: var(--muted); | ||
| font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif; |
|
|
||
| .workspace-text-caption { | ||
| color: var(--muted); | ||
| font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif; |
Summary
story-cluster-cardlist/story anatomy to classes; only the externalstyleprop remains.docs/ui-system.md.Inline style count
main: 131 occurrences ofstyle={inapps/web/app/**/*.tsx.Validation
Evidence
Closes #13