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

Adds utility CSS classes to EUI #774

Merged
merged 6 commits into from
May 4, 2018
Merged

Conversation

snide
Copy link
Contributor

@snide snide commented May 3, 2018

Fixes #758

After seeing separate instances of people wanting to deal with text wrapping issues we decided it best to provide some CSS utility classes for common situations. Otherwise we'd need to add lots of optional props to our React components that might not target the individual piece of content (like a heading in a tooltip) that we want.

More discussion can be found in the issue above.

I'm purposefully keeping this list very small to start. For example, keeping out flexs and floats since we already have components that do a decent job at this type of thing.

image

@snide snide requested review from chandlerprall and cchaos May 3, 2018 23:44
@snide
Copy link
Contributor Author

snide commented May 4, 2018

jenkins test this

@chandlerprall
Copy link
Contributor

@snide lint error

17:52:24 > @elastic/[email protected] lint /app
17:52:24 > eslint --cache --ignore-pattern "/*.snap.js" "src//.js" "src-docs/**/.js"
17:52:24
17:52:43
17:52:43 /app/src-docs/src/views/utility_classes/utility_classes_example.js
17:52:43 10:3 error 'EuiCode' is defined but never used no-unused-vars
17:52:43
17:52:43 ✖ 1 problem (1 error, 0 warnings)

Copy link
Contributor

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

Thanks for building these. I just had a couple comments/questions.

<div className="eui-textCenter">
<EuiCode>.eui-textCenter</EuiCode>
</div>
<div className="eui-textRight">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why wouldn't they use EuiTextAlign for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They can. I think for a lot of these simple text treatments through really just some quicky classes are more convenient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example... Here's a common one...

<EuiFlexItem className="eui-textRight" />

Dunno. Just think some of these are so common you don't necessarily want to go through the process of importing a component and writing a couple extra lines of wrappers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I agree that having those will be nice, but I was just concerned about how far we go with utility classes that duplicate the functionality of components.

Copy link
Contributor

@cchaos cchaos May 4, 2018

Choose a reason for hiding this comment

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

Should we just remove the <EuiTextAlign> component in favor of these utility classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's ok to have both. Align gets imported into EuiText so I think we're ok there. Neither are really things that should ever change. I think it's OK to leave it.

I don't think we want many utility classes, and don't think we should take it very far. That's why I wanted to start small.


<div>
<EuiIcon type="logoElasticStack" size="xxl" />
<EuiCode className="eui-alignTop">.eui-alignTop</EuiCode>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would think you'd want to add these utilities to the icon instead. Especially for the baseline version:

On text

screen shot 2018-05-04 at 13 56 04 pm

On Icon

screen shot 2018-05-04 at 13 56 38 pm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense


<h4>Display</h4>

<EuiCode className="eui-block">.eui-block</EuiCode>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these classes be eui-displayBlock, eui-displayInline, etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with speed for some of these. For example, all the text ones don't say... eui--wordWrapBreakAll.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I'm indifferent. If we want to be more explicit that's fine as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just worried that "block" is ambiguous if someone is reading scanning the source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good I'll change it.

@snide snide force-pushed the feature/utility_classes branch from 07483af to 5915cc5 Compare May 4, 2018 20:24
@snide snide merged commit 3ae48ec into elastic:master May 4, 2018
@snide snide deleted the feature/utility_classes branch May 4, 2018 22:48
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.

3 participants