Skip to content

feat(tile): add tile component - #3229

Merged
mattnolting merged 11 commits into
patternfly:masterfrom
christiemolloy:issue-3100
Jul 9, 2020
Merged

mattnolting merged 11 commits into
patternfly:masterfrom
christiemolloy:issue-3100

Conversation

@christiemolloy

@christiemolloy christiemolloy commented Jun 30, 2020 •

Copy link
Copy Markdown
Member

closes #3100

@patternfly-build

patternfly-build commented Jun 30, 2020 •

Copy link
Copy Markdown
Collaborator

@maryshak1996

Copy link
Copy Markdown

@mcarrano initial design specs request using all-black variant of logos on default and disabled, then switch to the full-color logo variant on hover and selected, but seeing this implemented with the full-color logo always used, I think that this still provides enough differentiation between the different states and I would support this as well, what do you think (before I approve this)
Screen Shot 2020-07-01 at 10 20 37 AM
^ screenshot of the implementation vs having the black PF logo on default and disabled

@maryshak1996 maryshak1996 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@christiemolloy you'll see I posed a question for Matt as well, but the only thing missing here is that this large stacked title needs to swap to blue for the icon on hover and selected (see here it's black still)
Screen Shot 2020-07-01 at 10 25 28 AM

@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.

@maryshak1996 I agree with you that allowing the logo to remain full-color in some cases is fine. I can see instances where changing a logotype to all black might to work. I'll defer to you on other issues. But looks good to me.

@christiemolloy

Copy link
Copy Markdown
Member Author

@maryshak1996 I actually saw this in the Marvel mock up so I thought that the larger tiles had a black icon for all states:
Screen Shot 2020-07-06 at 9 48 56 AM

But updated to this now:
Screen Shot 2020-07-06 at 9 51 24 AM

Also I didn't update the image color on different states, because that would require having that image as a background image, and i think the switch in images would be better solved in React but I can definitely try to achieve that if thats what we still want?

@maryshak1996

Copy link
Copy Markdown

@christiemolloy ahhh my bad there! Looks great now!

@maryshak1996
maryshak1996 self-requested a review July 6, 2020 14:22

@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.

Looking great, left a few comments.

--pf-c-tile__icon--FontSize: var(--pf-c-tile__title--m-stacked__icon--FontSize);
--pf-c-tile__icon--Color: var(--pf-c-tile__title--m-stacked__icon--Color);

&.pf-m-large {

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.

Should we use .pf-m-lg or .pf-m-display-lg here?

--pf-c-tile--disabled__subtext--Color: var(--pf-global--disabled-color--100);

position: relative;
display: inline-block;

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.

I think I'd use display: inline-grid here, then apply a row-gap. That way, in the future, if we want to use subgrid to manage row height in the title or text when tiles are adjacent, we could do that.

text-align: center;
background-color: var(--pf-c-tile--BackgroundColor);

&::after {

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.

Suggested change
&::after {
&::before {

We should try to use ::before first before using the ::after pseudo, as ::after always render above the element's content and ::before will naturally render behind content.

Comment on lines +29 to +31
--pf-c-tile__title--m-stacked__icon--m-large--FontSize: var(--pf-global--icon--FontSize--xl);
--pf-c-tile__title--m-stacked__icon--m-large--Width: var(--pf-c-tile__title--m-stacked__icon--m-large--FontSize);
--pf-c-tile__title--m-stacked__icon--m-large--Height: var(--pf-c-tile__title--m-stacked__icon--m-large--Width);

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.

Probably should use .pf-m-lg or .pf-m-display-lg to conform to existing patterns.

--pf-c-tile__title--Color: var(--pf-c-tile--disabled__title--Color);
--pf-c-tile__subtext--Color: var(--pf-c-tile--disabled__subtext--Color);

&::after {

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.

Suggested change
&::after {
&::before {

Comment on lines +92 to +95
&::after {
--pf-c-tile--BorderWidth: var(--pf-c-tile--m-selected--BorderWidth);
--pf-c-tile--BorderColor: var(--pf-c-tile--m-selected--BorderColor);
}

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.

Suggested change
&::after {
--pf-c-tile--BorderWidth: var(--pf-c-tile--m-selected--BorderWidth);
--pf-c-tile--BorderColor: var(--pf-c-tile--m-selected--BorderColor);
}
&::before {
--pf-c-tile--before--BorderWidth: var(--pf-c-tile--m-selected--before--BorderWidth);
--pf-c-tile--before--BorderColor: var(--pf-c-tile--m-selected--before--BorderColor);
}

Comment on lines +7 to +13
--pf-c-tile--BorderColor: var(--pf-global--BorderColor--100);
--pf-c-tile--BorderWidth: var(--pf-global--BorderWidth--sm);
--pf-c-tile--BorderRadius: var(--pf-global--BorderRadius--sm);
--pf-c-tile--hover--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected--BorderWidth: var(--pf-global--BorderWidth--md);
--pf-c-tile--m-selected--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--disabled--BackgroundColor: var(--pf-global--disabled-color--300);

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.

Suggested change
--pf-c-tile--BorderColor: var(--pf-global--BorderColor--100);
--pf-c-tile--BorderWidth: var(--pf-global--BorderWidth--sm);
--pf-c-tile--BorderRadius: var(--pf-global--BorderRadius--sm);
--pf-c-tile--hover--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected--BorderWidth: var(--pf-global--BorderWidth--md);
--pf-c-tile--m-selected--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--disabled--BackgroundColor: var(--pf-global--disabled-color--300);
--pf-c-tile--before--BorderColor: var(--pf-global--BorderColor--100);
--pf-c-tile--before--BorderWidth: var(--pf-global--BorderWidth--sm);
--pf-c-tile--before--BorderRadius: var(--pf-global--BorderRadius--sm);
--pf-c-tile--hover--before--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected--before--BorderWidth: var(--pf-global--BorderWidth--md);
--pf-c-tile--m-selected--before--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--disabled--before--BackgroundColor: var(--pf-global--disabled-color--300);
--pf-c-tile--disabled--before--BorderWidth: 0;

Comment on lines +78 to +80
&::after {
--pf-c-tile--BorderColor: var(--pf-c-tile--hover--BorderColor);
}

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.

Suggested change
&::after {
--pf-c-tile--BorderColor: var(--pf-c-tile--hover--BorderColor);
}
&::before {
--pf-c-tile--before--BorderColor: var(--pf-c-tile--hover--before--BorderColor);
}

left: 0;
content: "";
border: var(--pf-c-tile--BorderWidth) solid var(--pf-c-tile--BorderColor);
border-radius: var(--pf-c-tile--BorderRadius);

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.

pointer-events: none;

}

// stylelint-disable
&[disabled] {

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.

disabled isn't valid on a div - needs to be .pf-m-disabled

pointer-events: none;
cursor: not-allowed;

--pf-c-tile--BackgroundColor: var(--pf-c-tile--disabled--BackgroundColor);

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.

can you move the vars to the beginning of the block? We usually list it in the order of vars -> properties -> selectors

--pf-c-tile__body--Color: var(--pf-c-tile--disabled__body--Color);

&::before {
border: 0;

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.

you could just set --pf-c-tile--before--BorderWidth: 0; on the disabled (or .pf-m-disabled) selector

}

&:hover {
&::before {

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.

do you need this selector? Could you just assign the var under &:hover?


cursor: pointer;

--pf-c-tile__title--Color: var(--pf-c-tile--hover__title--Color);

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.

can you move the vars to the beginning of the block?


img {
width: 100%;
height: 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.

this can create a skewed image, should be max-width/height, but what if it's an svg? We could just start with supporting icon fonts and react-icons SVGs, which will accept the font-size declaration, then create a follow-up to investigate other image formats.


.pf-c-tile__header {
display: flex;
flex-direction: row;

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.

shouldn't need this since it's the default.

.pf-c-tile__header {
display: flex;
flex-direction: row;
align-items: center;

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.

This will center align the text and icon if the text wraps. Is that what we want to happen?

Screen Shot 2020-07-09 at 3 41 39 PM

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ill need to follow-up with design on this

&.pf-m-selected,
&:focus {
&::before {
--pf-c-tile--before--BorderWidth: var(--pf-c-tile--before--m-selected--BorderWidth);

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.

vars should be title--m-selected--before--

}

.pf-c-tile__header.pf-m-stacked .pf-c-tile__icon {
--pf-c-tile__icon--Color: var(--pf-c-tile--disabled__header--m-stacked__icon--Color);

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.

does this need to be set on .pf-c-tile__header.pf-m-stacked .pf-c-tile__icon or could we just set it under .pf-m-disabled as --pf-c-tile__icon--Color: var(--pf-c-tile--m-disabled__header__icon--Color);

--pf-c-tile--before--BorderWidth: var(--pf-c-tile--m-selected--before--BorderWidth);
--pf-c-tile--before--BorderColor: var(--pf-c-tile--m-selected--before--BorderColor);

cursor: pointer;

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.

could cursor: pointer just be set on the entire component? The card sets .pf-m-selectable { cursor: pointer; }

| `.pf-c-tile__body` | `<div>` | Initiates the tile body. |
| `.pf-m-selected` | `.pf-c-tile` | Modifies the tile for the selected state. |
| `.pf-m-stacked` | `.pf-c-tile__header` | Modifies the tile header to be stacked vertically. |
| `.pf-m-display-lg` | `.pf-c-tile` | Modifies the tile to have large display styling. |

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.

🔥

Comment on lines +11 to +12
--pf-c-tile--before--m-selected--BorderWidth: var(--pf-global--BorderWidth--md);
--pf-c-tile--before--m-selected--BorderColor: var(--pf-global--primary-color--100);

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.

Suggested change
--pf-c-tile--before--m-selected--BorderWidth: var(--pf-global--BorderWidth--md);
--pf-c-tile--before--m-selected--BorderColor: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected--before--BorderWidth: var(--pf-global--BorderWidth--md);
--pf-c-tile--m-selected--before--BorderColor: var(--pf-global--primary-color--100);

--pf-c-tile__title--Color: var(--pf-global--Color--100);
--pf-c-tile--hover__title--Color: var(--pf-global--primary-color--100);
--pf-c-tile--m-selected__title--Color: var(--pf-global--primary-color--100);
--pf-c-tile--disabled__title--Color: var(--pf-global--disabled-color--100);

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.

Suggested change
--pf-c-tile--disabled__title--Color: var(--pf-global--disabled-color--100);
--pf-c-tile--m-disabled__title--Color: var(--pf-global--disabled-color--100);

--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--disabled__header--m-stacked__icon--Color: var(--pf-global--Color--200);

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.

Suggested change
--pf-c-tile--disabled__header--m-stacked__icon--Color: var(--pf-global--Color--200);
--pf-c-tile--m-disabled__header--m-stacked__icon--Color: var(--pf-global--Color--200);

// body
--pf-c-tile__body--Color: var(--pf-global--Color--100);
--pf-c-tile__body--FontSize: var(--pf-global--FontSize--xs);
--pf-c-tile--disabled__body--Color: var(--pf-global--disabled-color--100);

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.

Suggested change
--pf-c-tile--disabled__body--Color: var(--pf-global--disabled-color--100);
--pf-c-tile--m-disabled__body--Color: var(--pf-global--disabled-color--100);

pointer-events: none;
cursor: not-allowed;

--pf-c-tile--BackgroundColor: var(--pf-c-tile--disabled--BackgroundColor);

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.

Suggested change
--pf-c-tile--BackgroundColor: var(--pf-c-tile--disabled--BackgroundColor);
--pf-c-tile--BackgroundColor: var(--pf-c-tile--m-disabled--BackgroundColor);

Comment on lines +73 to +74
--pf-c-tile__title--Color: var(--pf-c-tile--disabled__title--Color);
--pf-c-tile__body--Color: var(--pf-c-tile--disabled__body--Color);

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.

Suggested change
--pf-c-tile__title--Color: var(--pf-c-tile--disabled__title--Color);
--pf-c-tile__body--Color: var(--pf-c-tile--disabled__body--Color);
--pf-c-tile__title--Color: var(--pf-c-tile--m-disabled__title--Color);
--pf-c-tile__body--Color: var(--pf-c-tile--m-disabled__body--Color);

}

.pf-c-tile__header.pf-m-stacked .pf-c-tile__icon {
--pf-c-tile__icon--Color: var(--pf-c-tile--disabled__header--m-stacked__icon--Color);

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.

Suggested change
--pf-c-tile__icon--Color: var(--pf-c-tile--disabled__header--m-stacked__icon--Color);
--pf-c-tile__icon--Color: var(--pf-c-tile--m-disabled__header--m-stacked__icon--Color);

flex-direction: column;
justify-content: initial;

.pf-c-tile__icon {

@mattnolting mattnolting Jul 9, 2020 •

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.

Should you use the same pattern we use w/button in pf-m-start/end?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think design only calls for it to be on the left

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

display: flex;
justify-content: center;

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.

you probably want to add align-items: center; here, or at least on the display-lg.stacked icon selector since that has a defined height and the image may be shorter than the height

--pf-c-tile__title--Color: var(--pf-c-tile--m-disabled__title--Color);
--pf-c-tile__body--Color: var(--pf-c-tile--m-disabled__body--Color);
--pf-c-tile--before--BorderWidth: 0;
--pf-c-tile__icon--Color: var(--pf-c-tile--m-disabled__header--m-stacked__icon--Color);

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.

could this be renamed?

Suggested change
--pf-c-tile__icon--Color: var(--pf-c-tile--m-disabled__header--m-stacked__icon--Color);
--pf-c-tile__icon--Color: var(--pf-c-tile--m-disabled__icon--Color);

@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.

It's pretty much perfect!

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.

6 participants