The intent of this PR is to remove all the usages of Pds::Iconwithin the repo. Once this PR is merged a new version of Structure will be released, adopted in Cloud UI (with the needed changes/fixes that are required by the update), and only at that point we will proceed with the complete removal and deprecation of the Pds::Icon component itself from the repo (this will be done in a follow-up PR, obviusly).
Changes
In this PR I have:
added the @hashicorp/ember-flight-icons package as dependency (so we can use the <FlightIcon> component)
to be able to view the icons in Storybook, we need to injected the Flight icons sprite in the Storybook page's <head> element; this has been done using the previewHead function
notice: I had to add @hashicorp/flight-icons as dev-dependency otherwise the linter would complain that in .main.js the require() would be “extraneous”
updated the markdown with instructions for the “install” of the Pds::Ember package
removed sample icons from main tests/dummy app template (that page us useless)
Pds::Avatar component → replaced Pds::Icon with FlightIcon
⚠️ Notice: as agreed with @heatherlarsen we have replaced the square "user" icon with a generic "user" icon without a border around it; this is probably OK because in HCP every user has a gravatar image (see thread)
Pds::ErrorMessage component → replaced Pds::Icon with FlightIcon
Pds::Select component → replaced Pds::Icon with FlightIcon in the component “facade”
Pds::Dropdown component → replaced Pds::Icon with FlightIcon in the "trigger" sub-component
Pds::Button component → replaced Pds::Icon with FlightIcon
Pds::GlobalHeader component → updated the docs/stories to use FlightIcon instead of Pds::Icon
Pds::CheckboxField component → replaced Pds::Icon with embedded SVG in the component “facade”
in this specific case I didn’t use the FlightIcon component because the corresponding icon check would touch the bounding box of the container, and would require some heavy refactoring; so I’ve decided that it was easier/better to directly embed the SVG (there are just a few instances of Pds::CheckboxField in Cloud UI, and by the time this PR will land they will likely have already been replaced with the equivalent HDS component)
Tooltip modifier → updated the docs/stories to use FlightIcon instead of Pds::Icon
Toolbar component → updated the docs/stories to use FlightIcon instead of Pds::Icon
CtaLink component → updated the docs/stories to use FlightIcon instead of Pds::Icon
Link "component" → updated the docs/stories to use FlightIcon instead of Pds::Icon (this is not technically a component, it's just styling via CSS)
Testing
I have symlinked my local directory package/pds-ember to the cloud-ui/node_modules/@hashicorp/pds-ember folder in Cloud UI, run the application and tested that everything worked as expected.
Once this PR is merged and the new Structure version is adopted in Cloud UI:
Pds::Button
[x] check all the instances that have a @iconStart and/or @iconEnd argument, and replace the name of the icon according to the pre-defined mapping (but consider there may be exceptions, so there may be a need to check visually the outcome in some cases, and validate with product designers).
I have run a codemod (see below) on the entire Cloud UI codebase to check for such instances but found zero occurrences of button with @iconStart/iconEnd arguments
Pds::Dropdown
[x] make sure that if there are instances in which the Pds::Dropdown::Trigger has a custom @icon argument, the name of icon is updated to use the Flight icon instead of the Structure one (you can search for /.Trigger/, case sensitive).
the only occurrence I've found is in this file packages/cloud-ui-core/addon/components/more-menu/index.hbs but the Structure icon names used in the Trigger are more-horizontal and chevron-down which are the same in Flight, so no need to update the code, it just works.
Codemod used to check <Pds::Button> instances with @iconStart/@iconEnd arguments:
Description
The intent of this PR is to remove all the usages of
Pds::Icon
within the repo. Once this PR is merged a new version of Structure will be released, adopted in Cloud UI (with the needed changes/fixes that are required by the update), and only at that point we will proceed with the complete removal and deprecation of thePds::Icon
component itself from the repo (this will be done in a follow-up PR, obviusly).Changes
In this PR I have:
@hashicorp/ember-flight-icons
package as dependency (so we can use the<FlightIcon>
component)<head>
element; this has been done using thepreviewHead
function@hashicorp/flight-icons
as dev-dependency otherwise the linter would complain that in.main.js
therequire()
would be “extraneous”Pds::Ember
packagetests/dummy
app template (that page us useless)Pds::Avatar
component → replacedPds::Icon
withFlightIcon
Pds::ErrorMessage
component → replacedPds::Icon
withFlightIcon
Pds::Select
component → replacedPds::Icon
withFlightIcon
in the component “facade”Pds::Dropdown
component → replacedPds::Icon
withFlightIcon
in the "trigger" sub-componentPds::Button
component → replacedPds::Icon
withFlightIcon
Pds::GlobalHeader
component → updated the docs/stories to useFlightIcon
instead ofPds::Icon
Pds::CheckboxField
component → replacedPds::Icon
with embedded SVG in the component “facade”FlightIcon
component because the corresponding iconcheck
would touch the bounding box of the container, and would require some heavy refactoring; so I’ve decided that it was easier/better to directly embed the SVG (there are just a few instances ofPds::CheckboxField
in Cloud UI, and by the time this PR will land they will likely have already been replaced with the equivalent HDS component)Tooltip
modifier → updated the docs/stories to useFlightIcon
instead ofPds::Icon
Toolbar
component → updated the docs/stories to useFlightIcon
instead ofPds::Icon
CtaLink
component → updated the docs/stories to useFlightIcon
instead ofPds::Icon
Link
"component" → updated the docs/stories to useFlightIcon
instead ofPds::Icon
(this is not technically a component, it's just styling via CSS)Testing
I have symlinked my local directory
package/pds-ember
to thecloud-ui/node_modules/@hashicorp/pds-ember
folder in Cloud UI, run the application and tested that everything worked as expected.Relevant links
🚧 TODOs
Once this PR is merged and the new Structure version is adopted in Cloud UI:
Pds::Button
@iconStart
and/or@iconEnd
argument, and replace the name of the icon according to the pre-defined mapping (but consider there may be exceptions, so there may be a need to check visually the outcome in some cases, and validate with product designers).@iconStart/iconEnd
argumentsPds::Dropdown
Pds::Dropdown::Trigger
has a custom@icon
argument, the name of icon is updated to use the Flight icon instead of the Structure one (you can search for/.Trigger/
, case sensitive).packages/cloud-ui-core/addon/components/more-menu/index.hbs
but the Structure icon names used in theTrigger
aremore-horizontal
andchevron-down
which are the same in Flight, so no need to update the code, it just works.Codemod used to check
<Pds::Button>
instances with@iconStart/@iconEnd
arguments: