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

Adding centerAlign as a property for column headers #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ssotangkur-airbnb
Copy link
Collaborator

to: @milesj @stefhatcher @hayes @alecklandgraf

Description

Added a centerAlign option to the ColumnMetadata section of <DataTable> to allow the column headers to be center aligned.

Motivation and Context

Some content looks best center aligned.

Testing

Verified it looks correct with a new story in storyboard.

Screenshots

image

Checklist

  • My code follows the style guide of this project.
  • I have updated or added documentation accordingly.
  • I have read the CONTRIBUTING document.

@@ -89,11 +94,14 @@ export default function ColumnLabels({
const sortable =
!columnMetadata || !columnMetadata[key] || columnMetadata[key].disableSorting !== 1;

const alignStyle = columnMetadata?.[key]?.rightAlign ? rightAlignmentStyle :
Copy link
Contributor

Choose a reason for hiding this comment

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

please un-nest these nested turneries for readability.

let alignStyle = {};

if (columnMetadata?.[key]?.rightAlign) {
  alignStyle = rightAlignmentStyle;
} else if (columnMetadata?.[key]?.centerAlign) {
  alignStyle = centerAlignmentStyle;
}

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.

2 participants