Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Add story for Table component#1001

Open
Coteh wants to merge 4 commits into
masterfrom
table-story
Open

Add story for Table component#1001
Coteh wants to merge 4 commits into
masterfrom
table-story

Conversation

@Coteh

@Coteh Coteh commented Aug 22, 2020

Copy link
Copy Markdown
Collaborator

Addresses the Table story in #954.

Leaving in Draft until these items are done:

  • Complete knobs for columns widths and header font size
  • Determine whether it's necessary to have knobs for align headers and align body columns
  • Decide whether to transition from knobs to Storybook Controls edit: will address in separate PR

This PR also adds Storybook Backgrounds, as I wanted to add the color #fafafa, which is being used underneath the Favourite short links table in the homepage, as a background colour for the canvas. This will make the Table component stand out better. I also set #fafafa as the default background colour for story canvases.

image

@codecov

codecov Bot commented Aug 22, 2020

Copy link
Copy Markdown

Codecov Report

Merging #1001 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1001   +/-   ##
=======================================
  Coverage   52.58%   52.58%           
=======================================
  Files         142      142           
  Lines        3564     3564           
  Branches      168      168           
=======================================
  Hits         1874     1874           
  Misses       1623     1623           
  Partials       67       67           
Flag Coverage Δ
#golang 72.03% <ø> (ø)
#typescript 22.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
frontend/src/component/ui/Table.tsx 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebc6a04...c243c26. Read the comment docs.

@Coteh Coteh marked this pull request as ready for review August 22, 2020 20:28
@Coteh

Coteh commented Aug 22, 2020

Copy link
Copy Markdown
Collaborator Author

Readied this PR for review, will convert it to Storybook Controls if we start using it.

@naturetime10

Copy link
Copy Markdown
Member

@Coteh Control seems good. Let's do it!

@Coteh

Coteh commented Aug 28, 2020

Copy link
Copy Markdown
Collaborator Author

@byliuyang I think what I'll do is merge this in as-is, then make a separate PR for Controls and convert all existing stories to use Controls in that PR. What do you think?

@naturetime10 naturetime10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @Coteh , thank you so much for working on this PR. Can you add a screenshot so that reviewers know how does the page look like?

Comment on lines +31 to +33
rows={new Array(number('Number of rows', 2))
.fill(0)
.map((_, i) => headers.map((_, j) => `data ${i}-${j}`))}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am confused by what's going on here. Can you explain what's going on or extract the logic using helper functions?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I am simply allowing the table to have the number of rows user specifies within the storybook. I can make it into a helper function if that makes it easier to understand.

Comment on lines +1 to +15
export const parameters = {
backgrounds: {
default: 'short',
values: [
{
name: 'white',
value: '#fff'
},
{
name: 'short',
value: '#fafafa'
}
]
}
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder what are those?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These are the parameters for storybook backgrounds https://storybook.js.org/docs/react/essentials/backgrounds

@Coteh

Coteh commented Sep 2, 2020

Copy link
Copy Markdown
Collaborator Author

@byliuyang Screenshot added

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants