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

Add list element feature [Fixes #772] #1720

Merged
merged 9 commits into from Oct 2, 2018
Merged

Add list element feature [Fixes #772] #1720

merged 9 commits into from Oct 2, 2018

Conversation

danieldaeschle
Copy link
Contributor

This is a new feature.
How to update the docs/changelog?

Proposed solution

It adds a list element which was missing of the most of users

Testing Done

I checked in browser how it looks
image

@Log1x
Copy link
Contributor

Log1x commented Mar 12, 2018

You forgot to remove list.sass from elements when you changed it to a component.

Otherwise, looks good to me.

@danieldaeschle
Copy link
Contributor Author

Updated.

Copy link
Owner

@jgthms jgthms left a comment

Choose a reason for hiding this comment

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

Great first PR! You followed the guidelines. Some changes required though.

background-color: $list-background-color
border: $list-border
border-radius: $list-radius
.list-item
Copy link
Owner

Choose a reason for hiding this comment

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

I wouldn't nest this under .list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

where then?

border: $list-border
border-radius: $list-radius
.list-item
color: black
Copy link
Owner

Choose a reason for hiding this comment

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

Use color: $list-item-color and set the default value to $text.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes, my fault :O

border-radius: $list-radius
.list-item
color: black
cursor: default
Copy link
Owner

Choose a reason for hiding this comment

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

Remove this.

.list-item
color: black
cursor: default
display: flex
Copy link
Owner

Choose a reason for hiding this comment

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

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

without display: flex
image

color: black
cursor: default
display: flex
justify-content: flex-start
Copy link
Owner

Choose a reason for hiding this comment

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

Remove this.

cursor: default
display: flex
justify-content: flex-start
padding: 8px 16px
Copy link
Owner

Choose a reason for hiding this comment

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

Use padding: 0.5em 1em

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 didn't understand em and rem until today xD

padding: 8px 16px
&:not(:last-child)
border-bottom: $list-item-border
& .is-hoverable:hover
Copy link
Owner

Choose a reason for hiding this comment

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

I like this idea. But the syntax is &.is-hoverable:hover (without the space) and should be nested under .list-item.

Also, can you add a &.is-active state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which color should it have? i tried to give it primary but then the text color is still black

Copy link
Contributor Author

@danieldaeschle danieldaeschle left a comment

Choose a reason for hiding this comment

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

Some more improvements?

.list-item
color: black
cursor: default
display: flex
Copy link
Contributor Author

Choose a reason for hiding this comment

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

without display: flex
image

padding: 8px 16px
&:not(:last-child)
border-bottom: $list-item-border
& .is-hoverable:hover
Copy link
Contributor Author

Choose a reason for hiding this comment

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

which color should it have? i tried to give it primary but then the text color is still black

@KKSzymanowski
Copy link
Contributor

With the current implementation card appears to be slightly wider then the list because of border instead of box shadow. Switching to box shadow fixes this and, in my opinion, gives a nicer feel to it:

.list
  background-color: $list-background-color
- border: $list-border
+ box-shadow: $card-shadow
  border-radius: $list-radius
  &.is-hoverable > .list-item:hover:not(.is-active)
    background-color: $list-item-hover-color
    cursor: pointer

image

@danieldaeschle danieldaeschle changed the title Add list element feature Fixes #772 Add list element feature [Fixes #772] Mar 13, 2018
@KKSzymanowski
Copy link
Contributor

Also, one of my use-cases for this list would be either a key value list or a list of labels and icons:

<div class="list">
    <div class="list-item">
        <div class="level">
            <div class="level-left">
                First
            </div>
            <div class="level-right">
                <i class="fa fa-check fa-fw"></i>
            </div>
        </div>
    </div>
</div>

image

But because of the display: flex on the .list-item the level element doesn't fill the entire width:

image

What would be the workaround for that?

@danieldaeschle
Copy link
Contributor Author

eventually display: block is the solution? :)

@KKSzymanowski
Copy link
Contributor

Yeah, that's how I did it for the screenshot, but I thought the flex display was there for a reason.

@danieldaeschle
Copy link
Contributor Author

What does @jgthms think about the border?

@jgthms
Copy link
Owner

jgthms commented Mar 13, 2018

The shadow is a good shout. Let’s put that instead of the border.

@KKSzymanowski
Copy link
Contributor

I haven't noticed this before but left padding is not consistent with the card.
image

Wouldn't it be better to change the list item padding to 0.75 and switch em to rem?

@danieldaeschle
Copy link
Contributor Author

padding: 0.5rem 0.75rem then? or padding: 0.5em 0.75rem ? what is the different?

@KKSzymanowski
Copy link
Contributor

In my opinion padding: 0.5rem 0.75rem (or even padding: 0.375rem 0.75rem).

what is the different?

em refers to the subject's font size whereas rem refers to the root(<html>) font size.

.list-item
color: $list-item-color
display: block
padding: 0.375rem 0.75rem
Copy link
Owner

Choose a reason for hiding this comment

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

You need padding: 0.5em 1em here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jgthms Why is the 0.5em 1em padding better than 0.375rem 0.75rem?

Copy link
Owner

Choose a reason for hiding this comment

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

Uses emso it's proportional to the list's font size, and just looks better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I get the second part, but don't understand how do you decide whether to use rem or em.
For vertical margins(level, card, panel) you tend to use rem but sometimes(form label) you use em.
For horizontal margins you tend to use em but sometimes(tags) you use rem.
Similarly for paddings.
What's your rule of thumb when it comes to these units?

I feel like I'm being annoying but I just want to understand your train of though.

Copy link
Owner

Choose a reason for hiding this comment

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

Margin is between elements, hence a common denominator like rem. Padding is within an element and the visual balance is assured when everything is proportional to the font size hence em.

Button padding is em. Same for form controls.


$list-item-border: 1px solid $border !default
$list-item-color: $text !default
$list-item-active-color: $primary !default
Copy link
Owner

Choose a reason for hiding this comment

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

$list-item-active-background-color: $link !default

$list-item-border: 1px solid $border !default
$list-item-color: $text !default
$list-item-active-color: $primary !default
$list-item-active-text-color: $white !default
Copy link
Owner

Choose a reason for hiding this comment

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

$list-item-active-color: $link-invert !default

$list-item-color: $text !default
$list-item-active-color: $primary !default
$list-item-active-text-color: $white !default
$list-item-hover-color: $background !default
Copy link
Owner

Choose a reason for hiding this comment

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

$list-item-hover-background-color: $background !default

@danieldaeschle
Copy link
Contributor Author

Ready to merge?


.list
background-color: $list-background-color
box-shadow: $card-shadow
Copy link
Owner

Choose a reason for hiding this comment

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

Don’t reference a variable from another file. Create a new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

xD

@danieldaeschle
Copy link
Contributor Author

Feedback?

@danieldaeschle
Copy link
Contributor Author

push

@HDVinnie
Copy link

Any update? Will this be merged?

@augustinbegue
Copy link

Any updates ? I think this feature would be very usefull

@frederikhors
Copy link

@jgthms can you please merge? Is there another collaborator who can do it for you?

@frederikhors
Copy link

@danieldaeschle can you update docs?

@danieldaeschle
Copy link
Contributor Author

My english is notj good enough to write fancy docs. i can do it but now yet and only if @jgthms says he will merge it then.

@KKSzymanowski
Copy link
Contributor

Do what you can and tag us, we'll help you out.

@danieldaeschle
Copy link
Contributor Author

Thanks, but I'm waiting for confirmation from @jgthms

@jgthms jgthms merged commit e6e4a5a into jgthms:master Oct 2, 2018
@danieldaeschle
Copy link
Contributor Author

Wow, thanks :)

@jgthms
Copy link
Owner

jgthms commented Oct 2, 2018

No, thank you! 😉

@frederikhors
Copy link

@danieldaeschle any docs? How to use? With english we can help.

@KKSzymanowski
Copy link
Contributor

@frederikhors Not much to it:

<div class="list">
    <div class="list-item">First</div>
    <div class="list-item is-active">Second</div>
    <div class="list-item">Third</div>
</div>

If you want the items behaving like links:

<div class="list is-hoverable">
    <div class="list-item">First</div>
    <div class="list-item is-active">Second</div>
    <div class="list-item">Third</div>
</div>

@nandordudas
Copy link

Link of list is missing at components, i try with url and it works.
https://bulma.io/documentation/components/list/

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.

None yet

8 participants