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

SlideTabs improvements #49545

Merged
merged 18 commits into from
Dec 5, 2024
Merged

SlideTabs improvements #49545

merged 18 commits into from
Dec 5, 2024

Conversation

bl-nero
Copy link
Contributor

@bl-nero bl-nero commented Nov 28, 2024

Add support for tooltips and status icons

Demo. Note that it demonstrates these features as they are used in a follow-up PR, based on this one.

Requires #49544 (not on its own, but because it's a part of a larger PR train)
Followed up by #49546
Contributes to #46612

Adds a model-level validation capability to our validation library.
They will be later required in the SlideTabs component
Add support for tooltips and status icons
@bl-nero bl-nero added the no-changelog Indicates that a PR does not require a changelog entry label Nov 28, 2024
@bl-nero bl-nero marked this pull request as ready for review November 28, 2024 15:17
@bl-nero bl-nero requested a review from gzdunek December 2, 2024 17:17
// property being undefined and not present at all: undefined props would
// override the default ones, but we want it them to interfere at all.
const optionalProps: { color?: string; 'aria-label'?: string } = {};
if (color != undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (color != undefined) {
if (color !== undefined) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it really necessary to be so strict about it? I mean, if somehow color (and ariaLabel below) become null, we're gonna have a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, well, I guess the type system would protect us here in this case. Changing.

if (color != undefined) {
optionalProps.color = color;
}
if (ariaLabel != undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (ariaLabel != undefined) {
if (ariaLabel !== undefined) {

Comment on lines +286 to +288
// This is one of these rare cases when there is a difference between
// property being undefined and not present at all: undefined props would
// override the default ones, but we want it them to interfere at all.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for pointing this out.

optionalProps['aria-label'] = ariaLabel;
}

if (statusKind) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Use an early return instead?

  if (!statusKind) {
    return null;
  }

  // This is one of these rare cases when there is a difference between
  // property being undefined and not present at all: undefined props would
  // override the default ones, but we want it them to interfere at all.
  const optionalProps: { color?: string; 'aria-label'?: string } = {};
  if (color != undefined) {
    optionalProps.color = color;
  }
  if (ariaLabel != undefined) {
    optionalProps['aria-label'] = ariaLabel;
  }

  return (
    <StatusIcon
      kind={statusKind}
      size={size}
      style={{ transition: 'color 0.2s ease-in 0s' }}
      {...optionalProps}
    />
  );

Base automatically changed from bl-nero/tooltips to master December 4, 2024 18:11
@bl-nero bl-nero added this pull request to the merge queue Dec 5, 2024
@bl-nero bl-nero removed this pull request from the merge queue due to a manual request Dec 5, 2024
@bl-nero bl-nero added this pull request to the merge queue Dec 5, 2024
Merged via the queue into master with commit a631cf1 Dec 5, 2024
41 checks passed
@bl-nero bl-nero deleted the bl-nero/slidetabs branch December 5, 2024 11:46
@public-teleport-github-review-bot

@bl-nero See the table below for backport results.

Branch Result
branch/v17 Failed

@public-teleport-github-review-bot

@bl-nero See the table below for backport results.

Branch Result
branch/v17 Failed

bl-nero added a commit that referenced this pull request Dec 6, 2024
* Validation

Adds a model-level validation capability to our validation library.

* Move tooltips to the design package

They will be later required in the SlideTabs component

* SlideTabs improvements

Add support for tooltips and status icons

* Review

* Also, rename the tooltip directory

* Fix an import

* Review: status-related props, extract StatusIcon

* Also, rename the tooltip component

* review

* review

* Never return undefined from useValidation()
github-merge-queue bot pushed a commit that referenced this pull request Dec 9, 2024
* Validation

Adds a model-level validation capability to our validation library.

* Move tooltips to the design package

They will be later required in the SlideTabs component

* SlideTabs improvements

Add support for tooltips and status icons

* Review

* Also, rename the tooltip directory

* Fix an import

* Review: status-related props, extract StatusIcon

* Also, rename the tooltip component

* review

* review

* Never return undefined from useValidation()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/md ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants