Problem/Motivation

After adding the paragraph type icons in #2830016: Add a thumbnail/icon field to Paragraphs type we should use the icon to better identify the types.

The add button is sometimes not satisfyingly accessible with the type labels.

Proposed resolution

Show the type icons in the "Add paragraph" button prepending to the type labels.
This is truly optional.

User interface changes

Buttons will contain icons.

Comments

miro_dietiker created an issue. See original summary.

dennis cohn’s picture

Is this coming in the new version? Would love to see this happening.

miro_dietiker’s picture

Sure, but we first want to release a new Paragraphs version without the icon field... There are delays with signing off the release, hope we can unlock the progress this week.

toncic’s picture

Issue summary: View changes
StatusFileSize
new10.94 KB

I just try in browser to see how will looks. Here is the code which I added and the screenshot how it looks.

    padding-left: 40px;
    background: url(https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcS53Bs4N3AwZ8wfFSWktsb_uism7i2tgJDd3Bu0dIG9d1EoEPh5dmzvqA) no-repeat 8%;
    background-size: 20px;

miro_dietiker’s picture

Yeah, we discussed and felt like this could be the most simple start... (compared to adding an image tag inside the button...)
At least it makes the icons somehow visible.

The modal mode will be an option and we first need to figure out how well it works. There will be many follow-ups to care.
So i would vote to also bring in the icons here as a starting point.

toncic’s picture

StatusFileSize
new70.48 KB

Here is better mock-ups.

toncic’s picture

StatusFileSize
new30.99 KB

Updates for last mock-up.

miro_dietiker’s picture

I think the label should be left aligned.

Also if we do mockups, we should display the button in the different states including the expanded version.

You changed proportion of the mock-up. The text is much smaller or the buttod gained size and padding. Scale and proportion matters.

toncic’s picture

StatusFileSize
new151.69 KB

Updated mock-ups.

VladimirMarko’s picture

Issue summary: View changes
VladimirMarko’s picture

miro_dietiker’s picture

Priority: Normal » Minor

Demoting this to minor as the dropbutton has only very few space and we have a better way (overlay add) to visualise types while adding.

kevinquillen’s picture

I think this would be a better fit as a modal with larger icons. Not everything can be represented as a tiny image.

miro_dietiker’s picture

@kevinquillen Totally. We have separate issues around the modal that always referred to the image. When we defined this, the modal was a stretch goal. The fact that we have now the modal also was a reason to demote this to minor.

I kept it open since in our experiments with the Drop button a tiny icon was still better than none.

matiasmiranda’s picture

StatusFileSize
new107.06 KB
new216.7 KB
new3.29 MB
new4.9 KB

I added an option to the "display widget" config form to choose if you want to show the Paragraph type icon in the add button. If selected, the icon will be shown in the buttons, and also inline with the "select" widget (See screenshots).

I attach a patch.

please take a look

matiasmiranda’s picture

Status: Active » Needs review
matiasmiranda’s picture

StatusFileSize
new7.67 KB

Sorry I forgot to add new files. Here goes again.
Thanks

The last submitted patch, 15: display-type-icon-in-add-button-2833873-15.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 17: display-type-icon-in-add-button-2833873-15.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

wotts’s picture

StatusFileSize
new20.51 KB
new1.58 KB

I've made something that's not useable for the community; the patch is simply applicable for our own specific situation, however I still wanted to share. I've added a screenshot aswell.
Paragraphs Icons Gin example

It's a little patch and some custom CSS for Gin which we load in through a different module.

The custom CSS is super basic and looks like this:

#edit-field-paragraphs-add-more:has(> .field-add-more-submit.add-mode-button) {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
}

#edit-field-paragraphs-add-more > .field-add-more-submit.add-mode-button {
  height: 4rem;
  font-size: 14px;
  padding-left: 4.4rem;
  text-align: start;
  background-size: 4rem;
  background-position: left;
  background-repeat: no-repeat;
}

#edit-field-paragraphs-add-more > .field-add-more-submit.add-mode-button:hover {
  color: var(--gin-color-primary);
  background-color: var(--gin-bg-header);
}