Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table] Add Regions/IRegion docs #1666

Merged
merged 3 commits into from
Oct 6, 2017
Merged

Conversation

cmslewis
Copy link
Contributor

@cmslewis cmslewis commented Oct 5, 2017

Fixes #902

Checklist

  • Update documentation

Changes proposed in this pull request:

  • 🌟 NEW Table documentation now includes a section about Regions and the IRegion interface.

Reviewers should focus on:

  • How's the language? Anything stick out as confusing, incorrect, or awkwardly worded?

@blueprint-bot
Copy link

Add Region docs

Preview: documentation | table
Coverage: core | datetime

@blueprint-bot
Copy link

Delete unnecessary IRegion description line

Preview: documentation | table
Coverage: core | datetime

Copy link
Contributor

@llorca llorca left a comment

Choose a reason for hiding this comment

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

Looks good. Question before approving, is it me or the docs nav is kinda broken? Blue item doesn't change on scroll, kinda flickers when scrolling

@cmslewis
Copy link
Contributor Author

cmslewis commented Oct 6, 2017

@llorca it repros on blueprintjs.com, so this PR isn't the source. But file an issue if you want to track. 👍

@@ -89,12 +89,21 @@ export type ICellInterval = [number, number];
export type ICellCoordinate = [number, number];

/**
* A ZERO-indexed region of cells.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this knowledge into the props descriptions.

Copy link
Contributor

@themadcreator themadcreator left a comment

Choose a reason for hiding this comment

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

looks nice!

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

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

not clear how RegionCardinality is used.

[`Table.scrollToRegion`](#table-js.instance-methods) instance method.

There are four different types of regions, each represented by a different
`RegionCardinality`:
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this object used in code? you mention it here but never show examples that use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe it would make more sense to introduce this enum after explaining IRegion? be like, "ok now that you know all that, here's the shorthand we developed for it."

const multiColumnRegion = Regions.column(0, 2); // { rows: null, cols: [0, 2] }
const multiRowRegion = Regions.row(0, 2); // { rows: [0, 2], cols: null }

const tableRegion = Regions.table(); // { rows: null, cols: null }
Copy link
Contributor

Choose a reason for hiding this comment

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

how do these functions relate to RegionCardinality?

* The first and last column indices in the region, inclusive and
* zero-indexed. If `cols` is `null`, then all columns are understood to be
* included in the region.
*/
cols?: ICellInterval;
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps add | null to these types to match docs? or does it support undefined (cuz of optional prop)?

I know we don't use sNC in blueprint but these annotations are useful in the outside world.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe the type should be cols: ICellInterval | null? not optional, just nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally agree, but I'm hesitant to make that change in an otherwise docs-only PR. Might break people who are manually constructing their regions if they happened to pass undefined.

Copy link
Contributor Author

@cmslewis cmslewis Oct 6, 2017

Choose a reason for hiding this comment

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

Added | null but left the ? for now to keep allowing undefined. The existing code and comments are actually out-of-sync on this point: code uses undefined but comments mention null. Can fix later.

@blueprint-bot
Copy link

Respond to CR feedback

Preview: documentation | table
Coverage: core | datetime

@cmslewis cmslewis merged commit 8924645 into master Oct 6, 2017
@cmslewis cmslewis deleted the cl/table-902-add-iregion-docs branch October 6, 2017 21:56
@cmslewis cmslewis mentioned this pull request Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants