Skip to content

feat: #218 v5-table-component table-part-[01]#307

Merged
rpt-rfoxy merged 12 commits intomainfrom
feat-218-v5-table-component-part-table
Mar 3, 2025
Merged

feat: #218 v5-table-component table-part-[01]#307
rpt-rfoxy merged 12 commits intomainfrom
feat-218-v5-table-component-part-table

Conversation

@rpt-rfoxy
Copy link
Contributor

Pull request checklist

  • Create table Component (table) part

Detail as per issue below (required):
as perdiscusstion here Discussion
schreenshoot
image

@rpt-rfoxy rpt-rfoxy changed the title feat: #218 v5-table-component table-part feat: #218 v5-table-component table-part-[01] Feb 10, 2025
@codacy-production
Copy link

codacy-production bot commented Feb 10, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for d9a34431 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d9a3443) Report Missing Report Missing Report Missing
Head commit (f5fbc46) 4249 3854 90.70%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#307) 8 8 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Copy link
Contributor

@kurtdoherty kurtdoherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rpt-rfoxy. I've left a few comments; I think there'll need to be a bit of conversation on some, particularly the file structure and display mode.

import { TableContainer } from '../../table-container'
describe('Table', () => {
test('should match snapshot', () => {
const { asFragment } = render(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: It's important to design our tests to fail well. You can read more about this here. Right now, this test is will fail:

  1. ✅ when our subject changes (TableContainer); and,
  2. ❌ when one of the subject's collaborators change (e.g. Table)

Failure (2) is not what we want.

suggestion: To avoid this happening, we can simply change our test as follows:

render(<TableContainer>Fake child</TableContainer>)

This way, we're only snapshotting the subject (and it's fake child), not the subject AND a bunch of collaborators. Each collaborator will have it's own tests to validate they function correctly.



The Table component can be used from the Table molecule components, e.g. `TableRow`, `TableCell`, etc
There are two visual styles for the table, dependant on screen width.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Again, I don't see anything about this kind of responsive behaviour on the Figma design spec.

padding: 0.75rem 0.5rem;
${isBelowDesktop} {
display: flex;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I don't see anything about this kind of responsive behaviour on the Figma design spec. It's really important that we do not add complexity to our components if we're not required to by the design spec.

Unless I'm mistaken, "responsiveness" will be done by hiding/showing columns; it will not be done by adjusting the way a table's cells are laid out.

import { isBelowDesktop } from '../../../styles/media'
import { styled } from '@linaria/react'

export const ElTable = styled.table`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I do not think we should be using the default table display mode. Instead, I think we should be using a flex or grid display mode. That said, I think this concern was missed on the solution design as I can't see any details around how we plan to size columns in the table correctly.

Might need further discussion on this one 🤔

import React, { FC, TableHTMLAttributes } from 'react'
import { ElTable } from './styles'

export interface ITableProps extends TableHTMLAttributes<HTMLTableElement> {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: Can you please keep the names for prop types and interfaces consistent with the rest of the repo? Specifically, we don't use prefixes like I to denote an interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I don't think it was discussed in the solution design, but do we really need the nested folder structure here? Feels like we could just have something like:

table/
  __tests__/
    table.tests.tsx
    table-container.tests.tsx
  styles.tsx
  table.tsx
  table.stories.tsx
  table-container.tsx
  table-container.stories.tsx
  ...

@rpt-rfoxy
Copy link
Contributor Author

thanks @kurtdoherty for the feedback, i'll change the code

Copy link
Contributor

@kurtdoherty kurtdoherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rpt-rfoxy, just the one question, otherwise looks good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why are we testing our barrel file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its because when we do test --coverage, the result funcs always bellow 84%, so i inisiative to add test barrel file to keep the test function in 84%++

image

Copy link
Contributor

@kurtdoherty kurtdoherty Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, okay, that's just "gaming the system." We don't want to add tests for the sake of our coverage metrics; that approach will just lead to low-value, high-maintenance tests, and undermine the value coverage metrics are meant to provide: namely, the identification of possible risk in our code.

Instead of simply adding test coverage against a module that does not need tests, we need to assess whether there's any meaningful coverage gaps being reported. Barrel files are not a meaningful gap.

To help with this, I'll make a change to our coverage settings to exclude barrel files. Once that's merged in, rebase you changes and see what your coverage comes back as for the components you're adding in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've raised #315 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#315 has now been merged.

export * from './components/skeleton'
export * from './components/tooltip'
export * from './components/table/table-container'
export * from './components/table/table-toolbar'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpt-rfoxy question: Is there a reason why this is being removed now? We agreed upon having separate folders for atoms. This will allow you to avoid having a barrel file.
@kurtdoherty Please do correct me if I am wrong here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice this change sorry 🙈 I agree with you, removing these doesn't seem to be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the feedback, i already remove the barrel

@rpt-rfoxy rpt-rfoxy merged commit 9f976ee into main Mar 3, 2025
6 checks passed
@rpt-rfoxy rpt-rfoxy deleted the feat-218-v5-table-component-part-table branch March 3, 2025 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants