feat(Table): Add basic table component#103
Merged
Merged
Conversation
size-limit report 📦
|
JohannesMerz
approved these changes
May 26, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a basic Table component with its related styles, stories, and tests to support a new table feature.
- Added tableStyles in the theme and updated the default component styles mapping.
- Created the Table component along with its styles, stories, and tests.
- Updated component primitive helper to support an extended template literal for styled components.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/theme/defaultComponentStyles.ts | Added import and mapping for tableStyles. |
| src/styleHelpers/componentPrimitive.tsx | Updated transformFn type and added extendedTemplate for styled components. |
| src/index.ts | Exported the new Table component. |
| src/Table/styles.ts | Defined Table styles following theme conventions. |
| src/Table/index.ts | Re-exported Table module. |
| src/Table/Table.tsx | Implemented the basic Table component with header, body, and cell primitives. |
| src/Table/Table.stories.tsx | Provided story examples for the Table component. |
| src/Table/Table.spec.tsx | Added unit tests to verify Table component rendering. |
Comment on lines
17
to
+19
| <P extends object, I extends ComponentPrimitiveProps<P>>( | ||
| property: string | string[], | ||
| transformFn?: (value: unknown) => string | number | ||
| transformFn?: (value: unknown) => string | number | any |
There was a problem hiding this comment.
Consider specifying a more precise return type instead of 'any' to maintain type safety.
| { tag = 'div' as any }: CreateComponentPrimitiveOptions<T> = {} | ||
| ) => | ||
| (template: TemplateStringsArray, ...styles: Array<Interpolation<ComponentPrimitiveProps<P>>>) => { | ||
| const extendedTemplate = Object.assign([...template, ''], { raw: [...template.raw, ''] }); |
There was a problem hiding this comment.
[nitpick] Adding a comment to explain the purpose of extending the template literal would improve maintainability.
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.
No description provided.