Skip to content

Showcase - Convert Foundations, Layouts, Utilities pages to TS #3016

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

Merged
merged 11 commits into from
Jul 16, 2025

Conversation

dchyun
Copy link
Contributor

@dchyun dchyun commented Jul 15, 2025

๐Ÿ“Œ Summary

If merged, this PR would convert the Foundations, Layouts, and Overrides showcase pages to TS.

๐Ÿ› ๏ธ Detailed description

Summary of pages converted

  • Foundations
    • Elevation
    • Focus ring
    • Typography
  • Layouts
    • App Frame
    • Flex
    • Grid
  • Overrides
    • Power Select

๐Ÿ”— 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.

Copy link

vercel bot commented Jul 15, 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 16, 2025 2:30pm
hds-website โœ… Ready (Inspect) Visit Preview Jul 16, 2025 2:30pm

@dchyun dchyun force-pushed the dchyun/showcase-overrides-ts-conversion branch from 97eced4 to 624605b Compare July 15, 2025 19:30
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] All of the functionality of this file could be handled in a route file alone, so deleted this file and move its functionality to the route.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why I implemented things in this way, tbh ๐Ÿคทโ€โ™‚๏ธ๐Ÿคฆโ€โ™‚๏ธ
3ff5ddf

get weights() {
return [...FONT_WEIGHTS];
}
get styles() {
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 variable, and the imports that make it up were unused in the template file so it was removed.

@@ -236,7 +234,7 @@
<Hds::Layout::Grid @gap="48" @align="center" as |LG|>
<Shw::Placeholder @text="item #1" @height="48" />
<Shw::Placeholder @text="item #2" @height="48" />
<LG.Item @basis="25%" @grow="0" @shrink="0">
<LG.Item>
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] The basis, grow and shrink arguments are not present in the Layout::Grid Item subcomponent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, probably remnants of a copy&paste from a similar example in the layout flex page.

@@ -199,7 +197,7 @@
<Hds::Layout::Grid @gap="16" @align="center" as |LG|>
<Shw::Placeholder @text="item #1" @height="48" />
<Shw::Placeholder @text="item #2" @height="48" />
<LG.Item @columnWidth="25%">
<LG.Item>
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] The columnWidth argument is not present on the Layout::Grid Item subcomponent

<SG.Item @label="3 column layout Card layout using columnWidth=33.33%">
<Hds::Layout::Grid @columnWidth="33.33%" @gap="32">
<Hds::Card::Container @level="mid" @hasBorder={{true}} {{style padding="24px"}}>
<Hds::Card::Container @level={{@model.HdsCardLevelValues.Mid}} @hasBorder={{true}} {{style padding="24px"}}>
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] Type errors were thrown when leaving this value as a string. Instead the card level values had to be added to the model and used here. Similar type errors are not thrown for other component values used.

Ex: When the Badge is used below, there is no type error thrown when @color="success" is set.

This is due to a difference in how the types for these two arrguments are defined.

HdsCardLevel is defined using the union type

export type HdsCardLevel =
  | HdsCardLevelValues.Base
  | HdsCardLevelValues.Mid
  | HdsCardLevelValues.High;

HdsBadgeColors is defined using template literals

export type HdsBadgeColors = `${HdsBadgeColorValues}`;

The template literal method allows you to use raw strings directly, meanwhile the union method means you have to use the exact enum values.

Ideally we should have some alignment on how these types are set. That could be a future alignment effort. My preference would be to use the template literal method so we can avoid having to do things like this in the template files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Totally agree - would you mind adding at ticket in the backlog where we can note all the components that have issues like this so we can fix them all at once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a ticket for this in the epic. https://hashicorp.atlassian.net/browse/HDS-5154

@@ -24,7 +25,8 @@ declare module '@glint/environment-ember-loose/registry' {
PageTitle,
RenderModifiersRegistry,
ShowcaseTemplateRegistry,
EmberComposableHelpersRegistry {
EmberComposableHelpersRegistry,
PowerSelectRegistry {
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] Without adding this to the registry template errors were thrown in the Power Select saying PowerSelect was not defined.

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] The diff can make this a little unclear, but the FocusRing route was removed, as it was not needed. A base level Foundations route file was separately added as it was missing previously. All other top level routes (components, overrides, utilities, etc) have route files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense! Thank you for clarifying.

@dchyun dchyun marked this pull request as ready for review July 15, 2025 20:04
@dchyun dchyun requested a review from a team as a code owner July 15, 2025 20:04
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.

left a few comments

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why I implemented things in this way, tbh ๐Ÿคทโ€โ™‚๏ธ๐Ÿคฆโ€โ™‚๏ธ
3ff5ddf

@@ -236,7 +234,7 @@
<Hds::Layout::Grid @gap="48" @align="center" as |LG|>
<Shw::Placeholder @text="item #1" @height="48" />
<Shw::Placeholder @text="item #2" @height="48" />
<LG.Item @basis="25%" @grow="0" @shrink="0">
<LG.Item>
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, probably remnants of a copy&paste from a similar example in the layout flex page.

shleewhite
shleewhite previously approved these changes Jul 16, 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!

Copy link
Contributor

@shleewhite shleewhite left a comment

Choose a reason for hiding this comment

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

๐Ÿšข

@dchyun dchyun merged commit 216bd9f into main Jul 16, 2025
16 checks passed
@dchyun dchyun deleted the dchyun/showcase-overrides-ts-conversion branch July 16, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants