Skip to content

Conversation

@shleewhite
Copy link
Contributor

@shleewhite shleewhite commented Jul 8, 2025

๐Ÿ“Œ Summary

If merged, this PR would convert the following pages in the showcase to TypeScript:

  • AppHeader
  • AppSideNav
  • Copy::Button
  • Copy::Snippet
  • Pagination

๐Ÿ› ๏ธ Detailed description

The best way to understand the changes in this PR is to walk through each commit in the "Files changed" tab, I have added comments there explaining why I made the changes.

๐Ÿ”— External links

Jira ticket: HDS-5076


๐Ÿ‘€ Component checklist

  • Percy was checked for any visual regression

๐Ÿ’ฌ Please consider using conventional comments when reviewing this PR.

๐Ÿ“‹ PCI review checklist
  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
  • If applicable, I've worked with GRC to document the impact of any changes to security controls.
    Examples of changes to controls include access controls, encryption, logging, etc.
  • If applicable, I've worked with GRC to ensure compliance due to a significant change to the in-scope PCI environment.
    Examples include changes to operating systems, ports, protocols, services, cryptography-related components, PII processing code, etc.

@vercel
Copy link

vercel bot commented Jul 8, 2025

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Updated (UTC)
hds-showcase โœ… Ready (Inspect) Visit Preview Jul 14, 2025 3:06pm
hds-website โœ… Ready (Inspect) Visit Preview Jul 14, 2025 3:06pm

return document.querySelector('#test-target-node-element');
}

get targetMultipleNodeElements() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I removed this getter from the typescript version because:

  1. It was never used in the showcase template
  2. Hds::Copy::Button doesn't support copying multiple nodes like this

@shleewhite shleewhite changed the title Showcase/ts batch 1 Showcase: Batch 1 converting pages to TypeScript Jul 8, 2025

<Hds::AppSideNav::Portal @targetName="sidenav-portal-demo-1" @ariaLabel="Primary on portal demo 1" as |Nav|>
<Nav.extraBefore><Shw::Placeholder @height="72px" @text="extraBefore" @background="#f3d9c5" /></Nav.extraBefore>
<Nav.ExtraBefore><Shw::Placeholder @height="72px" @text="extraBefore" @background="#f3d9c5" /></Nav.ExtraBefore>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this causes a small change in Percy because now the blocks are rendered (they weren't before)

<Shw::Text::H4>Target types</Shw::Text::H4>

<Shw::Grid @columns={{3}} @gap="2rem" as |SF|>
<Shw::Flex @gap="2rem" as |SF|>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: columns isnt an argument on Flex (its only on Grid), opted to change it back to Flex and remove the columns argument to avoid changes in Percy.

import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
import { inject as service } from '@ember/service';
import { service } from '@ember/service';

Copy link
Member

Choose a reason for hiding this comment

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

For context, Alexey is referring to the following deprecation https://deprecations.emberjs.com/id/importing-inject-from-ember-service/. However, we're still supporting 3.28 at the moment, so we'd need to operate such changes closer to the major release โ€“ and can be done across the library with a simple replace.

import Route from '@ember/routing/route';
import type { ModelFrom } from 'showcase/utils/ModelFromRoute';

interface User {
Copy link
Contributor

Choose a reason for hiding this comment

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

[Suggestion] Since these mock api files are used across multiple component maybe we should define a types file for them somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think that might be a good follow up ticket.. @aklkv suggested actually making a reusable fixture that imports the typed user data. So I think if we do that, we could have the type in that file.

didoo
didoo previously approved these changes Jul 14, 2025
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

LGTM!

@shleewhite shleewhite merged commit 1a3cd28 into main Jul 14, 2025
16 checks passed
@shleewhite shleewhite deleted the showcase/ts-batch-1 branch July 14, 2025 16:09
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