Reazioni personalizzate di Discourse

Hello,

I made some CSS modification on Discourse Reactions Plugin. So it looks much like Facebook reaction buttons.

These for 6 reaction buttons including the default which is on my site is :heart: .

COMMON / SCSS
Place this code to common - css section.
Important notice: You can modify the emojis above label with edit content: 'Love it!', content: 'Beautiful' etc… lines: Of course you can use whatever reaction you want. It is just a label above the reactions.

.discourse-reactions-picker {
  .discourse-reactions-picker-container {
    width: 330px;
    height: 50px;
    max-width: calc(100vw - 2em);
    border: 1px solid var(--primary-low) !important;
    border-radius: 50px;
    .pickable-reaction {
      max-width: 100% !important;
      margin: 0 !important;
      padding: 0 !important;
    }
  }
  .pickable-reaction {
    background: transparent !important;
    .emoji {
      height: 40px;
      width: 40px;
      padding: 0 !important;
      transform: scale(0.9);
    }
    &.is-used {
      transform: scale(1.3);
      transform-origin: bottom;
      border: none !important;
    }
    &:hover {
      transform-origin: bottom;
    }
    &:hover:after {
      position: absolute;
      font-size: 10px;
      top: -15px;
      background: var(--secondary-low);
      color: var(--secondary);
      padding: 2px 5px;
      border-radius: 20px;
    }
    &:first-child {
      &:hover:after {
        content: 'Love it!';
      }
    }
    &:nth-child(2) {
      &:hover:after {
        content: 'Beautiful';
      }
    }
    &:nth-child(3) {
      &:hover:after {
        content: 'Hug';
      }
    }
    &:nth-child(4) {
      &:hover:after {
        content: 'Congrats!!';
      }
    }
    &:nth-child(5) {
      &:hover:after {
        content: 'Hmm...';
      }
    }
    &:nth-child(6) {
      &:hover:after {
        content: 'Wooow!';
      }
    }
  }
}

react-buttons


Mobile

On mobile I set position fixed the reactions picker position.

This is a possible option to prevent this strange behaviour. :arrow_down:
raction-no-fixed

Looks like this :arrow_down:
reactions-fixed

Same thing happening with state panel on mobile that was on reactions picker so also use position fixed.

Mobile / SCSS

.discourse-reactions-picker {
  position: fixed;
  .pickable-reaction {
    &:hover:after {
      font-size: 12px;
      top: -8px;
    }
    &.is-used {
      &:hover:after {
        transform: scale(0.8);
        top: -15px;
      }
    }
  }
}

.discourse-reactions-state-panel {
  position: fixed;
}

Hide default who liked section

COMMON / CSS

I hide the default who’s liked section because the Reactions State Panel also show those informations.

.who-liked {
  display: none;
}
25 Mi Piace

Like it very much :love_you_gesture:

5 Mi Piace

Awesone this works really nice. Thanks for sharing
:beers::sunglasses::+1::sparkles:

4 Mi Piace

I have it installed and I love it.

A question:

Is it possible to remove that black hover?

2 Mi Piace

Hi Paulina,

I am really glad you like it :heart: Thank you!

To hide the dark hovered user list panel use this code :slightly_smiling_face:

.discourse-reactions-list .reactions .user-list {
  display: none;
}
4 Mi Piace

It worked for me! I love the way it looks, thank you very much. :heart:

2 Mi Piace

Hi Don,

I like your customization very much. A great Job and thanks! :heart:
but I still have a question, how to get rid of the black hover like this?

Selection_060

3 Mi Piace

Hi Neo,

Thank you :heart:

Unfortunately that is not possible to hide title attribute with css but you can edit the js.discourse_reactions.picker.react_with text on /admin/customize/site_texts to make it less longer.

3 Mi Piace

Thanks, I’ve done with it, now it looks better! :wave:

3 Mi Piace

Questo è fantastico, @Don. Grazie mille.

Sto pensando di usarlo nella mia configurazione di Discourse, ma attualmente abbiamo due righe di opzioni di reazione (sei emoji per riga, quindi 12 emoji in totale).

So abbastanza di CSS per cavarmela, ma non è davvero il mio forte.

Quanto sarebbe difficile modificare questo codice in modo che funzioni per quel tipo di disposizione?

Apprezzo davvero la tua condivisione (anche se sono piuttosto in ritardo alla festa!).

3 Mi Piace

Grazie JR :slightly_smiling_face: Penso che creerò un componente tematico da questo per renderlo più facile da usare e adattarlo alle reazioni, aggiungere alcune correzioni, ecc… Spero che aiuti. Cercherò di realizzarlo la prossima settimana.

5 Mi Piace

Grazie mille, @Don! Sarebbe incredibile e un’aggiunta/integrazione molto apprezzata. Terrò sicuramente d’occhio.

3 Mi Piace

Happy So Excited GIF

2 Mi Piace

Ciao,

Ho creato un componente tematico da questo. Penso che renda le cose più facili. :slightly_smiling_face:

Grazie al componente tematico creato in precedenza da @manuel Category List with Banners posso implementare facilmente l’impostazione dell’elenco sull’etichetta delle reazioni. Grazie :heart:

Ho aggiunto correzioni e alcune impostazioni:

  1. reactions_label
    Separare con punto e virgola ;
    nome reazione;etichetta reazione
    May-29-2022 17-02-05

  2. reactions picker rounding
    Arrotondamento degli angoli del selettore delle reazioni (border-radius). Puoi usare px, em, ecc.
    Predefinito 1em.


    Se vuoi renderlo più o meno arrotondato, cambia questa impostazione.
    La versione precedente era 2em.

  3. state panel rounding
    Arrotondamento degli angoli del pannello di stato delle reazioni (border-radius). Puoi usare px, em, ecc.

  4. user list rounding
    Arrotondamento degli angoli dell’elenco utenti delle reazioni (border-radius). Puoi usare px, em, ecc.

  5. hide user list heading
    Questa opzione nasconderà l’intestazione dell’elenco utenti nel pannello. L’intestazione è smiley in questa immagine.

  6. hide user list
    Questa opzione nasconderà il pannello dell’elenco utenti. Questo è il pannello scuro con l’hover.

  7. hide who liked
    Questa opzione nasconderà la sezione predefinita “chi ha messo mi piace”.

Ho in programma ancora qualche idea con questo componente, che aggiungerò in seguito. :slightly_smiling_face:

17 Mi Piace