Skip to content
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

Review updates #10

Conversation

cchaos
Copy link

@cchaos cchaos commented May 29, 2020

I'll comment my thoughts/changes in the diff.

Copy link
Author

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Visually the main differences are:

Screen Shot 2020-05-29 at 17 02 37 PM

Readonly

Since we allow consumers to pick a color to render the expression in, if it's not clickable we're totally ignoring it and forcing the text color. We shouldn't do this, but align the visual more to how the normal expression works which just removes the border if it's not clickable. So in column layout we remove the background color if not clickbale.

Invalid

We don't need to restrict isInvalid to only the column style layout. The inline version can be too. So I've update the component to render the icon for both.

Active

This is where I sort of took a liberty. I felt the 2px border all the way around was a bit distracting because of how pronounced it was. My thought was, why don't we just keep with the bottom-border concept, and simply add that. I think it looks kinda cool because it's also almost like a shadow.

Screen Shot 2020-05-29 at 17 06 32 PM

Focus & hover

I think it's important to keep the coloring from the passed color prop to change the color of the background when in focus. I also added a text underline for both focus and hover states that align to what we do with buttons.

Screen Shot 2020-05-29 at 17 09 21 PM

@@ -103,7 +101,7 @@ export default () => {
};

const renderPopover1 = () => (
<div>
<div style={{ width: 300 }}>
Copy link
Author

Choose a reason for hiding this comment

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

These just makes sure the popover doesn't change size on selection change.

/>
<EuiSpacer />
<EuiTitle size="xxs">
<h3>Description width at 50px</h3>
Copy link
Author

Choose a reason for hiding this comment

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

This example now shows a more appropriate sized for the word "JOIN"

@@ -7,11 +7,11 @@
@include euiFontSizeS;
@include euiCodeFont;

border-bottom: 2px solid transparent;
border-bottom: $euiBorderWidthThick solid transparent;
Copy link
Author

Choose a reason for hiding this comment

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

We actually have a variable for this now

Comment on lines +26 to +28
border-color: transparent;
// Ensures there's no flash of the dashed style before turning solid for the active state
border-bottom-style: solid;
Copy link
Author

Choose a reason for hiding this comment

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

Keeps the border to only the bottom

Comment on lines -85 to -87
.euiPopover__anchor {
width: 100%;
}
Copy link
Author

Choose a reason for hiding this comment

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

Don't forget that you can't set external component-specific style like this. It will affect all usages. EuiPopover actually has a display="block" prop to help with this which I added to your examples.

*/
descriptionWidth?: number;
descriptionWidth?: number | string;
Copy link
Author

Choose a reason for hiding this comment

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

This allows the consumer to decide how they want to handle the sizing unit. Whether by pixel or percentage or some other unit like vw. Keeps it really flexible by simply passing any type that style.width accepts.

Comment on lines -111 to +116
let colorClass;
if (display === 'columns' && isInvalid) {
colorClass = colorToClassNameMap.danger;
} else {
colorClass = colorToClassNameMap[color];
}
const calculatedColor = isInvalid ? 'danger' : color;
Copy link
Author

Choose a reason for hiding this comment

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

Allows for all display types to be invalid

Comment on lines +132 to 139
const descriptionStyle = descriptionProps && descriptionProps.style;
const customWidth =
display === 'columns' && descriptionWidth
? {
flexBasis: `${descriptionWidth}%`,
flexBasis: descriptionWidth,
...descriptionStyle,
}
: undefined;
Copy link
Author

Choose a reason for hiding this comment

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

Need to also account for the fact that style is a property of descriptionProps. If a consumer passed descriptionProps.style it would have overridden the customWidth style.

</span>
{invalidIcon}
Copy link
Author

Choose a reason for hiding this comment

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

Simplified the internals now that all displays can be invalid.

Comment on lines +142 to +143
<EuiIcon
className="euiExpression__icon"
Copy link
Author

Choose a reason for hiding this comment

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

It's usually easier to just pass a class directly to the icon instead of creating a wrapper.

@cchaos
Copy link
Author

cchaos commented May 29, 2020

One other thing I would do, is create a new example section specifically for the isInvalid prop and you can show how it displays in both display types.

@cchaos
Copy link
Author

cchaos commented May 29, 2020

There also still seems to be a bit of a truncation issue. It might still be nice for consumers to be able to adjust this with a simple prop. Similar to how EuiCodeEditor handles whiteSpace you do for `wordWrap: 'truncate' | 'breakWord'.

Screen Shot 2020-05-29 at 17 20 10 PM

@andreadelrio andreadelrio merged commit b606ecc into andreadelrio:expression-truncate May 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
2 participants