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

[core] feat(HTMLTable): use 'compact' instead of 'condensed' #5823

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/core/src/common/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if (typeof process !== "undefined") {
export const ACTIVE = `${NS}-active`;
export const ALIGN_LEFT = `${NS}-align-left`;
export const ALIGN_RIGHT = `${NS}-align-right`;
export const COMPACT = `${NS}-compact`;
export const DARK = `${NS}-dark`;
export const DISABLED = `${NS}-disabled`;
export const FILL = `${NS}-fill`;
Expand Down Expand Up @@ -148,6 +149,7 @@ export const SELECT = `${NS}-select`;

export const HTML_TABLE = `${NS}-html-table`;
export const HTML_TABLE_BORDERED = `${HTML_TABLE}-bordered`;
/** @deprecated prefer `COMPACT` */
export const HTML_TABLE_CONDENSED = `${HTML_TABLE}-condensed`;
export const HTML_TABLE_STRIPED = `${HTML_TABLE}-striped`;

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/components/html-table/_html-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Markup:
</tfoot>
</table>

.#{$ns}-compact - Compact appearance
.#{$ns}-html-table-bordered - Bordered appearance
.#{$ns}-html-table-condensed - Condensed smaller appearance
.#{$ns}-html-table-condensed - Condensed smaller appearance (DEPRECATED, use compact instead)
.#{$ns}-html-table-striped - Striped appearance
.#{$ns}-interactive - Enables hover styles on rows

Expand Down Expand Up @@ -112,6 +113,7 @@ $dark-table-border-color: $pt-dark-divider-white !default;
table.#{$ns}-html-table {
@extend %html-table;

&.#{$ns}-compact,
&.#{$ns}-html-table-condensed {
$small-vertical-padding: centered-text($table-row-height-small);

Expand Down
19 changes: 14 additions & 5 deletions packages/core/src/components/html-table/htmlTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,23 @@ export interface IHTMLTableProps
extends React.TableHTMLAttributes<HTMLTableElement>,
// eslint-disable-next-line deprecation/deprecation
IElementRefProps<HTMLTableElement> {
/** Enables borders between rows and cells. */
/** Enable borders between rows and cells. */
bordered?: boolean;

/** Use small, condensed appearance. */
/** Use compact appearance with less padding. */
compact?: boolean;

/**
* Use small, condensed appearance.
*
* @deprecated use `compact` instead
*/
condensed?: boolean;

/** Enables hover styles on row. */
/** Enable hover styles on rows. */
interactive?: boolean;

/** Use an alternate background color on odd rows. */
/** Use an alternate background color on odd-numbered rows. */
striped?: boolean;
}

Expand All @@ -49,11 +56,13 @@ export interface IHTMLTableProps
export class HTMLTable extends AbstractPureComponent2<HTMLTableProps> {
public render() {
// eslint-disable-next-line deprecation/deprecation
const { bordered, className, condensed, elementRef, interactive, striped, ...htmlProps } = this.props;
const { bordered, className, compact, condensed, elementRef, interactive, striped, ...htmlProps } = this.props;
const classes = classNames(
Classes.HTML_TABLE,
{
[Classes.COMPACT]: compact,
[Classes.HTML_TABLE_BORDERED]: bordered,
// eslint-disable-next-line deprecation/deprecation
[Classes.HTML_TABLE_CONDENSED]: condensed,
[Classes.HTML_TABLE_STRIPED]: striped,
[Classes.INTERACTIVE]: interactive,
Expand Down