Skip to content

fix(tile): remove support for imgs - #3274

Merged
mcoker merged 8 commits into
patternfly:masterfrom
christiemolloy:fixTile
Jul 29, 2020
Merged

mcoker merged 8 commits into
patternfly:masterfrom
christiemolloy:fixTile

Conversation

@christiemolloy

Copy link
Copy Markdown
Member

As a follow up to #3229 this PR removes support for images in the tile component and only supports SVG's which take on the font-size property set on the tile-icon.

@patternfly-build

patternfly-build commented Jul 10, 2020 •

Copy link
Copy Markdown
Collaborator

Preview: https://patternfly-pr-3274.surge.sh

A11y report: https://patternfly-pr-3274-coverage.surge.sh

CSS Size Report
NameCurrentPreviousDiff %
site/docs/components/Wizard/examples/Wizard.css117 B56 B52.14
components/NotificationBadge/notification-badge.css3.5 kB2.7 kB22.90
components/Tile/tile.css6.3 kB6.2 kB1.31
components/Wizard/wizard.css21.0 kB21.1 kB-0.10
patternfly.css741.6 kB744.2 kB-0.35
patternfly-no-reset.css739.7 kB742.3 kB-0.35
patternfly.min.css653.1 kB655.6 kB-0.39
components/Page/page.css23.0 kB23.3 kB-1.15
components/Form/form.css7.4 kB7.6 kB-2.87
components/FormControl/form-control.css13.3 kB16.4 kB-22.63

@mattnolting mattnolting left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just the one comment

{{#> tile-header tile-header--modifier="pf-m-stacked"}}
{{#> tile-icon}}
<img src="/assets/images/pf-logo-small.svg" alt="PatternFly logo">
{{#> tile-img-pf}}{{/tile-img-pf}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These can all be

Suggested change
{{#> tile-img-pf}}{{/tile-img-pf}}
{{> tile-img-pf}}

@mcarrano mcarrano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works for me.

--pf-c-tile__icon--Color: var(--pf-global--Color--200);
--pf-c-tile--hover__icon--Color: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected__icon--Color: var(--pf-global--primary-color--100);
--pf-c-tile--m-disabled__icon--Color: var(--pf-global--disabled-color--100);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should leave this in. If someone sets --pf-c-tile__icon--Color: red;, then it will still be red if it's disabled since we only set the icon color for stacked icons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also need to add back so the stacked icon color is disabled

--pf-c-tile__header--m-stacked__icon--Color: var(--pf-global--disabled-color--100);

@mcoker

mcoker commented Jul 13, 2020

Copy link
Copy Markdown
Contributor

Just an idea, but this might be a time to try something like

.pf-c-tile__icon {
  color: var(--pf-c-tile__icon--Color--state, var(--pf-c-tile__icon--Color--type, var(--pf-c-tile__icon--Color)));
}

where --pf-c-tile__icon--Color is the base/default color.

Then we have a theme var for the tile "type" (eg, stacked), and set .pf-c-tile__header.pf-m-stacked { --pf-c-tile__icon--Color--type: var(--pf-c-tile__header--m-stacked__icon--Color); }

Then for hover/focus/selected/disabled, we set .pf-c-tile__header:hover { --pf-c-tile__icon--Color--state: var(--pf-c-tile--hover__icon--Color); }, .pf-c-tile__header.pf-m-selected { --pf-c-tile__icon--Color--state: var(--pf-c-tile--m-selected__icon--Color); }, etc.

That way we're only setting 1 var on hover, focus, etc, for the icon color versus needed to set 2 separate vars. That's assuming we don't think we would separate out the icon hover/focus/selected/disabled color between normal and stacked variations, which it doesn't seem like we would. Easier for us and the user to customize.

We haven't done that before, but I'm curious what you think @christiemolloy @mattnolting

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One last thing - the disabled tiles need tabindex="-1" so they aren't focusable, and we should add that to the a11y docs.

Screen Shot 2020-07-20 at 3 51 47 PM

--pf-c-tile__header--m-stacked__icon--Color: var(--pf-global--Color--100);
--pf-c-tile--hover__header--m-stacked__icon--Color: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected__header--m-stacked__icon--Color: var(--pf-global--primary-color--100);
--pf-c-tile--m-disabled__header--m-stacked__icon--Color: var(--pf-global--disabled-color--100);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like you need to add this back. It's used but no longer defined:

--pf-c-tile__header--m-stacked__icon--Color: var(--pf-c-tile--m-disabled__header--m-stacked__icon--Color);

@mattnolting
mattnolting self-requested a review July 29, 2020 15:05

@mattnolting mattnolting left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LPTM!

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤩👍

@mcoker
mcoker merged commit b33735b into patternfly:master Jul 29, 2020
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.

5 participants