Skip to content

report: add treemap button, refactor icon styles#12392

Merged
connorjclark merged 9 commits into
masterfrom
treemap-icon-button
Apr 28, 2021
Merged

report: add treemap button, refactor icon styles#12392
connorjclark merged 9 commits into
masterfrom
treemap-icon-button

Conversation

@connorjclark

@connorjclark connorjclark commented Apr 22, 2021

Copy link
Copy Markdown
Collaborator

Only shows if there is treemap data present.

We can also use this new icon button in devtools for the "View Trace" button.

ref #11254

tool menu before

image
image

second pass

image
image

first pass

image

hover

image

@connorjclark connorjclark requested a review from a team as a code owner April 22, 2021 00:16
@connorjclark connorjclark requested review from adamraine and removed request for a team April 22, 2021 00:16
@google-cla google-cla Bot added the cla: yes label Apr 22, 2021

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

We can also use this new icon button in devtools for the "View Trace" button.

Could we get the shape and style of this new button to match "View Trace"? Or are you planning to change "View Trace" down the line when treemap moves into the default config?

Comment thread lighthouse-core/report/html/renderer/report-ui-features.js Outdated
@connorjclark

connorjclark commented Apr 22, 2021

Copy link
Copy Markdown
Collaborator Author

Could we get the shape and style of this new button to match "View Trace"? Or are you planning to change "View Trace" down the line when treemap moves into the default config?

image
we could tweak the icon button a bit to match this. wdyt @paulirish

I planned to change the view trace button to use this icon button next release.

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

Could we get the shape and style of this new button to match "View Trace"? Or are you planning to change "View Trace" down the line when treemap moves into the default config?

image
we could tweak the icon button a bit to match this. wdyt @paulirish

yup lg! i was actually also tweaking the look and my first pass ended up with something quite similar:

image

Comment thread lighthouse-core/report/html/report-styles.css Outdated
Comment thread lighthouse-core/report/html/renderer/report-ui-features.js Outdated
Comment thread lighthouse-core/report/html/report-styles.css Outdated
@connorjclark

Copy link
Copy Markdown
Collaborator Author

Updated first post with new screenshots. I refactored tool-icon (renamed report-icon) to be reusable, and for the invert trick we use for the icon to not bleed over into other parts of the element (ty psuedoelements)

@connorjclark connorjclark changed the title report: add treemap icon button report: add treemap button Apr 27, 2021
@connorjclark connorjclark changed the title report: add treemap button report: add treemap button, refactor icon styles Apr 27, 2021

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

a few small things first, but seems good!

/**
* @param {{text: string, icon?: string, onClick: () => void}} opts
*/
createButton(opts) {

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.

addButton since it adds it to the dom? (from the name i didnt expect it to do the append too, but it makes sense)

background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="black"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M3 5v14h19V5H3zm2 2h15v4H5V7zm0 10v-4h4v4H5zm6 0v-4h9v4h-9z"/></svg>');
}

.lh-button {

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.

the component approach of the reusable report-icon in both dropdown items and lh-button makes sense after you think about it for a bit.

so.

yeah sure. cool. 👍

.lh-tools__button.active + .lh-tools__dropdown {
opacity: 1;
clip: rect(-1px, 187px, 242px, -3px);
clip: rect(-1px, 194px, 242px, -3px);

@paulirish paulirish Apr 28, 2021

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.

this clip is so weird. whyd we do it? ooh for a composited animation. geez. we're funny.

.dark .lh-tools__dropdown a:focus {
background-color: #BDBDBD;
}
/* copy icon needs slight adjustments to look great */

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.

this selector doesnt apply anymore fwiw.

it seemed weird so i checked it out. it seems to be shrinking the icon to not be so big.

image

IMO its not a huge deal so we can just nuke the rule. (or move it to .report-icon--copy::before)

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.

4 participants